pass memory- and i/o-enabled flags down via the PCI bus and device attach
arguments, so that a device can tell if its memory and I/O spaces are enabled. The flags are cleared, depending on the contents of devices CSR registers, in the machine-independent PCI bus code.
This commit is contained in:
parent
2c5444dc85
commit
cc93b2c4eb
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: apecs.c,v 1.21 1997/04/07 23:40:26 cgd Exp $ */
|
||||
/* $NetBSD: apecs.c,v 1.22 1997/04/10 23:12:16 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
@ -30,7 +30,7 @@
|
||||
#include <machine/options.h> /* Config options headers */
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.21 1997/04/07 23:40:26 cgd Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: apecs.c,v 1.22 1997/04/10 23:12:16 cgd Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -184,6 +184,7 @@ apecsattach(parent, self, aux)
|
||||
pba.pba_memt = acp->ac_memt;
|
||||
pba.pba_pc = &acp->ac_pc;
|
||||
pba.pba_bus = 0;
|
||||
pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
|
||||
config_found(self, &pba, apecsprint);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cia.c,v 1.19 1997/04/07 23:40:29 cgd Exp $ */
|
||||
/* $NetBSD: cia.c,v 1.20 1997/04/10 23:12:17 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
@ -30,7 +30,7 @@
|
||||
#include <machine/options.h> /* Config options headers */
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.19 1997/04/07 23:40:29 cgd Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: cia.c,v 1.20 1997/04/10 23:12:17 cgd Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -177,6 +177,7 @@ ciaattach(parent, self, aux)
|
||||
pba.pba_memt = ccp->cc_memt;
|
||||
pba.pba_pc = &ccp->cc_pc;
|
||||
pba.pba_bus = 0;
|
||||
pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
|
||||
config_found(self, &pba, ciaprint);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: dwlpx.c,v 1.4 1997/04/07 23:40:32 cgd Exp $ */
|
||||
/* $NetBSD: dwlpx.c,v 1.5 1997/04/10 23:12:18 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997 by Matthew Jacob
|
||||
@ -33,7 +33,7 @@
|
||||
#include <machine/options.h> /* Config options headers */
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: dwlpx.c,v 1.4 1997/04/07 23:40:32 cgd Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: dwlpx.c,v 1.5 1997/04/10 23:12:18 cgd Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -141,6 +141,7 @@ dwlpxattach(parent, self, aux)
|
||||
pba.pba_memt = sc->dwlpx_cc.cc_memt;
|
||||
pba.pba_pc = &sc->dwlpx_cc.cc_pc;
|
||||
pba.pba_bus = 0;
|
||||
pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
|
||||
config_found(self, &pba, dwlpxprint);
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: lca.c,v 1.18 1997/04/07 23:40:35 cgd Exp $ */
|
||||
/* $NetBSD: lca.c,v 1.19 1997/04/10 23:12:19 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
|
||||
@ -30,7 +30,7 @@
|
||||
#include <machine/options.h> /* Config options headers */
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: lca.c,v 1.18 1997/04/07 23:40:35 cgd Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: lca.c,v 1.19 1997/04/10 23:12:19 cgd Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -226,6 +226,7 @@ lcaattach(parent, self, aux)
|
||||
pba.pba_memt = lcp->lc_memt;
|
||||
pba.pba_pc = &lcp->lc_pc;
|
||||
pba.pba_bus = 0;
|
||||
pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
|
||||
config_found(self, &pba, lcaprint);
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
/* $NetBSD: pci_machdep.c,v 1.6 1997/01/27 10:19:33 leo Exp $ */
|
||||
/* $NetBSD: pci_machdep.c,v 1.7 1997/04/10 23:12:20 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Leo Weppelman. All rights reserved.
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
|
||||
* Copyright (c) 1994 Charles Hannum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -92,6 +92,7 @@ void *auxp;
|
||||
pba.pba_busname = "pci";
|
||||
pba.pba_pc = NULL;
|
||||
pba.pba_bus = 0;
|
||||
pba.pba_flags = PCI_FLAGS_IO_ENABLED | PCI_FLAGS_MEM_ENABLED;
|
||||
|
||||
printf("\n");
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
/* $NetBSD: pci.c,v 1.26 1996/12/05 01:25:30 cgd Exp $ */
|
||||
/* $NetBSD: pci.c,v 1.27 1997/04/10 23:12:22 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995, 1996 Christopher G. Demetriou. All rights reserved.
|
||||
* Copyright (c) 1995, 1996, 1997
|
||||
* Christopher G. Demetriou. All rights reserved.
|
||||
* Copyright (c) 1994 Charles Hannum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -149,7 +150,7 @@ pciattach(parent, self, aux)
|
||||
|
||||
for (device = 0; device < maxndevs; device++) {
|
||||
pcitag_t tag;
|
||||
pcireg_t id, class, intr, bhlcr;
|
||||
pcireg_t id, class, intr, bhlcr, csr;
|
||||
struct pci_attach_args pa;
|
||||
int pin;
|
||||
|
||||
@ -166,6 +167,7 @@ pciattach(parent, self, aux)
|
||||
id = pci_conf_read(pc, tag, PCI_ID_REG);
|
||||
if (id == 0 || id == 0xffffffff)
|
||||
continue;
|
||||
csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG);
|
||||
class = pci_conf_read(pc, tag, PCI_CLASS_REG);
|
||||
intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG);
|
||||
|
||||
@ -178,6 +180,15 @@ pciattach(parent, self, aux)
|
||||
pa.pa_id = id;
|
||||
pa.pa_class = class;
|
||||
|
||||
/* set up memory and I/O enable flags as appropriate */
|
||||
pa.pa_flags = 0;
|
||||
if ((pba->pba_flags & PCI_FLAGS_IO_ENABLED) &&
|
||||
(csr & PCI_COMMAND_IO_ENABLE))
|
||||
pa.pa_flags |= PCI_FLAGS_IO_ENABLED;
|
||||
if ((pba->pba_flags & PCI_FLAGS_MEM_ENABLED) &&
|
||||
(csr & PCI_COMMAND_MEM_ENABLE))
|
||||
pa.pa_flags |= PCI_FLAGS_MEM_ENABLED;
|
||||
|
||||
if (bus == 0) {
|
||||
pa.pa_intrswiz = 0;
|
||||
pa.pa_intrtag = tag;
|
||||
@ -221,6 +232,11 @@ pciprint(aux, pnp)
|
||||
printf("%s at %s", devinfo, pnp);
|
||||
}
|
||||
printf(" dev %d function %d", pa->pa_device, pa->pa_function);
|
||||
#if 0
|
||||
printf(" (%si/o, %smem)",
|
||||
pa->pa_flags & PCI_FLAGS_IO_ENABLED ? "" : "no ",
|
||||
pa->pa_flags & PCI_FLAGS_MEM_ENABLED ? "" : "no ");
|
||||
#endif
|
||||
return (UNCONF);
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: pcivar.h,v 1.18 1996/12/01 21:02:18 leo Exp $ */
|
||||
/* $NetBSD: pcivar.h,v 1.19 1997/04/10 23:12:23 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
|
||||
* Copyright (c) 1996, 1997 Christopher G. Demetriou. All rights reserved.
|
||||
* Copyright (c) 1994 Charles Hannum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -70,10 +70,11 @@ ERROR: COMPILING FOR UNSUPPORTED MACHINE, OR MORE THAN ONE.
|
||||
* PCI bus attach arguments.
|
||||
*/
|
||||
struct pcibus_attach_args {
|
||||
char *pba_busname; /* XXX should be common */
|
||||
char *pba_busname; /* XXX should be common */
|
||||
bus_space_tag_t pba_iot; /* pci i/o space tag */
|
||||
bus_space_tag_t pba_memt; /* pci mem space tag */
|
||||
pci_chipset_tag_t pba_pc;
|
||||
int pba_flags; /* flags; see below */
|
||||
|
||||
int pba_bus; /* PCI bus number */
|
||||
|
||||
@ -92,6 +93,7 @@ struct pci_attach_args {
|
||||
bus_space_tag_t pa_iot; /* pci i/o space tag */
|
||||
bus_space_tag_t pa_memt; /* pci mem space tag */
|
||||
pci_chipset_tag_t pa_pc;
|
||||
int pa_flags; /* flags; see below */
|
||||
|
||||
u_int pa_device;
|
||||
u_int pa_function;
|
||||
@ -112,6 +114,12 @@ struct pci_attach_args {
|
||||
pci_intr_line_t pa_intrline; /* intr. routing information */
|
||||
};
|
||||
|
||||
/*
|
||||
* Flags given in the bus and device attachment args.
|
||||
*/
|
||||
#define PCI_FLAGS_IO_ENABLED 0x01 /* I/O space is enabled */
|
||||
#define PCI_FLAGS_MEM_ENABLED 0x02 /* memory space is enabled */
|
||||
|
||||
/*
|
||||
* Locators devices that attach to 'pcibus', as specified to config.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user