|
libhd 5.0
|
#include <fcntl.h>#include <unistd.h>#include <malloc.h>#include <stdio.h>#include <sys/mman.h>#include <sys/types.h>#include <sys/stat.h>#include <string.h>#include "AsmMacros.h"#include "pci.h"Defines | |
| #define | RESORT 1 |
| #define | FIX_ROM 0 |
| #define | PCI_EN 0x80000000 |
Functions | |
| static void | readConfigSpaceCfg1 (CARD32 bus, CARD32 dev, CARD32 func, CARD32 *reg) |
| static int | checkSlotCfg1 (CARD32 bus, CARD32 dev, CARD32 func) |
| static int | checkSlotCfg2 (CARD32 bus, int dev) |
| static void | readConfigSpaceCfg2 (CARD32 bus, int dev, CARD32 *reg) |
| static CARD8 | interpretConfigSpace (CARD32 *reg, int busidx, CARD8 dev, CARD8 func) |
| static CARD32 | findBIOSMap (PciStructPtr pciP, CARD32 *biosSize) |
| static void | restoreMem (PciStructPtr pciP) |
| static CARD32 | readPciCfg1 (CARD32 reg) |
| static void | writePciCfg1 (CARD32 reg, CARD32 val) |
| static CARD32 | readPciCfg2 (CARD32 reg) |
| static void | writePciCfg2 (CARD32 reg, CARD32 val) |
| void | scan_pci (int pci_cfg_method) |
| void | pciVideoDisable (void) |
| void | pciVideoRestore (void) |
| void | EnableCurrent () |
| CARD8 | PciRead8 (int offset, CARD32 Slot) |
| CARD16 | PciRead16 (int offset, CARD32 Slot) |
| CARD32 | PciRead32 (int offset, CARD32 Slot) |
| void | PciWrite8 (int offset, CARD8 byte, CARD32 Slot) |
| void | PciWrite16 (int offset, CARD16 word, CARD32 Slot) |
| void | PciWrite32 (int offset, CARD32 lg, CARD32 Slot) |
| int | mapPciRom (PciStructPtr pciP) |
| CARD32 | findPci (CARD16 slotBX) |
| CARD16 | pciSlotBX (PciStructPtr pPci) |
| PciStructPtr | findPciDevice (CARD16 vendorID, CARD16 deviceID, char n) |
| PciStructPtr | findPciClass (CARD8 intf, CARD8 subClass, CARD16 class, char n) |
| static int | remapMem (PciStructPtr pciP, int num, CARD32 size) |
| int | cfg1out (CARD16 addr, CARD32 val) |
| int | cfg1in (CARD16 addr, CARD32 *val) |
| PciStructPtr | findPciByIDs (int bus, int dev, int func) |
Variables | |
| PciStructPtr | PciStruct = NULL |
| PciBusPtr | PciBuses = NULL |
| PciStructPtr | CurrentPci = NULL |
| PciStructPtr | PciList = NULL |
| int | pciMaxBus = 0 |
| static CARD32 | PciCfg1Addr |
| static CARD32(* | readPci )(CARD32 reg) = readPciCfg1 |
| static void(* | writePci )(CARD32 reg, CARD32 val) = writePciCfg1 |
| static int | numbus |
| static int | hostbridges = 1 |
| static unsigned long | pciMinMemReg = ~0 |
| static CARD32 | remapMEM_val |
| static int | remapMEM_num |
| #define FIX_ROM 0 |
Referenced by mapPciRom().
| #define PCI_EN 0x80000000 |
Referenced by checkSlotCfg1(), findPci(), interpretConfigSpace(), readConfigSpaceCfg1(), and scan_pci().
| #define RESORT 1 |
Referenced by scan_pci().
References PciCfg1Addr, and readPci.
References PciCfg1Addr, val, and writePci.
References PCI_EN, PCI_MODE1_ADDRESS_REG, and PCI_MODE1_DATA_REG.
Referenced by scan_pci().
| static int checkSlotCfg2 | ( | CARD32 | bus, |
| int | dev | ||
| ) | [static] |
References PCI_MODE2_ENABLE_REG, PCI_MODE2_FORWARD_REG, and val.
Referenced by scan_pci().
| void EnableCurrent | ( | void | ) |
| static CARD32 findBIOSMap | ( | PciStructPtr | pciP, |
| CARD32 * | biosSize | ||
| ) | [static] |
References pciStructRec::bus, PciSlot::l, pciStructRec::next, PciRead32(), PciStruct, PciWrite32(), remapMem(), pciStructRec::RomBase, pciStructRec::Slot, and val.
Referenced by mapPciRom().
References PciSlot::l, pciStructRec::next, pciBusRec::next, pciStructRec::pBus, PCI_EN, PciStruct, pciBusRec::Slot, and pciStructRec::Slot.
Referenced by int1A_handler().
| PciStructPtr findPciByIDs | ( | int | bus, |
| int | dev, | ||
| int | func | ||
| ) |
References pciStructRec::bus, pciStructRec::dev, pciStructRec::func, pciStructRec::next, and PciList.
| PciStructPtr findPciClass | ( | CARD8 | intf, |
| CARD8 | subClass, | ||
| CARD16 | class, | ||
| char | n | ||
| ) |
References pciStructRec::BaseClass, CurrentPci, pciStructRec::Interface, pciStructRec::next, and pciStructRec::SubClass.
| PciStructPtr findPciDevice | ( | CARD16 | vendorID, |
| CARD16 | deviceID, | ||
| char | n | ||
| ) |
References CurrentPci, pciStructRec::DeviceID, pciStructRec::next, and pciStructRec::VendorID.
References pciStructRec::active, pciStructRec::BaseClass, pciBusRec::bctl, BRIDGE_CLASS, BRIDGE_HOST_CLASS, BRIDGE_PCI_CLASS, pciStructRec::bus, pciStructRec::cmd_st, pciStructRec::dev, device, pciStructRec::DeviceID, pciStructRec::func, pciStructRec::Interface, interface, IS_MEM32, IS_MEM64, PciSlot::l, pciStructRec::next, pciBusRec::next, PCI_EN, PCI_MULTIFUNC_DEV, PciBuses, pciMinMemReg, PciStruct, pciBusRec::primary, pciStructRec::RomBase, pciBusRec::secondary, pciStructRec::Slot, pciBusRec::Slot, pciStructRec::SubClass, vendor, pciStructRec::VendorID, and VIDEO_CLASS.
Referenced by scan_pci().
| int mapPciRom | ( | PciStructPtr | pciP | ) |
References CurrentPci, findBIOSMap(), FIX_ROM, PciSlot::l, MEM_FILE, PciRead32(), PciWrite32(), restoreMem(), pciStructRec::RomBase, pciStructRec::Slot, V_BIOS, and writePci.
References readPci.
Referenced by int1A_handler().
References readPci.
Referenced by findBIOSMap(), int1A_handler(), mapPciRom(), and remapMem().
References readPci.
Referenced by int1A_handler().
| CARD16 pciSlotBX | ( | PciStructPtr | pPci | ) |
References PciSlot::l, and pciStructRec::Slot.
Referenced by int1A_handler().
| void pciVideoDisable | ( | void | ) |
References pciBusRec::bctl, pciStructRec::cmd_st, PciSlot::l, pciStructRec::next, pciBusRec::next, PciBuses, PciStruct, pciStructRec::RomBase, pciStructRec::Slot, pciBusRec::Slot, and writePci.
Referenced by EnableCurrent().
| void pciVideoRestore | ( | void | ) |
References readPci, val, and writePci.
Referenced by int1A_handler().
References writePci.
Referenced by findBIOSMap(), int1A_handler(), mapPciRom(), remapMem(), and restoreMem().
References readPci, val, and writePci.
Referenced by int1A_handler().
References PCI_EN, PCI_MODE1_ADDRESS_REG, and PCI_MODE1_DATA_REG.
Referenced by scan_pci().
References PCI_MODE2_ENABLE_REG, and PCI_MODE2_FORWARD_REG.
Referenced by scan_pci().
References PCI_MODE1_ADDRESS_REG, PCI_MODE1_DATA_REG, and val.
References PCI_MODE2_ENABLE_REG, PCI_MODE2_FORWARD_REG, and val.
Referenced by scan_pci().
| static int remapMem | ( | PciStructPtr | pciP, |
| int | num, | ||
| CARD32 | size | ||
| ) | [static] |
References PciSlot::l, pciStructRec::next, PciRead32(), PciStruct, PciWrite32(), pciStructRec::Slot, and val.
Referenced by findBIOSMap().
| static void restoreMem | ( | PciStructPtr | pciP | ) | [static] |
References PciSlot::l, PciWrite32(), and pciStructRec::Slot.
Referenced by mapPciRom().
| void scan_pci | ( | int | pci_cfg_method | ) |
References pciStructRec::bus, checkSlotCfg1(), checkSlotCfg2(), interpretConfigSpace(), MAX_DEV_PER_VENDOR_CFG1, MAX_PCI_DEVICES, pciStructRec::next, pciBusRec::next, pciStructRec::pBus, pciBusRec::pBus, PCI_EN, PCI_MAXBUS, PCI_MODE1_ADDRESS_REG, PCI_MODE2_ENABLE_REG, PCI_MODE2_FORWARD_REG, PciBuses, pciMaxBus, PciStruct, pciBusRec::primary, readConfigSpaceCfg1(), readConfigSpaceCfg2(), readPci, readPciCfg2(), RESORT, pciBusRec::secondary, writePci, and writePciCfg2().
Referenced by InitInt10().
References PCI_MODE1_ADDRESS_REG, and PCI_MODE1_DATA_REG.
References PCI_MODE2_ENABLE_REG, and PCI_MODE2_FORWARD_REG.
Referenced by scan_pci().
| PciStructPtr CurrentPci = NULL |
Referenced by EnableCurrent(), findPciClass(), findPciDevice(), InitInt10(), int1A_handler(), and mapPciRom().
int hostbridges = 1 [static] |
int numbus [static] |
Referenced by interpretConfigSpace(), pciVideoDisable(), pciVideoRestore(), and scan_pci().
CARD32 PciCfg1Addr [static] |
| PciStructPtr PciList = NULL |
Referenced by findPciByIDs().
| int pciMaxBus = 0 |
Referenced by int1A_handler(), and scan_pci().
unsigned long pciMinMemReg = ~0 [static] |
Referenced by interpretConfigSpace().
| PciStructPtr PciStruct = NULL |
Referenced by findBIOSMap(), findPci(), interpretConfigSpace(), pciVideoDisable(), pciVideoRestore(), remapMem(), and scan_pci().
Referenced by cfg1in(), PciRead16(), PciRead32(), PciRead8(), PciWrite16(), PciWrite8(), and scan_pci().
int remapMEM_num [static] |
CARD32 remapMEM_val [static] |
Referenced by cfg1out(), EnableCurrent(), mapPciRom(), pciVideoDisable(), pciVideoRestore(), PciWrite16(), PciWrite32(), PciWrite8(), and scan_pci().