summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpi.cpp
diff options
context:
space:
mode:
authorAlexey Gavrilov <rebovas@yahoo.com>2024-03-19 16:44:56 +0700
committerAlexey Gavrilov <rebovas@yahoo.com>2024-03-19 16:44:56 +0700
commit3678f5d1970feea92f787928ceb9f53ed0b4c1e2 (patch)
treee2e5ff20d9144cda59b7a651d9622ad22ee89e86 /drivers/acpi/acpi.cpp
parent32e05e127197275bc4931e0beb6e1f7f29fb5d4d (diff)
Implementation acpi tables through structs
Diffstat (limited to 'drivers/acpi/acpi.cpp')
-rw-r--r--drivers/acpi/acpi.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/drivers/acpi/acpi.cpp b/drivers/acpi/acpi.cpp
new file mode 100644
index 0000000..41a7aa7
--- /dev/null
+++ b/drivers/acpi/acpi.cpp
@@ -0,0 +1,71 @@
+#include "acpi.h"
+#include "StringOperations.h"
+
+
+Rsdp::Rsdp() : rsdpStruct(nullptr), rsdtObj(nullptr), xsdtObj(nullptr)
+{
+ rsdpStruct = (struct rsdp *)StringOperations::findInMemory(rsdpSign, rsdpRomMemArea);
+
+ if(rsdpStruct == nullptr)
+ {
+ rsdpStruct = (struct rsdp *)StringOperations::findInMemory(rsdpSign, rsdpEbdaMemArea);
+ }
+
+ if(rsdpStruct != nullptr)
+ {
+ rsdtObj = Rsdt(rsdpStruct->rsdtAddress);
+ if(rsdpStruct->revision >= validFieldRevision)
+ {
+ xsdtObj = Xsdt(rsdpStruct->xsdtAddress);
+ }
+ }
+};
+
+const Rsdt *Rsdp::getRsdt() const
+{
+ if(rsdpStruct != nullptr) return &rsdtObj;
+ else return nullptr;
+};
+
+Rsdt::Rsdt(const nulltype null) : entry(null)
+{
+ rsdtStruct = null;
+};
+
+Rsdt::Rsdt(const uint32 addrRsdt) : entry(nullptr)
+{
+ rsdtStruct = (const struct rsdt *)(addrRsdt);
+ if(rsdtStruct != nullptr)
+ {
+ entry = Entry(rsdtStruct->header.length,
+ (&rsdtStruct->firstEntryAddr));
+ }
+};
+
+const Xsdt *Rsdp::getXsdt() const
+{
+ if(rsdpStruct != nullptr) return &xsdtObj;
+ else return nullptr;
+};
+
+Xsdt::Xsdt(const nulltype null)
+{
+ xsdtStruct = nullptr;
+};
+
+Xsdt::Xsdt(const uint32 xsdt)
+{
+ xsdtStruct = (const struct xsdt *)(xsdt);
+};
+
+Entry::Entry(const uint32 rsdtLength, const uint32 *entryAddress)
+{
+ sizeHeadersInBytes = rsdtLength - sizeof(descHeader);
+ headers = (const struct descHeader **)(entryAddress);
+};
+
+Entry::Entry(const nulltype null)
+{
+ sizeHeadersInBytes = 0;
+ headers = null;
+};