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
|
// ACPI
|
||||||
IoInitAcpi();
|
IoInitAcpi();
|
||||||
|
|
||||||
// PCI
|
// PCI express
|
||||||
IoInitPCI();
|
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
|
// Scheduler
|
||||||
PsInitSched();
|
PsInitSched();
|
||||||
|
|
|
@ -169,16 +169,14 @@ static inline void IoInitRXSDT(void)
|
||||||
KeStartPanic("Invalid RSDT checksum : %d vs 0", checksum);
|
KeStartPanic("Invalid RSDT checksum : %d vs 0", checksum);
|
||||||
|
|
||||||
if (IoACPIVersion == 1) {
|
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->signature,
|
||||||
rxsdt->OEMID,
|
|
||||||
rxsdt->length,
|
rxsdt->length,
|
||||||
rxsdt
|
rxsdt
|
||||||
);
|
);
|
||||||
} else {
|
} 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->signature,
|
||||||
rxsdt->OEMID,
|
|
||||||
rxsdt->length,
|
rxsdt->length,
|
||||||
rxsdt
|
rxsdt
|
||||||
);
|
);
|
||||||
|
@ -222,9 +220,8 @@ static inline void IoSearchAcpiTables(void)
|
||||||
if (!checksum) {
|
if (!checksum) {
|
||||||
for (ulong i=0; i < N_SDT_TYPES; i++) {
|
for (ulong i=0; i < N_SDT_TYPES; i++) {
|
||||||
if (!strncmp(table->signature, SDTChar[i], 4)) {
|
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],
|
SDTChar[i],
|
||||||
table->OEMID,
|
|
||||||
table->length,
|
table->length,
|
||||||
table
|
table
|
||||||
);
|
);
|
||||||
|
@ -248,9 +245,8 @@ static inline void IoSearchAcpiTables(void)
|
||||||
checksum = DoChecksum(dsdt, (size_t)dsdt->length, 0, 0);
|
checksum = DoChecksum(dsdt, (size_t)dsdt->length, 0, 0);
|
||||||
if (!checksum) {
|
if (!checksum) {
|
||||||
if (!strncmp(dsdt->signature, SDTChar[SDT_DSDT], 4)) {
|
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],
|
SDTChar[SDT_DSDT],
|
||||||
dsdt->OEMID,
|
|
||||||
dsdt->length,
|
dsdt->length,
|
||||||
dsdt
|
dsdt
|
||||||
);
|
);
|
||||||
|
|
|
@ -34,15 +34,15 @@ static inline void* pciGetConfigAddr(uchar bus, uchar device,
|
||||||
uchar function, ushort offset)
|
uchar function, ushort offset)
|
||||||
{
|
{
|
||||||
if(device > 32) {
|
if(device > 32) {
|
||||||
KernLog("pciGetConfigAddr(): bad device ID\n");
|
DebugLog("pciGetConfigAddr(): bad device ID\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(function > 8) {
|
if(function > 8) {
|
||||||
KernLog("pciGetConfigAddr(): bad function ID\n");
|
DebugLog("pciGetConfigAddr(): bad function ID\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if(offset > 4096) {
|
if(offset > 4096) {
|
||||||
KernLog("pciGetConfigAddr(): bad register offset\n");
|
DebugLog("pciGetConfigAddr(): bad register offset\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ void IoPciWriteConfigDWord(PciDev_t *device, ushort offset, uint data)
|
||||||
void IoPciEnumerate()
|
void IoPciEnumerate()
|
||||||
{
|
{
|
||||||
if(pciConfigBaseAddress == NULL) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ void IoPciEnumerate()
|
||||||
PciDev_t *IoPciGetDevice(ushort vendorID, ushort deviceID)
|
PciDev_t *IoPciGetDevice(ushort vendorID, ushort deviceID)
|
||||||
{
|
{
|
||||||
if(pciConfigBaseAddress == NULL) {
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ void IoInitPCI()
|
||||||
{
|
{
|
||||||
struct MCFG_t *MCFG_table = (struct MCFG_t*)IoGetAcpiTable(SDT_MCFG);
|
struct MCFG_t *MCFG_table = (struct MCFG_t*)IoGetAcpiTable(SDT_MCFG);
|
||||||
if(MCFG_table == NULL) {
|
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;
|
pciConfigBaseAddress = MCFG_table->pciConfigBaseAddress;
|
||||||
DebugLog("PCI Config Base address = 0x%p\n", pciConfigBaseAddress);
|
DebugLog("PCI Config Base address = 0x%p\n", pciConfigBaseAddress);
|
||||||
|
@ -165,9 +165,9 @@ void IoInitPCI()
|
||||||
// Give R/W access to the configuration space
|
// Give R/W access to the configuration space
|
||||||
for(int i=0; i < 65536; i++) // 65536 = 256 * 32 * 8
|
for(int i=0; i < 65536; i++) // 65536 = 256 * 32 * 8
|
||||||
{
|
{
|
||||||
// 4096 for page size TODO: use of KPAGESIZE
|
MmMapPage((void *)((ulong)pciConfigBaseAddress + i * KPAGESIZE),
|
||||||
MmMapPage((void *)((ulong)pciConfigBaseAddress + i * 4096),
|
(void *)((ulong)pciConfigBaseAddress + i * KPAGESIZE),
|
||||||
(void *)((ulong)pciConfigBaseAddress + i * 4096), PRESENT | READWRITE);
|
PRESENT | READWRITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue