| 137 | } |
| 138 | |
| 139 | void Init(){ |
| 140 | if(desc){ |
| 141 | goto success; // Already found |
| 142 | } |
| 143 | |
| 144 | for(int i = 0; i <= 0x7BFF; i += 16){ // Search first KB for RSDP, the RSDP is aligned on a 16 byte boundary |
| 145 | if(memcmp((void*)Memory::GetIOMapping(i),signature,8) == 0){ |
| 146 | desc = ((acpi_xsdp_t*)Memory::GetIOMapping(i)); |
| 147 | |
| 148 | goto success; |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | for(int i = 0x80000; i <= 0x9FFFF; i += 16){ // Search further for RSDP |
| 153 | if(memcmp((void*)Memory::GetIOMapping(i),signature,8) == 0){ |
| 154 | desc = ((acpi_xsdp_t*)Memory::GetIOMapping(i)); |
| 155 | |
| 156 | goto success; |
| 157 | } |
| 158 | } |
| 159 | |
| 160 | for(int i = 0xE0000; i <= 0xFFFFF; i += 16){ // Search further for RSDP |
| 161 | if(memcmp((void*)Memory::GetIOMapping(i),signature,8) == 0){ |
| 162 | desc = ((acpi_xsdp_t*)Memory::GetIOMapping(i)); |
| 163 | |
| 164 | goto success; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | { |
| 169 | const char* panicReasons[]{"System not ACPI Complaiant."}; |
| 170 | KernelPanic(panicReasons,1); |
| 171 | //return; |
| 172 | } |
| 173 | |
| 174 | success: |
| 175 | |
| 176 | isos = new List<apic_iso_t*>(); |
| 177 | |
| 178 | if(desc->revision == 2){ |
| 179 | rsdtHeader = ((acpi_rsdt_t*)Memory::GetIOMapping(desc->xsdt)); |
| 180 | xsdtHeader = ((acpi_xsdt_t*)Memory::GetIOMapping(desc->xsdt)); |
| 181 | } else{ |
| 182 | rsdtHeader = ((acpi_rsdt_t*)Memory::GetIOMapping(desc->rsdt)); |
| 183 | } |
| 184 | |
| 185 | memcpy(oem,rsdtHeader->header.oem,6); |
| 186 | oem[6] = 0; // Zero OEM String |
| 187 | |
| 188 | if(debugLevelACPI >= DebugLevelNormal){ |
| 189 | Log::Info("[ACPI] Revision: %d", desc->revision); |
| 190 | } |
| 191 | |
| 192 | fadt = reinterpret_cast<acpi_fadt_t*>(FindSDT("FACP", 0)); |
| 193 | |
| 194 | asm("cli"); |
| 195 | |
| 196 | lai_set_acpi_revision(rsdtHeader->header.revision); |
nothing calls this directly
no test coverage detected