Subversion Repositories HelenOS-historic

Rev

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

Rev 30 Rev 32
Line 126... Line 126...
126
    return sum == ct->ext_table_checksum;
126
    return sum == ct->ext_table_checksum;
127
}
127
}
128
 
128
 
129
void mp_init(void)
129
void mp_init(void)
130
{
130
{
131
    __address addr, frame;
131
    __u8 *addr[2] = { NULL, (__u8 *) 0xf0000 };
132
    int cnt, n;
132
    int i, j, length[2] = { 1024, 64*1024 };
133
   
133
   
134
 
134
 
135
    /*
135
    /*
-
 
136
     * Find MP Floating Pointer Structure
-
 
137
     * 1a. search first 1K of EBDA
136
     * EBDA can be undefined. In that case addr would be 0.
138
     * 1b. if EBDA is undefined, search last 1K of base memory
-
 
139
     *  2. search 64K starting at 0xf0000
137
     */
140
     */
138
    addr = ebda;
-
 
139
    if (addr) {
-
 
140
        cnt = 1024;
-
 
141
        while (addr = __u32_search(addr,cnt,FS_SIGNATURE)) {
-
 
142
            if (mp_fs_check((__u8 *) addr))
-
 
143
                goto fs_found;
-
 
144
            addr++;
-
 
145
            cnt--;
-
 
146
        }
-
 
147
    }
141
 
148
    else {
-
 
149
        /*
-
 
150
         * Second place where the MP Floating Pointer Structure may live is the last
142
    addr[0] = (__u8 *) (ebda ? ebda : 639 * 1024);
151
         * kilobyte of base memory.
143
    for (i = 0; i < 2; i++) {
152
         */
-
 
153
        addr = 639*1024;
144
        for (j = 0; j < length[i]; j += 16) {
154
        cnt = 1024;
-
 
155
        while (addr = __u32_search(addr,cnt,FS_SIGNATURE)) {
145
            if (*((__u32 *) &addr[i][j]) == FS_SIGNATURE && mp_fs_check(&addr[i][j])) {
156
            if (mp_fs_check((__u8 *) addr))
146
                fs = (struct __mpfs *) &addr[i][j];
157
                goto fs_found;
147
                goto fs_found;
158
            addr++;
-
 
159
            cnt--;
148
            }
160
        }
149
        }
161
    }
150
    }
162
 
151
 
163
    /*
-
 
164
     * As the last resort, MP Floating Pointer Structure is searched in the BIOS
-
 
165
     * ROM.
-
 
166
     */
-
 
167
    addr = 0xf0000;
-
 
168
    cnt = 64*1024;
-
 
169
    while (addr = __u32_search(addr,cnt,FS_SIGNATURE)) {
-
 
170
        if (mp_fs_check((__u8 *) addr))
-
 
171
            goto fs_found;
-
 
172
        addr++;
-
 
173
        cnt--;
-
 
174
    }
-
 
175
 
-
 
176
    return;
152
    return;
177
   
153
   
178
fs_found:
154
fs_found:
179
    printf("%L: MP Floating Pointer Structure\n", addr);
155
    printf("%L: MP Floating Pointer Structure\n", fs);
180
 
156
 
181
    fs = (struct __mpfs *) addr;
-
 
182
    frame_not_free((__address) fs);
157
    frame_not_free((__address) fs);
183
   
158
 
184
    if (fs->config_type == 0 && fs->configuration_table) {
159
    if (fs->config_type == 0 && fs->configuration_table) {
185
        if (fs->mpfib2 >> 7) {
160
        if (fs->mpfib2 >> 7) {
186
            printf("mp_init: PIC mode not supported\n");
161
            printf("mp_init: PIC mode not supported\n");
187
            return;
162
            return;
188
        }
163
        }