summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/biovar.h37
-rw-r--r--sys/dev/ic/ami.c31
-rw-r--r--sys/dev/ic/amivar.h3
3 files changed, 49 insertions, 22 deletions
diff --git a/sys/dev/biovar.h b/sys/dev/biovar.h
index 85aef418c9b..ce2b7c06303 100644
--- a/sys/dev/biovar.h
+++ b/sys/dev/biovar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: biovar.h,v 1.9 2005/08/01 17:23:14 beck Exp $ */
+/* $OpenBSD: biovar.h,v 1.10 2005/08/08 03:11:36 marco Exp $ */
/*
* Copyright (c) 2002 Niklas Hallqvist. All rights reserved.
@@ -57,6 +57,8 @@ typedef struct _bioc_inq {
int novol; /* nr of volumes */
int nodisk; /* nr of total disks */
+
+ char dev[16]; /* controller device */
} bioc_inq;
#define BIOCDISK _IOWR('B', 33, bioc_disk)
@@ -83,7 +85,7 @@ typedef struct _bioc_disk {
#define BIOC_SDINVALID_S "Invalid"
int resv; /* align */
- quad_t size; /* size of the disk */
+ u_quad_t size; /* size of the disk */
/* this is provided by the physical disks if suported */
char vendor[8]; /* vendor string */
@@ -91,6 +93,12 @@ typedef struct _bioc_disk {
char revision[4]; /* revision string */
char pad[4]; /* zero terminate in here */
+ /* physical data */
+ u_int16_t channel;
+ u_int16_t target;
+ u_int16_t lun;
+ u_int16_t other_id; /* unused for now but needed for sas/fc */
+
/* XXX get this too? */
/* serial number */
} bioc_disk;
@@ -100,9 +108,9 @@ typedef struct _bioc_disk {
typedef struct _bioc_vol {
void *cookie;
- int volid; /* volume id */
- int resv1; /* for binary compatibility */
- int status; /* current status */
+ int volid; /* volume id */
+ int resv1; /* for binary compatibility */
+ int status; /* current status */
#define BIOC_SVONLINE 0x00
#define BIOC_SVONLINE_S "Online"
#define BIOC_SVOFFLINE 0x01
@@ -111,16 +119,19 @@ typedef struct _bioc_vol {
#define BIOC_SVDEGRADED_S "Degraded"
#define BIOC_SVINVALID 0xff
#define BIOC_SVINVALID_S "Invalid"
- int resv2; /* align */
- quad_t size; /* size of the disk */
- int level; /* raid level */
- int nodisk; /* nr of drives */
+ int resv2; /* align */
+ u_quad_t size; /* size of the disk */
+ int level; /* raid level */
+ int nodisk; /* nr of drives */
/* this is provided by the RAID card */
- char vendor[8]; /* vendor string */
- char product[16]; /* product string */
- char revision[4]; /* revision string */
- char pad[4]; /* zero terminate in here */
+ char vendor[8]; /* vendor string */
+ char product[16]; /* product string */
+ char revision[4]; /* revision string */
+ char pad[4]; /* zero terminate in here */
+
+ /* physical data */
+ char dev[16]; /* device */
} bioc_vol;
#define BIOCALARM _IOWR('B', 35, bioc_alarm)
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c
index 66c00273e49..0d1138d4709 100644
--- a/sys/dev/ic/ami.c
+++ b/sys/dev/ic/ami.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ami.c,v 1.53 2005/08/05 04:16:51 marco Exp $ */
+/* $OpenBSD: ami.c,v 1.54 2005/08/08 03:11:36 marco Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -1485,6 +1485,7 @@ ami_scsi_cmd(xs)
{
struct scsi_link *link = xs->sc_link;
struct ami_softc *sc = link->adapter_softc;
+ struct device *dev = link->device_softc;
struct ami_ccb *ccb;
struct ami_iocmd *cmd;
struct scsi_inquiry_data inq;
@@ -1521,6 +1522,11 @@ ami_scsi_cmd(xs)
switch (xs->cmd->opcode) {
case TEST_UNIT_READY:
+ /* save off sd? after autoconf */
+ if (!cold) /* XXX bogus */
+ strlcpy(sc->sc_hdr[target].dev, dev->dv_xname,
+ sizeof(sc->sc_hdr[target].dev));
+
case START_STOP:
#if 0
case VERIFY:
@@ -1766,6 +1772,7 @@ ami_scsi_ioctl(struct scsi_link *link, u_long cmd,
caddr_t addr, int flag, struct proc *p)
{
struct ami_softc *sc = (struct ami_softc *)link->adapter_softc;
+ /* struct device *dev = (struct device *)link->device_softc; */
/* u_int8_t target = link->target; */
if (sc->sc_ioctl)
@@ -1997,6 +2004,8 @@ ami_ioctl_inq(sc, bi)
bi->novol = p->ada_nld;
bi->nodisk = 0;
+ strlcpy(bi->dev, sc->sc_dev.dv_xname, sizeof(bi->dev));
+
/* do we actually care how many disks we have at this point? */
for (i = 0; i < p->ada_nld; i++)
for (s = 0; s < p->ald[i].adl_spandepth; s++)
@@ -2092,8 +2101,10 @@ ami_ioctl_vol(sc, bv)
if (p->ald[i].adl_spandepth > 1)
bv->level *= 10;
- bv->size *= (quad_t)512;
+ bv->size *= (u_quad_t)512;
+ strlcpy(bv->dev, sc->sc_hdr[i].dev, sizeof(bv->dev));
+
bail:
free(p, M_DEVBUF);
@@ -2110,6 +2121,7 @@ ami_ioctl_disk(sc, bd)
int i, s, t, d;
int off;
int error = 0;
+ u_int16_t ch, tg;
p = malloc(sizeof *p, M_DEVBUF, M_NOWAIT);
if (!p) {
@@ -2166,15 +2178,18 @@ ami_ioctl_disk(sc, bd)
bd->status = BIOC_SDINVALID;
}
- bd->size = (quad_t)p->apd[off].adp_size * (quad_t)512;
+ bd->size = (u_quad_t)p->apd[off].adp_size *
+ (u_quad_t)512;
- if (!ami_drv_inq(sc,
- (p->ald[i].asp[s].adv[t].add_target >> 4),
- (p->ald[i].asp[s].adv[t].add_target & 0x0f),
- &inqbuf)) {
+ 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))
strlcpy(bd->vendor, inqbuf.vendor,
8 + 16 + 4 + 1); /* vendor prod rev zero */
- }
+
+ bd->channel = ch;
+ bd->target = tg;
error = 0;
goto bail;
diff --git a/sys/dev/ic/amivar.h b/sys/dev/ic/amivar.h
index 82b01140f97..4ff0a74dbe8 100644
--- a/sys/dev/ic/amivar.h
+++ b/sys/dev/ic/amivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: amivar.h,v 1.15 2005/08/05 04:16:51 marco Exp $ */
+/* $OpenBSD: amivar.h,v 1.16 2005/08/08 03:11:36 marco Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -116,6 +116,7 @@ struct ami_softc {
u_int8_t hd_prop;
u_int8_t hd_stat;
u_int32_t hd_size;
+ char dev[16];
} sc_hdr[AMI_BIG_MAX_LDRIVES];
struct ami_rawsoftc *sc_rawsoftcs;
};