Subversion Repositories HelenOS

Rev

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

Rev 2222 Rev 2441
Line 57... Line 57...
57
    struct acpi_rsdp *r = (struct acpi_rsdp *) rsdp;
57
    struct acpi_rsdp *r = (struct acpi_rsdp *) rsdp;
58
    uint8_t sum = 0;
58
    uint8_t sum = 0;
59
    unsigned int i;
59
    unsigned int i;
60
   
60
   
61
    for (i = 0; i < 20; i++)
61
    for (i = 0; i < 20; i++)
62
        sum += rsdp[i];
62
        sum = (uint8_t) (sum + rsdp[i]);
63
       
63
       
64
    if (sum)   
64
    if (sum)   
65
        return 0; /* bad checksum */
65
        return 0; /* bad checksum */
66
 
66
 
67
    if (r->revision == 0)
67
    if (r->revision == 0)
68
        return 1; /* ACPI 1.0 */
68
        return 1; /* ACPI 1.0 */
69
       
69
       
70
    for (; i < r->length; i++)
70
    for (; i < r->length; i++)
71
        sum += rsdp[i];
71
        sum = (uint8_t) (sum + rsdp[i]);
72
       
72
       
73
    return !sum;
73
    return !sum;
74
   
74
   
75
}
75
}
76
 
76
 
Line 79... Line 79...
79
    struct acpi_sdt_header *h = (struct acpi_sdt_header *) sdt;
79
    struct acpi_sdt_header *h = (struct acpi_sdt_header *) sdt;
80
    uint8_t sum = 0;
80
    uint8_t sum = 0;
81
    unsigned int i;
81
    unsigned int i;
82
 
82
 
83
    for (i = 0; i < h->length; i++)
83
    for (i = 0; i < h->length; i++)
84
        sum += sdt[i];
84
        sum = (uint8_t) (sum + sdt[i]);
85
       
85
       
86
    return !sum;
86
    return !sum;
87
}
87
}
88
 
88
 
89
static void map_sdt(struct acpi_sdt_header *sdt)
89
static void map_sdt(struct acpi_sdt_header *sdt)
Line 103... Line 103...
103
            map_sdt(h);
103
            map_sdt(h);
104
            if (*((uint32_t *) &h->signature[0]) == *((uint32_t *) &signature_map[j].signature[0])) {
104
            if (*((uint32_t *) &h->signature[0]) == *((uint32_t *) &signature_map[j].signature[0])) {
105
                if (!acpi_sdt_check((uint8_t *) h))
105
                if (!acpi_sdt_check((uint8_t *) h))
106
                    goto next;
106
                    goto next;
107
                *signature_map[j].sdt_ptr = h;
107
                *signature_map[j].sdt_ptr = h;
108
                printf("%#zx: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
108
                printf("%#zp: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
109
            }
109
            }
110
        }
110
        }
111
next:
111
next:
112
        ;
112
        ;
113
    }
113
    }
Line 124... Line 124...
124
            map_sdt(h);
124
            map_sdt(h);
125
            if (*((uint32_t *) &h->signature[0]) == *((uint32_t *) &signature_map[j].signature[0])) {
125
            if (*((uint32_t *) &h->signature[0]) == *((uint32_t *) &signature_map[j].signature[0])) {
126
                if (!acpi_sdt_check((uint8_t *) h))
126
                if (!acpi_sdt_check((uint8_t *) h))
127
                    goto next;
127
                    goto next;
128
                *signature_map[j].sdt_ptr = h;
128
                *signature_map[j].sdt_ptr = h;
129
                printf("%#zx: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
129
                printf("%#zp: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
130
            }
130
            }
131
        }
131
        }
132
next:
132
next:
133
        ;
133
        ;
134
    }
134
    }
Line 158... Line 158...
158
    }
158
    }
159
 
159
 
160
    return;
160
    return;
161
 
161
 
162
rsdp_found:
162
rsdp_found:
163
    printf("%#zx: ACPI Root System Description Pointer\n", acpi_rsdp);
163
    printf("%#zp: ACPI Root System Description Pointer\n", acpi_rsdp);
164
 
164
 
165
    acpi_rsdt = (struct acpi_rsdt *) (unative_t) acpi_rsdp->rsdt_address;
165
    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);
166
    if (acpi_rsdp->revision) acpi_xsdt = (struct acpi_xsdt *) ((uintptr_t) acpi_rsdp->xsdt_address);
167
 
167
 
168
    if (acpi_rsdt) map_sdt((struct acpi_sdt_header *) acpi_rsdt);
168
    if (acpi_rsdt) map_sdt((struct acpi_sdt_header *) acpi_rsdt);