diff options
-rw-r--r-- | sys/dev/ic/gdt_common.c | 129 | ||||
-rw-r--r-- | sys/dev/ic/gdtvar.h | 163 |
2 files changed, 2 insertions, 290 deletions
diff --git a/sys/dev/ic/gdt_common.c b/sys/dev/ic/gdt_common.c index 4c168be0c6b..e1bf90095bd 100644 --- a/sys/dev/ic/gdt_common.c +++ b/sys/dev/ic/gdt_common.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gdt_common.c,v 1.60 2011/07/17 22:46:48 matthew Exp $ */ +/* $OpenBSD: gdt_common.c,v 1.61 2012/08/15 02:38:14 jsg Exp $ */ /* * Copyright (c) 1999, 2000, 2003 Niklas Hallqvist. All rights reserved. @@ -557,9 +557,6 @@ gdt_scsi_cmd(struct scsi_xfer *xs) struct gdt_softc *sc = link->adapter_softc; u_int8_t target = link->target; struct gdt_ccb *ccb; -#if 0 - struct gdt_ucmd *ucmd; -#endif u_int32_t blockno, blockcnt; struct scsi_rw *rw; struct scsi_rw_big *rwb; @@ -1424,128 +1421,4 @@ gdt_ioctl_setstate(struct gdt_softc *sc, struct bioc_setstate *bs) { return (1); /* XXX not yet */ } - -#if 0 -int -gdt_ioctl(struct device *dev, u_long cmd, caddr_t addr) -{ - int error = 0; - struct gdt_dummy *dummy; - - switch (cmd) { - case GDT_IOCTL_DUMMY: - dummy = (struct gdt_dummy *)addr; - printf("%s: GDT_IOCTL_DUMMY %d\n", dev->dv_xname, dummy->x++); - break; - - case GDT_IOCTL_GENERAL: { - gdt_ucmd_t *ucmd; - struct gdt_softc *sc = (struct gdt_softc *)dev; - int s; - - ucmd = (gdt_ucmd_t *)addr; - s = splbio(); - TAILQ_INSERT_TAIL(&sc->sc_ucmdq, ucmd, links); - ucmd->complete_flag = FALSE; - splx(s); - gdt_chain(sc); - if (!ucmd->complete_flag) - (void)tsleep((void *)ucmd, PCATCH | PRIBIO, "gdtucw", - 0); - break; - } - - case GDT_IOCTL_DRVERS: - ((gdt_drvers_t *)addr)->vers = - (GDT_DRIVER_VERSION << 8) | GDT_DRIVER_SUBVERSION; - break; - - case GDT_IOCTL_CTRCNT: - ((gdt_ctrcnt_t *)addr)->cnt = gdt_cnt; - break; - -#ifdef notyet - case GDT_IOCTL_CTRTYPE: { - gdt_ctrt_t *p; - struct gdt_softc *sc = (struct gdt_softc *)dev; - - p = (gdt_ctrt_t *)addr; - p->oem_id = 0x8000; - p->type = 0xfd; - p->info = (sc->sc_bus << 8) | (sc->sc_slot << 3); - p->ext_type = 0x6000 | sc->sc_subdevice; - p->device_id = sc->sc_device; - p->sub_device_id = sc->sc_subdevice; - break; - } -#endif - - case GDT_IOCTL_OSVERS: { - gdt_osv_t *p; - - p = (gdt_osv_t *)addr; - p->oscode = 10; - p->version = osrelease[0] - '0'; - if (osrelease[1] == '.') - p->subversion = osrelease[2] - '0'; - else - p->subversion = 0; - if (osrelease[3] == '.') - p->revision = osrelease[4] - '0'; - else - p->revision = 0; - strlcpy(p->name, ostype, sizeof p->name); - break; - } - -#ifdef notyet - case GDT_IOCTL_EVENT: { - gdt_event_t *p; - int s; - - p = (gdt_event_t *)addr; - if (p->erase == 0xff) { - if (p->dvr.event_source == GDT_ES_TEST) - p->dvr.event_data.size = - sizeof(p->dvr.event_data.eu.test); - else if (p->dvr.event_source == GDT_ES_DRIVER) - p->dvr.event_data.size = - sizeof(p->dvr.event_data.eu.driver); - else if (p->dvr.event_source == GDT_ES_SYNC) - p->dvr.event_data.size = - sizeof(p->dvr.event_data.eu.sync); - else - p->dvr.event_data.size = - sizeof(p->dvr.event_data.eu.async); - s = splbio(); - gdt_store_event(p->dvr.event_source, p->dvr.event_idx, - &p->dvr.event_data); - splx(s); - } else if (p->erase == 0xfe) { - s = splbio(); - gdt_clear_events(); - splx(s); - } else if (p->erase == 0) { - p->handle = gdt_read_event(p->handle, &p->dvr); - } else { - gdt_readapp_event((u_int8_t)p->erase, &p->dvr); - } - break; - } -#endif - - case GDT_IOCTL_STATIST: -#if 0 - bcopy(&gdt_stat, (gdt_statist_t *)addr, sizeof gdt_stat); -#else - error = EOPNOTSUPP; -#endif - break; - - default: - error = EINVAL; - } - return (error); -} -#endif /* 0 */ #endif /* NBIO > 0 */ diff --git a/sys/dev/ic/gdtvar.h b/sys/dev/ic/gdtvar.h index ef3e8dc071f..add7ee19dbf 100644 --- a/sys/dev/ic/gdtvar.h +++ b/sys/dev/ic/gdtvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: gdtvar.h,v 1.20 2011/07/08 08:26:41 jsg Exp $ */ +/* $OpenBSD: gdtvar.h,v 1.21 2012/08/15 02:38:14 jsg Exp $ */ /* * Copyright (c) 1999, 2000 Niklas Hallqvist. All rights reserved. @@ -32,169 +32,8 @@ #define DEVNAME(s) ((s)->sc_dev.dv_xname) #define GDT_CMD_RESERVE 4 /* Internal driver cmd reserve. */ -#define GDT_IOCTL_DUMMY _IOWR('B', 32, struct gdt_dummy) -struct gdt_dummy { - void *cookie; - int x; -}; - #define GDT_SCRATCH_SZ 4096 -#define GDT_IOCTL_GENERAL _IOWR('B', 33, gdt_ucmd_t) /* general IOCTL */ -typedef struct gdt_ucmd { - void *cookie; - u_int16_t io_node; - u_int16_t service; - u_int32_t timeout; - u_int16_t status; - u_int32_t info; - - u_int32_t BoardNode; /* board node (always 0) */ - u_int32_t CommandIndex; /* command number */ - u_int16_t OpCode; /* the command (READ,..) */ - union { - struct { - u_int16_t DeviceNo; /* number of cache drive */ - u_int32_t BlockNo; /* block number */ - u_int32_t BlockCnt; /* block count */ - void *DestAddr; /* data */ - } cache; /* cache service cmd. str. */ - struct { - u_int16_t param_size; /* size of p_param buffer */ - u_int32_t subfunc; /* IOCTL function */ - u_int32_t channel; /* device */ - void *p_param; /* data */ - } ioctl; /* IOCTL command structure */ - struct { - u_int16_t reserved; - u_int32_t direction; /* data direction */ - u_int32_t mdisc_time; /* disc. time (0: no timeout)*/ - u_int32_t mcon_time; /* connect time(0: no to.) */ - void *sdata; /* dest. addr. (if s/g: -1) */ - u_int32_t sdlen; /* data length (bytes) */ - u_int32_t clen; /* SCSI cmd. length(6,10,12) */ - u_int8_t cmd[12]; /* SCSI command */ - u_int8_t target; /* target ID */ - u_int8_t lun; /* LUN */ - u_int8_t bus; /* SCSI bus number */ - u_int8_t priority; /* only 0 used */ - u_int32_t sense_len; /* sense data length */ - void *sense_data; /* sense data addr. */ - u_int32_t link_p; /* linked cmds (not supp.) */ - } raw; /* raw service cmd. struct. */ - } u; - u_int8_t data[GDT_SCRATCH_SZ]; - int complete_flag; - TAILQ_ENTRY(gdt_ucmd) links; -} gdt_ucmd_t; - -#define GDT_IOCTL_DRVERS _IOWR('B', 34, int) /* get driver version */ -typedef struct gdt_drvers { - void *cookie; - int vers; -} gdt_drvers_t; - -#define GDT_IOCTL_CTRTYPE _IOR('B', 35, gdt_ctrt_t) /* get ctr. type */ -typedef struct gdt_ctrt { - void *cookie; - u_int16_t io_node; - u_int16_t oem_id; - u_int16_t type; - u_int32_t info; - u_int8_t access; - u_int8_t remote; - u_int16_t ext_type; - u_int16_t device_id; - u_int16_t sub_device_id; -} gdt_ctrt_t; - -#define GDT_IOCTL_OSVERS _IOR('B', 36, gdt_osv_t) /* get OS version */ -typedef struct gdt_osv { - void *cookie; - u_int8_t oscode; - u_int8_t version; - u_int8_t subversion; - u_int16_t revision; - char name[64]; -} gdt_osv_t; - -#define GDT_IOCTL_CTRCNT _IOR('B', 37, int) /* get ctr. count */ -typedef struct gdt_ctrcnt { - void *cookie; - int cnt; -} gdt_ctrcnt_t; - -#define GDT_IOCTL_EVENT _IOWR('B', 38, gdt_event_t) /* get event */ - -typedef struct { - u_int16_t size; /* size of structure */ - union { - char stream[16]; - struct { - u_int16_t ionode; - u_int16_t service; - u_int32_t index; - } driver; - struct { - u_int16_t ionode; - u_int16_t service; - u_int16_t status; - u_int32_t info; - u_int8_t scsi_coord[3]; - } async; - struct { - u_int16_t ionode; - u_int16_t service; - u_int16_t status; - u_int32_t info; - u_int16_t hostdrive; - u_int8_t scsi_coord[3]; - u_int8_t sense_key; - } sync; - struct { - u_int32_t l1, l2, l3, l4; - } test; - } eu; - u_int32_t severity; - u_int8_t event_string[256]; -} gdt_evt_data; -#define GDT_ES_ASYNC 1 -#define GDT_ES_DRIVER 2 -#define GDT_ES_TEST 3 -#define GDT_ES_SYNC 4 - -/* dvrevt structure */ -typedef struct { - u_int32_t first_stamp; - u_int32_t last_stamp; - u_int16_t same_count; - u_int16_t event_source; - u_int16_t event_idx; - u_int8_t application; - u_int8_t reserved; - gdt_evt_data event_data; -} gdt_evt_str; - -typedef struct gdt_event { - void *cookie; - int erase; - int handle; - gdt_evt_str dvr; -} gdt_event_t; - -#define GDT_IOCTL_STATIST _IOR('B', 39, gdt_statist_t) /* get statistics */ -typedef struct gdt_statist { - void *cookie; - u_int16_t io_count_act; - u_int16_t io_count_max; - u_int16_t req_queue_act; - u_int16_t req_queue_max; - u_int16_t cmd_index_act; - u_int16_t cmd_index_max; - u_int16_t sg_count_act; - u_int16_t sg_count_max; -} gdt_statist_t; - #ifdef _KERNEL /* Debugging */ |