summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorMarco Peereboom <marco@cvs.openbsd.org>2005-08-09 14:29:19 +0000
committerMarco Peereboom <marco@cvs.openbsd.org>2005-08-09 14:29:19 +0000
commit5169c2e4460eab6f28652fa21076781d90fd9ca3 (patch)
treecfa0fc6715af48e3d747cc23cde3a22da52c2689 /sys/dev/ic
parent579885057a3e8bd9b15cdf9d4c1d5c40fa81a868 (diff)
Provide HDD serial numbers to bio. Requested deraadt@ ok dlg@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/ami.c21
1 files changed, 17 insertions, 4 deletions
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;