diff options
author | dg <dg@FreeBSD.org> | 1995-03-17 04:27:21 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-03-17 04:27:21 +0000 |
commit | b553215b12e7b5a5694196a76a7eeaaab7c61e4e (patch) | |
tree | 70ee5f641c6ef0c9cab22daae6a9b2a8ede50326 | |
parent | 865b8325a4b6237f192b4c21e221c3c003e8bef1 (diff) | |
download | FreeBSD-src-b553215b12e7b5a5694196a76a7eeaaab7c61e4e.zip FreeBSD-src-b553215b12e7b5a5694196a76a7eeaaab7c61e4e.tar.gz |
Added a new field to the pci_device struct called pd_shutdown to specify
a device specific shutdown routine for devconf. Assign the value of this
to the kern_devconf struct. Implement a device shutdown routine for if_de
that disables the device. This will stop the device from corrupting memory
after a reboot.
-rw-r--r-- | sys/dev/de/if_de.c | 21 | ||||
-rw-r--r-- | sys/dev/pci/pci.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/pcivar.h | 3 | ||||
-rw-r--r-- | sys/pci/aic7870.c | 5 | ||||
-rw-r--r-- | sys/pci/if_de.c | 21 | ||||
-rw-r--r-- | sys/pci/if_pdq.c | 8 | ||||
-rw-r--r-- | sys/pci/ncr.c | 8 | ||||
-rw-r--r-- | sys/pci/pci.c | 12 | ||||
-rw-r--r-- | sys/pci/pcisupport.c | 18 | ||||
-rw-r--r-- | sys/pci/pcivar.h | 3 |
10 files changed, 85 insertions, 26 deletions
diff --git a/sys/dev/de/if_de.c b/sys/dev/de/if_de.c index d413c94..494a0fb 100644 --- a/sys/dev/de/if_de.c +++ b/sys/dev/de/if_de.c @@ -21,7 +21,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: if_de.c,v 1.16 1995/02/10 06:06:42 davidg Exp $ + * $Id: if_de.c,v 1.17 1995/03/16 17:41:20 se Exp $ * */ @@ -49,6 +49,7 @@ #include <sys/malloc.h> #include <sys/kernel.h> #include <sys/proc.h> /* only for declaration of wakeup() used by vm.h */ +#include <sys/devconf.h> #include <machine/clock.h> #include <net/if.h> @@ -1049,12 +1050,14 @@ tulip_initring( static char* tulip_pci_probe (pcici_t config_id, pcidi_t device_id); static void tulip_pci_attach(pcici_t config_id, int unit); static u_long tulip_count; +static int tulip_pci_shutdown(struct kern_devconf *, int); struct pci_device dedevice = { "de", tulip_pci_probe, tulip_pci_attach, &tulip_count, + tulip_pci_shutdown, }; DATA_SET (pcidevice_set, dedevice); @@ -1163,5 +1166,21 @@ tulip_pci_attach( pci_map_int (config_id, tulip_intr, (void*) sc, &net_imask); } } + +static int +tulip_pci_shutdown(kdc, force) + struct kern_devconf *kdc; + int force; +{ + tulip_softc_t *sc = tulips[kdc->kdc_unit]; + + *sc->tulip_csrs.csr_busmode = TULIP_BUSMODE_SWRESET; + DELAY(10); /* Wait 10 microsends (actually 50 PCI cycles but at + 33MHz that comes to two microseconds but wait a + bit longer anyways) */ + (void) dev_detach(kdc); + return 0; +} + #endif /* NPCI > 0 */ #endif /* NDE > 0 */ diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c index 377aaa7..aa51596 100644 --- a/sys/dev/pci/pci.c +++ b/sys/dev/pci/pci.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pci.c,v 1.17 1995/02/27 17:17:13 se Exp $ +** $Id: pci.c,v 1.18 1995/03/02 21:51:53 se Exp $ ** ** General subroutines for the PCI bus on 80*86 systems. ** pci_configure () @@ -63,10 +63,6 @@ #include <vm/vm.h> #include <vm/vm_param.h> -#include <pci/pcivar.h> -#include <pci/pcireg.h> -#include <pci/pcibus.h> - #include <machine/pmap.h> #ifdef __FreeBSD2__ #include <sys/devconf.h> @@ -91,6 +87,11 @@ extern pmap_t pmap_kernel(void); static vm_offset_t pmap_mapdev (vm_offset_t paddr, vm_size_t vsize); #endif /* __FreeBSD2__ */ +#include <pci/pcivar.h> +#include <pci/pcireg.h> +#include <pci/pcibus.h> + + /*======================================================== ** @@ -407,6 +408,7 @@ void pci_configure() pdcp -> pdc_kdc.kdc_parentdata = &pdcp->pdc_pi; pdcp -> pdc_kdc.kdc_state = DC_UNKNOWN; pdcp -> pdc_kdc.kdc_description = name; + pdcp -> pdc_kdc.kdc_shutdown = dvp->pd_shutdown; /* ** And register this device diff --git a/sys/dev/pci/pcivar.h b/sys/dev/pci/pcivar.h index 73ce43e..4e62dbf 100644 --- a/sys/dev/pci/pcivar.h +++ b/sys/dev/pci/pcivar.h @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcivar.h,v 1.1 1995/02/01 22:56:55 se Exp $ +** $Id: pcivar.h,v 1.2 1995/02/27 17:17:14 se Exp $ ** ** Declarations for pci device drivers. ** @@ -129,6 +129,7 @@ struct pci_device { char* (*pd_probe ) (pcici_t tag, pcidi_t type); void (*pd_attach) (pcici_t tag, int unit); u_long *pd_count; + int (*pd_shutdown) (struct kern_devconf *, int); }; /*----------------------------------------------------------------- diff --git a/sys/pci/aic7870.c b/sys/pci/aic7870.c index f875006..86375cf 100644 --- a/sys/pci/aic7870.c +++ b/sys/pci/aic7870.c @@ -19,7 +19,7 @@ * 4. Modifications may be freely made to this file if the above conditions * are met. * - * $Id: aic7870.c,v 1.5 1995/02/02 13:12:13 davidg Exp $ + * $Id: aic7870.c,v 1.6 1995/02/03 17:08:17 gibbs Exp $ */ #include <pci.h> @@ -46,7 +46,8 @@ struct pci_device ahc_device = { "ahc", aic7870_probe, aic7870_attach, - &aic7870_count + &aic7870_count, + NULL }; DATA_SET (pcidevice_set, ahc_device); diff --git a/sys/pci/if_de.c b/sys/pci/if_de.c index d413c94..494a0fb 100644 --- a/sys/pci/if_de.c +++ b/sys/pci/if_de.c @@ -21,7 +21,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: if_de.c,v 1.16 1995/02/10 06:06:42 davidg Exp $ + * $Id: if_de.c,v 1.17 1995/03/16 17:41:20 se Exp $ * */ @@ -49,6 +49,7 @@ #include <sys/malloc.h> #include <sys/kernel.h> #include <sys/proc.h> /* only for declaration of wakeup() used by vm.h */ +#include <sys/devconf.h> #include <machine/clock.h> #include <net/if.h> @@ -1049,12 +1050,14 @@ tulip_initring( static char* tulip_pci_probe (pcici_t config_id, pcidi_t device_id); static void tulip_pci_attach(pcici_t config_id, int unit); static u_long tulip_count; +static int tulip_pci_shutdown(struct kern_devconf *, int); struct pci_device dedevice = { "de", tulip_pci_probe, tulip_pci_attach, &tulip_count, + tulip_pci_shutdown, }; DATA_SET (pcidevice_set, dedevice); @@ -1163,5 +1166,21 @@ tulip_pci_attach( pci_map_int (config_id, tulip_intr, (void*) sc, &net_imask); } } + +static int +tulip_pci_shutdown(kdc, force) + struct kern_devconf *kdc; + int force; +{ + tulip_softc_t *sc = tulips[kdc->kdc_unit]; + + *sc->tulip_csrs.csr_busmode = TULIP_BUSMODE_SWRESET; + DELAY(10); /* Wait 10 microsends (actually 50 PCI cycles but at + 33MHz that comes to two microseconds but wait a + bit longer anyways) */ + (void) dev_detach(kdc); + return 0; +} + #endif /* NPCI > 0 */ #endif /* NDE > 0 */ diff --git a/sys/pci/if_pdq.c b/sys/pci/if_pdq.c index 609a541..e4eb42e 100644 --- a/sys/pci/if_pdq.c +++ b/sys/pci/if_pdq.c @@ -21,9 +21,14 @@ * (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: if_pdq.c,v 1.7 1995/03/14 01:52:52 thomas Exp $ + * $Id: if_pdq.c,v 1.1 1995/03/14 09:16:04 davidg Exp $ * * $Log: if_pdq.c,v $ + * Revision 1.1 1995/03/14 09:16:04 davidg + * Added support for generic FDDI and the DEC DEFEA and DEFPA FDDI adapters. + * + * Submitted by: Matt Thomas + * * Revision 1.7 1995/03/14 01:52:52 thomas * Update for new FreeBSD PCI Interrupt interface * @@ -461,6 +466,7 @@ struct pci_device fpadevice = { pdq_pci_probe, pdq_pci_attach, &pdq_pci_count, + NULL }; #if defined(__FreeBSD__) diff --git a/sys/pci/ncr.c b/sys/pci/ncr.c index 3abf2b0..2f02606c 100644 --- a/sys/pci/ncr.c +++ b/sys/pci/ncr.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: ncr.c,v 1.30 1995/03/15 18:15:32 se Exp $ +** $Id: ncr.c,v 1.31 1995/03/16 13:02:40 se Exp $ ** ** Device driver for the NCR 53C810 PCI-SCSI-Controller. ** @@ -173,6 +173,7 @@ #ifndef __NetBSD__ +#include <sys/devconf.h> #include <pci/pcivar.h> #include <pci/pcireg.h> #include <pci/ncrreg.h> @@ -1254,7 +1255,7 @@ static void ncr_attach (pcici_t tag, int unit); static char ident[] = - "\n$Id: ncr.c,v 1.30 1995/03/15 18:15:32 se Exp $\n"; + "\n$Id: ncr.c,v 1.31 1995/03/16 13:02:40 se Exp $\n"; u_long ncr_version = NCR_VERSION + (u_long) sizeof (struct ncb) @@ -1307,7 +1308,8 @@ struct pci_device ncr_device = { "ncr", ncr_probe, ncr_attach, - &ncr_count + &ncr_count, + NULL }; DATA_SET (pcidevice_set, ncr_device); diff --git a/sys/pci/pci.c b/sys/pci/pci.c index 377aaa7..aa51596 100644 --- a/sys/pci/pci.c +++ b/sys/pci/pci.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pci.c,v 1.17 1995/02/27 17:17:13 se Exp $ +** $Id: pci.c,v 1.18 1995/03/02 21:51:53 se Exp $ ** ** General subroutines for the PCI bus on 80*86 systems. ** pci_configure () @@ -63,10 +63,6 @@ #include <vm/vm.h> #include <vm/vm_param.h> -#include <pci/pcivar.h> -#include <pci/pcireg.h> -#include <pci/pcibus.h> - #include <machine/pmap.h> #ifdef __FreeBSD2__ #include <sys/devconf.h> @@ -91,6 +87,11 @@ extern pmap_t pmap_kernel(void); static vm_offset_t pmap_mapdev (vm_offset_t paddr, vm_size_t vsize); #endif /* __FreeBSD2__ */ +#include <pci/pcivar.h> +#include <pci/pcireg.h> +#include <pci/pcibus.h> + + /*======================================================== ** @@ -407,6 +408,7 @@ void pci_configure() pdcp -> pdc_kdc.kdc_parentdata = &pdcp->pdc_pi; pdcp -> pdc_kdc.kdc_state = DC_UNKNOWN; pdcp -> pdc_kdc.kdc_description = name; + pdcp -> pdc_kdc.kdc_shutdown = dvp->pd_shutdown; /* ** And register this device diff --git a/sys/pci/pcisupport.c b/sys/pci/pcisupport.c index 4e3b337..eee424a 100644 --- a/sys/pci/pcisupport.c +++ b/sys/pci/pcisupport.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcisupport.c,v 1.10 1995/02/27 17:22:09 se Exp $ +** $Id: pcisupport.c,v 1.11 1995/03/02 23:29:44 se Exp $ ** ** Device driver for INTEL PCI chipsets. ** @@ -53,6 +53,7 @@ #include <sys/types.h> #include <sys/param.h> #include <sys/kernel.h> +#include <sys/devconf.h> #include <pci/pcivar.h> #include <pci/pcireg.h> @@ -77,7 +78,8 @@ struct pci_device chipset_device = { "chip", chipset_probe, chipset_attach, - &chipset_count + &chipset_count, + NULL }; DATA_SET (pcidevice_set, chipset_device); @@ -303,7 +305,8 @@ struct pci_device ppb_device = { "ppb", ppb_probe, ppb_attach, - &ppb_count + &ppb_count, + NULL }; DATA_SET (pcidevice_set, ppb_device); @@ -345,7 +348,8 @@ struct pci_device vga_device = { "vga", vga_probe, vga_attach, - &vga_count + &vga_count, + NULL }; DATA_SET (pcidevice_set, vga_device); @@ -401,7 +405,8 @@ struct pci_device lkm_device = { "lkm", lkm_probe, lkm_attach, - &lkm_count + &lkm_count, + NULL }; DATA_SET (pcidevice_set, lkm_device); @@ -434,7 +439,8 @@ struct pci_device ign_device = { NULL, ign_probe, ign_attach, - &ign_count + &ign_count, + NULL }; DATA_SET (pcidevice_set, ign_device); diff --git a/sys/pci/pcivar.h b/sys/pci/pcivar.h index 73ce43e..4e62dbf 100644 --- a/sys/pci/pcivar.h +++ b/sys/pci/pcivar.h @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: pcivar.h,v 1.1 1995/02/01 22:56:55 se Exp $ +** $Id: pcivar.h,v 1.2 1995/02/27 17:17:14 se Exp $ ** ** Declarations for pci device drivers. ** @@ -129,6 +129,7 @@ struct pci_device { char* (*pd_probe ) (pcici_t tag, pcidi_t type); void (*pd_attach) (pcici_t tag, int unit); u_long *pd_count; + int (*pd_shutdown) (struct kern_devconf *, int); }; /*----------------------------------------------------------------- |