Rev 3386 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3386 | Rev 4581 | ||
---|---|---|---|
Line 60... | Line 60... | ||
60 | static int madt_cmp(void * a, void * b); |
60 | static int madt_cmp(void * a, void * b); |
61 | 61 | ||
62 | struct madt_l_apic *madt_l_apic_entries = NULL; |
62 | struct madt_l_apic *madt_l_apic_entries = NULL; |
63 | struct madt_io_apic *madt_io_apic_entries = NULL; |
63 | struct madt_io_apic *madt_io_apic_entries = NULL; |
64 | 64 | ||
65 | index_t madt_l_apic_entry_index = 0; |
65 | size_t madt_l_apic_entry_index = 0; |
66 | index_t madt_io_apic_entry_index = 0; |
66 | size_t madt_io_apic_entry_index = 0; |
67 | count_t madt_l_apic_entry_cnt = 0; |
67 | size_t madt_l_apic_entry_cnt = 0; |
68 | count_t madt_io_apic_entry_cnt = 0; |
68 | size_t madt_io_apic_entry_cnt = 0; |
69 | count_t cpu_count = 0; |
69 | size_t cpu_count = 0; |
70 | 70 | ||
71 | struct madt_apic_header * * madt_entries_index = NULL; |
71 | struct madt_apic_header * * madt_entries_index = NULL; |
72 | unsigned int madt_entries_index_cnt = 0; |
72 | unsigned int madt_entries_index_cnt = 0; |
73 | 73 | ||
74 | char *entry[] = { |
74 | char *entry[] = { |
Line 84... | Line 84... | ||
84 | }; |
84 | }; |
85 | 85 | ||
86 | /* |
86 | /* |
87 | * ACPI MADT Implementation of SMP configuration interface. |
87 | * ACPI MADT Implementation of SMP configuration interface. |
88 | */ |
88 | */ |
89 | static count_t madt_cpu_count(void); |
89 | static size_t madt_cpu_count(void); |
90 | static bool madt_cpu_enabled(index_t i); |
90 | static bool madt_cpu_enabled(size_t i); |
91 | static bool madt_cpu_bootstrap(index_t i); |
91 | static bool madt_cpu_bootstrap(size_t i); |
92 | static uint8_t madt_cpu_apic_id(index_t i); |
92 | static uint8_t madt_cpu_apic_id(size_t i); |
93 | static int madt_irq_to_pin(unsigned int irq); |
93 | static int madt_irq_to_pin(unsigned int irq); |
94 | 94 | ||
95 | struct smp_config_operations madt_config_operations = { |
95 | struct smp_config_operations madt_config_operations = { |
96 | .cpu_count = madt_cpu_count, |
96 | .cpu_count = madt_cpu_count, |
97 | .cpu_enabled = madt_cpu_enabled, |
97 | .cpu_enabled = madt_cpu_enabled, |
98 | .cpu_bootstrap = madt_cpu_bootstrap, |
98 | .cpu_bootstrap = madt_cpu_bootstrap, |
99 | .cpu_apic_id = madt_cpu_apic_id, |
99 | .cpu_apic_id = madt_cpu_apic_id, |
100 | .irq_to_pin = madt_irq_to_pin |
100 | .irq_to_pin = madt_irq_to_pin |
101 | }; |
101 | }; |
102 | 102 | ||
103 | count_t madt_cpu_count(void) |
103 | size_t madt_cpu_count(void) |
104 | { |
104 | { |
105 | return madt_l_apic_entry_cnt; |
105 | return madt_l_apic_entry_cnt; |
106 | } |
106 | } |
107 | 107 | ||
108 | bool madt_cpu_enabled(index_t i) |
108 | bool madt_cpu_enabled(size_t i) |
109 | { |
109 | { |
110 | ASSERT(i < madt_l_apic_entry_cnt); |
110 | ASSERT(i < madt_l_apic_entry_cnt); |
111 | return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->flags & 0x1; |
111 | return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->flags & 0x1; |
112 | 112 | ||
113 | } |
113 | } |
114 | 114 | ||
115 | bool madt_cpu_bootstrap(index_t i) |
115 | bool madt_cpu_bootstrap(size_t i) |
116 | { |
116 | { |
117 | ASSERT(i < madt_l_apic_entry_cnt); |
117 | ASSERT(i < madt_l_apic_entry_cnt); |
118 | return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->apic_id == l_apic_id(); |
118 | return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->apic_id == l_apic_id(); |
119 | } |
119 | } |
120 | 120 | ||
121 | uint8_t madt_cpu_apic_id(index_t i) |
121 | uint8_t madt_cpu_apic_id(size_t i) |
122 | { |
122 | { |
123 | ASSERT(i < madt_l_apic_entry_cnt); |
123 | ASSERT(i < madt_l_apic_entry_cnt); |
124 | return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->apic_id; |
124 | return ((struct madt_l_apic *) madt_entries_index[madt_l_apic_entry_index + i])->apic_id; |
125 | } |
125 | } |
126 | 126 |