mirror of
https://gitlab.os-k.eu/os-k-team/os-k.git
synced 2023-08-25 14:03:10 +02:00
Some cosmetics, add panic when necessary
This commit is contained in:
parent
dbee7c4d00
commit
a4287f02e5
@ -86,16 +86,8 @@ noreturn void BtStartKern(multiboot_info_t *mbInfo, uint mbMagic, void *codeSeg)
|
||||
// ACPI
|
||||
IoInitAcpi();
|
||||
|
||||
// PCI
|
||||
// PCI express
|
||||
IoInitPCI();
|
||||
|
||||
// Test RTL8139
|
||||
PciDev_t *rtl8139_pciDev = IoPciGetDevice(0x10EC, 0x8139);
|
||||
if(rtl8139_pciDev != NULL)
|
||||
{
|
||||
DebugLog("Network card RTL8139 found ! PCI config addr = %p\n",
|
||||
rtl8139_pciDev->configAddr);
|
||||
}
|
||||
|
||||
// Scheduler
|
||||
PsInitSched();
|
||||
|
@ -169,16 +169,14 @@ static inline void IoInitRXSDT(void)
|
||||
KeStartPanic("Invalid RSDT checksum : %d vs 0", checksum);
|
||||
|
||||
if (IoACPIVersion == 1) {
|
||||
DebugLog("ACPI Root System Table %s (%s) length %d [%p]\n",
|
||||
DebugLog("ACPI Root System Table %s length %d [%p]\n",
|
||||
rxsdt->signature,
|
||||
rxsdt->OEMID,
|
||||
rxsdt->length,
|
||||
rxsdt
|
||||
);
|
||||
} else {
|
||||
DebugLog("ACPI Extended System Table %s (%s) length %d [%p]\n",
|
||||
DebugLog("ACPI Extended System Table %s length %d [%p]\n",
|
||||
rxsdt->signature,
|
||||
rxsdt->OEMID,
|
||||
rxsdt->length,
|
||||
rxsdt
|
||||
);
|
||||
@ -222,9 +220,8 @@ static inline void IoSearchAcpiTables(void)
|
||||
if (!checksum) {
|
||||
for (ulong i=0; i < N_SDT_TYPES; i++) {
|
||||
if (!strncmp(table->signature, SDTChar[i], 4)) {
|
||||
DebugLog("ACPI System Table %s (OEM %s) length %d [%p]\n",
|
||||
DebugLog("ACPI System Table %s length %d [%p]\n",
|
||||
SDTChar[i],
|
||||
table->OEMID,
|
||||
table->length,
|
||||
table
|
||||
);
|
||||
@ -248,9 +245,8 @@ static inline void IoSearchAcpiTables(void)
|
||||
checksum = DoChecksum(dsdt, (size_t)dsdt->length, 0, 0);
|
||||
if (!checksum) {
|
||||
if (!strncmp(dsdt->signature, SDTChar[SDT_DSDT], 4)) {
|
||||
DebugLog("ACPI System Table %s (OEM %s) length %d [%p]\n",
|
||||
DebugLog("ACPI System Table %s length %d [%p]\n",
|
||||
SDTChar[SDT_DSDT],
|
||||
dsdt->OEMID,
|
||||
dsdt->length,
|
||||
dsdt
|
||||
);
|
||||
|
@ -34,15 +34,15 @@ static inline void* pciGetConfigAddr(uchar bus, uchar device,
|
||||
uchar function, ushort offset)
|
||||
{
|
||||
if(device > 32) {
|
||||
KernLog("pciGetConfigAddr(): bad device ID\n");
|
||||
DebugLog("pciGetConfigAddr(): bad device ID\n");
|
||||
return 0;
|
||||
}
|
||||
if(function > 8) {
|
||||
KernLog("pciGetConfigAddr(): bad function ID\n");
|
||||
DebugLog("pciGetConfigAddr(): bad function ID\n");
|
||||
return 0;
|
||||
}
|
||||
if(offset > 4096) {
|
||||
KernLog("pciGetConfigAddr(): bad register offset\n");
|
||||
DebugLog("pciGetConfigAddr(): bad register offset\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ void IoPciWriteConfigDWord(PciDev_t *device, ushort offset, uint data)
|
||||
void IoPciEnumerate()
|
||||
{
|
||||
if(pciConfigBaseAddress == NULL) {
|
||||
KernLog("Unable to access PCI configuration : MCFG table not reachable\n");
|
||||
KeStartPanic("Unable to access PCI configuration : MCFG table not reachable\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ void IoPciEnumerate()
|
||||
PciDev_t *IoPciGetDevice(ushort vendorID, ushort deviceID)
|
||||
{
|
||||
if(pciConfigBaseAddress == NULL) {
|
||||
KernLog("Unable to access PCI configuration : MCFG table not reachable\n");
|
||||
KeStartPanic("Unable to access PCI configuration : MCFG table not reachable\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ void IoInitPCI()
|
||||
{
|
||||
struct MCFG_t *MCFG_table = (struct MCFG_t*)IoGetAcpiTable(SDT_MCFG);
|
||||
if(MCFG_table == NULL) {
|
||||
KernLog("Unable to access PCI configuration : MCFG table not reachable\n");
|
||||
KeStartPanic("Unable to access PCI configuration : MCFG table not reachable\n");
|
||||
}
|
||||
pciConfigBaseAddress = MCFG_table->pciConfigBaseAddress;
|
||||
DebugLog("PCI Config Base address = 0x%p\n", pciConfigBaseAddress);
|
||||
@ -165,9 +165,9 @@ void IoInitPCI()
|
||||
// Give R/W access to the configuration space
|
||||
for(int i=0; i < 65536; i++) // 65536 = 256 * 32 * 8
|
||||
{
|
||||
// 4096 for page size TODO: use of KPAGESIZE
|
||||
MmMapPage((void *)((ulong)pciConfigBaseAddress + i * 4096),
|
||||
(void *)((ulong)pciConfigBaseAddress + i * 4096), PRESENT | READWRITE);
|
||||
MmMapPage((void *)((ulong)pciConfigBaseAddress + i * KPAGESIZE),
|
||||
(void *)((ulong)pciConfigBaseAddress + i * KPAGESIZE),
|
||||
PRESENT | READWRITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user