mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-20 08:44:33 +00:00
Bring the 'new-bus' to the i386. This extensively changes the way the
i386 platform boots, it is no longer ISA-centric, and is fully dynamic. Most old drivers compile and run without modification via 'compatability shims' to enable a smoother transition. eisa, isapnp and pccard* are not yet using the new resource manager. Once fully converted, all drivers will be loadable, including PCI and ISA. (Some other changes appear to have snuck in, including a port of Soren's ATA driver to the Alpha. Soren, back this out if you need to.) This is a checkpoint of work-in-progress, but is quite functional. The bulk of the work was done over the last few years by Doug Rabson and Garrett Wollman. Approved by: core
This commit is contained in:
parent
24c38be4da
commit
6182fdbda8
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=45720
|
@ -23,7 +23,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: autoconf.c,v 1.14 1999/03/12 14:44:46 gallatin Exp $
|
||||
* $Id: autoconf.c,v 1.15 1999/03/28 17:33:38 dfr Exp $
|
||||
*/
|
||||
|
||||
#include "opt_bootp.h"
|
||||
|
@ -190,7 +190,7 @@ configure(void *dummy)
|
|||
|
||||
if((hwrpb->rpb_type != ST_DEC_3000_300) &&
|
||||
(hwrpb->rpb_type != ST_DEC_3000_500)){
|
||||
pci_configure();
|
||||
/* pci_configure(); */
|
||||
|
||||
/*
|
||||
* Probe ISA devices after everything.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This file tells config what files go into building a kernel,
|
||||
# files marked standard are always included.
|
||||
#
|
||||
# $Id: files.alpha,v 1.16 1999/01/23 16:53:26 dfr Exp $
|
||||
# $Id: files.alpha,v 1.17 1999/03/10 10:36:50 yokota Exp $
|
||||
#
|
||||
# The long compile-with and dependency lines are required because of
|
||||
# limitations in config: backslash-newline doesn't work in strings, and
|
||||
|
@ -112,10 +112,13 @@ mcclock_if.h standard \
|
|||
no-obj no-implicit-rule before-depend \
|
||||
clean "mcclock_if.h"
|
||||
alpha/pci/cia.c optional cia
|
||||
alpha/pci/cia_pci.c optional cia
|
||||
alpha/pci/pci_eb164_intr.s optional cia
|
||||
alpha/pci/apecs.c optional apecs
|
||||
alpha/pci/apecs_pci.c optional apecs
|
||||
alpha/pci/pci_eb64plus_intr.s optional apecs
|
||||
alpha/pci/lca.c optional lca
|
||||
alpha/pci/lca_pci.c optional lca
|
||||
alpha/pci/pcibus.c optional pci
|
||||
alpha/isa/isa.c optional isa
|
||||
alpha/isa/mcclock_isa.c optional isa
|
||||
|
@ -157,3 +160,10 @@ dev/syscons/syscons.c optional sc device-driver
|
|||
dev/syscons/scvidctl.c optional sc device-driver
|
||||
isa/syscons_isa.c optional sc device-driver
|
||||
isa/psm.c optional psm device-driver
|
||||
dev/ata/ata-all.c optional ata device-driver
|
||||
dev/ata/ata-dma.c optional ata device-driver
|
||||
dev/ata/atapi-all.c optional ata device-driver
|
||||
dev/ata/ata-disk.c optional atadisk device-driver
|
||||
dev/ata/atapi-cd.c optional atapicd device-driver
|
||||
dev/ata/atapi-fd.c optional atapifd device-driver
|
||||
dev/ata/atapi-tape.c optional atapist device-driver
|
||||
|
|
|
@ -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.5 1998/10/06 14:18:39 dfr Exp $
|
||||
* $Id: chipset.h,v 1.6 1998/11/15 18:25:16 dfr Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CHIPSET_H_
|
||||
|
@ -100,13 +100,6 @@ typedef struct alpha_chipset {
|
|||
*/
|
||||
alpha_chipset_read_hae_t* read_hae;
|
||||
alpha_chipset_write_hae_t* write_hae;
|
||||
|
||||
/*
|
||||
* PCI interrupt device.
|
||||
* (XXX hack until I change pci code to use new
|
||||
* device framework.)
|
||||
*/
|
||||
void* intrdev;
|
||||
} alpha_chipset_t;
|
||||
|
||||
extern alpha_chipset_t chipset;
|
||||
|
|
|
@ -73,6 +73,7 @@ extern struct platform {
|
|||
void (*pci_intr_map) __P((void *));
|
||||
void (*pci_intr_disable) __P((int));
|
||||
void (*pci_intr_enable) __P((int));
|
||||
int (*pci_setup_ide_intr) __P((int chan, void (*fn)(void*), void *arg));
|
||||
} platform;
|
||||
|
||||
/*
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: cpufunc.h,v 1.2 1998/07/22 08:25:39 dfr Exp $
|
||||
* $Id: cpufunc.h,v 1.3 1998/08/17 08:21:31 dfr Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CPUFUNC_H_
|
||||
|
@ -58,12 +58,46 @@ breakpoint(void)
|
|||
#define writew(pa,v) chipset.writew(pa,v)
|
||||
#define writel(pa,v) chipset.writel(pa,v)
|
||||
|
||||
/*
|
||||
* Bulk i/o (for IDE driver).
|
||||
*/
|
||||
static __inline void insw(u_int32_t port, void *buffer, size_t count)
|
||||
{
|
||||
u_int16_t *p = (u_int16_t *) buffer;
|
||||
while (count--)
|
||||
*p++ = inw(port);
|
||||
}
|
||||
|
||||
static __inline void insl(u_int32_t port, void *buffer, size_t count)
|
||||
{
|
||||
u_int32_t *p = (u_int32_t *) buffer;
|
||||
while (count--)
|
||||
*p++ = inl(port);
|
||||
}
|
||||
|
||||
static __inline void outsw(u_int32_t port, const void *buffer, size_t count)
|
||||
{
|
||||
const u_int16_t *p = (const u_int16_t *) buffer;
|
||||
while (count--)
|
||||
outw(port, *p++);
|
||||
}
|
||||
|
||||
static __inline void outsl(u_int32_t port, const void *buffer, size_t count)
|
||||
{
|
||||
const u_int32_t *p = (const u_int32_t *) buffer;
|
||||
while (count--)
|
||||
outl(port, *p++);
|
||||
}
|
||||
|
||||
/*
|
||||
* String version of IO memory access ops:
|
||||
*/
|
||||
extern void memcpy_fromio(void *, u_int32_t, size_t);
|
||||
extern void memcpy_toio(u_int32_t, void *, size_t);
|
||||
extern void memcpy_io(u_int32_t, u_int32_t, size_t);
|
||||
extern void memset_io(u_int32_t, int, size_t);
|
||||
extern void memsetw(void *, int, size_t);
|
||||
extern void memsetw_io(u_int32_t, int, size_t);
|
||||
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
|
|
@ -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.8 1998/11/28 09:55:16 dfr Exp $
|
||||
* $Id: isa.c,v 1.9 1999/01/23 16:53:27 dfr Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -31,11 +31,13 @@
|
|||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <isa/isareg.h>
|
||||
#include <isa/isavar.h>
|
||||
#include <alpha/isa/isavar.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/intrcnt.h>
|
||||
#include <machine/resource.h>
|
||||
|
@ -78,10 +80,6 @@ static struct resource *isa_alloc_resource(device_t bus, device_t child,
|
|||
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 */
|
||||
|
@ -139,7 +137,7 @@ isa_add_device(device_t dev, const char *name, int unit)
|
|||
idev->id_portsize[0] = 0;
|
||||
idev->id_portsize[1] = 0;
|
||||
|
||||
if (resource_int_value(name, unit, "iomem", &t) == 0)
|
||||
if (resource_int_value(name, unit, "maddr", &t) == 0)
|
||||
idev->id_maddr[0] = t;
|
||||
else
|
||||
idev->id_maddr[0] = 0;
|
||||
|
@ -236,6 +234,8 @@ isa_probe(device_t dev)
|
|||
{
|
||||
int i;
|
||||
|
||||
device_set_desc(dev, "ISA bus");
|
||||
|
||||
/*
|
||||
* Add all devices configured to be attached to isa0.
|
||||
*/
|
||||
|
@ -256,14 +256,7 @@ 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");
|
||||
isa_init_intr();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -276,13 +269,6 @@ isa_attach(device_t dev)
|
|||
if (bootverbose)
|
||||
printf("isa_attach: mask=%04x\n", isa_irq_mask());
|
||||
|
||||
/* mask all isa interrupts */
|
||||
outb(IO_ICU1+1, 0xff);
|
||||
outb(IO_ICU2+1, 0xff);
|
||||
|
||||
/* make sure chaining irq is enabled */
|
||||
isa_intr_enable(2);
|
||||
|
||||
/*
|
||||
* Arrange for bus_generic_attach(dev) to be called later.
|
||||
*/
|
||||
|
@ -340,12 +326,14 @@ isa_print_child(device_t bus, device_t dev)
|
|||
printf("-%#x", (u_int)(id->id_maddr[1]
|
||||
+ id->id_msize[1] - 1));
|
||||
}
|
||||
#if 0
|
||||
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]);
|
||||
#endif
|
||||
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)
|
||||
|
@ -406,8 +394,10 @@ isa_read_ivar(device_t bus, device_t dev,
|
|||
case ISA_IVAR_FLAGS:
|
||||
*result = idev->id_flags;
|
||||
break;
|
||||
default:
|
||||
return (ENOENT);
|
||||
}
|
||||
return ENOENT;
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -462,6 +452,43 @@ isa_write_ivar(device_t bus, device_t dev,
|
|||
return (0);
|
||||
}
|
||||
|
||||
void isa_init_intr(void)
|
||||
{
|
||||
static int initted = 0;
|
||||
|
||||
if (initted) return;
|
||||
initted = 1;
|
||||
|
||||
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");
|
||||
|
||||
/* mask all isa interrupts */
|
||||
outb(IO_ICU1+1, 0xff);
|
||||
outb(IO_ICU2+1, 0xff);
|
||||
|
||||
/* make sure chaining irq is enabled */
|
||||
isa_intr_enable(2);
|
||||
}
|
||||
|
||||
struct resource *
|
||||
isa_alloc_intr(device_t bus, device_t child, int irq)
|
||||
{
|
||||
return rman_reserve_resource(&isa_irq_rman, irq, irq, 1,
|
||||
0, child);
|
||||
}
|
||||
|
||||
int
|
||||
isa_release_intr(device_t bus, device_t child, struct resource *r)
|
||||
{
|
||||
return rman_release_resource(r);
|
||||
}
|
||||
|
||||
/*
|
||||
* This implementation simply passes the request up to the parent
|
||||
* bus, which in our case is the pci chipset device, substituting any
|
||||
|
@ -502,7 +529,7 @@ isa_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
|||
* The hack implementation of intr_create() passes a
|
||||
* NULL child device.
|
||||
*/
|
||||
if (isdefault && (id == NULL || id->id_irq[0] >= 0)) {
|
||||
if (isdefault && id && id->id_irq[0] >= 0) {
|
||||
start = id->id_irq[0];
|
||||
end = id->id_irq[0];
|
||||
count = 1;
|
||||
|
@ -576,7 +603,6 @@ 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)
|
||||
|
@ -595,7 +621,7 @@ isa_release_resource(device_t bus, device_t child, int type, int rid,
|
|||
|
||||
rv = BUS_RELEASE_RESOURCE(device_get_parent(bus), child, type, rid, r);
|
||||
|
||||
if (rv) {
|
||||
if (rv == 0) {
|
||||
switch (type) {
|
||||
case SYS_RES_IRQ:
|
||||
id->id_irqres[rid] = 0;
|
||||
|
@ -652,7 +678,7 @@ isa_handle_intr(void *arg)
|
|||
outb(IO_ICU1, 0x20 | (irq > 7 ? 2 : irq));
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
isa_setup_intr(device_t dev, device_t child,
|
||||
struct resource *irq,
|
||||
driver_intr_t *intr, void *arg, void **cookiep)
|
||||
|
@ -681,10 +707,15 @@ isa_setup_intr(device_t dev, device_t child,
|
|||
isa_intr_enable(irq->r_start);
|
||||
|
||||
*cookiep = ii;
|
||||
|
||||
if (child)
|
||||
device_printf(child, "interrupting at ISA irq %d\n",
|
||||
(int)irq->r_start);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
int
|
||||
isa_teardown_intr(device_t dev, device_t child,
|
||||
struct resource *irq, void *cookie)
|
||||
{
|
||||
|
@ -696,6 +727,4 @@ isa_teardown_intr(device_t dev, device_t child,
|
|||
return 0;
|
||||
}
|
||||
|
||||
DRIVER_MODULE(isa, cia, isa_driver, isa_devclass, 0, 0);
|
||||
DRIVER_MODULE(isa, apecs, isa_driver, isa_devclass, 0, 0);
|
||||
DRIVER_MODULE(isa, lca, isa_driver, isa_devclass, 0, 0);
|
||||
DRIVER_MODULE(isa, isab, isa_driver, isa_devclass, 0, 0);
|
||||
|
|
39
sys/alpha/isa/isavar.h
Normal file
39
sys/alpha/isa/isavar.h
Normal file
|
@ -0,0 +1,39 @@
|
|||
/*-
|
||||
* Copyright (c) 1998 Doug Rabson
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* Export low-level interrupt handling code for chipsets which route
|
||||
* interrupts via the ISA interrupt controller.
|
||||
*/
|
||||
void isa_init_intr(void);
|
||||
struct resource *isa_alloc_intr(device_t bus, device_t child, int irq);
|
||||
int isa_release_intr(device_t bus, device_t child, struct resource *r);
|
||||
int isa_setup_intr(device_t dev, device_t child, struct resource *irq,
|
||||
driver_intr_t *intr, void *arg, void **cookiep);
|
||||
int isa_teardown_intr(device_t dev, device_t child, struct resource *irq,
|
||||
void *cookie);
|
|
@ -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.4 1998/12/04 22:54:42 archie Exp $
|
||||
* $Id: apecs.c,v 1.5 1999/01/18 20:15:07 gallatin Exp $
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
|
@ -60,12 +60,15 @@
|
|||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <alpha/pci/apecsreg.h>
|
||||
#include <alpha/pci/apecsvar.h>
|
||||
#include <alpha/pci/pcibus.h>
|
||||
#include <alpha/isa/isavar.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/resource.h>
|
||||
#include <machine/intrcnt.h>
|
||||
#include <machine/cpuconf.h>
|
||||
#include <machine/swiz.h>
|
||||
|
@ -75,7 +78,6 @@
|
|||
|
||||
static devclass_t apecs_devclass;
|
||||
static device_t apecs0; /* XXX only one for now */
|
||||
static device_t isa0;
|
||||
|
||||
struct apecs_softc {
|
||||
vm_offset_t dmem_base; /* dense memory */
|
||||
|
@ -442,18 +444,25 @@ apecs_write_hae(u_int64_t hae)
|
|||
|
||||
static int apecs_probe(device_t dev);
|
||||
static int apecs_attach(device_t dev);
|
||||
static struct resource *apecs_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 apecs_release_resource(device_t bus, device_t child,
|
||||
int type, int rid, struct resource *r);
|
||||
static int apecs_setup_intr(device_t dev, device_t child, struct resource *irq,
|
||||
driver_intr_t *intr, void *arg, void **cookiep);
|
||||
static int apecs_teardown_intr(device_t dev, device_t child,
|
||||
struct resource *irq, void *cookie);
|
||||
|
||||
static device_method_t apecs_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, apecs_probe),
|
||||
DEVMETHOD(device_attach, apecs_attach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_alloc_resource, pci_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, pci_release_resource),
|
||||
DEVMETHOD(bus_alloc_resource, apecs_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, apecs_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, pci_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, apecs_setup_intr),
|
||||
|
@ -499,29 +508,19 @@ apecs_probe(device_t dev)
|
|||
apecs_hae_mem = REGVAL(EPIC_HAXR1);
|
||||
|
||||
pci_init_resources();
|
||||
isa_init_intr();
|
||||
|
||||
isa0 = device_add_child(dev, "isa", 0, 0);
|
||||
device_add_child(dev, "pcib", 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern void isa_intr(void* frame, u_long vector);
|
||||
|
||||
static int
|
||||
apecs_attach(device_t dev)
|
||||
{
|
||||
struct apecs_softc* sc = APECS_SOFTC(dev);
|
||||
apecs_init();
|
||||
|
||||
/*
|
||||
* the avanti routes interrupts through the isa interrupt
|
||||
* controller, so we need to special case it
|
||||
*/
|
||||
if(hwrpb->rpb_type == ST_DEC_2100_A50)
|
||||
chipset.intrdev = isa0;
|
||||
else
|
||||
chipset.intrdev = apecs0;
|
||||
|
||||
sc->dmem_base = APECS_PCI_DENSE;
|
||||
sc->smem_base = APECS_PCI_SPARSE;
|
||||
sc->io_base = APECS_PCI_SIO;
|
||||
|
@ -541,6 +540,27 @@ apecs_attach(device_t dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct resource *
|
||||
apecs_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
||||
u_long start, u_long end, u_long count, u_int flags)
|
||||
{
|
||||
if (type == SYS_RES_IRQ)
|
||||
return isa_alloc_intr(bus, child, start);
|
||||
else
|
||||
return pci_alloc_resource(bus, child, type, rid,
|
||||
start, end, count, flags);
|
||||
}
|
||||
|
||||
static int
|
||||
apecs_release_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
if (type == SYS_RES_IRQ)
|
||||
return isa_release_intr(bus, child, r);
|
||||
else
|
||||
return pci_release_resource(bus, child, type, rid, r);
|
||||
}
|
||||
|
||||
static int
|
||||
apecs_setup_intr(device_t dev, device_t child,
|
||||
struct resource *irq,
|
||||
|
@ -548,6 +568,13 @@ apecs_setup_intr(device_t dev, device_t child,
|
|||
{
|
||||
int error;
|
||||
|
||||
/*
|
||||
* the avanti routes interrupts through the isa interrupt
|
||||
* controller, so we need to special case it
|
||||
*/
|
||||
if(hwrpb->rpb_type == ST_DEC_2100_A50)
|
||||
return isa_setup_intr(dev, child, irq, intr, arg, cookiep);
|
||||
|
||||
error = rman_activate_resource(irq);
|
||||
if (error)
|
||||
return error;
|
||||
|
@ -567,6 +594,13 @@ static int
|
|||
apecs_teardown_intr(device_t dev, device_t child,
|
||||
struct resource *irq, void *cookie)
|
||||
{
|
||||
/*
|
||||
* the avanti routes interrupts through the isa interrupt
|
||||
* controller, so we need to special case it
|
||||
*/
|
||||
if(hwrpb->rpb_type == ST_DEC_2100_A50)
|
||||
return isa_teardown_intr(dev, child, irq, cookie);
|
||||
|
||||
alpha_teardown_intr(cookie);
|
||||
return rman_deactivate_resource(irq);
|
||||
}
|
||||
|
|
73
sys/alpha/pci/apecs_pci.c
Normal file
73
sys/alpha/pci/apecs_pci.c
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*-
|
||||
* Copyright (c) 1998 Doug Rabson
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPEAPECSL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (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$
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
static devclass_t pcib_devclass;
|
||||
|
||||
static int
|
||||
apecs_pcib_probe(device_t dev)
|
||||
{
|
||||
device_set_desc(dev, "2107x PCI host bus adapter");
|
||||
|
||||
device_add_child(dev, "pci", 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static device_method_t apecs_pcib_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, apecs_pcib_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t apecs_pcib_driver = {
|
||||
"pcib",
|
||||
apecs_pcib_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1,
|
||||
};
|
||||
|
||||
DRIVER_MODULE(pcib, apecs, apecs_pcib_driver, pcib_devclass, 0, 0);
|
|
@ -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.14 1998/12/04 22:54:42 archie Exp $
|
||||
* $Id: cia.c,v 1.15 1999/03/28 17:52:17 dfr Exp $
|
||||
*/
|
||||
/*-
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -96,6 +96,7 @@
|
|||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <alpha/pci/ciareg.h>
|
||||
|
@ -654,6 +655,7 @@ static device_method_t cia_methods[] = {
|
|||
DEVMETHOD(device_attach, cia_attach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_alloc_resource, pci_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, pci_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, pci_activate_resource),
|
||||
|
@ -724,11 +726,12 @@ cia_probe(device_t dev)
|
|||
if (cia0)
|
||||
return ENXIO;
|
||||
cia0 = dev;
|
||||
device_set_desc(dev, "2117x PCI adapter"); /* XXX */
|
||||
device_set_desc(dev, "2117x Core Logic chipset"); /* XXX */
|
||||
|
||||
pci_init_resources();
|
||||
isa_init_intr();
|
||||
|
||||
device_add_child(dev, "isa", 0, 0);
|
||||
device_add_child(dev, "pcib", 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -736,12 +739,10 @@ cia_probe(device_t dev)
|
|||
static int
|
||||
cia_attach(device_t dev)
|
||||
{
|
||||
struct cia_softc* sc = CIA_SOFTC(dev);
|
||||
char* name;
|
||||
int pass;
|
||||
|
||||
cia_init();
|
||||
chipset.intrdev = dev;
|
||||
|
||||
name = cia_ispyxis ? "Pyxis" : "ALCOR/ALCOR2";
|
||||
if (cia_ispyxis) {
|
||||
|
@ -832,6 +833,9 @@ cia_setup_intr(device_t dev, device_t child,
|
|||
/* Enable PCI interrupt */
|
||||
platform.pci_intr_enable(irq->r_start);
|
||||
|
||||
device_printf(child, "interrupting at CIA irq %d\n",
|
||||
(int) irq->r_start);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -844,4 +848,3 @@ cia_teardown_intr(device_t dev, device_t child,
|
|||
}
|
||||
|
||||
DRIVER_MODULE(cia, root, cia_driver, cia_devclass, 0, 0);
|
||||
|
||||
|
|
73
sys/alpha/pci/cia_pci.c
Normal file
73
sys/alpha/pci/cia_pci.c
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*-
|
||||
* Copyright (c) 1998 Doug Rabson
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (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$
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
static devclass_t pcib_devclass;
|
||||
|
||||
static int
|
||||
cia_pcib_probe(device_t dev)
|
||||
{
|
||||
device_set_desc(dev, "2117x PCI host bus adapter");
|
||||
|
||||
device_add_child(dev, "pci", 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static device_method_t cia_pcib_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, cia_pcib_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t cia_pcib_driver = {
|
||||
"pcib",
|
||||
cia_pcib_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1,
|
||||
};
|
||||
|
||||
DRIVER_MODULE(pcib, cia, cia_pcib_driver, pcib_devclass, 0, 0);
|
|
@ -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.4 1998/11/15 18:25:16 dfr Exp $
|
||||
* $Id: lca.c,v 1.5 1998/12/04 22:54:42 archie Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
|
@ -35,15 +35,16 @@
|
|||
#include <alpha/pci/lcareg.h>
|
||||
#include <alpha/pci/lcavar.h>
|
||||
#include <alpha/pci/pcibus.h>
|
||||
#include <machine/swiz.h>
|
||||
#include <alpha/isa/isavar.h>
|
||||
#include <machine/intr.h>
|
||||
#include <machine/resource.h>
|
||||
#include <machine/cpuconf.h>
|
||||
#include <machine/swiz.h>
|
||||
|
||||
#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa)
|
||||
|
||||
static devclass_t lca_devclass;
|
||||
static device_t lca0; /* XXX only one for now */
|
||||
static device_t isa0;
|
||||
|
||||
struct lca_softc {
|
||||
int junk;
|
||||
|
@ -333,8 +334,12 @@ lca_write_hae(u_int64_t hae)
|
|||
|
||||
static int lca_probe(device_t dev);
|
||||
static int lca_attach(device_t dev);
|
||||
static void *lca_create_intr(device_t dev, device_t child, int irq, driver_intr_t *intr, void *arg);
|
||||
static int lca_connect_intr(device_t dev, void* ih);
|
||||
static struct resource *lca_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 lca_release_resource(device_t bus, device_t child,
|
||||
int type, int rid, struct resource *r);
|
||||
|
||||
static device_method_t lca_methods[] = {
|
||||
/* Device interface */
|
||||
|
@ -342,10 +347,12 @@ 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_alloc_resource, lca_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, lca_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, pci_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, isa_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, isa_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
@ -380,9 +387,12 @@ lca_probe(device_t dev)
|
|||
if (lca0)
|
||||
return ENXIO;
|
||||
lca0 = dev;
|
||||
device_set_desc(dev, "21066 PCI adapter"); /* XXX */
|
||||
device_set_desc(dev, "21066 Core Logic chipset"); /* XXX */
|
||||
|
||||
isa0 = device_add_child(dev, "isa", 0, 0);
|
||||
pci_init_resources();
|
||||
isa_init_intr();
|
||||
|
||||
device_add_child(dev, "pcib", 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -393,7 +403,6 @@ lca_attach(device_t dev)
|
|||
struct lca_softc* sc = LCA_SOFTC(dev);
|
||||
|
||||
lca_init();
|
||||
chipset.intrdev = isa0;
|
||||
|
||||
set_iointr(alpha_dispatch_intr);
|
||||
|
||||
|
@ -408,5 +417,26 @@ lca_attach(device_t dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct resource *
|
||||
lca_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
||||
u_long start, u_long end, u_long count, u_int flags)
|
||||
{
|
||||
if (type == SYS_RES_IRQ)
|
||||
return isa_alloc_intr(bus, child, start);
|
||||
else
|
||||
return pci_alloc_resource(bus, child, type, rid,
|
||||
start, end, count, flags);
|
||||
}
|
||||
|
||||
static int
|
||||
lca_release_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
if (type == SYS_RES_IRQ)
|
||||
return isa_release_intr(bus, child, r);
|
||||
else
|
||||
return pci_release_resource(bus, child, type, rid, r);
|
||||
}
|
||||
|
||||
DRIVER_MODULE(lca, root, lca_driver, lca_devclass, 0, 0);
|
||||
|
||||
|
|
73
sys/alpha/pci/lca_pci.c
Normal file
73
sys/alpha/pci/lca_pci.c
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*-
|
||||
* Copyright (c) 1998 Doug Rabson
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPELCAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (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$
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
static devclass_t pcib_devclass;
|
||||
|
||||
static int
|
||||
lca_pcib_probe(device_t dev)
|
||||
{
|
||||
device_set_desc(dev, "21066 PCI host bus adapter");
|
||||
|
||||
device_add_child(dev, "pci", 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static device_method_t lca_pcib_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, lca_pcib_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t lca_pcib_driver = {
|
||||
"pcib",
|
||||
lca_pcib_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1,
|
||||
};
|
||||
|
||||
DRIVER_MODULE(pcib, lca, lca_pcib_driver, pcib_devclass, 0, 0);
|
|
@ -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.7 1998/11/18 23:53:12 dfr Exp $
|
||||
* $Id: pcibus.c,v 1.8 1998/12/27 18:03:29 dfr Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -32,6 +32,7 @@
|
|||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/interrupt.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/rman.h>
|
||||
|
@ -40,6 +41,7 @@
|
|||
#include <machine/chipset.h>
|
||||
#include <machine/cpuconf.h>
|
||||
#include <machine/resource.h>
|
||||
#include <alpha/pci/pcibus.h>
|
||||
|
||||
char chipset_type[10];
|
||||
int chipset_bwx = 0;
|
||||
|
@ -129,6 +131,8 @@ pci_cvt_to_bwx(vm_offset_t sparse)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/*
|
||||
* These can disappear when I update the pci code to use the new
|
||||
* device framework.
|
||||
|
@ -160,6 +164,8 @@ intr_connect(struct intrec *idesc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
alpha_platform_assign_pciintr(pcicfgregs *cfg)
|
||||
{
|
||||
|
@ -167,6 +173,20 @@ alpha_platform_assign_pciintr(pcicfgregs *cfg)
|
|||
platform.pci_intr_map((void *)cfg);
|
||||
}
|
||||
|
||||
int
|
||||
alpha_platform_setup_ide_intr(int chan, driver_intr_t *fn, void *arg)
|
||||
{
|
||||
if (platform.pci_setup_ide_intr)
|
||||
return platform.pci_setup_ide_intr(chan, fn, arg);
|
||||
else {
|
||||
int irqs[2] = { 14, 15 };
|
||||
void *junk;
|
||||
struct resource *res;
|
||||
res = isa_alloc_intr(0, 0, irqs[chan]);
|
||||
return isa_setup_intr(0, 0, res, fn, arg, &junk);
|
||||
}
|
||||
}
|
||||
|
||||
static struct rman irq_rman, port_rman, mem_rman;
|
||||
|
||||
void pci_init_resources()
|
||||
|
@ -177,23 +197,23 @@ void pci_init_resources()
|
|||
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");
|
||||
panic("pci_init_resources irq_rman");
|
||||
|
||||
port_rman.rm_start = 0;
|
||||
port_rman.rm_end = 0xffff;
|
||||
port_rman.rm_end = ~0u;
|
||||
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");
|
||||
|| rman_manage_region(&port_rman, 0x0, (1L << 32)))
|
||||
panic("pci_init_resources 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";
|
||||
mem_rman.rm_descr = "I/O memory";
|
||||
if (rman_init(&mem_rman)
|
||||
|| rman_manage_region(&mem_rman, 0x0, (1L << 32)))
|
||||
panic("cia_probe mem_rman");
|
||||
panic("pci_init_resources mem_rman");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -205,6 +225,7 @@ 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;
|
||||
struct resource *rv;
|
||||
|
||||
switch (type) {
|
||||
case SYS_RES_IRQ:
|
||||
|
@ -223,7 +244,20 @@ pci_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
|||
return 0;
|
||||
}
|
||||
|
||||
return rman_reserve_resource(rm, start, end, count, flags, child);
|
||||
rv = rman_reserve_resource(rm, start, end, count, flags, child);
|
||||
if (rv == 0)
|
||||
return 0;
|
||||
|
||||
if (type == SYS_RES_MEMORY) {
|
||||
rman_set_bustag(rv, ALPHA_BUS_SPACE_MEM);
|
||||
rman_set_bushandle(rv, rv->r_start);
|
||||
rman_set_virtual(rv, (void *) rv->r_start); /* XXX */
|
||||
} else if (type == SYS_RES_IOPORT) {
|
||||
rman_set_bustag(rv, ALPHA_BUS_SPACE_IO);
|
||||
rman_set_bushandle(rv, rv->r_start);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -265,6 +299,13 @@ memcpy_toio(u_int32_t d, void *s, size_t size)
|
|||
writeb(d++, *cp++);
|
||||
}
|
||||
|
||||
void
|
||||
memcpy_io(u_int32_t d, u_int32_t s, size_t size)
|
||||
{
|
||||
while (size--)
|
||||
writeb(d++, readb(s++));
|
||||
}
|
||||
|
||||
void
|
||||
memset_io(u_int32_t d, int val, size_t size)
|
||||
{
|
||||
|
@ -272,6 +313,24 @@ memset_io(u_int32_t d, int val, size_t size)
|
|||
writeb(d++, val);
|
||||
}
|
||||
|
||||
void
|
||||
memsetw(void *d, int val, size_t size)
|
||||
{
|
||||
u_int16_t *sp = d;
|
||||
|
||||
while (size--)
|
||||
*sp++ = val;
|
||||
}
|
||||
|
||||
void
|
||||
memsetw_io(u_int32_t d, int val, size_t size)
|
||||
{
|
||||
while (size--) {
|
||||
writew(d, val);
|
||||
d += sizeof(u_int16_t);
|
||||
}
|
||||
}
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#ifdef DDB
|
||||
#include <ddb/ddb.h>
|
||||
|
@ -280,7 +339,6 @@ DB_COMMAND(in, db_in)
|
|||
{
|
||||
int c;
|
||||
int size;
|
||||
u_int32_t val;
|
||||
|
||||
if (!have_addr)
|
||||
return;
|
||||
|
@ -307,7 +365,7 @@ DB_COMMAND(in, db_in)
|
|||
|
||||
if (count <= 0) count = 1;
|
||||
while (--count >= 0) {
|
||||
db_printf("%08x:\t", addr);
|
||||
db_printf("%08lx:\t", addr);
|
||||
switch (size) {
|
||||
case 1:
|
||||
db_printf("%02x\n", inb(addr));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id$ */
|
||||
/* $Id: tc.c,v 1.1 1998/08/20 08:27:10 dfr Exp $ */
|
||||
/*
|
||||
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
|
||||
* All rights reserved.
|
||||
|
@ -568,8 +568,6 @@ tc_attach(device_t dev)
|
|||
|
||||
tc0 = dev;
|
||||
|
||||
chipset.intrdev = dev;
|
||||
|
||||
switch(hwrpb->rpb_type){
|
||||
#ifdef DEC_3000_300
|
||||
case ST_DEC_3000_300:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id$ */
|
||||
/* $Id: tcasic.c,v 1.1 1998/08/20 08:27:11 dfr Exp $ */
|
||||
/* from $NetBSD: tcasic.c,v 1.23 1998/05/14 00:01:31 thorpej Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -97,7 +97,6 @@ tcasic_attach(device_t dev)
|
|||
tcasic0 = dev;
|
||||
|
||||
/* chipset = tcasic_chipset;*/
|
||||
chipset.intrdev = dev;
|
||||
device_probe_and_attach(tc0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -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.6 1998/09/04 08:01:26 dfr Exp $
|
||||
* $Id: dwlpx.c,v 1.7 1998/11/15 18:25:16 dfr Exp $
|
||||
*/
|
||||
|
||||
#include "opt_simos.h"
|
||||
|
@ -293,7 +293,7 @@ dwlpx_attach(device_t dev)
|
|||
dwlpx0 = dev;
|
||||
|
||||
chipset = dwlpx_chipset;
|
||||
chipset.intrdev = dev;
|
||||
/* chipset.intrdev = dev; */
|
||||
|
||||
regs = KV(DWLPX_BASE(kft_get_node(dev), kft_get_hosenum(dev)));
|
||||
sc->dmem_base = regs + (0L << 32);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
|
||||
* $Id: autoconf.c,v 1.111 1999/01/19 00:10:59 peter Exp $
|
||||
* $Id: autoconf.c,v 1.112 1999/04/15 14:52:24 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -50,9 +50,11 @@
|
|||
#include "opt_cd9660.h"
|
||||
#include "opt_mfs.h"
|
||||
#include "opt_nfsroot.h"
|
||||
#include "opt_bus.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/diskslice.h>
|
||||
|
@ -74,13 +76,19 @@
|
|||
|
||||
#include "isa.h"
|
||||
#if NISA > 0
|
||||
#ifdef OLD_BUS_ARCH
|
||||
#include <i386/isa/isa_device.h>
|
||||
#else
|
||||
device_t isa_bus_device = 0;
|
||||
#endif /* OLD_BUS_ARCH */
|
||||
#endif
|
||||
|
||||
#include "pnp.h"
|
||||
#if NPNP > 0
|
||||
#ifdef OLD_BUS_ARCH
|
||||
#include <i386/isa/pnp.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "eisa.h"
|
||||
#if NEISA > 0
|
||||
|
@ -92,8 +100,6 @@
|
|||
#include <pci/pcivar.h>
|
||||
#endif
|
||||
|
||||
#include <sys/bus.h>
|
||||
|
||||
static void configure_first __P((void *));
|
||||
static void configure __P((void *));
|
||||
static void configure_final __P((void *));
|
||||
|
@ -186,6 +192,8 @@ configure_finish()
|
|||
{
|
||||
}
|
||||
|
||||
device_t nexus_dev;
|
||||
|
||||
/*
|
||||
* Determine i/o configuration for a machine.
|
||||
*/
|
||||
|
@ -228,21 +236,21 @@ configure(dummy)
|
|||
eisa_configure();
|
||||
#endif
|
||||
|
||||
#if NPCI > 0
|
||||
pci_configure();
|
||||
#endif
|
||||
|
||||
#if NPNP > 0
|
||||
pnp_configure();
|
||||
#endif
|
||||
|
||||
#if NISA > 0
|
||||
isa_configure();
|
||||
#endif
|
||||
/* nexus0 is the top of the i386 device tree */
|
||||
device_add_child(root_bus, "nexus", 0, 0);
|
||||
|
||||
/* initialize new bus architecture */
|
||||
root_bus_configure();
|
||||
|
||||
#if NISA > 0
|
||||
if (isa_bus_device)
|
||||
bus_generic_attach(isa_bus_device);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Now we're ready to handle (pending) interrupts.
|
||||
* XXX this is slightly misplaced.
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: exception.s,v 1.56 1999/02/25 11:03:08 bde Exp $
|
||||
* $Id: exception.s,v 1.57 1999/02/28 10:53:28 bde Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
|
@ -139,7 +139,7 @@ IDTVEC(fpu)
|
|||
#if NNPX > 0
|
||||
/*
|
||||
* Handle like an interrupt (except for accounting) so that we can
|
||||
* call npxintr to clear the error. It would be better to handle
|
||||
* call npx_intr to clear the error. It would be better to handle
|
||||
* npx interrupts as traps. This used to be difficult for nested
|
||||
* interrupts, but now it is fairly easy - mask nested ones the
|
||||
* same as SWI_AST's.
|
||||
|
@ -180,7 +180,7 @@ IDTVEC(fpu)
|
|||
movl %eax,_cpl
|
||||
#endif /* SMP */
|
||||
|
||||
call _npxintr
|
||||
call _npx_intr
|
||||
|
||||
incb _intr_nesting_level
|
||||
MEXITCOUNT
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: exception.s,v 1.56 1999/02/25 11:03:08 bde Exp $
|
||||
* $Id: exception.s,v 1.57 1999/02/28 10:53:28 bde Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
|
@ -139,7 +139,7 @@ IDTVEC(fpu)
|
|||
#if NNPX > 0
|
||||
/*
|
||||
* Handle like an interrupt (except for accounting) so that we can
|
||||
* call npxintr to clear the error. It would be better to handle
|
||||
* call npx_intr to clear the error. It would be better to handle
|
||||
* npx interrupts as traps. This used to be difficult for nested
|
||||
* interrupts, but now it is fairly easy - mask nested ones the
|
||||
* same as SWI_AST's.
|
||||
|
@ -180,7 +180,7 @@ IDTVEC(fpu)
|
|||
movl %eax,_cpl
|
||||
#endif /* SMP */
|
||||
|
||||
call _npxintr
|
||||
call _npx_intr
|
||||
|
||||
incb _intr_nesting_level
|
||||
MEXITCOUNT
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: npx.c,v 1.65 1999/01/08 16:29:59 bde Exp $
|
||||
* $Id: npx.c,v 1.66 1999/03/28 23:28:18 dt Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
|
@ -43,10 +43,14 @@
|
|||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/proc.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#ifdef NPX_DEBUG
|
||||
#include <sys/syslog.h>
|
||||
#endif
|
||||
|
@ -64,6 +68,7 @@
|
|||
#ifndef SMP
|
||||
#include <machine/clock.h>
|
||||
#endif
|
||||
#include <machine/resource.h>
|
||||
#include <machine/specialreg.h>
|
||||
#include <machine/segments.h>
|
||||
|
||||
|
@ -72,7 +77,6 @@
|
|||
#include <i386/isa/intr_machdep.h>
|
||||
#include <i386/isa/isa.h>
|
||||
#endif
|
||||
#include <i386/isa/isa_device.h>
|
||||
|
||||
/*
|
||||
* 387 and 287 Numeric Coprocessor Extension (NPX) Driver.
|
||||
|
@ -83,9 +87,6 @@
|
|||
#define NPX_DISABLE_I586_OPTIMIZED_BZERO (1 << 1)
|
||||
#define NPX_DISABLE_I586_OPTIMIZED_COPYIO (1 << 2)
|
||||
|
||||
/* XXX - should be in header file. */
|
||||
ointhand2_t npxintr;
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#define fldcw(addr) __asm("fldcw %0" : : "m" (*(addr)))
|
||||
|
@ -119,18 +120,15 @@ void stop_emulating __P((void));
|
|||
|
||||
typedef u_char bool_t;
|
||||
|
||||
static int npxattach __P((struct isa_device *dvp));
|
||||
static int npxprobe __P((struct isa_device *dvp));
|
||||
static int npxprobe1 __P((struct isa_device *dvp));
|
||||
static int npx_attach __P((device_t dev));
|
||||
void npx_intr __P((void *));
|
||||
static int npx_probe __P((device_t dev));
|
||||
static int npx_probe1 __P((device_t dev));
|
||||
#ifdef I586_CPU
|
||||
static long timezero __P((const char *funcname,
|
||||
void (*func)(void *buf, size_t len)));
|
||||
#endif /* I586_CPU */
|
||||
|
||||
struct isa_driver npxdriver = {
|
||||
npxprobe, npxattach, "npx",
|
||||
};
|
||||
|
||||
int hw_float; /* XXX currently just alias for npx_exists */
|
||||
|
||||
SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint,
|
||||
|
@ -191,12 +189,13 @@ __asm(" \n\
|
|||
* need to use interrupts. Return 1 if device exists.
|
||||
*/
|
||||
static int
|
||||
npxprobe(dvp)
|
||||
struct isa_device *dvp;
|
||||
npx_probe(dev)
|
||||
device_t dev;
|
||||
{
|
||||
#ifdef SMP
|
||||
/*#ifdef SMP*/
|
||||
#if 1
|
||||
|
||||
return npxprobe1(dvp);
|
||||
return npx_probe1(dev);
|
||||
|
||||
#else /* SMP */
|
||||
|
||||
|
@ -213,20 +212,20 @@ npxprobe(dvp)
|
|||
* install suitable handlers and run with interrupts enabled so we
|
||||
* won't need to do so much here.
|
||||
*/
|
||||
npx_intrno = NRSVIDT + ffs(dvp->id_irq) - 1;
|
||||
npx_intrno = NRSVIDT + 13;
|
||||
save_eflags = read_eflags();
|
||||
disable_intr();
|
||||
save_icu1_mask = inb(IO_ICU1 + 1);
|
||||
save_icu2_mask = inb(IO_ICU2 + 1);
|
||||
save_idt_npxintr = idt[npx_intrno];
|
||||
save_idt_npxtrap = idt[16];
|
||||
outb(IO_ICU1 + 1, ~(IRQ_SLAVE | dvp->id_irq));
|
||||
outb(IO_ICU2 + 1, ~(dvp->id_irq >> 8));
|
||||
outb(IO_ICU1 + 1, ~IRQ_SLAVE);
|
||||
outb(IO_ICU2 + 1, ~(1 << (13 - 8)));
|
||||
setidt(16, probetrap, SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
|
||||
setidt(npx_intrno, probeintr, SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
|
||||
npx_idt_probeintr = idt[npx_intrno];
|
||||
enable_intr();
|
||||
result = npxprobe1(dvp);
|
||||
result = npx_probe1(dev);
|
||||
disable_intr();
|
||||
outb(IO_ICU1 + 1, save_icu1_mask);
|
||||
outb(IO_ICU2 + 1, save_icu2_mask);
|
||||
|
@ -239,8 +238,8 @@ npxprobe(dvp)
|
|||
}
|
||||
|
||||
static int
|
||||
npxprobe1(dvp)
|
||||
struct isa_device *dvp;
|
||||
npx_probe1(dev)
|
||||
device_t dev;
|
||||
{
|
||||
#ifndef SMP
|
||||
u_short control;
|
||||
|
@ -280,21 +279,18 @@ npxprobe1(dvp)
|
|||
*/
|
||||
fninit();
|
||||
|
||||
#ifdef SMP
|
||||
|
||||
/*#ifdef SMP*/
|
||||
#if 1
|
||||
/*
|
||||
* Exception 16 MUST work for SMP.
|
||||
*/
|
||||
npx_irq13 = 0;
|
||||
npx_ex16 = hw_float = npx_exists = 1;
|
||||
dvp->id_irq = 0; /* zap the interrupt */
|
||||
/*
|
||||
* special return value to flag that we do not
|
||||
* actually use any I/O registers
|
||||
*/
|
||||
return (-1);
|
||||
device_set_desc(dev, "math processor");
|
||||
return (0);
|
||||
|
||||
#else /* SMP */
|
||||
#else /* !SMP */
|
||||
device_set_desc(dev, "math processor");
|
||||
|
||||
/*
|
||||
* Don't use fwait here because it might hang.
|
||||
|
@ -335,14 +331,12 @@ npxprobe1(dvp)
|
|||
* Good, exception 16 works.
|
||||
*/
|
||||
npx_ex16 = 1;
|
||||
dvp->id_irq = 0; /* zap the interrupt */
|
||||
/*
|
||||
* special return value to flag that we do not
|
||||
* actually use any I/O registers
|
||||
*/
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
if (npx_intrs_while_probing != 0) {
|
||||
int rid;
|
||||
struct resource *r;
|
||||
void *intr;
|
||||
/*
|
||||
* Bad, we are stuck with IRQ13.
|
||||
*/
|
||||
|
@ -350,8 +344,30 @@ npxprobe1(dvp)
|
|||
/*
|
||||
* npxattach would be too late to set npx0_imask.
|
||||
*/
|
||||
npx0_imask |= dvp->id_irq;
|
||||
return (IO_NPXSIZE);
|
||||
npx0_imask |= (1 << 13);
|
||||
|
||||
/*
|
||||
* We allocate these resources permanently,
|
||||
* so there is no need to keep track of them.
|
||||
*/
|
||||
rid = 0;
|
||||
r = bus_alloc_resource(dev, SYS_RES_IOPORT,
|
||||
&rid, IO_NPX, IO_NPX,
|
||||
IO_NPXSIZE, RF_ACTIVE);
|
||||
if (r == 0)
|
||||
panic("npx: can't get ports");
|
||||
rid = 0;
|
||||
r = bus_alloc_resource(dev, SYS_RES_IRQ,
|
||||
&rid, 13, 13,
|
||||
1, RF_ACTIVE);
|
||||
if (r == 0)
|
||||
panic("npx: can't get IRQ");
|
||||
BUS_SETUP_INTR(device_get_parent(dev),
|
||||
dev, r, npx_intr, 0, &intr);
|
||||
if (intr == 0)
|
||||
panic("npx: can't create intr");
|
||||
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* Worse, even IRQ13 is broken. Use emulator.
|
||||
|
@ -363,13 +379,7 @@ npxprobe1(dvp)
|
|||
* emulator and say that it has been installed. XXX handle devices
|
||||
* that aren't really devices better.
|
||||
*/
|
||||
dvp->id_irq = 0;
|
||||
/*
|
||||
* special return value to flag that we do not
|
||||
* actually use any I/O registers
|
||||
*/
|
||||
return (-1);
|
||||
|
||||
return (0);
|
||||
#endif /* SMP */
|
||||
}
|
||||
|
||||
|
@ -377,14 +387,15 @@ npxprobe1(dvp)
|
|||
* Attach routine - announce which it is, and wire into system
|
||||
*/
|
||||
int
|
||||
npxattach(dvp)
|
||||
struct isa_device *dvp;
|
||||
npx_attach(dev)
|
||||
device_t dev;
|
||||
{
|
||||
dvp->id_ointr = npxintr;
|
||||
int flags;
|
||||
|
||||
/* The caller has printed "irq 13" for the npx_irq13 case. */
|
||||
if (!npx_irq13) {
|
||||
printf("npx%d: ", dvp->id_unit);
|
||||
device_print_prettyname(dev);
|
||||
if (npx_irq13) {
|
||||
printf("using IRQ 13 interface\n");
|
||||
} else {
|
||||
if (npx_ex16)
|
||||
printf("INT 16 interface\n");
|
||||
#if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE)
|
||||
|
@ -401,23 +412,26 @@ npxattach(dvp)
|
|||
npxinit(__INITIAL_NPXCW__);
|
||||
|
||||
#ifdef I586_CPU
|
||||
if (resource_int_value("npx", 0, "flags", &flags) != 0)
|
||||
flags = 0;
|
||||
|
||||
if (cpu_class == CPUCLASS_586 && npx_ex16 &&
|
||||
timezero("i586_bzero()", i586_bzero) <
|
||||
timezero("bzero()", bzero) * 4 / 5) {
|
||||
if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) {
|
||||
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) {
|
||||
bcopy_vector = i586_bcopy;
|
||||
ovbcopy_vector = i586_bcopy;
|
||||
}
|
||||
if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_BZERO))
|
||||
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BZERO))
|
||||
bzero = i586_bzero;
|
||||
if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_COPYIO)) {
|
||||
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_COPYIO)) {
|
||||
copyin_vector = i586_copyin;
|
||||
copyout_vector = i586_copyout;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return (1); /* XXX unused */
|
||||
return (0); /* XXX unused */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -494,8 +508,8 @@ npxexit(p)
|
|||
* solution for signals other than SIGFPE.
|
||||
*/
|
||||
void
|
||||
npxintr(unit)
|
||||
int unit;
|
||||
npx_intr(dummy)
|
||||
void *dummy;
|
||||
{
|
||||
int code;
|
||||
struct intrframe *frame;
|
||||
|
@ -518,7 +532,7 @@ npxintr(unit)
|
|||
/*
|
||||
* Pass exception to process.
|
||||
*/
|
||||
frame = (struct intrframe *)&unit; /* XXX */
|
||||
frame = (struct intrframe *)&dummy; /* XXX */
|
||||
if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) {
|
||||
/*
|
||||
* Interrupt is essentially a trap, so we can afford to call
|
||||
|
@ -686,4 +700,31 @@ timezero(funcname, func)
|
|||
}
|
||||
#endif /* I586_CPU */
|
||||
|
||||
static device_method_t npx_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, npx_probe),
|
||||
DEVMETHOD(device_attach, npx_attach),
|
||||
DEVMETHOD(device_detach, bus_generic_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
DEVMETHOD(device_suspend, bus_generic_suspend),
|
||||
DEVMETHOD(device_resume, bus_generic_resume),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t npx_driver = {
|
||||
"npx",
|
||||
npx_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1, /* no softc */
|
||||
};
|
||||
|
||||
static devclass_t npx_devclass;
|
||||
|
||||
/*
|
||||
* We prefer to attach to the root nexus so that the usual case (exception 16)
|
||||
* doesn't describe the processor as being `on isa'.
|
||||
*/
|
||||
DRIVER_MODULE(npx, nexus, npx_driver, npx_devclass, 0, 0);
|
||||
|
||||
#endif /* NNPX > 0 */
|
||||
|
|
409
sys/amd64/amd64/legacy.c
Normal file
409
sys/amd64/amd64/legacy.c
Normal file
|
@ -0,0 +1,409 @@
|
|||
/*
|
||||
* Copyright 1998 Massachusetts Institute of Technology
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby
|
||||
* granted, provided that both the above copyright notice and this
|
||||
* permission notice appear in all copies, that both the above
|
||||
* copyright notice and this permission notice appear in all
|
||||
* supporting documentation, and that the name of M.I.T. not be used
|
||||
* in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission. M.I.T. makes
|
||||
* no representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
|
||||
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
|
||||
* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code implements a `root nexus' for Intel Architecture
|
||||
* machines. The function of the root nexus is to serve as an
|
||||
* attachment point for both processors and buses, and to manage
|
||||
* resources which are common to all of them. In particular,
|
||||
* this code implements the core resource managers for interrupt
|
||||
* requests, DMA requests (which rightfully should be a part of the
|
||||
* ISA code but it's easier to do it here for now), I/O port addresses,
|
||||
* and I/O memory address space.
|
||||
*/
|
||||
|
||||
#include "opt_smp.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/interrupt.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <machine/vmparam.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <machine/pmap.h>
|
||||
|
||||
#include <machine/ipl.h>
|
||||
#include <machine/resource.h>
|
||||
#ifdef APIC_IO
|
||||
#include <machine/smp.h>
|
||||
#include <machine/mpapic.h>
|
||||
#endif
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
#include <i386/isa/icu.h>
|
||||
#include <i386/isa/intr_machdep.h>
|
||||
|
||||
#include <pci/pcivar.h>
|
||||
|
||||
#include "eisa.h"
|
||||
#include "isa.h"
|
||||
#include "pci.h"
|
||||
#include "npx.h"
|
||||
#include "apm.h"
|
||||
|
||||
static struct rman irq_rman, drq_rman, port_rman, mem_rman;
|
||||
|
||||
static int nexus_probe(device_t);
|
||||
static void nexus_print_child(device_t, device_t);
|
||||
static struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
|
||||
u_long, u_long, u_long, u_int);
|
||||
static int nexus_activate_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_deactivate_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_release_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_setup_intr(device_t, device_t, struct resource *,
|
||||
void (*)(void *), void *, void **);
|
||||
static int nexus_teardown_intr(device_t, device_t, struct resource *,
|
||||
void *);
|
||||
|
||||
static device_method_t nexus_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, nexus_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
DEVMETHOD(device_detach, bus_generic_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, nexus_print_child),
|
||||
DEVMETHOD(bus_read_ivar, bus_generic_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, bus_generic_write_ivar),
|
||||
DEVMETHOD(bus_alloc_resource, nexus_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, nexus_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, nexus_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t nexus_driver = {
|
||||
"nexus",
|
||||
nexus_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1, /* no softc */
|
||||
};
|
||||
static devclass_t nexus_devclass;
|
||||
|
||||
DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);
|
||||
|
||||
#ifdef APIC_IO
|
||||
#define LASTIRQ (NINTR - 1)
|
||||
#else
|
||||
#define LASTIRQ 15
|
||||
#endif
|
||||
|
||||
static int
|
||||
nexus_probe(device_t dev)
|
||||
{
|
||||
device_t child;
|
||||
|
||||
device_quiet(dev); /* suppress attach message for neatness */
|
||||
|
||||
irq_rman.rm_start = 0;
|
||||
irq_rman.rm_end = LASTIRQ;
|
||||
irq_rman.rm_type = RMAN_ARRAY;
|
||||
irq_rman.rm_descr = "Interrupt request lines";
|
||||
if (rman_init(&irq_rman)
|
||||
|| rman_manage_region(&irq_rman, 0, 1)
|
||||
|| rman_manage_region(&irq_rman, 3, LASTIRQ))
|
||||
panic("nexus_probe irq_rman");
|
||||
|
||||
drq_rman.rm_start = 0;
|
||||
drq_rman.rm_end = 7;
|
||||
drq_rman.rm_type = RMAN_ARRAY;
|
||||
drq_rman.rm_descr = "DMA request lines";
|
||||
/* XXX drq 0 not available on some machines */
|
||||
if (rman_init(&drq_rman)
|
||||
|| rman_manage_region(&drq_rman, 0, 7))
|
||||
panic("nexus_probe drq_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("nexus_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, 0, ~0))
|
||||
panic("nexus_probe mem_rman");
|
||||
|
||||
#if NNPX > 0
|
||||
child = device_add_child(dev, "npx", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe npx");
|
||||
#endif /* NNPX > 0 */
|
||||
#if NAPM > 0
|
||||
child = device_add_child(dev, "apm", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe apm");
|
||||
#endif /* NAPM > 0 */
|
||||
#if NPCI > 0
|
||||
/* Add a PCI bridge if pci bus is present */
|
||||
if (pci_cfgopen() != 0) {
|
||||
child = device_add_child(dev, "pcib", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe pcib");
|
||||
}
|
||||
#endif
|
||||
#if 0 && NEISA > 0
|
||||
child = device_add_child(dev, "eisa", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe eisa");
|
||||
#endif
|
||||
#if NISA > 0
|
||||
/* Add an ISA bus directly if pci bus is not present */
|
||||
if (pci_cfgopen() == 0) {
|
||||
child = device_add_child(dev, "isa", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe isa");
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
nexus_print_child(device_t bus, device_t child)
|
||||
{
|
||||
printf(" on motherboard");
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 nexus0.
|
||||
* (Exceptions include npx.)
|
||||
*/
|
||||
static struct resource *
|
||||
nexus_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 resource *rv;
|
||||
struct rman *rm;
|
||||
|
||||
switch (type) {
|
||||
case SYS_RES_IRQ:
|
||||
rm = &irq_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_DRQ:
|
||||
rm = &drq_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_IOPORT:
|
||||
rm = &port_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_MEMORY:
|
||||
rm = &mem_rman;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
rv = rman_reserve_resource(rm, start, end, count, flags, child);
|
||||
if (rv == 0)
|
||||
return 0;
|
||||
|
||||
if (type == SYS_RES_MEMORY) {
|
||||
caddr_t vaddr = 0;
|
||||
|
||||
if (rv->r_end < 1024 * 1024 * 1024) {
|
||||
/*
|
||||
* The first 1Mb is mapped at KERNBASE.
|
||||
*/
|
||||
vaddr = (caddr_t)((uintptr_t)KERNBASE + rv->r_start);
|
||||
} else {
|
||||
u_int32_t paddr;
|
||||
u_int32_t psize;
|
||||
u_int32_t poffs;
|
||||
|
||||
paddr = rv->r_start;
|
||||
psize = rv->r_end - rv->r_start;
|
||||
|
||||
poffs = paddr - trunc_page(paddr);
|
||||
vaddr = (caddr_t) pmap_mapdev(paddr-poffs, psize+poffs) + poffs;
|
||||
}
|
||||
rman_set_virtual(rv, vaddr);
|
||||
rman_set_bustag(rv, I386_BUS_SPACE_MEM);
|
||||
rman_set_bushandle(rv, (bus_space_handle_t) vaddr);
|
||||
} else if (type == SYS_RES_IOPORT) {
|
||||
rman_set_bustag(rv, I386_BUS_SPACE_IO);
|
||||
rman_set_bushandle(rv, rv->r_start);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
return (rman_activate_resource(r));
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
return (rman_deactivate_resource(r));
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_release_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
return (rman_release_resource(r));
|
||||
}
|
||||
|
||||
/*
|
||||
* Currently this uses the really grody interface from kern/kern_intr.c
|
||||
* (which really doesn't belong in kern/anything.c). Eventually, all of
|
||||
* the code in kern_intr.c and machdep_intr.c should get moved here, since
|
||||
* this is going to be the official interface.
|
||||
*/
|
||||
static int
|
||||
nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
|
||||
void (*ihand)(void *), void *arg, void **cookiep)
|
||||
{
|
||||
intrmask_t *mask;
|
||||
driver_t *driver;
|
||||
int error, icflags;
|
||||
|
||||
if (child)
|
||||
device_printf(child, "interrupting at irq %d\n",
|
||||
(int)irq->r_start);
|
||||
|
||||
*cookiep = 0;
|
||||
if (irq->r_flags & RF_SHAREABLE)
|
||||
icflags = 0;
|
||||
else
|
||||
icflags = INTR_EXCL;
|
||||
|
||||
driver = device_get_driver(child);
|
||||
switch (driver->type) {
|
||||
case DRIVER_TYPE_TTY:
|
||||
mask = &tty_imask;
|
||||
break;
|
||||
case (DRIVER_TYPE_TTY | DRIVER_TYPE_FAST):
|
||||
mask = &tty_imask;
|
||||
icflags |= INTR_FAST;
|
||||
break;
|
||||
case DRIVER_TYPE_BIO:
|
||||
mask = &bio_imask;
|
||||
break;
|
||||
case DRIVER_TYPE_NET:
|
||||
mask = &net_imask;
|
||||
break;
|
||||
case DRIVER_TYPE_CAM:
|
||||
mask = &cam_imask;
|
||||
break;
|
||||
case DRIVER_TYPE_MISC:
|
||||
mask = 0;
|
||||
break;
|
||||
default:
|
||||
panic("still using grody create_intr interface");
|
||||
}
|
||||
|
||||
/*
|
||||
* We depend here on rman_activate_resource() being idempotent.
|
||||
*/
|
||||
error = rman_activate_resource(irq);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
*cookiep = intr_create((void *)(intptr_t)-1, irq->r_start, ihand, arg,
|
||||
mask, icflags);
|
||||
if (*cookiep)
|
||||
error = intr_connect(*cookiep);
|
||||
else
|
||||
error = EINVAL; /* XXX ??? */
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
|
||||
{
|
||||
return (intr_destroy(ih));
|
||||
}
|
||||
|
||||
static devclass_t pcib_devclass;
|
||||
|
||||
static int
|
||||
nexus_pcib_probe(device_t dev)
|
||||
{
|
||||
device_set_desc(dev, "PCI host bus adapter");
|
||||
|
||||
device_add_child(dev, "pci", 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static device_method_t nexus_pcib_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, nexus_pcib_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t nexus_pcib_driver = {
|
||||
"pcib",
|
||||
nexus_pcib_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1,
|
||||
};
|
||||
|
||||
DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0);
|
|
@ -35,7 +35,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.327 1999/03/06 04:46:18 wollman Exp $
|
||||
* $Id: machdep.c,v 1.328 1999/04/03 22:19:58 jdp Exp $
|
||||
*/
|
||||
|
||||
#include "apm.h"
|
||||
|
@ -71,6 +71,7 @@
|
|||
#include <sys/sysent.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/vmmeter.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
|
@ -125,7 +126,9 @@
|
|||
#include <machine/perfmon.h>
|
||||
#endif
|
||||
|
||||
#ifdef OLD_BUS_ARCH
|
||||
#include <i386/isa/isa_device.h>
|
||||
#endif
|
||||
#include <i386/isa/intr_machdep.h>
|
||||
#ifndef VM86
|
||||
#include <i386/isa/rtc.h>
|
||||
|
@ -1164,8 +1167,10 @@ init386(first)
|
|||
unsigned biosbasemem, biosextmem;
|
||||
struct gate_descriptor *gdp;
|
||||
int gsel_tss;
|
||||
#if NNPX > 0
|
||||
int msize;
|
||||
#endif
|
||||
|
||||
struct isa_device *idp;
|
||||
#ifndef SMP
|
||||
/* table descriptors - used to load tables by microp */
|
||||
struct region_descriptor r_gdt, r_idt;
|
||||
|
@ -1454,10 +1459,11 @@ init386(first)
|
|||
#endif
|
||||
|
||||
#if NNPX > 0
|
||||
idp = find_isadev(isa_devtab_null, &npxdriver, 0);
|
||||
if (idp != NULL && idp->id_msize != 0) {
|
||||
Maxmem = idp->id_msize / 4;
|
||||
speculative_mprobe = FALSE;
|
||||
if (resource_int_value("npx", 0, "msize", &msize) == 0) {
|
||||
if (msize != 0) {
|
||||
Maxmem = msize / 4;
|
||||
speculative_mprobe = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
409
sys/amd64/amd64/nexus.c
Normal file
409
sys/amd64/amd64/nexus.c
Normal file
|
@ -0,0 +1,409 @@
|
|||
/*
|
||||
* Copyright 1998 Massachusetts Institute of Technology
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby
|
||||
* granted, provided that both the above copyright notice and this
|
||||
* permission notice appear in all copies, that both the above
|
||||
* copyright notice and this permission notice appear in all
|
||||
* supporting documentation, and that the name of M.I.T. not be used
|
||||
* in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission. M.I.T. makes
|
||||
* no representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
|
||||
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
|
||||
* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code implements a `root nexus' for Intel Architecture
|
||||
* machines. The function of the root nexus is to serve as an
|
||||
* attachment point for both processors and buses, and to manage
|
||||
* resources which are common to all of them. In particular,
|
||||
* this code implements the core resource managers for interrupt
|
||||
* requests, DMA requests (which rightfully should be a part of the
|
||||
* ISA code but it's easier to do it here for now), I/O port addresses,
|
||||
* and I/O memory address space.
|
||||
*/
|
||||
|
||||
#include "opt_smp.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/interrupt.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <machine/vmparam.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <machine/pmap.h>
|
||||
|
||||
#include <machine/ipl.h>
|
||||
#include <machine/resource.h>
|
||||
#ifdef APIC_IO
|
||||
#include <machine/smp.h>
|
||||
#include <machine/mpapic.h>
|
||||
#endif
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
#include <i386/isa/icu.h>
|
||||
#include <i386/isa/intr_machdep.h>
|
||||
|
||||
#include <pci/pcivar.h>
|
||||
|
||||
#include "eisa.h"
|
||||
#include "isa.h"
|
||||
#include "pci.h"
|
||||
#include "npx.h"
|
||||
#include "apm.h"
|
||||
|
||||
static struct rman irq_rman, drq_rman, port_rman, mem_rman;
|
||||
|
||||
static int nexus_probe(device_t);
|
||||
static void nexus_print_child(device_t, device_t);
|
||||
static struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
|
||||
u_long, u_long, u_long, u_int);
|
||||
static int nexus_activate_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_deactivate_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_release_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_setup_intr(device_t, device_t, struct resource *,
|
||||
void (*)(void *), void *, void **);
|
||||
static int nexus_teardown_intr(device_t, device_t, struct resource *,
|
||||
void *);
|
||||
|
||||
static device_method_t nexus_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, nexus_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
DEVMETHOD(device_detach, bus_generic_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, nexus_print_child),
|
||||
DEVMETHOD(bus_read_ivar, bus_generic_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, bus_generic_write_ivar),
|
||||
DEVMETHOD(bus_alloc_resource, nexus_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, nexus_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, nexus_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t nexus_driver = {
|
||||
"nexus",
|
||||
nexus_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1, /* no softc */
|
||||
};
|
||||
static devclass_t nexus_devclass;
|
||||
|
||||
DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);
|
||||
|
||||
#ifdef APIC_IO
|
||||
#define LASTIRQ (NINTR - 1)
|
||||
#else
|
||||
#define LASTIRQ 15
|
||||
#endif
|
||||
|
||||
static int
|
||||
nexus_probe(device_t dev)
|
||||
{
|
||||
device_t child;
|
||||
|
||||
device_quiet(dev); /* suppress attach message for neatness */
|
||||
|
||||
irq_rman.rm_start = 0;
|
||||
irq_rman.rm_end = LASTIRQ;
|
||||
irq_rman.rm_type = RMAN_ARRAY;
|
||||
irq_rman.rm_descr = "Interrupt request lines";
|
||||
if (rman_init(&irq_rman)
|
||||
|| rman_manage_region(&irq_rman, 0, 1)
|
||||
|| rman_manage_region(&irq_rman, 3, LASTIRQ))
|
||||
panic("nexus_probe irq_rman");
|
||||
|
||||
drq_rman.rm_start = 0;
|
||||
drq_rman.rm_end = 7;
|
||||
drq_rman.rm_type = RMAN_ARRAY;
|
||||
drq_rman.rm_descr = "DMA request lines";
|
||||
/* XXX drq 0 not available on some machines */
|
||||
if (rman_init(&drq_rman)
|
||||
|| rman_manage_region(&drq_rman, 0, 7))
|
||||
panic("nexus_probe drq_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("nexus_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, 0, ~0))
|
||||
panic("nexus_probe mem_rman");
|
||||
|
||||
#if NNPX > 0
|
||||
child = device_add_child(dev, "npx", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe npx");
|
||||
#endif /* NNPX > 0 */
|
||||
#if NAPM > 0
|
||||
child = device_add_child(dev, "apm", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe apm");
|
||||
#endif /* NAPM > 0 */
|
||||
#if NPCI > 0
|
||||
/* Add a PCI bridge if pci bus is present */
|
||||
if (pci_cfgopen() != 0) {
|
||||
child = device_add_child(dev, "pcib", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe pcib");
|
||||
}
|
||||
#endif
|
||||
#if 0 && NEISA > 0
|
||||
child = device_add_child(dev, "eisa", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe eisa");
|
||||
#endif
|
||||
#if NISA > 0
|
||||
/* Add an ISA bus directly if pci bus is not present */
|
||||
if (pci_cfgopen() == 0) {
|
||||
child = device_add_child(dev, "isa", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe isa");
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
nexus_print_child(device_t bus, device_t child)
|
||||
{
|
||||
printf(" on motherboard");
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 nexus0.
|
||||
* (Exceptions include npx.)
|
||||
*/
|
||||
static struct resource *
|
||||
nexus_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 resource *rv;
|
||||
struct rman *rm;
|
||||
|
||||
switch (type) {
|
||||
case SYS_RES_IRQ:
|
||||
rm = &irq_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_DRQ:
|
||||
rm = &drq_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_IOPORT:
|
||||
rm = &port_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_MEMORY:
|
||||
rm = &mem_rman;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
rv = rman_reserve_resource(rm, start, end, count, flags, child);
|
||||
if (rv == 0)
|
||||
return 0;
|
||||
|
||||
if (type == SYS_RES_MEMORY) {
|
||||
caddr_t vaddr = 0;
|
||||
|
||||
if (rv->r_end < 1024 * 1024 * 1024) {
|
||||
/*
|
||||
* The first 1Mb is mapped at KERNBASE.
|
||||
*/
|
||||
vaddr = (caddr_t)((uintptr_t)KERNBASE + rv->r_start);
|
||||
} else {
|
||||
u_int32_t paddr;
|
||||
u_int32_t psize;
|
||||
u_int32_t poffs;
|
||||
|
||||
paddr = rv->r_start;
|
||||
psize = rv->r_end - rv->r_start;
|
||||
|
||||
poffs = paddr - trunc_page(paddr);
|
||||
vaddr = (caddr_t) pmap_mapdev(paddr-poffs, psize+poffs) + poffs;
|
||||
}
|
||||
rman_set_virtual(rv, vaddr);
|
||||
rman_set_bustag(rv, I386_BUS_SPACE_MEM);
|
||||
rman_set_bushandle(rv, (bus_space_handle_t) vaddr);
|
||||
} else if (type == SYS_RES_IOPORT) {
|
||||
rman_set_bustag(rv, I386_BUS_SPACE_IO);
|
||||
rman_set_bushandle(rv, rv->r_start);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
return (rman_activate_resource(r));
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
return (rman_deactivate_resource(r));
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_release_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
return (rman_release_resource(r));
|
||||
}
|
||||
|
||||
/*
|
||||
* Currently this uses the really grody interface from kern/kern_intr.c
|
||||
* (which really doesn't belong in kern/anything.c). Eventually, all of
|
||||
* the code in kern_intr.c and machdep_intr.c should get moved here, since
|
||||
* this is going to be the official interface.
|
||||
*/
|
||||
static int
|
||||
nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
|
||||
void (*ihand)(void *), void *arg, void **cookiep)
|
||||
{
|
||||
intrmask_t *mask;
|
||||
driver_t *driver;
|
||||
int error, icflags;
|
||||
|
||||
if (child)
|
||||
device_printf(child, "interrupting at irq %d\n",
|
||||
(int)irq->r_start);
|
||||
|
||||
*cookiep = 0;
|
||||
if (irq->r_flags & RF_SHAREABLE)
|
||||
icflags = 0;
|
||||
else
|
||||
icflags = INTR_EXCL;
|
||||
|
||||
driver = device_get_driver(child);
|
||||
switch (driver->type) {
|
||||
case DRIVER_TYPE_TTY:
|
||||
mask = &tty_imask;
|
||||
break;
|
||||
case (DRIVER_TYPE_TTY | DRIVER_TYPE_FAST):
|
||||
mask = &tty_imask;
|
||||
icflags |= INTR_FAST;
|
||||
break;
|
||||
case DRIVER_TYPE_BIO:
|
||||
mask = &bio_imask;
|
||||
break;
|
||||
case DRIVER_TYPE_NET:
|
||||
mask = &net_imask;
|
||||
break;
|
||||
case DRIVER_TYPE_CAM:
|
||||
mask = &cam_imask;
|
||||
break;
|
||||
case DRIVER_TYPE_MISC:
|
||||
mask = 0;
|
||||
break;
|
||||
default:
|
||||
panic("still using grody create_intr interface");
|
||||
}
|
||||
|
||||
/*
|
||||
* We depend here on rman_activate_resource() being idempotent.
|
||||
*/
|
||||
error = rman_activate_resource(irq);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
*cookiep = intr_create((void *)(intptr_t)-1, irq->r_start, ihand, arg,
|
||||
mask, icflags);
|
||||
if (*cookiep)
|
||||
error = intr_connect(*cookiep);
|
||||
else
|
||||
error = EINVAL; /* XXX ??? */
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
|
||||
{
|
||||
return (intr_destroy(ih));
|
||||
}
|
||||
|
||||
static devclass_t pcib_devclass;
|
||||
|
||||
static int
|
||||
nexus_pcib_probe(device_t dev)
|
||||
{
|
||||
device_set_desc(dev, "PCI host bus adapter");
|
||||
|
||||
device_add_child(dev, "pci", 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static device_method_t nexus_pcib_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, nexus_pcib_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t nexus_pcib_driver = {
|
||||
"pcib",
|
||||
nexus_pcib_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1,
|
||||
};
|
||||
|
||||
DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0);
|
|
@ -11,7 +11,7 @@
|
|||
# device lines is present in the ./LINT configuration file. If you are
|
||||
# in doubt as to the purpose or necessity of a line, check first in LINT.
|
||||
#
|
||||
# $Id: GENERIC,v 1.160 1999/04/16 16:17:05 n_hibma Exp $
|
||||
# $Id: GENERIC,v 1.161 1999/04/16 18:27:18 jkh Exp $
|
||||
|
||||
machine "i386"
|
||||
cpu "I386_CPU"
|
||||
|
@ -53,10 +53,10 @@ config kernel root on wd0
|
|||
#options NAPIC=1 # number of IO APICs
|
||||
#options NINTR=24 # number of INTs
|
||||
|
||||
controller isa0
|
||||
controller pnp0 # PnP support for ISA
|
||||
controller eisa0
|
||||
controller pci0
|
||||
controller isa0 at nexus?
|
||||
#controller pnp0 # PnP support for ISA
|
||||
#controller eisa0
|
||||
controller pci0 at nexus?
|
||||
|
||||
controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2
|
||||
disk fd0 at fdc0 drive 0
|
||||
|
@ -108,9 +108,9 @@ controller matcd0 at isa? port 0x230 bio
|
|||
device scd0 at isa? port 0x230 bio
|
||||
|
||||
# atkbdc0 controlls both the keyboard and the PS/2 mouse
|
||||
controller atkbdc0 at isa? port IO_KBD tty
|
||||
device atkbd0 at isa? tty irq 1
|
||||
device psm0 at isa? tty irq 12
|
||||
controller atkbdc0 at isa? port IO_KBD
|
||||
device atkbd0 at atkbdc? tty irq 1
|
||||
device psm0 at atkbdc? tty irq 12
|
||||
|
||||
device vga0 at isa? port ? conflicts
|
||||
|
||||
|
@ -126,12 +126,12 @@ device sc0 at isa? tty
|
|||
# If you have a ThinkPAD, uncomment this along with the rest of the PCVT lines
|
||||
#options PCVT_SCANSET=2 # IBM keyboards are non-std
|
||||
|
||||
device npx0 at isa? port IO_NPX irq 13
|
||||
device npx0 at nexus? port IO_NPX irq 13
|
||||
|
||||
#
|
||||
# Laptop support (see LINT for more options)
|
||||
#
|
||||
device apm0 at isa? disable flags 0x31 # Advanced Power Management
|
||||
device apm0 at nexus? disable flags 0x31 # Advanced Power Management
|
||||
|
||||
# PCCARD (PCMCIA) support
|
||||
#controller card0
|
||||
|
@ -178,8 +178,8 @@ device ex0 at isa? port? net irq?
|
|||
device fe0 at isa? port 0x300 net irq ?
|
||||
device le0 at isa? port 0x300 net irq 5 iomem 0xd0000
|
||||
device lnc0 at isa? port 0x280 net irq 10 drq 0
|
||||
device ze0 at isa? port 0x300 net irq 10 iomem 0xd8000
|
||||
device zp0 at isa? port 0x300 net irq 10 iomem 0xd8000
|
||||
#device ze0 at isa? port 0x300 net irq 10 iomem 0xd8000
|
||||
#device zp0 at isa? port 0x300 net irq 10 iomem 0xd8000
|
||||
device cs0 at isa? port 0x300 net irq ?
|
||||
|
||||
pseudo-device loop
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
|
||||
* $Id: intr_machdep.c,v 1.16 1999/01/08 19:17:48 bde Exp $
|
||||
* $Id: intr_machdep.c,v 1.17 1999/04/14 14:26:36 bde Exp $
|
||||
*/
|
||||
|
||||
#include "opt_auto_eoi.h"
|
||||
|
@ -328,6 +328,7 @@ isa_get_nameunit(int id)
|
|||
return ("clk0"); /* XXX may also be sloppy driver */
|
||||
if (id == 1)
|
||||
return ("rtc0");
|
||||
#if 0
|
||||
for (dp = isa_devtab_bio; dp->id_driver != NULL; dp++)
|
||||
if (dp->id_id == id)
|
||||
goto found_device;
|
||||
|
@ -343,6 +344,7 @@ isa_get_nameunit(int id)
|
|||
for (dp = isa_devtab_tty; dp->id_driver != NULL; dp++)
|
||||
if (dp->id_id == id)
|
||||
goto found_device;
|
||||
#endif
|
||||
return "???";
|
||||
|
||||
found_device:
|
||||
|
|
1514
sys/amd64/isa/isa.c
1514
sys/amd64/isa/isa.c
File diff suppressed because it is too large
Load diff
510
sys/amd64/isa/isa_dma.c
Normal file
510
sys/amd64/isa/isa_dma.c
Normal file
|
@ -0,0 +1,510 @@
|
|||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* William Jolitz.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
|
||||
* $Id: isa.c,v 1.117 1998/11/29 15:42:40 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* code to manage AT bus
|
||||
*
|
||||
* 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com):
|
||||
* Fixed uninitialized variable problem and added code to deal
|
||||
* with DMA page boundaries in isa_dmarangecheck(). Fixed word
|
||||
* mode DMA count compution and reorganized DMA setup code in
|
||||
* isa_dmastart()
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <machine/ipl.h>
|
||||
#include <machine/md_var.h>
|
||||
#ifdef APIC_IO
|
||||
#include <machine/smp.h>
|
||||
#endif /* APIC_IO */
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_param.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <i386/isa/intr_machdep.h>
|
||||
#include <i386/isa/isa.h>
|
||||
#include <i386/isa/ic/i8237.h>
|
||||
|
||||
#include <sys/interrupt.h>
|
||||
|
||||
#include "pnp.h"
|
||||
#if NPNP > 0
|
||||
#include <i386/isa/pnp.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Register definitions for DMA controller 1 (channels 0..3):
|
||||
*/
|
||||
#define DMA1_CHN(c) (IO_DMA1 + 1*(2*(c))) /* addr reg for channel c */
|
||||
#define DMA1_SMSK (IO_DMA1 + 1*10) /* single mask register */
|
||||
#define DMA1_MODE (IO_DMA1 + 1*11) /* mode register */
|
||||
#define DMA1_FFC (IO_DMA1 + 1*12) /* clear first/last FF */
|
||||
|
||||
/*
|
||||
** Register definitions for DMA controller 2 (channels 4..7):
|
||||
*/
|
||||
#define DMA2_CHN(c) (IO_DMA2 + 2*(2*(c))) /* addr reg for channel c */
|
||||
#define DMA2_SMSK (IO_DMA2 + 2*10) /* single mask register */
|
||||
#define DMA2_MODE (IO_DMA2 + 2*11) /* mode register */
|
||||
#define DMA2_FFC (IO_DMA2 + 2*12) /* clear first/last FF */
|
||||
|
||||
static int isa_dmarangecheck __P((caddr_t va, u_int length, int chan));
|
||||
|
||||
static caddr_t dma_bouncebuf[8];
|
||||
static u_int dma_bouncebufsize[8];
|
||||
static u_int8_t dma_bounced = 0;
|
||||
static u_int8_t dma_busy = 0; /* Used in isa_dmastart() */
|
||||
static u_int8_t dma_inuse = 0; /* User for acquire/release */
|
||||
static u_int8_t dma_auto_mode = 0;
|
||||
|
||||
#define VALID_DMA_MASK (7)
|
||||
|
||||
/* high byte of address is stored in this port for i-th dma channel */
|
||||
static int dmapageport[8] = { 0x87, 0x83, 0x81, 0x82, 0x8f, 0x8b, 0x89, 0x8a };
|
||||
|
||||
/*
|
||||
* Setup a DMA channel's bounce buffer.
|
||||
*/
|
||||
void
|
||||
isa_dmainit(chan, bouncebufsize)
|
||||
int chan;
|
||||
u_int bouncebufsize;
|
||||
{
|
||||
void *buf;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dmainit: channel out of range");
|
||||
|
||||
if (dma_bouncebuf[chan] != NULL)
|
||||
panic("isa_dmainit: impossible request");
|
||||
#endif
|
||||
|
||||
dma_bouncebufsize[chan] = bouncebufsize;
|
||||
|
||||
/* Try malloc() first. It works better if it works. */
|
||||
buf = malloc(bouncebufsize, M_DEVBUF, M_NOWAIT);
|
||||
if (buf != NULL) {
|
||||
if (isa_dmarangecheck(buf, bouncebufsize, chan) == 0) {
|
||||
dma_bouncebuf[chan] = buf;
|
||||
return;
|
||||
}
|
||||
free(buf, M_DEVBUF);
|
||||
}
|
||||
buf = contigmalloc(bouncebufsize, M_DEVBUF, M_NOWAIT, 0ul, 0xfffffful,
|
||||
1ul, chan & 4 ? 0x20000ul : 0x10000ul);
|
||||
if (buf == NULL)
|
||||
printf("isa_dmainit(%d, %d) failed\n", chan, bouncebufsize);
|
||||
else
|
||||
dma_bouncebuf[chan] = buf;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register a DMA channel's usage. Usually called from a device driver
|
||||
* in open() or during its initialization.
|
||||
*/
|
||||
int
|
||||
isa_dma_acquire(chan)
|
||||
int chan;
|
||||
{
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dma_acquire: channel out of range");
|
||||
#endif
|
||||
|
||||
if (dma_inuse & (1 << chan)) {
|
||||
printf("isa_dma_acquire: channel %d already in use\n", chan);
|
||||
return (EBUSY);
|
||||
}
|
||||
dma_inuse |= (1 << chan);
|
||||
dma_auto_mode &= ~(1 << chan);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Unregister a DMA channel's usage. Usually called from a device driver
|
||||
* during close() or during its shutdown.
|
||||
*/
|
||||
void
|
||||
isa_dma_release(chan)
|
||||
int chan;
|
||||
{
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dma_release: channel out of range");
|
||||
|
||||
if ((dma_inuse & (1 << chan)) == 0)
|
||||
printf("isa_dma_release: channel %d not in use\n", chan);
|
||||
#endif
|
||||
|
||||
if (dma_busy & (1 << chan)) {
|
||||
dma_busy &= ~(1 << chan);
|
||||
/*
|
||||
* XXX We should also do "dma_bounced &= (1 << chan);"
|
||||
* because we are acting on behalf of isa_dmadone() which
|
||||
* was not called to end the last DMA operation. This does
|
||||
* not matter now, but it may in the future.
|
||||
*/
|
||||
}
|
||||
|
||||
dma_inuse &= ~(1 << chan);
|
||||
dma_auto_mode &= ~(1 << chan);
|
||||
}
|
||||
|
||||
/*
|
||||
* isa_dmacascade(): program 8237 DMA controller channel to accept
|
||||
* external dma control by a board.
|
||||
*/
|
||||
void
|
||||
isa_dmacascade(chan)
|
||||
int chan;
|
||||
{
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dmacascade: channel out of range");
|
||||
#endif
|
||||
|
||||
/* set dma channel mode, and set dma channel mode */
|
||||
if ((chan & 4) == 0) {
|
||||
outb(DMA1_MODE, DMA37MD_CASCADE | chan);
|
||||
outb(DMA1_SMSK, chan);
|
||||
} else {
|
||||
outb(DMA2_MODE, DMA37MD_CASCADE | (chan & 3));
|
||||
outb(DMA2_SMSK, chan & 3);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* isa_dmastart(): program 8237 DMA controller channel, avoid page alignment
|
||||
* problems by using a bounce buffer.
|
||||
*/
|
||||
void
|
||||
isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan)
|
||||
{
|
||||
vm_offset_t phys;
|
||||
int waport;
|
||||
caddr_t newaddr;
|
||||
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dmastart: channel out of range");
|
||||
|
||||
if ((chan < 4 && nbytes > (1<<16))
|
||||
|| (chan >= 4 && (nbytes > (1<<17) || (u_int)addr & 1)))
|
||||
panic("isa_dmastart: impossible request");
|
||||
|
||||
if ((dma_inuse & (1 << chan)) == 0)
|
||||
printf("isa_dmastart: channel %d not acquired\n", chan);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/*
|
||||
* XXX This should be checked, but drivers like ad1848 only call
|
||||
* isa_dmastart() once because they use Auto DMA mode. If we
|
||||
* leave this in, drivers that do this will print this continuously.
|
||||
*/
|
||||
if (dma_busy & (1 << chan))
|
||||
printf("isa_dmastart: channel %d busy\n", chan);
|
||||
#endif
|
||||
|
||||
dma_busy |= (1 << chan);
|
||||
|
||||
if (isa_dmarangecheck(addr, nbytes, chan)) {
|
||||
if (dma_bouncebuf[chan] == NULL
|
||||
|| dma_bouncebufsize[chan] < nbytes)
|
||||
panic("isa_dmastart: bad bounce buffer");
|
||||
dma_bounced |= (1 << chan);
|
||||
newaddr = dma_bouncebuf[chan];
|
||||
|
||||
/* copy bounce buffer on write */
|
||||
if (!(flags & B_READ))
|
||||
bcopy(addr, newaddr, nbytes);
|
||||
addr = newaddr;
|
||||
}
|
||||
|
||||
/* translate to physical */
|
||||
phys = pmap_extract(pmap_kernel(), (vm_offset_t)addr);
|
||||
|
||||
if (flags & B_RAW) {
|
||||
dma_auto_mode |= (1 << chan);
|
||||
} else {
|
||||
dma_auto_mode &= ~(1 << chan);
|
||||
}
|
||||
|
||||
if ((chan & 4) == 0) {
|
||||
/*
|
||||
* Program one of DMA channels 0..3. These are
|
||||
* byte mode channels.
|
||||
*/
|
||||
/* set dma channel mode, and reset address ff */
|
||||
|
||||
/* If B_RAW flag is set, then use autoinitialise mode */
|
||||
if (flags & B_RAW) {
|
||||
if (flags & B_READ)
|
||||
outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_WRITE|chan);
|
||||
else
|
||||
outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_READ|chan);
|
||||
}
|
||||
else
|
||||
if (flags & B_READ)
|
||||
outb(DMA1_MODE, DMA37MD_SINGLE|DMA37MD_WRITE|chan);
|
||||
else
|
||||
outb(DMA1_MODE, DMA37MD_SINGLE|DMA37MD_READ|chan);
|
||||
outb(DMA1_FFC, 0);
|
||||
|
||||
/* send start address */
|
||||
waport = DMA1_CHN(chan);
|
||||
outb(waport, phys);
|
||||
outb(waport, phys>>8);
|
||||
outb(dmapageport[chan], phys>>16);
|
||||
|
||||
/* send count */
|
||||
outb(waport + 1, --nbytes);
|
||||
outb(waport + 1, nbytes>>8);
|
||||
|
||||
/* unmask channel */
|
||||
outb(DMA1_SMSK, chan);
|
||||
} else {
|
||||
/*
|
||||
* Program one of DMA channels 4..7. These are
|
||||
* word mode channels.
|
||||
*/
|
||||
/* set dma channel mode, and reset address ff */
|
||||
|
||||
/* If B_RAW flag is set, then use autoinitialise mode */
|
||||
if (flags & B_RAW) {
|
||||
if (flags & B_READ)
|
||||
outb(DMA2_MODE, DMA37MD_AUTO|DMA37MD_WRITE|(chan&3));
|
||||
else
|
||||
outb(DMA2_MODE, DMA37MD_AUTO|DMA37MD_READ|(chan&3));
|
||||
}
|
||||
else
|
||||
if (flags & B_READ)
|
||||
outb(DMA2_MODE, DMA37MD_SINGLE|DMA37MD_WRITE|(chan&3));
|
||||
else
|
||||
outb(DMA2_MODE, DMA37MD_SINGLE|DMA37MD_READ|(chan&3));
|
||||
outb(DMA2_FFC, 0);
|
||||
|
||||
/* send start address */
|
||||
waport = DMA2_CHN(chan - 4);
|
||||
outb(waport, phys>>1);
|
||||
outb(waport, phys>>9);
|
||||
outb(dmapageport[chan], phys>>16);
|
||||
|
||||
/* send count */
|
||||
nbytes >>= 1;
|
||||
outb(waport + 2, --nbytes);
|
||||
outb(waport + 2, nbytes>>8);
|
||||
|
||||
/* unmask channel */
|
||||
outb(DMA2_SMSK, chan & 3);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
isa_dmadone(int flags, caddr_t addr, int nbytes, int chan)
|
||||
{
|
||||
#ifdef DIAGNOSTIC
|
||||
if (chan & ~VALID_DMA_MASK)
|
||||
panic("isa_dmadone: channel out of range");
|
||||
|
||||
if ((dma_inuse & (1 << chan)) == 0)
|
||||
printf("isa_dmadone: channel %d not acquired\n", chan);
|
||||
#endif
|
||||
|
||||
if (((dma_busy & (1 << chan)) == 0) &&
|
||||
(dma_auto_mode & (1 << chan)) == 0 )
|
||||
printf("isa_dmadone: channel %d not busy\n", chan);
|
||||
|
||||
if ((dma_auto_mode & (1 << chan)) == 0)
|
||||
outb(chan & 4 ? DMA2_SMSK : DMA1_SMSK, (chan & 3) | 4);
|
||||
|
||||
if (dma_bounced & (1 << chan)) {
|
||||
/* copy bounce buffer on read */
|
||||
if (flags & B_READ)
|
||||
bcopy(dma_bouncebuf[chan], addr, nbytes);
|
||||
|
||||
dma_bounced &= ~(1 << chan);
|
||||
}
|
||||
dma_busy &= ~(1 << chan);
|
||||
}
|
||||
|
||||
/*
|
||||
* Check for problems with the address range of a DMA transfer
|
||||
* (non-contiguous physical pages, outside of bus address space,
|
||||
* crossing DMA page boundaries).
|
||||
* Return true if special handling needed.
|
||||
*/
|
||||
|
||||
static int
|
||||
isa_dmarangecheck(caddr_t va, u_int length, int chan)
|
||||
{
|
||||
vm_offset_t phys, priorpage = 0, endva;
|
||||
u_int dma_pgmsk = (chan & 4) ? ~(128*1024-1) : ~(64*1024-1);
|
||||
|
||||
endva = (vm_offset_t)round_page((vm_offset_t)va + length);
|
||||
for (; va < (caddr_t) endva ; va += PAGE_SIZE) {
|
||||
phys = trunc_page(pmap_extract(pmap_kernel(), (vm_offset_t)va));
|
||||
#define ISARAM_END RAM_END
|
||||
if (phys == 0)
|
||||
panic("isa_dmacheck: no physical page present");
|
||||
if (phys >= ISARAM_END)
|
||||
return (1);
|
||||
if (priorpage) {
|
||||
if (priorpage + PAGE_SIZE != phys)
|
||||
return (1);
|
||||
/* check if crossing a DMA page boundary */
|
||||
if (((u_int)priorpage ^ (u_int)phys) & dma_pgmsk)
|
||||
return (1);
|
||||
}
|
||||
priorpage = phys;
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
||||
/*
|
||||
* Query the progress of a transfer on a DMA channel.
|
||||
*
|
||||
* To avoid having to interrupt a transfer in progress, we sample
|
||||
* each of the high and low databytes twice, and apply the following
|
||||
* logic to determine the correct count.
|
||||
*
|
||||
* Reads are performed with interrupts disabled, thus it is to be
|
||||
* expected that the time between reads is very small. At most
|
||||
* one rollover in the low count byte can be expected within the
|
||||
* four reads that are performed.
|
||||
*
|
||||
* There are three gaps in which a rollover can occur :
|
||||
*
|
||||
* - read low1
|
||||
* gap1
|
||||
* - read high1
|
||||
* gap2
|
||||
* - read low2
|
||||
* gap3
|
||||
* - read high2
|
||||
*
|
||||
* If a rollover occurs in gap1 or gap2, the low2 value will be
|
||||
* greater than the low1 value. In this case, low2 and high2 are a
|
||||
* corresponding pair.
|
||||
*
|
||||
* In any other case, low1 and high1 can be considered to be correct.
|
||||
*
|
||||
* The function returns the number of bytes remaining in the transfer,
|
||||
* or -1 if the channel requested is not active.
|
||||
*
|
||||
*/
|
||||
int
|
||||
isa_dmastatus(int chan)
|
||||
{
|
||||
u_long cnt = 0;
|
||||
int ffport, waport;
|
||||
u_long low1, high1, low2, high2;
|
||||
|
||||
/* channel active? */
|
||||
if ((dma_inuse & (1 << chan)) == 0) {
|
||||
printf("isa_dmastatus: channel %d not active\n", chan);
|
||||
return(-1);
|
||||
}
|
||||
/* channel busy? */
|
||||
|
||||
if (((dma_busy & (1 << chan)) == 0) &&
|
||||
(dma_auto_mode & (1 << chan)) == 0 ) {
|
||||
printf("chan %d not busy\n", chan);
|
||||
return -2 ;
|
||||
}
|
||||
if (chan < 4) { /* low DMA controller */
|
||||
ffport = DMA1_FFC;
|
||||
waport = DMA1_CHN(chan) + 1;
|
||||
} else { /* high DMA controller */
|
||||
ffport = DMA2_FFC;
|
||||
waport = DMA2_CHN(chan - 4) + 2;
|
||||
}
|
||||
|
||||
disable_intr(); /* no interrupts Mr Jones! */
|
||||
outb(ffport, 0); /* clear register LSB flipflop */
|
||||
low1 = inb(waport);
|
||||
high1 = inb(waport);
|
||||
outb(ffport, 0); /* clear again */
|
||||
low2 = inb(waport);
|
||||
high2 = inb(waport);
|
||||
enable_intr(); /* enable interrupts again */
|
||||
|
||||
/*
|
||||
* Now decide if a wrap has tried to skew our results.
|
||||
* Note that after TC, the count will read 0xffff, while we want
|
||||
* to return zero, so we add and then mask to compensate.
|
||||
*/
|
||||
if (low1 >= low2) {
|
||||
cnt = (low1 + (high1 << 8) + 1) & 0xffff;
|
||||
} else {
|
||||
cnt = (low2 + (high2 << 8) + 1) & 0xffff;
|
||||
}
|
||||
|
||||
if (chan >= 4) /* high channels move words */
|
||||
cnt *= 2;
|
||||
return(cnt);
|
||||
}
|
||||
|
||||
/*
|
||||
* Stop a DMA transfer currently in progress.
|
||||
*/
|
||||
int
|
||||
isa_dmastop(int chan)
|
||||
{
|
||||
if ((dma_inuse & (1 << chan)) == 0)
|
||||
printf("isa_dmastop: channel %d not acquired\n", chan);
|
||||
|
||||
if (((dma_busy & (1 << chan)) == 0) &&
|
||||
((dma_auto_mode & (1 << chan)) == 0)) {
|
||||
printf("chan %d not busy\n", chan);
|
||||
return -2 ;
|
||||
}
|
||||
|
||||
if ((chan & 4) == 0) {
|
||||
outb(DMA1_SMSK, (chan & 3) | 4 /* disable mask */);
|
||||
} else {
|
||||
outb(DMA2_SMSK, (chan & 3) | 4 /* disable mask */);
|
||||
}
|
||||
return(isa_dmastatus(chan));
|
||||
}
|
51
sys/amd64/isa/isa_dma.h
Normal file
51
sys/amd64/isa/isa_dma.h
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*-
|
||||
* Copyright (c) 1991 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)isa_device.h 7.1 (Berkeley) 5/9/91
|
||||
* $Id: isa_device.h,v 1.57 1999/01/17 06:33:43 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_ISA_DMA_H_
|
||||
#define _I386_ISA_ISA_DMA_H_
|
||||
|
||||
#ifdef KERNEL
|
||||
void isa_dmacascade __P((int chan));
|
||||
void isa_dmadone __P((int flags, caddr_t addr, int nbytes, int chan));
|
||||
void isa_dmainit __P((int chan, u_int bouncebufsize));
|
||||
void isa_dmastart __P((int flags, caddr_t addr, u_int nbytes, int chan));
|
||||
int isa_dma_acquire __P((int chan));
|
||||
void isa_dma_release __P((int chan));
|
||||
int isa_dmastatus __P((int chan));
|
||||
int isa_dmastop __P((int chan));
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* !_I386_ISA_ISA_DMA_H_ */
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)isa.c 7.2 (Berkeley) 5/13/91
|
||||
* $Id: intr_machdep.c,v 1.16 1999/01/08 19:17:48 bde Exp $
|
||||
* $Id: intr_machdep.c,v 1.17 1999/04/14 14:26:36 bde Exp $
|
||||
*/
|
||||
|
||||
#include "opt_auto_eoi.h"
|
||||
|
@ -328,6 +328,7 @@ isa_get_nameunit(int id)
|
|||
return ("clk0"); /* XXX may also be sloppy driver */
|
||||
if (id == 1)
|
||||
return ("rtc0");
|
||||
#if 0
|
||||
for (dp = isa_devtab_bio; dp->id_driver != NULL; dp++)
|
||||
if (dp->id_id == id)
|
||||
goto found_device;
|
||||
|
@ -343,6 +344,7 @@ isa_get_nameunit(int id)
|
|||
for (dp = isa_devtab_tty; dp->id_driver != NULL; dp++)
|
||||
if (dp->id_id == id)
|
||||
goto found_device;
|
||||
#endif
|
||||
return "???";
|
||||
|
||||
found_device:
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)npx.c 7.2 (Berkeley) 5/12/91
|
||||
* $Id: npx.c,v 1.65 1999/01/08 16:29:59 bde Exp $
|
||||
* $Id: npx.c,v 1.66 1999/03/28 23:28:18 dt Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
|
@ -43,10 +43,14 @@
|
|||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/proc.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#ifdef NPX_DEBUG
|
||||
#include <sys/syslog.h>
|
||||
#endif
|
||||
|
@ -64,6 +68,7 @@
|
|||
#ifndef SMP
|
||||
#include <machine/clock.h>
|
||||
#endif
|
||||
#include <machine/resource.h>
|
||||
#include <machine/specialreg.h>
|
||||
#include <machine/segments.h>
|
||||
|
||||
|
@ -72,7 +77,6 @@
|
|||
#include <i386/isa/intr_machdep.h>
|
||||
#include <i386/isa/isa.h>
|
||||
#endif
|
||||
#include <i386/isa/isa_device.h>
|
||||
|
||||
/*
|
||||
* 387 and 287 Numeric Coprocessor Extension (NPX) Driver.
|
||||
|
@ -83,9 +87,6 @@
|
|||
#define NPX_DISABLE_I586_OPTIMIZED_BZERO (1 << 1)
|
||||
#define NPX_DISABLE_I586_OPTIMIZED_COPYIO (1 << 2)
|
||||
|
||||
/* XXX - should be in header file. */
|
||||
ointhand2_t npxintr;
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#define fldcw(addr) __asm("fldcw %0" : : "m" (*(addr)))
|
||||
|
@ -119,18 +120,15 @@ void stop_emulating __P((void));
|
|||
|
||||
typedef u_char bool_t;
|
||||
|
||||
static int npxattach __P((struct isa_device *dvp));
|
||||
static int npxprobe __P((struct isa_device *dvp));
|
||||
static int npxprobe1 __P((struct isa_device *dvp));
|
||||
static int npx_attach __P((device_t dev));
|
||||
void npx_intr __P((void *));
|
||||
static int npx_probe __P((device_t dev));
|
||||
static int npx_probe1 __P((device_t dev));
|
||||
#ifdef I586_CPU
|
||||
static long timezero __P((const char *funcname,
|
||||
void (*func)(void *buf, size_t len)));
|
||||
#endif /* I586_CPU */
|
||||
|
||||
struct isa_driver npxdriver = {
|
||||
npxprobe, npxattach, "npx",
|
||||
};
|
||||
|
||||
int hw_float; /* XXX currently just alias for npx_exists */
|
||||
|
||||
SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint,
|
||||
|
@ -191,12 +189,13 @@ __asm(" \n\
|
|||
* need to use interrupts. Return 1 if device exists.
|
||||
*/
|
||||
static int
|
||||
npxprobe(dvp)
|
||||
struct isa_device *dvp;
|
||||
npx_probe(dev)
|
||||
device_t dev;
|
||||
{
|
||||
#ifdef SMP
|
||||
/*#ifdef SMP*/
|
||||
#if 1
|
||||
|
||||
return npxprobe1(dvp);
|
||||
return npx_probe1(dev);
|
||||
|
||||
#else /* SMP */
|
||||
|
||||
|
@ -213,20 +212,20 @@ npxprobe(dvp)
|
|||
* install suitable handlers and run with interrupts enabled so we
|
||||
* won't need to do so much here.
|
||||
*/
|
||||
npx_intrno = NRSVIDT + ffs(dvp->id_irq) - 1;
|
||||
npx_intrno = NRSVIDT + 13;
|
||||
save_eflags = read_eflags();
|
||||
disable_intr();
|
||||
save_icu1_mask = inb(IO_ICU1 + 1);
|
||||
save_icu2_mask = inb(IO_ICU2 + 1);
|
||||
save_idt_npxintr = idt[npx_intrno];
|
||||
save_idt_npxtrap = idt[16];
|
||||
outb(IO_ICU1 + 1, ~(IRQ_SLAVE | dvp->id_irq));
|
||||
outb(IO_ICU2 + 1, ~(dvp->id_irq >> 8));
|
||||
outb(IO_ICU1 + 1, ~IRQ_SLAVE);
|
||||
outb(IO_ICU2 + 1, ~(1 << (13 - 8)));
|
||||
setidt(16, probetrap, SDT_SYS386TGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
|
||||
setidt(npx_intrno, probeintr, SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL));
|
||||
npx_idt_probeintr = idt[npx_intrno];
|
||||
enable_intr();
|
||||
result = npxprobe1(dvp);
|
||||
result = npx_probe1(dev);
|
||||
disable_intr();
|
||||
outb(IO_ICU1 + 1, save_icu1_mask);
|
||||
outb(IO_ICU2 + 1, save_icu2_mask);
|
||||
|
@ -239,8 +238,8 @@ npxprobe(dvp)
|
|||
}
|
||||
|
||||
static int
|
||||
npxprobe1(dvp)
|
||||
struct isa_device *dvp;
|
||||
npx_probe1(dev)
|
||||
device_t dev;
|
||||
{
|
||||
#ifndef SMP
|
||||
u_short control;
|
||||
|
@ -280,21 +279,18 @@ npxprobe1(dvp)
|
|||
*/
|
||||
fninit();
|
||||
|
||||
#ifdef SMP
|
||||
|
||||
/*#ifdef SMP*/
|
||||
#if 1
|
||||
/*
|
||||
* Exception 16 MUST work for SMP.
|
||||
*/
|
||||
npx_irq13 = 0;
|
||||
npx_ex16 = hw_float = npx_exists = 1;
|
||||
dvp->id_irq = 0; /* zap the interrupt */
|
||||
/*
|
||||
* special return value to flag that we do not
|
||||
* actually use any I/O registers
|
||||
*/
|
||||
return (-1);
|
||||
device_set_desc(dev, "math processor");
|
||||
return (0);
|
||||
|
||||
#else /* SMP */
|
||||
#else /* !SMP */
|
||||
device_set_desc(dev, "math processor");
|
||||
|
||||
/*
|
||||
* Don't use fwait here because it might hang.
|
||||
|
@ -335,14 +331,12 @@ npxprobe1(dvp)
|
|||
* Good, exception 16 works.
|
||||
*/
|
||||
npx_ex16 = 1;
|
||||
dvp->id_irq = 0; /* zap the interrupt */
|
||||
/*
|
||||
* special return value to flag that we do not
|
||||
* actually use any I/O registers
|
||||
*/
|
||||
return (-1);
|
||||
return (0);
|
||||
}
|
||||
if (npx_intrs_while_probing != 0) {
|
||||
int rid;
|
||||
struct resource *r;
|
||||
void *intr;
|
||||
/*
|
||||
* Bad, we are stuck with IRQ13.
|
||||
*/
|
||||
|
@ -350,8 +344,30 @@ npxprobe1(dvp)
|
|||
/*
|
||||
* npxattach would be too late to set npx0_imask.
|
||||
*/
|
||||
npx0_imask |= dvp->id_irq;
|
||||
return (IO_NPXSIZE);
|
||||
npx0_imask |= (1 << 13);
|
||||
|
||||
/*
|
||||
* We allocate these resources permanently,
|
||||
* so there is no need to keep track of them.
|
||||
*/
|
||||
rid = 0;
|
||||
r = bus_alloc_resource(dev, SYS_RES_IOPORT,
|
||||
&rid, IO_NPX, IO_NPX,
|
||||
IO_NPXSIZE, RF_ACTIVE);
|
||||
if (r == 0)
|
||||
panic("npx: can't get ports");
|
||||
rid = 0;
|
||||
r = bus_alloc_resource(dev, SYS_RES_IRQ,
|
||||
&rid, 13, 13,
|
||||
1, RF_ACTIVE);
|
||||
if (r == 0)
|
||||
panic("npx: can't get IRQ");
|
||||
BUS_SETUP_INTR(device_get_parent(dev),
|
||||
dev, r, npx_intr, 0, &intr);
|
||||
if (intr == 0)
|
||||
panic("npx: can't create intr");
|
||||
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
* Worse, even IRQ13 is broken. Use emulator.
|
||||
|
@ -363,13 +379,7 @@ npxprobe1(dvp)
|
|||
* emulator and say that it has been installed. XXX handle devices
|
||||
* that aren't really devices better.
|
||||
*/
|
||||
dvp->id_irq = 0;
|
||||
/*
|
||||
* special return value to flag that we do not
|
||||
* actually use any I/O registers
|
||||
*/
|
||||
return (-1);
|
||||
|
||||
return (0);
|
||||
#endif /* SMP */
|
||||
}
|
||||
|
||||
|
@ -377,14 +387,15 @@ npxprobe1(dvp)
|
|||
* Attach routine - announce which it is, and wire into system
|
||||
*/
|
||||
int
|
||||
npxattach(dvp)
|
||||
struct isa_device *dvp;
|
||||
npx_attach(dev)
|
||||
device_t dev;
|
||||
{
|
||||
dvp->id_ointr = npxintr;
|
||||
int flags;
|
||||
|
||||
/* The caller has printed "irq 13" for the npx_irq13 case. */
|
||||
if (!npx_irq13) {
|
||||
printf("npx%d: ", dvp->id_unit);
|
||||
device_print_prettyname(dev);
|
||||
if (npx_irq13) {
|
||||
printf("using IRQ 13 interface\n");
|
||||
} else {
|
||||
if (npx_ex16)
|
||||
printf("INT 16 interface\n");
|
||||
#if defined(MATH_EMULATE) || defined(GPL_MATH_EMULATE)
|
||||
|
@ -401,23 +412,26 @@ npxattach(dvp)
|
|||
npxinit(__INITIAL_NPXCW__);
|
||||
|
||||
#ifdef I586_CPU
|
||||
if (resource_int_value("npx", 0, "flags", &flags) != 0)
|
||||
flags = 0;
|
||||
|
||||
if (cpu_class == CPUCLASS_586 && npx_ex16 &&
|
||||
timezero("i586_bzero()", i586_bzero) <
|
||||
timezero("bzero()", bzero) * 4 / 5) {
|
||||
if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) {
|
||||
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BCOPY)) {
|
||||
bcopy_vector = i586_bcopy;
|
||||
ovbcopy_vector = i586_bcopy;
|
||||
}
|
||||
if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_BZERO))
|
||||
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_BZERO))
|
||||
bzero = i586_bzero;
|
||||
if (!(dvp->id_flags & NPX_DISABLE_I586_OPTIMIZED_COPYIO)) {
|
||||
if (!(flags & NPX_DISABLE_I586_OPTIMIZED_COPYIO)) {
|
||||
copyin_vector = i586_copyin;
|
||||
copyout_vector = i586_copyout;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return (1); /* XXX unused */
|
||||
return (0); /* XXX unused */
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -494,8 +508,8 @@ npxexit(p)
|
|||
* solution for signals other than SIGFPE.
|
||||
*/
|
||||
void
|
||||
npxintr(unit)
|
||||
int unit;
|
||||
npx_intr(dummy)
|
||||
void *dummy;
|
||||
{
|
||||
int code;
|
||||
struct intrframe *frame;
|
||||
|
@ -518,7 +532,7 @@ npxintr(unit)
|
|||
/*
|
||||
* Pass exception to process.
|
||||
*/
|
||||
frame = (struct intrframe *)&unit; /* XXX */
|
||||
frame = (struct intrframe *)&dummy; /* XXX */
|
||||
if ((ISPL(frame->if_cs) == SEL_UPL) || (frame->if_eflags & PSL_VM)) {
|
||||
/*
|
||||
* Interrupt is essentially a trap, so we can afford to call
|
||||
|
@ -686,4 +700,31 @@ timezero(funcname, func)
|
|||
}
|
||||
#endif /* I586_CPU */
|
||||
|
||||
static device_method_t npx_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, npx_probe),
|
||||
DEVMETHOD(device_attach, npx_attach),
|
||||
DEVMETHOD(device_detach, bus_generic_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
DEVMETHOD(device_suspend, bus_generic_suspend),
|
||||
DEVMETHOD(device_resume, bus_generic_resume),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t npx_driver = {
|
||||
"npx",
|
||||
npx_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1, /* no softc */
|
||||
};
|
||||
|
||||
static devclass_t npx_devclass;
|
||||
|
||||
/*
|
||||
* We prefer to attach to the root nexus so that the usual case (exception 16)
|
||||
* doesn't describe the processor as being `on isa'.
|
||||
*/
|
||||
DRIVER_MODULE(npx, nexus, npx_driver, npx_devclass, 0, 0);
|
||||
|
||||
#endif /* NNPX > 0 */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Id: boot1.c,v 1.2 1998/09/26 10:51:36 dfr Exp $
|
||||
* $Id: boot1.c,v 1.3 1998/10/18 19:05:07 dfr Exp $
|
||||
* From $NetBSD: bootxx.c,v 1.4 1997/09/06 14:08:29 drochner Exp $
|
||||
*/
|
||||
|
||||
|
@ -49,6 +49,18 @@ putchar(int c)
|
|||
prom_putchar(c);
|
||||
}
|
||||
|
||||
int
|
||||
getchar()
|
||||
{
|
||||
return prom_getchar();
|
||||
}
|
||||
|
||||
int
|
||||
ischar()
|
||||
{
|
||||
return prom_poll();
|
||||
}
|
||||
|
||||
void
|
||||
puts(const char *s)
|
||||
{
|
||||
|
@ -149,10 +161,38 @@ devclose()
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
getfilename(char *filename)
|
||||
{
|
||||
int c;
|
||||
char *p;
|
||||
|
||||
puts("Boot: ");
|
||||
|
||||
while ((c = getchar()) != '\n') {
|
||||
if (c == '\b') {
|
||||
if (p > filename) {
|
||||
puts("\b \b");
|
||||
p--;
|
||||
}
|
||||
} else
|
||||
*p++ = c;
|
||||
}
|
||||
*p = '\0';
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
loadfile(char *name, char *addr)
|
||||
{
|
||||
int n;
|
||||
char filename[512];
|
||||
char *p;
|
||||
|
||||
restart:
|
||||
puts("Loading ");
|
||||
puts(name);
|
||||
puts("\n");
|
||||
|
||||
if (openrd(name)) {
|
||||
puts("Can't open file ");
|
||||
|
@ -161,9 +201,17 @@ loadfile(char *name, char *addr)
|
|||
halt();
|
||||
}
|
||||
|
||||
p = addr;
|
||||
do {
|
||||
n = readit(addr, 1024);
|
||||
addr += n;
|
||||
n = readit(p, 1024);
|
||||
p += n;
|
||||
if (ischar()) {
|
||||
puts("Stop!\n");
|
||||
devclose();
|
||||
getfilename(filename);
|
||||
name = filename;
|
||||
goto restart;
|
||||
}
|
||||
twiddle();
|
||||
} while (n > 0);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id$ */
|
||||
/* $Id: prom.c,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $ */
|
||||
/* $NetBSD: prom.c,v 1.3 1997/09/06 14:03:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -41,7 +41,7 @@ static void prom_probe(struct console *cp);
|
|||
static int prom_init(int);
|
||||
void prom_putchar(int);
|
||||
int prom_getchar(void);
|
||||
static int prom_poll(void);
|
||||
int prom_poll(void);
|
||||
|
||||
struct console promconsole = {
|
||||
"prom",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* $Id: start.S,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $
|
||||
* $Id: start.S,v 1.2 1998/10/31 17:12:32 dfr Exp $
|
||||
* From: $NetBSD: start.S,v 1.4 1998/03/28 00:54:15 cgd Exp $
|
||||
*/
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
|||
.set noreorder /* don't reorder instructions */
|
||||
|
||||
#define ENTRY_FRAME 32
|
||||
#define STACK_SIZE 8192
|
||||
|
||||
NESTED(start, 1, ENTRY_FRAME, ra, 0, 0)
|
||||
br pv,Lstartgp
|
||||
|
@ -57,7 +58,7 @@ Lstartgp:
|
|||
CALL(bzero)
|
||||
|
||||
#if defined(NETBOOT) || defined(LOADER)
|
||||
lda sp,stack + 8192 - ENTRY_FRAME
|
||||
lda sp,stack + STACK_SIZE - ENTRY_FRAME
|
||||
#endif
|
||||
|
||||
CALL(main) /* transfer to C */
|
||||
|
@ -84,5 +85,5 @@ LEAF(cpu_number, 0)
|
|||
END(cpu_number)
|
||||
|
||||
#if defined(NETBOOT) || defined(LOADER)
|
||||
BSS(stack, 8192)
|
||||
BSS(stack, STACK_SIZE)
|
||||
#endif
|
||||
|
|
|
@ -15,6 +15,7 @@ SRCS+= main.c conf.c dev_net.c
|
|||
.include <${.CURDIR}/../../common/Makefile.inc>
|
||||
CFLAGS+= -mno-fp-regs
|
||||
CFLAGS+= -I${.CURDIR}/../../common -I${.CURDIR}
|
||||
CFLAGS+= -I${.CURDIR}/../../.. -I.
|
||||
CFLAGS+= -I${.OBJDIR}
|
||||
CFLAGS+= -DNETBOOT
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bootstrap.h,v 1.19 1999/01/22 23:50:13 msmith Exp $
|
||||
* $Id: bootstrap.h,v 1.20 1999/02/04 17:06:45 dcs Exp $
|
||||
*/
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -214,8 +214,8 @@ extern int elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module
|
|||
/* XXX just for conversion's sake, until we move to the new linker set code */
|
||||
|
||||
#define SET_FOREACH(pvar, set) \
|
||||
for (pvar = set.ls_items; \
|
||||
pvar < set.ls_items + set.ls_length; \
|
||||
for ((char*) pvar = set.ls_items; \
|
||||
(char*) pvar < (char*) &set.ls_items[set.ls_length]; \
|
||||
pvar++)
|
||||
|
||||
#else /* NEW_LINKER_SET */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $Id$ */
|
||||
/* $Id: prom.c,v 1.1.1.1 1998/08/21 03:17:42 msmith Exp $ */
|
||||
/* $NetBSD: prom.c,v 1.3 1997/09/06 14:03:58 drochner Exp $ */
|
||||
|
||||
/*
|
||||
|
@ -41,7 +41,7 @@ static void prom_probe(struct console *cp);
|
|||
static int prom_init(int);
|
||||
void prom_putchar(int);
|
||||
int prom_getchar(void);
|
||||
static int prom_poll(void);
|
||||
int prom_poll(void);
|
||||
|
||||
struct console promconsole = {
|
||||
"prom",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.i386 -- with config changes.
|
||||
# Copyright 1990 W. Jolitz
|
||||
# from: @(#)Makefile.i386 7.1 5/10/91
|
||||
# $Id: Makefile.i386,v 1.144 1999/04/13 18:25:08 peter Exp $
|
||||
# $Id: Makefile.i386,v 1.145 1999/04/15 14:52:23 bde Exp $
|
||||
#
|
||||
# Makefile for FreeBSD
|
||||
#
|
||||
|
@ -17,7 +17,7 @@
|
|||
#
|
||||
|
||||
# Which version of config(8) is required.
|
||||
%VERSREQ= 300012
|
||||
%VERSREQ= 400013
|
||||
|
||||
KERNFORMAT?= elf
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.i386 -- with config changes.
|
||||
# Copyright 1990 W. Jolitz
|
||||
# from: @(#)Makefile.i386 7.1 5/10/91
|
||||
# $Id: Makefile.i386,v 1.144 1999/04/13 18:25:08 peter Exp $
|
||||
# $Id: Makefile.i386,v 1.145 1999/04/15 14:52:23 bde Exp $
|
||||
#
|
||||
# Makefile for FreeBSD
|
||||
#
|
||||
|
@ -17,7 +17,7 @@
|
|||
#
|
||||
|
||||
# Which version of config(8) is required.
|
||||
%VERSREQ= 300012
|
||||
%VERSREQ= 400013
|
||||
|
||||
KERNFORMAT?= elf
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.581 1999/04/14 16:54:00 peter Exp $
|
||||
# $Id: LINT,v 1.582 1999/04/16 16:17:04 n_hibma Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
|
@ -827,7 +827,7 @@ options "MSGBUF_SIZE=40960"
|
|||
#
|
||||
# Mandatory ISA devices: isa, npx
|
||||
#
|
||||
controller isa0
|
||||
controller isa0 at nexus?
|
||||
|
||||
#
|
||||
# Options for `isa':
|
||||
|
@ -888,10 +888,10 @@ options "NTIMECOUNTER=20"
|
|||
controller pnp0
|
||||
|
||||
# The keyboard controller; it controlls the keyboard and the PS/2 mouse.
|
||||
controller atkbdc0 at isa? port IO_KBD tty
|
||||
controller atkbdc0 at isa? port IO_KBD
|
||||
|
||||
# The AT keyboard
|
||||
device atkbd0 at isa? tty irq 1
|
||||
device atkbd0 at atkbdc? tty irq 1
|
||||
|
||||
# Options for atkbd:
|
||||
options ATKBD_DFLT_KEYMAP # specify the built-in keymap
|
||||
|
@ -907,7 +907,7 @@ options KBD_INSTALL_CDEV # install a CDEV entry in /dev
|
|||
# 0x04 Old-style (XT) keyboard support, useful for older ThinkPads
|
||||
|
||||
# PS/2 mouse
|
||||
device psm0 at isa? tty irq 12
|
||||
device psm0 at atkbdc? tty irq 12
|
||||
|
||||
# Options for psm:
|
||||
options PSM_HOOKAPM #hook the APM resume event, useful
|
||||
|
@ -977,7 +977,7 @@ options SC_DISABLE_REBOOT # disable reboot key sequence
|
|||
# buggy. If it is not configured then you *must* configure math emulation
|
||||
# (see above). If both npx0 and emulation are configured, then only npx0
|
||||
# is used (provided it works).
|
||||
device npx0 at isa? port IO_NPX iosiz 0x0 flags 0x0 irq 13
|
||||
device npx0 at nexus? port IO_NPX iosiz 0x0 flags 0x0 irq 13
|
||||
|
||||
#
|
||||
# `flags' for npx0:
|
||||
|
@ -1464,7 +1464,7 @@ controller matcd0 at isa? port 0x230 bio
|
|||
device wt0 at isa? port 0x300 bio irq 5 drq 1
|
||||
device ctx0 at isa? port 0x230 iomem 0xd0000
|
||||
device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000
|
||||
device apm0 at isa?
|
||||
device apm0 at nexus?
|
||||
device gp0 at isa? port 0x2c0 tty
|
||||
device gsc0 at isa? port "IO_GSC1" tty drq 3
|
||||
device joy0 at isa? port IO_GAME
|
||||
|
@ -1632,7 +1632,7 @@ options "EISA_SLOTS=12"
|
|||
# The "oltr" driver supports the following Olicom PCI token-ring adapters
|
||||
# OC-3136, OC-3137, OC-3139, OC-3140, OC-3141, OC-3540, OC-3250
|
||||
#
|
||||
controller pci0
|
||||
controller pci0 at nexus?
|
||||
controller ahc1
|
||||
controller ncr0
|
||||
controller isp0
|
||||
|
|
|
@ -613,6 +613,21 @@ pci/ncr.c optional ncr device-driver
|
|||
pci/pci.c optional pci device-driver
|
||||
pci/pci_compat.c optional pci
|
||||
pci/pcisupport.c optional pci
|
||||
pci_if.o optional pci \
|
||||
dependency "pci_if.c pci_if.h" \
|
||||
compile-with "${NORMAL_C}" \
|
||||
no-implicit-rule local
|
||||
pci_if.c optional pci \
|
||||
dependency "$S/kern/makedevops.pl $S/pci/pci_if.m" \
|
||||
compile-with "perl5 $S/kern/makedevops.pl -c $S/pci/pci_if.m" \
|
||||
no-obj no-implicit-rule before-depend local \
|
||||
clean "pci_if.c"
|
||||
pci_if.h optional pci \
|
||||
dependency "$S/kern/makedevops.pl $S/pci/pci_if.m" \
|
||||
compile-with "perl5 $S/kern/makedevops.pl -h $S/pci/pci_if.m" \
|
||||
no-obj no-implicit-rule before-depend \
|
||||
clean "pci_if.h"
|
||||
pci/tek390.c optional amd device-driver
|
||||
pci/simos.c optional simos device-driver
|
||||
pci/alpm.c optional alpm device-driver
|
||||
pci/xrpu.c optional xrpu device-driver
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This file tells config what files go into building a kernel,
|
||||
# files marked standard are always included.
|
||||
#
|
||||
# $Id: files.alpha,v 1.16 1999/01/23 16:53:26 dfr Exp $
|
||||
# $Id: files.alpha,v 1.17 1999/03/10 10:36:50 yokota Exp $
|
||||
#
|
||||
# The long compile-with and dependency lines are required because of
|
||||
# limitations in config: backslash-newline doesn't work in strings, and
|
||||
|
@ -112,10 +112,13 @@ mcclock_if.h standard \
|
|||
no-obj no-implicit-rule before-depend \
|
||||
clean "mcclock_if.h"
|
||||
alpha/pci/cia.c optional cia
|
||||
alpha/pci/cia_pci.c optional cia
|
||||
alpha/pci/pci_eb164_intr.s optional cia
|
||||
alpha/pci/apecs.c optional apecs
|
||||
alpha/pci/apecs_pci.c optional apecs
|
||||
alpha/pci/pci_eb64plus_intr.s optional apecs
|
||||
alpha/pci/lca.c optional lca
|
||||
alpha/pci/lca_pci.c optional lca
|
||||
alpha/pci/pcibus.c optional pci
|
||||
alpha/isa/isa.c optional isa
|
||||
alpha/isa/mcclock_isa.c optional isa
|
||||
|
@ -157,3 +160,10 @@ dev/syscons/syscons.c optional sc device-driver
|
|||
dev/syscons/scvidctl.c optional sc device-driver
|
||||
isa/syscons_isa.c optional sc device-driver
|
||||
isa/psm.c optional psm device-driver
|
||||
dev/ata/ata-all.c optional ata device-driver
|
||||
dev/ata/ata-dma.c optional ata device-driver
|
||||
dev/ata/atapi-all.c optional ata device-driver
|
||||
dev/ata/ata-disk.c optional atadisk device-driver
|
||||
dev/ata/atapi-cd.c optional atapicd device-driver
|
||||
dev/ata/atapi-fd.c optional atapifd device-driver
|
||||
dev/ata/atapi-tape.c optional atapist device-driver
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This file tells config what files go into building a kernel,
|
||||
# files marked standard are always included.
|
||||
#
|
||||
# $Id: files.i386,v 1.234 1999/04/13 19:38:10 peter Exp $
|
||||
# $Id: files.i386,v 1.235 1999/04/15 14:52:23 bde Exp $
|
||||
#
|
||||
# The long compile-with and dependency lines are required because of
|
||||
# limitations in config: backslash-newline doesn't work in strings, and
|
||||
|
@ -90,6 +90,7 @@ i386/i386/mp_machdep.c optional smp
|
|||
i386/i386/mpapic.c optional smp
|
||||
i386/i386/mpboot.s optional smp
|
||||
i386/i386/mplock.s optional smp
|
||||
i386/i386/nexus.c standard
|
||||
i386/i386/perfmon.c optional perfmon profiling-routine
|
||||
i386/i386/perfmon.c optional perfmon
|
||||
i386/i386/pmap.c standard
|
||||
|
@ -125,8 +126,8 @@ i386/ibcs2/imgact_coff.c optional ibcs2
|
|||
i386/isa/adv_isa.c optional adv device-driver
|
||||
#i386/isa/aha1542.c optional aha device-driver
|
||||
i386/isa/aha_isa.c optional aha device-driver
|
||||
i386/isa/atkbd_isa.c optional atkbd device-driver
|
||||
i386/isa/atkbdc_isa.c optional atkbdc device-driver
|
||||
isa/atkbd_isa.c optional atkbd device-driver
|
||||
isa/atkbdc_isa.c optional atkbdc device-driver
|
||||
i386/isa/bt_isa.c optional bt device-driver
|
||||
i386/isa/clock.c standard
|
||||
i386/isa/cronyx.c optional cx device-driver
|
||||
|
@ -177,6 +178,8 @@ i386/isa/mse.c optional mse device-driver
|
|||
i386/isa/npx.c mandatory npx device-driver
|
||||
i386/isa/pcaudio.c optional pca device-driver
|
||||
i386/isa/matcd/matcd.c optional matcd device-driver
|
||||
i386/isa/isa_compat.c optional isa device-driver
|
||||
i386/isa/isa_dma.c optional isa device-driver
|
||||
i386/isa/pcibus.c optional pci device-driver
|
||||
i386/isa/pcicx.c optional ze device-driver
|
||||
i386/isa/pcicx.c optional zp device-driver
|
||||
|
@ -190,7 +193,7 @@ i386/isa/pnp.c optional pnp device-driver
|
|||
i386/isa/prof_machdep.c optional profiling-routine
|
||||
i386/isa/ppc.c optional ppc device-driver
|
||||
i386/isa/pcf.c optional pcf device-driver
|
||||
i386/isa/psm.c optional psm device-driver
|
||||
isa/psm.c optional psm device-driver
|
||||
i386/isa/random_machdep.c standard
|
||||
i386/isa/rc.c optional rc device-driver
|
||||
i386/isa/rp.c optional rp device-driver
|
||||
|
@ -198,7 +201,7 @@ i386/isa/scd.c optional scd device-driver
|
|||
i386/isa/si.c optional si device-driver
|
||||
i386/isa/si2_z280.c optional si device-driver
|
||||
i386/isa/si3_t225.c optional si device-driver
|
||||
i386/isa/sio.c optional sio device-driver
|
||||
isa/sio.c optional sio device-driver
|
||||
i386/isa/snd/sound.c optional pcm device-driver
|
||||
i386/isa/snd/dmabuf.c optional pcm device-driver
|
||||
i386/isa/snd/ad1848.c optional pcm device-driver
|
||||
|
@ -268,9 +271,9 @@ i386/isa/sound/cs4232.c optional css device-driver
|
|||
i386/isa/spigot.c optional spigot device-driver
|
||||
i386/isa/spkr.c optional speaker device-driver
|
||||
i386/isa/stallion.c optional stl device-driver
|
||||
i386/isa/syscons_isa.c optional sc device-driver
|
||||
isa/syscons_isa.c optional sc device-driver
|
||||
i386/isa/vesa.c optional vga device-driver
|
||||
i386/isa/vga_isa.c optional vga device-driver
|
||||
isa/vga_isa.c optional vga device-driver
|
||||
i386/isa/tw.c optional tw device-driver
|
||||
i386/isa/wd.c optional wdc device-driver
|
||||
i386/isa/wd.c optional wd device-driver
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: aha_isa.c,v 1.5 1998/11/10 06:44:54 gibbs Exp $
|
||||
* $Id: aha_isa.c,v 1.6 1999/01/20 06:21:23 imp Exp $
|
||||
*/
|
||||
|
||||
#include "pnp.h"
|
||||
|
@ -257,7 +257,6 @@ static void
|
|||
ahapnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
||||
{
|
||||
struct pnp_cinfo d;
|
||||
struct isa_device *dvp;
|
||||
|
||||
if (dev->id_unit >= NAHATOT)
|
||||
return;
|
||||
|
@ -278,9 +277,7 @@ ahapnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
|||
|
||||
if (dev->id_driver == NULL) {
|
||||
dev->id_driver = &ahadriver;
|
||||
dvp = find_isadev(isa_devtab_tty, &ahadriver, 0);
|
||||
if (dvp != NULL)
|
||||
dev->id_id = dvp->id_id;
|
||||
dev->id_id = isa_compat_nextid();
|
||||
}
|
||||
|
||||
if ((dev->id_alive = aha_isa_probe(dev)) != 0)
|
||||
|
|
|
@ -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: ata-all.c,v 1.5 1999/03/28 18:57:18 sos Exp $
|
||||
* $Id: ata-all.c,v 1.6 1999/04/10 18:53:35 sos Exp $
|
||||
*/
|
||||
|
||||
#include "ata.h"
|
||||
|
@ -44,12 +44,18 @@
|
|||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <machine/clock.h>
|
||||
#ifdef __i386__
|
||||
#include <machine/smp.h>
|
||||
#endif
|
||||
#include <pci/pcivar.h>
|
||||
#include <pci/pcireg.h>
|
||||
#ifdef __i386__
|
||||
#include <i386/isa/icu.h>
|
||||
#include <i386/isa/isa.h>
|
||||
#include <i386/isa/isa_device.h>
|
||||
#else
|
||||
#include <isa/isareg.h>
|
||||
#endif
|
||||
#include <dev/ata/ata-all.h>
|
||||
#include <dev/ata/ata-disk.h>
|
||||
#include <dev/ata/atapi-all.h>
|
||||
|
@ -62,7 +68,7 @@
|
|||
#endif
|
||||
|
||||
/* prototypes */
|
||||
#if NISA > 0
|
||||
#if NISA > 0 && defined(__i386__)
|
||||
static int32_t ata_isaprobe(struct isa_device *);
|
||||
static int32_t ata_isaattach(struct isa_device *);
|
||||
#endif
|
||||
|
@ -76,9 +82,10 @@ static void ataintr(int32_t);
|
|||
|
||||
static int32_t atanlun = 0;
|
||||
struct ata_softc *atadevices[MAXATA];
|
||||
|
||||
#if NISA > 0 && defined(__i386__)
|
||||
struct isa_driver atadriver = { ata_isaprobe, ata_isaattach, "ata" };
|
||||
|
||||
#if NISA > 0
|
||||
static int32_t
|
||||
ata_isaprobe(struct isa_device *devp)
|
||||
{
|
||||
|
@ -133,6 +140,10 @@ ata_pciprobe(pcici_t tag, pcidi_t type)
|
|||
return "Promise Ultra/33 IDE controller";
|
||||
case 0x522910b9:
|
||||
return "AcerLabs Aladdin IDE controller";
|
||||
case 0x06401095:
|
||||
return "CMD 640 IDE controller";
|
||||
case 0x06461095:
|
||||
return "CMD 646 IDE controller";
|
||||
#if 0
|
||||
case 0x05711106:
|
||||
return "VIA Apollo IDE controller";
|
||||
|
@ -222,14 +233,18 @@ ata_pciattach(pcici_t tag, int32_t unit)
|
|||
lun = 0;
|
||||
if (ata_probe(iobase_1, altiobase_1, bmaddr_1, tag, &lun)) {
|
||||
if (iobase_1 == IO_WD1)
|
||||
#ifdef __i386__
|
||||
register_intr(irq1, (int)"", 0, (inthand2_t *)ataintr,
|
||||
&bio_imask, lun);
|
||||
#else
|
||||
alpha_platform_setup_ide_intr(0, ataintr, (void *)(intptr_t)lun);
|
||||
#endif
|
||||
else {
|
||||
if (sysctrl)
|
||||
pci_map_int(tag, (inthand2_t *)promise_intr,
|
||||
(void *)lun, &bio_imask);
|
||||
(void *)(intptr_t)lun, &bio_imask);
|
||||
else
|
||||
pci_map_int(tag, (inthand2_t *)ataintr, (void *)lun,&bio_imask);
|
||||
pci_map_int(tag, (inthand2_t *)ataintr, (void *)(intptr_t)lun,&bio_imask);
|
||||
}
|
||||
printf("ata%d at 0x%04x irq %d on ata-pci%d\n",
|
||||
lun, iobase_1, isa_apic_irq(irq1), unit);
|
||||
|
@ -237,11 +252,15 @@ ata_pciattach(pcici_t tag, int32_t unit)
|
|||
lun = 1;
|
||||
if (ata_probe(iobase_2, altiobase_2, bmaddr_2, tag, &lun)) {
|
||||
if (iobase_2 == IO_WD2)
|
||||
#ifdef __i386__
|
||||
register_intr(irq2, (int)"", 0, (inthand2_t *)ataintr,
|
||||
&bio_imask, lun);
|
||||
#else
|
||||
alpha_platform_setup_ide_intr(1, ataintr, (void *)(intptr_t)lun);
|
||||
#endif
|
||||
else {
|
||||
if (!sysctrl)
|
||||
pci_map_int(tag, (inthand2_t *)ataintr, (void *)lun,&bio_imask);
|
||||
pci_map_int(tag, (inthand2_t *)ataintr, (void *)(intptr_t)lun,&bio_imask);
|
||||
}
|
||||
printf("ata%d at 0x%04x irq %d on ata-pci%d\n",
|
||||
lun, iobase_2, isa_apic_irq(irq2), unit);
|
||||
|
@ -418,6 +437,7 @@ ata_probe(int32_t ioaddr, int32_t altioaddr, int32_t bmaddr,
|
|||
#ifndef ATA_STATIC_ID
|
||||
atanlun++;
|
||||
#endif
|
||||
outb(scp->ioaddr + ATA_DRIVE, ATA_D_IBM | ATA_MASTER);
|
||||
return ATA_IOSIZE;
|
||||
}
|
||||
|
||||
|
@ -571,7 +591,7 @@ printf("ata_command: addr=%04x, device=%02x, cmd=%02x, c=%d, h=%d, s=%d, count=%
|
|||
scp->active = ATA_WAIT_INTR;
|
||||
outb(scp->ioaddr + ATA_CMD, command);
|
||||
if (tsleep((caddr_t)scp, PRIBIO, "atacmd", 500)) {
|
||||
printf("ata_command: timeout waiting for interrupt");
|
||||
printf("ata_command: timeout waiting for interrupt\n");
|
||||
scp->active = ATA_IDLE;
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -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: ata-disk.c,v 1.5 1999/03/28 18:57:18 sos Exp $
|
||||
* $Id: ata-disk.c,v 1.6 1999/04/10 18:53:35 sos Exp $
|
||||
*/
|
||||
|
||||
#include "ata.h"
|
||||
|
@ -527,11 +527,11 @@ ad_transfer(struct buf *bp)
|
|||
/* output the data */
|
||||
#if 0
|
||||
outsw(adp->controller->ioaddr + ATA_DATA,
|
||||
(void *)((int32_t)bp->b_data + adp->donecount),
|
||||
(void *)((uintptr_t)bp->b_data + adp->donecount),
|
||||
adp->currentsize / sizeof(int16_t));
|
||||
#else
|
||||
outsl(adp->controller->ioaddr + ATA_DATA,
|
||||
(void *)((int32_t)bp->b_data + adp->donecount),
|
||||
(void *)((uintptr_t)bp->b_data + adp->donecount),
|
||||
adp->currentsize / sizeof(int32_t));
|
||||
#endif
|
||||
adp->bytecount -= adp->currentsize;
|
||||
|
@ -590,11 +590,11 @@ printf("extra SMP interrupt\n");
|
|||
/* data ready, read in */
|
||||
#if 0
|
||||
insw(adp->controller->ioaddr + ATA_DATA,
|
||||
(void *)((int32_t)bp->b_data + adp->donecount),
|
||||
(void *)((uintptr_t)bp->b_data + adp->donecount),
|
||||
adp->currentsize / sizeof(int16_t));
|
||||
#else
|
||||
insl(adp->controller->ioaddr + ATA_DATA,
|
||||
(void *)((int32_t)bp->b_data + adp->donecount),
|
||||
(void *)((uintptr_t)bp->b_data + adp->donecount),
|
||||
adp->currentsize / sizeof(int32_t));
|
||||
#endif
|
||||
adp->bytecount -= adp->currentsize;
|
||||
|
|
|
@ -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: ata-dma.c,v 1.3 1999/03/30 13:09:47 sos Exp $
|
||||
* $Id: ata-dma.c,v 1.4 1999/04/10 18:53:35 sos Exp $
|
||||
*/
|
||||
|
||||
#include "ata.h"
|
||||
|
@ -42,6 +42,12 @@
|
|||
#include <pci/pcireg.h>
|
||||
#include <dev/ata/ata-all.h>
|
||||
|
||||
#ifdef __alpha__
|
||||
#undef vtophys
|
||||
#define vtophys(va) (pmap_kextract(((vm_offset_t) (va))) \
|
||||
+ 1*1024*1024*1024)
|
||||
#endif
|
||||
|
||||
/* misc defines */
|
||||
#define MIN(a,b) ((a)>(b)?(b):(a))
|
||||
|
||||
|
@ -64,7 +70,7 @@ ata_dmainit(struct ata_softc *scp, int32_t device,
|
|||
if (!(dmatab = malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT)))
|
||||
return -1;
|
||||
|
||||
if (((int)dmatab>>PAGE_SHIFT)^(((int)dmatab+PAGE_SIZE-1)>>PAGE_SHIFT)) {
|
||||
if (((uintptr_t)dmatab>>PAGE_SHIFT)^(((uintptr_t)dmatab+PAGE_SIZE-1)>>PAGE_SHIFT)) {
|
||||
printf("ata_dmainit: dmatab crosses page boundary, no DMA\n");
|
||||
free(dmatab, M_DEVBUF);
|
||||
return -1;
|
||||
|
@ -252,7 +258,7 @@ ata_dmasetup(struct ata_softc *scp, int32_t device,
|
|||
#ifdef ATA_DEBUGDMA
|
||||
printf("ata%d: dmasetup\n", scp->lun);
|
||||
#endif
|
||||
if (((u_int32_t)data & 1) || (count & 1))
|
||||
if (((uintptr_t)data & 1) || (count & 1))
|
||||
return -1;
|
||||
|
||||
if (!count) {
|
||||
|
@ -263,7 +269,7 @@ ata_dmasetup(struct ata_softc *scp, int32_t device,
|
|||
|
||||
dmatab = scp->dmatab[device ? 1 : 0];
|
||||
dma_base = vtophys(data);
|
||||
dma_count = MIN(count, (PAGE_SIZE - ((u_int32_t)data & PAGE_MASK)));
|
||||
dma_count = MIN(count, (PAGE_SIZE - ((uintptr_t)data & PAGE_MASK)));
|
||||
data += dma_count;
|
||||
count -= dma_count;
|
||||
|
||||
|
|
|
@ -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: atapi-all.c,v 1.5 1999/03/28 18:57:19 sos Exp $
|
||||
* $Id: atapi-all.c,v 1.6 1999/04/10 18:53:35 sos Exp $
|
||||
*/
|
||||
|
||||
#include "ata.h"
|
||||
|
@ -310,13 +310,13 @@ printf("atapi_interrupt: length=%d reason=0x%02x\n", length, reason);
|
|||
printf("atapi_interrupt: write data underrun %d/%d\n",
|
||||
length, request->bytecount);
|
||||
outsw(atp->controller->ioaddr + ATA_DATA,
|
||||
(void *)((int32_t)request->data), length / sizeof(int16_t));
|
||||
(void *)((uintptr_t)request->data), length / sizeof(int16_t));
|
||||
for (resid=request->bytecount; resid<length; resid+=sizeof(int16_t))
|
||||
outw(atp->controller->ioaddr + ATA_DATA, 0);
|
||||
}
|
||||
else {
|
||||
outsw(atp->controller->ioaddr + ATA_DATA,
|
||||
(void *)((int32_t)request->data), length / sizeof(int16_t));
|
||||
(void *)((uintptr_t)request->data), length / sizeof(int16_t));
|
||||
}
|
||||
request->bytecount -= length;
|
||||
request->data += length;
|
||||
|
@ -331,13 +331,13 @@ printf("atapi_interrupt: length=%d reason=0x%02x\n", length, reason);
|
|||
printf("atapi_interrupt: read data overrun %d/%d\n",
|
||||
length, request->bytecount);
|
||||
insw(atp->controller->ioaddr + ATA_DATA,
|
||||
(void *)((int32_t)request->data), length / sizeof(int16_t));
|
||||
(void *)((uintptr_t)request->data), length / sizeof(int16_t));
|
||||
for (resid=request->bytecount; resid<length; resid+=sizeof(int16_t))
|
||||
inw(atp->controller->ioaddr + ATA_DATA);
|
||||
}
|
||||
else {
|
||||
insw(atp->controller->ioaddr + ATA_DATA,
|
||||
(void *)((int32_t)request->data), length / sizeof(int16_t));
|
||||
(void *)((uintptr_t)request->data), length / sizeof(int16_t));
|
||||
}
|
||||
request->bytecount -= length;
|
||||
request->data += length;
|
||||
|
|
|
@ -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: atkbd.c,v 1.4 1999/01/28 10:55:55 yokota Exp $
|
||||
* $Id: atkbd.c,v 1.5 1999/03/10 10:36:52 yokota Exp $
|
||||
*/
|
||||
|
||||
#include "atkbd.h"
|
||||
|
@ -46,7 +46,7 @@
|
|||
#include <dev/kbd/atkbdreg.h>
|
||||
#include <dev/kbd/atkbdcreg.h>
|
||||
|
||||
#ifndef __i386__
|
||||
#if 1
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <isa/isareg.h>
|
||||
|
@ -89,6 +89,7 @@ static struct cdevsw atkbd_cdevsw = {
|
|||
|
||||
#endif /* KBD_INSTALL_CDEV */
|
||||
|
||||
#if 0
|
||||
#ifdef __i386__
|
||||
|
||||
atkbd_softc_t
|
||||
|
@ -110,6 +111,7 @@ atkbd_softc_t
|
|||
}
|
||||
|
||||
#endif /* __i386__ */
|
||||
#endif
|
||||
|
||||
int
|
||||
atkbd_probe_unit(int unit, int port, int irq, int flags)
|
||||
|
@ -376,16 +378,14 @@ atkbd_configure(int flags)
|
|||
{
|
||||
keyboard_t *kbd;
|
||||
int arg[2];
|
||||
#ifdef __i386__
|
||||
struct isa_device *dev;
|
||||
int i;
|
||||
|
||||
/* XXX: a kludge to obtain the device configuration flags */
|
||||
dev = find_isadev(isa_devtab_tty, &atkbddriver, 0);
|
||||
if (dev != NULL) {
|
||||
flags |= dev->id_flags;
|
||||
if (resource_int_value("atkbd", 0, "flags", &i) == 0) {
|
||||
flags |= i;
|
||||
/* if the driver is disabled, unregister the keyboard if any */
|
||||
if (!dev->id_enabled) {
|
||||
if (resource_int_value("atkbd", 0, "disabled", &i) == 0
|
||||
&& i != 0) {
|
||||
i = kbd_find_keyboard(ATKBD_DRIVER_NAME, ATKBD_DEFAULT);
|
||||
if (i >= 0) {
|
||||
kbd = kbd_get_keyboard(i);
|
||||
|
@ -395,8 +395,7 @@ atkbd_configure(int flags)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* probe the keyboard controller */
|
||||
atkbdc_configure();
|
||||
|
||||
|
|
|
@ -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: atkbd_isa.c,v 1.1 1999/01/23 16:53:27 dfr Exp $
|
||||
* $Id: atkbd_isa.c,v 1.2 1999/03/10 10:36:49 yokota Exp $
|
||||
*/
|
||||
|
||||
#include "atkbd.h"
|
||||
|
@ -37,6 +37,7 @@
|
|||
#include <sys/conf.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
|
@ -70,9 +71,9 @@ static driver_t atkbd_driver = {
|
|||
static int
|
||||
atkbdprobe(device_t dev)
|
||||
{
|
||||
u_long port;
|
||||
u_long irq;
|
||||
u_long flags;
|
||||
uintptr_t port;
|
||||
uintptr_t irq;
|
||||
uintptr_t flags;
|
||||
|
||||
device_set_desc(dev, "AT Keyboard");
|
||||
|
||||
|
@ -89,9 +90,9 @@ static int
|
|||
atkbdattach(device_t dev)
|
||||
{
|
||||
atkbd_softc_t *sc;
|
||||
u_long port;
|
||||
u_long irq;
|
||||
u_long flags;
|
||||
uintptr_t port;
|
||||
uintptr_t irq;
|
||||
uintptr_t flags;
|
||||
struct resource *res;
|
||||
void *ih;
|
||||
int zero = 0;
|
||||
|
|
|
@ -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: atkbd_isa.c,v 1.1 1999/01/23 16:53:27 dfr Exp $
|
||||
* $Id: atkbd_isa.c,v 1.2 1999/03/10 10:36:49 yokota Exp $
|
||||
*/
|
||||
|
||||
#include "atkbd.h"
|
||||
|
@ -37,6 +37,7 @@
|
|||
#include <sys/conf.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
|
@ -70,9 +71,9 @@ static driver_t atkbd_driver = {
|
|||
static int
|
||||
atkbdprobe(device_t dev)
|
||||
{
|
||||
u_long port;
|
||||
u_long irq;
|
||||
u_long flags;
|
||||
uintptr_t port;
|
||||
uintptr_t irq;
|
||||
uintptr_t flags;
|
||||
|
||||
device_set_desc(dev, "AT Keyboard");
|
||||
|
||||
|
@ -89,9 +90,9 @@ static int
|
|||
atkbdattach(device_t dev)
|
||||
{
|
||||
atkbd_softc_t *sc;
|
||||
u_long port;
|
||||
u_long irq;
|
||||
u_long flags;
|
||||
uintptr_t port;
|
||||
uintptr_t irq;
|
||||
uintptr_t flags;
|
||||
struct resource *res;
|
||||
void *ih;
|
||||
int zero = 0;
|
||||
|
|
|
@ -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.2 1998/11/15 18:25:17 dfr Exp $
|
||||
* $Id: psm.c,v 1.3 1999/01/23 16:53:28 dfr Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -76,6 +76,7 @@
|
|||
#include <sys/poll.h>
|
||||
#include <sys/syslog.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#ifdef DEVFS
|
||||
#include <sys/devfsext.h>
|
||||
|
@ -740,8 +741,8 @@ psmprobe(device_t dev)
|
|||
{
|
||||
int unit = device_get_unit(dev);
|
||||
struct psm_softc *sc = device_get_softc(dev);
|
||||
u_long port;
|
||||
u_long flags;
|
||||
uintptr_t port;
|
||||
uintptr_t flags;
|
||||
int stat[3];
|
||||
int command_byte;
|
||||
int mask;
|
||||
|
@ -991,7 +992,7 @@ psmattach(device_t dev)
|
|||
struct psm_softc *sc = device_get_softc(dev);
|
||||
void *ih;
|
||||
struct resource *res;
|
||||
u_long irq;
|
||||
uintptr_t irq;
|
||||
int zero = 0;
|
||||
|
||||
if (sc == NULL) /* shouldn't happen */
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
* $Id: if_cs.c,v 1.8 1999/01/12 00:27:43 eivind Exp $
|
||||
* $Id: if_cs.c,v 1.9 1999/01/28 01:59:53 dillon Exp $
|
||||
*
|
||||
* Device driver for Crystal Semiconductor CS8920 based ethernet
|
||||
* adapters. By Maxim Bolotin and Oleg Sharoiko, 27-April-1997
|
||||
|
@ -1352,7 +1352,6 @@ cs_pnp_attach(u_long csn, u_long vend_id, char *name,
|
|||
int iobase, unit, flags;
|
||||
u_int irq;
|
||||
int drq;
|
||||
struct isa_device *dvp;
|
||||
struct cs_softc *sc = malloc(sizeof *sc, M_DEVBUF, M_NOWAIT);
|
||||
|
||||
if (read_pnp_parms ( &d , ldn ) == 0 ) {
|
||||
|
@ -1373,9 +1372,7 @@ cs_pnp_attach(u_long csn, u_long vend_id, char *name,
|
|||
|
||||
if (dev->id_driver == NULL) {
|
||||
dev->id_driver = &csdriver;
|
||||
dvp = find_isadev(isa_devtab_net, &csdriver, 0);
|
||||
if (dvp != NULL)
|
||||
dev->id_id = dvp->id_id;
|
||||
dev->id_id = isa_compat_nextid();
|
||||
}
|
||||
|
||||
if (!sc) return;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_ed.c,v 1.149 1999/01/28 01:59:53 dillon Exp $
|
||||
* $Id: if_ed.c,v 1.150 1999/03/17 16:44:51 luigi Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -3488,7 +3488,6 @@ static void
|
|||
edpnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
||||
{
|
||||
struct pnp_cinfo d;
|
||||
struct isa_device *dvp;
|
||||
|
||||
if (dev->id_unit >= NEDTOT)
|
||||
return;
|
||||
|
@ -3509,9 +3508,7 @@ edpnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
|||
|
||||
if (dev->id_driver == NULL) {
|
||||
dev->id_driver = &eddriver;
|
||||
dvp = find_isadev(isa_devtab_net, &eddriver, 0);
|
||||
if (dvp != NULL)
|
||||
dev->id_id = dvp->id_id;
|
||||
dev->id_id = isa_compat_nextid();
|
||||
}
|
||||
|
||||
if ((dev->id_alive = ed_probe(dev)) != 0)
|
||||
|
|
1179
sys/dev/fdc/fdc.c
1179
sys/dev/fdc/fdc.c
File diff suppressed because it is too large
Load diff
|
@ -27,7 +27,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_fxp.c,v 1.65 1999/03/17 16:44:53 luigi Exp $
|
||||
* $Id: if_fxp.c,v 1.66 1999/03/20 04:51:25 wes Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -89,6 +89,10 @@
|
|||
#else /* __FreeBSD__ */
|
||||
|
||||
#include <sys/sockio.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <net/ethernet.h>
|
||||
#include <net/if_arp.h>
|
||||
|
@ -491,51 +495,31 @@ fxp_ether_ioctl(ifp, cmd, data)
|
|||
|
||||
#else /* __FreeBSD__ */
|
||||
|
||||
static u_long fxp_count;
|
||||
static const char *fxp_probe __P((pcici_t, pcidi_t));
|
||||
static void fxp_attach __P((pcici_t, int));
|
||||
|
||||
static void fxp_shutdown __P((int, void *));
|
||||
|
||||
static struct pci_device fxp_device = {
|
||||
"fxp",
|
||||
fxp_probe,
|
||||
fxp_attach,
|
||||
&fxp_count,
|
||||
NULL
|
||||
};
|
||||
DATA_SET(pcidevice_set, fxp_device);
|
||||
|
||||
/*
|
||||
* Return identification string if this is device is ours.
|
||||
*/
|
||||
static const char *
|
||||
fxp_probe(config_id, device_id)
|
||||
pcici_t config_id;
|
||||
pcidi_t device_id;
|
||||
static int
|
||||
fxp_probe(device_t dev)
|
||||
{
|
||||
if (((device_id & 0xffff) == FXP_VENDORID_INTEL) &&
|
||||
((device_id >> 16) & 0xffff) == FXP_DEVICEID_i82557)
|
||||
return ("Intel EtherExpress Pro 10/100B Ethernet");
|
||||
if ((pci_get_vendor(dev) == FXP_VENDORID_INTEL) &&
|
||||
(pci_get_device(dev) == FXP_DEVICEID_i82557)) {
|
||||
device_set_desc(dev, "Intel EtherExpress Pro 10/100B Ethernet");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
static void
|
||||
fxp_attach(config_id, unit)
|
||||
pcici_t config_id;
|
||||
int unit;
|
||||
static int
|
||||
fxp_attach(device_t dev)
|
||||
{
|
||||
struct fxp_softc *sc;
|
||||
vm_offset_t pbase;
|
||||
int error = 0;
|
||||
struct fxp_softc *sc = device_get_softc(dev);
|
||||
struct ifnet *ifp;
|
||||
int s;
|
||||
u_long val;
|
||||
int rid;
|
||||
|
||||
sc = malloc(sizeof(struct fxp_softc), M_DEVBUF, M_NOWAIT);
|
||||
if (sc == NULL)
|
||||
return;
|
||||
bzero(sc, sizeof(struct fxp_softc));
|
||||
callout_handle_init(&sc->stat_ch);
|
||||
|
||||
s = splimp();
|
||||
|
@ -543,39 +527,56 @@ fxp_attach(config_id, unit)
|
|||
/*
|
||||
* Enable bus mastering.
|
||||
*/
|
||||
val = pci_conf_read(config_id, PCI_COMMAND_STATUS_REG);
|
||||
val = pci_read_config(dev, PCIR_COMMAND, 2);
|
||||
val |= (PCIM_CMD_MEMEN|PCIM_CMD_BUSMASTEREN);
|
||||
pci_conf_write(config_id, PCI_COMMAND_STATUS_REG, val);
|
||||
pci_write_config(dev, PCIR_COMMAND, val, 2);
|
||||
|
||||
/*
|
||||
* Map control/status registers.
|
||||
*/
|
||||
if (!pci_map_mem(config_id, FXP_PCI_MMBA,
|
||||
(vm_offset_t *)&sc->csr, &pbase)) {
|
||||
printf("fxp%d: couldn't map memory\n", unit);
|
||||
rid = FXP_PCI_MMBA;
|
||||
sc->mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
|
||||
0, ~0, 1, RF_ACTIVE);
|
||||
if (!sc->mem) {
|
||||
device_printf(dev, "could not map memory\n");
|
||||
error = ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
sc->csr = rman_get_virtual(sc->mem); /* XXX use bus_space */
|
||||
|
||||
/*
|
||||
* Allocate our interrupt.
|
||||
*/
|
||||
if (!pci_map_int(config_id, fxp_intr, sc, &net_imask)) {
|
||||
printf("fxp%d: couldn't map interrupt\n", unit);
|
||||
rid = 0;
|
||||
sc->irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
|
||||
RF_SHAREABLE | RF_ACTIVE);
|
||||
if (sc->irq == NULL) {
|
||||
device_printf(dev, "could not map interrupt\n");
|
||||
error = ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
error = bus_setup_intr(dev, sc->irq, fxp_intr, sc, &sc->ih);
|
||||
if (error) {
|
||||
device_printf(dev, "could not setup irq\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* Do generic parts of attach. */
|
||||
if (fxp_attach_common(sc, sc->arpcom.ac_enaddr)) {
|
||||
/* Failed! */
|
||||
(void) pci_unmap_int(config_id);
|
||||
bus_teardown_intr(dev, sc->irq, sc->ih);
|
||||
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
|
||||
bus_release_resource(dev, SYS_RES_MEMORY, FXP_PCI_MMBA, sc->mem);
|
||||
error = ENXIO;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
printf("fxp%d: Ethernet address %6D%s\n", unit,
|
||||
device_printf(dev, "Ethernet address %6D%s\n",
|
||||
sc->arpcom.ac_enaddr, ":", sc->phy_10Mbps_only ? ", 10Mbps" : "");
|
||||
|
||||
ifp = &sc->arpcom.ac_if;
|
||||
ifp->if_unit = unit;
|
||||
ifp->if_unit = device_get_unit(dev);
|
||||
ifp->if_name = "fxp";
|
||||
ifp->if_output = ether_output;
|
||||
ifp->if_baudrate = 100000000;
|
||||
|
@ -600,19 +601,63 @@ fxp_attach(config_id, unit)
|
|||
bpfattach(ifp, DLT_EN10MB, sizeof(struct ether_header));
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Add shutdown hook so that DMA is disabled prior to reboot. Not
|
||||
* doing do could allow DMA to corrupt kernel memory during the
|
||||
* reboot before the driver initializes.
|
||||
*/
|
||||
at_shutdown(fxp_shutdown, sc, SHUTDOWN_POST_SYNC);
|
||||
|
||||
splx(s);
|
||||
return;
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
free(sc, M_DEVBUF);
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
|
||||
/*
|
||||
* Detach interface.
|
||||
*/
|
||||
static int
|
||||
fxp_detach(device_t dev)
|
||||
{
|
||||
struct fxp_softc *sc = device_get_softc(dev);
|
||||
int s;
|
||||
|
||||
s = splimp();
|
||||
|
||||
/*
|
||||
* Close down routes etc.
|
||||
*/
|
||||
if_detach(&sc->arpcom.ac_if);
|
||||
|
||||
/*
|
||||
* Stop DMA and drop transmit queue.
|
||||
*/
|
||||
fxp_stop(sc);
|
||||
|
||||
/*
|
||||
* Deallocate resources.
|
||||
*/
|
||||
bus_teardown_intr(dev, sc->irq, sc->ih);
|
||||
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq);
|
||||
bus_release_resource(dev, SYS_RES_MEMORY, FXP_PCI_MMBA, sc->mem);
|
||||
|
||||
/*
|
||||
* Free all the receive buffers.
|
||||
*/
|
||||
if (sc->rfa_headm != NULL)
|
||||
m_freem(sc->rfa_headm);
|
||||
|
||||
/*
|
||||
* Free all media structures.
|
||||
*/
|
||||
ifmedia_removeall(&sc->sc_media);
|
||||
|
||||
/*
|
||||
* Free anciliary structures.
|
||||
*/
|
||||
free(sc->cbl_base, M_DEVBUF);
|
||||
free(sc->fxp_stats, M_DEVBUF);
|
||||
free(sc->mcsp, M_DEVBUF);
|
||||
|
||||
splx(s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -620,14 +665,39 @@ fxp_attach(config_id, unit)
|
|||
* main purpose of this routine is to shut off receiver DMA so that
|
||||
* kernel memory doesn't get clobbered during warmboot.
|
||||
*/
|
||||
static void
|
||||
fxp_shutdown(howto, sc)
|
||||
int howto;
|
||||
void *sc;
|
||||
static int
|
||||
fxp_shutdown(device_t dev)
|
||||
{
|
||||
fxp_stop((struct fxp_softc *) sc);
|
||||
/*
|
||||
* Make sure that DMA is disabled prior to reboot. Not doing
|
||||
* do could allow DMA to corrupt kernel memory during the
|
||||
* reboot before the driver initializes.
|
||||
*/
|
||||
fxp_stop((struct fxp_softc *) device_get_softc(dev));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static device_method_t fxp_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, fxp_probe),
|
||||
DEVMETHOD(device_attach, fxp_attach),
|
||||
DEVMETHOD(device_detach, fxp_detach),
|
||||
DEVMETHOD(device_shutdown, fxp_shutdown),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t fxp_driver = {
|
||||
"fxp",
|
||||
fxp_methods,
|
||||
DRIVER_TYPE_NET,
|
||||
sizeof(struct fxp_softc),
|
||||
};
|
||||
|
||||
static devclass_t fxp_devclass;
|
||||
|
||||
DRIVER_MODULE(fxp, pci, fxp_driver, fxp_devclass, 0, 0);
|
||||
|
||||
#endif /* __NetBSD__ */
|
||||
|
||||
/*************************************************************
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: if_fxpvar.h,v 1.5 1998/06/07 17:12:38 dfr Exp $
|
||||
* $Id: if_fxpvar.h,v 1.6 1998/08/02 00:29:15 dg Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -48,6 +48,9 @@ struct fxp_softc {
|
|||
#else
|
||||
struct arpcom arpcom; /* per-interface network data */
|
||||
caddr_t csr; /* control/status registers */
|
||||
struct resource *mem; /* resource descriptor for registers */
|
||||
struct resource *irq; /* resource descriptor for interrupt */
|
||||
void *ih; /* interrupt handler cookie */
|
||||
#endif /* __NetBSD__ */
|
||||
struct mbuf *rfa_headm; /* first mbuf in receive frame area */
|
||||
struct mbuf *rfa_tailm; /* last mbuf in receive frame area */
|
||||
|
|
|
@ -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: atkbd.c,v 1.4 1999/01/28 10:55:55 yokota Exp $
|
||||
* $Id: atkbd.c,v 1.5 1999/03/10 10:36:52 yokota Exp $
|
||||
*/
|
||||
|
||||
#include "atkbd.h"
|
||||
|
@ -46,7 +46,7 @@
|
|||
#include <dev/kbd/atkbdreg.h>
|
||||
#include <dev/kbd/atkbdcreg.h>
|
||||
|
||||
#ifndef __i386__
|
||||
#if 1
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <isa/isareg.h>
|
||||
|
@ -89,6 +89,7 @@ static struct cdevsw atkbd_cdevsw = {
|
|||
|
||||
#endif /* KBD_INSTALL_CDEV */
|
||||
|
||||
#if 0
|
||||
#ifdef __i386__
|
||||
|
||||
atkbd_softc_t
|
||||
|
@ -110,6 +111,7 @@ atkbd_softc_t
|
|||
}
|
||||
|
||||
#endif /* __i386__ */
|
||||
#endif
|
||||
|
||||
int
|
||||
atkbd_probe_unit(int unit, int port, int irq, int flags)
|
||||
|
@ -376,16 +378,14 @@ atkbd_configure(int flags)
|
|||
{
|
||||
keyboard_t *kbd;
|
||||
int arg[2];
|
||||
#ifdef __i386__
|
||||
struct isa_device *dev;
|
||||
int i;
|
||||
|
||||
/* XXX: a kludge to obtain the device configuration flags */
|
||||
dev = find_isadev(isa_devtab_tty, &atkbddriver, 0);
|
||||
if (dev != NULL) {
|
||||
flags |= dev->id_flags;
|
||||
if (resource_int_value("atkbd", 0, "flags", &i) == 0) {
|
||||
flags |= i;
|
||||
/* if the driver is disabled, unregister the keyboard if any */
|
||||
if (!dev->id_enabled) {
|
||||
if (resource_int_value("atkbd", 0, "disabled", &i) == 0
|
||||
&& i != 0) {
|
||||
i = kbd_find_keyboard(ATKBD_DRIVER_NAME, ATKBD_DEFAULT);
|
||||
if (i >= 0) {
|
||||
kbd = kbd_get_keyboard(i);
|
||||
|
@ -395,8 +395,7 @@ atkbd_configure(int flags)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* probe the keyboard controller */
|
||||
atkbdc_configure();
|
||||
|
||||
|
|
|
@ -23,10 +23,12 @@
|
|||
* (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: pci.c,v 1.93 1999/01/19 23:29:18 se Exp $
|
||||
* $Id: pci.c,v 1.94 1999/04/11 02:47:31 eivind Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
#include "opt_bus.h"
|
||||
|
||||
#include "pci.h"
|
||||
#if NPCI > 0
|
||||
|
||||
|
@ -50,6 +52,11 @@
|
|||
#include <vm/pmap.h>
|
||||
#include <vm/vm_extern.h>
|
||||
|
||||
#include <sys/bus.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <pci/pcireg.h>
|
||||
#include <pci/pcivar.h>
|
||||
#include <pci/pci_ioctl.h>
|
||||
|
@ -338,11 +345,10 @@ pci_readcfg(pcicfgregs *probe)
|
|||
M_DEVBUF, M_WAITOK);
|
||||
if (devlist_entry == NULL)
|
||||
return (NULL);
|
||||
bzero(devlist_entry, sizeof *devlist_entry);
|
||||
|
||||
cfg = &devlist_entry->cfg;
|
||||
|
||||
bzero(cfg, sizeof *cfg);
|
||||
|
||||
cfg->bus = probe->bus;
|
||||
cfg->slot = probe->slot;
|
||||
cfg->func = probe->func;
|
||||
|
@ -450,113 +456,6 @@ pci_freecfg(struct pci_devinfo *dinfo)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
pci_addcfg(struct pci_devinfo *dinfo)
|
||||
{
|
||||
if (bootverbose) {
|
||||
int i;
|
||||
pcicfgregs *cfg = &dinfo->cfg;
|
||||
|
||||
printf("found->\tvendor=0x%04x, dev=0x%04x, revid=0x%02x\n",
|
||||
cfg->vendor, cfg->device, cfg->revid);
|
||||
printf("\tclass=%02x-%02x-%02x, hdrtype=0x%02x, mfdev=%d\n",
|
||||
cfg->baseclass, cfg->subclass, cfg->progif,
|
||||
cfg->hdrtype, cfg->mfdev);
|
||||
printf("\tsubordinatebus=%x \tsecondarybus=%x\n",
|
||||
cfg->subordinatebus, cfg->secondarybus);
|
||||
#ifdef PCI_DEBUG
|
||||
printf("\tcmdreg=0x%04x, statreg=0x%04x, cachelnsz=%d (dwords)\n",
|
||||
cfg->cmdreg, cfg->statreg, cfg->cachelnsz);
|
||||
printf("\tlattimer=0x%02x (%d ns), mingnt=0x%02x (%d ns), maxlat=0x%02x (%d ns)\n",
|
||||
cfg->lattimer, cfg->lattimer * 30,
|
||||
cfg->mingnt, cfg->mingnt * 250, cfg->maxlat, cfg->maxlat * 250);
|
||||
#endif /* PCI_DEBUG */
|
||||
if (cfg->intpin > 0)
|
||||
printf("\tintpin=%c, irq=%d\n", cfg->intpin +'a' -1, cfg->intline);
|
||||
|
||||
for (i = 0; i < cfg->nummaps; i++) {
|
||||
pcimap *m = &cfg->map[i];
|
||||
printf("\tmap[%d]: type %x, range %2d, base %08x, size %2d\n",
|
||||
i, m->type, m->ln2range, m->base, m->ln2size);
|
||||
}
|
||||
}
|
||||
pci_drvattach(dinfo); /* XXX currently defined in pci_compat.c */
|
||||
}
|
||||
|
||||
/* scan one PCI bus for devices */
|
||||
|
||||
static int
|
||||
pci_probebus(int bus)
|
||||
{
|
||||
pcicfgregs probe;
|
||||
int bushigh = bus;
|
||||
|
||||
#ifdef SIMOS
|
||||
#undef PCI_SLOTMAX
|
||||
#define PCI_SLOTMAX 0
|
||||
#endif
|
||||
|
||||
bzero(&probe, sizeof probe);
|
||||
/* XXX KDM */
|
||||
/* probe.parent = pci_bridgeto(bus); */
|
||||
probe.bus = bus;
|
||||
for (probe.slot = 0; probe.slot <= PCI_SLOTMAX; probe.slot++) {
|
||||
int pcifunchigh = 0;
|
||||
for (probe.func = 0; probe.func <= pcifunchigh; probe.func++) {
|
||||
struct pci_devinfo *dinfo = pci_readcfg(&probe);
|
||||
if (dinfo != NULL) {
|
||||
if (dinfo->cfg.mfdev)
|
||||
pcifunchigh = 7;
|
||||
/*
|
||||
* XXX: Temporarily move pci_addcfg() up before
|
||||
* the use of cfg->subordinatebus. This is
|
||||
* necessary, since pci_addcfg() calls the
|
||||
* device's probe(), which may read the bus#
|
||||
* from some device dependent register of
|
||||
* some host to PCI bridges. The probe will
|
||||
* eventually be moved to pci_readcfg(), and
|
||||
* pci_addcfg() will then be moved back down
|
||||
* below the conditional statement ...
|
||||
*/
|
||||
pci_addcfg(dinfo);
|
||||
|
||||
if (bushigh < dinfo->cfg.subordinatebus)
|
||||
bushigh = dinfo->cfg.subordinatebus;
|
||||
if (bushigh < dinfo->cfg.secondarybus)
|
||||
bushigh = dinfo->cfg.secondarybus;
|
||||
|
||||
/* XXX KDM */
|
||||
/* cfg = NULL; we don't own this anymore ... */
|
||||
}
|
||||
}
|
||||
}
|
||||
return (bushigh);
|
||||
}
|
||||
|
||||
/* scan a PCI bus tree reached through one PCI attachment point */
|
||||
|
||||
int
|
||||
pci_probe(pciattach *parent)
|
||||
{
|
||||
int bushigh;
|
||||
int bus = 0;
|
||||
|
||||
STAILQ_INIT(&pci_devq);
|
||||
|
||||
bushigh = pci_bushigh();
|
||||
while (bus <= bushigh) {
|
||||
int newbushigh;
|
||||
|
||||
printf("Probing for devices on PCI bus %d:\n", bus);
|
||||
newbushigh = pci_probebus(bus);
|
||||
|
||||
if (bushigh < newbushigh)
|
||||
bushigh = newbushigh;
|
||||
bus++;
|
||||
}
|
||||
return (bushigh);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is the user interface to PCI configuration space.
|
||||
*/
|
||||
|
@ -750,8 +649,8 @@ pci_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
|||
"pci_match_conf) (%d)\npci_ioctl: "
|
||||
"pat_buf_len should be = %d\n",
|
||||
cio->pat_buf_len, cio->num_patterns,
|
||||
sizeof(struct pci_match_conf),
|
||||
sizeof(struct pci_match_conf) *
|
||||
(int)sizeof(struct pci_match_conf),
|
||||
(int)sizeof(struct pci_match_conf) *
|
||||
cio->num_patterns);
|
||||
printf("pci_ioctl: do your headers match your "
|
||||
"kernel?\n");
|
||||
|
@ -945,4 +844,534 @@ pci_cdevinit(void *dummy)
|
|||
|
||||
SYSINIT(pcidev, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+PCI_CDEV, pci_cdevinit, NULL);
|
||||
|
||||
#include "pci_if.h"
|
||||
|
||||
/*
|
||||
* A simple driver to wrap the old pci driver mechanism for back-compat.
|
||||
*/
|
||||
|
||||
static int
|
||||
pci_compat_probe(device_t dev)
|
||||
{
|
||||
struct pci_device *dvp;
|
||||
struct pci_devinfo *dinfo;
|
||||
pcicfgregs *cfg;
|
||||
const char *name;
|
||||
int error;
|
||||
|
||||
dinfo = device_get_ivars(dev);
|
||||
cfg = &dinfo->cfg;
|
||||
dvp = device_get_driver(dev)->priv;
|
||||
|
||||
/*
|
||||
* Do the wrapped probe.
|
||||
*/
|
||||
error = ENXIO;
|
||||
if (dvp && dvp->pd_probe) {
|
||||
name = dvp->pd_probe(cfg, (cfg->device << 16) + cfg->vendor);
|
||||
if (name) {
|
||||
device_set_desc_copy(dev, name);
|
||||
error = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static int
|
||||
pci_compat_attach(device_t dev)
|
||||
{
|
||||
struct pci_device *dvp;
|
||||
struct pci_devinfo *dinfo;
|
||||
pcicfgregs *cfg;
|
||||
int unit;
|
||||
|
||||
dinfo = device_get_ivars(dev);
|
||||
cfg = &dinfo->cfg;
|
||||
dvp = device_get_driver(dev)->priv;
|
||||
|
||||
unit = device_get_unit(dev);
|
||||
if (unit > *dvp->pd_count)
|
||||
*dvp->pd_count = unit;
|
||||
if (dvp->pd_attach)
|
||||
dvp->pd_attach(cfg, unit);
|
||||
|
||||
/*
|
||||
* XXX KDM for some devices, dvp->pd_name winds up NULL.
|
||||
* I haven't investigated enough to figure out why this
|
||||
* would happen.
|
||||
*/
|
||||
if (dvp->pd_name != NULL)
|
||||
strncpy(dinfo->conf.pd_name, dvp->pd_name,
|
||||
sizeof(dinfo->conf.pd_name));
|
||||
else
|
||||
strncpy(dinfo->conf.pd_name, "????",
|
||||
sizeof(dinfo->conf.pd_name));
|
||||
dinfo->conf.pd_name[sizeof(dinfo->conf.pd_name) - 1] = 0;
|
||||
dinfo->conf.pd_unit = unit;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static device_method_t pci_compat_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, pci_compat_probe),
|
||||
DEVMETHOD(device_attach, pci_compat_attach),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static devclass_t pci_devclass;
|
||||
|
||||
/*
|
||||
* Create a new style driver around each old pci driver.
|
||||
*/
|
||||
static void
|
||||
pci_wrap_old_drivers(void)
|
||||
{
|
||||
struct pci_device **dvpp, *dvp;
|
||||
|
||||
dvpp = (struct pci_device **)pcidevice_set.ls_items;
|
||||
while ((dvp = *dvpp++) != NULL) {
|
||||
driver_t *driver;
|
||||
driver = malloc(sizeof(driver_t), M_DEVBUF, M_NOWAIT);
|
||||
if (!driver)
|
||||
continue;
|
||||
bzero(driver, sizeof(driver_t));
|
||||
driver->name = dvp->pd_name;
|
||||
driver->methods = pci_compat_methods;
|
||||
driver->type = 0; /* XXX fixup in pci_map_int() */
|
||||
driver->softc = sizeof(struct pci_devinfo *);
|
||||
driver->priv = dvp;
|
||||
devclass_add_driver(pci_devclass, driver);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* New style pci driver. Parent device is either a pci-host-bridge or a
|
||||
* pci-pci-bridge. Both kinds are represented by instances of pcib.
|
||||
*/
|
||||
|
||||
static void
|
||||
pci_print_verbose(struct pci_devinfo *dinfo)
|
||||
{
|
||||
if (bootverbose) {
|
||||
int i;
|
||||
pcicfgregs *cfg = &dinfo->cfg;
|
||||
|
||||
printf("found->\tvendor=0x%04x, dev=0x%04x, revid=0x%02x\n",
|
||||
cfg->vendor, cfg->device, cfg->revid);
|
||||
printf("\tclass=%02x-%02x-%02x, hdrtype=0x%02x, mfdev=%d\n",
|
||||
cfg->baseclass, cfg->subclass, cfg->progif,
|
||||
cfg->hdrtype, cfg->mfdev);
|
||||
printf("\tsubordinatebus=%x \tsecondarybus=%x\n",
|
||||
cfg->subordinatebus, cfg->secondarybus);
|
||||
#ifdef PCI_DEBUG
|
||||
printf("\tcmdreg=0x%04x, statreg=0x%04x, cachelnsz=%d (dwords)\n",
|
||||
cfg->cmdreg, cfg->statreg, cfg->cachelnsz);
|
||||
printf("\tlattimer=0x%02x (%d ns), mingnt=0x%02x (%d ns), maxlat=0x%02x (%d ns)\n",
|
||||
cfg->lattimer, cfg->lattimer * 30,
|
||||
cfg->mingnt, cfg->mingnt * 250, cfg->maxlat, cfg->maxlat * 250);
|
||||
#endif /* PCI_DEBUG */
|
||||
if (cfg->intpin > 0)
|
||||
printf("\tintpin=%c, irq=%d\n", cfg->intpin +'a' -1, cfg->intline);
|
||||
|
||||
for (i = 0; i < cfg->nummaps; i++) {
|
||||
pcimap *m = &cfg->map[i];
|
||||
printf("\tmap[%d]: type %x, range %2d, base %08x, size %2d\n",
|
||||
i, m->type, m->ln2range, m->base, m->ln2size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
pci_add_children(device_t dev, int busno)
|
||||
{
|
||||
pcicfgregs probe;
|
||||
int bushigh = busno;
|
||||
|
||||
#ifdef SIMOS
|
||||
#undef PCI_SLOTMAX
|
||||
#define PCI_SLOTMAX 0
|
||||
#endif
|
||||
|
||||
bzero(&probe, sizeof probe);
|
||||
/* XXX KDM */
|
||||
/* probe.parent = pci_bridgeto(bus); */
|
||||
probe.bus = busno;
|
||||
for (probe.slot = 0; probe.slot <= PCI_SLOTMAX; probe.slot++) {
|
||||
int pcifunchigh = 0;
|
||||
for (probe.func = 0; probe.func <= pcifunchigh; probe.func++) {
|
||||
struct pci_devinfo *dinfo = pci_readcfg(&probe);
|
||||
if (dinfo != NULL) {
|
||||
if (dinfo->cfg.mfdev)
|
||||
pcifunchigh = 7;
|
||||
|
||||
pci_print_verbose(dinfo);
|
||||
dinfo->cfg.dev =
|
||||
device_add_child(dev, NULL, -1, dinfo);
|
||||
|
||||
if (bushigh < dinfo->cfg.subordinatebus)
|
||||
bushigh = dinfo->cfg.subordinatebus;
|
||||
if (bushigh < dinfo->cfg.secondarybus)
|
||||
bushigh = dinfo->cfg.secondarybus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bushigh;
|
||||
}
|
||||
|
||||
static int
|
||||
pci_new_probe(device_t dev)
|
||||
{
|
||||
STAILQ_INIT(&pci_devq);
|
||||
device_set_desc(dev, "PCI bus");
|
||||
|
||||
pci_add_children(dev, device_get_unit(dev));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
pci_print_child(device_t dev, device_t child)
|
||||
{
|
||||
printf(" at device %d.%d", pci_get_slot(child), pci_get_function(child));
|
||||
printf(" on %s%d", device_get_name(dev), device_get_unit(dev));
|
||||
}
|
||||
|
||||
static int
|
||||
pci_read_ivar(device_t dev, device_t child, int which, u_long *result)
|
||||
{
|
||||
struct pci_devinfo *dinfo;
|
||||
pcicfgregs *cfg;
|
||||
|
||||
dinfo = device_get_ivars(child);
|
||||
cfg = &dinfo->cfg;
|
||||
|
||||
switch (which) {
|
||||
case PCI_IVAR_SUBVENDOR:
|
||||
*result = cfg->subvendor;
|
||||
break;
|
||||
case PCI_IVAR_SUBDEVICE:
|
||||
*result = cfg->subdevice;
|
||||
break;
|
||||
case PCI_IVAR_VENDOR:
|
||||
*result = cfg->vendor;
|
||||
break;
|
||||
case PCI_IVAR_DEVICE:
|
||||
*result = cfg->device;
|
||||
break;
|
||||
case PCI_IVAR_DEVID:
|
||||
*result = (cfg->device << 16) | cfg->vendor;
|
||||
break;
|
||||
case PCI_IVAR_CLASS:
|
||||
*result = cfg->baseclass;
|
||||
break;
|
||||
case PCI_IVAR_SUBCLASS:
|
||||
*result = cfg->subclass;
|
||||
break;
|
||||
case PCI_IVAR_PROGIF:
|
||||
*result = cfg->progif;
|
||||
break;
|
||||
case PCI_IVAR_REVID:
|
||||
*result = cfg->revid;
|
||||
break;
|
||||
case PCI_IVAR_INTPIN:
|
||||
*result = cfg->intpin;
|
||||
break;
|
||||
case PCI_IVAR_IRQ:
|
||||
*result = cfg->intline;
|
||||
break;
|
||||
case PCI_IVAR_BUS:
|
||||
*result = cfg->bus;
|
||||
break;
|
||||
case PCI_IVAR_SLOT:
|
||||
*result = cfg->slot;
|
||||
break;
|
||||
case PCI_IVAR_FUNCTION:
|
||||
*result = cfg->func;
|
||||
break;
|
||||
case PCI_IVAR_SECONDARYBUS:
|
||||
*result = cfg->secondarybus;
|
||||
break;
|
||||
case PCI_IVAR_SUBORDINATEBUS:
|
||||
*result = cfg->subordinatebus;
|
||||
break;
|
||||
default:
|
||||
return ENOENT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pci_write_ivar(device_t dev, device_t child, int which, uintptr_t value)
|
||||
{
|
||||
struct pci_devinfo *dinfo;
|
||||
pcicfgregs *cfg;
|
||||
|
||||
dinfo = device_get_ivars(child);
|
||||
cfg = &dinfo->cfg;
|
||||
|
||||
switch (which) {
|
||||
case PCI_IVAR_SUBVENDOR:
|
||||
case PCI_IVAR_SUBDEVICE:
|
||||
case PCI_IVAR_VENDOR:
|
||||
case PCI_IVAR_DEVICE:
|
||||
case PCI_IVAR_DEVID:
|
||||
case PCI_IVAR_CLASS:
|
||||
case PCI_IVAR_SUBCLASS:
|
||||
case PCI_IVAR_PROGIF:
|
||||
case PCI_IVAR_REVID:
|
||||
case PCI_IVAR_INTPIN:
|
||||
case PCI_IVAR_IRQ:
|
||||
case PCI_IVAR_BUS:
|
||||
case PCI_IVAR_SLOT:
|
||||
case PCI_IVAR_FUNCTION:
|
||||
return EINVAL; /* disallow for now */
|
||||
|
||||
case PCI_IVAR_SECONDARYBUS:
|
||||
cfg->secondarybus = value;
|
||||
break;
|
||||
case PCI_IVAR_SUBORDINATEBUS:
|
||||
cfg->subordinatebus = value;
|
||||
break;
|
||||
default:
|
||||
return ENOENT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
pci_mapno(pcicfgregs *cfg, int reg)
|
||||
{
|
||||
int i, nummaps;
|
||||
pcimap *map;
|
||||
|
||||
nummaps = cfg->nummaps;
|
||||
map = cfg->map;
|
||||
|
||||
for (i = 0; i < nummaps; i++)
|
||||
if (map[i].reg == reg)
|
||||
return (i);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_porten(pcicfgregs *cfg)
|
||||
{
|
||||
return ((cfg->cmdreg & PCIM_CMD_PORTEN) != 0);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_isportmap(pcicfgregs *cfg, int map)
|
||||
|
||||
{
|
||||
return ((unsigned)map < cfg->nummaps
|
||||
&& (cfg->map[map].type & PCI_MAPPORT) != 0);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_memen(pcicfgregs *cfg)
|
||||
{
|
||||
return ((cfg->cmdreg & PCIM_CMD_MEMEN) != 0);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_ismemmap(pcicfgregs *cfg, int map)
|
||||
{
|
||||
return ((unsigned)map < cfg->nummaps
|
||||
&& (cfg->map[map].type & PCI_MAPMEM) != 0);
|
||||
}
|
||||
|
||||
static struct resource *
|
||||
pci_alloc_resource(device_t dev, device_t child, int type, int *rid,
|
||||
u_long start, u_long end, u_long count, u_int flags)
|
||||
{
|
||||
int isdefault;
|
||||
struct pci_devinfo *dinfo = device_get_ivars(child);
|
||||
pcicfgregs *cfg = &dinfo->cfg;
|
||||
struct resource *rv, **rvp = 0;
|
||||
int map;
|
||||
|
||||
isdefault = (device_get_parent(child) == dev
|
||||
&& start == 0UL && end == ~0UL && count == 1);
|
||||
|
||||
switch (type) {
|
||||
case SYS_RES_IRQ:
|
||||
if (*rid != 0)
|
||||
return 0;
|
||||
if (isdefault && cfg->intline != 255) {
|
||||
start = cfg->intline;
|
||||
end = cfg->intline;
|
||||
count = 1;
|
||||
}
|
||||
break;
|
||||
|
||||
case SYS_RES_DRQ: /* passthru for child isa */
|
||||
break;
|
||||
|
||||
case SYS_RES_MEMORY:
|
||||
if (isdefault) {
|
||||
map = pci_mapno(cfg, *rid);
|
||||
if (pci_memen(cfg) && pci_ismemmap(cfg, map)) {
|
||||
start = cfg->map[map].base;
|
||||
count = 1 << cfg->map[map].ln2size;
|
||||
end = start + count;
|
||||
rvp = &cfg->map[map].res;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case SYS_RES_IOPORT:
|
||||
if (isdefault) {
|
||||
map = pci_mapno(cfg, *rid);
|
||||
if (pci_porten(cfg) && pci_isportmap(cfg, map)) {
|
||||
start = cfg->map[map].base;
|
||||
count = 1 << cfg->map[map].ln2size;
|
||||
end = start + count;
|
||||
rvp = &cfg->map[map].res;
|
||||
} else
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
rv = BUS_ALLOC_RESOURCE(device_get_parent(dev), child,
|
||||
type, rid, start, end, count, flags);
|
||||
if (rvp)
|
||||
*rvp = rv;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
pci_release_resource(device_t dev, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
int rv;
|
||||
struct pci_devinfo *dinfo = device_get_ivars(child);
|
||||
pcicfgregs *cfg = &dinfo->cfg;
|
||||
int map = 0;
|
||||
|
||||
switch (type) {
|
||||
case SYS_RES_IRQ:
|
||||
if (rid != 0)
|
||||
return EINVAL;
|
||||
break;
|
||||
|
||||
case SYS_RES_DRQ: /* passthru for child isa */
|
||||
break;
|
||||
|
||||
case SYS_RES_MEMORY:
|
||||
case SYS_RES_IOPORT:
|
||||
/*
|
||||
* Only check the map registers if this is a direct
|
||||
* descendant.
|
||||
*/
|
||||
if (device_get_parent(child) == dev)
|
||||
map = pci_mapno(cfg, rid);
|
||||
else
|
||||
map = -1;
|
||||
break;
|
||||
|
||||
default:
|
||||
return (ENOENT);
|
||||
}
|
||||
|
||||
rv = BUS_RELEASE_RESOURCE(device_get_parent(dev), child, type, rid, r);
|
||||
|
||||
if (rv == 0) {
|
||||
switch (type) {
|
||||
case SYS_RES_IRQ:
|
||||
cfg->irqres = 0;
|
||||
break;
|
||||
|
||||
case SYS_RES_DRQ: /* passthru for child isa */
|
||||
break;
|
||||
|
||||
case SYS_RES_MEMORY:
|
||||
case SYS_RES_IOPORT:
|
||||
if (map != -1)
|
||||
cfg->map[map].res = 0;
|
||||
break;
|
||||
|
||||
default:
|
||||
return ENOENT;
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
static u_int32_t
|
||||
pci_read_config_method(device_t dev, device_t child, int reg, int width)
|
||||
{
|
||||
struct pci_devinfo *dinfo = device_get_ivars(child);
|
||||
pcicfgregs *cfg = &dinfo->cfg;
|
||||
return pci_cfgread(cfg, reg, width);
|
||||
}
|
||||
|
||||
static void
|
||||
pci_write_config_method(device_t dev, device_t child, int reg,
|
||||
u_int32_t val, int width)
|
||||
{
|
||||
struct pci_devinfo *dinfo = device_get_ivars(child);
|
||||
pcicfgregs *cfg = &dinfo->cfg;
|
||||
pci_cfgwrite(cfg, reg, val, width);
|
||||
}
|
||||
|
||||
static int
|
||||
pci_modevent(module_t mod, int what, void *arg)
|
||||
{
|
||||
switch (what) {
|
||||
case MOD_LOAD:
|
||||
pci_wrap_old_drivers();
|
||||
break;
|
||||
|
||||
case MOD_UNLOAD:
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static device_method_t pci_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, pci_new_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, pci_print_child),
|
||||
DEVMETHOD(bus_read_ivar, pci_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, pci_write_ivar),
|
||||
DEVMETHOD(bus_driver_added, bus_generic_driver_added),
|
||||
DEVMETHOD(bus_alloc_resource, pci_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, pci_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
/* PCI interface */
|
||||
DEVMETHOD(pci_read_config, pci_read_config_method),
|
||||
DEVMETHOD(pci_write_config, pci_write_config_method),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t pci_driver = {
|
||||
"pci",
|
||||
pci_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1, /* no softc */
|
||||
};
|
||||
|
||||
DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, 0);
|
||||
|
||||
#endif /* NPCI > 0 */
|
||||
|
|
44
sys/dev/pci/pci_if.m
Normal file
44
sys/dev/pci/pci_if.m
Normal file
|
@ -0,0 +1,44 @@
|
|||
#
|
||||
# Copyright (c) 1998 Doug Rabson
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (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$
|
||||
#
|
||||
|
||||
INTERFACE pci;
|
||||
|
||||
METHOD u_int32_t read_config {
|
||||
device_t dev;
|
||||
device_t child;
|
||||
int reg;
|
||||
int width;
|
||||
};
|
||||
|
||||
METHOD void write_config {
|
||||
device_t dev;
|
||||
device_t child;
|
||||
int reg;
|
||||
u_int32_t val;
|
||||
int width;
|
||||
};
|
|
@ -26,7 +26,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: pcireg.h,v 1.19 1997/09/20 07:41:58 dyson Exp $
|
||||
* $Id: pcireg.h,v 1.20 1998/10/07 03:40:51 gibbs Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -173,7 +173,7 @@
|
|||
#define PCIS_MEMORY_OTHER 0x80
|
||||
|
||||
#define PCIC_BRIDGE 0x06
|
||||
#define PCIS_BRDIGE_HOST 0x00
|
||||
#define PCIS_BRIDGE_HOST 0x00
|
||||
#define PCIS_BRIDGE_ISA 0x01
|
||||
#define PCIS_BRIDGE_EISA 0x02
|
||||
#define PCIS_BRIDGE_MCA 0x03
|
||||
|
|
|
@ -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: pcivar.h,v 1.24 1999/01/13 04:59:19 bde Exp $
|
||||
* $Id: pcivar.h,v 1.25 1999/01/19 23:29:20 se Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -67,13 +67,17 @@ typedef struct {
|
|||
u_int8_t ln2size;
|
||||
u_int8_t ln2range;
|
||||
u_int8_t reg; /* offset of map register in config space */
|
||||
/* u_int8_t dummy;*/
|
||||
struct resource *res; /* handle from resource manager */
|
||||
} pcimap;
|
||||
|
||||
/* config header information common to all header types */
|
||||
|
||||
typedef struct pcicfg {
|
||||
struct device *dev; /* device which owns this */
|
||||
pcimap *map; /* pointer to array of PCI maps */
|
||||
void *hdrspec; /* pointer to header type specific data */
|
||||
struct resource *irqres; /* resource descriptor for interrupt mapping */
|
||||
|
||||
u_int16_t subvendor; /* card vendor ID */
|
||||
u_int16_t subdevice; /* card device ID, assigned by card vendor */
|
||||
|
@ -182,6 +186,79 @@ void pci_cfgwrite (pcicfgregs *cfg, int reg, int data, int bytes);
|
|||
vm_offset_t pci_cvt_to_dense (vm_offset_t);
|
||||
vm_offset_t pci_cvt_to_bwx (vm_offset_t);
|
||||
#endif /* __alpha__ */
|
||||
|
||||
#ifdef _SYS_BUS_H_
|
||||
|
||||
#include "pci_if.h"
|
||||
|
||||
enum pci_device_ivars {
|
||||
PCI_IVAR_SUBVENDOR,
|
||||
PCI_IVAR_SUBDEVICE,
|
||||
PCI_IVAR_VENDOR,
|
||||
PCI_IVAR_DEVICE,
|
||||
PCI_IVAR_DEVID,
|
||||
PCI_IVAR_CLASS,
|
||||
PCI_IVAR_SUBCLASS,
|
||||
PCI_IVAR_PROGIF,
|
||||
PCI_IVAR_REVID,
|
||||
PCI_IVAR_INTPIN,
|
||||
PCI_IVAR_IRQ,
|
||||
PCI_IVAR_BUS,
|
||||
PCI_IVAR_SLOT,
|
||||
PCI_IVAR_FUNCTION,
|
||||
PCI_IVAR_SECONDARYBUS,
|
||||
PCI_IVAR_SUBORDINATEBUS,
|
||||
};
|
||||
|
||||
/*
|
||||
* Simplified accessors for pci devices
|
||||
*/
|
||||
#define PCI_ACCESSOR(A, B, T) \
|
||||
\
|
||||
static __inline T pci_get_ ## A(device_t dev) \
|
||||
{ \
|
||||
uintptr_t v; \
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, PCI_IVAR_ ## B, &v); \
|
||||
return (T) v; \
|
||||
} \
|
||||
\
|
||||
static __inline void pci_set_ ## A(device_t dev, T t) \
|
||||
{ \
|
||||
u_long v = (u_long) t; \
|
||||
BUS_WRITE_IVAR(device_get_parent(dev), dev, PCI_IVAR_ ## B, v); \
|
||||
}
|
||||
|
||||
PCI_ACCESSOR(subvendor, SUBVENDOR, u_int16_t)
|
||||
PCI_ACCESSOR(subdevice, SUBDEVICE, u_int16_t)
|
||||
PCI_ACCESSOR(vendor, VENDOR, u_int16_t)
|
||||
PCI_ACCESSOR(device, DEVICE, u_int16_t)
|
||||
PCI_ACCESSOR(devid, DEVID, u_int32_t)
|
||||
PCI_ACCESSOR(class, CLASS, u_int8_t)
|
||||
PCI_ACCESSOR(subclass, SUBCLASS, u_int8_t)
|
||||
PCI_ACCESSOR(progif, PROGIF, u_int8_t)
|
||||
PCI_ACCESSOR(revid, REVID, u_int8_t)
|
||||
PCI_ACCESSOR(intpin, INTPIN, u_int8_t)
|
||||
PCI_ACCESSOR(irq, IRQ, u_int8_t)
|
||||
PCI_ACCESSOR(bus, BUS, u_int8_t)
|
||||
PCI_ACCESSOR(slot, SLOT, u_int8_t)
|
||||
PCI_ACCESSOR(function, FUNCTION, u_int8_t)
|
||||
PCI_ACCESSOR(secondarybus, SECONDARYBUS, u_int8_t)
|
||||
PCI_ACCESSOR(subordinatebus, SUBORDINATEBUS, u_int8_t)
|
||||
|
||||
static __inline u_int32_t
|
||||
pci_read_config(device_t dev, int reg, int width)
|
||||
{
|
||||
return PCI_READ_CONFIG(device_get_parent(dev), dev, reg, width);
|
||||
}
|
||||
|
||||
static __inline void
|
||||
pci_write_config(device_t dev, int reg, u_int32_t val, int width)
|
||||
{
|
||||
PCI_WRITE_CONFIG(device_get_parent(dev), dev, reg, val, width);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* for compatibility to FreeBSD-2.2 version of PCI code */
|
||||
|
||||
#ifdef PCI_COMPAT
|
||||
|
|
|
@ -1180,7 +1180,6 @@ int
|
|||
rpattach(dev)
|
||||
struct isa_device *dev;
|
||||
{
|
||||
struct isa_device *idev;
|
||||
dev_t rp_dev;
|
||||
int iobase, unit, /*rpmajor,*/ oldspl;
|
||||
int num_ports, num_chan, num_aiops;
|
||||
|
@ -1280,13 +1279,6 @@ struct isa_device *dev;
|
|||
}
|
||||
}
|
||||
|
||||
idev = find_isadev(isa_devtab_tty, &rpdriver,
|
||||
RP_MPMASTER(dev) + rp_pcicount);
|
||||
if(idev == NULL) {
|
||||
printf("rp%d: master device %d not configured\n",
|
||||
dev->id_unit, RP_MPMASTER(dev));
|
||||
}
|
||||
/* printf("COOL!! Device is found!!\n");
|
||||
for(rpmajor=0;rpmajor<nchrdev;rpmajor++)
|
||||
if(cdevsw[rpmajor].d_open == rpopen)
|
||||
printf("From %d entries: Found entry at major = %d\n",nchrdev,rpmajor);
|
||||
|
|
|
@ -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.220 1999/01/19 00:21:47 peter Exp $
|
||||
* $Id: sio.c,v 1.221 1999/01/30 12:17:35 phk 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 <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#ifdef DEVFS
|
||||
#include <sys/devfsext.h>
|
||||
|
@ -103,8 +104,10 @@
|
|||
|
||||
#endif
|
||||
|
||||
#ifndef __i386__
|
||||
#define disable_intr() 0
|
||||
#define enable_intr() 0
|
||||
#endif
|
||||
|
||||
#ifdef SMP
|
||||
#define disable_intr() COM_DISABLE_INTR()
|
||||
|
@ -2607,6 +2610,21 @@ static void siocnclose __P((struct siocnstate *sp, Port_t iobase));
|
|||
static void siocnopen __P((struct siocnstate *sp, Port_t iobase, int speed));
|
||||
static void siocntxwait __P((Port_t iobase));
|
||||
|
||||
#ifdef __i386__
|
||||
/*
|
||||
* XXX: sciocnget() and sciocnputc() are not declared static, as they are
|
||||
* referred to from i386/i386/i386-gdbstub.c.
|
||||
*/
|
||||
static cn_probe_t siocnprobe;
|
||||
static cn_init_t siocninit;
|
||||
static cn_checkc_t siocncheckc;
|
||||
cn_getc_t siocngetc;
|
||||
cn_putc_t siocnputc;
|
||||
|
||||
CONS_DRIVER(sio, siocnprobe, siocninit, siocngetc, siocncheckc, siocnputc);
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
siocntxwait(iobase)
|
||||
Port_t iobase;
|
||||
|
@ -2731,11 +2749,9 @@ void
|
|||
siocnprobe(cp)
|
||||
struct consdev *cp;
|
||||
{
|
||||
#if 0
|
||||
speed_t boot_speed;
|
||||
u_char cfcr;
|
||||
struct isa_device *dvp;
|
||||
int s;
|
||||
int s, unit;
|
||||
struct siocnstate sp;
|
||||
|
||||
/*
|
||||
|
@ -2753,10 +2769,16 @@ siocnprobe(cp)
|
|||
* don't need to probe.
|
||||
*/
|
||||
cp->cn_pri = CN_DEAD;
|
||||
for (dvp = isa_devtab_tty; dvp->id_driver != NULL; dvp++)
|
||||
if (dvp->id_driver == &siodriver && dvp->id_enabled
|
||||
&& COM_CONSOLE(dvp)) {
|
||||
siocniobase = dvp->id_iobase;
|
||||
|
||||
for (unit = 0; unit < 16; unit++) { /* XXX need to know how many */
|
||||
int flags;
|
||||
if (resource_int_value("sio", unit, "flags", &flags))
|
||||
continue;
|
||||
if (COM_CONSOLE(flags)) {
|
||||
int port;
|
||||
if (resource_int_value("sio", unit, "port", &port))
|
||||
continue;
|
||||
siocniobase = port;
|
||||
s = spltty();
|
||||
if (boothowto & RB_SERIAL) {
|
||||
boot_speed = siocngetspeed(siocniobase,
|
||||
|
@ -2784,17 +2806,19 @@ siocnprobe(cp)
|
|||
|
||||
siocnopen(&sp, siocniobase, comdefaultrate);
|
||||
splx(s);
|
||||
if (!COM_LLCONSOLE(dvp)) {
|
||||
cp->cn_dev = makedev(CDEV_MAJOR, dvp->id_unit);
|
||||
cp->cn_pri = COM_FORCECONSOLE(dvp)
|
||||
if (!COM_LLCONSOLE(flags)) {
|
||||
cp->cn_dev = makedev(CDEV_MAJOR, unit);
|
||||
cp->cn_pri = COM_FORCECONSOLE(flags)
|
||||
|| boothowto & RB_SERIAL
|
||||
? CN_REMOTE : CN_NORMAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __alpha__
|
||||
|
||||
struct consdev siocons = {
|
||||
NULL, NULL, siocngetc, siocncheckc, siocnputc,
|
||||
NULL, makedev(CDEV_MAJOR, 0), CN_NORMAL,
|
||||
|
@ -2877,6 +2901,8 @@ siogdbattach(port, speed)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
siocninit(cp)
|
||||
struct consdev *cp;
|
||||
|
@ -3158,7 +3184,6 @@ static void
|
|||
siopnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
||||
{
|
||||
struct pnp_cinfo d;
|
||||
struct isa_device *dvp;
|
||||
|
||||
if (dev->id_unit >= NSIOTOT)
|
||||
return;
|
||||
|
@ -3180,9 +3205,7 @@ siopnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
|||
|
||||
if (dev->id_driver == NULL) {
|
||||
dev->id_driver = &siodriver;
|
||||
dvp = find_isadev(isa_devtab_tty, &siodriver, 0);
|
||||
if (dvp != NULL)
|
||||
dev->id_id = dvp->id_id;
|
||||
dev->id_id = isa_compat_nextid();
|
||||
}
|
||||
|
||||
if ((dev->id_alive = sioprobe(dev)) != 0)
|
||||
|
|
|
@ -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.298 1999/02/05 11:52:11 yokota Exp $
|
||||
* $Id: syscons.c,v 1.299 1999/03/10 10:36:53 yokota Exp $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
|
@ -1869,6 +1869,7 @@ extern struct isa_driver scdriver;
|
|||
static void
|
||||
sccnprobe(struct consdev *cp)
|
||||
{
|
||||
#if 0
|
||||
struct isa_device *dvp;
|
||||
|
||||
/*
|
||||
|
@ -1885,6 +1886,13 @@ sccnprobe(struct consdev *cp)
|
|||
return;
|
||||
}
|
||||
sckbdprobe(dvp->id_unit, dvp->id_flags, TRUE);
|
||||
#else
|
||||
if (!scvidprobe(0, 0, TRUE)) {
|
||||
cp->cn_pri = CN_DEAD;
|
||||
return;
|
||||
}
|
||||
sckbdprobe(0, 0, TRUE);
|
||||
#endif
|
||||
|
||||
/* initialize required fields */
|
||||
cp->cn_dev = makedev(CDEV_MAJOR, SC_CONSOLE);
|
||||
|
|
|
@ -59,6 +59,10 @@
|
|||
#include <sys/queue.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
#include <machine/bus_pio.h>
|
||||
#include <machine/bus_memio.h>
|
||||
#endif
|
||||
#include <machine/bus.h>
|
||||
#include <machine/endian.h>
|
||||
|
||||
|
@ -162,15 +166,9 @@ void ohci_dump_td __P((ohci_soft_td_t *));
|
|||
void ohci_dump_ed __P((ohci_soft_ed_t *));
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#define OWRITE4(sc, r, x) bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x))
|
||||
#define OREAD4(sc, r) bus_space_read_4((sc)->iot, (sc)->ioh, (r))
|
||||
#define OREAD2(sc, r) bus_space_read_2((sc)->iot, (sc)->ioh, (r))
|
||||
#elif defined(__FreeBSD__)
|
||||
#define OWRITE4(sc, r, x) *(u_int32_t *) ((sc)->sc_iobase + (r)) = x
|
||||
#define OREAD4(sc, r) (*(u_int32_t *) ((sc)->sc_iobase + (r)))
|
||||
#define OREAD2(sc, r) (*(u_int16_t *) ((sc)->sc_iobase + (r)))
|
||||
#endif
|
||||
|
||||
/* Reverse the bits in a value 0 .. 31 */
|
||||
static u_int8_t revbits[OHCI_NO_INTRS] =
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
* USB spec: http://www.teleport.com/cgi-bin/mailmerge.cgi/~usb/cgiform.tpl
|
||||
*/
|
||||
|
||||
#include "opt_bus.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -52,23 +54,13 @@
|
|||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/queue.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <pci/pcivar.h>
|
||||
#include <pci/pcireg.h>
|
||||
|
||||
#define PCI_CLASS_SERIALBUS 0x0c000000
|
||||
#define PCI_SUBCLASS_COMMUNICATIONS_SERIAL 0x00000000
|
||||
#define PCI_SUBCLASS_SERIALBUS_FIREWIRE 0x00000000
|
||||
#define PCI_SUBCLASS_SERIALBUS_ACCESS 0x00010000
|
||||
#define PCI_SUBCLASS_SERIALBUS_SSA 0x00020000
|
||||
#define PCI_SUBCLASS_SERIALBUS_USB 0x00030000
|
||||
#define PCI_SUBCLASS_SERIALBUS_FIBER 0x00040000
|
||||
|
||||
#define PCI_INTERFACE(d) (((d) >> 8) & 0xff)
|
||||
#define PCI_SUBCLASS(d) ((d) & PCI_SUBCLASS_MASK)
|
||||
#define PCI_CLASS(d) ((d) & PCI_CLASS_MASK)
|
||||
|
||||
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usbdi.h>
|
||||
#include <dev/usb/usbdivar.h>
|
||||
|
@ -77,7 +69,6 @@
|
|||
#include <dev/usb/ohcireg.h>
|
||||
#include <dev/usb/ohcivar.h>
|
||||
|
||||
|
||||
#define PCI_OHCI_VENDORID_ALI 0x10b9
|
||||
#define PCI_OHCI_VENDORID_CMDTECH 0x1095
|
||||
#define PCI_OHCI_VENDORID_COMPAQ 0x0e11
|
||||
|
@ -98,27 +89,12 @@ static const char *ohci_device_usb0673 = "CMD Tech 673 (USB0673) USB Host Contr
|
|||
|
||||
static const char *ohci_device_generic = "OHCI (generic) USB Host Controller";
|
||||
|
||||
|
||||
static const char *ohci_pci_probe __P((pcici_t, pcidi_t));
|
||||
static void ohci_pci_attach __P((pcici_t, int));
|
||||
|
||||
static u_long ohci_count = 0;
|
||||
|
||||
static struct pci_device ohci_pci_device = {
|
||||
"ohci",
|
||||
ohci_pci_probe,
|
||||
ohci_pci_attach,
|
||||
&ohci_count,
|
||||
NULL
|
||||
};
|
||||
|
||||
DATA_SET(pcidevice_set, ohci_pci_device);
|
||||
|
||||
#define PCI_OHCI_BASE_REG 0x10
|
||||
|
||||
static const char *
|
||||
ohci_pci_probe(pcici_t config_id, pcidi_t device_id)
|
||||
ohci_pci_match(device_t dev)
|
||||
{
|
||||
u_int32_t class;
|
||||
u_int32_t device_id = pci_get_devid(dev);
|
||||
|
||||
switch(device_id) {
|
||||
case PCI_OHCI_DEVICEID_ALADDIN_V:
|
||||
|
@ -132,54 +108,72 @@ ohci_pci_probe(pcici_t config_id, pcidi_t device_id)
|
|||
case PCI_OHCI_DEVICEID_NEC:
|
||||
return (ohci_device_nec);
|
||||
default:
|
||||
class = pci_conf_read(config_id, PCI_CLASS_REG);
|
||||
if ( (PCI_CLASS(class) == PCI_CLASS_SERIALBUS)
|
||||
&& (PCI_SUBCLASS(class) == PCI_SUBCLASS_SERIALBUS_USB)
|
||||
&& (PCI_INTERFACE(class) == PCI_INTERFACE_OHCI)) {
|
||||
return(ohci_device_generic);
|
||||
if ( pci_get_class(dev) == PCIC_SERIALBUS
|
||||
&& pci_get_subclass(dev) == PCIS_SERIALBUS_USB
|
||||
&& pci_get_progif(dev) == PCI_INTERFACE_OHCI) {
|
||||
return (ohci_device_generic);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL; /* dunno */
|
||||
}
|
||||
|
||||
static void
|
||||
ohci_pci_attach(pcici_t config_id, int unit)
|
||||
static int
|
||||
ohci_pci_probe(device_t dev)
|
||||
{
|
||||
vm_offset_t pbase;
|
||||
device_t usbus;
|
||||
ohci_softc_t *sc;
|
||||
usbd_status err;
|
||||
int id;
|
||||
|
||||
sc = malloc(sizeof(ohci_softc_t), M_DEVBUF, M_NOWAIT);
|
||||
/* Do not free it below, intr might use the sc */
|
||||
if ( sc == NULL ) {
|
||||
printf("ohci%d: could not allocate memory", unit);
|
||||
return;
|
||||
const char *desc = ohci_pci_match(dev);
|
||||
if (desc) {
|
||||
device_set_desc(dev, desc);
|
||||
return 0;
|
||||
} else {
|
||||
return ENXIO;
|
||||
}
|
||||
memset(sc, 0, sizeof(ohci_softc_t));
|
||||
}
|
||||
|
||||
if(!pci_map_mem(config_id, PCI_CBMEM,
|
||||
(vm_offset_t *)&sc->sc_iobase, &pbase)) {
|
||||
printf("ohci%d: could not map memory\n", unit);
|
||||
return;
|
||||
static int
|
||||
ohci_pci_attach(device_t dev)
|
||||
{
|
||||
int unit = device_get_unit(dev);
|
||||
ohci_softc_t *sc = device_get_softc(dev);
|
||||
device_t usbus;
|
||||
usbd_status err;
|
||||
int rid;
|
||||
struct resource *res;
|
||||
void *ih;
|
||||
int error;
|
||||
|
||||
rid = PCI_CBMEM;
|
||||
res = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,
|
||||
0, ~0, 1, RF_ACTIVE);
|
||||
if (!res) {
|
||||
device_printf(dev, "could not map memory\n");
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
if ( !pci_map_int(config_id, (pci_inthand_t *)ohci_intr,
|
||||
(void *) sc, &bio_imask)) {
|
||||
printf("ohci%d: could not map irq\n", unit);
|
||||
return;
|
||||
sc->iot = rman_get_bustag(res);
|
||||
sc->ioh = rman_get_bushandle(res);
|
||||
|
||||
rid = 0;
|
||||
res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
|
||||
RF_SHAREABLE | RF_ACTIVE);
|
||||
if (res == NULL) {
|
||||
device_printf(dev, "could not allocate irq\n");
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
usbus = device_add_child(root_bus, "usb", -1, sc);
|
||||
error = bus_setup_intr(dev, res, (driver_intr_t *) ohci_intr, sc, &ih);
|
||||
if (error) {
|
||||
device_printf(dev, "could not setup irq\n");
|
||||
return error;
|
||||
}
|
||||
|
||||
usbus = device_add_child(dev, "usb", -1, sc);
|
||||
if (!usbus) {
|
||||
printf("ohci%d: could not add USB device to root bus\n", unit);
|
||||
return;
|
||||
printf("ohci%d: could not add USB device\n", unit);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
id = pci_conf_read(config_id, PCI_ID_REG);
|
||||
switch(id) {
|
||||
switch (pci_get_devid(dev)) {
|
||||
case PCI_OHCI_DEVICEID_ALADDIN_V:
|
||||
device_set_desc(usbus, ohci_device_aladdin_v);
|
||||
sprintf(sc->sc_vendor, "AcerLabs");
|
||||
|
@ -202,7 +196,7 @@ ohci_pci_attach(pcici_t config_id, int unit)
|
|||
break;
|
||||
default:
|
||||
if (bootverbose)
|
||||
printf("(New OHCI DeviceId=0x%08x)\n", id);
|
||||
printf("(New OHCI DeviceId=0x%08x)\n", pci_get_devid(dev));
|
||||
device_set_desc(usbus, ohci_device_generic);
|
||||
sprintf(sc->sc_vendor, "(unknown)");
|
||||
}
|
||||
|
@ -211,8 +205,36 @@ ohci_pci_attach(pcici_t config_id, int unit)
|
|||
err = ohci_init(sc);
|
||||
if (err != USBD_NORMAL_COMPLETION) {
|
||||
printf("ohci%d: init failed, error=%d\n", unit, err);
|
||||
device_delete_child(root_bus, usbus);
|
||||
device_delete_child(dev, usbus);
|
||||
}
|
||||
|
||||
return;
|
||||
return device_probe_and_attach(sc->sc_bus.bdev);
|
||||
}
|
||||
|
||||
static device_method_t ohci_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, ohci_pci_probe),
|
||||
DEVMETHOD(device_attach, ohci_pci_attach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t ohci_driver = {
|
||||
"ohci",
|
||||
ohci_methods,
|
||||
DRIVER_TYPE_BIO,
|
||||
sizeof(ohci_softc_t),
|
||||
};
|
||||
|
||||
static devclass_t ohci_devclass;
|
||||
|
||||
DRIVER_MODULE(ohci, pci, ohci_driver, ohci_devclass, 0, 0);
|
||||
|
|
|
@ -72,7 +72,8 @@ typedef struct ohci_softc {
|
|||
/* XXX should keep track of all DMA memory */
|
||||
|
||||
#elif defined(__FreeBSD__)
|
||||
int sc_iobase;
|
||||
bus_space_tag_t iot;
|
||||
bus_space_handle_t ioh;
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
usb_dma_t sc_hccadma;
|
||||
|
|
|
@ -126,13 +126,8 @@ USB_ATTACH(ucom)
|
|||
static int
|
||||
ucom_detach(device_t self)
|
||||
{
|
||||
const char *devinfo = device_get_desc(self);
|
||||
|
||||
DPRINTF(("%s: disconnected\n", USBDEVNAME(self)));
|
||||
if (devinfo) {
|
||||
device_set_desc(self, NULL);
|
||||
free((void *)devinfo, M_USB);
|
||||
}
|
||||
device_set_desc(self, NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -992,13 +992,8 @@ ugenpoll(dev, events, p)
|
|||
static int
|
||||
ugen_detach(device_t self)
|
||||
{
|
||||
const char *devinfo = device_get_desc(self);
|
||||
|
||||
DPRINTF(("%s: disconnected\n", USBDEVNAME(self)));
|
||||
if (devinfo) {
|
||||
device_set_desc(self, NULL);
|
||||
free((void *)devinfo, M_USB);
|
||||
}
|
||||
device_set_desc(self, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,6 +63,9 @@ cgiform.tpl
|
|||
#include <sys/queue.h>
|
||||
#include <sys/select.h>
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
#include <machine/bus_pio.h>
|
||||
#endif
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <dev/usb/usb.h>
|
||||
|
@ -225,11 +228,11 @@ void uhci_dump_td __P((uhci_soft_td_t *));
|
|||
#define UREAD2(sc, r) bus_space_read_2((sc)->iot, (sc)->ioh, (r))
|
||||
#define UREAD4(sc, r) bus_space_read_4((sc)->iot, (sc)->ioh, (r))
|
||||
#elif defined(__FreeBSD__)
|
||||
#define UWRITE2(sc,r,x) outw((sc)->sc_iobase + (r), (x))
|
||||
#define UWRITE4(sc,r,x) outl((sc)->sc_iobase + (r), (x))
|
||||
#define UREAD1(sc,r) inb((sc)->sc_iobase + (r))
|
||||
#define UREAD2(sc,r) inw((sc)->sc_iobase + (r))
|
||||
#define UREAD4(sc,r) inl((sc)->sc_iobase + (r))
|
||||
#define UWRITE2(sc, r, x) bus_space_write_2((sc)->iot, (sc)->ioh, (r), (x))
|
||||
#define UWRITE4(sc, r, x) bus_space_write_4((sc)->iot, (sc)->ioh, (r), (x))
|
||||
#define UREAD1(sc, r) bus_space_read_1((sc)->iot, (sc)->ioh, (r))
|
||||
#define UREAD2(sc, r) bus_space_read_2((sc)->iot, (sc)->ioh, (r))
|
||||
#define UREAD4(sc, r) bus_space_read_4((sc)->iot, (sc)->ioh, (r))
|
||||
#endif
|
||||
|
||||
#define UHCICMD(sc, cmd) UWRITE2(sc, UHCI_CMD, cmd)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* FreeBSD $Id: uhci_pci.c,v 1.4 1999/04/06 23:09:58 n_hibma Exp $ */
|
||||
/* FreeBSD $Id: uhci_pci.c,v 1.5 1999/04/11 14:24:20 n_hibma Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
|
@ -37,6 +37,8 @@
|
|||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "opt_bus.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -45,23 +47,13 @@
|
|||
#include <sys/device.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/queue.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <pci/pcivar.h>
|
||||
#include <pci/pcireg.h>
|
||||
|
||||
#define PCI_CLASS_SERIALBUS 0x0c000000
|
||||
#define PCI_SUBCLASS_COMMUNICATIONS_SERIAL 0x00000000
|
||||
#define PCI_SUBCLASS_SERIALBUS_FIREWIRE 0x00000000
|
||||
#define PCI_SUBCLASS_SERIALBUS_ACCESS 0x00010000
|
||||
#define PCI_SUBCLASS_SERIALBUS_SSA 0x00020000
|
||||
#define PCI_SUBCLASS_SERIALBUS_USB 0x00030000
|
||||
#define PCI_SUBCLASS_SERIALBUS_FIBER 0x00040000
|
||||
|
||||
#define PCI_INTERFACE(d) (((d)>>8)&0xff)
|
||||
#define PCI_SUBCLASS(d) ((d)&PCI_SUBCLASS_MASK)
|
||||
#define PCI_CLASS(d) ((d)&PCI_CLASS_MASK)
|
||||
|
||||
|
||||
#include <dev/usb/usb.h>
|
||||
#include <dev/usb/usbdi.h>
|
||||
#include <dev/usb/usbdivar.h>
|
||||
|
@ -70,7 +62,6 @@
|
|||
#include <dev/usb/uhcireg.h>
|
||||
#include <dev/usb/uhcivar.h>
|
||||
|
||||
|
||||
#define PCI_UHCI_VENDORID_INTEL 0x8086
|
||||
#define PCI_UHCI_VENDORID_VIA 0x1106
|
||||
|
||||
|
@ -85,26 +76,10 @@ static const char *uhci_device_generic = "UHCI (generic) USB Controller";
|
|||
|
||||
#define PCI_UHCI_BASE_REG 0x20
|
||||
|
||||
static const char *uhci_pci_probe __P((pcici_t, pcidi_t));
|
||||
static void uhci_pci_attach __P((pcici_t, int));
|
||||
|
||||
static u_long uhci_count = 0;
|
||||
|
||||
static struct pci_device uhci_pci_device = {
|
||||
"uhci",
|
||||
uhci_pci_probe,
|
||||
uhci_pci_attach,
|
||||
&uhci_count,
|
||||
NULL
|
||||
};
|
||||
|
||||
DATA_SET(pcidevice_set, uhci_pci_device);
|
||||
|
||||
|
||||
static const char *
|
||||
uhci_pci_probe(pcici_t config_id, pcidi_t device_id)
|
||||
uhci_pci_match(device_t dev)
|
||||
{
|
||||
u_int32_t class;
|
||||
u_int32_t device_id = pci_get_devid(dev);
|
||||
|
||||
if (device_id == PCI_UHCI_DEVICEID_PIIX3) {
|
||||
return (uhci_device_piix3);
|
||||
|
@ -113,10 +88,9 @@ uhci_pci_probe(pcici_t config_id, pcidi_t device_id)
|
|||
} else if (device_id == PCI_UHCI_DEVICEID_VT83C572) {
|
||||
return (uhci_device_vt83c572);
|
||||
} else {
|
||||
class = pci_conf_read(config_id, PCI_CLASS_REG);
|
||||
if ( PCI_CLASS(class) == PCI_CLASS_SERIALBUS
|
||||
&& PCI_SUBCLASS(class) == PCI_SUBCLASS_SERIALBUS_USB
|
||||
&& PCI_INTERFACE(class) == PCI_INTERFACE_UHCI) {
|
||||
if ( pci_get_class(dev) == PCIC_SERIALBUS
|
||||
&& pci_get_subclass(dev) == PCIS_SERIALBUS_USB
|
||||
&& pci_get_progif(dev) == PCI_INTERFACE_UHCI) {
|
||||
return (uhci_device_generic);
|
||||
}
|
||||
}
|
||||
|
@ -124,42 +98,64 @@ uhci_pci_probe(pcici_t config_id, pcidi_t device_id)
|
|||
return NULL; /* dunno... */
|
||||
}
|
||||
|
||||
static void
|
||||
uhci_pci_attach(pcici_t config_id, int unit)
|
||||
static int
|
||||
uhci_pci_probe(device_t dev)
|
||||
{
|
||||
int id, legsup;
|
||||
const char *desc = uhci_pci_match(dev);
|
||||
if (desc) {
|
||||
device_set_desc(dev, desc);
|
||||
return 0;
|
||||
} else {
|
||||
return ENXIO;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
uhci_pci_attach(device_t dev)
|
||||
{
|
||||
int unit = device_get_unit(dev);
|
||||
int legsup;
|
||||
char *typestr;
|
||||
usbd_status err;
|
||||
uhci_softc_t *sc = NULL;
|
||||
device_t usbus;
|
||||
uhci_softc_t *sc = device_get_softc(dev);
|
||||
int rid;
|
||||
struct resource *res;
|
||||
void *ih;
|
||||
int error;
|
||||
|
||||
sc = malloc(sizeof(uhci_softc_t), M_DEVBUF, M_NOWAIT);
|
||||
/* Do not free it below, intr might use the sc */
|
||||
if ( sc == NULL ) {
|
||||
printf("uhci%d: could not allocate memory", unit);
|
||||
return;
|
||||
rid = PCI_UHCI_BASE_REG;
|
||||
res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid,
|
||||
0, ~0, 1, RF_ACTIVE);
|
||||
if (!res) {
|
||||
device_printf(dev, "could not map ports\n");
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
sc->iot = rman_get_bustag(res);
|
||||
sc->ioh = rman_get_bushandle(res);
|
||||
|
||||
rid = 0;
|
||||
res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
|
||||
RF_SHAREABLE | RF_ACTIVE);
|
||||
if (res == NULL) {
|
||||
device_printf(dev, "could not allocate irq\n");
|
||||
return ENOMEM;
|
||||
}
|
||||
memset(sc, 0, sizeof(uhci_softc_t));
|
||||
|
||||
if ( !pci_map_port(config_id, PCI_UHCI_BASE_REG, &sc->sc_iobase) ) {
|
||||
printf("uhci%d: could not map port\n", unit);
|
||||
return;
|
||||
|
||||
error = bus_setup_intr(dev, res, (driver_intr_t *) uhci_intr, sc, &ih);
|
||||
if (error) {
|
||||
device_printf(dev, "could not setup irq\n");
|
||||
return error;
|
||||
}
|
||||
|
||||
if ( !pci_map_int(config_id, (pci_inthand_t *)uhci_intr,
|
||||
(void *) sc, &bio_imask)) {
|
||||
printf("uhci%d: could not map irq\n", unit);
|
||||
return;
|
||||
}
|
||||
|
||||
usbus = device_add_child(root_bus, "usb", -1, sc);
|
||||
usbus = device_add_child(dev, "usb", -1, sc);
|
||||
if (!usbus) {
|
||||
printf("usb%d: could not add USB device to root bus\n", unit);
|
||||
return;
|
||||
printf("usb%d: could not add USB device\n", unit);
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
id = pci_conf_read(config_id, PCI_ID_REG);
|
||||
switch (id) {
|
||||
switch (pci_get_devid(dev)) {
|
||||
case PCI_UHCI_DEVICEID_PIIX3:
|
||||
device_set_desc(usbus, uhci_device_piix3);
|
||||
sprintf(sc->sc_vendor, "Intel");
|
||||
|
@ -173,13 +169,13 @@ uhci_pci_attach(pcici_t config_id, int unit)
|
|||
sprintf(sc->sc_vendor, "VIA");
|
||||
break;
|
||||
default:
|
||||
printf("(New UHCI DeviceId=0x%08x)\n", id);
|
||||
printf("(New UHCI DeviceId=0x%08x)\n", pci_get_devid(dev));
|
||||
device_set_desc(usbus, uhci_device_generic);
|
||||
sprintf(sc->sc_vendor, "(0x%08x)", id);
|
||||
sprintf(sc->sc_vendor, "(0x%08x)", pci_get_devid(dev));
|
||||
}
|
||||
|
||||
if (bootverbose) {
|
||||
switch(pci_conf_read(config_id, PCI_USBREV) & PCI_USBREV_MASK) {
|
||||
switch(pci_read_config(dev, PCI_USBREV, 4) & PCI_USBREV_MASK) {
|
||||
case PCI_USBREV_PRE_1_0:
|
||||
typestr = "pre 1.0";
|
||||
break;
|
||||
|
@ -191,25 +187,53 @@ uhci_pci_attach(pcici_t config_id, int unit)
|
|||
break;
|
||||
}
|
||||
printf("uhci%d: USB version %s, chip rev. %d\n", unit, typestr,
|
||||
(int) pci_conf_read(config_id, PCIR_REVID) & 0xff);
|
||||
pci_get_revid(dev));
|
||||
}
|
||||
|
||||
legsup = pci_conf_read(config_id, PCI_LEGSUP);
|
||||
legsup = pci_read_config(dev, PCI_LEGSUP, 4);
|
||||
if ( !(legsup & PCI_LEGSUP_USBPIRQDEN) ) {
|
||||
#if ! (defined(USBVERBOSE) || defined(USB_DEBUG))
|
||||
if (bootverbose)
|
||||
#endif
|
||||
printf("uhci%d: PIRQD enable not set\n", unit);
|
||||
legsup |= PCI_LEGSUP_USBPIRQDEN;
|
||||
pci_conf_write(config_id, PCI_LEGSUP, legsup);
|
||||
pci_write_config(dev, PCI_LEGSUP, legsup, 4);
|
||||
}
|
||||
|
||||
sc->sc_bus.bdev = usbus;
|
||||
err = uhci_init(sc);
|
||||
if (err != USBD_NORMAL_COMPLETION) {
|
||||
printf("uhci%d: init failed, error=%d\n", unit, err);
|
||||
device_delete_child(root_bus, usbus);
|
||||
device_delete_child(dev, usbus);
|
||||
}
|
||||
|
||||
return;
|
||||
return device_probe_and_attach(sc->sc_bus.bdev);
|
||||
}
|
||||
|
||||
static device_method_t uhci_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, uhci_pci_probe),
|
||||
DEVMETHOD(device_attach, uhci_pci_attach),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t uhci_driver = {
|
||||
"uhci",
|
||||
uhci_methods,
|
||||
DRIVER_TYPE_BIO,
|
||||
sizeof(uhci_softc_t),
|
||||
};
|
||||
|
||||
static devclass_t uhci_devclass;
|
||||
|
||||
DRIVER_MODULE(uhci, pci, uhci_driver, uhci_devclass, 0, 0);
|
||||
|
|
|
@ -125,7 +125,8 @@ typedef struct uhci_softc {
|
|||
bus_dma_tag_t sc_dmatag; /* DMA tag */
|
||||
/* XXX should keep track of all DMA memory */
|
||||
#elif defined(__FreeBSD__)
|
||||
int sc_iobase;
|
||||
bus_space_tag_t iot;
|
||||
bus_space_handle_t ioh;
|
||||
#endif /* defined(__FreeBSD__) */
|
||||
|
||||
uhci_physaddr_t *sc_pframes;
|
||||
|
|
|
@ -200,13 +200,8 @@ USB_ATTACH(uhid)
|
|||
static int
|
||||
uhid_detach(device_t self)
|
||||
{
|
||||
const char *devinfo = device_get_desc(self);
|
||||
|
||||
DPRINTF(("%s: disconnected\n", USBDEVNAME(self)));
|
||||
if (devinfo) {
|
||||
device_set_desc(self, NULL);
|
||||
free((void *)devinfo, M_USB);
|
||||
}
|
||||
device_set_desc(self, NULL);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -81,10 +81,15 @@ usbd_status uhub_init_port __P((struct usbd_port *));
|
|||
void uhub_disconnect_port __P((struct usbd_port *up));
|
||||
usbd_status uhub_explore __P((usbd_device_handle hub));
|
||||
void uhub_intr __P((usbd_request_handle, usbd_private_handle, usbd_status));
|
||||
#ifdef __FreeBSD__
|
||||
#include "usb_if.h"
|
||||
static void uhub_disconnected __P((device_t));
|
||||
#endif
|
||||
|
||||
/* void uhub_disco __P((void *)); */
|
||||
|
||||
USB_DECLARE_DRIVER(uhub);
|
||||
USB_DECLARE_DRIVER_INIT(uhub,
|
||||
DEVMETHOD(usb_disconnected, uhub_disconnected));
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
devclass_t uhubroot_devclass;
|
||||
|
@ -251,8 +256,8 @@ USB_ATTACH(uhub)
|
|||
}
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
static int
|
||||
uhub_detach(device_t self)
|
||||
static void
|
||||
uhub_disconnected(device_t self)
|
||||
{
|
||||
struct uhub_softc *sc = device_get_softc(self);
|
||||
struct usbd_port *up;
|
||||
|
@ -264,12 +269,20 @@ uhub_detach(device_t self)
|
|||
nports = dev->hub->hubdesc.bNbrPorts;
|
||||
for (p = 0; p < nports; p++) {
|
||||
up = &sc->sc_hub->hub->ports[p];
|
||||
if (up->device)
|
||||
if (up->device) {
|
||||
uhub_disconnect_port(up);
|
||||
}
|
||||
}
|
||||
|
||||
free(sc->sc_hub->hub, M_USB);
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
uhub_detach(device_t self)
|
||||
{
|
||||
struct uhub_softc *sc = device_get_softc(self);
|
||||
DPRINTF(("%s: disconnected\n", USBDEVNAME(self)));
|
||||
free(sc->sc_hub->hub, M_USB);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -502,6 +515,7 @@ uhub_disconnect_port(up)
|
|||
}
|
||||
}
|
||||
#if defined(__FreeBSD__)
|
||||
USB_DISCONNECTED(sc->sc_dev);
|
||||
device_delete_child(scp->sc_dev, sc->sc_dev);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -437,13 +437,8 @@ ulptioctl(dev, cmd, data, flag, p)
|
|||
static int
|
||||
ulpt_detach(device_t self)
|
||||
{
|
||||
const char *devinfo = device_get_desc(self);
|
||||
|
||||
DPRINTF(("%s: disconnected\n", USBDEVNAME(self)));
|
||||
if (devinfo) {
|
||||
device_set_desc(self, NULL);
|
||||
free((void *)devinfo, M_USB);
|
||||
}
|
||||
device_set_desc(self, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,13 +125,8 @@ USB_ATTACH(umodem)
|
|||
static int
|
||||
umodem_detach(device_t self)
|
||||
{
|
||||
const char *devinfo = device_get_desc(self);
|
||||
|
||||
DPRINTF(("%s: disconnected\n", USBDEVNAME(self)));
|
||||
if (devinfo) {
|
||||
device_set_desc(self, NULL);
|
||||
free((void *)devinfo, M_USB);
|
||||
}
|
||||
device_set_desc(self, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -363,7 +363,6 @@ static int
|
|||
ums_detach(device_t self)
|
||||
{
|
||||
struct ums_softc *sc = device_get_softc(self);
|
||||
const char *devinfo = device_get_desc(self);
|
||||
|
||||
if (sc->sc_enabled) {
|
||||
usbd_abort_pipe(sc->sc_intrpipe);
|
||||
|
@ -372,10 +371,7 @@ ums_detach(device_t self)
|
|||
sc->sc_disconnected = 1;
|
||||
|
||||
DPRINTF(("%s: disconnected\n", USBDEVNAME(self)));
|
||||
if (devinfo) {
|
||||
device_set_desc(self, NULL);
|
||||
free((void *)devinfo, M_USB);
|
||||
}
|
||||
device_set_desc(self, NULL);
|
||||
free(sc->sc_loc_btn, M_USB);
|
||||
free(sc->sc_ibuf, M_USB);
|
||||
|
||||
|
|
|
@ -408,5 +408,6 @@ usb_detach(device_t self)
|
|||
return (1);
|
||||
}
|
||||
|
||||
DRIVER_MODULE(usb, root, usb_driver, usb_devclass, 0, 0);
|
||||
DRIVER_MODULE(usb, uhci, usb_driver, usb_devclass, 0, 0);
|
||||
DRIVER_MODULE(usb, ohci, usb_driver, usb_devclass, 0, 0);
|
||||
#endif
|
||||
|
|
|
@ -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: usb_if.m,v 1.3 1999/01/07 23:31:37 n_hibma Exp $
|
||||
# $Id: usb_if.m,v 1.4 1999/03/22 19:58:59 n_hibma Exp $
|
||||
#
|
||||
|
||||
# USB interface description
|
||||
|
@ -38,3 +38,10 @@ INTERFACE usb;
|
|||
METHOD int reconfigure {
|
||||
device_t dev;
|
||||
};
|
||||
|
||||
# The device is being disconnected and should clean up before
|
||||
# being destroyed.
|
||||
#
|
||||
METHOD void disconnected {
|
||||
device_t dev;
|
||||
};
|
||||
|
|
|
@ -126,7 +126,7 @@ __CONCAT(dname,_attach)(parent, self, aux) \
|
|||
* because of includes in the wrong order.
|
||||
*/
|
||||
#define bdevice device_t
|
||||
#define USBDEVNAME(bdev) usbd_devname(&bdev)
|
||||
#define USBDEVNAME(bdev) device_get_nameunit(bdev)
|
||||
|
||||
/* XXX Change this when FreeBSD has memset
|
||||
*/
|
||||
|
|
|
@ -1302,30 +1302,7 @@ usbd_driver_load(module_t mod, int what, void *arg)
|
|||
void
|
||||
usbd_device_set_desc(device_t device, char *devinfo)
|
||||
{
|
||||
size_t l;
|
||||
char *desc;
|
||||
|
||||
if ( devinfo ) {
|
||||
l = strlen(devinfo);
|
||||
desc = malloc(l+1, M_USB, M_NOWAIT);
|
||||
if (desc)
|
||||
memcpy(desc, devinfo, l+1);
|
||||
} else
|
||||
desc = NULL;
|
||||
|
||||
device_set_desc(device, desc);
|
||||
}
|
||||
|
||||
char *
|
||||
usbd_devname(bdevice *bdev)
|
||||
{
|
||||
static char buf[20];
|
||||
/* XXX a static buffer is not exactly a good idea, but the only
|
||||
* thing that goes wrong is the string that is being printed
|
||||
*/
|
||||
|
||||
sprintf(buf, "%s%d", device_get_name(*bdev), device_get_unit(*bdev));
|
||||
return (buf);
|
||||
device_set_desc_copy(device, devinfo);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -336,7 +336,6 @@ usb_endpoint_descriptor_t *usbd_get_endpoint_descriptor
|
|||
#if defined(__FreeBSD__)
|
||||
int usbd_driver_load __P((module_t mod, int what, void *arg));
|
||||
void usbd_device_set_desc __P((device_t device, char *devinfo));
|
||||
char *usbd_devname(bdevice *bdev);
|
||||
bus_print_child_t usbd_print_child;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*
|
||||
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
||||
*
|
||||
* $Id: apm.c,v 1.76 1998/12/04 21:28:39 archie Exp $
|
||||
* $Id: apm.c,v 1.77 1998/12/10 23:36:14 msmith Exp $
|
||||
*/
|
||||
|
||||
#include "opt_devfs.h"
|
||||
|
@ -30,7 +30,7 @@
|
|||
#include <sys/systm.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/apm_bios.h>
|
||||
#include <machine/segments.h>
|
||||
#include <machine/clock.h>
|
||||
|
@ -432,11 +432,15 @@ void
|
|||
apm_suspend(int state)
|
||||
{
|
||||
struct apm_softc *sc = &apm_softc;
|
||||
int error;
|
||||
|
||||
if (!sc)
|
||||
return;
|
||||
|
||||
if (sc->initialized) {
|
||||
error = DEVICE_SUSPEND(root_bus);
|
||||
if (error)
|
||||
return; /* XXX no error reporting */
|
||||
apm_execute_hook(hook[APM_HOOK_SUSPEND]);
|
||||
if (apm_suspend_system(state) == 0)
|
||||
apm_processevent();
|
||||
|
@ -454,8 +458,10 @@ apm_resume(void)
|
|||
if (!sc)
|
||||
return;
|
||||
|
||||
if (sc->initialized)
|
||||
if (sc->initialized) {
|
||||
DEVICE_RESUME(root_bus);
|
||||
apm_execute_hook(hook[APM_HOOK_RESUME]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -623,9 +629,6 @@ apm_not_halt_cpu(void)
|
|||
}
|
||||
|
||||
/* device driver definitions */
|
||||
static int apmprobe (struct isa_device *);
|
||||
static int apmattach(struct isa_device *);
|
||||
struct isa_driver apmdriver = { apmprobe, apmattach, "apm" };
|
||||
|
||||
/*
|
||||
* probe APM (dummy):
|
||||
|
@ -639,18 +642,24 @@ struct isa_driver apmdriver = { apmprobe, apmattach, "apm" };
|
|||
*/
|
||||
|
||||
static int
|
||||
apmprobe(struct isa_device *dvp)
|
||||
apm_probe(device_t dev)
|
||||
{
|
||||
#ifdef VM86
|
||||
struct vm86frame vmf;
|
||||
int i;
|
||||
#endif
|
||||
int flags;
|
||||
|
||||
if ( dvp->id_unit > 0 ) {
|
||||
device_set_desc(dev, "APM BIOS");
|
||||
|
||||
if ( device_get_unit(dev) > 0 ) {
|
||||
printf("apm: Only one APM driver supported.\n");
|
||||
return 0;
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
if (resource_int_value("apm", 0, "flags", &flags) != 0)
|
||||
flags = 0;
|
||||
|
||||
#ifdef VM86
|
||||
bzero(&vmf, sizeof(struct vm86frame)); /* safety */
|
||||
vmf.vmf_ax = (APM_BIOS << 8) | APM_INSTCHECK;
|
||||
|
@ -712,9 +721,9 @@ apmprobe(struct isa_device *dvp)
|
|||
printf("apm: 32-bit connection error.\n");
|
||||
return 0;
|
||||
}
|
||||
if (dvp->id_flags & 0x20)
|
||||
if (flags & 0x20)
|
||||
statclock_disable = 1;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -779,10 +788,14 @@ apm_processevent(void)
|
|||
*/
|
||||
|
||||
static int
|
||||
apmattach(struct isa_device *dvp)
|
||||
apm_attach(device_t dev)
|
||||
{
|
||||
#define APM_KERNBASE KERNBASE
|
||||
struct apm_softc *sc = &apm_softc;
|
||||
int flags;
|
||||
|
||||
if (resource_int_value("apm", 0, "flags", &flags) != 0)
|
||||
flags = 0;
|
||||
|
||||
sc->initialized = 0;
|
||||
|
||||
|
@ -833,11 +846,11 @@ apmattach(struct isa_device *dvp)
|
|||
apm_addr.segment = GSEL(GAPMCODE32_SEL, SEL_KPL);
|
||||
apm_addr.offset = sc->cs_entry;
|
||||
|
||||
if ((dvp->id_flags & 0x10)) {
|
||||
if ((dvp->id_flags & 0xf) >= 0x2) {
|
||||
if ((flags & 0x10)) {
|
||||
if ((flags & 0xf) >= 0x2) {
|
||||
apm_driver_version(0x102);
|
||||
}
|
||||
if (!apm_version && (dvp->id_flags & 0xf) >= 0x1) {
|
||||
if (!apm_version && (flags & 0xf) >= 0x1) {
|
||||
apm_driver_version(0x101);
|
||||
}
|
||||
} else {
|
||||
|
@ -1009,19 +1022,22 @@ apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
|
|||
return error;
|
||||
}
|
||||
|
||||
static device_method_t apm_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, apm_probe),
|
||||
DEVMETHOD(device_attach, apm_attach),
|
||||
|
||||
static apm_devsw_installed = 0;
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static void
|
||||
apm_drvinit(void *unused)
|
||||
{
|
||||
dev_t dev;
|
||||
static driver_t apm_driver = {
|
||||
"apm",
|
||||
apm_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1, /* no softc (XXX) */
|
||||
};
|
||||
|
||||
if( ! apm_devsw_installed ) {
|
||||
dev = makedev(CDEV_MAJOR,0);
|
||||
cdevsw_add(&dev,&apm_cdevsw,NULL);
|
||||
apm_devsw_installed = 1;
|
||||
}
|
||||
}
|
||||
static devclass_t apm_devclass;
|
||||
|
||||
SYSINIT(apmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,apm_drvinit,NULL)
|
||||
CDEV_DRIVER_MODULE(apm, nexus, apm_driver, apm_devclass,
|
||||
CDEV_MAJOR, apm_cdevsw, 0, 0);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*
|
||||
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
||||
*
|
||||
* $Id: apm.c,v 1.76 1998/12/04 21:28:39 archie Exp $
|
||||
* $Id: apm.c,v 1.77 1998/12/10 23:36:14 msmith Exp $
|
||||
*/
|
||||
|
||||
#include "opt_devfs.h"
|
||||
|
@ -30,7 +30,7 @@
|
|||
#include <sys/systm.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <sys/bus.h>
|
||||
#include <machine/apm_bios.h>
|
||||
#include <machine/segments.h>
|
||||
#include <machine/clock.h>
|
||||
|
@ -432,11 +432,15 @@ void
|
|||
apm_suspend(int state)
|
||||
{
|
||||
struct apm_softc *sc = &apm_softc;
|
||||
int error;
|
||||
|
||||
if (!sc)
|
||||
return;
|
||||
|
||||
if (sc->initialized) {
|
||||
error = DEVICE_SUSPEND(root_bus);
|
||||
if (error)
|
||||
return; /* XXX no error reporting */
|
||||
apm_execute_hook(hook[APM_HOOK_SUSPEND]);
|
||||
if (apm_suspend_system(state) == 0)
|
||||
apm_processevent();
|
||||
|
@ -454,8 +458,10 @@ apm_resume(void)
|
|||
if (!sc)
|
||||
return;
|
||||
|
||||
if (sc->initialized)
|
||||
if (sc->initialized) {
|
||||
DEVICE_RESUME(root_bus);
|
||||
apm_execute_hook(hook[APM_HOOK_RESUME]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -623,9 +629,6 @@ apm_not_halt_cpu(void)
|
|||
}
|
||||
|
||||
/* device driver definitions */
|
||||
static int apmprobe (struct isa_device *);
|
||||
static int apmattach(struct isa_device *);
|
||||
struct isa_driver apmdriver = { apmprobe, apmattach, "apm" };
|
||||
|
||||
/*
|
||||
* probe APM (dummy):
|
||||
|
@ -639,18 +642,24 @@ struct isa_driver apmdriver = { apmprobe, apmattach, "apm" };
|
|||
*/
|
||||
|
||||
static int
|
||||
apmprobe(struct isa_device *dvp)
|
||||
apm_probe(device_t dev)
|
||||
{
|
||||
#ifdef VM86
|
||||
struct vm86frame vmf;
|
||||
int i;
|
||||
#endif
|
||||
int flags;
|
||||
|
||||
if ( dvp->id_unit > 0 ) {
|
||||
device_set_desc(dev, "APM BIOS");
|
||||
|
||||
if ( device_get_unit(dev) > 0 ) {
|
||||
printf("apm: Only one APM driver supported.\n");
|
||||
return 0;
|
||||
return ENXIO;
|
||||
}
|
||||
|
||||
if (resource_int_value("apm", 0, "flags", &flags) != 0)
|
||||
flags = 0;
|
||||
|
||||
#ifdef VM86
|
||||
bzero(&vmf, sizeof(struct vm86frame)); /* safety */
|
||||
vmf.vmf_ax = (APM_BIOS << 8) | APM_INSTCHECK;
|
||||
|
@ -712,9 +721,9 @@ apmprobe(struct isa_device *dvp)
|
|||
printf("apm: 32-bit connection error.\n");
|
||||
return 0;
|
||||
}
|
||||
if (dvp->id_flags & 0x20)
|
||||
if (flags & 0x20)
|
||||
statclock_disable = 1;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -779,10 +788,14 @@ apm_processevent(void)
|
|||
*/
|
||||
|
||||
static int
|
||||
apmattach(struct isa_device *dvp)
|
||||
apm_attach(device_t dev)
|
||||
{
|
||||
#define APM_KERNBASE KERNBASE
|
||||
struct apm_softc *sc = &apm_softc;
|
||||
int flags;
|
||||
|
||||
if (resource_int_value("apm", 0, "flags", &flags) != 0)
|
||||
flags = 0;
|
||||
|
||||
sc->initialized = 0;
|
||||
|
||||
|
@ -833,11 +846,11 @@ apmattach(struct isa_device *dvp)
|
|||
apm_addr.segment = GSEL(GAPMCODE32_SEL, SEL_KPL);
|
||||
apm_addr.offset = sc->cs_entry;
|
||||
|
||||
if ((dvp->id_flags & 0x10)) {
|
||||
if ((dvp->id_flags & 0xf) >= 0x2) {
|
||||
if ((flags & 0x10)) {
|
||||
if ((flags & 0xf) >= 0x2) {
|
||||
apm_driver_version(0x102);
|
||||
}
|
||||
if (!apm_version && (dvp->id_flags & 0xf) >= 0x1) {
|
||||
if (!apm_version && (flags & 0xf) >= 0x1) {
|
||||
apm_driver_version(0x101);
|
||||
}
|
||||
} else {
|
||||
|
@ -1009,19 +1022,22 @@ apmioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
|
|||
return error;
|
||||
}
|
||||
|
||||
static device_method_t apm_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, apm_probe),
|
||||
DEVMETHOD(device_attach, apm_attach),
|
||||
|
||||
static apm_devsw_installed = 0;
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static void
|
||||
apm_drvinit(void *unused)
|
||||
{
|
||||
dev_t dev;
|
||||
static driver_t apm_driver = {
|
||||
"apm",
|
||||
apm_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1, /* no softc (XXX) */
|
||||
};
|
||||
|
||||
if( ! apm_devsw_installed ) {
|
||||
dev = makedev(CDEV_MAJOR,0);
|
||||
cdevsw_add(&dev,&apm_cdevsw,NULL);
|
||||
apm_devsw_installed = 1;
|
||||
}
|
||||
}
|
||||
static devclass_t apm_devclass;
|
||||
|
||||
SYSINIT(apmdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,apm_drvinit,NULL)
|
||||
CDEV_DRIVER_MODULE(apm, nexus, apm_driver, apm_devclass,
|
||||
CDEV_MAJOR, apm_cdevsw, 0, 0);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
# device lines is present in the ./LINT configuration file. If you are
|
||||
# in doubt as to the purpose or necessity of a line, check first in LINT.
|
||||
#
|
||||
# $Id: GENERIC,v 1.160 1999/04/16 16:17:05 n_hibma Exp $
|
||||
# $Id: GENERIC,v 1.161 1999/04/16 18:27:18 jkh Exp $
|
||||
|
||||
machine "i386"
|
||||
cpu "I386_CPU"
|
||||
|
@ -53,10 +53,10 @@ config kernel root on wd0
|
|||
#options NAPIC=1 # number of IO APICs
|
||||
#options NINTR=24 # number of INTs
|
||||
|
||||
controller isa0
|
||||
controller pnp0 # PnP support for ISA
|
||||
controller eisa0
|
||||
controller pci0
|
||||
controller isa0 at nexus?
|
||||
#controller pnp0 # PnP support for ISA
|
||||
#controller eisa0
|
||||
controller pci0 at nexus?
|
||||
|
||||
controller fdc0 at isa? port "IO_FD1" bio irq 6 drq 2
|
||||
disk fd0 at fdc0 drive 0
|
||||
|
@ -108,9 +108,9 @@ controller matcd0 at isa? port 0x230 bio
|
|||
device scd0 at isa? port 0x230 bio
|
||||
|
||||
# atkbdc0 controlls both the keyboard and the PS/2 mouse
|
||||
controller atkbdc0 at isa? port IO_KBD tty
|
||||
device atkbd0 at isa? tty irq 1
|
||||
device psm0 at isa? tty irq 12
|
||||
controller atkbdc0 at isa? port IO_KBD
|
||||
device atkbd0 at atkbdc? tty irq 1
|
||||
device psm0 at atkbdc? tty irq 12
|
||||
|
||||
device vga0 at isa? port ? conflicts
|
||||
|
||||
|
@ -126,12 +126,12 @@ device sc0 at isa? tty
|
|||
# If you have a ThinkPAD, uncomment this along with the rest of the PCVT lines
|
||||
#options PCVT_SCANSET=2 # IBM keyboards are non-std
|
||||
|
||||
device npx0 at isa? port IO_NPX irq 13
|
||||
device npx0 at nexus? port IO_NPX irq 13
|
||||
|
||||
#
|
||||
# Laptop support (see LINT for more options)
|
||||
#
|
||||
device apm0 at isa? disable flags 0x31 # Advanced Power Management
|
||||
device apm0 at nexus? disable flags 0x31 # Advanced Power Management
|
||||
|
||||
# PCCARD (PCMCIA) support
|
||||
#controller card0
|
||||
|
@ -178,8 +178,8 @@ device ex0 at isa? port? net irq?
|
|||
device fe0 at isa? port 0x300 net irq ?
|
||||
device le0 at isa? port 0x300 net irq 5 iomem 0xd0000
|
||||
device lnc0 at isa? port 0x280 net irq 10 drq 0
|
||||
device ze0 at isa? port 0x300 net irq 10 iomem 0xd8000
|
||||
device zp0 at isa? port 0x300 net irq 10 iomem 0xd8000
|
||||
#device ze0 at isa? port 0x300 net irq 10 iomem 0xd8000
|
||||
#device zp0 at isa? port 0x300 net irq 10 iomem 0xd8000
|
||||
device cs0 at isa? port 0x300 net irq ?
|
||||
|
||||
pseudo-device loop
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.581 1999/04/14 16:54:00 peter Exp $
|
||||
# $Id: LINT,v 1.582 1999/04/16 16:17:04 n_hibma Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
|
@ -827,7 +827,7 @@ options "MSGBUF_SIZE=40960"
|
|||
#
|
||||
# Mandatory ISA devices: isa, npx
|
||||
#
|
||||
controller isa0
|
||||
controller isa0 at nexus?
|
||||
|
||||
#
|
||||
# Options for `isa':
|
||||
|
@ -888,10 +888,10 @@ options "NTIMECOUNTER=20"
|
|||
controller pnp0
|
||||
|
||||
# The keyboard controller; it controlls the keyboard and the PS/2 mouse.
|
||||
controller atkbdc0 at isa? port IO_KBD tty
|
||||
controller atkbdc0 at isa? port IO_KBD
|
||||
|
||||
# The AT keyboard
|
||||
device atkbd0 at isa? tty irq 1
|
||||
device atkbd0 at atkbdc? tty irq 1
|
||||
|
||||
# Options for atkbd:
|
||||
options ATKBD_DFLT_KEYMAP # specify the built-in keymap
|
||||
|
@ -907,7 +907,7 @@ options KBD_INSTALL_CDEV # install a CDEV entry in /dev
|
|||
# 0x04 Old-style (XT) keyboard support, useful for older ThinkPads
|
||||
|
||||
# PS/2 mouse
|
||||
device psm0 at isa? tty irq 12
|
||||
device psm0 at atkbdc? tty irq 12
|
||||
|
||||
# Options for psm:
|
||||
options PSM_HOOKAPM #hook the APM resume event, useful
|
||||
|
@ -977,7 +977,7 @@ options SC_DISABLE_REBOOT # disable reboot key sequence
|
|||
# buggy. If it is not configured then you *must* configure math emulation
|
||||
# (see above). If both npx0 and emulation are configured, then only npx0
|
||||
# is used (provided it works).
|
||||
device npx0 at isa? port IO_NPX iosiz 0x0 flags 0x0 irq 13
|
||||
device npx0 at nexus? port IO_NPX iosiz 0x0 flags 0x0 irq 13
|
||||
|
||||
#
|
||||
# `flags' for npx0:
|
||||
|
@ -1464,7 +1464,7 @@ controller matcd0 at isa? port 0x230 bio
|
|||
device wt0 at isa? port 0x300 bio irq 5 drq 1
|
||||
device ctx0 at isa? port 0x230 iomem 0xd0000
|
||||
device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000
|
||||
device apm0 at isa?
|
||||
device apm0 at nexus?
|
||||
device gp0 at isa? port 0x2c0 tty
|
||||
device gsc0 at isa? port "IO_GSC1" tty drq 3
|
||||
device joy0 at isa? port IO_GAME
|
||||
|
@ -1632,7 +1632,7 @@ options "EISA_SLOTS=12"
|
|||
# The "oltr" driver supports the following Olicom PCI token-ring adapters
|
||||
# OC-3136, OC-3137, OC-3139, OC-3140, OC-3141, OC-3540, OC-3250
|
||||
#
|
||||
controller pci0
|
||||
controller pci0 at nexus?
|
||||
controller ahc1
|
||||
controller ncr0
|
||||
controller isp0
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Makefile.i386 -- with config changes.
|
||||
# Copyright 1990 W. Jolitz
|
||||
# from: @(#)Makefile.i386 7.1 5/10/91
|
||||
# $Id: Makefile.i386,v 1.144 1999/04/13 18:25:08 peter Exp $
|
||||
# $Id: Makefile.i386,v 1.145 1999/04/15 14:52:23 bde Exp $
|
||||
#
|
||||
# Makefile for FreeBSD
|
||||
#
|
||||
|
@ -17,7 +17,7 @@
|
|||
#
|
||||
|
||||
# Which version of config(8) is required.
|
||||
%VERSREQ= 300012
|
||||
%VERSREQ= 400013
|
||||
|
||||
KERNFORMAT?= elf
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.581 1999/04/14 16:54:00 peter Exp $
|
||||
# $Id: LINT,v 1.582 1999/04/16 16:17:04 n_hibma Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
|
@ -827,7 +827,7 @@ options "MSGBUF_SIZE=40960"
|
|||
#
|
||||
# Mandatory ISA devices: isa, npx
|
||||
#
|
||||
controller isa0
|
||||
controller isa0 at nexus?
|
||||
|
||||
#
|
||||
# Options for `isa':
|
||||
|
@ -888,10 +888,10 @@ options "NTIMECOUNTER=20"
|
|||
controller pnp0
|
||||
|
||||
# The keyboard controller; it controlls the keyboard and the PS/2 mouse.
|
||||
controller atkbdc0 at isa? port IO_KBD tty
|
||||
controller atkbdc0 at isa? port IO_KBD
|
||||
|
||||
# The AT keyboard
|
||||
device atkbd0 at isa? tty irq 1
|
||||
device atkbd0 at atkbdc? tty irq 1
|
||||
|
||||
# Options for atkbd:
|
||||
options ATKBD_DFLT_KEYMAP # specify the built-in keymap
|
||||
|
@ -907,7 +907,7 @@ options KBD_INSTALL_CDEV # install a CDEV entry in /dev
|
|||
# 0x04 Old-style (XT) keyboard support, useful for older ThinkPads
|
||||
|
||||
# PS/2 mouse
|
||||
device psm0 at isa? tty irq 12
|
||||
device psm0 at atkbdc? tty irq 12
|
||||
|
||||
# Options for psm:
|
||||
options PSM_HOOKAPM #hook the APM resume event, useful
|
||||
|
@ -977,7 +977,7 @@ options SC_DISABLE_REBOOT # disable reboot key sequence
|
|||
# buggy. If it is not configured then you *must* configure math emulation
|
||||
# (see above). If both npx0 and emulation are configured, then only npx0
|
||||
# is used (provided it works).
|
||||
device npx0 at isa? port IO_NPX iosiz 0x0 flags 0x0 irq 13
|
||||
device npx0 at nexus? port IO_NPX iosiz 0x0 flags 0x0 irq 13
|
||||
|
||||
#
|
||||
# `flags' for npx0:
|
||||
|
@ -1464,7 +1464,7 @@ controller matcd0 at isa? port 0x230 bio
|
|||
device wt0 at isa? port 0x300 bio irq 5 drq 1
|
||||
device ctx0 at isa? port 0x230 iomem 0xd0000
|
||||
device spigot0 at isa? port 0xad6 irq 15 iomem 0xee000
|
||||
device apm0 at isa?
|
||||
device apm0 at nexus?
|
||||
device gp0 at isa? port 0x2c0 tty
|
||||
device gsc0 at isa? port "IO_GSC1" tty drq 3
|
||||
device joy0 at isa? port IO_GAME
|
||||
|
@ -1632,7 +1632,7 @@ options "EISA_SLOTS=12"
|
|||
# The "oltr" driver supports the following Olicom PCI token-ring adapters
|
||||
# OC-3136, OC-3137, OC-3139, OC-3140, OC-3141, OC-3540, OC-3250
|
||||
#
|
||||
controller pci0
|
||||
controller pci0 at nexus?
|
||||
controller ahc1
|
||||
controller ncr0
|
||||
controller isp0
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# This file tells config what files go into building a kernel,
|
||||
# files marked standard are always included.
|
||||
#
|
||||
# $Id: files.i386,v 1.234 1999/04/13 19:38:10 peter Exp $
|
||||
# $Id: files.i386,v 1.235 1999/04/15 14:52:23 bde Exp $
|
||||
#
|
||||
# The long compile-with and dependency lines are required because of
|
||||
# limitations in config: backslash-newline doesn't work in strings, and
|
||||
|
@ -90,6 +90,7 @@ i386/i386/mp_machdep.c optional smp
|
|||
i386/i386/mpapic.c optional smp
|
||||
i386/i386/mpboot.s optional smp
|
||||
i386/i386/mplock.s optional smp
|
||||
i386/i386/nexus.c standard
|
||||
i386/i386/perfmon.c optional perfmon profiling-routine
|
||||
i386/i386/perfmon.c optional perfmon
|
||||
i386/i386/pmap.c standard
|
||||
|
@ -125,8 +126,8 @@ i386/ibcs2/imgact_coff.c optional ibcs2
|
|||
i386/isa/adv_isa.c optional adv device-driver
|
||||
#i386/isa/aha1542.c optional aha device-driver
|
||||
i386/isa/aha_isa.c optional aha device-driver
|
||||
i386/isa/atkbd_isa.c optional atkbd device-driver
|
||||
i386/isa/atkbdc_isa.c optional atkbdc device-driver
|
||||
isa/atkbd_isa.c optional atkbd device-driver
|
||||
isa/atkbdc_isa.c optional atkbdc device-driver
|
||||
i386/isa/bt_isa.c optional bt device-driver
|
||||
i386/isa/clock.c standard
|
||||
i386/isa/cronyx.c optional cx device-driver
|
||||
|
@ -177,6 +178,8 @@ i386/isa/mse.c optional mse device-driver
|
|||
i386/isa/npx.c mandatory npx device-driver
|
||||
i386/isa/pcaudio.c optional pca device-driver
|
||||
i386/isa/matcd/matcd.c optional matcd device-driver
|
||||
i386/isa/isa_compat.c optional isa device-driver
|
||||
i386/isa/isa_dma.c optional isa device-driver
|
||||
i386/isa/pcibus.c optional pci device-driver
|
||||
i386/isa/pcicx.c optional ze device-driver
|
||||
i386/isa/pcicx.c optional zp device-driver
|
||||
|
@ -190,7 +193,7 @@ i386/isa/pnp.c optional pnp device-driver
|
|||
i386/isa/prof_machdep.c optional profiling-routine
|
||||
i386/isa/ppc.c optional ppc device-driver
|
||||
i386/isa/pcf.c optional pcf device-driver
|
||||
i386/isa/psm.c optional psm device-driver
|
||||
isa/psm.c optional psm device-driver
|
||||
i386/isa/random_machdep.c standard
|
||||
i386/isa/rc.c optional rc device-driver
|
||||
i386/isa/rp.c optional rp device-driver
|
||||
|
@ -198,7 +201,7 @@ i386/isa/scd.c optional scd device-driver
|
|||
i386/isa/si.c optional si device-driver
|
||||
i386/isa/si2_z280.c optional si device-driver
|
||||
i386/isa/si3_t225.c optional si device-driver
|
||||
i386/isa/sio.c optional sio device-driver
|
||||
isa/sio.c optional sio device-driver
|
||||
i386/isa/snd/sound.c optional pcm device-driver
|
||||
i386/isa/snd/dmabuf.c optional pcm device-driver
|
||||
i386/isa/snd/ad1848.c optional pcm device-driver
|
||||
|
@ -268,9 +271,9 @@ i386/isa/sound/cs4232.c optional css device-driver
|
|||
i386/isa/spigot.c optional spigot device-driver
|
||||
i386/isa/spkr.c optional speaker device-driver
|
||||
i386/isa/stallion.c optional stl device-driver
|
||||
i386/isa/syscons_isa.c optional sc device-driver
|
||||
isa/syscons_isa.c optional sc device-driver
|
||||
i386/isa/vesa.c optional vga device-driver
|
||||
i386/isa/vga_isa.c optional vga device-driver
|
||||
isa/vga_isa.c optional vga device-driver
|
||||
i386/isa/tw.c optional tw device-driver
|
||||
i386/isa/wd.c optional wdc device-driver
|
||||
i386/isa/wd.c optional wd device-driver
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
|
||||
* $Id: autoconf.c,v 1.111 1999/01/19 00:10:59 peter Exp $
|
||||
* $Id: autoconf.c,v 1.112 1999/04/15 14:52:24 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -50,9 +50,11 @@
|
|||
#include "opt_cd9660.h"
|
||||
#include "opt_mfs.h"
|
||||
#include "opt_nfsroot.h"
|
||||
#include "opt_bus.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/diskslice.h>
|
||||
|
@ -74,13 +76,19 @@
|
|||
|
||||
#include "isa.h"
|
||||
#if NISA > 0
|
||||
#ifdef OLD_BUS_ARCH
|
||||
#include <i386/isa/isa_device.h>
|
||||
#else
|
||||
device_t isa_bus_device = 0;
|
||||
#endif /* OLD_BUS_ARCH */
|
||||
#endif
|
||||
|
||||
#include "pnp.h"
|
||||
#if NPNP > 0
|
||||
#ifdef OLD_BUS_ARCH
|
||||
#include <i386/isa/pnp.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "eisa.h"
|
||||
#if NEISA > 0
|
||||
|
@ -92,8 +100,6 @@
|
|||
#include <pci/pcivar.h>
|
||||
#endif
|
||||
|
||||
#include <sys/bus.h>
|
||||
|
||||
static void configure_first __P((void *));
|
||||
static void configure __P((void *));
|
||||
static void configure_final __P((void *));
|
||||
|
@ -186,6 +192,8 @@ configure_finish()
|
|||
{
|
||||
}
|
||||
|
||||
device_t nexus_dev;
|
||||
|
||||
/*
|
||||
* Determine i/o configuration for a machine.
|
||||
*/
|
||||
|
@ -228,21 +236,21 @@ configure(dummy)
|
|||
eisa_configure();
|
||||
#endif
|
||||
|
||||
#if NPCI > 0
|
||||
pci_configure();
|
||||
#endif
|
||||
|
||||
#if NPNP > 0
|
||||
pnp_configure();
|
||||
#endif
|
||||
|
||||
#if NISA > 0
|
||||
isa_configure();
|
||||
#endif
|
||||
/* nexus0 is the top of the i386 device tree */
|
||||
device_add_child(root_bus, "nexus", 0, 0);
|
||||
|
||||
/* initialize new bus architecture */
|
||||
root_bus_configure();
|
||||
|
||||
#if NISA > 0
|
||||
if (isa_bus_device)
|
||||
bus_generic_attach(isa_bus_device);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Now we're ready to handle (pending) interrupts.
|
||||
* XXX this is slightly misplaced.
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: exception.s,v 1.56 1999/02/25 11:03:08 bde Exp $
|
||||
* $Id: exception.s,v 1.57 1999/02/28 10:53:28 bde Exp $
|
||||
*/
|
||||
|
||||
#include "npx.h"
|
||||
|
@ -139,7 +139,7 @@ IDTVEC(fpu)
|
|||
#if NNPX > 0
|
||||
/*
|
||||
* Handle like an interrupt (except for accounting) so that we can
|
||||
* call npxintr to clear the error. It would be better to handle
|
||||
* call npx_intr to clear the error. It would be better to handle
|
||||
* npx interrupts as traps. This used to be difficult for nested
|
||||
* interrupts, but now it is fairly easy - mask nested ones the
|
||||
* same as SWI_AST's.
|
||||
|
@ -180,7 +180,7 @@ IDTVEC(fpu)
|
|||
movl %eax,_cpl
|
||||
#endif /* SMP */
|
||||
|
||||
call _npxintr
|
||||
call _npx_intr
|
||||
|
||||
incb _intr_nesting_level
|
||||
MEXITCOUNT
|
||||
|
|
409
sys/i386/i386/legacy.c
Normal file
409
sys/i386/i386/legacy.c
Normal file
|
@ -0,0 +1,409 @@
|
|||
/*
|
||||
* Copyright 1998 Massachusetts Institute of Technology
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby
|
||||
* granted, provided that both the above copyright notice and this
|
||||
* permission notice appear in all copies, that both the above
|
||||
* copyright notice and this permission notice appear in all
|
||||
* supporting documentation, and that the name of M.I.T. not be used
|
||||
* in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission. M.I.T. makes
|
||||
* no representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
|
||||
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
|
||||
* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code implements a `root nexus' for Intel Architecture
|
||||
* machines. The function of the root nexus is to serve as an
|
||||
* attachment point for both processors and buses, and to manage
|
||||
* resources which are common to all of them. In particular,
|
||||
* this code implements the core resource managers for interrupt
|
||||
* requests, DMA requests (which rightfully should be a part of the
|
||||
* ISA code but it's easier to do it here for now), I/O port addresses,
|
||||
* and I/O memory address space.
|
||||
*/
|
||||
|
||||
#include "opt_smp.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/interrupt.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <machine/vmparam.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <machine/pmap.h>
|
||||
|
||||
#include <machine/ipl.h>
|
||||
#include <machine/resource.h>
|
||||
#ifdef APIC_IO
|
||||
#include <machine/smp.h>
|
||||
#include <machine/mpapic.h>
|
||||
#endif
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
#include <i386/isa/icu.h>
|
||||
#include <i386/isa/intr_machdep.h>
|
||||
|
||||
#include <pci/pcivar.h>
|
||||
|
||||
#include "eisa.h"
|
||||
#include "isa.h"
|
||||
#include "pci.h"
|
||||
#include "npx.h"
|
||||
#include "apm.h"
|
||||
|
||||
static struct rman irq_rman, drq_rman, port_rman, mem_rman;
|
||||
|
||||
static int nexus_probe(device_t);
|
||||
static void nexus_print_child(device_t, device_t);
|
||||
static struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
|
||||
u_long, u_long, u_long, u_int);
|
||||
static int nexus_activate_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_deactivate_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_release_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_setup_intr(device_t, device_t, struct resource *,
|
||||
void (*)(void *), void *, void **);
|
||||
static int nexus_teardown_intr(device_t, device_t, struct resource *,
|
||||
void *);
|
||||
|
||||
static device_method_t nexus_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, nexus_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
DEVMETHOD(device_detach, bus_generic_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, nexus_print_child),
|
||||
DEVMETHOD(bus_read_ivar, bus_generic_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, bus_generic_write_ivar),
|
||||
DEVMETHOD(bus_alloc_resource, nexus_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, nexus_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, nexus_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t nexus_driver = {
|
||||
"nexus",
|
||||
nexus_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1, /* no softc */
|
||||
};
|
||||
static devclass_t nexus_devclass;
|
||||
|
||||
DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);
|
||||
|
||||
#ifdef APIC_IO
|
||||
#define LASTIRQ (NINTR - 1)
|
||||
#else
|
||||
#define LASTIRQ 15
|
||||
#endif
|
||||
|
||||
static int
|
||||
nexus_probe(device_t dev)
|
||||
{
|
||||
device_t child;
|
||||
|
||||
device_quiet(dev); /* suppress attach message for neatness */
|
||||
|
||||
irq_rman.rm_start = 0;
|
||||
irq_rman.rm_end = LASTIRQ;
|
||||
irq_rman.rm_type = RMAN_ARRAY;
|
||||
irq_rman.rm_descr = "Interrupt request lines";
|
||||
if (rman_init(&irq_rman)
|
||||
|| rman_manage_region(&irq_rman, 0, 1)
|
||||
|| rman_manage_region(&irq_rman, 3, LASTIRQ))
|
||||
panic("nexus_probe irq_rman");
|
||||
|
||||
drq_rman.rm_start = 0;
|
||||
drq_rman.rm_end = 7;
|
||||
drq_rman.rm_type = RMAN_ARRAY;
|
||||
drq_rman.rm_descr = "DMA request lines";
|
||||
/* XXX drq 0 not available on some machines */
|
||||
if (rman_init(&drq_rman)
|
||||
|| rman_manage_region(&drq_rman, 0, 7))
|
||||
panic("nexus_probe drq_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("nexus_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, 0, ~0))
|
||||
panic("nexus_probe mem_rman");
|
||||
|
||||
#if NNPX > 0
|
||||
child = device_add_child(dev, "npx", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe npx");
|
||||
#endif /* NNPX > 0 */
|
||||
#if NAPM > 0
|
||||
child = device_add_child(dev, "apm", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe apm");
|
||||
#endif /* NAPM > 0 */
|
||||
#if NPCI > 0
|
||||
/* Add a PCI bridge if pci bus is present */
|
||||
if (pci_cfgopen() != 0) {
|
||||
child = device_add_child(dev, "pcib", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe pcib");
|
||||
}
|
||||
#endif
|
||||
#if 0 && NEISA > 0
|
||||
child = device_add_child(dev, "eisa", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe eisa");
|
||||
#endif
|
||||
#if NISA > 0
|
||||
/* Add an ISA bus directly if pci bus is not present */
|
||||
if (pci_cfgopen() == 0) {
|
||||
child = device_add_child(dev, "isa", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe isa");
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
nexus_print_child(device_t bus, device_t child)
|
||||
{
|
||||
printf(" on motherboard");
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 nexus0.
|
||||
* (Exceptions include npx.)
|
||||
*/
|
||||
static struct resource *
|
||||
nexus_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 resource *rv;
|
||||
struct rman *rm;
|
||||
|
||||
switch (type) {
|
||||
case SYS_RES_IRQ:
|
||||
rm = &irq_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_DRQ:
|
||||
rm = &drq_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_IOPORT:
|
||||
rm = &port_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_MEMORY:
|
||||
rm = &mem_rman;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
rv = rman_reserve_resource(rm, start, end, count, flags, child);
|
||||
if (rv == 0)
|
||||
return 0;
|
||||
|
||||
if (type == SYS_RES_MEMORY) {
|
||||
caddr_t vaddr = 0;
|
||||
|
||||
if (rv->r_end < 1024 * 1024 * 1024) {
|
||||
/*
|
||||
* The first 1Mb is mapped at KERNBASE.
|
||||
*/
|
||||
vaddr = (caddr_t)((uintptr_t)KERNBASE + rv->r_start);
|
||||
} else {
|
||||
u_int32_t paddr;
|
||||
u_int32_t psize;
|
||||
u_int32_t poffs;
|
||||
|
||||
paddr = rv->r_start;
|
||||
psize = rv->r_end - rv->r_start;
|
||||
|
||||
poffs = paddr - trunc_page(paddr);
|
||||
vaddr = (caddr_t) pmap_mapdev(paddr-poffs, psize+poffs) + poffs;
|
||||
}
|
||||
rman_set_virtual(rv, vaddr);
|
||||
rman_set_bustag(rv, I386_BUS_SPACE_MEM);
|
||||
rman_set_bushandle(rv, (bus_space_handle_t) vaddr);
|
||||
} else if (type == SYS_RES_IOPORT) {
|
||||
rman_set_bustag(rv, I386_BUS_SPACE_IO);
|
||||
rman_set_bushandle(rv, rv->r_start);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
return (rman_activate_resource(r));
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
return (rman_deactivate_resource(r));
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_release_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
return (rman_release_resource(r));
|
||||
}
|
||||
|
||||
/*
|
||||
* Currently this uses the really grody interface from kern/kern_intr.c
|
||||
* (which really doesn't belong in kern/anything.c). Eventually, all of
|
||||
* the code in kern_intr.c and machdep_intr.c should get moved here, since
|
||||
* this is going to be the official interface.
|
||||
*/
|
||||
static int
|
||||
nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
|
||||
void (*ihand)(void *), void *arg, void **cookiep)
|
||||
{
|
||||
intrmask_t *mask;
|
||||
driver_t *driver;
|
||||
int error, icflags;
|
||||
|
||||
if (child)
|
||||
device_printf(child, "interrupting at irq %d\n",
|
||||
(int)irq->r_start);
|
||||
|
||||
*cookiep = 0;
|
||||
if (irq->r_flags & RF_SHAREABLE)
|
||||
icflags = 0;
|
||||
else
|
||||
icflags = INTR_EXCL;
|
||||
|
||||
driver = device_get_driver(child);
|
||||
switch (driver->type) {
|
||||
case DRIVER_TYPE_TTY:
|
||||
mask = &tty_imask;
|
||||
break;
|
||||
case (DRIVER_TYPE_TTY | DRIVER_TYPE_FAST):
|
||||
mask = &tty_imask;
|
||||
icflags |= INTR_FAST;
|
||||
break;
|
||||
case DRIVER_TYPE_BIO:
|
||||
mask = &bio_imask;
|
||||
break;
|
||||
case DRIVER_TYPE_NET:
|
||||
mask = &net_imask;
|
||||
break;
|
||||
case DRIVER_TYPE_CAM:
|
||||
mask = &cam_imask;
|
||||
break;
|
||||
case DRIVER_TYPE_MISC:
|
||||
mask = 0;
|
||||
break;
|
||||
default:
|
||||
panic("still using grody create_intr interface");
|
||||
}
|
||||
|
||||
/*
|
||||
* We depend here on rman_activate_resource() being idempotent.
|
||||
*/
|
||||
error = rman_activate_resource(irq);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
*cookiep = intr_create((void *)(intptr_t)-1, irq->r_start, ihand, arg,
|
||||
mask, icflags);
|
||||
if (*cookiep)
|
||||
error = intr_connect(*cookiep);
|
||||
else
|
||||
error = EINVAL; /* XXX ??? */
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
|
||||
{
|
||||
return (intr_destroy(ih));
|
||||
}
|
||||
|
||||
static devclass_t pcib_devclass;
|
||||
|
||||
static int
|
||||
nexus_pcib_probe(device_t dev)
|
||||
{
|
||||
device_set_desc(dev, "PCI host bus adapter");
|
||||
|
||||
device_add_child(dev, "pci", 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static device_method_t nexus_pcib_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, nexus_pcib_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t nexus_pcib_driver = {
|
||||
"pcib",
|
||||
nexus_pcib_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1,
|
||||
};
|
||||
|
||||
DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0);
|
|
@ -35,7 +35,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)machdep.c 7.4 (Berkeley) 6/3/91
|
||||
* $Id: machdep.c,v 1.327 1999/03/06 04:46:18 wollman Exp $
|
||||
* $Id: machdep.c,v 1.328 1999/04/03 22:19:58 jdp Exp $
|
||||
*/
|
||||
|
||||
#include "apm.h"
|
||||
|
@ -71,6 +71,7 @@
|
|||
#include <sys/sysent.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/vmmeter.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#ifdef SYSVSHM
|
||||
#include <sys/shm.h>
|
||||
|
@ -125,7 +126,9 @@
|
|||
#include <machine/perfmon.h>
|
||||
#endif
|
||||
|
||||
#ifdef OLD_BUS_ARCH
|
||||
#include <i386/isa/isa_device.h>
|
||||
#endif
|
||||
#include <i386/isa/intr_machdep.h>
|
||||
#ifndef VM86
|
||||
#include <i386/isa/rtc.h>
|
||||
|
@ -1164,8 +1167,10 @@ init386(first)
|
|||
unsigned biosbasemem, biosextmem;
|
||||
struct gate_descriptor *gdp;
|
||||
int gsel_tss;
|
||||
#if NNPX > 0
|
||||
int msize;
|
||||
#endif
|
||||
|
||||
struct isa_device *idp;
|
||||
#ifndef SMP
|
||||
/* table descriptors - used to load tables by microp */
|
||||
struct region_descriptor r_gdt, r_idt;
|
||||
|
@ -1454,10 +1459,11 @@ init386(first)
|
|||
#endif
|
||||
|
||||
#if NNPX > 0
|
||||
idp = find_isadev(isa_devtab_null, &npxdriver, 0);
|
||||
if (idp != NULL && idp->id_msize != 0) {
|
||||
Maxmem = idp->id_msize / 4;
|
||||
speculative_mprobe = FALSE;
|
||||
if (resource_int_value("npx", 0, "msize", &msize) == 0) {
|
||||
if (msize != 0) {
|
||||
Maxmem = msize / 4;
|
||||
speculative_mprobe = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
409
sys/i386/i386/nexus.c
Normal file
409
sys/i386/i386/nexus.c
Normal file
|
@ -0,0 +1,409 @@
|
|||
/*
|
||||
* Copyright 1998 Massachusetts Institute of Technology
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software and
|
||||
* its documentation for any purpose and without fee is hereby
|
||||
* granted, provided that both the above copyright notice and this
|
||||
* permission notice appear in all copies, that both the above
|
||||
* copyright notice and this permission notice appear in all
|
||||
* supporting documentation, and that the name of M.I.T. not be used
|
||||
* in advertising or publicity pertaining to distribution of the
|
||||
* software without specific, written prior permission. M.I.T. makes
|
||||
* no representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
|
||||
* ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
|
||||
* SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (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$
|
||||
*/
|
||||
|
||||
/*
|
||||
* This code implements a `root nexus' for Intel Architecture
|
||||
* machines. The function of the root nexus is to serve as an
|
||||
* attachment point for both processors and buses, and to manage
|
||||
* resources which are common to all of them. In particular,
|
||||
* this code implements the core resource managers for interrupt
|
||||
* requests, DMA requests (which rightfully should be a part of the
|
||||
* ISA code but it's easier to do it here for now), I/O port addresses,
|
||||
* and I/O memory address space.
|
||||
*/
|
||||
|
||||
#include "opt_smp.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/interrupt.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <machine/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <machine/vmparam.h>
|
||||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
#include <machine/pmap.h>
|
||||
|
||||
#include <machine/ipl.h>
|
||||
#include <machine/resource.h>
|
||||
#ifdef APIC_IO
|
||||
#include <machine/smp.h>
|
||||
#include <machine/mpapic.h>
|
||||
#endif
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
#include <i386/isa/icu.h>
|
||||
#include <i386/isa/intr_machdep.h>
|
||||
|
||||
#include <pci/pcivar.h>
|
||||
|
||||
#include "eisa.h"
|
||||
#include "isa.h"
|
||||
#include "pci.h"
|
||||
#include "npx.h"
|
||||
#include "apm.h"
|
||||
|
||||
static struct rman irq_rman, drq_rman, port_rman, mem_rman;
|
||||
|
||||
static int nexus_probe(device_t);
|
||||
static void nexus_print_child(device_t, device_t);
|
||||
static struct resource *nexus_alloc_resource(device_t, device_t, int, int *,
|
||||
u_long, u_long, u_long, u_int);
|
||||
static int nexus_activate_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_deactivate_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_release_resource(device_t, device_t, int, int,
|
||||
struct resource *);
|
||||
static int nexus_setup_intr(device_t, device_t, struct resource *,
|
||||
void (*)(void *), void *, void **);
|
||||
static int nexus_teardown_intr(device_t, device_t, struct resource *,
|
||||
void *);
|
||||
|
||||
static device_method_t nexus_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, nexus_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
DEVMETHOD(device_detach, bus_generic_detach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, nexus_print_child),
|
||||
DEVMETHOD(bus_read_ivar, bus_generic_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, bus_generic_write_ivar),
|
||||
DEVMETHOD(bus_alloc_resource, nexus_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, nexus_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, nexus_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, nexus_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, nexus_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, nexus_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t nexus_driver = {
|
||||
"nexus",
|
||||
nexus_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1, /* no softc */
|
||||
};
|
||||
static devclass_t nexus_devclass;
|
||||
|
||||
DRIVER_MODULE(nexus, root, nexus_driver, nexus_devclass, 0, 0);
|
||||
|
||||
#ifdef APIC_IO
|
||||
#define LASTIRQ (NINTR - 1)
|
||||
#else
|
||||
#define LASTIRQ 15
|
||||
#endif
|
||||
|
||||
static int
|
||||
nexus_probe(device_t dev)
|
||||
{
|
||||
device_t child;
|
||||
|
||||
device_quiet(dev); /* suppress attach message for neatness */
|
||||
|
||||
irq_rman.rm_start = 0;
|
||||
irq_rman.rm_end = LASTIRQ;
|
||||
irq_rman.rm_type = RMAN_ARRAY;
|
||||
irq_rman.rm_descr = "Interrupt request lines";
|
||||
if (rman_init(&irq_rman)
|
||||
|| rman_manage_region(&irq_rman, 0, 1)
|
||||
|| rman_manage_region(&irq_rman, 3, LASTIRQ))
|
||||
panic("nexus_probe irq_rman");
|
||||
|
||||
drq_rman.rm_start = 0;
|
||||
drq_rman.rm_end = 7;
|
||||
drq_rman.rm_type = RMAN_ARRAY;
|
||||
drq_rman.rm_descr = "DMA request lines";
|
||||
/* XXX drq 0 not available on some machines */
|
||||
if (rman_init(&drq_rman)
|
||||
|| rman_manage_region(&drq_rman, 0, 7))
|
||||
panic("nexus_probe drq_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("nexus_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, 0, ~0))
|
||||
panic("nexus_probe mem_rman");
|
||||
|
||||
#if NNPX > 0
|
||||
child = device_add_child(dev, "npx", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe npx");
|
||||
#endif /* NNPX > 0 */
|
||||
#if NAPM > 0
|
||||
child = device_add_child(dev, "apm", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe apm");
|
||||
#endif /* NAPM > 0 */
|
||||
#if NPCI > 0
|
||||
/* Add a PCI bridge if pci bus is present */
|
||||
if (pci_cfgopen() != 0) {
|
||||
child = device_add_child(dev, "pcib", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe pcib");
|
||||
}
|
||||
#endif
|
||||
#if 0 && NEISA > 0
|
||||
child = device_add_child(dev, "eisa", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe eisa");
|
||||
#endif
|
||||
#if NISA > 0
|
||||
/* Add an ISA bus directly if pci bus is not present */
|
||||
if (pci_cfgopen() == 0) {
|
||||
child = device_add_child(dev, "isa", 0, 0);
|
||||
if (child == 0)
|
||||
panic("nexus_probe isa");
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
nexus_print_child(device_t bus, device_t child)
|
||||
{
|
||||
printf(" on motherboard");
|
||||
}
|
||||
|
||||
/*
|
||||
* 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 nexus0.
|
||||
* (Exceptions include npx.)
|
||||
*/
|
||||
static struct resource *
|
||||
nexus_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 resource *rv;
|
||||
struct rman *rm;
|
||||
|
||||
switch (type) {
|
||||
case SYS_RES_IRQ:
|
||||
rm = &irq_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_DRQ:
|
||||
rm = &drq_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_IOPORT:
|
||||
rm = &port_rman;
|
||||
break;
|
||||
|
||||
case SYS_RES_MEMORY:
|
||||
rm = &mem_rman;
|
||||
break;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
rv = rman_reserve_resource(rm, start, end, count, flags, child);
|
||||
if (rv == 0)
|
||||
return 0;
|
||||
|
||||
if (type == SYS_RES_MEMORY) {
|
||||
caddr_t vaddr = 0;
|
||||
|
||||
if (rv->r_end < 1024 * 1024 * 1024) {
|
||||
/*
|
||||
* The first 1Mb is mapped at KERNBASE.
|
||||
*/
|
||||
vaddr = (caddr_t)((uintptr_t)KERNBASE + rv->r_start);
|
||||
} else {
|
||||
u_int32_t paddr;
|
||||
u_int32_t psize;
|
||||
u_int32_t poffs;
|
||||
|
||||
paddr = rv->r_start;
|
||||
psize = rv->r_end - rv->r_start;
|
||||
|
||||
poffs = paddr - trunc_page(paddr);
|
||||
vaddr = (caddr_t) pmap_mapdev(paddr-poffs, psize+poffs) + poffs;
|
||||
}
|
||||
rman_set_virtual(rv, vaddr);
|
||||
rman_set_bustag(rv, I386_BUS_SPACE_MEM);
|
||||
rman_set_bushandle(rv, (bus_space_handle_t) vaddr);
|
||||
} else if (type == SYS_RES_IOPORT) {
|
||||
rman_set_bustag(rv, I386_BUS_SPACE_IO);
|
||||
rman_set_bushandle(rv, rv->r_start);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_activate_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
return (rman_activate_resource(r));
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_deactivate_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
return (rman_deactivate_resource(r));
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_release_resource(device_t bus, device_t child, int type, int rid,
|
||||
struct resource *r)
|
||||
{
|
||||
return (rman_release_resource(r));
|
||||
}
|
||||
|
||||
/*
|
||||
* Currently this uses the really grody interface from kern/kern_intr.c
|
||||
* (which really doesn't belong in kern/anything.c). Eventually, all of
|
||||
* the code in kern_intr.c and machdep_intr.c should get moved here, since
|
||||
* this is going to be the official interface.
|
||||
*/
|
||||
static int
|
||||
nexus_setup_intr(device_t bus, device_t child, struct resource *irq,
|
||||
void (*ihand)(void *), void *arg, void **cookiep)
|
||||
{
|
||||
intrmask_t *mask;
|
||||
driver_t *driver;
|
||||
int error, icflags;
|
||||
|
||||
if (child)
|
||||
device_printf(child, "interrupting at irq %d\n",
|
||||
(int)irq->r_start);
|
||||
|
||||
*cookiep = 0;
|
||||
if (irq->r_flags & RF_SHAREABLE)
|
||||
icflags = 0;
|
||||
else
|
||||
icflags = INTR_EXCL;
|
||||
|
||||
driver = device_get_driver(child);
|
||||
switch (driver->type) {
|
||||
case DRIVER_TYPE_TTY:
|
||||
mask = &tty_imask;
|
||||
break;
|
||||
case (DRIVER_TYPE_TTY | DRIVER_TYPE_FAST):
|
||||
mask = &tty_imask;
|
||||
icflags |= INTR_FAST;
|
||||
break;
|
||||
case DRIVER_TYPE_BIO:
|
||||
mask = &bio_imask;
|
||||
break;
|
||||
case DRIVER_TYPE_NET:
|
||||
mask = &net_imask;
|
||||
break;
|
||||
case DRIVER_TYPE_CAM:
|
||||
mask = &cam_imask;
|
||||
break;
|
||||
case DRIVER_TYPE_MISC:
|
||||
mask = 0;
|
||||
break;
|
||||
default:
|
||||
panic("still using grody create_intr interface");
|
||||
}
|
||||
|
||||
/*
|
||||
* We depend here on rman_activate_resource() being idempotent.
|
||||
*/
|
||||
error = rman_activate_resource(irq);
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
*cookiep = intr_create((void *)(intptr_t)-1, irq->r_start, ihand, arg,
|
||||
mask, icflags);
|
||||
if (*cookiep)
|
||||
error = intr_connect(*cookiep);
|
||||
else
|
||||
error = EINVAL; /* XXX ??? */
|
||||
|
||||
return (error);
|
||||
}
|
||||
|
||||
static int
|
||||
nexus_teardown_intr(device_t dev, device_t child, struct resource *r, void *ih)
|
||||
{
|
||||
return (intr_destroy(ih));
|
||||
}
|
||||
|
||||
static devclass_t pcib_devclass;
|
||||
|
||||
static int
|
||||
nexus_pcib_probe(device_t dev)
|
||||
{
|
||||
device_set_desc(dev, "PCI host bus adapter");
|
||||
|
||||
device_add_child(dev, "pci", 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static device_method_t nexus_pcib_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, nexus_pcib_probe),
|
||||
DEVMETHOD(device_attach, bus_generic_attach),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
/* Bus interface */
|
||||
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t nexus_pcib_driver = {
|
||||
"pcib",
|
||||
nexus_pcib_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
1,
|
||||
};
|
||||
|
||||
DRIVER_MODULE(pcib, nexus, nexus_pcib_driver, pcib_devclass, 0, 0);
|
|
@ -46,7 +46,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: userconfig.c,v 1.132 1999/02/21 16:33:51 n_hibma Exp $
|
||||
** $Id: userconfig.c,v 1.133 1999/04/06 17:08:30 wpaul Exp $
|
||||
**/
|
||||
|
||||
/**
|
||||
|
@ -115,11 +115,13 @@
|
|||
#include <sys/reboot.h>
|
||||
#include <sys/linker.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/cons.h>
|
||||
#include <machine/md_var.h>
|
||||
#include <machine/limits.h>
|
||||
|
||||
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include "pnp.h"
|
||||
|
||||
|
@ -132,11 +134,17 @@
|
|||
static MALLOC_DEFINE(M_DEVL, "isa_devlist", "isa_device lists in userconfig()");
|
||||
|
||||
static struct isa_device *isa_devlist; /* list read by kget to extract changes */
|
||||
static struct isa_device *isa_devtab; /* fake isa_device table */
|
||||
static struct isa_driver *isa_drvtab; /* fake driver list */
|
||||
|
||||
static int userconfig_boot_parsing; /* set if we are reading from the boot instructions */
|
||||
|
||||
#define putchar(x) cnputc(x)
|
||||
|
||||
static void load_devtab(void);
|
||||
static void free_devtab(void);
|
||||
static void save_resource(struct isa_device *);
|
||||
|
||||
static int
|
||||
sysctl_machdep_uc_devlist SYSCTL_HANDLER_ARGS
|
||||
{
|
||||
|
@ -279,8 +287,6 @@ getchar(void)
|
|||
#endif
|
||||
|
||||
#ifdef VISUAL_USERCONFIG
|
||||
static struct isa_device *devtabs[] = { isa_devtab_bio, isa_devtab_tty, isa_devtab_net,
|
||||
isa_devtab_cam, isa_devtab_null, NULL };
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
@ -538,12 +544,10 @@ setdev(DEV_LIST *dev, int enabled)
|
|||
static void
|
||||
getdevs(void)
|
||||
{
|
||||
int i,j;
|
||||
int i;
|
||||
struct isa_device *ap;
|
||||
|
||||
for (j = 0; devtabs[j]; j++) /* ISA devices */
|
||||
{
|
||||
ap = devtabs[j]; /* pointer to array of devices */
|
||||
ap = isa_devtab; /* pointer to array of devices */
|
||||
for (i = 0; ap[i].id_id; i++) /* for each device in this table */
|
||||
{
|
||||
scratch.unit = ap[i].id_unit; /* device parameters */
|
||||
|
@ -563,7 +567,6 @@ getdevs(void)
|
|||
if (!devinfo(&scratch)) /* get more info on the device */
|
||||
insdev(&scratch,ap[i].id_enabled?active:inactive);
|
||||
}
|
||||
}
|
||||
#if NPCI > 0
|
||||
for (i = 0; i < pcidevice_set.ls_length; i++)
|
||||
{
|
||||
|
@ -847,6 +850,7 @@ savelist(DEV_LIST *list, int active)
|
|||
{
|
||||
id_pn = id_p->id_next;
|
||||
bcopy(list->device,id_p,sizeof(struct isa_device));
|
||||
save_resource(list->device);
|
||||
id_p->id_next = id_pn;
|
||||
break;
|
||||
}
|
||||
|
@ -855,6 +859,7 @@ savelist(DEV_LIST *list, int active)
|
|||
{
|
||||
id_pn = malloc(sizeof(struct isa_device),M_DEVL,M_WAITOK);
|
||||
bcopy(list->device,id_pn,sizeof(struct isa_device));
|
||||
save_resource(list->device);
|
||||
id_pn->id_next = isa_devlist;
|
||||
isa_devlist = id_pn; /* park at top of list */
|
||||
}
|
||||
|
@ -2510,7 +2515,7 @@ visuserconfig(void)
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: userconfig.c,v 1.132 1999/02/21 16:33:51 n_hibma Exp $
|
||||
* $Id: userconfig.c,v 1.133 1999/04/06 17:08:30 wpaul Exp $
|
||||
*/
|
||||
|
||||
#include "scbus.h"
|
||||
|
@ -2659,6 +2664,7 @@ userconfig(void)
|
|||
int rval;
|
||||
Cmd *cmd;
|
||||
|
||||
load_devtab();
|
||||
init_config_script();
|
||||
while (1) {
|
||||
|
||||
|
@ -2693,8 +2699,10 @@ userconfig(void)
|
|||
continue;
|
||||
}
|
||||
rval = (*cmd->handler)(cmd->parms);
|
||||
if (rval)
|
||||
if (rval) {
|
||||
free_devtab();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2792,11 +2800,7 @@ static int
|
|||
list_devices(CmdParm *parms)
|
||||
{
|
||||
lineno = 0;
|
||||
if (lsdevtab(&isa_devtab_bio[0])) return 0;
|
||||
if (lsdevtab(&isa_devtab_tty[0])) return 0;
|
||||
if (lsdevtab(&isa_devtab_net[0])) return 0;
|
||||
if (lsdevtab(&isa_devtab_cam[0])) return 0;
|
||||
if (lsdevtab(&isa_devtab_null[0])) return 0;
|
||||
if (lsdevtab(isa_devtab)) return 0;
|
||||
#if NPNP > 0
|
||||
if (lspnp()) return 0;
|
||||
#endif
|
||||
|
@ -3312,20 +3316,65 @@ lsdevtab(struct isa_device *dt)
|
|||
return(0);
|
||||
}
|
||||
|
||||
static void
|
||||
load_devtab(void)
|
||||
{
|
||||
int i, val;
|
||||
int count = resource_count();
|
||||
int id = 1;
|
||||
int dt;
|
||||
char *name;
|
||||
int unit;
|
||||
|
||||
isa_devtab = malloc(sizeof(struct isa_device)*(count + 1),M_DEVL,M_WAITOK);
|
||||
isa_drvtab = malloc(sizeof(struct isa_driver)*(count + 1),M_DEVL,M_WAITOK);
|
||||
bzero(isa_devtab, sizeof(struct isa_device) * (count + 1));
|
||||
bzero(isa_drvtab, sizeof(struct isa_driver) * (count + 1));
|
||||
dt = 0;
|
||||
for (i = 0; i < count; i++) {
|
||||
name = resource_query_name(i);
|
||||
unit = resource_query_unit(i);
|
||||
if (unit < 0)
|
||||
continue; /* skip wildcards */
|
||||
isa_devtab[dt].id_id = id++;
|
||||
isa_devtab[dt].id_driver = &isa_drvtab[dt];
|
||||
resource_int_value(name, unit, "port", &isa_devtab[dt].id_iobase);
|
||||
val = 0;
|
||||
resource_int_value(name, unit, "irq", &val);
|
||||
isa_devtab[dt].id_irq = (1 << val);
|
||||
resource_int_value(name, unit, "drq", &isa_devtab[dt].id_drq);
|
||||
resource_int_value(name, unit, "maddr",(int *)&isa_devtab[dt].id_maddr);
|
||||
resource_int_value(name, unit, "msize", &isa_devtab[dt].id_msize);
|
||||
isa_devtab[dt].id_unit = unit;
|
||||
resource_int_value(name, unit, "flags", &isa_devtab[dt].id_flags);
|
||||
val = 0;
|
||||
resource_int_value(name, unit, "disabled", &val);
|
||||
isa_devtab[dt].id_enabled = !val;
|
||||
isa_drvtab[dt].name = malloc(strlen(name) + 1, M_DEVL,M_WAITOK);
|
||||
strcpy(isa_drvtab[dt].name, name);
|
||||
dt++;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
free_devtab(void)
|
||||
{
|
||||
int i;
|
||||
int count = resource_count();
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
if (isa_drvtab[i].name)
|
||||
free(isa_drvtab[i].name, M_DEVL);
|
||||
free(isa_drvtab, M_DEVL);
|
||||
free(isa_devtab, M_DEVL);
|
||||
}
|
||||
|
||||
static struct isa_device *
|
||||
find_device(char *devname, int unit)
|
||||
{
|
||||
struct isa_device *ret;
|
||||
|
||||
if ((ret = search_devtable(&isa_devtab_bio[0], devname, unit)) != NULL)
|
||||
return ret;
|
||||
if ((ret = search_devtable(&isa_devtab_tty[0], devname, unit)) != NULL)
|
||||
return ret;
|
||||
if ((ret = search_devtable(&isa_devtab_net[0], devname, unit)) != NULL)
|
||||
return ret;
|
||||
if ((ret = search_devtable(&isa_devtab_cam[0], devname, unit)) != NULL)
|
||||
return ret;
|
||||
if ((ret = search_devtable(&isa_devtab_null[0], devname, unit)) != NULL)
|
||||
if ((ret = search_devtable(isa_devtab, devname, unit)) != NULL)
|
||||
return ret;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -3532,6 +3581,29 @@ list_scsi(CmdParm *parms)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
save_resource(struct isa_device *idev)
|
||||
{
|
||||
int i;
|
||||
char *name;
|
||||
int unit;
|
||||
int count = resource_count();
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
name = resource_query_name(i);
|
||||
unit = resource_query_unit(i);
|
||||
if (strcmp(name, idev->id_driver->name) || unit != idev->id_unit)
|
||||
continue;
|
||||
resource_set_int(i, "port", isa_devtab[i].id_iobase);
|
||||
resource_set_int(i, "irq", (1 << isa_devtab[i].id_irq));
|
||||
resource_set_int(i, "drq", isa_devtab[i].id_drq);
|
||||
resource_set_int(i, "maddr", (int)isa_devtab[i].id_maddr);
|
||||
resource_set_int(i, "msize", isa_devtab[i].id_msize);
|
||||
resource_set_int(i, "flags", isa_devtab[i].id_flags);
|
||||
resource_set_int(i, "disabled", !isa_devtab[i].id_enabled);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
save_dev(idev)
|
||||
struct isa_device *idev;
|
||||
|
@ -3544,6 +3616,7 @@ struct isa_device *idev;
|
|||
if (id_p->id_id == idev->id_id) {
|
||||
id_pn = id_p->id_next;
|
||||
bcopy(idev,id_p,sizeof(struct isa_device));
|
||||
save_resource(idev);
|
||||
id_p->id_next = id_pn;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: asnames.h,v 1.29 1999/02/22 15:13:34 bde Exp $
|
||||
* $Id: asnames.h,v 1.30 1999/02/25 12:53:34 bde Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_ASNAMES_H_
|
||||
|
@ -291,7 +291,7 @@
|
|||
#define _normalize_nuo normalize_nuo
|
||||
#define _npx_intrs_while_probing npx_intrs_while_probing
|
||||
#define _npx_traps_while_probing npx_traps_while_probing
|
||||
#define _npxintr npxintr
|
||||
#define _npx_intr npx_intr
|
||||
#define _npxproc npxproc
|
||||
#define _npxsave npxsave
|
||||
#define _other_cpus other_cpus
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: aha_isa.c,v 1.5 1998/11/10 06:44:54 gibbs Exp $
|
||||
* $Id: aha_isa.c,v 1.6 1999/01/20 06:21:23 imp Exp $
|
||||
*/
|
||||
|
||||
#include "pnp.h"
|
||||
|
@ -257,7 +257,6 @@ static void
|
|||
ahapnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
||||
{
|
||||
struct pnp_cinfo d;
|
||||
struct isa_device *dvp;
|
||||
|
||||
if (dev->id_unit >= NAHATOT)
|
||||
return;
|
||||
|
@ -278,9 +277,7 @@ ahapnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
|||
|
||||
if (dev->id_driver == NULL) {
|
||||
dev->id_driver = &ahadriver;
|
||||
dvp = find_isadev(isa_devtab_tty, &ahadriver, 0);
|
||||
if (dvp != NULL)
|
||||
dev->id_id = dvp->id_id;
|
||||
dev->id_id = isa_compat_nextid();
|
||||
}
|
||||
|
||||
if ((dev->id_alive = aha_isa_probe(dev)) != 0)
|
||||
|
|
1179
sys/i386/isa/fd.c
1179
sys/i386/isa/fd.c
File diff suppressed because it is too large
Load diff
|
@ -31,7 +31,7 @@
|
|||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
||||
* $Id: fdc.h,v 1.12 1998/12/12 08:16:01 imp Exp $
|
||||
* $Id: fdc.h,v 1.13 1999/01/15 09:15:27 bde Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -70,6 +70,10 @@ struct fdc_data
|
|||
int fdc_errs; /* number of logged errors */
|
||||
struct buf_queue_head head;
|
||||
struct buf *bp; /* active buffer */
|
||||
struct resource *res_ioport, *res_irq, *res_drq;
|
||||
int rid_ioport, rid_irq, rid_drq;
|
||||
void *fdc_intr;
|
||||
struct device *fdc_dev;
|
||||
};
|
||||
|
||||
/***********************************************************************\
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue