diff options
author | sos <sos@FreeBSD.org> | 2008-04-13 16:05:34 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 2008-04-13 16:05:34 +0000 |
commit | a3d2be176f396ea6c3fc51b7ca25b82d6680924a (patch) | |
tree | 9cb10410dd9aec05a81a9da9ac64651fa5aac7b5 | |
parent | 8a08087c0abff744976a0377efdc8cf787fba0d8 (diff) | |
download | FreeBSD-src-a3d2be176f396ea6c3fc51b7ca25b82d6680924a.zip FreeBSD-src-a3d2be176f396ea6c3fc51b7ca25b82d6680924a.tar.gz |
Fix identify of slave devices.
-rw-r--r-- | sys/dev/ata/ata-all.h | 2 | ||||
-rw-r--r-- | sys/dev/ata/ata-raid.c | 15 |
2 files changed, 8 insertions, 9 deletions
diff --git a/sys/dev/ata/ata-all.h b/sys/dev/ata/ata-all.h index 5065661..69531b0 100644 --- a/sys/dev/ata/ata-all.h +++ b/sys/dev/ata/ata-all.h @@ -301,7 +301,7 @@ struct ata_ahci_cmd_list { #define ATA_PC98_CTLADDR_RID 8 #define ATA_PC98_BANKADDR_RID 9 #define ATA_IRQ_RID 0 -#define ATA_DEV(unit) ((unit == ATA_ATA_SLAVE) ? 0x10 : 0) +#define ATA_DEV(unit) ((unit > 0) ? 0x10 : 0) #define ATA_CFA_MAGIC1 0x844A #define ATA_CFA_MAGIC2 0x848A #define ATA_CFA_MAGIC3 0x8400 diff --git a/sys/dev/ata/ata-raid.c b/sys/dev/ata/ata-raid.c index 01c586b..d7dfac0 100644 --- a/sys/dev/ata/ata-raid.c +++ b/sys/dev/ata/ata-raid.c @@ -1669,9 +1669,8 @@ ata_raid_adaptec_read_meta(device_t dev, struct ar_softc **raidp) if (be32toh(meta->generation) >= raid->generation) { struct ata_device *atadev = device_get_softc(parent); struct ata_channel *ch = device_get_softc(GRANDPARENT(dev)); - int disk_number = (ch->unit << !(ch->flags & ATA_NO_SLAVE)) + - ATA_DEV(atadev->unit); - + int disk_number = + (ch->unit << !(ch->flags & ATA_NO_SLAVE)) + atadev->unit; raid->disks[disk_number].dev = parent; raid->disks[disk_number].sectors = be32toh(meta->configs[disk_number + 1].sectors); @@ -2303,7 +2302,7 @@ ata_raid_intel_write_meta(struct ar_softc *rdp) bcopy(atadev->param.serial, meta->disk[disk].serial, sizeof(rdp->disks[disk].serial)); meta->disk[disk].sectors = rdp->disks[disk].sectors; - meta->disk[disk].id = (ch->unit << 16) | ATA_DEV(atadev->unit); + meta->disk[disk].id = (ch->unit << 16) | atadev->unit; } else meta->disk[disk].sectors = rdp->total_sectors / rdp->width; @@ -3328,7 +3327,7 @@ ata_raid_promise_write_meta(struct ar_softc *rdp) device_get_softc(device_get_parent(rdp->disks[disk].dev)); meta->raid.channel = ch->unit; - meta->raid.device = ATA_DEV(atadev->unit); + meta->raid.device = atadev->unit; meta->raid.disk_sectors = rdp->disks[disk].sectors; meta->raid.disk_offset = rdp->offset_sectors; } @@ -3416,7 +3415,7 @@ ata_raid_promise_write_meta(struct ar_softc *rdp) device_get_softc(rdp->disks[drive].dev); meta->raid.disk[drive].channel = ch->unit; - meta->raid.disk[drive].device = ATA_DEV(atadev->unit); + meta->raid.disk[drive].device = atadev->unit; } meta->raid.disk[drive].magic_0 = PR_MAGIC0(meta->raid.disk[drive]) | timestamp.tv_sec; @@ -3742,7 +3741,7 @@ ata_raid_sis_write_meta(struct ar_softc *rdp) struct ata_channel *ch = device_get_softc(device_get_parent(rdp->disks[disk].dev)); struct ata_device *atadev = device_get_softc(rdp->disks[disk].dev); - int disk_number = 1 + ATA_DEV(atadev->unit) + (ch->unit << 1); + int disk_number = 1 + atadev->unit + (ch->unit << 1); meta->disks |= disk_number << ((1 - disk) << 2); } @@ -3780,7 +3779,7 @@ ata_raid_sis_write_meta(struct ar_softc *rdp) bcopy(atadev->param.model, meta->model, sizeof(meta->model)); /* XXX SOS if total_disks > 2 this may not float */ - meta->disk_number = 1 + ATA_DEV(atadev->unit) + (ch->unit << 1); + meta->disk_number = 1 + atadev->unit + (ch->unit << 1); if (testing || bootverbose) ata_raid_sis_print_meta(meta); |