Squashed todo: only compute the numEntries once, and made it static.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35889 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -33,7 +33,7 @@ static struct scan_spots_struct acpi_scan_spots[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static acpi_descriptor_header *sAcpiRsdt; // System Description Table
|
static acpi_descriptor_header *sAcpiRsdt; // System Description Table
|
||||||
|
static int32 sNumEntries = -1;
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
acpi_check_rsdt(acpi_rsdp *rsdp)
|
acpi_check_rsdt(acpi_rsdp *rsdp)
|
||||||
@@ -63,22 +63,21 @@ acpi_find_table(const char *signature)
|
|||||||
if (sAcpiRsdt == NULL)
|
if (sAcpiRsdt == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// Tried to keep numEntries a static variable; kept turning up 0 on table
|
if (sNumEntries == -1)
|
||||||
// scan
|
sNumEntries = (sAcpiRsdt->length - sizeof(acpi_descriptor_header)) / 4;
|
||||||
// TODO: This calculates numEntries for every acpi probe.
|
|
||||||
int32 numEntries = (sAcpiRsdt->length - sizeof(acpi_descriptor_header)) / 4;
|
if (sNumEntries <= 0) {
|
||||||
if (numEntries <= 0) {
|
|
||||||
TRACE(("acpi: root system description table is empty\n"));
|
TRACE(("acpi: root system description table is empty\n"));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE(("acpi: searching %ld entries for table '%.4s'\n", numEntries,
|
TRACE(("acpi: searching %ld entries for table '%.4s'\n", sNumEntries,
|
||||||
signature));
|
signature));
|
||||||
|
|
||||||
uint32 *pointer = (uint32 *)((uint8 *)sAcpiRsdt
|
uint32 *pointer = (uint32 *)((uint8 *)sAcpiRsdt
|
||||||
+ sizeof(acpi_descriptor_header));
|
+ sizeof(acpi_descriptor_header));
|
||||||
|
|
||||||
for (int32 j = 0; j < numEntries; j++, pointer++) {
|
for (int32 j = 0; j < sNumEntries; j++, pointer++) {
|
||||||
acpi_descriptor_header *header = (acpi_descriptor_header *)
|
acpi_descriptor_header *header = (acpi_descriptor_header *)
|
||||||
mmu_map_physical_memory(*pointer, sizeof(acpi_descriptor_header),
|
mmu_map_physical_memory(*pointer, sizeof(acpi_descriptor_header),
|
||||||
kDefaultPageFlags);
|
kDefaultPageFlags);
|
||||||
|
|||||||
Reference in New Issue
Block a user