Pull up following revision(s) (requested by tsutsui in ticket #1323):
sys/arch/hp300/dev/rd.c: revision 1.109 sys/arch/hp300/stand/Makefile.buildboot: revision 1.37 sys/arch/hp300/stand/common/ct.c: revision 1.8 sys/arch/hp300/dev/hpibvar.h: revision 1.22 sys/arch/hp300/dev/ct.c: revision 1.62 sys/arch/hp300/dev/hpibvar.h: revision 1.23 sys/arch/hp300/dev/ct.c: revision 1.63 sys/arch/hp300/dev/hpibvar.h: revision 1.24 sys/arch/hp300/dev/mt.c: revision 1.55 sys/arch/hp300/dev/rdreg.h: revision 1.14 sys/arch/hp300/dev/hpib.c: revision 1.43 (via patch) sys/arch/hp300/dev/rdreg.h: revision 1.15 sys/arch/hp300/dev/rdreg.h: revision 1.16 sys/arch/hp300/dev/rdreg.h: revision 1.17 etc/etc.hp300/MAKEDEV.conf: revision 1.15 sys/arch/hp300/stand/common/hpibvar.h: revision 1.6 sys/arch/hp300/stand/common/rd.c: revision 1.11 sys/arch/hp300/dev/ctreg.h: revision 1.11 sys/arch/hp300/dev/rdvar.h: revision 1.24 sys/arch/hp300/dev/rdvar.h: revision 1.25 sys/arch/hp300/dev/rdvar.h: revision 1.26 sys/arch/hp300/dev/rd.c: revision 1.103 sys/arch/hp300/dev/rd.c: revision 1.104 sys/arch/hp300/dev/rd.c: revision 1.105 sys/arch/hp300/dev/rd.c: revision 1.106 sys/arch/hp300/dev/rd.c: revision 1.107 sys/arch/hp300/dev/rd.c: revision 1.108 Consistently use #define<tab> here. Consistently use #define<tab> as rdreg.h. No need to bother to use aprint_debug(9) inside #ifdef DEBUG block. Pull HP-IB probe fixes from OpenBSD/hp300. https://marc.info/?l=openbsd-cvs&m=113217630426615&w=2 Overhaul the way HP-IB devices are probed. We will now do an exhaustive probe of the (slave, punit) tuple space, since this is the only way we can get a dual disk or dual tape enclosure to attach two devices of the same kind. This allows using multiple rd(4) disk images on the same slave emulated by HPDisk (and probably the real 9122D with dual floppy disk drives). Thanks to Miod Vallat for suggesting this fix. Move attach messages from common rdident() to explicit rdattach(). Cleanup duplicated CS/80 indentify structures. From OpenBSD. https://marc.info/?l=openbsd-cvs&m=113227249626888&w=2 Define the CS/80 identify structure only once and correctly, instead of duplicating it in every CS/80 driver and using an hardcoded number for its size. No functional change. https://marc.info/?l=openbsd-cvs&m=113273001020159&w=2 Pick HP-IB describe structures changes from main kernel code here as well. Add support of multiple rd(4) disks on all punits for HPDisk. Special thanks to Anders Gustafsson, the author of "HPDisk" (GPIB disk emulator) http://www.dalton.ax/hpdisk/ for providing bare boards and improving firmwares for NetBSD/hp300. Specify -fno-unwind-tables to shrink binaries. Before: text data bss dec hex filename 77902 4328 137120 219350 358d6 uboot After: text data bss dec hex filename 64186 4328 137120 205634 32342 uboot Create rd3 device nodes, for HPDisk. Add Device and drive info of 2202A, 7908A, 7911A, and 7941A. Geometries and description info are taken from hpdrive.ini.sample in HPDrive. Briefly tested on HPDisk. Print rd(4) capacity and geometry info as sd(4) and wd(4) do. Before: rd0 at hpibbus1 slave 0 punit 0: 7937H rd0: 698 cylinders, 13 heads, 1116102 blocks, 512 bytes/block After: rd0 at hpibbus1 slave 0 punit 0: 7937H rd0: 544 MB, 698 cyl, 13 head, 123 sec, 512 bytes/block x 1116102 blocks
This commit is contained in:
parent
40559796c9
commit
54d6dcbd50
|
@ -1,7 +1,7 @@
|
|||
# $NetBSD: MAKEDEV.conf,v 1.14 2013/04/28 08:08:04 tsutsui Exp $
|
||||
# $NetBSD: MAKEDEV.conf,v 1.14.32.1 2021/07/14 18:04:04 martin Exp $
|
||||
|
||||
all_md)
|
||||
makedev ct0 ct1 rd0 rd1 rd2
|
||||
makedev ct0 ct1 rd0 rd1 rd2 rd3
|
||||
makedev wscons
|
||||
makedev sd0 sd1 sd2 cd0 cd1 st0 st1 ch0
|
||||
makedev ttyC0 ttyC1 ttyC2 ttyC3
|
||||
|
@ -15,7 +15,7 @@ all_md)
|
|||
ramdisk)
|
||||
makedev std
|
||||
makedev md0
|
||||
makedev ct0 ct1 rd0 rd1 rd2
|
||||
makedev ct0 ct1 rd0 rd1 rd2 rd3
|
||||
makedev sd0 sd1 sd2 cd0 cd1 st0 st1 ch0
|
||||
makedev scsibus0
|
||||
makedev ipty
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ct.c,v 1.61 2014/07/25 08:10:33 dholland Exp $ */
|
||||
/* $NetBSD: ct.c,v 1.61.32.1 2021/07/14 18:04:04 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -75,7 +75,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.61 2014/07/25 08:10:33 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ct.c,v 1.61.32.1 2021/07/14 18:04:04 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -257,7 +257,7 @@ ctattach(device_t parent, device_t self, void *aux)
|
|||
static int
|
||||
ctident(device_t parent, struct ct_softc *sc, struct hpibbus_attach_args *ha)
|
||||
{
|
||||
struct ct_describe desc;
|
||||
struct cs80_describe desc;
|
||||
u_char stat, cmd[3];
|
||||
char name[7];
|
||||
int i, id, n, type, canstream;
|
||||
|
@ -270,13 +270,12 @@ ctident(device_t parent, struct ct_softc *sc, struct hpibbus_attach_args *ha)
|
|||
|
||||
/* Is it one of the tapes we support? */
|
||||
for (id = 0; id < nctinfo; id++)
|
||||
if (ha->ha_id == ctinfo[id].hwid)
|
||||
if (ha->ha_id == ctinfo[id].hwid &&
|
||||
ha->ha_punit == ctinfo[id].punit)
|
||||
break;
|
||||
if (id == nctinfo)
|
||||
return 0;
|
||||
|
||||
ha->ha_punit = ctinfo[id].punit;
|
||||
|
||||
/*
|
||||
* So far, so good. Get drive parameters. Note command
|
||||
* is always issued to unit 0.
|
||||
|
@ -285,9 +284,10 @@ ctident(device_t parent, struct ct_softc *sc, struct hpibbus_attach_args *ha)
|
|||
cmd[1] = C_SVOL(0);
|
||||
cmd[2] = C_DESC;
|
||||
hpibsend(device_unit(parent), ha->ha_slave, C_CMD, cmd, sizeof(cmd));
|
||||
hpibrecv(device_unit(parent), ha->ha_slave, C_EXEC, &desc, 37);
|
||||
hpibrecv(device_unit(parent), ha->ha_slave, C_EXEC, &desc,
|
||||
sizeof(desc));
|
||||
hpibrecv(device_unit(parent), ha->ha_slave, C_QSTAT, &stat,
|
||||
sizeof(stat));
|
||||
sizeof(stat));
|
||||
|
||||
memset(name, 0, sizeof(name));
|
||||
if (stat == 0) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ctreg.h,v 1.10 2005/12/11 12:17:13 christos Exp $ */
|
||||
/* $NetBSD: ctreg.h,v 1.10.170.1 2021/07/14 18:04:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990, 1993
|
||||
|
@ -98,30 +98,6 @@ struct ct_clearcmd {
|
|||
char cmd;
|
||||
};
|
||||
|
||||
struct ct_describe {
|
||||
u_int d_iuw:16, /* controller: installed unit word */
|
||||
d_cmaxxfr:16, /* controller: max transfer rate (Kb) */
|
||||
d_ctype:8, /* controller: controller type */
|
||||
d_utype:8, /* unit: unit type */
|
||||
d_name:24, /* unit: name (6 BCD digits) */
|
||||
d_sectsize:16, /* unit: # of bytes per block (sector) */
|
||||
d_blkbuf:8, /* unit: # of blocks which can be buffered */
|
||||
d_burstsize:8, /* unit: recommended burst size */
|
||||
d_blocktime:16, /* unit: block time (u-sec) */
|
||||
d_uavexfr:16, /* unit: average transfer rate (Kb) */
|
||||
d_retry:16, /* unit: optimal retry time (1/100-sec) */
|
||||
d_access:16, /* unit: access time param (1/100-sec) */
|
||||
d_maxint:8, /* unit: maximum interleave */
|
||||
d_fvbyte:8, /* unit: fixed volume byte */
|
||||
d_rvbyte:8, /* unit: removable volume byte */
|
||||
d_maxcyl:24, /* volume: maximum cylinder */
|
||||
d_maxhead:8, /* volume: maximum head */
|
||||
d_maxsect:16, /* volume: maximum sector on track */
|
||||
d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */
|
||||
d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */
|
||||
d_interleave:8; /* volume: current interleave */
|
||||
};
|
||||
|
||||
#define CT7946ID 0x220
|
||||
#define CT9145ID 0x268
|
||||
#define CT9144ID 0x260
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hpib.c,v 1.39 2012/10/13 06:12:23 tsutsui Exp $ */
|
||||
/* $NetBSD: hpib.c,v 1.39.42.1 2021/07/14 18:04:04 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -65,7 +65,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.39 2012/10/13 06:12:23 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: hpib.c,v 1.39.42.1 2021/07/14 18:04:04 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -89,14 +89,9 @@ CFATTACH_DECL_NEW(hpibbus, sizeof(struct hpibbus_softc),
|
|||
hpibbusmatch, hpibbusattach, NULL, NULL);
|
||||
|
||||
static void hpibbus_attach_children(struct hpibbus_softc *);
|
||||
static int hpibbussearch(device_t, cfdata_t, const int *, void *);
|
||||
static int hpibbussubmatch(device_t, cfdata_t, const int *ldesc, void *);
|
||||
static int hpibbusprint(void *, const char *);
|
||||
|
||||
static int hpibbus_alloc(struct hpibbus_softc *, int, int);
|
||||
#if 0
|
||||
static void hpibbus_free(struct hpibbus_softc *, int, int);
|
||||
#endif
|
||||
|
||||
static void hpibstart(void *);
|
||||
static void hpibdone(void *);
|
||||
|
||||
|
@ -121,17 +116,9 @@ int hpibdmathresh = 3; /* byte count beyond which to attempt dma */
|
|||
* have ID tags, and often the host cannot even tell if such
|
||||
* a device is attached to the system!
|
||||
*
|
||||
* These two nasty bits mean that we have to treat HP-IB as
|
||||
* an indirect bus. However, since we are given some ID
|
||||
* information, it is unreasonable to disallow cloning of
|
||||
* CS/80 devices.
|
||||
*
|
||||
* To deal with all of this, we use the semi-twisted scheme
|
||||
* in hpibbus_attach_children(). For each HP-IB slave, we loop
|
||||
* through all of the possibly-configured children, allowing
|
||||
* them to modify the punit parameter (but NOT the slave!).
|
||||
*
|
||||
* This is evil, but what can you do?
|
||||
* * We nevertheless probe the whole (slave, punit) tuple space, since
|
||||
* drivers for devices with a unique ID know exactly where to attach;
|
||||
* and we disallow ``star'' locators for other drivers.
|
||||
*/
|
||||
|
||||
static int
|
||||
|
@ -181,62 +168,50 @@ static void
|
|||
hpibbus_attach_children(struct hpibbus_softc *sc)
|
||||
{
|
||||
struct hpibbus_attach_args ha;
|
||||
int slave;
|
||||
int id, slave, punit;
|
||||
int i;
|
||||
|
||||
for (slave = 0; slave < 8; slave++) {
|
||||
for (slave = 0; slave < HPIB_NSLAVES; slave++) {
|
||||
/*
|
||||
* Get the ID tag for the device, if any.
|
||||
* Plotters won't identify themselves, and
|
||||
* get the same value as non-existent devices.
|
||||
* However, aging HP-IB drives are slow to respond; try up
|
||||
* to three times to get a valid ID.
|
||||
*/
|
||||
ha.ha_id = hpibid(device_unit(sc->sc_dev), slave);
|
||||
for (i = 0; i < 3; i++) {
|
||||
id = hpibid(device_unit(sc->sc_dev), slave);
|
||||
if ((id & 0x200) != 0)
|
||||
break;
|
||||
delay(10000);
|
||||
}
|
||||
|
||||
ha.ha_slave = slave; /* not to be modified by children */
|
||||
ha.ha_punit = 0; /* children modify this */
|
||||
|
||||
/*
|
||||
* Search though all configured children for this bus.
|
||||
*/
|
||||
config_search_ia(hpibbussearch, sc->sc_dev, "hpibbus", &ha);
|
||||
for (punit = 0; punit < HPIB_NPUNITS; punit++) {
|
||||
/*
|
||||
* Search through all configured children for this bus.
|
||||
*/
|
||||
ha.ha_id = id;
|
||||
ha.ha_slave = slave;
|
||||
ha.ha_punit = punit;
|
||||
(void)config_found_sm_loc(sc->sc_dev, "hpibbus", NULL,
|
||||
&ha, hpibbusprint, hpibbussubmatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
hpibbussearch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
|
||||
hpibbussubmatch(device_t parent, cfdata_t cf, const int *ldesc, void *aux)
|
||||
{
|
||||
struct hpibbus_softc *sc = device_private(parent);
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
|
||||
/* Make sure this is in a consistent state. */
|
||||
ha->ha_punit = 0;
|
||||
if (cf->hpibbuscf_slave != HPIBBUSCF_SLAVE_DEFAULT &&
|
||||
cf->hpibbuscf_slave != ha->ha_slave)
|
||||
return 0;
|
||||
if (cf->hpibbuscf_punit != HPIBBUSCF_PUNIT_DEFAULT &&
|
||||
cf->hpibbuscf_punit != ha->ha_punit)
|
||||
return 0;
|
||||
|
||||
if (config_match(parent, cf, ha) > 0) {
|
||||
/*
|
||||
* The device probe has succeeded, and filled in
|
||||
* the punit information. Make sure the configuration
|
||||
* allows for this slave/punit combination.
|
||||
*/
|
||||
if (cf->hpibbuscf_slave != HPIBBUSCF_SLAVE_DEFAULT &&
|
||||
cf->hpibbuscf_slave != ha->ha_slave)
|
||||
goto out;
|
||||
if (cf->hpibbuscf_punit != HPIBBUSCF_PUNIT_DEFAULT &&
|
||||
cf->hpibbuscf_punit != ha->ha_punit)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Allocate the device's address from the bus's
|
||||
* resource map.
|
||||
*/
|
||||
if (hpibbus_alloc(sc, ha->ha_slave, ha->ha_punit))
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* This device is allowed; attach it.
|
||||
*/
|
||||
config_attach(parent, cf, ha, hpibbusprint);
|
||||
}
|
||||
out:
|
||||
return 0;
|
||||
return config_match(parent, cf, aux);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -244,6 +219,11 @@ hpibbusprint(void *aux, const char *pnp)
|
|||
{
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
|
||||
if (pnp != NULL) {
|
||||
if (ha->ha_id == 0 || ha->ha_punit != 0 /* XXX */)
|
||||
return QUIET;
|
||||
printf("HP-IB device (id %04X) at %s", ha->ha_id, pnp);
|
||||
}
|
||||
aprint_normal(" slave %d punit %d", ha->ha_slave, ha->ha_punit);
|
||||
return UNCONF;
|
||||
}
|
||||
|
@ -420,36 +400,3 @@ hpibintr(void *arg)
|
|||
|
||||
return (sc->sc_ops->hpib_intr)(arg);
|
||||
}
|
||||
|
||||
static int
|
||||
hpibbus_alloc(struct hpibbus_softc *sc, int slave, int punit)
|
||||
{
|
||||
|
||||
if (slave >= HPIB_NSLAVES ||
|
||||
punit >= HPIB_NPUNITS)
|
||||
panic("hpibbus_alloc: device address out of range");
|
||||
|
||||
if (sc->sc_rmap[slave][punit] == 0) {
|
||||
sc->sc_rmap[slave][punit] = 1;
|
||||
return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
hpibbus_free(struct hpibbus_softc *sc, int slave, int punit)
|
||||
{
|
||||
|
||||
if (slave >= HPIB_NSLAVES ||
|
||||
punit >= HPIB_NPUNITS)
|
||||
panic("hpibbus_free: device address out of range");
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (sc->sc_rmap[slave][punit] == 0)
|
||||
panic("hpibbus_free: not allocated");
|
||||
#endif
|
||||
|
||||
sc->sc_rmap[slave][punit] = 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hpibvar.h,v 1.21 2012/10/13 06:12:23 tsutsui Exp $ */
|
||||
/* $NetBSD: hpibvar.h,v 1.21.42.1 2021/07/14 18:04:04 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -60,8 +60,6 @@
|
|||
* @(#)hpibvar.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#include <sys/queue.h>
|
||||
|
||||
#define HPIB_IPL(x) ((((x) >> 4) & 0x3) + 3)
|
||||
|
||||
#define HPIBA 32
|
||||
|
@ -93,6 +91,36 @@
|
|||
#define C_UNT_P 0xdf /* with odd parity */
|
||||
#define C_SCG 0x60 /* Secondary group commands */
|
||||
|
||||
/*
|
||||
* Description structure for CS/80 devices.
|
||||
*/
|
||||
struct cs80_describe {
|
||||
u_int d_iuw:16, /* controller: installed unit word */
|
||||
d_cmaxxfr:16, /* controller: max transfer rate (Kb) */
|
||||
d_ctype:8, /* controller: controller type */
|
||||
d_utype:8, /* unit: unit type */
|
||||
d_name:24, /* unit: name (6 BCD digits) */
|
||||
d_sectsize:16, /* unit: # of bytes per block (sector) */
|
||||
d_blkbuf:8, /* unit: # of blocks which can be buffered */
|
||||
d_burstsize:8, /* unit: recommended burst size */
|
||||
d_blocktime:16, /* unit: block time (u-sec) */
|
||||
d_uavexfr:16, /* unit: average transfer rate (Kb) */
|
||||
d_retry:16, /* unit: optimal retry time (1/100-sec) */
|
||||
d_access:16, /* unit: access time param (1/100-sec) */
|
||||
d_maxint:8, /* unit: maximum interleave */
|
||||
d_fvbyte:8, /* unit: fixed volume byte */
|
||||
d_rvbyte:8, /* unit: removable volume byte */
|
||||
d_maxcyl:24, /* volume: maximum cylinder */
|
||||
d_maxhead:8, /* volume: maximum head */
|
||||
d_maxsect:16, /* volume: maximum sector on track */
|
||||
d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */
|
||||
d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */
|
||||
d_interleave:8; /* volume: current interleave */
|
||||
} __attribute__((__packed__));
|
||||
|
||||
#ifdef _KERNEL
|
||||
#include <sys/queue.h>
|
||||
|
||||
struct hpibbus_softc;
|
||||
|
||||
/*
|
||||
|
@ -139,7 +167,7 @@ struct hpibbus_attach_args {
|
|||
#define hpibbuscf_punit cf_loc[HPIBBUSCF_PUNIT]
|
||||
|
||||
#define HPIB_NSLAVES 8 /* number of slaves on a bus */
|
||||
#define HPIB_NPUNITS 2 /* number of punits per slave */
|
||||
#define HPIB_NPUNITS 15 /* number of punits per slave */
|
||||
|
||||
/*
|
||||
* An HP-IB job queue entry. Slave drivers have one of these used
|
||||
|
@ -174,12 +202,6 @@ struct hpibbus_softc {
|
|||
char *sc_addr;
|
||||
int sc_count;
|
||||
int sc_curcnt;
|
||||
|
||||
/*
|
||||
* HP-IB is an indirect bus; this cheezy resource map
|
||||
* keeps track of slave/punit allocations.
|
||||
*/
|
||||
char sc_rmap[HPIB_NSLAVES][HPIB_NPUNITS];
|
||||
};
|
||||
|
||||
/* sc_flags */
|
||||
|
@ -190,7 +212,6 @@ struct hpibbus_softc {
|
|||
#define HPIBF_TIMO 0x10
|
||||
#define HPIBF_DMA16 0x8000
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern void *internalhpib;
|
||||
extern int hpibtimeout;
|
||||
extern int hpibdmathresh;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: mt.c,v 1.54 2014/07/25 08:10:33 dholland Exp $ */
|
||||
/* $NetBSD: mt.c,v 1.54.32.1 2021/07/14 18:04:04 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -60,7 +60,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.54 2014/07/25 08:10:33 dholland Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: mt.c,v 1.54.32.1 2021/07/14 18:04:04 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -224,7 +224,8 @@ mtident(struct mt_softc *sc, struct hpibbus_attach_args *ha)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < nmtinfo; i++) {
|
||||
if (ha->ha_id == mtinfo[i].hwid) {
|
||||
if (ha->ha_id == mtinfo[i].hwid &&
|
||||
ha->ha_punit == 0) {
|
||||
if (sc != NULL) {
|
||||
sc->sc_type = mtinfo[i].hwid;
|
||||
aprint_normal(": %s tape\n", mtinfo[i].desc);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rd.c,v 1.101 2015/04/13 21:18:42 riastradh Exp $ */
|
||||
/* $NetBSD: rd.c,v 1.101.22.1 2021/07/14 18:04:04 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -72,7 +72,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.101 2015/04/13 21:18:42 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: rd.c,v 1.101.22.1 2021/07/14 18:04:04 martin Exp $");
|
||||
|
||||
#include "opt_useleds.h"
|
||||
|
||||
|
@ -172,13 +172,13 @@ static const char *err_info[] = {
|
|||
0, 0
|
||||
};
|
||||
|
||||
int rddebug = 0x80;
|
||||
#define RDB_FOLLOW 0x01
|
||||
#define RDB_STATUS 0x02
|
||||
#define RDB_IDENT 0x04
|
||||
#define RDB_IO 0x08
|
||||
#define RDB_ASYNC 0x10
|
||||
#define RDB_ERROR 0x80
|
||||
int rddebug = RDB_ERROR | RDB_IDENT;
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
@ -186,65 +186,244 @@ int rddebug = 0x80;
|
|||
* Nothing really critical here, could do without it.
|
||||
*/
|
||||
static const struct rdidentinfo rdidentinfo[] = {
|
||||
{ RD7946AID, 0, "7945A", NRD7945ABPT,
|
||||
NRD7945ATRK, 968, 108416 },
|
||||
[RD7945A] = {
|
||||
.ri_hwid = RD7946AID,
|
||||
.ri_desc = "7945A",
|
||||
.ri_nbpt = NRD7945ABPT,
|
||||
.ri_ntpc = NRD7945ATRK,
|
||||
.ri_ncyl = 968,
|
||||
.ri_nblocks = 108416
|
||||
},
|
||||
|
||||
{ RD9134DID, 1, "9134D", NRD9134DBPT,
|
||||
NRD9134DTRK, 303, 29088 },
|
||||
[RD9134D] = {
|
||||
.ri_hwid = RD9134DID,
|
||||
.ri_desc = "9134D",
|
||||
.ri_nbpt = NRD9134DBPT,
|
||||
.ri_ntpc = NRD9134DTRK,
|
||||
.ri_ncyl = 303,
|
||||
.ri_nblocks = 29088
|
||||
},
|
||||
|
||||
{ RD9134LID, 1, "9122S", NRD9122SBPT,
|
||||
NRD9122STRK, 77, 1232 },
|
||||
[RD9122S] = {
|
||||
.ri_hwid = RD9134LID,
|
||||
.ri_desc = "9122S",
|
||||
.ri_nbpt = NRD9122SBPT,
|
||||
.ri_ntpc = NRD9122STRK,
|
||||
.ri_ncyl = 77,
|
||||
.ri_nblocks = 1232
|
||||
},
|
||||
|
||||
{ RD7912PID, 0, "7912P", NRD7912PBPT,
|
||||
NRD7912PTRK, 572, 128128 },
|
||||
[RD7912P] = {
|
||||
.ri_hwid = RD7912PID,
|
||||
.ri_desc = "7912P",
|
||||
.ri_nbpt = NRD7912PBPT,
|
||||
.ri_ntpc = NRD7912PTRK,
|
||||
.ri_ncyl = 572,
|
||||
.ri_nblocks = 128128
|
||||
},
|
||||
|
||||
{ RD7914PID, 0, "7914P", NRD7914PBPT,
|
||||
NRD7914PTRK, 1152, 258048 },
|
||||
[RD7914P] = {
|
||||
.ri_hwid = RD7914PID,
|
||||
.ri_desc = "7914P",
|
||||
.ri_nbpt = NRD7914PBPT,
|
||||
.ri_ntpc = NRD7914PTRK,
|
||||
.ri_ncyl = 1152,
|
||||
.ri_nblocks = 258048
|
||||
},
|
||||
|
||||
{ RD7958AID, 0, "7958A", NRD7958ABPT,
|
||||
NRD7958ATRK, 1013, 255276 },
|
||||
[RD7958A] = {
|
||||
.ri_hwid = RD7958AID,
|
||||
.ri_desc = "7958A",
|
||||
.ri_nbpt = NRD7958ABPT,
|
||||
.ri_ntpc = NRD7958ATRK,
|
||||
.ri_ncyl = 1013,
|
||||
.ri_nblocks = 255276
|
||||
},
|
||||
|
||||
{ RD7957AID, 0, "7957A", NRD7957ABPT,
|
||||
NRD7957ATRK, 1036, 159544 },
|
||||
[RD7957A] = {
|
||||
.ri_hwid = RD7957AID,
|
||||
.ri_desc = "7957A",
|
||||
.ri_nbpt = NRD7957ABPT,
|
||||
.ri_ntpc = NRD7957ATRK,
|
||||
.ri_ncyl = 1036,
|
||||
.ri_nblocks = 159544
|
||||
},
|
||||
|
||||
{ RD7933HID, 0, "7933H", NRD7933HBPT,
|
||||
NRD7933HTRK, 1321, 789958 },
|
||||
[RD7933H] = {
|
||||
.ri_hwid = RD7933HID,
|
||||
.ri_desc = "7933H",
|
||||
.ri_nbpt = NRD7933HBPT,
|
||||
.ri_ntpc = NRD7933HTRK,
|
||||
.ri_ncyl = 1321,
|
||||
.ri_nblocks = 789958
|
||||
},
|
||||
|
||||
{ RD9134LID, 1, "9134L", NRD9134LBPT,
|
||||
NRD9134LTRK, 973, 77840 },
|
||||
[RD9134L] = {
|
||||
.ri_hwid = RD9134LID,
|
||||
.ri_desc = "9134L",
|
||||
.ri_nbpt = NRD9134LBPT,
|
||||
.ri_ntpc = NRD9134LTRK,
|
||||
.ri_ncyl = 973,
|
||||
.ri_nblocks = 77840
|
||||
},
|
||||
|
||||
{ RD7936HID, 0, "7936H", NRD7936HBPT,
|
||||
NRD7936HTRK, 698, 600978 },
|
||||
[RD7936H] = {
|
||||
.ri_hwid = RD7936HID,
|
||||
.ri_desc = "7936H",
|
||||
.ri_nbpt = NRD7936HBPT,
|
||||
.ri_ntpc = NRD7936HTRK,
|
||||
.ri_ncyl = 698,
|
||||
.ri_nblocks = 600978
|
||||
},
|
||||
|
||||
{ RD7937HID, 0, "7937H", NRD7937HBPT,
|
||||
NRD7937HTRK, 698, 1116102 },
|
||||
[RD7937H] = {
|
||||
.ri_hwid = RD7937HID,
|
||||
.ri_desc = "7937H",
|
||||
.ri_nbpt = NRD7937HBPT,
|
||||
.ri_ntpc = NRD7937HTRK,
|
||||
.ri_ncyl = 698,
|
||||
.ri_nblocks = 1116102
|
||||
},
|
||||
|
||||
{ RD7914CTID, 0, "7914CT", NRD7914PBPT,
|
||||
NRD7914PTRK, 1152, 258048 },
|
||||
[RD7914CT] = {
|
||||
.ri_hwid = RD7914CTID,
|
||||
.ri_desc = "7914CT",
|
||||
.ri_nbpt = NRD7914PBPT,
|
||||
.ri_ntpc = NRD7914PTRK,
|
||||
.ri_ncyl = 1152,
|
||||
.ri_nblocks = 258048
|
||||
},
|
||||
|
||||
{ RD7946AID, 0, "7946A", NRD7945ABPT,
|
||||
NRD7945ATRK, 968, 108416 },
|
||||
[RD7946A] = {
|
||||
.ri_hwid = RD7946AID,
|
||||
.ri_desc = "7946A",
|
||||
.ri_nbpt = NRD7945ABPT,
|
||||
.ri_ntpc = NRD7945ATRK,
|
||||
.ri_ncyl = 968,
|
||||
.ri_nblocks = 108416
|
||||
},
|
||||
|
||||
{ RD9134LID, 1, "9122D", NRD9122SBPT,
|
||||
NRD9122STRK, 77, 1232 },
|
||||
[RD9122D] = {
|
||||
.ri_hwid = RD9134LID,
|
||||
.ri_desc = "9122D",
|
||||
.ri_nbpt = NRD9122SBPT,
|
||||
.ri_ntpc = NRD9122STRK,
|
||||
.ri_ncyl = 77,
|
||||
.ri_nblocks = 1232
|
||||
},
|
||||
|
||||
{ RD7957BID, 0, "7957B", NRD7957BBPT,
|
||||
NRD7957BTRK, 1269, 159894 },
|
||||
[RD7957B] = {
|
||||
.ri_hwid = RD7957BID,
|
||||
.ri_desc = "7957B",
|
||||
.ri_nbpt = NRD7957BBPT,
|
||||
.ri_ntpc = NRD7957BTRK,
|
||||
.ri_ncyl = 1269,
|
||||
.ri_nblocks = 159894
|
||||
},
|
||||
|
||||
{ RD7958BID, 0, "7958B", NRD7958BBPT,
|
||||
NRD7958BTRK, 786, 297108 },
|
||||
[RD7958B] = {
|
||||
.ri_hwid = RD7958BID,
|
||||
.ri_desc = "7958B",
|
||||
.ri_nbpt = NRD7958BBPT,
|
||||
.ri_ntpc = NRD7958BTRK,
|
||||
.ri_ncyl = 786,
|
||||
.ri_nblocks = 297108
|
||||
},
|
||||
|
||||
{ RD7959BID, 0, "7959B", NRD7959BBPT,
|
||||
NRD7959BTRK, 1572, 594216 },
|
||||
[RD7959B] = {
|
||||
.ri_hwid = RD7959BID,
|
||||
.ri_desc = "7959B",
|
||||
.ri_nbpt = NRD7959BBPT,
|
||||
.ri_ntpc = NRD7959BTRK,
|
||||
.ri_ncyl = 1572,
|
||||
.ri_nblocks = 594216
|
||||
},
|
||||
|
||||
{ RD2200AID, 0, "2200A", NRD2200ABPT,
|
||||
NRD2200ATRK, 1449, 654948 },
|
||||
[RD2200A] = {
|
||||
.ri_hwid = RD2200AID,
|
||||
.ri_desc = "2200A",
|
||||
.ri_nbpt = NRD2200ABPT,
|
||||
.ri_ntpc = NRD2200ATRK,
|
||||
.ri_ncyl = 1449,
|
||||
.ri_nblocks = 654948
|
||||
},
|
||||
|
||||
{ RD2203AID, 0, "2203A", NRD2203ABPT,
|
||||
NRD2203ATRK, 1449, 1309896 }
|
||||
[RD2203A] = {
|
||||
.ri_hwid = RD2203AID,
|
||||
.ri_desc = "2203A",
|
||||
.ri_nbpt = NRD2203ABPT,
|
||||
.ri_ntpc = NRD2203ATRK,
|
||||
.ri_ncyl = 1449,
|
||||
.ri_nblocks = 1309896
|
||||
},
|
||||
|
||||
[RD2202A] = {
|
||||
.ri_hwid = RD2202AID,
|
||||
.ri_desc = "2202A",
|
||||
.ri_nbpt = NRD2202ABPT,
|
||||
.ri_ntpc = NRD2202ATRK,
|
||||
.ri_ncyl = 1449,
|
||||
.ri_nblocks = 1309896
|
||||
},
|
||||
|
||||
[RD7908A] = {
|
||||
.ri_hwid = RD7908AID,
|
||||
.ri_desc = "7908A",
|
||||
.ri_nbpt = NRD7908ABPT,
|
||||
.ri_ntpc = NRD7908ATRK,
|
||||
.ri_ncyl = 185,
|
||||
.ri_nblocks = 32375
|
||||
},
|
||||
|
||||
[RD7911A] = {
|
||||
.ri_hwid = RD7911AID,
|
||||
.ri_desc = "7911A",
|
||||
.ri_nbpt = NRD7911ABPT,
|
||||
.ri_ntpc = NRD7911ATRK,
|
||||
.ri_ncyl = 572,
|
||||
.ri_nblocks = 54912
|
||||
},
|
||||
|
||||
[RD7941A] = {
|
||||
.ri_hwid = RD7946AID,
|
||||
.ri_desc = "7941A",
|
||||
.ri_nbpt = NRD7941ABPT,
|
||||
.ri_ntpc = NRD7941ATRK,
|
||||
.ri_ncyl = 968,
|
||||
.ri_nblocks = 46464
|
||||
}
|
||||
};
|
||||
static const int numrdidentinfo = __arraycount(rdidentinfo);
|
||||
|
||||
struct rdname2id {
|
||||
const char *rn_name;
|
||||
int rn_id;
|
||||
};
|
||||
static const struct rdname2id rdname2id[] = {
|
||||
{ RD7945ANAME, RD7945A },
|
||||
{ RD9134DNAME, RD9134D },
|
||||
{ RD7912PNAME, RD7912P },
|
||||
{ RD7914PNAME, RD7914P },
|
||||
{ RD7958ANAME, RD7958A },
|
||||
{ RD7957ANAME, RD7957A },
|
||||
{ RD7933HNAME, RD7933H },
|
||||
{ RD9134LNAME, RD9134L },
|
||||
{ RD7936HNAME, RD7936H },
|
||||
{ RD7937HNAME, RD7937H },
|
||||
{ RD7914CTNAME, RD7914CT },
|
||||
{ RD9122DNAME, RD9122D },
|
||||
{ RD7957BNAME, RD7957B },
|
||||
{ RD7958BNAME, RD7958B },
|
||||
{ RD7959BNAME, RD7959B },
|
||||
{ RD2200ANAME, RD2200A },
|
||||
{ RD2203ANAME, RD2203A },
|
||||
{ RD2202ANAME, RD2202A },
|
||||
{ RD7908ANAME, RD7908A },
|
||||
{ RD7911ANAME, RD7911A },
|
||||
{ RD7941ANAME, RD7941A }
|
||||
};
|
||||
static const int numrdname2id = __arraycount(rdname2id);
|
||||
|
||||
static int rdident(device_t, struct rd_softc *,
|
||||
struct hpibbus_attach_args *);
|
||||
static void rdreset(struct rd_softc *);
|
||||
|
@ -311,25 +490,35 @@ static int
|
|||
rdmatch(device_t parent, cfdata_t cf, void *aux)
|
||||
{
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
struct rd_clearcmd ccmd;
|
||||
int ctlr, slave, punit;
|
||||
int rv;
|
||||
uint8_t stat;
|
||||
|
||||
rv = rdident(parent, NULL, ha);
|
||||
|
||||
if (rv == 0)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Set punit if operator specified one in the kernel
|
||||
* configuration file.
|
||||
* The supported device ID is probed.
|
||||
* Check if the specified physical unit is actually supported
|
||||
* by brandnew HP-IB emulator devices like HPDisk and HPDrive etc.
|
||||
*/
|
||||
if (cf->hpibbuscf_punit != HPIBBUSCF_PUNIT_DEFAULT &&
|
||||
cf->hpibbuscf_punit < HPIB_NPUNITS)
|
||||
ha->ha_punit = cf->hpibbuscf_punit;
|
||||
ctlr = device_unit(parent);
|
||||
slave = ha->ha_slave;
|
||||
punit = ha->ha_punit;
|
||||
if (punit == 0)
|
||||
return 1;
|
||||
|
||||
ccmd.c_unit = C_SUNIT(punit);
|
||||
ccmd.c_cmd = C_CLEAR;
|
||||
hpibsend(ctlr, slave, C_TCMD, &ccmd, sizeof(ccmd));
|
||||
hpibswait(ctlr, slave);
|
||||
hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
|
||||
if (stat != 0)
|
||||
return 0;
|
||||
|
||||
if (rdident(parent, NULL, ha) == 0) {
|
||||
/*
|
||||
* XXX Some aging HP-IB drives are slow to
|
||||
* XXX respond; give them a chance to catch
|
||||
* XXX up and probe them again.
|
||||
*/
|
||||
delay(10000);
|
||||
ha->ha_id = hpibid(device_unit(parent), ha->ha_slave);
|
||||
return rdident(parent, NULL, ha);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -338,6 +527,8 @@ rdattach(device_t parent, device_t self, void *aux)
|
|||
{
|
||||
struct rd_softc *sc = device_private(self);
|
||||
struct hpibbus_attach_args *ha = aux;
|
||||
int id;
|
||||
char pbuf[9];
|
||||
|
||||
sc->sc_dev = self;
|
||||
bufq_alloc(&sc->sc_tab, "disksort", BUFQ_SORT_RAWBLOCK);
|
||||
|
@ -347,6 +538,21 @@ rdattach(device_t parent, device_t self, void *aux)
|
|||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX We use DEV_BSIZE instead of the sector size value pulled
|
||||
* XXX off the driver because all of this code assumes 512 byte
|
||||
* XXX blocks. ICK!
|
||||
*/
|
||||
id = sc->sc_type;
|
||||
aprint_normal(": %s\n", rdidentinfo[id].ri_desc);
|
||||
format_bytes(pbuf, sizeof(pbuf),
|
||||
rdidentinfo[id].ri_nblocks * DEV_BSIZE);
|
||||
aprint_normal_dev(sc->sc_dev, "%s, %d cyl, %d head, %d sec,"
|
||||
" %d bytes/block x %u blocks\n",
|
||||
pbuf, rdidentinfo[id].ri_ncyl, rdidentinfo[id].ri_ntpc,
|
||||
rdidentinfo[id].ri_nbpt,
|
||||
DEV_BSIZE, rdidentinfo[id].ri_nblocks);
|
||||
|
||||
/*
|
||||
* Initialize and attach the disk structure.
|
||||
*/
|
||||
|
@ -382,7 +588,7 @@ rdattach(device_t parent, device_t self, void *aux)
|
|||
static int
|
||||
rdident(device_t parent, struct rd_softc *sc, struct hpibbus_attach_args *ha)
|
||||
{
|
||||
struct rd_describe *desc = sc != NULL ? &sc->sc_rddesc : NULL;
|
||||
struct cs80_describe desc;
|
||||
u_char stat, cmd[3];
|
||||
char name[7];
|
||||
int i, id, n, ctlr, slave;
|
||||
|
@ -398,7 +604,7 @@ rdident(device_t parent, struct rd_softc *sc, struct hpibbus_attach_args *ha)
|
|||
for (id = 0; id < numrdidentinfo; id++)
|
||||
if (ha->ha_id == rdidentinfo[id].ri_hwid)
|
||||
break;
|
||||
if (id == numrdidentinfo || ha->ha_punit > rdidentinfo[id].ri_maxunum)
|
||||
if (id == numrdidentinfo)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
|
@ -416,11 +622,11 @@ rdident(device_t parent, struct rd_softc *sc, struct hpibbus_attach_args *ha)
|
|||
cmd[1] = C_SVOL(0);
|
||||
cmd[2] = C_DESC;
|
||||
hpibsend(ctlr, slave, C_CMD, cmd, sizeof(cmd));
|
||||
hpibrecv(ctlr, slave, C_EXEC, desc, 37);
|
||||
hpibrecv(ctlr, slave, C_EXEC, &desc, sizeof(desc));
|
||||
hpibrecv(ctlr, slave, C_QSTAT, &stat, sizeof(stat));
|
||||
memset(name, 0, sizeof(name));
|
||||
if (stat == 0) {
|
||||
n = desc->d_name;
|
||||
n = desc.d_name;
|
||||
for (i = 5; i >= 0; i--) {
|
||||
name[i] = (n & 0xf) + '0';
|
||||
n >>= 4;
|
||||
|
@ -429,69 +635,75 @@ rdident(device_t parent, struct rd_softc *sc, struct hpibbus_attach_args *ha)
|
|||
|
||||
#ifdef DEBUG
|
||||
if (rddebug & RDB_IDENT) {
|
||||
aprint_debug("\n");
|
||||
aprint_debug_dev(sc->sc_dev, "name: %x ('%s')\n",
|
||||
desc->d_name, name);
|
||||
aprint_debug(" iuw %x, maxxfr %d, ctype %d\n",
|
||||
desc->d_iuw, desc->d_cmaxxfr, desc->d_ctype);
|
||||
aprint_debug(" utype %d, bps %d, blkbuf %d, burst %d,"
|
||||
aprint_normal("\n");
|
||||
aprint_normal_dev(sc->sc_dev, "id: 0x%04x, name: %x ('%s')\n",
|
||||
ha->ha_id, desc.d_name, name);
|
||||
aprint_normal(" iuw %x, maxxfr %d, ctype %d\n",
|
||||
desc.d_iuw, desc.d_cmaxxfr, desc.d_ctype);
|
||||
aprint_normal(" utype %d, bps %d, blkbuf %d, burst %d,"
|
||||
" blktime %d\n",
|
||||
desc->d_utype, desc->d_sectsize,
|
||||
desc->d_blkbuf, desc->d_burstsize, desc->d_blocktime);
|
||||
aprint_debug(" avxfr %d, ort %d, atp %d, maxint %d, fv %x"
|
||||
desc.d_utype, desc.d_sectsize,
|
||||
desc.d_blkbuf, desc.d_burstsize, desc.d_blocktime);
|
||||
aprint_normal(" avxfr %d, ort %d, atp %d, maxint %d, fv %x"
|
||||
", rv %x\n",
|
||||
desc->d_uavexfr, desc->d_retry, desc->d_access,
|
||||
desc->d_maxint, desc->d_fvbyte, desc->d_rvbyte);
|
||||
aprint_debug(" maxcyl/head/sect %d/%d/%d, maxvsect %d,"
|
||||
desc.d_uavexfr, desc.d_retry, desc.d_access,
|
||||
desc.d_maxint, desc.d_fvbyte, desc.d_rvbyte);
|
||||
aprint_normal(" maxcyl/head/sect %d/%d/%d, maxvsect %d,"
|
||||
" inter %d\n",
|
||||
desc->d_maxcyl, desc->d_maxhead, desc->d_maxsect,
|
||||
desc->d_maxvsectl, desc->d_interleave);
|
||||
desc.d_maxcyl, desc.d_maxhead, desc.d_maxsect,
|
||||
desc.d_maxvsectl, desc.d_interleave);
|
||||
aprint_normal("%s", device_xname(sc->sc_dev));
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Take care of a couple of anomolies:
|
||||
* 1. 7945A and 7946A both return same HW id
|
||||
* 1. 7945A, 7946A, and 7941A all return same HW id
|
||||
* 2. 9122S and 9134D both return same HW id
|
||||
* 3. 9122D and 9134L both return same HW id
|
||||
*/
|
||||
switch (ha->ha_id) {
|
||||
case RD7946AID:
|
||||
if (memcmp(name, "079450", 6) == 0)
|
||||
if (memcmp(name, RD7945ANAME, RDNAMELEN) == 0)
|
||||
id = RD7945A;
|
||||
else if (memcmp(name, RD7941ANAME, RDNAMELEN) == 0)
|
||||
id = RD7941A;
|
||||
else
|
||||
id = RD7946A;
|
||||
break;
|
||||
|
||||
case RD9134LID:
|
||||
if (memcmp(name, "091340", 6) == 0)
|
||||
if (memcmp(name, RD9134LNAME, RDNAMELEN) == 0)
|
||||
id = RD9134L;
|
||||
else
|
||||
id = RD9122D;
|
||||
break;
|
||||
|
||||
case RD9134DID:
|
||||
if (memcmp(name, "091220", 6) == 0)
|
||||
if (memcmp(name, RD9122SNAME, RDNAMELEN) == 0)
|
||||
id = RD9122S;
|
||||
else
|
||||
id = RD9134D;
|
||||
break;
|
||||
}
|
||||
|
||||
sc->sc_type = id;
|
||||
|
||||
/*
|
||||
* XXX We use DEV_BSIZE instead of the sector size value pulled
|
||||
* XXX off the driver because all of this code assumes 512 byte
|
||||
* XXX blocks. ICK!
|
||||
* HPDisk can have independent physical units that are not
|
||||
* corresponding to device IDs.
|
||||
* To handle this, we have to check names in the drive description
|
||||
* data for punit >= 1.
|
||||
*/
|
||||
aprint_normal(": %s\n", rdidentinfo[id].ri_desc);
|
||||
aprint_normal_dev(sc->sc_dev, "%d cylinders, %d heads, %d blocks,"
|
||||
" %d bytes/block\n",
|
||||
rdidentinfo[id].ri_ncyl,
|
||||
rdidentinfo[id].ri_ntpc, rdidentinfo[id].ri_nblocks,
|
||||
DEV_BSIZE);
|
||||
if (ha->ha_punit >= 1) {
|
||||
for (i = 0; i < numrdname2id; i++) {
|
||||
if (memcmp(name, rdname2id[i].rn_name,
|
||||
RDNAMELEN) == 0) {
|
||||
id = rdname2id[i].rn_id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sc->sc_type = id;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rdreg.h,v 1.13 2011/02/08 20:20:13 rmind Exp $ */
|
||||
/* $NetBSD: rdreg.h,v 1.13.60.1 2021/07/14 18:04:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -78,9 +78,9 @@ struct rd_stat {
|
|||
} cu_tva;
|
||||
} c_pf;
|
||||
} __attribute__((__packed__));
|
||||
#define c_raw c_pf.cu_raw
|
||||
#define c_blk c_pf.cu_sva.cu_lsl /* for now */
|
||||
#define c_tva c_pf.cu_tva
|
||||
#define c_raw c_pf.cu_raw
|
||||
#define c_blk c_pf.cu_sva.cu_lsl /* for now */
|
||||
#define c_tva c_pf.cu_tva
|
||||
|
||||
struct rd_ssmcmd {
|
||||
char c_unit;
|
||||
|
@ -103,47 +103,52 @@ struct rd_clearcmd {
|
|||
char c_cmd;
|
||||
} __attribute__((__packed__));
|
||||
|
||||
struct rd_describe {
|
||||
u_int d_iuw:16, /* controller: installed unit word */
|
||||
d_cmaxxfr:16, /* controller: max transfer rate (Kb) */
|
||||
d_ctype:8, /* controller: controller type */
|
||||
d_utype:8, /* unit: unit type */
|
||||
d_name:24, /* unit: name (6 BCD digits) */
|
||||
d_sectsize:16, /* unit: # of bytes per block (sector) */
|
||||
d_blkbuf:8, /* unit: # of blocks which can be buffered */
|
||||
d_burstsize:8, /* unit: recommended burst size */
|
||||
d_blocktime:16, /* unit: block time (u-sec) */
|
||||
d_uavexfr:16, /* unit: average transfer rate (Kb) */
|
||||
d_retry:16, /* unit: optimal retry time (1/100-sec) */
|
||||
d_access:16, /* unit: access time param (1/100-sec) */
|
||||
d_maxint:8, /* unit: maximum interleave */
|
||||
d_fvbyte:8, /* unit: fixed volume byte */
|
||||
d_rvbyte:8, /* unit: removable volume byte */
|
||||
d_maxcyl:24, /* volume: maximum cylinder */
|
||||
d_maxhead:8, /* volume: maximum head */
|
||||
d_maxsect:16, /* volume: maximum sector on track */
|
||||
d_maxvsecth:16, /* volume: maximum sector on volume (MSW) */
|
||||
d_maxvsectl:32, /* volume: maximum sector on volume (LSWs) */
|
||||
d_interleave:8; /* volume: current interleave */
|
||||
} __attribute__((__packed__));
|
||||
|
||||
/* HW ids */
|
||||
#define RD7946AID 0x220 /* also 7945A */
|
||||
#define RD7946AID 0x220 /* also 7945A and 7941A */
|
||||
#define RD9134DID 0x221 /* also 9122S */
|
||||
#define RD9134LID 0x222 /* also 9122D */
|
||||
#define RD7912PID 0x209
|
||||
#define RD7914CTID 0x20A
|
||||
#define RD7914CTID 0x20A
|
||||
#define RD7914PID 0x20B
|
||||
#define RD7958AID 0x22B
|
||||
#define RD7957AID 0x22A
|
||||
#define RD7957AID 0x22A
|
||||
#define RD7933HID 0x212
|
||||
#define RD7936HID 0x213 /* just guessing -- as of yet unknown */
|
||||
#define RD7937HID 0x214
|
||||
#define RD7957BID 0x22C /* another guess based on 7958B */
|
||||
#define RD7958BID 0x22D
|
||||
#define RD7959BID 0x22E /* another guess based on 7958B */
|
||||
#define RD2200AID 0x22F
|
||||
#define RD2203AID 0x230 /* yet another guess */
|
||||
#define RD7957BID 0x22C /* another guess based on 7958B */
|
||||
#define RD7958BID 0x22D
|
||||
#define RD7959BID 0x22E /* another guess based on 7958B */
|
||||
#define RD2200AID 0x22F
|
||||
#define RD2203AID 0x230 /* yet another guess */
|
||||
#define RD2202AID 0x231 /* from hpdrive.ini.sample */
|
||||
#define RD7908AID 0x200 /* from hpdrive.ini.sample */
|
||||
#define RD7911AID 0x204 /* from hpdrive.ini.sample */
|
||||
|
||||
/* Drive names -- per identify description structure */
|
||||
#define RD7945ANAME "079450"
|
||||
#define RD9134DNAME "091340"
|
||||
#define RD9122SNAME "091220"
|
||||
#define RD7912PNAME "079120"
|
||||
#define RD7914PNAME "079140"
|
||||
#define RD7958ANAME "079580"
|
||||
#define RD7957ANAME "079570"
|
||||
#define RD7933HNAME "079330"
|
||||
#define RD9134LNAME "091340"
|
||||
#define RD7936HNAME "079360"
|
||||
#define RD7937HNAME "079370"
|
||||
#define RD7914CTNAME "079140"
|
||||
#define RD9122DNAME RD9122SNAME
|
||||
#define RD7957BNAME "079571"
|
||||
#define RD7958BNAME "079581"
|
||||
#define RD7959BNAME "079591"
|
||||
#define RD2200ANAME "022000"
|
||||
#define RD2203ANAME "022030"
|
||||
#define RD2202ANAME "022020"
|
||||
#define RD7908ANAME "079080"
|
||||
#define RD7911ANAME "079110"
|
||||
#define RD7941ANAME "079410"
|
||||
|
||||
#define RDNAMELEN 6
|
||||
|
||||
/* SW ids -- indicies into rdidentinfo, order is arbitrary */
|
||||
#define RD7945A 0
|
||||
|
@ -152,17 +157,23 @@ struct rd_describe {
|
|||
#define RD7912P 3
|
||||
#define RD7914P 4
|
||||
#define RD7958A 5
|
||||
#define RD7957A 6
|
||||
#define RD7957A 6
|
||||
#define RD7933H 7
|
||||
#define RD9134L 8
|
||||
#define RD7936H 9
|
||||
#define RD7937H 10
|
||||
#define RD7914CT 11
|
||||
#define RD7946A 12
|
||||
#define RD9122D 13
|
||||
#define RD7957B 14
|
||||
#define RD7958B 15
|
||||
#define RD7959B 16
|
||||
#define RD7914CT 11
|
||||
#define RD7946A 12
|
||||
#define RD9122D 13
|
||||
#define RD7957B 14
|
||||
#define RD7958B 15
|
||||
#define RD7959B 16
|
||||
#define RD2200A 17
|
||||
#define RD2203A 18
|
||||
#define RD2202A 19
|
||||
#define RD7908A 20
|
||||
#define RD7911A 21
|
||||
#define RD7941A 22
|
||||
|
||||
#define NRD7945ABPT 16
|
||||
#define NRD7945ATRK 7
|
||||
|
@ -178,6 +189,10 @@ struct rd_describe {
|
|||
#define NRD7933HTRK 13
|
||||
#define NRD9134LBPT 16
|
||||
#define NRD9134LTRK 5
|
||||
#define NRD7911ABPT 32
|
||||
#define NRD7911ATRK 3
|
||||
#define NRD7941ABPT 16
|
||||
#define NRD7941ATRK 3
|
||||
|
||||
/*
|
||||
* Several HP drives have an odd number of 256 byte sectors per track.
|
||||
|
@ -190,8 +205,8 @@ struct rd_describe {
|
|||
* DISK REAL (256 BPS) HPUX (1024 BPS) BSD (512 BPS)
|
||||
* SPT x HD x CYL SPT x HD x CYL SPT x HD x CYL
|
||||
* ----- --------------- --------------- --------------
|
||||
* 7936: 123 x 7 x 1396 25 x 7 x 1716 123 x 7 x 698
|
||||
* 7937: 123 x 13 x 1396 25 x 16 x 1395 123 x 13 x 698
|
||||
* 7936H: 123 x 7 x 1396 25 x 7 x 1716 123 x 7 x 698
|
||||
* 7937H: 123 x 13 x 1396 25 x 16 x 1395 123 x 13 x 698
|
||||
*
|
||||
* 7957A: 63 x 5 x 1013 11 x 7 x 1036 22 x 7 x 1036
|
||||
* 7958A: 63 x 8 x 1013 21 x 6 x 1013 36 x 7 x 1013
|
||||
|
@ -202,6 +217,9 @@ struct rd_describe {
|
|||
*
|
||||
* 2200A: 113 x 8 x 1449 113 x 2 x 1449 113 x 4 x 1449
|
||||
* 2203A: 113 x 16 x 1449 113 x 4 x 1449 113 x 8 x 1449
|
||||
* 2202A: 113 x 16 x 1449 113 x 4 x 1449 113 x 8 x 1449
|
||||
*
|
||||
* 7908A: 35 x 5 x 370 ??? x ? x ??? 35 x 5 x 185
|
||||
*/
|
||||
#define NRD7936HBPT 123
|
||||
#define NRD7936HTRK 7
|
||||
|
@ -221,36 +239,40 @@ struct rd_describe {
|
|||
#define NRD2200ATRK 4
|
||||
#define NRD2203ABPT 113
|
||||
#define NRD2203ATRK 8
|
||||
#define NRD2202ABPT 113
|
||||
#define NRD2202ATRK 8
|
||||
#define NRD7908ABPT 35
|
||||
#define NRD7908ATRK 5
|
||||
|
||||
/* controller "unit" number */
|
||||
#define RDCTLR 15
|
||||
|
||||
/* convert 512 byte count into DEV_BSIZE count */
|
||||
#define RDSZ(x) ((x) >> (DEV_BSHIFT-9))
|
||||
#define RDSZ(x) ((x) >> (DEV_BSHIFT-9))
|
||||
|
||||
/* convert block number into sector number and back */
|
||||
#define RDBTOS(x) ((x) << (DEV_BSHIFT-8))
|
||||
#define RDSTOB(x) ((x) >> (DEV_BSHIFT-8))
|
||||
#define RDSTOB(x) ((x) >> (DEV_BSHIFT-8))
|
||||
|
||||
/* extract cyl/head/sect info from three-vector address */
|
||||
#define RDCYL(tva) ((u_long)(tva).cu_cyhd >> 8)
|
||||
#define RDHEAD(tva) ((tva).cu_cyhd & 0xFF)
|
||||
#define RDSECT(tva) ((tva).cu_sect)
|
||||
#define RDCYL(tva) ((u_long)(tva).cu_cyhd >> 8)
|
||||
#define RDHEAD(tva) ((tva).cu_cyhd & 0xFF)
|
||||
#define RDSECT(tva) ((tva).cu_sect)
|
||||
|
||||
#define REF_MASK 0x0
|
||||
#define FEF_MASK 0x0
|
||||
#define AEF_MASK 0x0
|
||||
#define IEF_MASK 0xF970
|
||||
|
||||
#define FEF_CU 0x4000 /* cross-unit */
|
||||
#define FEF_DR 0x0080 /* diagnostic result */
|
||||
#define FEF_IMR 0x0008 /* internal maintenance release */
|
||||
#define FEF_CU 0x4000 /* cross-unit */
|
||||
#define FEF_DR 0x0080 /* diagnostic result */
|
||||
#define FEF_IMR 0x0008 /* internal maintenance release */
|
||||
#define FEF_PF 0x0002 /* power fail */
|
||||
#define FEF_REXMT 0x0001 /* retransmit */
|
||||
#define AEF_UD 0x0040 /* unrecoverable data */
|
||||
#define IEF_RRMASK 0xe000 /* request release bits */
|
||||
#define IEF_MD 0x0020 /* marginal data */
|
||||
#define IEF_RD 0x0010 /* recoverable data */
|
||||
#define AEF_UD 0x0040 /* unrecoverable data */
|
||||
#define IEF_RRMASK 0xe000 /* request release bits */
|
||||
#define IEF_MD 0x0020 /* marginal data */
|
||||
#define IEF_RD 0x0010 /* recoverable data */
|
||||
|
||||
#define C_READ 0x00
|
||||
#define C_RAM 0x00 /* single vector (i.e. sector number) */
|
||||
|
@ -260,13 +282,13 @@ struct rd_describe {
|
|||
#define C_SADDR 0x10
|
||||
#define C_SLEN 0x18
|
||||
#define C_SUNIT(x) (0x20 | (x))
|
||||
#define C_SVOL(x) (0x40 | (x))
|
||||
#define C_SVOL(x) (0x40 | (x))
|
||||
#define C_NOP 0x34
|
||||
#define C_DESC 0x35
|
||||
#define C_DESC 0x35
|
||||
#define C_SREL 0x3b
|
||||
#define C_SSM 0x3e
|
||||
#define C_SRAM 0x48
|
||||
#define C_REL 0xc0
|
||||
#define C_REL 0xc0
|
||||
|
||||
#define C_CMD 0x05
|
||||
#define C_EXEC 0x0e
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rdvar.h,v 1.23 2015/04/14 20:32:35 riastradh Exp $ */
|
||||
/* $NetBSD: rdvar.h,v 1.23.22.1 2021/07/14 18:04:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -42,8 +42,7 @@
|
|||
#include <sys/rndsource.h>
|
||||
|
||||
struct rdidentinfo {
|
||||
short ri_hwid; /* 2 byte HW id */
|
||||
short ri_maxunum; /* maximum allowed unit number */
|
||||
uint16_t ri_hwid; /* 2 byte HW id */
|
||||
const char *ri_desc; /* drive type description */
|
||||
int ri_nbpt; /* DEV_BSIZE blocks per track */
|
||||
int ri_ntpc; /* tracks per cylinder */
|
||||
|
@ -69,7 +68,6 @@ struct rd_softc {
|
|||
short sc_type;
|
||||
char *sc_addr;
|
||||
int sc_resid;
|
||||
struct rd_describe sc_rddesc;
|
||||
struct hpibqueue sc_hq; /* hpib job queue entry */
|
||||
struct rd_iocmd sc_ioc;
|
||||
struct rd_rscmd sc_rsc;
|
||||
|
@ -87,16 +85,16 @@ struct rd_softc {
|
|||
/* sc_flags values */
|
||||
#define RDF_ALIVE 0x01
|
||||
#define RDF_SEEK 0x02
|
||||
#define RDF_SWAIT 0x04
|
||||
#define RDF_OPENING 0x08
|
||||
#define RDF_CLOSING 0x10
|
||||
#define RDF_WANTED 0x20
|
||||
#define RDF_WLABEL 0x40
|
||||
#define RDF_SWAIT 0x04
|
||||
#define RDF_OPENING 0x08
|
||||
#define RDF_CLOSING 0x10
|
||||
#define RDF_WANTED 0x20
|
||||
#define RDF_WLABEL 0x40
|
||||
|
||||
#define rdunit(x) ((int)(minor(x) >> 3))
|
||||
#define rdpart(x) ((int)(minor(x) & 0x7))
|
||||
#define rdpart(x) ((int)(minor(x) & 0x7))
|
||||
#define rdpunit(x) ((x) & 7)
|
||||
#define rdlabdev(d) (dev_t)(((int)(d)&~7)|2) /* rd?c */
|
||||
#define rdlabdev(d) (dev_t)(((int)(d)&~7)|2) /* rd?c */
|
||||
|
||||
#define RDRETRY 5
|
||||
#define RDWAITC 1 /* min time for timeout in seconds */
|
||||
#define RDWAITC 1 /* min time for timeout in seconds */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: Makefile.buildboot,v 1.36 2017/04/08 19:53:20 christos Exp $
|
||||
# $NetBSD: Makefile.buildboot,v 1.36.18.1 2021/07/14 18:04:04 martin Exp $
|
||||
|
||||
# RELOC=FFF00000 allows for boot prog up to FF000 (1044480) bytes long
|
||||
RELOC= FFF00000
|
||||
|
@ -20,7 +20,7 @@ CLEANFILES+= ${PROGAOUT}
|
|||
CPPFLAGS+= -I${.CURDIR}/../../.. -I${.CURDIR}/../../../.. -I${.OBJDIR}
|
||||
CPPFLAGS+= -Wno-main
|
||||
CPPFLAGS+= -D__daddr_t=int32_t
|
||||
CFLAGS= -Os -msoft-float -ffreestanding
|
||||
CFLAGS= -Os -fno-unwind-tables -msoft-float -ffreestanding
|
||||
|
||||
# XXX SHOULD NOT NEED TO DEFINE THESE!
|
||||
LIBCRT0=
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: ct.c,v 1.7 2011/07/17 20:54:40 joerg Exp $ */
|
||||
/* $NetBSD: ct.c,v 1.7.58.1 2021/07/14 18:04:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990, 1993
|
||||
|
@ -106,7 +106,7 @@ ctinit(int ctlr, int unit)
|
|||
int
|
||||
ctident(int ctlr, int unit)
|
||||
{
|
||||
struct ct_describe desc;
|
||||
struct cs80_describe desc;
|
||||
uint8_t stat, cmd[3];
|
||||
char name[7];
|
||||
int id, i;
|
||||
|
@ -131,7 +131,7 @@ ctident(int ctlr, int unit)
|
|||
cmd[1] = C_SVOL(0);
|
||||
cmd[2] = C_DESC;
|
||||
hpibsend(ctlr, unit, C_CMD, cmd, sizeof(cmd));
|
||||
hpibrecv(ctlr, unit, C_EXEC, (uint8_t *)&desc, 37);
|
||||
hpibrecv(ctlr, unit, C_EXEC, (uint8_t *)&desc, sizeof(desc));
|
||||
hpibrecv(ctlr, unit, C_QSTAT, &stat, sizeof(stat));
|
||||
memset(name, 0, sizeof(name));
|
||||
if (!stat) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hpibvar.h,v 1.5 2006/06/25 17:37:43 tsutsui Exp $ */
|
||||
/* $NetBSD: hpibvar.h,v 1.5.154.1 2021/07/14 18:04:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1990, 1993
|
||||
|
@ -31,21 +31,7 @@
|
|||
* @(#)hpibvar.h 8.1 (Berkeley) 6/10/93
|
||||
*/
|
||||
|
||||
#define HPIBA 32
|
||||
#define HPIBB 1
|
||||
#define HPIBC 8
|
||||
#define HPIBA_BA 21
|
||||
#define HPIBC_BA 30
|
||||
|
||||
#define CSA_BA 0x1F
|
||||
|
||||
#define C_DCL 20
|
||||
#define C_LAG 32
|
||||
#define C_UNL 63
|
||||
#define C_TAG 64
|
||||
#define C_UNA 94
|
||||
#define C_UNT 95
|
||||
#define C_SCG 96
|
||||
#include <hp300/dev/hpibvar.h>
|
||||
|
||||
struct hpib_softc {
|
||||
char sc_alive;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: rd.c,v 1.10 2011/07/17 20:54:40 joerg Exp $ */
|
||||
/* $NetBSD: rd.c,v 1.10.58.1 2021/07/14 18:04:04 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
|
@ -144,7 +144,7 @@ rdreset(int ctlr, int unit)
|
|||
static int
|
||||
rdident(int ctlr, int unit)
|
||||
{
|
||||
struct rd_describe desc;
|
||||
struct cs80_describe desc;
|
||||
uint8_t stat, cmd[3];
|
||||
char name[7];
|
||||
int id, i;
|
||||
|
@ -163,7 +163,7 @@ rdident(int ctlr, int unit)
|
|||
cmd[1] = C_SVOL(0);
|
||||
cmd[2] = C_DESC;
|
||||
hpibsend(ctlr, unit, C_CMD, cmd, sizeof(cmd));
|
||||
hpibrecv(ctlr, unit, C_EXEC, (uint8_t *)&desc, 37);
|
||||
hpibrecv(ctlr, unit, C_EXEC, (uint8_t *)&desc, sizeof(desc));
|
||||
hpibrecv(ctlr, unit, C_QSTAT, &stat, sizeof(stat));
|
||||
memset(name, 0, sizeof(name));
|
||||
if (!stat) {
|
||||
|
|
Loading…
Reference in New Issue