mirror of
https://github.com/opnsense/src.git
synced 2026-04-20 21:59:20 -04:00
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.
This commit is contained in:
parent
3e3eb41588
commit
cb09d35cb0
10 changed files with 85 additions and 26 deletions
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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__)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
};
|
||||
|
||||
/*-----------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Reference in a new issue