Subversion Repositories HelenOS

Rev

Rev 3022 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3022 Rev 4055
Line 47... Line 47...
47
 
47
 
48
struct acpi_rsdp *acpi_rsdp = NULL;
48
struct acpi_rsdp *acpi_rsdp = NULL;
49
struct acpi_rsdt *acpi_rsdt = NULL;
49
struct acpi_rsdt *acpi_rsdt = NULL;
50
struct acpi_xsdt *acpi_xsdt = NULL;
50
struct acpi_xsdt *acpi_xsdt = NULL;
51
 
51
 
52
struct acpi_signature_map signature_map[] = {
52
struct acpi_signature_map signature_map[] = {
-
 
53
    {
-
 
54
        (uint8_t *) "APIC",
-
 
55
        (void *) &acpi_madt,
53
    { (uint8_t *)"APIC", (void *) &acpi_madt, "Multiple APIC Description Table" }
56
        "Multiple APIC Description Table"
-
 
57
    }
54
};
58
};
55
 
59
 
56
static int rsdp_check(uint8_t *rsdp) {
60
static int rsdp_check(uint8_t *rsdp) {
57
    struct acpi_rsdp *r = (struct acpi_rsdp *) rsdp;
61
    struct acpi_rsdp *r = (struct acpi_rsdp *) rsdp;
58
    uint8_t sum = 0;
62
    uint8_t sum = 0;
Line 103... Line 107...
103
            map_sdt(h);
107
            map_sdt(h);
104
            if (*((uint32_t *) &h->signature[0]) == *((uint32_t *) &signature_map[j].signature[0])) {
108
            if (*((uint32_t *) &h->signature[0]) == *((uint32_t *) &signature_map[j].signature[0])) {
105
                if (!acpi_sdt_check((uint8_t *) h))
109
                if (!acpi_sdt_check((uint8_t *) h))
106
                    goto next;
110
                    goto next;
107
                *signature_map[j].sdt_ptr = h;
111
                *signature_map[j].sdt_ptr = h;
108
                printf("%#zp: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
112
                LOG("%p: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
109
            }
113
            }
110
        }
114
        }
111
next:
115
next:
112
        ;
116
        ;
113
    }
117
    }
Line 124... Line 128...
124
            map_sdt(h);
128
            map_sdt(h);
125
            if (*((uint32_t *) &h->signature[0]) == *((uint32_t *) &signature_map[j].signature[0])) {
129
            if (*((uint32_t *) &h->signature[0]) == *((uint32_t *) &signature_map[j].signature[0])) {
126
                if (!acpi_sdt_check((uint8_t *) h))
130
                if (!acpi_sdt_check((uint8_t *) h))
127
                    goto next;
131
                    goto next;
128
                *signature_map[j].sdt_ptr = h;
132
                *signature_map[j].sdt_ptr = h;
129
                printf("%#zp: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
133
                LOG("%p: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
130
            }
134
            }
131
        }
135
        }
132
next:
136
next:
133
        ;
137
        ;
134
    }
138
    }
Line 158... Line 162...
158
    }
162
    }
159
 
163
 
160
    return;
164
    return;
161
 
165
 
162
rsdp_found:
166
rsdp_found:
163
    printf("%#zp: ACPI Root System Description Pointer\n", acpi_rsdp);
167
    LOG("%p: ACPI Root System Description Pointer\n", acpi_rsdp);
164
 
168
 
165
    acpi_rsdt = (struct acpi_rsdt *) (unative_t) acpi_rsdp->rsdt_address;
169
    acpi_rsdt = (struct acpi_rsdt *) (unative_t) acpi_rsdp->rsdt_address;
166
    if (acpi_rsdp->revision) acpi_xsdt = (struct acpi_xsdt *) ((uintptr_t) acpi_rsdp->xsdt_address);
170
    if (acpi_rsdp->revision) acpi_xsdt = (struct acpi_xsdt *) ((uintptr_t) acpi_rsdp->xsdt_address);
167
 
171
 
168
    if (acpi_rsdt) map_sdt((struct acpi_sdt_header *) acpi_rsdt);
172
    if (acpi_rsdt) map_sdt((struct acpi_sdt_header *) acpi_rsdt);
169
    if (acpi_xsdt) map_sdt((struct acpi_sdt_header *) acpi_xsdt);  
173
    if (acpi_xsdt) map_sdt((struct acpi_sdt_header *) acpi_xsdt);  
170
 
174
 
171
    if (acpi_rsdt && !acpi_sdt_check((uint8_t *) acpi_rsdt)) {
175
    if (acpi_rsdt && !acpi_sdt_check((uint8_t *) acpi_rsdt)) {
172
        printf("RSDT: %s\n", "bad checksum");
176
        printf("RSDT: bad checksum\n");
173
        return;
177
        return;
174
    }
178
    }
175
    if (acpi_xsdt && !acpi_sdt_check((uint8_t *) acpi_xsdt)) {
179
    if (acpi_xsdt && !acpi_sdt_check((uint8_t *) acpi_xsdt)) {
176
        printf("XSDT: %s\n", "bad checksum");
180
        printf("XSDT: bad checksum\n");
177
        return;
181
        return;
178
    }
182
    }
179
 
183
 
180
    if (acpi_xsdt) configure_via_xsdt();
184
    if (acpi_xsdt) configure_via_xsdt();
181
    else if (acpi_rsdt) configure_via_rsdt();
185
    else if (acpi_rsdt) configure_via_rsdt();