Lines Matching refs:part

256 static unsigned long mmc_read_and_flush(struct mmc_part *part,  in mmc_read_and_flush()  argument
266 if (start < part->info.start) { in mmc_read_and_flush()
270 if ((start + sectors) > (part->info.start + part->info.size)) { in mmc_read_and_flush()
271 sectors = part->info.start + part->info.size - start; in mmc_read_and_flush()
285 if (sectors > buf_size / part->info.blksz) in mmc_read_and_flush()
286 sectors = buf_size / part->info.blksz; in mmc_read_and_flush()
291 blks = part->mmc->block_dev.block_read(part->mmc_blk, in mmc_read_and_flush()
294 flush_cache((ulong)tmp_buf, sectors * part->info.blksz); in mmc_read_and_flush()
297 memcpy(buffer, tmp_buf, sectors * part->info.blksz); in mmc_read_and_flush()
302 static unsigned long mmc_write(struct mmc_part *part, lbaint_t start, in mmc_write() argument
309 if (start < part->info.start) { in mmc_write()
313 if ((start + sectors) > (part->info.start + part->info.size)) { in mmc_write()
314 sectors = part->info.start + part->info.size - start; in mmc_write()
322 if (sectors > buf_size / part->info.blksz) in mmc_write()
323 sectors = buf_size / part->info.blksz; in mmc_write()
325 memcpy(tmp_buf, buffer, sectors * part->info.blksz); in mmc_write()
330 return part->mmc->block_dev.block_write(part->mmc_blk, in mmc_write()
339 struct mmc_part *part; in get_partition() local
342 part = malloc(sizeof(struct mmc_part)); in get_partition()
343 if (!part) in get_partition()
347 part->mmc = find_mmc_device(dev_num); in get_partition()
348 if (!part->mmc) { in get_partition()
353 if (mmc_init(part->mmc)) { in get_partition()
358 ret = mmc_switch_part(part->mmc, part_num); in get_partition()
362 mmc_blk = mmc_get_blk_desc(part->mmc); in get_partition()
368 ret = part_get_info_by_name(mmc_blk, partition, &part->info); in get_partition()
374 part->dev_num = dev_num; in get_partition()
375 part->mmc_blk = mmc_blk; in get_partition()
377 return part; in get_partition()
389 struct mmc_part *part; in mmc_byte_io() local
397 part = get_partition(ops, partition); in mmc_byte_io()
398 if (!part) in mmc_byte_io()
401 start_offset = calc_offset(part, offset); in mmc_byte_io()
403 start_sector = start_offset / part->info.blksz; in mmc_byte_io()
404 sectors = num_bytes / part->info.blksz; in mmc_byte_io()
406 if (start_offset % part->info.blksz || in mmc_byte_io()
407 num_bytes < part->info.blksz) { in mmc_byte_io()
409 if (start_offset % part->info.blksz) { in mmc_byte_io()
410 residue = part->info.blksz - in mmc_byte_io()
411 (start_offset % part->info.blksz); in mmc_byte_io()
419 ret = mmc_read_and_flush(part, in mmc_byte_io()
420 part->info.start + in mmc_byte_io()
433 tmp_buf += (start_offset % part->info.blksz); in mmc_byte_io()
436 ret = mmc_read_and_flush(part, in mmc_byte_io()
437 part->info.start + in mmc_byte_io()
447 start_offset % part->info.blksz, in mmc_byte_io()
450 ret = mmc_write(part, part->info.start + in mmc_byte_io()
468 ret = mmc_read_and_flush(part, in mmc_byte_io()
469 part->info.start + in mmc_byte_io()
473 ret = mmc_write(part, in mmc_byte_io()
474 part->info.start + in mmc_byte_io()
484 io_cnt += ret * part->info.blksz; in mmc_byte_io()
485 buffer += ret * part->info.blksz; in mmc_byte_io()
486 start_offset += ret * part->info.blksz; in mmc_byte_io()
487 num_bytes -= ret * part->info.blksz; in mmc_byte_io()
684 struct mmc_part *part; in get_unique_guid_for_partition() local
687 part = get_partition(ops, partition); in get_unique_guid_for_partition()
688 if (!part) in get_unique_guid_for_partition()
691 uuid_size = sizeof(part->info.uuid); in get_unique_guid_for_partition()
695 memcpy(guid_buf, part->info.uuid, uuid_size); in get_unique_guid_for_partition()