-#define USER_SPACE 1
/*
pci.c
-#define USER_SPACE 1
Configure devices on the PCI bus
vid= PCII_RREG16_(bus, dev, func, PCI_VID);
did= PCII_RREG16_(bus, dev, func, PCI_DID);
-#if USER_SPACE
if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL)))
printf("PCI: warning, sys_outl failed: %d\n", s);
-#else
- outl(PCII_CONFADD, PCII_UNSEL);
-#endif
#if 0
if (vid == 0xffff && did == 0xffff)
#if DEBUG
printf("in piix\n");
#endif
-#if USER_SPACE
if (OK != (s=sys_inb(PIIX_ELCR1, &elcr1)))
printf("Warning, sys_inb failed: %d\n", s);
if (OK != (s=sys_inb(PIIX_ELCR2, &elcr2)))
printf("Warning, sys_inb failed: %d\n", s);
-#else
- elcr1= inb(PIIX_ELCR1);
- elcr2= inb(PIIX_ELCR2);
-#endif
elcr= elcr1 | (elcr2 << 8);
for (i= 0; i<4; i++)
{
v= PCII_RREG8_(pcibus[busind].pb_busnr,
pcidev[devind].pd_dev, pcidev[devind].pd_func,
port);
-#if USER_SPACE
if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL)))
printf("PCI: warning, sys_outl failed: %d\n", s);
-#else
- outl(PCII_CONFADD, PCII_UNSEL);
-#endif
#if 0
printf("pcii_rreg8(%d, %d, 0x%X): %d.%d.%d= 0x%X\n",
busind, devind, port,
v= PCII_RREG16_(pcibus[busind].pb_busnr,
pcidev[devind].pd_dev, pcidev[devind].pd_func,
port);
-#if USER_SPACE
if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL)))
printf("PCI: warning, sys_outl failed: %d\n", s);
-#else
- outl(PCII_CONFADD, PCII_UNSEL);
-#endif
#if 0
printf("pcii_rreg16(%d, %d, 0x%X): %d.%d.%d= 0x%X\n",
busind, devind, port,
v= PCII_RREG32_(pcibus[busind].pb_busnr,
pcidev[devind].pd_dev, pcidev[devind].pd_func,
port);
-#if USER_SPACE
if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL)))
printf("PCI: warning, sys_outl failed: %d\n", s);
-#else
- outl(PCII_CONFADD, PCII_UNSEL);
-#endif
#if 0
printf("pcii_rreg32(%d, %d, 0x%X): %d.%d.%d= 0x%X\n",
busind, devind, port,
PCII_WREG8_(pcibus[busind].pb_busnr,
pcidev[devind].pd_dev, pcidev[devind].pd_func,
port, value);
-#if USER_SPACE
if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL)))
printf("PCI: warning, sys_outl failed: %d\n", s);
-#else
- outl(PCII_CONFADD, PCII_UNSEL);
-#endif
}
/*===========================================================================*
PCII_WREG16_(pcibus[busind].pb_busnr,
pcidev[devind].pd_dev, pcidev[devind].pd_func,
port, value);
-#if USER_SPACE
if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL)))
printf("PCI: warning, sys_outl failed: %d\n", s);
-#else
- outl(PCII_CONFADD, PCII_UNSEL);
-#endif
}
/*===========================================================================*
PCII_WREG32_(pcibus[busind].pb_busnr,
pcidev[devind].pd_dev, pcidev[devind].pd_func,
port, value);
-#if USER_SPACE
if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL)))
printf("PCI: warning, sys_outl failed: %d\n",s);
-#else
- outl(PCII_CONFADD, PCII_UNSEL);
-#endif
}
/*===========================================================================*
int s;
v= PCII_RREG16_(pcibus[busind].pb_busnr, 0, 0, PCI_SR);
-#if USER_SPACE
if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL)))
printf("PCI: warning, sys_outl failed: %d\n", s);
-#else
- outl(PCII_CONFADD, PCII_UNSEL);
-#endif
return v;
}
{
int s;
PCII_WREG16_(pcibus[busind].pb_busnr, 0, 0, PCI_SR, value);
-#if USER_SPACE
if (OK != (s=sys_outl(PCII_CONFADD, PCII_UNSEL)))
printf("PCI: warning, sys_outl failed: %d\n", s);
-#else
- outl(PCII_CONFADD, PCII_UNSEL);
-#endif
}