Cleanup things
This commit is contained in:
parent
a4287f02e5
commit
6ef5f0ef35
|
@ -70,7 +70,7 @@ struct SDTHeader_t {
|
|||
uint creatorID;
|
||||
uint creatorRevision;
|
||||
uint sdtEntry;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
|
||||
//
|
||||
// GAS type, used by ACPI tables to inform about registers
|
||||
|
@ -82,7 +82,7 @@ struct GenericAddressStructure
|
|||
uchar offset;
|
||||
uchar accessSize;
|
||||
ulong address;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
|
||||
//
|
||||
// ACPI table types id
|
||||
|
@ -192,7 +192,7 @@ struct FADT_t
|
|||
struct GenericAddressStructure xPMTimerBlock;
|
||||
struct GenericAddressStructure xGPE0Block;
|
||||
struct GenericAddressStructure xGPE1Block;
|
||||
};
|
||||
} __attribute__ ((packed));
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
|
|
|
@ -59,6 +59,7 @@ typedef struct ISRFrame_t ISRFrame_t;
|
|||
typedef struct RSDPDescriptor_t RSDPDescriptor_t;
|
||||
typedef struct SDTHeader_t SDTHeader_t;
|
||||
typedef struct FADT_t FADT_t;
|
||||
typedef struct MCFG_t MCFG_t;
|
||||
|
||||
typedef struct MemoryMap_t MemoryMap_t;
|
||||
typedef struct MapEntry_t MapEntry_t;
|
||||
|
|
|
@ -35,11 +35,10 @@
|
|||
#include <io/keyb.h>
|
||||
#include <io/cursor.h>
|
||||
#include <io/acpi.h>
|
||||
#include <io/pci.h>
|
||||
#include <po/shtdwn.h>
|
||||
#include <init/boot.h>
|
||||
|
||||
#include <io/pci.h>
|
||||
|
||||
//
|
||||
// Entry point of the Kaleid kernel
|
||||
//
|
||||
|
|
|
@ -22,15 +22,15 @@
|
|||
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
|
||||
#include <io/pci.h>
|
||||
#include <io/acpi.h>
|
||||
#include <mm/paging.h>
|
||||
|
||||
void* pciConfigBaseAddress = NULL;
|
||||
static void *pciConfigBaseAddress = NULL;
|
||||
|
||||
// -------------------------------------------------------------------------- //
|
||||
|
||||
static inline void* pciGetConfigAddr(uchar bus, uchar device,
|
||||
static inline void* pciGetConfigAddr(uchar bus, uchar device,
|
||||
uchar function, ushort offset)
|
||||
{
|
||||
if(device > 32) {
|
||||
|
@ -68,7 +68,6 @@ static inline uint pciReadConfigDWord(uchar bus, uchar device,
|
|||
return *((uint*)(pciGetConfigAddr(bus, device, function, offset)));
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
uchar IoPciReadConfigByte(PciDev_t *device, ushort offset)
|
||||
|
@ -104,8 +103,6 @@ void IoPciWriteConfigDWord(PciDev_t *device, ushort offset, uint data)
|
|||
memmove((void *)((ulong)device->configAddr + offset), &data, 4);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void IoPciEnumerate()
|
||||
{
|
||||
if(pciConfigBaseAddress == NULL) {
|
||||
|
@ -118,7 +115,7 @@ void IoPciEnumerate()
|
|||
for(uchar function = 0; function < 8; function++) {
|
||||
ushort vendor = pciReadConfigWord((uchar)bus, device, function, PCI_REG_VENDOR);
|
||||
if(vendor == 0xffff) continue;
|
||||
DebugLog("PCI device found ! vendor: %x, device: %x\n",
|
||||
DebugLog("PCI device vendor: %x, device: %x\n",
|
||||
vendor,
|
||||
pciReadConfigWord((uchar)bus, device, function, PCI_REG_DEVICE)
|
||||
);
|
||||
|
@ -153,7 +150,7 @@ PciDev_t *IoPciGetDevice(ushort vendorID, ushort deviceID)
|
|||
|
||||
void IoInitPCI()
|
||||
{
|
||||
struct MCFG_t *MCFG_table = (struct MCFG_t*)IoGetAcpiTable(SDT_MCFG);
|
||||
MCFG_t *MCFG_table = (MCFG_t*)IoGetAcpiTable(SDT_MCFG);
|
||||
if(MCFG_table == NULL) {
|
||||
KeStartPanic("Unable to access PCI configuration : MCFG table not reachable\n");
|
||||
}
|
||||
|
@ -170,6 +167,3 @@ void IoInitPCI()
|
|||
PRESENT | READWRITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue