Lines Matching refs:part

259 static unsigned long mmc_read_and_flush(struct mmc_part *part,  in mmc_read_and_flush()  argument
269 if (start < part->info.start) { in mmc_read_and_flush()
273 if ((start + sectors) > (part->info.start + part->info.size)) { in mmc_read_and_flush()
274 sectors = part->info.start + part->info.size - start; in mmc_read_and_flush()
288 if (sectors > buf_size / part->info.blksz) in mmc_read_and_flush()
289 sectors = buf_size / part->info.blksz; in mmc_read_and_flush()
294 blks = blk_dread(part->mmc_blk, in mmc_read_and_flush()
297 flush_cache((ulong)tmp_buf, sectors * part->info.blksz); in mmc_read_and_flush()
300 memcpy(buffer, tmp_buf, sectors * part->info.blksz); in mmc_read_and_flush()
305 static unsigned long mmc_write(struct mmc_part *part, lbaint_t start, in mmc_write() argument
312 if (start < part->info.start) { in mmc_write()
316 if ((start + sectors) > (part->info.start + part->info.size)) { in mmc_write()
317 sectors = part->info.start + part->info.size - start; in mmc_write()
325 if (sectors > buf_size / part->info.blksz) in mmc_write()
326 sectors = buf_size / part->info.blksz; in mmc_write()
328 memcpy(tmp_buf, buffer, sectors * part->info.blksz); in mmc_write()
333 return blk_dwrite(part->mmc_blk, in mmc_write()
342 struct mmc_part *part; in get_partition() local
345 part = malloc(sizeof(struct mmc_part)); in get_partition()
346 if (!part) in get_partition()
350 part->mmc = find_mmc_device(dev_num); in get_partition()
351 if (!part->mmc) { in get_partition()
356 if (mmc_init(part->mmc)) { in get_partition()
361 ret = mmc_switch_part(part->mmc, part_num); in get_partition()
365 mmc_blk = mmc_get_blk_desc(part->mmc); in get_partition()
371 ret = part_get_info_by_name(mmc_blk, partition, &part->info); in get_partition()
377 part->dev_num = dev_num; in get_partition()
378 part->mmc_blk = mmc_blk; in get_partition()
380 return part; in get_partition()
382 free(part); in get_partition()
395 struct mmc_part *part; in mmc_byte_io() local
403 part = get_partition(ops, partition); in mmc_byte_io()
404 if (!part) in mmc_byte_io()
407 if (!part->info.blksz) in mmc_byte_io()
410 start_offset = calc_offset(part, offset); in mmc_byte_io()
412 start_sector = start_offset / part->info.blksz; in mmc_byte_io()
413 sectors = num_bytes / part->info.blksz; in mmc_byte_io()
415 if (start_offset % part->info.blksz || in mmc_byte_io()
416 num_bytes < part->info.blksz) { in mmc_byte_io()
418 if (start_offset % part->info.blksz) { in mmc_byte_io()
419 residue = part->info.blksz - in mmc_byte_io()
420 (start_offset % part->info.blksz); in mmc_byte_io()
428 ret = mmc_read_and_flush(part, in mmc_byte_io()
429 part->info.start + in mmc_byte_io()
442 tmp_buf += (start_offset % part->info.blksz); in mmc_byte_io()
445 ret = mmc_read_and_flush(part, in mmc_byte_io()
446 part->info.start + in mmc_byte_io()
456 start_offset % part->info.blksz, in mmc_byte_io()
459 ret = mmc_write(part, part->info.start + in mmc_byte_io()
477 ret = mmc_read_and_flush(part, in mmc_byte_io()
478 part->info.start + in mmc_byte_io()
482 ret = mmc_write(part, in mmc_byte_io()
483 part->info.start + in mmc_byte_io()
493 io_cnt += ret * part->info.blksz; in mmc_byte_io()
494 buffer += ret * part->info.blksz; in mmc_byte_io()
495 start_offset += ret * part->info.blksz; in mmc_byte_io()
496 num_bytes -= ret * part->info.blksz; in mmc_byte_io()
806 struct mmc_part *part; in get_unique_guid_for_partition() local
809 part = get_partition(ops, partition); in get_unique_guid_for_partition()
810 if (!part) in get_unique_guid_for_partition()
813 uuid_size = sizeof(part->info.uuid); in get_unique_guid_for_partition()
817 memcpy(guid_buf, part->info.uuid, uuid_size); in get_unique_guid_for_partition()
840 struct mmc_part *part; in get_size_of_partition() local
845 part = get_partition(ops, partition); in get_size_of_partition()
846 if (!part) in get_size_of_partition()
849 *out_size_num_bytes = part->info.blksz * part->info.size; in get_size_of_partition()