summaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpi.cpp
diff options
context:
space:
mode:
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;
+};