Clean-up the DIO bus. Includes two main changes:
1) Pass address and ipl locators at attachment; 2) Remove hack which made the internal HP-IB controller look like a DIO device. The hack to allow the nhpib driver to support internal and DIO controllers appears to be a leftover from 4.3BD where it was not possible to have a driver attach to different busses. NetBSD has supported bus-dependent attachments for a long time.
This commit is contained in:
parent
80c79650a2
commit
8e726b5268
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: GENERIC,v 1.92 2003/04/26 14:10:12 ragge Exp $
|
||||
# $NetBSD: GENERIC,v 1.93 2003/05/24 06:21:21 gmcgarry Exp $
|
||||
#
|
||||
# GENERIC machine description file
|
||||
#
|
||||
|
@ -22,7 +22,7 @@ include "arch/hp300/conf/std.hp300"
|
|||
|
||||
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
|
||||
|
||||
#ident "GENERIC-$Revision: 1.92 $"
|
||||
#ident "GENERIC-$Revision: 1.93 $"
|
||||
|
||||
maxusers 32 # estimated number of users
|
||||
|
||||
|
@ -168,6 +168,7 @@ hil* at intio? # Human Interface Loop
|
|||
options UK_KEYBOARD # include United Kingdom HIL keymap
|
||||
options SE_KEYBOARD # include Swedish HIL keymap
|
||||
frodo* at intio? # Frodo utility chip found on 4xx's
|
||||
nhpib* at intio? # slow internal HP-IB
|
||||
|
||||
# 8250-like serial ports found on Frodo ASIC
|
||||
#dnkbd0 at frodo? offset 0x0 # Domain keyboard flavor
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# $NetBSD: files.hp300,v 1.64 2003/03/06 18:28:52 thorpej Exp $
|
||||
# $NetBSD: files.hp300,v 1.65 2003/05/24 06:21:21 gmcgarry Exp $
|
||||
#
|
||||
# hp300-specific configuration info
|
||||
|
||||
|
@ -136,7 +136,8 @@ file arch/hp300/dev/if_le.c le
|
|||
define hpibdev { }
|
||||
|
||||
device nhpib: hpibdev
|
||||
attach nhpib at dio
|
||||
attach nhpib at intio with nhpib_intio
|
||||
attach nhpib at dio with nhpib_dio
|
||||
file arch/hp300/dev/nhpib.c nhpib
|
||||
|
||||
device fhpib: hpibdev
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dca.c,v 1.54 2003/03/06 18:24:52 thorpej Exp $ */
|
||||
/* $NetBSD: dca.c,v 1.55 2003/05/24 06:21:22 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -84,7 +84,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dca.c,v 1.54 2003/03/06 18:24:52 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dca.c,v 1.55 2003/05/24 06:21:22 gmcgarry Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
|
@ -101,14 +101,10 @@ __KERNEL_RCSID(0, "$NetBSD: dca.c,v 1.54 2003/03/06 18:24:52 thorpej Exp $");
|
|||
#include <sys/syslog.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/bus.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include <hp300/dev/dioreg.h>
|
||||
#include <hp300/dev/diovar.h>
|
||||
#include <hp300/dev/diodevs.h>
|
||||
#include <hp300/dev/dcareg.h>
|
||||
|
@ -120,6 +116,9 @@ struct dca_softc {
|
|||
int sc_oflows; /* overflow counter */
|
||||
short sc_flags; /* state flags */
|
||||
|
||||
bus_space_tag_t sc_bst;
|
||||
bus_space_handle_t sc_bsh;
|
||||
|
||||
/*
|
||||
* Bits for sc_flags.
|
||||
*/
|
||||
|
@ -255,7 +254,6 @@ dcaattach(parent, self, aux)
|
|||
struct dcadevice *dca;
|
||||
int unit = self->dv_unit;
|
||||
int scode = da->da_scode;
|
||||
int ipl;
|
||||
|
||||
if (scode == dcaconscode) {
|
||||
dca = dca_cn;
|
||||
|
@ -269,20 +267,21 @@ dcaattach(parent, self, aux)
|
|||
cn_tab->cn_dev = makedev(cdevsw_lookup_major(&dca_cdevsw),
|
||||
unit);
|
||||
} else {
|
||||
dca = (struct dcadevice *)iomap(dio_scodetopa(da->da_scode),
|
||||
da->da_size);
|
||||
if (dca == NULL) {
|
||||
|
||||
sc->sc_bst = da->da_bst;
|
||||
if (bus_space_map(da->da_bst, da->da_addr, da->da_size,
|
||||
BUS_SPACE_MAP_LINEAR, &sc->sc_bsh)) {
|
||||
printf("\n%s: can't map registers\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
dca = (struct dcadevice *)bus_space_vaddr(sc->sc_bst,
|
||||
sc->sc_bsh);
|
||||
|
||||
}
|
||||
|
||||
sc->sc_dca = dca;
|
||||
|
||||
ipl = DIO_IPL(dca);
|
||||
printf(" ipl %d", ipl);
|
||||
|
||||
DELAY(1000);
|
||||
dca->dca_reset = 0xFF;
|
||||
DELAY(1000);
|
||||
|
@ -294,7 +293,7 @@ dcaattach(parent, self, aux)
|
|||
sc->sc_flags |= DCA_HASFIFO;
|
||||
|
||||
/* Establish interrupt handler. */
|
||||
(void) dio_intr_establish(dcaintr, sc, ipl,
|
||||
(void) dio_intr_establish(dcaintr, sc, da->da_ipl,
|
||||
(sc->sc_flags & DCA_HASFIFO) ? IPL_TTY : IPL_TTYNOBUF);
|
||||
|
||||
sc->sc_flags |= DCA_ACTIVE;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dcm.c,v 1.58 2003/05/04 02:10:07 gmcgarry Exp $ */
|
||||
/* $NetBSD: dcm.c,v 1.59 2003/05/24 06:21:22 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -89,7 +89,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dcm.c,v 1.58 2003/05/04 02:10:07 gmcgarry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dcm.c,v 1.59 2003/05/24 06:21:22 gmcgarry Exp $");
|
||||
|
||||
#include "opt_kgdb.h"
|
||||
|
||||
|
@ -106,13 +106,10 @@ __KERNEL_RCSID(0, "$NetBSD: dcm.c,v 1.58 2003/05/04 02:10:07 gmcgarry Exp $");
|
|||
#include <sys/time.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/cpu.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#include <hp300/dev/dioreg.h>
|
||||
#include <hp300/dev/diovar.h>
|
||||
#include <hp300/dev/diodevs.h>
|
||||
#include <hp300/dev/dcmreg.h>
|
||||
|
@ -249,6 +246,10 @@ static char iconv[16] = {
|
|||
|
||||
struct dcm_softc {
|
||||
struct device sc_dev; /* generic device glue */
|
||||
|
||||
bus_space_tag_t sc_bst;
|
||||
bus_space_handle_t sc_bsh;
|
||||
|
||||
struct dcmdevice *sc_dcm; /* pointer to hardware */
|
||||
struct tty *sc_tty[NDCMPORT]; /* our tty instances */
|
||||
struct modemreg *sc_modem[NDCMPORT]; /* modem control */
|
||||
|
@ -368,7 +369,7 @@ dcmattach(parent, self, aux)
|
|||
struct dcmdevice *dcm;
|
||||
int brd = self->dv_unit;
|
||||
int scode = da->da_scode;
|
||||
int i, mbits, code, ipl;
|
||||
int i, mbits, code;
|
||||
|
||||
sc->sc_flags = 0;
|
||||
|
||||
|
@ -384,20 +385,19 @@ dcmattach(parent, self, aux)
|
|||
cn_tab->cn_dev = makedev(cdevsw_lookup_major(&dcm_cdevsw),
|
||||
(brd << 2) | DCMCONSPORT);
|
||||
} else {
|
||||
dcm = (struct dcmdevice *)iomap(dio_scodetopa(da->da_scode),
|
||||
da->da_size);
|
||||
if (dcm == NULL) {
|
||||
sc->sc_bst = da->da_bst;
|
||||
if (bus_space_map(sc->sc_bst, da->da_addr, da->da_size,
|
||||
BUS_SPACE_MAP_LINEAR, &sc->sc_bsh)) {
|
||||
printf("\n%s: can't map registers\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
return;
|
||||
}
|
||||
dcm = (struct dcmdevice *)bus_space_vaddr(sc->sc_bst,
|
||||
sc->sc_bsh);
|
||||
}
|
||||
|
||||
sc->sc_dcm = dcm;
|
||||
|
||||
ipl = DIO_IPL(dcm);
|
||||
printf(" ipl %d", ipl);
|
||||
|
||||
/*
|
||||
* XXX someone _should_ fix this; the self test screws
|
||||
* autoconfig messages.
|
||||
|
@ -415,7 +415,7 @@ dcmattach(parent, self, aux)
|
|||
sc->sc_flags |= DCM_ACTIVE;
|
||||
|
||||
/* Establish the interrupt handler. */
|
||||
(void) dio_intr_establish(dcmintr, sc, ipl, IPL_TTY);
|
||||
(void) dio_intr_establish(dcmintr, sc, da->da_ipl, IPL_TTY);
|
||||
|
||||
if (dcmistype == DIS_TIMER)
|
||||
dcmsetischeme(brd, DIS_RESET|DIS_TIMER);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: dio.c,v 1.22 2003/04/01 20:41:36 thorpej Exp $ */
|
||||
/* $NetBSD: dio.c,v 1.23 2003/05/24 06:21:22 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: dio.c,v 1.22 2003/04/01 20:41:36 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dio.c,v 1.23 2003/05/24 06:21:22 gmcgarry Exp $");
|
||||
|
||||
#define _HP300_INTR_H_PRIVATE
|
||||
|
||||
|
@ -50,6 +50,8 @@ __KERNEL_RCSID(0, "$NetBSD: dio.c,v 1.22 2003/04/01 20:41:36 thorpej Exp $");
|
|||
#include <sys/kernel.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
|
@ -64,9 +66,11 @@ __KERNEL_RCSID(0, "$NetBSD: dio.c,v 1.22 2003/04/01 20:41:36 thorpej Exp $");
|
|||
#include <hp300/dev/diodevs.h>
|
||||
#include <hp300/dev/diodevs_data.h>
|
||||
|
||||
extern caddr_t internalhpib;
|
||||
#include "locators.h"
|
||||
#define diocf_scode cf_loc[DIOCF_SCODE]
|
||||
|
||||
int dio_scodesize __P((struct dio_attach_args *));
|
||||
|
||||
static int dio_scodesize __P((struct dio_attach_args *));
|
||||
char *dio_devinfo __P((struct dio_attach_args *, char *, size_t));
|
||||
|
||||
int diomatch __P((struct device *, struct cfdata *, void *));
|
||||
|
@ -100,7 +104,7 @@ dioattach(parent, self, aux)
|
|||
{
|
||||
struct dio_attach_args da;
|
||||
caddr_t pa, va;
|
||||
int scode, scmax, didmap, scodesize;
|
||||
int scode, scmax, scodesize;
|
||||
|
||||
printf("\n");
|
||||
|
||||
|
@ -112,17 +116,11 @@ dioattach(parent, self, aux)
|
|||
continue;
|
||||
}
|
||||
|
||||
didmap = 0;
|
||||
|
||||
/*
|
||||
* Temporarily map the space corresponding to
|
||||
* the current select code unless:
|
||||
* - this is the internal hpib select code,
|
||||
*/
|
||||
pa = dio_scodetopa(scode);
|
||||
if ((scode == 7) && internalhpib)
|
||||
va = internalhpib = (caddr_t)IIOV(pa);
|
||||
else {
|
||||
va = iomap(pa, PAGE_SIZE);
|
||||
if (va == NULL) {
|
||||
printf("%s: can't map scode %d\n",
|
||||
|
@ -130,12 +128,9 @@ dioattach(parent, self, aux)
|
|||
scode++;
|
||||
continue;
|
||||
}
|
||||
didmap = 1;
|
||||
}
|
||||
|
||||
/* Check for hardware. */
|
||||
if (badaddr(va)) {
|
||||
if (didmap)
|
||||
iounmap(va, PAGE_SIZE);
|
||||
scode++;
|
||||
continue;
|
||||
|
@ -145,25 +140,18 @@ dioattach(parent, self, aux)
|
|||
memset(&da, 0, sizeof(da));
|
||||
da.da_bst = HP300_BUS_SPACE_DIO;
|
||||
da.da_scode = scode;
|
||||
/*
|
||||
* Internal HP-IB doesn't always return a device ID,
|
||||
* so we rely on the sysflags.
|
||||
*/
|
||||
if ((scode == 7) && internalhpib)
|
||||
da.da_id = DIO_DEVICE_ID_IHPIB;
|
||||
else
|
||||
da.da_id = DIO_ID(va);
|
||||
|
||||
da.da_id = DIO_ID(va);
|
||||
if (DIO_ISFRAMEBUFFER(da.da_id))
|
||||
da.da_secid = DIO_SECID(va);
|
||||
|
||||
da.da_addr = (bus_addr_t)dio_scodetopa(scode);
|
||||
da.da_size = DIO_SIZE(scode, va);
|
||||
scodesize = dio_scodesize(&da);
|
||||
if (DIO_ISDIO(scode))
|
||||
da.da_size *= scodesize;
|
||||
da.da_ipl = DIO_IPL(va);
|
||||
|
||||
/* No longer need the device to be mapped. */
|
||||
if (didmap)
|
||||
iounmap(va, PAGE_SIZE);
|
||||
|
||||
/* Attach matching device. */
|
||||
|
@ -198,7 +186,7 @@ dioprint(aux, pnp)
|
|||
if (pnp)
|
||||
aprint_normal("%s at %s",
|
||||
dio_devinfo(da, buf, sizeof(buf)), pnp);
|
||||
aprint_normal(" scode %d", da->da_scode);
|
||||
aprint_normal(" scode %d ipl %d", da->da_scode, da->da_ipl);
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
|
@ -211,9 +199,7 @@ dio_scodetopa(scode)
|
|||
{
|
||||
u_long rval;
|
||||
|
||||
if (scode == 7 && internalhpib)
|
||||
rval = DIO_IHPIBADDR;
|
||||
else if (DIO_ISDIO(scode))
|
||||
if (DIO_ISDIO(scode))
|
||||
rval = DIO_BASE + (scode * DIO_DEVSIZE);
|
||||
else if (DIO_ISDIOII(scode))
|
||||
rval = DIOII_BASE + ((scode - DIOII_SCBASE) * DIOII_DEVSIZE);
|
||||
|
@ -227,19 +213,12 @@ dio_scodetopa(scode)
|
|||
* Return the select code size for this device, defaulting to 1
|
||||
* if we don't know what kind of device we have.
|
||||
*/
|
||||
int
|
||||
static int
|
||||
dio_scodesize(da)
|
||||
struct dio_attach_args *da;
|
||||
{
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Deal with lame internal HP-IB controllers which don't have
|
||||
* consistent/reliable device ids.
|
||||
*/
|
||||
if (da->da_scode == 7 && internalhpib)
|
||||
return (1);
|
||||
|
||||
/*
|
||||
* Find the dio_devdata matchind the primary id.
|
||||
* If we're a framebuffer, we also check the secondary id.
|
||||
|
@ -280,15 +259,6 @@ dio_devinfo(da, buf, buflen)
|
|||
|
||||
memset(buf, 0, buflen);
|
||||
|
||||
/*
|
||||
* Deal with lame internal HP-IB controllers which don't have
|
||||
* consistent/reliable device ids.
|
||||
*/
|
||||
if (da->da_scode == 7 && internalhpib) {
|
||||
sprintf(buf, DIO_DEVICE_DESC_IHPIB);
|
||||
return (buf);
|
||||
}
|
||||
|
||||
#ifdef DIOVERBOSE
|
||||
/*
|
||||
* Find the description matching our primary id.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: diovar.h,v 1.7 1998/01/11 21:53:05 thorpej Exp $ */
|
||||
/* $NetBSD: diovar.h,v 1.8 2003/05/24 06:21:22 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -48,7 +48,9 @@
|
|||
struct dio_attach_args {
|
||||
bus_space_tag_t da_bst; /* bus space tag */
|
||||
int da_scode; /* select code */
|
||||
int da_addr; /* device address */
|
||||
int da_size; /* size of address space */
|
||||
int da_ipl; /* interrupt priority level */
|
||||
u_int8_t da_id; /* primary device id */
|
||||
u_int8_t da_secid; /* secondary device id */
|
||||
};
|
||||
|
@ -73,9 +75,6 @@ struct dio_devdesc {
|
|||
const char *dd_desc; /* description */
|
||||
};
|
||||
|
||||
#include "locators.h"
|
||||
#define diocf_scode cf_loc[DIOCF_SCODE]
|
||||
|
||||
#ifdef _KERNEL
|
||||
void *dio_scodetopa __P((int));
|
||||
void *dio_intr_establish __P((int (*)(void *), void *, int, int));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fhpib.c,v 1.25 2003/05/03 18:10:47 wiz Exp $ */
|
||||
/* $NetBSD: fhpib.c,v 1.26 2003/05/24 06:21:22 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -76,7 +76,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: fhpib.c,v 1.25 2003/05/03 18:10:47 wiz Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: fhpib.c,v 1.26 2003/05/24 06:21:22 gmcgarry Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -88,7 +88,6 @@ __KERNEL_RCSID(0, "$NetBSD: fhpib.c,v 1.25 2003/05/03 18:10:47 wiz Exp $");
|
|||
#include <machine/autoconf.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <hp300/dev/dioreg.h>
|
||||
#include <hp300/dev/diovar.h>
|
||||
#include <hp300/dev/diodevs.h>
|
||||
|
||||
|
@ -181,7 +180,6 @@ fhpibattach(parent, self, aux)
|
|||
struct fhpib_softc *sc = (struct fhpib_softc *)self;
|
||||
struct dio_attach_args *da = aux;
|
||||
struct hpibdev_attach_args ha;
|
||||
int ipl;
|
||||
|
||||
sc->sc_regs = (struct fhpibdevice *)iomap(dio_scodetopa(da->da_scode),
|
||||
da->da_size);
|
||||
|
@ -190,11 +188,10 @@ fhpibattach(parent, self, aux)
|
|||
return;
|
||||
}
|
||||
|
||||
ipl = DIO_IPL(sc->sc_regs);
|
||||
printf(" ipl %d: %s\n", ipl, DIO_DEVICE_DESC_FHPIB);
|
||||
printf(": %s\n", DIO_DEVICE_DESC_FHPIB);
|
||||
|
||||
/* Establish the interrupt handler. */
|
||||
(void) dio_intr_establish(fhpibintr, sc, ipl, IPL_BIO);
|
||||
(void) dio_intr_establish(fhpibintr, sc, da->da_ipl, IPL_BIO);
|
||||
|
||||
callout_init(&sc->sc_dmadone_ch);
|
||||
callout_init(&sc->sc_ppwatch_ch);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: if_le.c,v 1.52 2002/10/20 05:54:29 gmcgarry Exp $ */
|
||||
/* $NetBSD: if_le.c,v 1.53 2003/05/24 06:21:22 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -75,7 +75,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.52 2002/10/20 05:54:29 gmcgarry Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.53 2003/05/24 06:21:22 gmcgarry Exp $");
|
||||
|
||||
#include "opt_inet.h"
|
||||
#include "bpfilter.h"
|
||||
|
@ -92,7 +92,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.52 2002/10/20 05:54:29 gmcgarry Exp $");
|
|||
#include <dev/ic/lancevar.h>
|
||||
#include <dev/ic/am7990var.h>
|
||||
|
||||
#include <hp300/dev/dioreg.h>
|
||||
#include <hp300/dev/diovar.h>
|
||||
#include <hp300/dev/diodevs.h>
|
||||
#include <hp300/dev/if_lereg.h>
|
||||
|
@ -202,7 +201,7 @@ leattach(struct device *parent, struct device *self, void *aux)
|
|||
bus_space_tag_t bst = da->da_bst;
|
||||
bus_space_handle_t bsh0, bsh1, bsh2;
|
||||
bus_size_t offset;
|
||||
int i, ipl;
|
||||
int i;
|
||||
|
||||
if (bus_space_map(bst, (bus_addr_t)dio_scodetopa(da->da_scode),
|
||||
da->da_size, 0, &bsh0)) {
|
||||
|
@ -231,9 +230,6 @@ leattach(struct device *parent, struct device *self, void *aux)
|
|||
bus_space_write_1(bst, bsh0, LER0_ID, 0xff);
|
||||
DELAY(100);
|
||||
|
||||
ipl = DIO_IPL((caddr_t)bsh0); /* XXX */
|
||||
printf(" ipl %d", ipl);
|
||||
|
||||
sc->sc_conf3 = LE_C3_BSWP;
|
||||
sc->sc_addr = 0;
|
||||
sc->sc_memsize = LE_BUFSIZE;
|
||||
|
@ -264,7 +260,7 @@ leattach(struct device *parent, struct device *self, void *aux)
|
|||
am7990_config(&lesc->sc_am7990);
|
||||
|
||||
/* Establish the interrupt handler. */
|
||||
(void) dio_intr_establish(leintr, sc, ipl, IPL_NET);
|
||||
(void) dio_intr_establish(leintr, sc, da->da_ipl, IPL_NET);
|
||||
bus_space_write_1(bst, bsh0, LER0_STATUS, LE_IE);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: intio.c,v 1.14 2003/01/01 01:34:46 thorpej Exp $ */
|
||||
/* $NetBSD: intio.c,v 1.15 2003/05/24 06:21:22 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1998, 2001 The NetBSD Foundation, Inc.
|
||||
|
@ -41,7 +41,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.14 2003/01/01 01:34:46 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: intio.c,v 1.15 2003/05/24 06:21:22 gmcgarry Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -65,6 +65,7 @@ CFATTACH_DECL(intio, sizeof(struct device),
|
|||
const struct intio_builtins intio_3xx_builtins[] = {
|
||||
{ "rtc", 0x020000, -1},
|
||||
{ "hil", 0x028000, 1},
|
||||
{ "hpib", 0x078000, 3},
|
||||
{ "dma", 0x100000, 1},
|
||||
{ "fb", 0x160000, -1},
|
||||
};
|
||||
|
@ -77,6 +78,7 @@ const struct intio_builtins intio_4xx_builtins[] = {
|
|||
{ "rtc", 0x020000, -1},
|
||||
{ "frodo", 0x01c000, 5},
|
||||
{ "hil", 0x028000, 1},
|
||||
{ "hpib", 0x078000, 3},
|
||||
{ "dma", 0x100000, 1},
|
||||
};
|
||||
#define nintio_4xx_builtins \
|
||||
|
@ -84,6 +86,7 @@ const struct intio_builtins intio_4xx_builtins[] = {
|
|||
#endif
|
||||
|
||||
static int intio_matched = 0;
|
||||
extern caddr_t internalhpib;
|
||||
|
||||
int
|
||||
intiomatch(parent, match, aux)
|
||||
|
@ -144,6 +147,14 @@ intioattach(parent, self, aux)
|
|||
memset(&ia, 0, sizeof(ia));
|
||||
|
||||
for (i=0; i<ndevs; i++) {
|
||||
|
||||
/*
|
||||
* Internal HP-IB doesn't always return a device ID,
|
||||
* so we rely on the sysflags.
|
||||
*/
|
||||
if (ib[i].ib_offset == 0x078000 && !internalhpib)
|
||||
continue;
|
||||
|
||||
strncpy(ia.ia_modname, ib[i].ib_modname, INTIO_MOD_LEN);
|
||||
ia.ia_modname[INTIO_MOD_LEN] = '\0';
|
||||
ia.ia_bst = HP300_BUS_SPACE_INTIO;
|
||||
|
@ -163,9 +174,9 @@ intioprint(aux, pnp)
|
|||
|
||||
if (pnp != NULL)
|
||||
aprint_normal("%s at %s", ia->ia_modname, pnp);
|
||||
if (ia->ia_iobase != 0) {
|
||||
if (ia->ia_iobase != 0 && pnp == NULL) {
|
||||
aprint_normal(" addr 0x%lx", INTIOBASE + ia->ia_iobase);
|
||||
if (ia->ia_ipl != -1 && pnp != NULL)
|
||||
if (ia->ia_ipl != -1)
|
||||
aprint_normal(" ipl %d", ia->ia_ipl);
|
||||
}
|
||||
return (UNCONF);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: nhpib.c,v 1.26 2002/10/02 05:15:53 thorpej Exp $ */
|
||||
/* $NetBSD: nhpib.c,v 1.27 2003/05/24 06:21:22 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -76,7 +76,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: nhpib.c,v 1.26 2002/10/02 05:15:53 thorpej Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: nhpib.c,v 1.27 2003/05/24 06:21:22 gmcgarry Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -85,13 +85,11 @@ __KERNEL_RCSID(0, "$NetBSD: nhpib.c,v 1.26 2002/10/02 05:15:53 thorpej Exp $");
|
|||
#include <sys/buf.h>
|
||||
#include <sys/device.h>
|
||||
|
||||
#include <machine/autoconf.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <hp300/dev/dioreg.h>
|
||||
#include <hp300/dev/intiovar.h>
|
||||
#include <hp300/dev/diovar.h>
|
||||
#include <hp300/dev/diodevs.h>
|
||||
|
||||
#include <hp300/dev/dmavar.h>
|
||||
|
||||
#include <hp300/dev/nhpibreg.h>
|
||||
|
@ -149,75 +147,132 @@ struct hpib_controller nhpib_controller = {
|
|||
|
||||
struct nhpib_softc {
|
||||
struct device sc_dev; /* generic device glue */
|
||||
|
||||
bus_space_tag_t sc_bst;
|
||||
bus_space_handle_t sc_bsh;
|
||||
|
||||
struct nhpibdevice *sc_regs; /* device registers */
|
||||
struct hpibbus_softc *sc_hpibbus; /* XXX */
|
||||
|
||||
int sc_myaddr;
|
||||
int sc_type;
|
||||
|
||||
struct callout sc_read_ch;
|
||||
struct callout sc_ppwatch_ch;
|
||||
};
|
||||
|
||||
int nhpibmatch __P((struct device *, struct cfdata *, void *));
|
||||
void nhpibattach __P((struct device *, struct device *, void *));
|
||||
int nhpib_dio_match __P((struct device *, struct cfdata *, void *));
|
||||
void nhpib_dio_attach __P((struct device *, struct device *, void *));
|
||||
int nhpib_intio_match __P((struct device *, struct cfdata *, void *));
|
||||
void nhpib_intio_attach __P((struct device *, struct device *, void *));
|
||||
|
||||
CFATTACH_DECL(nhpib, sizeof(struct nhpib_softc),
|
||||
nhpibmatch, nhpibattach, NULL, NULL);
|
||||
void nhpib_common_attach(struct nhpib_softc *, const char *);
|
||||
|
||||
CFATTACH_DECL(nhpib_dio, sizeof(struct nhpib_softc),
|
||||
nhpib_dio_match, nhpib_dio_attach, NULL, NULL);
|
||||
|
||||
CFATTACH_DECL(nhpib_intio, sizeof(struct nhpib_softc),
|
||||
nhpib_intio_match, nhpib_intio_attach, NULL, NULL);
|
||||
|
||||
int
|
||||
nhpibmatch(parent, match, aux)
|
||||
nhpib_intio_match(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct intio_attach_args *ia = aux;
|
||||
|
||||
if (strcmp("hpib", ia->ia_modname) == 0)
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
nhpib_dio_match(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
struct dio_attach_args *da = aux;
|
||||
|
||||
if (da->da_id == DIO_DEVICE_ID_NHPIB ||
|
||||
da->da_id == DIO_DEVICE_ID_IHPIB)
|
||||
if (da->da_id == DIO_DEVICE_ID_NHPIB)
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
nhpibattach(parent, self, aux)
|
||||
nhpib_intio_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct nhpib_softc *sc = (struct nhpib_softc *)self;
|
||||
struct intio_attach_args *ia = aux;
|
||||
const char *desc = "internal HP-IB";
|
||||
|
||||
sc->sc_bst = ia->ia_bst;
|
||||
if (bus_space_map(ia->ia_bst, ia->ia_iobase, INTIO_DEVSIZE, 0,
|
||||
&sc->sc_bsh)) {
|
||||
printf(": can't map registers\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sc->sc_myaddr = HPIBA_BA;
|
||||
sc->sc_type = HPIBA;
|
||||
|
||||
nhpib_common_attach(sc, desc);
|
||||
|
||||
/* establish the interrupt handler */
|
||||
(void) intio_intr_establish(nhpibintr, sc, ia->ia_ipl, IPL_BIO);
|
||||
}
|
||||
|
||||
void
|
||||
nhpib_dio_attach(parent, self, aux)
|
||||
struct device *parent, *self;
|
||||
void *aux;
|
||||
{
|
||||
struct nhpib_softc *sc = (struct nhpib_softc *)self;
|
||||
struct dio_attach_args *da = aux;
|
||||
struct hpibdev_attach_args ha;
|
||||
const char *desc;
|
||||
int ipl, type = HPIBA;
|
||||
const char *desc = DIO_DEVICE_DESC_NHPIB;
|
||||
|
||||
sc->sc_regs = (struct nhpibdevice *)iomap(dio_scodetopa(da->da_scode),
|
||||
da->da_size);
|
||||
if (sc->sc_regs == NULL) {
|
||||
printf("\n%s: can't map registers\n", self->dv_xname);
|
||||
sc->sc_bst = da->da_bst;
|
||||
if (bus_space_map(sc->sc_bst, da->da_addr, da->da_size, 0,
|
||||
&sc->sc_bsh)) {
|
||||
printf(": can't map registers\n");
|
||||
return;
|
||||
}
|
||||
|
||||
ipl = DIO_IPL(sc->sc_regs);
|
||||
/* read address off switches */
|
||||
sc->sc_myaddr = bus_space_read_1(sc->sc_bst, sc->sc_bsh, 5);
|
||||
sc->sc_type = HPIBB;
|
||||
|
||||
if (da->da_scode == 7 && internalhpib)
|
||||
desc = DIO_DEVICE_DESC_IHPIB;
|
||||
else if (da->da_id == DIO_DEVICE_ID_NHPIB) {
|
||||
type = HPIBB;
|
||||
desc = DIO_DEVICE_DESC_NHPIB;
|
||||
} else
|
||||
desc = "unknown HP-IB!";
|
||||
nhpib_common_attach(sc, desc);
|
||||
|
||||
printf(" ipl %d: %s\n", ipl, desc);
|
||||
/* establish the interrupt handler */
|
||||
(void)dio_intr_establish(nhpibintr, sc, da->da_ipl, IPL_BIO);
|
||||
}
|
||||
|
||||
/* Establish the interrupt handler. */
|
||||
(void) dio_intr_establish(nhpibintr, sc, ipl, IPL_BIO);
|
||||
void
|
||||
nhpib_common_attach(sc, desc)
|
||||
struct nhpib_softc *sc;
|
||||
const char *desc;
|
||||
{
|
||||
struct hpibdev_attach_args ha;
|
||||
|
||||
printf(": %s\n", desc);
|
||||
|
||||
sc->sc_regs = (struct nhpibdevice *)bus_space_vaddr(sc->sc_bst,
|
||||
sc->sc_bsh);
|
||||
|
||||
callout_init(&sc->sc_read_ch);
|
||||
callout_init(&sc->sc_ppwatch_ch);
|
||||
|
||||
ha.ha_ops = &nhpib_controller;
|
||||
ha.ha_type = type; /* XXX */
|
||||
ha.ha_ba = (type == HPIBA) ? HPIBA_BA :
|
||||
(sc->sc_regs->hpib_csa & CSA_BA);
|
||||
ha.ha_type = sc->sc_type; /* XXX */
|
||||
ha.ha_ba = sc->sc_myaddr;
|
||||
ha.ha_softcpp = &sc->sc_hpibbus; /* XXX */
|
||||
(void)config_found(self, &ha, hpibdevprint);
|
||||
(void)config_found((void *)sc, &ha, hpibdevprint);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: scsi.c,v 1.35 2003/05/03 18:10:47 wiz Exp $ */
|
||||
/* $NetBSD: scsi.c,v 1.36 2003/05/24 06:21:23 gmcgarry Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -83,7 +83,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: scsi.c,v 1.35 2003/05/03 18:10:47 wiz Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: scsi.c,v 1.36 2003/05/24 06:21:23 gmcgarry Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -95,7 +95,6 @@ __KERNEL_RCSID(0, "$NetBSD: scsi.c,v 1.35 2003/05/03 18:10:47 wiz Exp $");
|
|||
#include <machine/intr.h>
|
||||
#include <machine/hp300spu.h>
|
||||
|
||||
#include <hp300/dev/dioreg.h>
|
||||
#include <hp300/dev/diovar.h>
|
||||
#include <hp300/dev/diodevs.h>
|
||||
|
||||
|
@ -329,7 +328,7 @@ scsiattach(parent, self, aux)
|
|||
struct scsi_softc *hs = (struct scsi_softc *)self;
|
||||
struct dio_attach_args *da = aux;
|
||||
struct scsidevice *hd;
|
||||
int ipl, unit = self->dv_unit;
|
||||
int unit = self->dv_unit;
|
||||
|
||||
/*
|
||||
* Set up DMA job queue entry.
|
||||
|
@ -348,14 +347,11 @@ scsiattach(parent, self, aux)
|
|||
printf("\n%s: can't map registers\n", self->dv_xname);
|
||||
return;
|
||||
}
|
||||
ipl = DIO_IPL(hd);
|
||||
|
||||
printf(" ipl %d", ipl);
|
||||
|
||||
hs->sc_regs = hd;
|
||||
|
||||
/* Establish the interrupt handler. */
|
||||
(void) dio_intr_establish(scsiintr, hs, ipl, IPL_BIO);
|
||||
(void) dio_intr_establish(scsiintr, hs, da->da_ipl, IPL_BIO);
|
||||
|
||||
/* Reset the controller. */
|
||||
scsireset(unit);
|
||||
|
|
Loading…
Reference in New Issue