Lines Matching refs:ssfdc

240 static int build_logical_block_map(struct ssfdcr_record *ssfdc)  in build_logical_block_map()  argument
245 struct mtd_info *mtd = ssfdc->mbd.mtd; in build_logical_block_map()
248 ssfdc->map_len, in build_logical_block_map()
249 (unsigned long)ssfdc->map_len * ssfdc->erase_size / 1024); in build_logical_block_map()
252 for (phys_block = ssfdc->cis_block + 1; phys_block < ssfdc->map_len; in build_logical_block_map()
254 offset = (unsigned long)phys_block * ssfdc->erase_size; in build_logical_block_map()
273 ssfdc->logic_block_map[block_address] = in build_logical_block_map()
286 struct ssfdcr_record *ssfdc; in ssfdcr_add_mtd() local
299 ssfdc = kzalloc(sizeof(struct ssfdcr_record), GFP_KERNEL); in ssfdcr_add_mtd()
300 if (!ssfdc) in ssfdcr_add_mtd()
303 ssfdc->mbd.mtd = mtd; in ssfdcr_add_mtd()
304 ssfdc->mbd.devnum = -1; in ssfdcr_add_mtd()
305 ssfdc->mbd.tr = tr; in ssfdcr_add_mtd()
306 ssfdc->mbd.readonly = 1; in ssfdcr_add_mtd()
308 ssfdc->cis_block = cis_sector / (mtd->erasesize >> SECTOR_SHIFT); in ssfdcr_add_mtd()
309 ssfdc->erase_size = mtd->erasesize; in ssfdcr_add_mtd()
310 ssfdc->map_len = (u32)mtd->size / mtd->erasesize; in ssfdcr_add_mtd()
313 ssfdc->cis_block, ssfdc->erase_size, ssfdc->map_len, in ssfdcr_add_mtd()
314 DIV_ROUND_UP(ssfdc->map_len, MAX_PHYS_BLK_PER_ZONE)); in ssfdcr_add_mtd()
317 ssfdc->heads = 16; in ssfdcr_add_mtd()
318 ssfdc->sectors = 32; in ssfdcr_add_mtd()
319 get_chs(mtd->size, NULL, &ssfdc->heads, &ssfdc->sectors); in ssfdcr_add_mtd()
320 ssfdc->cylinders = (unsigned short)(((u32)mtd->size >> SECTOR_SHIFT) / in ssfdcr_add_mtd()
321 ((long)ssfdc->sectors * (long)ssfdc->heads)); in ssfdcr_add_mtd()
324 ssfdc->cylinders, ssfdc->heads , ssfdc->sectors, in ssfdcr_add_mtd()
325 (long)ssfdc->cylinders * (long)ssfdc->heads * in ssfdcr_add_mtd()
326 (long)ssfdc->sectors); in ssfdcr_add_mtd()
328 ssfdc->mbd.size = (long)ssfdc->heads * (long)ssfdc->cylinders * in ssfdcr_add_mtd()
329 (long)ssfdc->sectors; in ssfdcr_add_mtd()
332 ssfdc->logic_block_map = in ssfdcr_add_mtd()
333 kmalloc_array(ssfdc->map_len, in ssfdcr_add_mtd()
334 sizeof(ssfdc->logic_block_map[0]), GFP_KERNEL); in ssfdcr_add_mtd()
335 if (!ssfdc->logic_block_map) in ssfdcr_add_mtd()
337 memset(ssfdc->logic_block_map, 0xff, sizeof(ssfdc->logic_block_map[0]) * in ssfdcr_add_mtd()
338 ssfdc->map_len); in ssfdcr_add_mtd()
341 if (build_logical_block_map(ssfdc) < 0) in ssfdcr_add_mtd()
345 if (add_mtd_blktrans_dev(&ssfdc->mbd)) in ssfdcr_add_mtd()
349 ssfdc->mbd.devnum + 'a', mtd->index, mtd->name); in ssfdcr_add_mtd()
353 kfree(ssfdc->logic_block_map); in ssfdcr_add_mtd()
354 kfree(ssfdc); in ssfdcr_add_mtd()
359 struct ssfdcr_record *ssfdc = (struct ssfdcr_record *)dev; in ssfdcr_remove_dev() local
364 kfree(ssfdc->logic_block_map); in ssfdcr_remove_dev()
370 struct ssfdcr_record *ssfdc = (struct ssfdcr_record *)dev; in ssfdcr_readsect() local
373 sectors_per_block = ssfdc->erase_size >> SECTOR_SHIFT; in ssfdcr_readsect()
381 BUG_ON(block_address >= ssfdc->map_len); in ssfdcr_readsect()
383 block_address = ssfdc->logic_block_map[block_address]; in ssfdcr_readsect()
397 if (read_physical_sector(ssfdc->mbd.mtd, buf, sect_no) < 0) in ssfdcr_readsect()
408 struct ssfdcr_record *ssfdc = (struct ssfdcr_record *)dev; in ssfdcr_getgeo() local
411 ssfdc->cylinders, ssfdc->heads, ssfdc->sectors); in ssfdcr_getgeo()
413 geo->heads = ssfdc->heads; in ssfdcr_getgeo()
414 geo->sectors = ssfdc->sectors; in ssfdcr_getgeo()
415 geo->cylinders = ssfdc->cylinders; in ssfdcr_getgeo()