mirror of
https://github.com/wichtounet/thor-os.git
synced 2025-09-11 05:24:44 -04:00
Finish the OSL
This commit is contained in:
parent
fd03371249
commit
09450f1455
@ -19,6 +19,7 @@
|
|||||||
#include "kernel_utils.hpp"
|
#include "kernel_utils.hpp"
|
||||||
#include "interrupts.hpp"
|
#include "interrupts.hpp"
|
||||||
#include "timer.hpp"
|
#include "timer.hpp"
|
||||||
|
#include "pci.hpp"
|
||||||
|
|
||||||
#include "mutex.hpp"
|
#include "mutex.hpp"
|
||||||
#include "semaphore.hpp"
|
#include "semaphore.hpp"
|
||||||
@ -516,6 +517,56 @@ ACPI_STATUS AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS Address, UINT64 value, UINT3
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ACPI_STATUS AcpiOsReadPciConfiguration(ACPI_PCI_ID* pci_id, UINT32 Register, UINT64* value, UINT32 width){
|
||||||
|
if (pci_id->Bus >= 256 || pci_id->Device >= 32 || pci_id->Function >= 8){
|
||||||
|
return AE_BAD_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (width) {
|
||||||
|
case 8:
|
||||||
|
*((uint8_t*) value) = pci::read_config_byte(pci_id->Bus, pci_id->Device, pci_id->Function, Register);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
*((uint16_t*) value) = pci::read_config_word(pci_id->Bus, pci_id->Device, pci_id->Function, Register);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
*((uint32_t*) value) = pci::read_config_dword(pci_id->Bus, pci_id->Device, pci_id->Function, Register);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return AE_BAD_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
return AE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
ACPI_STATUS AcpiOsWritePciConfiguration(ACPI_PCI_ID* pci_id, UINT32 Register, ACPI_INTEGER value, UINT32 width){
|
||||||
|
if (pci_id->Bus >= 256 || pci_id->Device >= 32 || pci_id->Function >= 8){
|
||||||
|
return AE_BAD_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (width) {
|
||||||
|
case 8:
|
||||||
|
pci::write_config_byte(pci_id->Bus, pci_id->Device, pci_id->Function, Register, value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 16:
|
||||||
|
pci::write_config_word(pci_id->Bus, pci_id->Device, pci_id->Function, Register, value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 32:
|
||||||
|
pci::write_config_dword(pci_id->Bus, pci_id->Device, pci_id->Function, Register, value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return AE_BAD_PARAMETER;
|
||||||
|
}
|
||||||
|
|
||||||
|
return AE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// Interrupts
|
// Interrupts
|
||||||
|
|
||||||
struct acpi_interrupt_context {
|
struct acpi_interrupt_context {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user