Subversion Repositories HelenOS-historic

Rev

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

Rev 116 Rev 125
Line 82... Line 82...
82
    map_structure((__address) sdt, sdt->length);
82
    map_structure((__address) sdt, sdt->length);
83
}
83
}
84
 
84
 
85
void acpi_init(void)
85
void acpi_init(void)
86
{
86
{
87
        __u8 *addr[2] = { NULL, (__u8 *) 0xe0000 };
87
    __u8 *addr[2] = { NULL, (__u8 *) 0xe0000 };
88
        int i, j, length[2] = { 1024, 128*1024 };
88
    int i, j, length[2] = { 1024, 128*1024 };
89
    __u64 *sig = (__u64 *) RSDP_SIGNATURE;
89
    __u64 *sig = (__u64 *) RSDP_SIGNATURE;
90
 
90
 
91
        /*
91
    /*
92
     * Find Root System Description Pointer
92
     * Find Root System Description Pointer
93
         * 1. search first 1K of EBDA
93
     * 1. search first 1K of EBDA
94
         * 2. search 128K starting at 0xe0000
94
     * 2. search 128K starting at 0xe0000
95
         */
95
     */
96
 
96
 
97
    addr[0] = (__u8 *) ebda;
97
    addr[0] = (__u8 *) ebda;
98
    for (i = (ebda ? 0 : 1); i < 2; i++) {
98
    for (i = (ebda ? 0 : 1); i < 2; i++) {
99
                for (j = 0; j < length[i]; j += 16) {
99
        for (j = 0; j < length[i]; j += 16) {
100
                        if (*((__u64 *) &addr[i][j]) == *sig && rsdp_check(&addr[i][j])) {
100
            if (*((__u64 *) &addr[i][j]) == *sig && rsdp_check(&addr[i][j])) {
101
                                acpi_rsdp = (struct acpi_rsdp *) &addr[i][j];
101
                acpi_rsdp = (struct acpi_rsdp *) &addr[i][j];
102
                                goto rsdp_found;
102
                goto rsdp_found;
103
                        }
103
            }
104
                }
104
        }
105
        }
105
    }
106
 
106
 
107
        return;
107
    return;
108
 
108
 
109
rsdp_found:
109
rsdp_found:
110
        printf("%L: ACPI Root System Description Pointer\n", acpi_rsdp);
110
    printf("%L: ACPI Root System Description Pointer\n", acpi_rsdp);
111
   
111
 
112
    acpi_rsdt = (struct acpi_rsdt *) acpi_rsdp->rsdt_address;
112
    acpi_rsdt = (struct acpi_rsdt *) acpi_rsdp->rsdt_address;
113
    if (acpi_rsdp->revision) acpi_xsdt = (struct acpi_xsdt *) ((__address) acpi_rsdp->xsdt_address);
113
    if (acpi_rsdp->revision) acpi_xsdt = (struct acpi_xsdt *) ((__address) acpi_rsdp->xsdt_address);
114
 
114
 
115
    if (acpi_rsdt) map_sdt((struct acpi_sdt_header *) acpi_rsdt);
115
    if (acpi_rsdt) map_sdt((struct acpi_sdt_header *) acpi_rsdt);
116
    if (acpi_xsdt) map_sdt((struct acpi_sdt_header *) acpi_xsdt);  
116
    if (acpi_xsdt) map_sdt((struct acpi_sdt_header *) acpi_xsdt);  
Line 135... Line 135...
135
   
135
   
136
    for (i=0; i<cnt; i++) {
136
    for (i=0; i<cnt; i++) {
137
        for (j=0; j<sizeof(signature_map)/sizeof(struct acpi_signature_map); j++) {
137
        for (j=0; j<sizeof(signature_map)/sizeof(struct acpi_signature_map); j++) {
138
            struct acpi_sdt_header *h = (struct acpi_sdt_header *) acpi_rsdt->entry[i];
138
            struct acpi_sdt_header *h = (struct acpi_sdt_header *) acpi_rsdt->entry[i];
139
       
139
       
140
                map_sdt(h);
140
            map_sdt(h);
141
            if (*((__u32 *) &h->signature[0])==*((__u32 *) &signature_map[j].signature[0])) {
141
            if (*((__u32 *) &h->signature[0])==*((__u32 *) &signature_map[j].signature[0])) {
142
                if (!acpi_sdt_check((__u8 *) h))
142
                if (!acpi_sdt_check((__u8 *) h))
143
                    goto next;
143
                    goto next;
144
                *signature_map[j].sdt_ptr = h;
144
                *signature_map[j].sdt_ptr = h;
145
                printf("%L: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);
145
                printf("%L: ACPI %s\n", *signature_map[j].sdt_ptr, signature_map[j].description);