Style fixes
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35897 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -32,20 +32,23 @@ static struct scan_spots_struct acpi_scan_spots[] = {
|
|||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static acpi_descriptor_header *sAcpiRsdt; // System Description Table
|
static acpi_descriptor_header* sAcpiRsdt; // System Description Table
|
||||||
static int32 sNumEntries = -1;
|
static int32 sNumEntries = -1;
|
||||||
|
|
||||||
|
|
||||||
static status_t
|
static status_t
|
||||||
acpi_check_rsdt(acpi_rsdp *rsdp)
|
acpi_check_rsdt(acpi_rsdp* rsdp)
|
||||||
{
|
{
|
||||||
TRACE(("acpi: found rsdp at %p oem id: %.6s\n", rsdp, rsdp->oem_id));
|
TRACE(("acpi: found rsdp at %p oem id: %.6s\n", rsdp, rsdp->oem_id));
|
||||||
TRACE(("acpi: rsdp points to rsdt at 0x%lx\n", rsdp->rsdt_address));
|
TRACE(("acpi: rsdp points to rsdt at 0x%lx\n", rsdp->rsdt_address));
|
||||||
|
|
||||||
// map and validate the root system description table
|
// map and validate the root system description table
|
||||||
acpi_descriptor_header *rsdt
|
acpi_descriptor_header* rsdt
|
||||||
= (acpi_descriptor_header *)mmu_map_physical_memory(
|
= (acpi_descriptor_header*)mmu_map_physical_memory(
|
||||||
rsdp->rsdt_address, sizeof(acpi_descriptor_header), kDefaultPageFlags);
|
rsdp->rsdt_address, sizeof(acpi_descriptor_header),
|
||||||
if (rsdt == NULL || strncmp(rsdt->signature, ACPI_RSDT_SIGNATURE, 4) != 0) {
|
kDefaultPageFlags);
|
||||||
|
if (rsdt == NULL
|
||||||
|
|| strncmp(rsdt->signature, ACPI_RSDT_SIGNATURE, 4) != 0) {
|
||||||
if (rsdt != NULL)
|
if (rsdt != NULL)
|
||||||
mmu_free(rsdt, sizeof(acpi_descriptor_header));
|
mmu_free(rsdt, sizeof(acpi_descriptor_header));
|
||||||
TRACE(("acpi: invalid root system description table\n"));
|
TRACE(("acpi: invalid root system description table\n"));
|
||||||
@@ -57,15 +60,17 @@ acpi_check_rsdt(acpi_rsdp *rsdp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
acpi_descriptor_header *
|
acpi_descriptor_header*
|
||||||
acpi_find_table(const char *signature)
|
acpi_find_table(const char* signature)
|
||||||
{
|
{
|
||||||
if (sAcpiRsdt == NULL)
|
if (sAcpiRsdt == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (sNumEntries == -1)
|
if (sNumEntries == -1) {
|
||||||
sNumEntries = (sAcpiRsdt->length - sizeof(acpi_descriptor_header)) / 4;
|
sNumEntries = (sAcpiRsdt->length
|
||||||
|
- sizeof(acpi_descriptor_header)) / 4;
|
||||||
|
}
|
||||||
|
|
||||||
if (sNumEntries <= 0) {
|
if (sNumEntries <= 0) {
|
||||||
TRACE(("acpi: root system description table is empty\n"));
|
TRACE(("acpi: root system description table is empty\n"));
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -74,19 +79,20 @@ acpi_find_table(const char *signature)
|
|||||||
TRACE(("acpi: searching %ld entries for table '%.4s'\n", sNumEntries,
|
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 < sNumEntries; 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,
|
||||||
kDefaultPageFlags);
|
sizeof(acpi_descriptor_header), kDefaultPageFlags);
|
||||||
if (header == NULL || strncmp(header->signature, signature, 4) != 0) {
|
if (header == NULL
|
||||||
|
|| strncmp(header->signature, signature, 4) != 0) {
|
||||||
// not interesting for us
|
// not interesting for us
|
||||||
if (header != NULL)
|
if (header != NULL)
|
||||||
mmu_free(header, sizeof(acpi_descriptor_header));
|
mmu_free(header, sizeof(acpi_descriptor_header));
|
||||||
TRACE(("acpi: Looking for '%.4s'. Skipping '%.4s'\n", signature,
|
TRACE(("acpi: Looking for '%.4s'. Skipping '%.4s'\n",
|
||||||
header->signature));
|
signature, header->signature));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
TRACE(("acpi: Found '%.4s' @ %p\n", signature, pointer));
|
TRACE(("acpi: Found '%.4s' @ %p\n", signature, pointer));
|
||||||
@@ -99,20 +105,21 @@ acpi_find_table(const char *signature)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
acpi_init(void)
|
acpi_init()
|
||||||
{
|
{
|
||||||
// Try to find the ACPI RSDP.
|
// Try to find the ACPI RSDP.
|
||||||
for (int32 i = 0; acpi_scan_spots[i].length > 0; i++) {
|
for (int32 i = 0; acpi_scan_spots[i].length > 0; i++) {
|
||||||
acpi_rsdp *rsdp = NULL;
|
acpi_rsdp* rsdp = NULL;
|
||||||
|
|
||||||
TRACE(("acpi_init: entry base 0x%lx, limit 0x%lx\n",
|
TRACE(("acpi_init: entry base 0x%lx, limit 0x%lx\n",
|
||||||
acpi_scan_spots[i].start, acpi_scan_spots[i].stop));
|
acpi_scan_spots[i].start, acpi_scan_spots[i].stop));
|
||||||
|
|
||||||
for (char *pointer = (char *)acpi_scan_spots[i].start;
|
for (char* pointer = (char*)acpi_scan_spots[i].start;
|
||||||
(uint32)pointer < acpi_scan_spots[i].stop; pointer += 16) {
|
(uint32)pointer < acpi_scan_spots[i].stop; pointer += 16) {
|
||||||
if (strncmp(pointer, ACPI_RSDP_SIGNATURE, 8) == 0) {
|
if (strncmp(pointer, ACPI_RSDP_SIGNATURE, 8) == 0) {
|
||||||
TRACE(("acpi_init: found ACPI RSDP signature at %p\n", pointer));
|
TRACE(("acpi_init: found ACPI RSDP signature at %p\n",
|
||||||
rsdp = (acpi_rsdp *)pointer;
|
pointer));
|
||||||
|
rsdp = (acpi_rsdp*)pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user