Install temporary page fault handler while doing PCI config read and

write since these can generate MCHK for missing devices.
This commit is contained in:
augustss 2002-09-27 09:46:01 +00:00
parent bd0971158d
commit e3a6ac4328
1 changed files with 22 additions and 1 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pci_machdep.c,v 1.1 2002/05/30 08:51:36 augustss Exp $ */
/* $NetBSD: pci_machdep.c,v 1.2 2002/09/27 09:46:01 augustss Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -51,6 +51,7 @@
#include <sys/queue.h>
#include <sys/systm.h>
#include <sys/time.h>
#include <machine/pcb.h>
#include <uvm/uvm.h>
@ -66,6 +67,8 @@
#include <dev/pci/pcireg.h>
#include <dev/pci/pciconf.h>
int setfault(faultbuf); /* defined in locore.S */
struct powerpc_bus_dma_tag pci_bus_dma_tag = {
0, /* _bounce_thresh */
_bus_dmamap_create,
@ -131,21 +134,39 @@ pcireg_t
pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
{
pcireg_t data;
faultbuf env, *oldfault;
oldfault = curpcb->pcb_onfault;
if (setfault(env)) {
curpcb->pcb_onfault = oldfault;
return 0;
}
/*printf("pci_conf_read %x %x\n", tag, reg);*/
out32rb(CPC_PCICFGADR, SP_PCI(tag, reg));
data = in32rb(CPC_PCICFGDATA);
/*out32rb(CPC_PCICFGADR, 0);*/
curpcb->pcb_onfault = oldfault;
return data;
}
void
pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data)
{
faultbuf env, *oldfault;
oldfault = curpcb->pcb_onfault;
if (setfault(env)) {
curpcb->pcb_onfault = oldfault;
return;
}
/*printf("pci_conf_write %x %x %x\n", tag, reg, data);*/
out32rb(CPC_PCICFGADR, SP_PCI(tag, reg));
out32rb(CPC_PCICFGDATA, data);
/*out32rb(CPC_PCICFGADR, 0);*/
curpcb->pcb_onfault = oldfault;
}
int