Beispiel #1
0
int __sata_initialize(void)
{
	int rc;
	int i;

	for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) {
		memset(&sata_dev_desc[i], 0, sizeof(struct blk_desc));
		sata_dev_desc[i].if_type = IF_TYPE_SATA;
		sata_dev_desc[i].devnum = i;
		sata_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
		sata_dev_desc[i].type = DEV_TYPE_HARDDISK;
		sata_dev_desc[i].lba = 0;
		sata_dev_desc[i].blksz = 512;
		sata_dev_desc[i].log2blksz = LOG2(sata_dev_desc[i].blksz);
#ifndef CONFIG_BLK
		sata_dev_desc[i].block_read = sata_bread;
		sata_dev_desc[i].block_write = sata_bwrite;
#endif
		rc = init_sata(i);
		if (!rc) {
			rc = scan_sata(i);
			if (!rc && sata_dev_desc[i].lba > 0 &&
			    sata_dev_desc[i].blksz > 0)
				part_init(&sata_dev_desc[i]);
		}
	}

	return rc;
}
Beispiel #2
0
int __sata_initialize(void)
{
	int rc;
	int i;

	for (i = 0; i < CONFIG_SYS_SATA_MAX_DEVICE; i++) {
		memset(&sata_dev_desc[i], 0, sizeof(struct block_dev_desc));
		sata_dev_desc[i].if_type = IF_TYPE_SATA;
		sata_dev_desc[i].dev = i;
		sata_dev_desc[i].part_type = PART_TYPE_UNKNOWN;
		sata_dev_desc[i].type = DEV_TYPE_HARDDISK;
		sata_dev_desc[i].lba = 0;
		sata_dev_desc[i].blksz = 512;
		sata_dev_desc[i].log2blksz = LOG2(sata_dev_desc[i].blksz);
		sata_dev_desc[i].block_read = sata_read;
		sata_dev_desc[i].block_write = sata_write;

		rc = init_sata(i);
		if (!rc) {
			rc = scan_sata(i);
			if (!rc && (sata_dev_desc[i].lba > 0) &&
				(sata_dev_desc[i].blksz > 0))
				init_part(&sata_dev_desc[i]);
		}
	}
	sata_curr_device = 0;
	return rc;
}
Beispiel #3
0
static int warp_ata_init(int dev, disk_partition_t * info,
                         block_dev_desc_t ** dev_desc)
{
    int ret;
    u32 lun, part;
    block_dev_desc_t *sata_get_dev(int dev);

    lun = WARP_DEV_TO_LUN(dev);
    part = WARP_DEV_TO_PART(dev);

    if (sata_dev_desc[lun].if_type != IF_TYPE_SATA) {
        memset(&sata_dev_desc[lun], 0, sizeof(struct block_dev_desc));
        sata_dev_desc[lun].if_type = IF_TYPE_SATA;
        sata_dev_desc[lun].dev = lun;
        sata_dev_desc[lun].part_type = PART_TYPE_UNKNOWN;
        sata_dev_desc[lun].type = DEV_TYPE_HARDDISK;
        sata_dev_desc[lun].lba = 0;
        sata_dev_desc[lun].blksz = 512;
        sata_dev_desc[lun].block_read = sata_read;
        sata_dev_desc[lun].block_write = sata_write;

        if ((ret = init_sata(lun)))
            return ret;
        if ((ret = scan_sata(lun)))
            return ret;
        if ((sata_dev_desc[lun].lba > 0) && (sata_dev_desc[lun].blksz > 0))
            init_part(&sata_dev_desc[lun]);
    }

    if ((*dev_desc = sata_get_dev(lun)) == NULL) {
        printf("device %d not found\n", lun);
        return -1;
    }

    if (part == 0) {
        info->start = 0;
        return 0;
    }

    if ((ret = get_partition_info(*dev_desc, part, info)) != 0) {
        printf("partition %d:%d not found\n", lun, part);
        return ret;
    }

    return 0;
}