Support newer Highpoint BIOS's extended config.

This commit is contained in:
Søren Schmidt 2002-03-08 11:33:52 +00:00
parent b8ad1eb270
commit 84409b36ca
2 changed files with 25 additions and 23 deletions

View File

@ -814,8 +814,11 @@ ar_highpoint_write_conf(struct ar_softc *rdp)
if ((rdp->disks[disk].flags & (AR_DF_PRESENT | AR_DF_ONLINE)) ==
(AR_DF_PRESENT | AR_DF_ONLINE))
config->magic = HPT_MAGIC_OK;
if (rdp->disks[disk].flags & AR_DF_ASSIGNED)
if (rdp->disks[disk].flags & AR_DF_ASSIGNED) {
config->magic_0 = rdp->magic_0;
config->magic_2 = HPT_MAGIC_2;
strcpy(config->name_1, "FreeBSD ATARAID");
}
config->disk_number = disk;
switch (rdp->flags & (AR_F_RAID0 | AR_F_RAID1 | AR_F_SPAN)) {
@ -825,44 +828,36 @@ ar_highpoint_write_conf(struct ar_softc *rdp)
config->order = HPT_O_READY;
else
config->order = HPT_O_DOWN;
strcpy(config->name_2, "RAID 0");
break;
case AR_F_RAID1:
config->type = HPT_T_RAID1;
config->disk_number = (disk < rdp->width) ? disk : disk + 10;
strcpy(config->name_2, "RAID 1");
break;
case AR_F_RAID0 | AR_F_RAID1:
config->magic_1 = rdp->magic_1;
config->type = HPT_T_RAID01_RAID0;
#if 0
if ((rdp->flags & (AR_F_READY | AR_F_DEGRADED)) == AR_F_READY)
if (disk < rdp->width)
config->order = HPT_O_RAID01SRC;
else
config->order = HPT_O_RAID01DST;
else
if (rdp->disks[disk].flags & AR_DF_ONLINE)
config->order = HPT_O_RAID01DEGRADED;
else
config->order = HPT_O_DOWN;
#else
if (rdp->disks[disk].flags & AR_DF_ONLINE)
if (disk < rdp->width)
if (disk < rdp->width) {
config->order = HPT_O_RAID01SRC;
else
config->magic_0 = rdp->magic_0 - 1;
strcpy(config->name_2, "RAID 0+1 SRC");
}
else {
config->order = HPT_O_RAID01DST;
config->disk_number -= rdp->width;
strcpy(config->name_2, "RAID 0+1 DST");
}
else
config->order = HPT_O_DOWN;
#endif
if (disk >= rdp->width) {
config->magic_0 = rdp->magic_0 + 1;
config->disk_number -= rdp->width;
}
break;
case AR_F_SPAN:
config->type = HPT_T_SPAN;
strcpy(config->name_2, "SPAN");
break;
}
@ -1174,7 +1169,7 @@ ar_rw(struct ad_softc *adp, u_int32_t lba, int count, caddr_t data, int flags)
if (flags & AR_WAIT)
bp->bio_done = (void *)wakeup;
else
bp->bio_done = ar_rw_done;
bp->bio_done = ar_rw_done;
AR_STRATEGY(bp);
if (flags & AR_WAIT) {
error = tsleep(bp, PRIBIO, "arrw", 0);

View File

@ -35,7 +35,7 @@
#define AR_READ 0x01
#define AR_WRITE 0x02
#define AR_WAIT 0x04
#define AR_STRATEGY(x) (x)->bio_dev->si_disk->d_devsw->d_strategy((x))
#define AR_STRATEGY(x) (x)->bio_dev->si_disk->d_devsw->d_strategy((x))
#define AD_SOFTC(x) ((struct ad_softc *)(x.device->driver))
struct ar_disk {
@ -137,7 +137,14 @@ struct highpoint_raid_conf {
u_int8_t sectors;
u_int32_t lba;
} errorlog[32];
int8_t filler2[60];
int8_t filler2[16];
u_int32_t magic_2;
#define HPT_MAGIC_2 0x7fffffff
u_int8_t dummy_1;
u_int8_t name_1[15];
u_int8_t dummy_2;
u_int8_t name_2[15];
int8_t filler3[8];
} __attribute__((packed));