Cleanup things

This commit is contained in:
Adrien Bourmault 2020-02-13 13:40:07 +01:00
parent a4287f02e5
commit 6ef5f0ef35
No known key found for this signature in database
GPG Key ID: AFEE5788AEE3F4EC
4 changed files with 10 additions and 16 deletions

View File

@ -70,7 +70,7 @@ struct SDTHeader_t {
uint creatorID; uint creatorID;
uint creatorRevision; uint creatorRevision;
uint sdtEntry; uint sdtEntry;
}; } __attribute__ ((packed));
// //
// GAS type, used by ACPI tables to inform about registers // GAS type, used by ACPI tables to inform about registers
@ -82,7 +82,7 @@ struct GenericAddressStructure
uchar offset; uchar offset;
uchar accessSize; uchar accessSize;
ulong address; ulong address;
}; } __attribute__ ((packed));
// //
// ACPI table types id // ACPI table types id
@ -192,7 +192,7 @@ struct FADT_t
struct GenericAddressStructure xPMTimerBlock; struct GenericAddressStructure xPMTimerBlock;
struct GenericAddressStructure xGPE0Block; struct GenericAddressStructure xGPE0Block;
struct GenericAddressStructure xGPE1Block; struct GenericAddressStructure xGPE1Block;
}; } __attribute__ ((packed));
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//

View File

@ -59,6 +59,7 @@ typedef struct ISRFrame_t ISRFrame_t;
typedef struct RSDPDescriptor_t RSDPDescriptor_t; typedef struct RSDPDescriptor_t RSDPDescriptor_t;
typedef struct SDTHeader_t SDTHeader_t; typedef struct SDTHeader_t SDTHeader_t;
typedef struct FADT_t FADT_t; typedef struct FADT_t FADT_t;
typedef struct MCFG_t MCFG_t;
typedef struct MemoryMap_t MemoryMap_t; typedef struct MemoryMap_t MemoryMap_t;
typedef struct MapEntry_t MapEntry_t; typedef struct MapEntry_t MapEntry_t;

View File

@ -35,11 +35,10 @@
#include <io/keyb.h> #include <io/keyb.h>
#include <io/cursor.h> #include <io/cursor.h>
#include <io/acpi.h> #include <io/acpi.h>
#include <io/pci.h>
#include <po/shtdwn.h> #include <po/shtdwn.h>
#include <init/boot.h> #include <init/boot.h>
#include <io/pci.h>
// //
// Entry point of the Kaleid kernel // Entry point of the Kaleid kernel
// //

View File

@ -22,13 +22,13 @@
// along with OS/K. If not, see <https://www.gnu.org/licenses/>. // // along with OS/K. If not, see <https://www.gnu.org/licenses/>. //
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
#include <io/pci.h> #include <io/pci.h>
#include <io/acpi.h> #include <io/acpi.h>
#include <mm/paging.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) uchar function, ushort offset)
@ -68,7 +68,6 @@ static inline uint pciReadConfigDWord(uchar bus, uchar device,
return *((uint*)(pciGetConfigAddr(bus, device, function, offset))); return *((uint*)(pciGetConfigAddr(bus, device, function, offset)));
} }
//----------------------------------------------------------------------------// //----------------------------------------------------------------------------//
uchar IoPciReadConfigByte(PciDev_t *device, ushort 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); memmove((void *)((ulong)device->configAddr + offset), &data, 4);
} }
void IoPciEnumerate() void IoPciEnumerate()
{ {
if(pciConfigBaseAddress == NULL) { if(pciConfigBaseAddress == NULL) {
@ -118,7 +115,7 @@ void IoPciEnumerate()
for(uchar function = 0; function < 8; function++) { for(uchar function = 0; function < 8; function++) {
ushort vendor = pciReadConfigWord((uchar)bus, device, function, PCI_REG_VENDOR); ushort vendor = pciReadConfigWord((uchar)bus, device, function, PCI_REG_VENDOR);
if(vendor == 0xffff) continue; if(vendor == 0xffff) continue;
DebugLog("PCI device found ! vendor: %x, device: %x\n", DebugLog("PCI device vendor: %x, device: %x\n",
vendor, vendor,
pciReadConfigWord((uchar)bus, device, function, PCI_REG_DEVICE) pciReadConfigWord((uchar)bus, device, function, PCI_REG_DEVICE)
); );
@ -153,7 +150,7 @@ PciDev_t *IoPciGetDevice(ushort vendorID, ushort deviceID)
void IoInitPCI() 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) { if(MCFG_table == NULL) {
KeStartPanic("Unable to access PCI configuration : MCFG table not reachable\n"); KeStartPanic("Unable to access PCI configuration : MCFG table not reachable\n");
} }
@ -170,6 +167,3 @@ void IoInitPCI()
PRESENT | READWRITE); PRESENT | READWRITE);
} }
} }