Rev 822 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 822 | Rev 1059 | ||
---|---|---|---|
Line 53... | Line 53... | ||
53 | 53 | ||
54 | static struct smp_config_operations *ops = NULL; |
54 | static struct smp_config_operations *ops = NULL; |
55 | 55 | ||
56 | void smp_init(void) |
56 | void smp_init(void) |
57 | { |
57 | { |
- | 58 | int status; |
|
- | 59 | __address l_apic_address, io_apic_address; |
|
- | 60 | ||
58 | if (acpi_madt) { |
61 | if (acpi_madt) { |
59 | acpi_madt_parse(); |
62 | acpi_madt_parse(); |
60 | ops = &madt_config_operations; |
63 | ops = &madt_config_operations; |
61 | } |
64 | } |
62 | if (config.cpu_count == 1) { |
65 | if (config.cpu_count == 1) { |
63 | mps_init(); |
66 | mps_init(); |
64 | ops = &mps_config_operations; |
67 | ops = &mps_config_operations; |
65 | } |
68 | } |
66 | 69 | ||
- | 70 | l_apic_address = PA2KA(PFN2ADDR(frame_alloc_rc(ONE_FRAME, FRAME_ATOMIC | FRAME_KA, &status))); |
|
- | 71 | if (status != FRAME_OK) |
|
- | 72 | panic("cannot allocate address for l_apic\n"); |
|
- | 73 | ||
- | 74 | io_apic_address = PA2KA(PFN2ADDR(frame_alloc_rc(ONE_FRAME, FRAME_ATOMIC | FRAME_KA, &status))); |
|
- | 75 | if (status != FRAME_OK) |
|
- | 76 | panic("cannot allocate address for io_apic\n"); |
|
- | 77 | ||
67 | if (config.cpu_count > 1) { |
78 | if (config.cpu_count > 1) { |
68 | page_mapping_insert(AS_KERNEL, (__address) l_apic, (__address) l_apic, |
79 | page_mapping_insert(AS_KERNEL, l_apic_address, (__address) l_apic, |
69 | PAGE_NOT_CACHEABLE); |
80 | PAGE_NOT_CACHEABLE); |
70 | page_mapping_insert(AS_KERNEL, (__address) io_apic, (__address) io_apic, |
81 | page_mapping_insert(AS_KERNEL, io_apic_address, (__address) io_apic, |
71 | PAGE_NOT_CACHEABLE); |
82 | PAGE_NOT_CACHEABLE); |
- | 83 | ||
- | 84 | l_apic = (__u32 *) l_apic_address; |
|
- | 85 | io_apic = (__u32 *) io_apic_address; |
|
72 | } |
86 | } |
73 | 87 | ||
74 | /* |
88 | /* |
75 | * Must be initialized outside the kmp thread, since it is waited |
89 | * Must be initialized outside the kmp thread, since it is waited |
76 | * on before the kmp thread is created. |
90 | * on before the kmp thread is created. |