#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, and writePci.
static int checkSlotCfg2 | ( | CARD32 | bus, | |
int | dev | |||
) | [static] |
void EnableCurrent | ( | void | ) |
static CARD32 findBIOSMap | ( | PciStructPtr | pciP, | |
CARD32 * | biosSize | |||
) | [static] |
References pciStructRec::bus, PciSlot::l, pciStructRec::next, PciRead32(), PciWrite32(), remapMem(), pciStructRec::RomBase, and pciStructRec::Slot.
Referenced by mapPciRom().
References PciSlot::l, pciStructRec::next, pciBusRec::next, pciStructRec::pBus, PCI_EN, pciBusRec::Slot, and pciStructRec::Slot.
Referenced by int1A_handler().
PciStructPtr findPciByIDs | ( | int | bus, | |
int | dev, | |||
int | func | |||
) |
References pciStructRec::bus, pciStructRec::dev, pciStructRec::func, and pciStructRec::next.
PciStructPtr findPciClass | ( | CARD8 | intf, | |
CARD8 | subClass, | |||
CARD16 | class, | |||
char | n | |||
) |
References pciStructRec::BaseClass, pciStructRec::Interface, pciStructRec::next, and pciStructRec::SubClass.
PciStructPtr findPciDevice | ( | CARD16 | vendorID, | |
CARD16 | deviceID, | |||
char | n | |||
) |
References 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, pciStructRec::DeviceID, pciStructRec::func, pciStructRec::Interface, interface, IS_MEM32, IS_MEM64, PciSlot::l, pciStructRec::next, pciBusRec::next, PCI_EN, PCI_MULTIFUNC_DEV, 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 findBIOSMap(), FIX_ROM, PciSlot::l, MEM_FILE, PciRead32(), PciWrite32(), restoreMem(), pciStructRec::RomBase, pciStructRec::Slot, V_BIOS, and writePci.
CARD16 pciSlotBX | ( | PciStructPtr | pPci | ) |
void pciVideoDisable | ( | void | ) |
References pciBusRec::bctl, pciStructRec::cmd_st, PciSlot::l, pciStructRec::next, pciBusRec::next, pciStructRec::RomBase, pciStructRec::Slot, pciBusRec::Slot, and writePci.
Referenced by EnableCurrent().
void pciVideoRestore | ( | void | ) |
References writePci.
Referenced by findBIOSMap(), int1A_handler(), mapPciRom(), remapMem(), and restoreMem().
References PCI_MODE1_ADDRESS_REG, and PCI_MODE1_DATA_REG.
static int remapMem | ( | PciStructPtr | pciP, | |
int | num, | |||
CARD32 | size | |||
) | [static] |
References PciSlot::l, pciStructRec::next, PciRead32(), PciWrite32(), and pciStructRec::Slot.
Referenced by findBIOSMap().
static void restoreMem | ( | PciStructPtr | pciP | ) | [static] |
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, pciMaxBus, 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.
PciStructPtr CurrentPci = NULL |
Referenced by InitInt10(), and int1A_handler().
int hostbridges = 1 [static] |
int numbus [static] |
CARD32 PciCfg1Addr [static] |
PciStructPtr PciList = NULL |
int pciMaxBus = 0 |
Referenced by int1A_handler(), and scan_pci().
unsigned long pciMinMemReg = ~0 [static] |
PciStructPtr PciStruct = NULL |
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().