diff options
-rw-r--r-- | sys/alpha/alpha/genassym.c | 8 | ||||
-rw-r--r-- | sys/alpha/alpha/interrupt.c | 38 | ||||
-rw-r--r-- | sys/alpha/alpha/machdep.c | 5 | ||||
-rw-r--r-- | sys/alpha/alpha/swtch.s | 11 | ||||
-rw-r--r-- | sys/alpha/alpha/sys_machdep.c | 34 | ||||
-rw-r--r-- | sys/alpha/include/chipset.h | 25 | ||||
-rw-r--r-- | sys/alpha/include/intr.h | 17 | ||||
-rw-r--r-- | sys/alpha/include/proc.h | 10 | ||||
-rw-r--r-- | sys/alpha/isa/isa.c | 454 | ||||
-rw-r--r-- | sys/alpha/pci/apecs.c | 30 | ||||
-rw-r--r-- | sys/alpha/pci/cia.c | 143 | ||||
-rw-r--r-- | sys/alpha/pci/lca.c | 31 | ||||
-rw-r--r-- | sys/alpha/pci/pcibus.c | 129 | ||||
-rw-r--r-- | sys/alpha/pci/pcibus.h | 26 | ||||
-rw-r--r-- | sys/alpha/tlsb/dwlpx.c | 8 | ||||
-rw-r--r-- | sys/alpha/tlsb/gbus.c | 6 | ||||
-rw-r--r-- | sys/alpha/tlsb/kftxx.c | 6 | ||||
-rw-r--r-- | sys/alpha/tlsb/tlsb.c | 32 | ||||
-rw-r--r-- | sys/alpha/tlsb/zs_tlsb.c | 14 | ||||
-rw-r--r-- | sys/dev/atkbdc/psm.c | 17 | ||||
-rw-r--r-- | sys/dev/sio/sio.c | 17 | ||||
-rw-r--r-- | sys/isa/isavar.h | 30 | ||||
-rw-r--r-- | sys/isa/psm.c | 17 | ||||
-rw-r--r-- | sys/isa/sio.c | 17 | ||||
-rw-r--r-- | sys/isa/syscons.c | 17 | ||||
-rw-r--r-- | sys/powerpc/powerpc/genassym.c | 8 |
26 files changed, 916 insertions, 234 deletions
diff --git a/sys/alpha/alpha/genassym.c b/sys/alpha/alpha/genassym.c index ca99b6a..33febfc 100644 --- a/sys/alpha/alpha/genassym.c +++ b/sys/alpha/alpha/genassym.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 - * $Id: genassym.c,v 1.2 1998/06/14 13:44:43 dfr Exp $ + * $Id: genassym.c,v 1.3 1998/07/12 16:08:15 dfr Exp $ */ #include <sys/param.h> @@ -46,6 +46,7 @@ #include <sys/resource.h> #include <sys/resourcevar.h> #include <machine/frame.h> +#include <machine/chipset.h> #include <sys/vmmeter.h> #include <vm/vm.h> #include <vm/vm_param.h> @@ -95,7 +96,12 @@ main() OFF(P_PID, struct proc, p_pid); OFF(P_SWITCHTIME, struct proc, p_switchtime); OFF(P_RUNTIME, struct proc, p_runtime); + OFF(P_MD_FLAGS, struct proc, p_md.md_flags); OFF(P_MD_PCBPADDR, struct proc, p_md.md_pcbpaddr); + OFF(P_MD_HAE, struct proc, p_md.md_hae); + CONST1(MDP_HAEUSED); + + OFF(CHIPSET_WRITE_HAE, struct alpha_chipset, write_hae); OFF(PH_LINK, struct prochd, ph_link); OFF(PH_RLINK, struct prochd, ph_rlink); diff --git a/sys/alpha/alpha/interrupt.c b/sys/alpha/alpha/interrupt.c index 9390f8f..a29d63c 100644 --- a/sys/alpha/alpha/interrupt.c +++ b/sys/alpha/alpha/interrupt.c @@ -1,4 +1,4 @@ -/* $Id: interrupt.c,v 1.4 1998/07/12 16:09:27 dfr Exp $ */ +/* $Id: interrupt.c,v 1.5 1998/08/10 07:53:58 dfr Exp $ */ /* $NetBSD: interrupt.c,v 1.23 1998/02/24 07:38:01 thorpej Exp $ */ /* @@ -277,32 +277,50 @@ badaddr_read(addr, size, rptr) #define HASHVEC(vector) ((vector) % 31) +LIST_HEAD(alpha_intr_list, alpha_intr); + +struct alpha_intr { + LIST_ENTRY(alpha_intr) list; /* chain handlers in this hash bucket */ + int vector; /* vector to match */ + driver_intr_t *intr; /* handler function */ + void *arg; /* argument to handler */ +}; + static struct alpha_intr_list alpha_intr_hash[31]; -struct alpha_intr * -alpha_create_intr(int vector, driver_intr_t *intr, void *arg) +int alpha_setup_intr(int vector, driver_intr_t *intr, void *arg, + void **cookiep) { + int h = HASHVEC(vector); struct alpha_intr *i; + int s; i = malloc(sizeof(struct alpha_intr), M_DEVBUF, M_NOWAIT); if (!i) - return NULL; + return ENOMEM; i->vector = vector; i->intr = intr; i->arg = arg; - return i; + + s = splhigh(); + LIST_INSERT_HEAD(&alpha_intr_hash[h], i, list); + splx(s); + + *cookiep = i; + return 0; + } -int -alpha_connect_intr(struct alpha_intr *i) +int alpha_teardown_intr(void *cookie) { - int h = HASHVEC(i->vector); + struct alpha_intr *i = cookie; int s; s = splhigh(); - LIST_INSERT_HEAD(&alpha_intr_hash[h], i, list); + LIST_REMOVE(i, list); splx(s); - + + free(i, M_DEVBUF); return 0; } diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c index de57ec0..9a2c8fc 100644 --- a/sys/alpha/alpha/machdep.c +++ b/sys/alpha/alpha/machdep.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: machdep.c,v 1.20 1998/11/02 00:14:50 alex Exp $ + * $Id: machdep.c,v 1.21 1998/11/11 00:02:25 msmith Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -1410,7 +1410,8 @@ cpu_boot(int howto) void cpu_halt(void) { - alpha_pal_halt(); + /*alpha_pal_halt(); */ + prom_halt(1); } /* diff --git a/sys/alpha/alpha/swtch.s b/sys/alpha/alpha/swtch.s index 90d1bcf..1149320 100644 --- a/sys/alpha/alpha/swtch.s +++ b/sys/alpha/alpha/swtch.s @@ -1,4 +1,4 @@ -/* $Id: swtch.s,v 1.4 1998/07/12 16:32:03 dfr Exp $ */ +/* $Id: swtch.s,v 1.5 1998/08/23 16:05:54 dfr Exp $ */ /* $NetBSD: locore.s,v 1.47 1998/03/22 07:26:32 thorpej Exp $ */ /* @@ -324,6 +324,15 @@ Lsetfpenable: cmovne t0, 1, a0 call_pal PAL_OSF1_wrfen + /* set the hae register if this process has specified a value */ + ldq t0, curproc + ldq t1, P_MD_FLAGS(t0) + and t1, MDP_HAEUSED + beq t1, Lrestoreregs + ldq a0, P_MD_HAE(t0) + ldq pv, chipset + CHIPSET_WRITE_HAE + CALL((pv)) + Lrestoreregs: /* restore the registers, and return */ bsr ra, exception_restore_regs /* jmp/CALL trashes pv/t12 */ diff --git a/sys/alpha/alpha/sys_machdep.c b/sys/alpha/alpha/sys_machdep.c index e0c55dd..6ff5956 100644 --- a/sys/alpha/alpha/sys_machdep.c +++ b/sys/alpha/alpha/sys_machdep.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * from: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 - * $Id: sys_machdep.c,v 1.34 1998/03/23 19:52:34 jlemon Exp $ + * $Id: sys_machdep.c,v 1.1 1998/06/10 10:53:27 dfr Exp $ * */ @@ -50,6 +50,7 @@ #include <sys/user.h> #include <machine/cpu.h> +#include <machine/sysarch.h> #include <vm/vm_kern.h> /* for kernel_map */ @@ -60,6 +61,8 @@ struct sysarch_args { }; #endif +static int alpha_sethae(struct proc *p, char *args); + int sysarch(p, uap) struct proc *p; @@ -68,9 +71,38 @@ sysarch(p, uap) int error = 0; switch(SCARG(uap,op)) { + case ALPHA_SETHAE: + error = alpha_sethae(p, uap->parms); + break; + default: error = EINVAL; break; } return (error); } + +struct alpha_sethae_args { + u_int64_t hae; +}; + +static int +alpha_sethae(struct proc *p, char *args) +{ + int error; + struct alpha_sethae_args ua; + + if (error = copyin(args, &ua, sizeof(struct alpha_sethae_args))) + return (error); + + if (securelevel > 0) + return (EPERM); + + if (error = suser(p->p_ucred, &p->p_acflag)) + return error; + + p->p_md.md_flags |= MDP_HAEUSED; + p->p_md.md_hae = ua.hae; + + return (0); +} diff --git a/sys/alpha/include/chipset.h b/sys/alpha/include/chipset.h index 74698c5..f7a61be 100644 --- a/sys/alpha/include/chipset.h +++ b/sys/alpha/include/chipset.h @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: chipset.h,v 1.4 1998/08/10 07:53:58 dfr Exp $ + * $Id: chipset.h,v 1.5 1998/10/06 14:18:39 dfr Exp $ */ #ifndef _MACHINE_CHIPSET_H_ @@ -54,7 +54,8 @@ typedef void alpha_chipset_cfgwritew_t(u_int, u_int, u_int, u_int, typedef void alpha_chipset_cfgwritel_t(u_int, u_int, u_int, u_int, u_int32_t); typedef vm_offset_t alpha_chipset_addrcvt_t(vm_offset_t); - +typedef u_int64_t alpha_chipset_read_hae_t(void); +typedef void alpha_chipset_write_hae_t(u_int64_t); typedef struct alpha_chipset { /* @@ -91,8 +92,14 @@ typedef struct alpha_chipset { /* * PCI address space translation functions */ - alpha_chipset_addrcvt_t* cvt_to_dense; - alpha_chipset_addrcvt_t* cvt_to_bwx; + alpha_chipset_addrcvt_t* cvt_to_dense; + alpha_chipset_addrcvt_t* cvt_to_bwx; + + /* + * Access the HAE register + */ + alpha_chipset_read_hae_t* read_hae; + alpha_chipset_write_hae_t* write_hae; /* * PCI interrupt device. @@ -104,4 +111,14 @@ typedef struct alpha_chipset { extern alpha_chipset_t chipset; +/* + * Exported sysctl variables describing the PCI chipset. + */ +extern char chipset_type[10]; +extern int chipset_bwx; +extern long chipset_ports; +extern long chipset_memory; +extern long chipset_dense; +extern long chipset_hae_mask; + #endif /* !_MACHINE_CHIPSET_H_ */ diff --git a/sys/alpha/include/intr.h b/sys/alpha/include/intr.h index 79af6fd..3f4c79d 100644 --- a/sys/alpha/include/intr.h +++ b/sys/alpha/include/intr.h @@ -23,24 +23,15 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: intr.h,v 1.2 1998/07/12 16:09:30 dfr Exp $ + * $Id: intr.h,v 1.3 1998/08/10 07:53:58 dfr Exp $ */ #ifndef _MACHINE_INTR_H_ #define _MACHINE_INTR_H_ -LIST_HEAD(alpha_intr_list, alpha_intr); - -struct alpha_intr { - LIST_ENTRY(alpha_intr) list; /* chain handlers in this hash bucket */ - int vector; /* vector to match */ - driver_intr_t *intr; /* handler function */ - void *arg; /* argument to handler */ -}; - -struct alpha_intr *alpha_create_intr(int vector, - driver_intr_t *intr, void *arg); -int alpha_connect_intr(struct alpha_intr *i); +int alpha_setup_intr(int vector, driver_intr_t *intr, void *arg, + void **cookiep); +int alpha_teardown_intr(void *cookie); void alpha_dispatch_intr(void *frame, unsigned long vector); #endif /* !_MACHINE_INTR_H_ */ diff --git a/sys/alpha/include/proc.h b/sys/alpha/include/proc.h index 6a1af70..de243360 100644 --- a/sys/alpha/include/proc.h +++ b/sys/alpha/include/proc.h @@ -1,4 +1,4 @@ -/* $Id: proc.h,v 1.2 1998/06/10 10:55:17 dfr Exp $ */ +/* $Id: proc.h,v 1.3 1998/07/15 20:16:27 dfr Exp $ */ /* From: NetBSD: proc.h,v 1.3 1997/04/06 08:47:36 cgd Exp */ /* @@ -38,12 +38,14 @@ struct mdbpt { }; struct mdproc { - u_long md_flags; + u_long md_flags; struct trapframe *md_tf; /* trap/syscall registers */ - struct pcb *md_pcbpaddr; /* phys addr of the pcb */ - struct mdbpt md_sstep[2]; /* two single step breakpoints */ + struct pcb *md_pcbpaddr; /* phys addr of the pcb */ + struct mdbpt md_sstep[2]; /* two single step breakpoints */ + u_int64_t md_hae; /* user HAE register value */ }; #define MDP_FPUSED 0x0001 /* Process used the FPU */ #define MDP_STEP1 0x0002 /* Single step normal instruction */ #define MDP_STEP2 0x0004 /* Single step branch instruction */ +#define MDP_HAEUSED 0x0008 /* Process used the HAE */ diff --git a/sys/alpha/isa/isa.c b/sys/alpha/isa/isa.c index a93e3a6..7eebcd2 100644 --- a/sys/alpha/isa/isa.c +++ b/sys/alpha/isa/isa.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: isa.c,v 1.4 1998/09/16 08:23:51 dfr Exp $ + * $Id: isa.c,v 1.5 1998/10/25 01:30:16 paul Exp $ */ #include <sys/param.h> @@ -32,24 +32,36 @@ #include <sys/module.h> #include <sys/bus.h> #include <sys/malloc.h> +#include <sys/rman.h> #include <isa/isareg.h> #include <isa/isavar.h> #include <machine/intr.h> +#include <machine/resource.h> + +MALLOC_DEFINE(M_ISADEV, "isadev", "ISA device"); /* * The structure used to attach devices to the Isa. */ struct isa_device { - int id_port; - int id_portsize; + u_short id_port[ISA_NPORT_IVARS]; + u_short id_portsize[ISA_NPORT_IVARS]; + vm_offset_t id_maddr[ISA_NMEM_IVARS]; + vm_size_t id_msize[ISA_NMEM_IVARS]; + int id_irq[ISA_NIRQ_IVARS]; + int id_drq[ISA_NDRQ_IVARS]; int id_flags; - int id_irq; + struct resource *id_portres[ISA_NPORT_IVARS]; + struct resource *id_memres[ISA_NMEM_IVARS]; + struct resource *id_irqres[ISA_NIRQ_IVARS]; + struct resource *id_drqres[ISA_NDRQ_IVARS]; }; #define DEVTOISA(dev) ((struct isa_device*) device_get_ivars(dev)) static devclass_t isa_devclass; +static struct rman isa_irq_rman; /* * Device methods @@ -59,9 +71,16 @@ static int isa_attach(device_t dev); static void isa_print_child(device_t dev, device_t child); static int isa_read_ivar(device_t dev, device_t child, int which, u_long *result); static int isa_write_ivar(device_t dev, device_t child, int which, u_long result); -static void *isa_create_intr(device_t dev, device_t child, int irq, - driver_intr_t *intr, void *arg); -static int isa_connect_intr(device_t dev, void *ih); +static struct resource *isa_alloc_resource(device_t bus, device_t child, + int type, int *rid, + u_long start, u_long end, + u_long count, u_int flags); +static int isa_release_resource(device_t bus, device_t child, + int type, int rid, struct resource *r); +static int isa_setup_intr(device_t dev, device_t child, struct resource *irq, + driver_intr_t *intr, void *arg, void **cookiep); +static int isa_teardown_intr(device_t dev, device_t child, + struct resource *irq, void *cookie); static device_method_t isa_methods[] = { /* Device interface */ @@ -74,8 +93,12 @@ static device_method_t isa_methods[] = { DEVMETHOD(bus_print_child, isa_print_child), DEVMETHOD(bus_read_ivar, isa_read_ivar), DEVMETHOD(bus_write_ivar, isa_write_ivar), - DEVMETHOD(bus_create_intr, isa_create_intr), - DEVMETHOD(bus_connect_intr, isa_connect_intr), + DEVMETHOD(bus_alloc_resource, isa_alloc_resource), + DEVMETHOD(bus_release_resource, isa_release_resource), + DEVMETHOD(bus_activate_resource, bus_generic_activate_resource), + DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource), + DEVMETHOD(bus_setup_intr, isa_setup_intr), + DEVMETHOD(bus_teardown_intr, isa_teardown_intr), { 0, 0 } }; @@ -90,34 +113,69 @@ static driver_t isa_driver = { static void isa_add_device(device_t dev, const char *name, int unit) { - struct isa_device *idev; - device_t child; - int t; + struct isa_device *idev; + device_t child; + int sensitive, t; + static device_t last_sensitive; + + if (resource_int_value(name, unit, "sensitive", &sensitive) != 0) + sensitive = 0; - idev = malloc(sizeof(struct isa_device), M_DEVBUF, M_NOWAIT); + idev = malloc(sizeof(struct isa_device), M_ISADEV, M_NOWAIT); if (!idev) return; + bzero(idev, sizeof *idev); if (resource_int_value(name, unit, "port", &t) == 0) - idev->id_port = t; + idev->id_port[0] = t; else - idev->id_port = 0; + idev->id_port[0] = 0; + idev->id_port[1] = 0; + if (resource_int_value(name, unit, "portsize", &t) == 0) - idev->id_portsize = t; + idev->id_portsize[0] = t; + else + idev->id_portsize[0] = 0; + idev->id_portsize[1] = 0; + + if (resource_int_value(name, unit, "iomem", &t) == 0) + idev->id_maddr[0] = t; else - idev->id_portsize = 0; + idev->id_maddr[0] = 0; + idev->id_maddr[1] = 0; + + if (resource_int_value(name, unit, "msize", &t) == 0) + idev->id_msize[0] = t; + else + idev->id_msize[0] = 0; + idev->id_msize[1] = 0; + if (resource_int_value(name, unit, "flags", &t) == 0) idev->id_flags = t; else idev->id_flags = 0; + if (resource_int_value(name, unit, "irq", &t) == 0) - idev->id_irq = t; + idev->id_irq[0] = t; else - idev->id_irq = -1; + idev->id_irq[0] = -1; + idev->id_irq[1] = -1; - child = device_add_child(dev, name, unit, idev); - if (!child) + if (resource_int_value(name, unit, "drq", &t) == 0) + idev->id_drq[0] = t; + else + idev->id_drq[0] = -1; + idev->id_drq[1] = -1; + + if (sensitive) + child = device_add_child_after(dev, last_sensitive, name, + unit, idev); + else + child = device_add_child(dev, name, unit, idev); + if (child == 0) return; + else if (sensitive) + last_sensitive = child; if (resource_int_value(name, unit, "disabled", &t) == 0 && t != 0) device_disable(child); @@ -187,6 +245,15 @@ isa_probe(device_t dev) resource_query_unit(i)); } + isa_irq_rman.rm_start = 0; + isa_irq_rman.rm_end = 15; + isa_irq_rman.rm_type = RMAN_ARRAY; + isa_irq_rman.rm_descr = "ISA Interrupt request lines"; + if (rman_init(&isa_irq_rman) + || rman_manage_region(&isa_irq_rman, 0, 1) + || rman_manage_region(&isa_irq_rman, 3, 15)) + panic("isa_probe isa_irq_rman"); + return 0; } @@ -215,15 +282,69 @@ isa_attach(device_t dev) static void isa_print_child(device_t bus, device_t dev) { - struct isa_device* idev = DEVTOISA(dev); + struct isa_device *id = DEVTOISA(dev); + + if (id->id_port[0] > 0 || id->id_port[1] + || id->id_maddr[0] > 0 || id->id_maddr[1] + || id->id_irq[0] >= 0 || id->id_irq[1] >= 0 + || id->id_drq[0] >= 0 || id->id_drq[1] >= 0) + printf(" at"); + if (id->id_port[0] && id->id_port[1]) { + printf(" ports %#x", (u_int)id->id_port[0]); + if (id->id_portsize[0]) + printf("-%#x", (u_int)(id->id_port[0] + + id->id_portsize[0] - 1)); + printf(" and %#x", (u_int)id->id_port[1]); + if (id->id_portsize[1]) + printf("-%#x", (u_int)(id->id_port[1] + + id->id_portsize[1] - 1)); + } else if (id->id_port[0]) { + printf(" port %#x", (u_int)id->id_port[0]); + if (id->id_portsize[0]) + printf("-%#x", (u_int)(id->id_port[0] + + id->id_portsize[0] - 1)); + } else if (id->id_port[1]) { + printf(" port %#x", (u_int)id->id_port[1]); + if (id->id_portsize[1]) + printf("-%#x", (u_int)(id->id_port[1] + + id->id_portsize[1] - 1)); + } + if (id->id_maddr[0] && id->id_maddr[1]) { + printf(" iomem %#x", (u_int)id->id_maddr[0]); + if (id->id_msize[0]) + printf("-%#x", (u_int)(id->id_maddr[0] + + id->id_msize[0] - 1)); + printf(" and %#x", (u_int)id->id_maddr[1]); + if (id->id_msize[1]) + printf("-%#x", (u_int)(id->id_maddr[1] + + id->id_msize[1] - 1)); + } else if (id->id_maddr[0]) { + printf(" iomem %#x", (u_int)id->id_maddr[0]); + if (id->id_msize[0]) + printf("-%#x", (u_int)(id->id_maddr[0] + + id->id_msize[0] - 1)); + } else if (id->id_maddr[1]) { + printf(" iomem %#x", (u_int)id->id_maddr[1]); + if (id->id_msize[1]) + printf("-%#x", (u_int)(id->id_maddr[1] + + id->id_msize[1] - 1)); + } + if (id->id_irq[0] >= 0 && id->id_irq[1] >= 0) + printf(" irqs %d and %d", id->id_irq[0], id->id_irq[1]); + else if (id->id_irq[0] >= 0) + printf(" irq %d", id->id_irq[0]); + else if (id->id_irq[1] >= 0) + printf(" irq %d", id->id_irq[1]); + if (id->id_drq[0] >= 0 && id->id_drq[1] >= 0) + printf(" drqs %d and %d", id->id_drq[0], id->id_drq[1]); + else if (id->id_drq[0] >= 0) + printf(" drq %d", id->id_drq[0]); + else if (id->id_drq[1] >= 0) + printf(" drq %d", id->id_drq[1]); + + if (id->id_flags) + printf(" flags %#x", id->id_flags); - printf(" at"); - if (idev->id_port) - printf(" 0x%x", idev->id_port); - if (idev->id_portsize > 0) - printf("-0x%x", idev->id_port + idev->id_portsize - 1); - if (idev->id_irq >= 0) - printf(" irq %d", idev->id_irq); printf(" on %s%d", device_get_name(bus), device_get_unit(bus)); } @@ -235,18 +356,45 @@ isa_read_ivar(device_t bus, device_t dev, struct isa_device* idev = DEVTOISA(dev); switch (index) { - case ISA_IVAR_PORT: - *result = idev->id_port; + case ISA_IVAR_PORT_0: + *result = idev->id_port[0]; + break; + case ISA_IVAR_PORT_1: + *result = idev->id_port[1]; + break; + case ISA_IVAR_PORTSIZE_0: + *result = idev->id_portsize[0]; break; - case ISA_IVAR_PORTSIZE: - *result = idev->id_portsize; + case ISA_IVAR_PORTSIZE_1: + *result = idev->id_portsize[1]; + break; + case ISA_IVAR_MADDR_0: + *result = idev->id_maddr[0]; + break; + case ISA_IVAR_MADDR_1: + *result = idev->id_maddr[1]; + break; + case ISA_IVAR_MSIZE_0: + *result = idev->id_msize[0]; + break; + case ISA_IVAR_MSIZE_1: + *result = idev->id_msize[1]; + break; + case ISA_IVAR_IRQ_0: + *result = idev->id_irq[0]; + break; + case ISA_IVAR_IRQ_1: + *result = idev->id_irq[1]; + break; + case ISA_IVAR_DRQ_0: + *result = idev->id_drq[0]; + break; + case ISA_IVAR_DRQ_1: + *result = idev->id_drq[1]; break; case ISA_IVAR_FLAGS: *result = idev->id_flags; break; - case ISA_IVAR_IRQ: - *result = idev->id_irq; - break; } return ENOENT; } @@ -258,20 +406,198 @@ isa_write_ivar(device_t bus, device_t dev, struct isa_device* idev = DEVTOISA(dev); switch (index) { - case ISA_IVAR_PORT: - idev->id_port = value; + case ISA_IVAR_PORT_0: + idev->id_port[0] = value; + break; + case ISA_IVAR_PORT_1: + idev->id_port[1] = value; + break; + case ISA_IVAR_PORTSIZE_0: + idev->id_portsize[0] = value; + break; + case ISA_IVAR_PORTSIZE_1: + idev->id_portsize[1] = value; + break; + case ISA_IVAR_MADDR_0: + idev->id_maddr[0] = value; + break; + case ISA_IVAR_MADDR_1: + idev->id_maddr[1] = value; + break; + case ISA_IVAR_MSIZE_0: + idev->id_msize[0] = value; + break; + case ISA_IVAR_MSIZE_1: + idev->id_msize[1] = value; + break; + case ISA_IVAR_IRQ_0: + idev->id_irq[0] = value; break; - case ISA_IVAR_PORTSIZE: - idev->id_portsize = value; + case ISA_IVAR_IRQ_1: + idev->id_irq[1] = value; + break; + case ISA_IVAR_DRQ_0: + idev->id_drq[0] = value; + break; + case ISA_IVAR_DRQ_1: + idev->id_drq[1] = value; break; case ISA_IVAR_FLAGS: idev->id_flags = value; break; - case ISA_IVAR_IRQ: - idev->id_irq = value; + default: + return (ENOENT); + } + return (0); +} + +/* + * This implementation simply passes the request up to the parent + * bus, which in our case is the pci chipset device, substituting any + * configured values if the caller defaulted. We can get away with + * this because there is no special mapping for ISA resources on this + * platform. When porting this code to another architecture, it may be + * necessary to interpose a mapping layer here. + * + * We manage our own interrupt resources since ISA interrupts go through + * the ISA PIC, not the PCI interrupt controller. + */ +static struct resource * +isa_alloc_resource(device_t bus, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + int isdefault; + struct resource *rv, **rvp; + struct isa_device *id = DEVTOISA(child); + + isdefault = (start == 0UL && end == ~0UL && *rid == 0); + if (*rid > 1) + return 0; + + switch (type) { + case SYS_RES_IRQ: + if (isdefault && id->id_irq[0] >= 0) { + start = id->id_irq[0]; + end = id->id_irq[0]; + count = 1; + } + rvp = &id->id_irqres[*rid]; + rv = rman_reserve_resource(&isa_irq_rman, + start, end, count, + 0, child); + if (!rv) + return 0; + *rvp = rv; + id->id_irq[*rid] = rv->r_start; + return rv; + + case SYS_RES_MEMORY: + if (isdefault && id->id_maddr[0]) { + start = id->id_maddr[0]; + count = max(count, (u_long)id->id_msize[0]); + end = id->id_maddr[0] + count; + } + rvp = &id->id_memres[*rid]; break; + + case SYS_RES_IOPORT: + if (isdefault && id->id_port[0]) { + start = id->id_port[0]; + count = max(count, (u_long)id->id_portsize[0]); + end = id->id_port[0] + count; + } + rvp = &id->id_portres[*rid]; + break; + + default: + return 0; } - return ENOENT; + + /* + * If the client attempts to reallocate a resource without + * releasing what was there previously, die horribly so that + * he knows how he !@#$ed up. + */ + if (*rvp != 0) + panic("%s%d: (%d, %d) not free for %s%d\n", + device_get_name(bus), device_get_unit(bus), + type, *rid, + device_get_name(child), device_get_unit(child)); + + /* + * nexus_alloc_resource had better not change *rid... + */ + rv = BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type, rid, + start, end, count, flags); + if ((*rvp = rv) != 0) { + switch (type) { + case SYS_RES_MEMORY: + id->id_maddr[*rid] = rv->r_start; + id->id_msize[*rid] = count; + break; + case SYS_RES_IOPORT: + id->id_port[*rid] = rv->r_start; + id->id_portsize[*rid] = count; + break; + } + } + return rv; +} + +static int +isa_release_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + int rv; + struct resource **rp; + struct isa_device *id = DEVTOISA(child); + + if (rid > 1) + return EINVAL; + + switch (type) { + case SYS_RES_IRQ: + return (rman_release_resource(r)); + case SYS_RES_DRQ: + case SYS_RES_IOPORT: + case SYS_RES_MEMORY: + break; + default: + return (ENOENT); + } + + rv = BUS_RELEASE_RESOURCE(device_get_parent(bus), child, type, rid, r); + + if (rv) { + switch (type) { + case SYS_RES_IRQ: + id->id_irqres[rid] = 0; + id->id_irq[rid] = -1; + break; + + case SYS_RES_DRQ: + id->id_drqres[rid] = 0; + id->id_drq[rid] = -1; + break; + + case SYS_RES_MEMORY: + id->id_memres[rid] = 0; + id->id_maddr[rid] = 0; + id->id_msize[rid] = 0; + break; + + case SYS_RES_IOPORT: + id->id_portres[rid] = 0; + id->id_port[rid] = 0; + id->id_portsize[rid] = 0; + break; + + default: + return ENOENT; + } + } + + return rv; } struct isa_intr { @@ -299,37 +625,47 @@ isa_handle_intr(void *arg) outb(IO_ICU1, 0x20 | (irq > 7 ? 2 : irq)); } -static void * -isa_create_intr(device_t dev, device_t child, int irq, - driver_intr_t *intr, void *arg) +static int +isa_setup_intr(device_t dev, device_t child, + struct resource *irq, + driver_intr_t *intr, void *arg, void **cookiep) { struct isa_intr *ii; + int error; + + error = rman_activate_resource(irq); + if (error) + return error; - if (irq == 2) irq = 9; ii = malloc(sizeof(struct isa_intr), M_DEVBUF, M_NOWAIT); if (!ii) - return NULL; + return ENOMEM; ii->intr = intr; ii->arg = arg; - ii->irq = irq; - ii->ih = alpha_create_intr(0x800 + (irq << 4), isa_handle_intr, ii); - - if (!ii->ih) { + ii->irq = irq->r_start; + + error = alpha_setup_intr(0x800 + (irq->r_start << 4), + isa_handle_intr, ii, &ii->ih); + if (error) { free(ii, M_DEVBUF); - return NULL; + return error; } + isa_intr_enable(irq->r_start); - return ii; + *cookiep = ii; + return 0; } static int -isa_connect_intr(device_t dev, void *ih) +isa_teardown_intr(device_t dev, device_t child, + struct resource *irq, void *cookie) { - struct isa_intr *ii = ih; - struct alpha_intr *i = ii->ih; + struct isa_intr *ii = cookie; - isa_intr_enable(ii->irq); - return alpha_connect_intr(i); + alpha_teardown_intr(ii->ih); + isa_intr_disable(irq->r_start); + + return 0; } DRIVER_MODULE(isa, cia, isa_driver, isa_devclass, 0, 0); diff --git a/sys/alpha/pci/apecs.c b/sys/alpha/pci/apecs.c index 4334102..c8bbad7 100644 --- a/sys/alpha/pci/apecs.c +++ b/sys/alpha/pci/apecs.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: apecs.c,v 1.1 1998/08/10 07:53:59 dfr Exp $ + * $Id: apecs.c,v 1.2 1998/10/06 14:18:40 dfr Exp $ */ /* * Copyright (c) 1995, 1996 Carnegie-Mellon University. @@ -63,6 +63,7 @@ #include <alpha/pci/apecsreg.h> #include <alpha/pci/apecsvar.h> +#include <alpha/pci/pcibus.h> #include <machine/intr.h> #include <machine/cpuconf.h> #include <machine/swiz.h> @@ -103,6 +104,8 @@ static alpha_chipset_cfgwriteb_t apecs_swiz_cfgwriteb; static alpha_chipset_cfgwritew_t apecs_swiz_cfgwritew; static alpha_chipset_cfgwritel_t apecs_swiz_cfgwritel; static alpha_chipset_addrcvt_t apecs_cvt_dense; +static alpha_chipset_read_hae_t apecs_read_hae; +static alpha_chipset_write_hae_t apecs_write_hae; static alpha_chipset_t apecs_swiz_chipset = { apecs_swiz_inb, @@ -126,6 +129,8 @@ static alpha_chipset_t apecs_swiz_chipset = { apecs_swiz_cfgwritel, apecs_cvt_dense, NULL, + apecs_read_hae, + apecs_write_hae, }; static int @@ -419,6 +424,18 @@ apecs_cvt_dense(vm_offset_t addr) } +static u_int64_t +apecs_read_hae(void) +{ + return apecs_hae_mem & 0xf8000000; +} + +static void +apecs_write_hae(u_int64_t hae) +{ + u_int32_t pa = hae; + apecs_swiz_set_hae_mem(&pa); +} static int apecs_probe(device_t dev); static int apecs_attach(device_t dev); @@ -431,6 +448,10 @@ static device_method_t apecs_methods[] = { DEVMETHOD(device_attach, apecs_attach), /* Bus interface */ + DEVMETHOD(bus_alloc_resource, pci_alloc_resource), + DEVMETHOD(bus_release_resource, pci_release_resource), + DEVMETHOD(bus_activate_resource, pci_activate_resource), + DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), { 0, 0 } }; @@ -493,6 +514,13 @@ apecs_attach(device_t dev) set_iointr(alpha_dispatch_intr); + strcpy(chipset_type, "apecs"); + chipset_bwx = 0; + chipset_ports = APECS_PCI_SIO; + chipset_memory = APECS_PCI_SPARSE; + chipset_dense = APECS_PCI_DENSE; + chipset_hae_mask = EPIC_HAXR1_EADDR; + bus_generic_attach(dev); return 0; } diff --git a/sys/alpha/pci/cia.c b/sys/alpha/pci/cia.c index 065c420..09b8ac7 100644 --- a/sys/alpha/pci/cia.c +++ b/sys/alpha/pci/cia.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cia.c,v 1.9 1998/09/16 08:24:30 dfr Exp $ + * $Id: cia.c,v 1.10 1998/10/06 14:18:40 dfr Exp $ */ /*- * Copyright (c) 1998 The NetBSD Foundation, Inc. @@ -96,14 +96,17 @@ #include <sys/kernel.h> #include <sys/module.h> #include <sys/bus.h> +#include <sys/rman.h> #include <alpha/pci/ciareg.h> #include <alpha/pci/ciavar.h> +#include <alpha/pci/pcibus.h> #include <machine/bwx.h> #include <machine/swiz.h> #include <machine/intr.h> #include <machine/cpuconf.h> #include <machine/rpb.h> +#include <machine/resource.h> #define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) @@ -138,6 +141,8 @@ static alpha_chipset_cfgwriteb_t cia_bwx_cfgwriteb, cia_swiz_cfgwriteb; static alpha_chipset_cfgwritew_t cia_bwx_cfgwritew, cia_swiz_cfgwritew; static alpha_chipset_cfgwritel_t cia_bwx_cfgwritel, cia_swiz_cfgwritel; static alpha_chipset_addrcvt_t cia_cvt_dense, cia_cvt_bwx; +static alpha_chipset_read_hae_t cia_read_hae; +static alpha_chipset_write_hae_t cia_write_hae; static alpha_chipset_t cia_bwx_chipset = { cia_bwx_inb, @@ -161,6 +166,8 @@ static alpha_chipset_t cia_bwx_chipset = { cia_bwx_cfgwritel, cia_cvt_dense, cia_cvt_bwx, + cia_read_hae, + cia_write_hae, }; static alpha_chipset_t cia_swiz_chipset = { cia_swiz_inb, @@ -184,6 +191,8 @@ static alpha_chipset_t cia_swiz_chipset = { cia_swiz_cfgwritel, cia_cvt_dense, NULL, + cia_read_hae, + cia_write_hae, }; static u_int8_t @@ -439,28 +448,30 @@ cia_swiz_outl(u_int32_t port, u_int32_t data) } static __inline void -cia_swiz_set_hae_mem(u_int32_t pa) +cia_swiz_set_hae_mem(u_int32_t *pa) { - /* Only bother with region 1 */ + /* Only bother with region 1 */ #define REG1 (7 << 29) - if ((cia_hae_mem & REG1) != (pa & REG1)) { - /* - * Seems fairly paranoid but this is what Linux does... - */ - int s = splhigh(); - cia_hae_mem = (cia_hae_mem & ~REG1) | (pa & REG1); - REGVAL(CIA_CSR_HAE_MEM) = cia_hae_mem; - alpha_mb(); - cia_hae_mem = REGVAL(CIA_CSR_HAE_MEM); - splx(s); - } + if ((cia_hae_mem & REG1) != (*pa & REG1)) { + /* + * Seems fairly paranoid but this is what Linux does... + */ + u_int32_t msb = *pa & REG1; + int s = splhigh(); + cia_hae_mem = (cia_hae_mem & ~REG1) | msb; + REGVAL(CIA_CSR_HAE_MEM) = cia_hae_mem; + alpha_mb(); + cia_hae_mem = REGVAL(CIA_CSR_HAE_MEM); + splx(s); + *pa -= msb; + } } static u_int8_t cia_swiz_readb(u_int32_t pa) { alpha_mb(); - cia_swiz_set_hae_mem(pa); + cia_swiz_set_hae_mem(&pa); return SPARSE_READ_BYTE(KV(CIA_PCI_SMEM1), pa); } @@ -468,7 +479,7 @@ static u_int16_t cia_swiz_readw(u_int32_t pa) { alpha_mb(); - cia_swiz_set_hae_mem(pa); + cia_swiz_set_hae_mem(&pa); return SPARSE_READ_WORD(KV(CIA_PCI_SMEM1), pa); } @@ -476,14 +487,14 @@ static u_int32_t cia_swiz_readl(u_int32_t pa) { alpha_mb(); - cia_swiz_set_hae_mem(pa); + cia_swiz_set_hae_mem(&pa); return SPARSE_READ_LONG(KV(CIA_PCI_SMEM1), pa); } static void cia_swiz_writeb(u_int32_t pa, u_int8_t data) { - cia_swiz_set_hae_mem(pa); + cia_swiz_set_hae_mem(&pa); SPARSE_WRITE_BYTE(KV(CIA_PCI_SMEM1), pa, data); alpha_wmb(); } @@ -491,7 +502,7 @@ cia_swiz_writeb(u_int32_t pa, u_int8_t data) static void cia_swiz_writew(u_int32_t pa, u_int16_t data) { - cia_swiz_set_hae_mem(pa); + cia_swiz_set_hae_mem(&pa); SPARSE_WRITE_WORD(KV(CIA_PCI_SMEM1), pa, data); alpha_wmb(); } @@ -499,7 +510,7 @@ cia_swiz_writew(u_int32_t pa, u_int16_t data) static void cia_swiz_writel(u_int32_t pa, u_int32_t data) { - cia_swiz_set_hae_mem(pa); + cia_swiz_set_hae_mem(&pa); SPARSE_WRITE_LONG(KV(CIA_PCI_SMEM1), pa, data); alpha_wmb(); } @@ -616,12 +627,35 @@ cia_cvt_bwx(vm_offset_t addr) return (addr |= CIA_EV56_BWMEM); } +static u_int64_t +cia_read_hae(void) +{ + return cia_hae_mem & REG1; +} +static void +cia_write_hae(u_int64_t hae) +{ + u_int32_t pa = hae; + cia_swiz_set_hae_mem(&pa); +} static int cia_probe(device_t dev); static int cia_attach(device_t dev); -static void *cia_create_intr(device_t dev, device_t child, int irq, driver_intr_t *intr, void *arg); -static int cia_connect_intr(device_t dev, void* ih); +static struct resource *cia_alloc_resource(device_t bus, device_t child, + int type, int *rid, + u_long start, u_long end, + u_long count, u_int flags); +static int cia_activate_resource(device_t bus, device_t child, + int type, int rid, struct resource *r); +static int cia_deactivate_resource(device_t bus, device_t child, + int type, int rid, struct resource *r); +static int cia_release_resource(device_t bus, device_t child, + int type, int rid, struct resource *r); +static int cia_setup_intr(device_t dev, device_t child, struct resource *irq, + driver_intr_t *intr, void *arg, void **cookiep); +static int cia_teardown_intr(device_t dev, device_t child, + struct resource *irq, void *cookie); static device_method_t cia_methods[] = { /* Device interface */ @@ -629,8 +663,12 @@ static device_method_t cia_methods[] = { DEVMETHOD(device_attach, cia_attach), /* Bus interface */ - DEVMETHOD(bus_create_intr, cia_create_intr), - DEVMETHOD(bus_connect_intr, cia_connect_intr), + DEVMETHOD(bus_alloc_resource, pci_alloc_resource), + DEVMETHOD(bus_release_resource, pci_release_resource), + DEVMETHOD(bus_activate_resource, pci_activate_resource), + DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), + DEVMETHOD(bus_setup_intr, cia_setup_intr), + DEVMETHOD(bus_teardown_intr, cia_teardown_intr), { 0, 0 } }; @@ -696,6 +734,8 @@ cia_probe(device_t dev) cia0 = dev; device_set_desc(dev, "2117x PCI adapter"); /* XXX */ + pci_init_resources(); + device_add_child(dev, "isa", 0, 0); return 0; @@ -761,29 +801,54 @@ cia_attach(device_t dev) if (!platform.iointr) /* XXX */ set_iointr(alpha_dispatch_intr); + if (cia_ispyxis) { + strcpy(chipset_type, "pyxis"); + chipset_bwx = 1; + chipset_ports = CIA_EV56_BWIO; + chipset_memory = CIA_EV56_BWMEM; + chipset_dense = CIA_PCI_DENSE; + } else { + strcpy(chipset_type, "cia"); + chipset_bwx = 0; + chipset_ports = CIA_PCI_SIO1; + chipset_memory = CIA_PCI_SMEM1; + chipset_dense = CIA_PCI_DENSE; + chipset_hae_mask = 7L << 29; + } + bus_generic_attach(dev); return 0; } -static void * -cia_create_intr(device_t dev, device_t child, - int irq, driver_intr_t *intr, void *arg) +static int +cia_setup_intr(device_t dev, device_t child, + struct resource *irq, + driver_intr_t *intr, void *arg, void **cookiep) { - return alpha_create_intr(0x900 + (irq << 4), intr, arg); + struct alpha_intr *i; + int error; + + error = rman_activate_resource(irq); + if (error) + return error; + + error = alpha_setup_intr(0x900 + (irq->r_start << 4), + intr, arg, cookiep); + if (error) + return error; + + /* Enable PCI interrupt */ + platform.pci_intr_enable(irq->r_start); + + return 0; } static int -cia_connect_intr(device_t dev, void* ih) -{ - struct alpha_intr *i = ih; - int s = splhigh(); - int error = alpha_connect_intr(i); - if (!error) { - /* Enable PCI interrupt */ - platform.pci_intr_enable((i->vector - 0x900) >> 4); - } - splx(s); - return error; +cia_teardown_intr(device_t dev, device_t child, + struct resource *irq, void *cookie) +{ + alpha_teardown_intr(cookie); + return rman_deactivate_resource(irq); } DRIVER_MODULE(cia, root, cia_driver, cia_devclass, 0, 0); diff --git a/sys/alpha/pci/lca.c b/sys/alpha/pci/lca.c index 58f873f..5cf492f 100644 --- a/sys/alpha/pci/lca.c +++ b/sys/alpha/pci/lca.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: lca.c,v 1.2 1998/09/23 21:23:51 msmith Exp $ + * $Id: lca.c,v 1.3 1998/10/06 14:18:40 dfr Exp $ */ #include <sys/param.h> @@ -34,6 +34,7 @@ #include <alpha/pci/lcareg.h> #include <alpha/pci/lcavar.h> +#include <alpha/pci/pcibus.h> #include <machine/swiz.h> #include <machine/intr.h> #include <machine/cpuconf.h> @@ -70,6 +71,8 @@ static alpha_chipset_cfgwriteb_t lca_cfgwriteb; static alpha_chipset_cfgwritew_t lca_cfgwritew; static alpha_chipset_cfgwritel_t lca_cfgwritel; static alpha_chipset_addrcvt_t lca_cvt_dense; +static alpha_chipset_read_hae_t lca_read_hae; +static alpha_chipset_write_hae_t lca_write_hae; static alpha_chipset_t lca_chipset = { lca_inb, @@ -92,6 +95,9 @@ static alpha_chipset_t lca_chipset = { lca_cfgwritew, lca_cfgwritel, lca_cvt_dense, + NULL, + lca_read_hae, + lca_write_hae, }; static u_int8_t @@ -312,6 +318,18 @@ lca_cvt_dense(vm_offset_t addr) } +static u_int64_t +lca_read_hae(void) +{ + return lca_hae_mem & 0xf8000000; +} + +static void +lca_write_hae(u_int64_t hae) +{ + u_int32_t pa = hae; + lca_set_hae_mem(&pa); +} static int lca_probe(device_t dev); static int lca_attach(device_t dev); @@ -324,6 +342,10 @@ static device_method_t lca_methods[] = { DEVMETHOD(device_attach, lca_attach), /* Bus interface */ + DEVMETHOD(bus_alloc_resource, pci_alloc_resource), + DEVMETHOD(bus_release_resource, pci_release_resource), + DEVMETHOD(bus_activate_resource, pci_activate_resource), + DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), { 0, 0 } }; @@ -375,6 +397,13 @@ lca_attach(device_t dev) set_iointr(alpha_dispatch_intr); + strcpy(chipset_type, "lca"); + chipset_bwx = 0; + chipset_ports = LCA_PCI_SIO; + chipset_memory = LCA_PCI_SPARSE; + chipset_dense = LCA_PCI_DENSE; + chipset_hae_mask = IOC_HAE_ADDREXT; + bus_generic_attach(dev); return 0; } diff --git a/sys/alpha/pci/pcibus.c b/sys/alpha/pci/pcibus.c index 0cafff2..8dc5bd3 100644 --- a/sys/alpha/pci/pcibus.c +++ b/sys/alpha/pci/pcibus.c @@ -23,7 +23,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: pcibus.c,v 1.4 1998/08/10 07:53:59 dfr Exp $ + * $Id: pcibus.c,v 1.5 1998/10/06 14:18:40 dfr Exp $ * */ @@ -33,10 +33,34 @@ #include <sys/module.h> #include <sys/bus.h> #include <sys/interrupt.h> +#include <sys/sysctl.h> +#include <sys/rman.h> #include <pci/pcivar.h> #include <machine/chipset.h> #include <machine/cpuconf.h> +#include <machine/resource.h> + +char chipset_type[10]; +int chipset_bwx = 0; +long chipset_ports = 0; +long chipset_memory = 0; +long chipset_dense = 0; +long chipset_hae_mask = 0; + +SYSCTL_NODE(_hw, OID_AUTO, chipset, CTLFLAG_RW, 0, "PCI chipset information"); +SYSCTL_STRING(_hw_chipset, OID_AUTO, type, CTLFLAG_RD, chipset_type, 0, + "PCI chipset type"); +SYSCTL_INT(_hw_chipset, OID_AUTO, bwx, CTLFLAG_RD, &chipset_bwx, 0, + "PCI chipset supports BWX access"); +SYSCTL_LONG(_hw_chipset, OID_AUTO, ports, CTLFLAG_RD, &chipset_ports, 0, + "PCI chipset port address"); +SYSCTL_LONG(_hw_chipset, OID_AUTO, memory, CTLFLAG_RD, &chipset_memory, 0, + "PCI chipset memory address"); +SYSCTL_LONG(_hw_chipset, OID_AUTO, dense, CTLFLAG_RD, &chipset_dense, 0, + "PCI chipset dense memory address"); +SYSCTL_LONG(_hw_chipset, OID_AUTO, hae_mask, CTLFLAG_RD, &chipset_hae_mask, 0, + "PCI chipset mask for HAE register"); static int cfgmech; static int devmax; @@ -116,22 +140,27 @@ struct intrec * intr_create(void *dev_instance, int irq, inthand2_t handler, void *arg, intrmask_t *maskptr, int flags) { + struct resource *res; device_t pcib = chipset.intrdev; - if (pcib) - return BUS_CREATE_INTR(pcib, pcib, irq, - (driver_intr_t*) handler, arg); - else + int zero = 0; + void *cookie; + + res = BUS_ALLOC_RESOURCE(pcib, pcib, SYS_RES_IRQ, &zero, + irq, irq, 1, RF_SHAREABLE | RF_ACTIVE); + if (BUS_SETUP_INTR(pcib, pcib, res, (driver_intr_t *)handler, arg, &cookie)) return 0; + + return (struct intrec *)cookie; } int intr_connect(struct intrec *idesc) { - device_t pcib = chipset.intrdev; - if (pcib) - return BUS_CONNECT_INTR(pcib, idesc); - else - return EINVAL; + /* + * intr_create has already connected it (doesn't matter for the + * only consumer of this interface (pci). + */ + return 0; } void @@ -141,6 +170,86 @@ alpha_platform_assign_pciintr(pcicfgregs *cfg) platform.pci_intr_map((void *)cfg); } +static struct rman irq_rman, port_rman, mem_rman; + +void pci_init_resources() +{ + irq_rman.rm_start = 0; + irq_rman.rm_end = 32; + irq_rman.rm_type = RMAN_ARRAY; + irq_rman.rm_descr = "PCI Interrupt request lines"; + if (rman_init(&irq_rman) + || rman_manage_region(&irq_rman, 0, 31)) + panic("cia_probe irq_rman"); + + port_rman.rm_start = 0; + port_rman.rm_end = 0xffff; + port_rman.rm_type = RMAN_ARRAY; + port_rman.rm_descr = "I/O ports"; + if (rman_init(&port_rman) + || rman_manage_region(&port_rman, 0, 0xffff)) + panic("cia_probe port_rman"); + + mem_rman.rm_start = 0; + mem_rman.rm_end = ~0u; + mem_rman.rm_type = RMAN_ARRAY; + mem_rman.rm_descr = "I/O memory addresses"; + if (rman_init(&mem_rman) + || rman_manage_region(&mem_rman, 0x0, (1L << 32))) + panic("cia_probe mem_rman"); +} + +/* + * Allocate a resource on behalf of child. NB: child is usually going to be a + * child of one of our descendants, not a direct child of the pci chipset. + */ +struct resource * +pci_alloc_resource(device_t bus, device_t child, int type, int *rid, + u_long start, u_long end, u_long count, u_int flags) +{ + struct rman *rm; + + switch (type) { + case SYS_RES_IRQ: + rm = &irq_rman; + break; + + case SYS_RES_IOPORT: + rm = &port_rman; + break; + + case SYS_RES_MEMORY: + rm = &mem_rman; + break; + + default: + return 0; + } + + return rman_reserve_resource(rm, start, end, count, flags, child); +} + +int +pci_activate_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + return (rman_activate_resource(r)); +} + +int +pci_deactivate_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + return (rman_deactivate_resource(r)); +} + +int +pci_release_resource(device_t bus, device_t child, int type, int rid, + struct resource *r) +{ + return (rman_release_resource(r)); +} + void memcpy_fromio(void *d, u_int32_t s, size_t size) { diff --git a/sys/alpha/pci/pcibus.h b/sys/alpha/pci/pcibus.h index eb56cec..38b51b7 100644 --- a/sys/alpha/pci/pcibus.h +++ b/sys/alpha/pci/pcibus.h @@ -23,19 +23,17 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: pcibus.h,v 1.1 1998/06/10 10:55:38 dfr Exp $ */ -typedef int alpha_pci_maxdevs_t(pcicfgregs*); -typedef int alpha_pci_cfgread_t(pcicfgregs*, int, int); -typedef void alpha_pci_cfgwrite_t(pcicfgregs*, int, int, int); - -struct alpha_pci_ops { - alpha_pci_maxdevs_t* maxdevs; - alpha_pci_cfgread_t* cfgread; - alpha_pci_cfgwrite_t* cfgwrite; -}; - -struct alpha_pci_softc { - struct alpha_pci_ops* ops; -}; +void pci_init_resources(void); +struct resource *pci_alloc_resource(device_t bus, device_t child, + int type, int *rid, + u_long start, u_long end, u_long count, + u_int flags); +int pci_activate_resource(device_t bus, device_t child, int type, int rid, + struct resource *r); +int pci_deactivate_resource(device_t bus, device_t child, int type, int rid, + struct resource *r); +int pci_release_resource(device_t bus, device_t child, int type, int rid, + struct resource *r); diff --git a/sys/alpha/tlsb/dwlpx.c b/sys/alpha/tlsb/dwlpx.c index 7db56ce..bb80abf 100644 --- a/sys/alpha/tlsb/dwlpx.c +++ b/sys/alpha/tlsb/dwlpx.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: dwlpx.c,v 1.5 1998/08/10 07:53:59 dfr Exp $ + * $Id: dwlpx.c,v 1.6 1998/09/04 08:01:26 dfr Exp $ */ #include "opt_simos.h" @@ -288,6 +288,8 @@ dwlpx_attach(device_t dev) struct dwlpx_softc* sc = DWLPX_SOFTC(dev); device_t parent = device_get_parent(dev); vm_offset_t regs; + void *intr; + dwlpx0 = dev; chipset = dwlpx_chipset; @@ -301,9 +303,7 @@ dwlpx_attach(device_t dev) *(u_int32_t*) (regs + PCIA_CTL(0)) = 1; /* Type1 config cycles */ - BUS_CONNECT_INTR(parent, - BUS_CREATE_INTR(parent, dev, - 0, dwlpx_intr, 0)); + return BUS_SETUP_INTR(parent, dev, NULL, dwlpx_intr, 0, &intr); return 0; } diff --git a/sys/alpha/tlsb/gbus.c b/sys/alpha/tlsb/gbus.c index 9894889..f98a3bd 100644 --- a/sys/alpha/tlsb/gbus.c +++ b/sys/alpha/tlsb/gbus.c @@ -92,8 +92,8 @@ static device_method_t gbus_methods[] = { DEVMETHOD(bus_print_child, gbus_print_child), DEVMETHOD(bus_read_ivar, gbus_read_ivar), DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_create_intr, bus_generic_create_intr), - DEVMETHOD(bus_connect_intr, bus_generic_connect_intr), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), { 0, 0 } }; @@ -134,7 +134,7 @@ gbus_print_child(device_t bus, device_t dev) { struct gbus_device* gdev = DEVTOGBUS(dev); - printf(" at %s%d offset 0x%lx", + printf(" at %s%d offset 0x%x", device_get_name(bus), device_get_unit(bus), gdev->gd_offset); } diff --git a/sys/alpha/tlsb/kftxx.c b/sys/alpha/tlsb/kftxx.c index 6f9f89a..d85b202 100644 --- a/sys/alpha/tlsb/kftxx.c +++ b/sys/alpha/tlsb/kftxx.c @@ -1,4 +1,4 @@ -/* $Id: kftxx.c,v 1.2 1998/06/14 13:45:24 dfr Exp $ */ +/* $Id: kftxx.c,v 1.3 1998/07/12 16:23:17 dfr Exp $ */ /* $NetBSD: kftxx.c,v 1.9 1998/05/14 00:01:32 thorpej Exp $ */ /* @@ -89,8 +89,8 @@ static device_method_t kft_methods[] = { DEVMETHOD(bus_print_child, kft_print_child), DEVMETHOD(bus_read_ivar, kft_read_ivar), DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_create_intr, bus_generic_create_intr), - DEVMETHOD(bus_connect_intr, bus_generic_connect_intr), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), { 0, 0 } }; diff --git a/sys/alpha/tlsb/tlsb.c b/sys/alpha/tlsb/tlsb.c index 6e618a3..72cf93a 100644 --- a/sys/alpha/tlsb/tlsb.c +++ b/sys/alpha/tlsb/tlsb.c @@ -95,8 +95,11 @@ static devclass_t tlsb_devclass; static int tlsb_probe(device_t dev); static void tlsb_print_child(device_t dev, device_t child); static int tlsb_read_ivar(device_t dev, device_t child, int which, u_long* result); -static void *tlsb_create_intr(device_t dev, device_t child, int irq, driver_intr_t *intr, void *arg); -static int tlsb_connect_intr(device_t dev, void* ih); +static int tlsb_setup_intr(device_t dev, device_t child, + struct resource *irq, + driver_intr_t *intr, void *arg, void **cookiep); +static int tlsb_teardown_intr(device_t dev, device_t child, + struct resource *irq, void *cookie); static device_method_t tlsb_methods[] = { /* Device interface */ @@ -109,8 +112,8 @@ static device_method_t tlsb_methods[] = { DEVMETHOD(bus_print_child, tlsb_print_child), DEVMETHOD(bus_read_ivar, tlsb_read_ivar), DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_create_intr, tlsb_create_intr), - DEVMETHOD(bus_connect_intr, tlsb_connect_intr), + DEVMETHOD(bus_setup_intr, tlsb_setup_intr), + DEVMETHOD(bus_teardown_intr, tlsb_teardown_intr), { 0, 0 } }; @@ -265,27 +268,32 @@ tlsb_read_ivar(device_t dev, device_t child, return ENOENT; } -static void * -tlsb_create_intr(device_t dev, device_t child, - int irq, driver_intr_t *intr, void *arg) +static int +tlsb_setup_intr(device_t dev, device_t child, + struct resource *irq, + driver_intr_t *intr, void *arg, void **cookiep) { struct tlsb_softc* sc = device_get_softc(dev); struct intr_mapping* i; i = malloc(sizeof(struct intr_mapping), M_DEVBUF, M_NOWAIT); if (!i) - return NULL; + return ENOMEM; i->intr = intr; i->arg = arg; - return i; + STAILQ_INSERT_TAIL(&sc->intr_handlers, i, queue); + *cookiep = i; + return 0; } static int -tlsb_connect_intr(device_t dev, void *ih) +tlsb_teardown_intr(device_t dev, device_t child, + struct resource *irq, void *cookie) { struct tlsb_softc* sc = device_get_softc(dev); - struct intr_mapping* i = ih; + struct intr_mapping* i = cookie; - STAILQ_INSERT_TAIL(&sc->intr_handlers, i, queue); + STAILQ_REMOVE(&sc->intr_handlers, i, intr_mapping, queue); + free(i, M_DEVBUF); return 0; } diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c index f5e7032..e88b8b1 100644 --- a/sys/alpha/tlsb/zs_tlsb.c +++ b/sys/alpha/tlsb/zs_tlsb.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: zs_tlsb.c,v 1.4 1998/07/12 16:23:19 dfr Exp $ + * $Id: zs_tlsb.c,v 1.5 1998/07/31 09:20:01 dfr Exp $ */ /* * This driver is a hopeless hack to get the SimOS console working. A real @@ -385,6 +385,7 @@ struct zsc_softc { caddr_t base; struct zs_softc* sc_a; struct zs_softc* sc_b; + void *intr; }; static int zsc_tlsb_probe(device_t dev); @@ -404,8 +405,8 @@ static device_method_t zsc_tlsb_methods[] = { DEVMETHOD(bus_print_child, zsc_tlsb_print_child), DEVMETHOD(bus_read_ivar, bus_generic_read_ivar), DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_create_intr, bus_generic_create_intr), - DEVMETHOD(bus_connect_intr, bus_generic_connect_intr), + DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), + DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), { 0, 0 } }; @@ -455,6 +456,7 @@ zsc_tlsb_attach(device_t dev) { struct zsc_softc* sc = device_get_softc(dev); device_t parent = device_get_parent(dev); + void *ih; bus_generic_attach(dev); @@ -462,9 +464,9 @@ zsc_tlsb_attach(device_t dev) sc->sc_a = ZS_SOFTC(0); sc->sc_b = ZS_SOFTC(1); - BUS_CONNECT_INTR(parent, - BUS_CREATE_INTR(parent, dev, - 1, zsc_tlsb_intr, sc)); + /* XXX should use resource argument to communicate vector */ + return BUS_SETUP_INTR(parent, dev, NULL, zsc_tlsb_intr, sc, + &sc->intr); return 0; } diff --git a/sys/dev/atkbdc/psm.c b/sys/dev/atkbdc/psm.c index 68eb46a..5b999e1 100644 --- a/sys/dev/atkbdc/psm.c +++ b/sys/dev/atkbdc/psm.c @@ -20,7 +20,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: psm.c,v 1.56 1998/10/22 05:58:40 bde Exp $ + * $Id: psm.c,v 1.1 1998/11/08 18:43:03 dfr Exp $ */ /* @@ -76,6 +76,7 @@ #include <sys/poll.h> #include <sys/syslog.h> #include <sys/malloc.h> +#include <sys/rman.h> #ifdef DEVFS #include <sys/devfsext.h> #endif @@ -85,6 +86,7 @@ #include <machine/clock.h> #include <machine/limits.h> #include <machine/mouse.h> +#include <machine/resource.h> #include <isa/isareg.h> #include <isa/isavar.h> @@ -981,6 +983,8 @@ psmattach(device_t dev) int unit = device_get_unit(dev); struct psm_softc *sc = device_get_softc(dev); void *ih; + struct resource *res; + int zero = 0; if (sc == NULL) /* shouldn't happen */ return (ENXIO); @@ -1023,14 +1027,11 @@ psmattach(device_t dev) if (bootverbose) --verbose; - ih = BUS_CREATE_INTR(device_get_parent(dev), dev, - isa_get_irq(dev), - psmintr, sc); - if (!ih) - return ENXIO; + res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, 0ul, ~0ul, 1, + RF_SHAREABLE | RF_ACTIVE); + BUS_SETUP_INTR(device_get_parent(dev), dev, res, psmintr, sc, + &ih); - BUS_CONNECT_INTR(device_get_parent(dev), ih); - return (0); } diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c index d5b48ce..683c59e 100644 --- a/sys/dev/sio/sio.c +++ b/sys/dev/sio/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.216 1998/09/26 13:59:26 peter Exp $ + * $Id: sio.c,v 1.217 1998/09/26 14:47:16 dfr Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.215 */ @@ -68,6 +68,7 @@ #include <sys/syslog.h> #include <sys/sysctl.h> #include <sys/bus.h> +#include <sys/rman.h> #ifdef DEVFS #include <sys/devfsext.h> #endif @@ -78,6 +79,7 @@ #include <machine/clock.h> #include <machine/ipl.h> +#include <machine/resource.h> #include <isa/sioreg.h> @@ -921,6 +923,8 @@ sioattach(dev) int s; int unit; void *ih; + struct resource *res; + int zero = 0; u_int flags = isa_get_flags(dev); #if 0 @@ -1136,13 +1140,10 @@ determined_type: ; #endif com->flags = isa_get_flags(dev); /* Heritate id_flags for later */ - ih = BUS_CREATE_INTR(device_get_parent(dev), dev, - isa_get_irq(dev), - siointr, com); - if (!ih) - return ENXIO; - - BUS_CONNECT_INTR(device_get_parent(dev), ih); + res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, 0ul, ~0ul, 1, + RF_SHAREABLE | RF_ACTIVE); + BUS_SETUP_INTR(device_get_parent(dev), dev, res, siointr, com, + &ih); return (0); } diff --git a/sys/isa/isavar.h b/sys/isa/isavar.h index 756333a..bb8ee55 100644 --- a/sys/isa/isavar.h +++ b/sys/isa/isavar.h @@ -23,14 +23,34 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: isavar.h,v 1.1 1998/08/06 08:49:09 dfr Exp $ */ +#define ISA_NPORT_IVARS 2 +#define ISA_NMEM_IVARS 2 +#define ISA_NIRQ_IVARS 2 +#define ISA_NDRQ_IVARS 2 + enum isa_device_ivars { - ISA_IVAR_PORT, - ISA_IVAR_PORTSIZE, - ISA_IVAR_FLAGS, - ISA_IVAR_IRQ + ISA_IVAR_PORT, + ISA_IVAR_PORT_0 = ISA_IVAR_PORT, + ISA_IVAR_PORT_1, + ISA_IVAR_PORTSIZE, + ISA_IVAR_PORTSIZE_0 = ISA_IVAR_PORTSIZE, + ISA_IVAR_PORTSIZE_1, + ISA_IVAR_MADDR, + ISA_IVAR_MADDR_0 = ISA_IVAR_MADDR, + ISA_IVAR_MADDR_1, + ISA_IVAR_MSIZE, + ISA_IVAR_MSIZE_0 = ISA_IVAR_MSIZE, + ISA_IVAR_MSIZE_1, + ISA_IVAR_FLAGS, + ISA_IVAR_IRQ, + ISA_IVAR_IRQ_0 = ISA_IVAR_IRQ, + ISA_IVAR_IRQ_1, + ISA_IVAR_DRQ, + ISA_IVAR_DRQ_0 = ISA_IVAR_DRQ, + ISA_IVAR_DRQ_1 }; extern int isa_irq_pending(void); diff --git a/sys/isa/psm.c b/sys/isa/psm.c index 68eb46a..5b999e1 100644 --- a/sys/isa/psm.c +++ b/sys/isa/psm.c @@ -20,7 +20,7 @@ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: psm.c,v 1.56 1998/10/22 05:58:40 bde Exp $ + * $Id: psm.c,v 1.1 1998/11/08 18:43:03 dfr Exp $ */ /* @@ -76,6 +76,7 @@ #include <sys/poll.h> #include <sys/syslog.h> #include <sys/malloc.h> +#include <sys/rman.h> #ifdef DEVFS #include <sys/devfsext.h> #endif @@ -85,6 +86,7 @@ #include <machine/clock.h> #include <machine/limits.h> #include <machine/mouse.h> +#include <machine/resource.h> #include <isa/isareg.h> #include <isa/isavar.h> @@ -981,6 +983,8 @@ psmattach(device_t dev) int unit = device_get_unit(dev); struct psm_softc *sc = device_get_softc(dev); void *ih; + struct resource *res; + int zero = 0; if (sc == NULL) /* shouldn't happen */ return (ENXIO); @@ -1023,14 +1027,11 @@ psmattach(device_t dev) if (bootverbose) --verbose; - ih = BUS_CREATE_INTR(device_get_parent(dev), dev, - isa_get_irq(dev), - psmintr, sc); - if (!ih) - return ENXIO; + res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, 0ul, ~0ul, 1, + RF_SHAREABLE | RF_ACTIVE); + BUS_SETUP_INTR(device_get_parent(dev), dev, res, psmintr, sc, + &ih); - BUS_CONNECT_INTR(device_get_parent(dev), ih); - return (0); } diff --git a/sys/isa/sio.c b/sys/isa/sio.c index d5b48ce..683c59e 100644 --- a/sys/isa/sio.c +++ b/sys/isa/sio.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sio.c,v 1.216 1998/09/26 13:59:26 peter Exp $ + * $Id: sio.c,v 1.217 1998/09/26 14:47:16 dfr Exp $ * from: @(#)com.c 7.5 (Berkeley) 5/16/91 * from: i386/isa sio.c,v 1.215 */ @@ -68,6 +68,7 @@ #include <sys/syslog.h> #include <sys/sysctl.h> #include <sys/bus.h> +#include <sys/rman.h> #ifdef DEVFS #include <sys/devfsext.h> #endif @@ -78,6 +79,7 @@ #include <machine/clock.h> #include <machine/ipl.h> +#include <machine/resource.h> #include <isa/sioreg.h> @@ -921,6 +923,8 @@ sioattach(dev) int s; int unit; void *ih; + struct resource *res; + int zero = 0; u_int flags = isa_get_flags(dev); #if 0 @@ -1136,13 +1140,10 @@ determined_type: ; #endif com->flags = isa_get_flags(dev); /* Heritate id_flags for later */ - ih = BUS_CREATE_INTR(device_get_parent(dev), dev, - isa_get_irq(dev), - siointr, com); - if (!ih) - return ENXIO; - - BUS_CONNECT_INTR(device_get_parent(dev), ih); + res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, 0ul, ~0ul, 1, + RF_SHAREABLE | RF_ACTIVE); + BUS_SETUP_INTR(device_get_parent(dev), dev, res, siointr, com, + &ih); return (0); } diff --git a/sys/isa/syscons.c b/sys/isa/syscons.c index 65a5153..e44fe37 100644 --- a/sys/isa/syscons.c +++ b/sys/isa/syscons.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: syscons.c,v 1.275 1998/10/31 10:35:23 dfr Exp $ + * $Id: syscons.c,v 1.276 1998/11/08 12:39:04 dfr Exp $ * from: i386/isa syscons.c,v 1.278 */ @@ -54,10 +54,12 @@ #include <sys/tty.h> #include <sys/kernel.h> #include <sys/malloc.h> +#include <sys/rman.h> #ifdef DEVFS #include <sys/devfsext.h> #endif +#include <machine/resource.h> #include <machine/clock.h> #include <machine/cons.h> #include <machine/console.h> @@ -694,6 +696,8 @@ scattach(device_t dev) int vc; #endif void *ih; + struct resource *res; + int zero = 0; scinit(); flags = isa_get_flags(dev); @@ -771,13 +775,10 @@ scattach(device_t dev) UID_ROOT, GID_WHEEL, 0600, "consolectl"); #endif - ih = BUS_CREATE_INTR(device_get_parent(dev), dev, - isa_get_irq(dev), - scintr, 0); - if (!ih) - return ENXIO; - - BUS_CONNECT_INTR(device_get_parent(dev), ih); + res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, 0ul, ~0ul, 1, + RF_SHAREABLE | RF_ACTIVE); + BUS_SETUP_INTR(device_get_parent(dev), dev, res, scintr, 0, + &ih); return 0; } diff --git a/sys/powerpc/powerpc/genassym.c b/sys/powerpc/powerpc/genassym.c index ca99b6a..33febfc 100644 --- a/sys/powerpc/powerpc/genassym.c +++ b/sys/powerpc/powerpc/genassym.c @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * from: @(#)genassym.c 5.11 (Berkeley) 5/10/91 - * $Id: genassym.c,v 1.2 1998/06/14 13:44:43 dfr Exp $ + * $Id: genassym.c,v 1.3 1998/07/12 16:08:15 dfr Exp $ */ #include <sys/param.h> @@ -46,6 +46,7 @@ #include <sys/resource.h> #include <sys/resourcevar.h> #include <machine/frame.h> +#include <machine/chipset.h> #include <sys/vmmeter.h> #include <vm/vm.h> #include <vm/vm_param.h> @@ -95,7 +96,12 @@ main() OFF(P_PID, struct proc, p_pid); OFF(P_SWITCHTIME, struct proc, p_switchtime); OFF(P_RUNTIME, struct proc, p_runtime); + OFF(P_MD_FLAGS, struct proc, p_md.md_flags); OFF(P_MD_PCBPADDR, struct proc, p_md.md_pcbpaddr); + OFF(P_MD_HAE, struct proc, p_md.md_hae); + CONST1(MDP_HAEUSED); + + OFF(CHIPSET_WRITE_HAE, struct alpha_chipset, write_hae); OFF(PH_LINK, struct prochd, ph_link); OFF(PH_RLINK, struct prochd, ph_rlink); |