Adding upstream version 6.00+dfgs.
[syslinux-debian/hramrach.git] / com32 / lib / pci / writex.c
blobd83a1eede99ef8054325b9c11f7b815dff9e8568
1 #include "pci/pci.h"
3 void BWL(pci_write)(TYPE v, pciaddr_t a)
5 for (;;) {
6 switch (__pci_cfg_type) {
7 case PCI_CFG_AUTO:
8 pci_set_config_type(PCI_CFG_AUTO);
9 break; /* Try again */
11 case PCI_CFG_TYPE1:
13 uint32_t oldcf8;
14 cli();
15 oldcf8 = inl(0xcf8);
16 outl(a, 0xcf8);
17 BWL(out) (v, 0xcfc + (a & 3));
18 outl(oldcf8, 0xcf8);
19 sti();
21 return;
23 case PCI_CFG_TYPE2:
25 uint8_t oldcf8, oldcfa;
27 if (a & (0x10 << 11))
28 return; /* Devices 16-31 not supported */
30 cli();
31 oldcf8 = inb(0xcf8);
32 oldcfa = inb(0xcfa);
33 outb(0xf0 + ((a >> (8 - 1)) & 0x0e), 0xcf8);
34 outb(a >> 16, 0xcfa);
35 BWL(out) (v, 0xc000 + ((a >> (11 - 8)) & 0xf00) + (a & 0xff));
36 outb(oldcf8, 0xcf8);
37 outb(oldcfa, 0xcfa);
38 sti();
40 return;
42 case PCI_CFG_BIOS:
43 __pci_read_write_bios(BIOSCALL, v, a);
44 return;
46 default:
47 return;