syslinux-3.08-2 sources from FC4
[bootcd.git] / syslinux / com32 / lib / pci / cfgtype.c
1 #include "pci/pci.h"
2
3 enum pci_config_type __pci_cfg_type;
4
5 void pci_set_config_type(enum pci_config_type type)
6 {
7   uint32_t oldcf8;
8
9   if ( type == PCI_CFG_AUTO ) {
10     /* Try to detect CM #1 */
11     cli();
12     oldcf8 = inl(0xcf8);
13     outl(~0, 0xcf8);
14     if ( inl(0xcf8) == pci_mkaddr(255,31,7,252) )
15       type = PCI_CFG_TYPE1;
16     else
17       type = PCI_CFG_TYPE2;     /* ... it better be ... */
18     outl(oldcf8, 0xcf8);
19     sti();
20   }
21
22   __pci_cfg_type = type;
23 }