diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2005-08-09 14:29:19 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2005-08-09 14:29:19 +0000 |
commit | 5169c2e4460eab6f28652fa21076781d90fd9ca3 (patch) | |
tree | cfa0fc6715af48e3d747cc23cde3a22da52c2689 /sys/dev | |
parent | 579885057a3e8bd9b15cdf9d4c1d5c40fa81a868 (diff) |
Provide HDD serial numbers to bio. Requested deraadt@ ok dlg@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/biovar.h | 4 | ||||
-rw-r--r-- | sys/dev/ic/ami.c | 21 |
2 files changed, 19 insertions, 6 deletions
diff --git a/sys/dev/biovar.h b/sys/dev/biovar.h index 82d913cc7e4..3434944346c 100644 --- a/sys/dev/biovar.h +++ b/sys/dev/biovar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: biovar.h,v 1.12 2005/08/08 20:23:46 marco Exp $ */ +/* $OpenBSD: biovar.h,v 1.13 2005/08/09 14:29:18 marco Exp $ */ /* * Copyright (c) 2002 Niklas Hallqvist. All rights reserved. @@ -94,7 +94,7 @@ struct bioc_disk { char bd_product[16]; /* product string */ char bd_revision[4]; /* revision string */ char bd_pad[4]; /* zero terminate in here */ - char bd_serial[16]; /* serial number */ + char bd_serial[32]; /* serial number */ char bd_procdev[16]; /* processor device */ }; diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c index 604ed5cf99d..91775bdeb40 100644 --- a/sys/dev/ic/ami.c +++ b/sys/dev/ic/ami.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ami.c,v 1.56 2005/08/08 20:23:46 marco Exp $ */ +/* $OpenBSD: ami.c,v 1.57 2005/08/09 14:29:18 marco Exp $ */ /* * Copyright (c) 2001 Michael Shalayeff @@ -138,7 +138,7 @@ int ami_inquire(struct ami_softc *sc, u_int8_t op); #if NBIO > 0 int ami_mgmt(struct ami_softc *, u_int8_t, u_int8_t, u_int8_t, size_t, void *); -int ami_drv_inq(struct ami_softc *, u_int8_t, u_int8_t, void *); +int ami_drv_inq(struct ami_softc *, u_int8_t, u_int8_t, u_int8_t, void *); int ami_ioctl(struct device *, u_long, caddr_t); int ami_ioctl_inq(struct ami_softc *, struct bioc_inq *); int ami_ioctl_vol(struct ami_softc *, struct bioc_vol *); @@ -1861,10 +1861,11 @@ ami_ioctl(dev, cmd, addr) } int -ami_drv_inq(sc, ch, tg, inqbuf) +ami_drv_inq(sc, ch, tg, page, inqbuf) struct ami_softc *sc; u_int8_t ch; u_int8_t tg; + u_int8_t page; void *inqbuf; { struct ami_ccb *ccb; @@ -1908,6 +1909,11 @@ ami_drv_inq(sc, ch, tg, inqbuf) ps->apt_cdb[4] = sizeof(struct scsi_inquiry_data); /* INQUIRY length */ ps->apt_cdb[5] = 0; + if (page != 0) { + ps->apt_cdb[1] = SI_EVPD; + ps->apt_cdb[2] = page; + } + ps->apt_data = htole32(pa + sizeof *ps); ps->apt_datalen = sizeof(struct scsi_inquiry_data); @@ -2127,6 +2133,7 @@ ami_ioctl_disk(sc, bd) struct bioc_disk *bd; { struct scsi_inquiry_data inqbuf; + struct scsi_inquiry_vpd vpdbuf; struct ami_big_diskarray *p; /* struct too large for stack */ int i, s, t, d; int off; @@ -2194,10 +2201,16 @@ ami_ioctl_disk(sc, bd) ch = p->ald[i].asp[s].adv[t].add_target >> 4; tg = p->ald[i].asp[s].adv[t].add_target & 0x0f; - if (!ami_drv_inq(sc, ch, tg, &inqbuf)) + if (!ami_drv_inq(sc, ch, tg, 0, &inqbuf)) strlcpy(bd->bd_vendor, inqbuf.vendor, 8 + 16 + 4 + 1); /* vendor prod rev zero */ + if (!ami_drv_inq(sc, ch, tg, 0x80, &vpdbuf)) + strlcpy(bd->bd_serial, vpdbuf.serial, + vpdbuf.page_length < sizeof(bd->bd_serial) ? + vpdbuf.page_length : sizeof(bd->bd_serial)); + + bd->bd_channel = ch; bd->bd_target = tg; |