From ee3ad3b3fa07257f7933b80b3a243dac9014ae23 Mon Sep 17 00:00:00 2001 From: Antoine Cure Date: Mon, 10 Feb 2020 02:26:55 +0100 Subject: [PATCH] WIP: get PCI config base address from MCFG table --- include/io/acpi.h | 17 +++++++++++++++++ kaleid/kernel/io/pci.c | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/include/io/acpi.h b/include/io/acpi.h index 917a682..fb43fa7 100644 --- a/include/io/acpi.h +++ b/include/io/acpi.h @@ -196,6 +196,23 @@ struct FADT_t //----------------------------------------------------------------------------// +struct SDT_MCFG_t { + char signature[4]; + uint length; + uchar revision; + uchar checksum; + char OEMID[6]; + char OEMTableID[8]; + uint OEMRevision; + uint creatorID; + uint creatorRevision; + uint sdtEntry; + + ulong PCIConfigBaseAddress; +}; + +//----------------------------------------------------------------------------// + void IoInitAcpi(void); SDTHeader_t *IoGetAcpiTable(ulong id); diff --git a/kaleid/kernel/io/pci.c b/kaleid/kernel/io/pci.c index e8a7e64..9b29a9a 100644 --- a/kaleid/kernel/io/pci.c +++ b/kaleid/kernel/io/pci.c @@ -29,8 +29,10 @@ void pciGetDevice(ushort vendorID, ushort deviceID, int deviceType) { - if(IoGetAcpiTable(SDT_MCFG) == NULL) + struct SDT_MCFG_t *MCFG_table = (struct SDT_MCFG_t*)IoGetAcpiTable(SDT_MCFG); + if(MCFG_table == NULL) { KernLog("Unable to access PCI configuration : MCFG table not reachable\n"); } + KernLog("PCI Config Base address = %ld", MCFG_table->PCIConfigBaseAddress); }