Rev 501 | Rev 515 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 501 | Rev 512 | ||
---|---|---|---|
Line 42... | Line 42... | ||
42 | 42 | ||
43 | struct acpi_madt *acpi_madt = NULL; |
43 | struct acpi_madt *acpi_madt = NULL; |
44 | 44 | ||
45 | #ifdef CONFIG_SMP |
45 | #ifdef CONFIG_SMP |
46 | 46 | ||
- | 47 | /** Standard ISA IRQ map; can be overriden by Interrupt Source Override entries of MADT. */ |
|
- | 48 | int isa_irq_map[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; |
|
- | 49 | ||
47 | static void madt_l_apic_entry(struct madt_l_apic *la, __u32 index); |
50 | static void madt_l_apic_entry(struct madt_l_apic *la, __u32 index); |
48 | static void madt_io_apic_entry(struct madt_io_apic *ioa, __u32 index); |
51 | static void madt_io_apic_entry(struct madt_io_apic *ioa, __u32 index); |
- | 52 | static void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override, __u32 index); |
|
49 | static int madt_cmp(void * a, void * b); |
53 | static int madt_cmp(void * a, void * b); |
50 | 54 | ||
51 | struct madt_l_apic *madt_l_apic_entries = NULL; |
55 | struct madt_l_apic *madt_l_apic_entries = NULL; |
52 | struct madt_io_apic *madt_io_apic_entries = NULL; |
56 | struct madt_io_apic *madt_io_apic_entries = NULL; |
53 | 57 | ||
Line 77... | Line 81... | ||
77 | */ |
81 | */ |
78 | static count_t madt_cpu_count(void); |
82 | static count_t madt_cpu_count(void); |
79 | static bool madt_cpu_enabled(index_t i); |
83 | static bool madt_cpu_enabled(index_t i); |
80 | static bool madt_cpu_bootstrap(index_t i); |
84 | static bool madt_cpu_bootstrap(index_t i); |
81 | static __u8 madt_cpu_apic_id(index_t i); |
85 | static __u8 madt_cpu_apic_id(index_t i); |
- | 86 | static int madt_irq_to_pin(int irq); |
|
82 | 87 | ||
83 | struct smp_config_operations madt_config_operations = { |
88 | struct smp_config_operations madt_config_operations = { |
84 | .cpu_count = madt_cpu_count, |
89 | .cpu_count = madt_cpu_count, |
85 | .cpu_enabled = madt_cpu_enabled, |
90 | .cpu_enabled = madt_cpu_enabled, |
86 | .cpu_bootstrap = madt_cpu_bootstrap, |
91 | .cpu_bootstrap = madt_cpu_bootstrap, |
87 | .cpu_apic_id = madt_cpu_apic_id |
92 | .cpu_apic_id = madt_cpu_apic_id, |
- | 93 | .irq_to_pin = madt_irq_to_pin |
|
88 | }; |
94 | }; |
89 | 95 | ||
90 | static count_t madt_cpu_count(void) |
96 | count_t madt_cpu_count(void) |
91 | { |
97 | { |
92 | return madt_l_apic_entry_cnt; |
98 | return madt_l_apic_entry_cnt; |
93 | } |
99 | } |
94 | 100 | ||
95 | static bool madt_cpu_enabled(index_t i) |
101 | bool madt_cpu_enabled(index_t i) |
96 | { |
102 | { |
97 | ASSERT(i < madt_l_apic_entry_cnt); |
103 | ASSERT(i < madt_l_apic_entry_cnt); |
98 | return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->flags & 0x1; |
104 | return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->flags & 0x1; |
99 | 105 | ||
100 | } |
106 | } |
101 | 107 | ||
102 | static bool madt_cpu_bootstrap(index_t i) |
108 | bool madt_cpu_bootstrap(index_t i) |
103 | { |
109 | { |
104 | ASSERT(i < madt_l_apic_entry_cnt); |
110 | ASSERT(i < madt_l_apic_entry_cnt); |
105 | return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->apic_id == l_apic_id(); |
111 | return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->apic_id == l_apic_id(); |
106 | } |
112 | } |
107 | 113 | ||
108 | static __u8 madt_cpu_apic_id(index_t i) |
114 | __u8 madt_cpu_apic_id(index_t i) |
109 | { |
115 | { |
110 | ASSERT(i < madt_l_apic_entry_cnt); |
116 | ASSERT(i < madt_l_apic_entry_cnt); |
111 | return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->apic_id; |
117 | return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->apic_id; |
112 | } |
118 | } |
113 | 119 | ||
- | 120 | int madt_irq_to_pin(int irq) |
|
- | 121 | { |
|
- | 122 | ASSERT(irq < sizeof(isa_irq_map)/sizeof(int)); |
|
- | 123 | return isa_irq_map[irq]; |
|
- | 124 | } |
|
- | 125 | ||
114 | int madt_cmp(void * a, void * b) |
126 | int madt_cmp(void * a, void * b) |
115 | { |
127 | { |
116 | return |
128 | return |
117 | (((struct madt_apic_header *) a)->type > ((struct madt_apic_header *) b)->type) ? |
129 | (((struct madt_apic_header *) a)->type > ((struct madt_apic_header *) b)->type) ? |
118 | 1 : |
130 | 1 : |
Line 152... | Line 164... | ||
152 | break; |
164 | break; |
153 | case MADT_IO_APIC: |
165 | case MADT_IO_APIC: |
154 | madt_io_apic_entry((struct madt_io_apic *) h, index); |
166 | madt_io_apic_entry((struct madt_io_apic *) h, index); |
155 | break; |
167 | break; |
156 | case MADT_INTR_SRC_OVRD: |
168 | case MADT_INTR_SRC_OVRD: |
- | 169 | madt_intr_src_ovrd_entry((struct madt_intr_src_ovrd *) h, index); |
|
- | 170 | break; |
|
157 | case MADT_NMI_SRC: |
171 | case MADT_NMI_SRC: |
158 | case MADT_L_APIC_NMI: |
172 | case MADT_L_APIC_NMI: |
159 | case MADT_L_APIC_ADDR_OVRD: |
173 | case MADT_L_APIC_ADDR_OVRD: |
160 | case MADT_IO_SAPIC: |
174 | case MADT_IO_SAPIC: |
161 | case MADT_L_SAPIC: |
175 | case MADT_L_SAPIC: |
Line 207... | Line 221... | ||
207 | /* currently not supported */ |
221 | /* currently not supported */ |
208 | return; |
222 | return; |
209 | } |
223 | } |
210 | } |
224 | } |
211 | 225 | ||
- | 226 | void madt_intr_src_ovrd_entry(struct madt_intr_src_ovrd *override, __u32 index) |
|
- | 227 | { |
|
- | 228 | ASSERT(override->source < sizeof(isa_irq_map)/sizeof(int)); |
|
- | 229 | printf("Remapping irq%d to IO APIC pin%d\n", override->source, override->global_intr); |
|
- | 230 | isa_irq_map[override->source] = override->global_intr; |
|
- | 231 | ||
- | 232 | } |
|
212 | 233 | ||
213 | #endif /* CONFIG_SMP */ |
234 | #endif /* CONFIG_SMP */ |