Rev 127 | Rev 131 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 127 | Rev 129 | ||
---|---|---|---|
Line 25... | Line 25... | ||
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
27 | */ |
28 | 28 | ||
29 | #include <arch/types.h> |
29 | #include <arch/types.h> |
- | 30 | #include <typedefs.h> |
|
30 | #include <arch/acpi/acpi.h> |
31 | #include <arch/acpi/acpi.h> |
31 | #include <arch/acpi/madt.h> |
32 | #include <arch/acpi/madt.h> |
32 | #include <arch/smp/apic.h> |
33 | #include <arch/smp/apic.h> |
- | 34 | #include <arch/smp/smp.h> |
|
33 | #include <mm/page.h> |
35 | #include <mm/page.h> |
34 | #include <panic.h> |
36 | #include <panic.h> |
- | 37 | #include <debug.h> |
|
- | 38 | #include <config.h> |
|
35 | 39 | ||
36 | struct acpi_madt *acpi_madt = NULL; |
40 | struct acpi_madt *acpi_madt = NULL; |
37 | 41 | ||
38 | #ifdef __SMP__ |
42 | #ifdef __SMP__ |
39 | 43 | ||
Line 63... | Line 67... | ||
63 | "IO_SAPIC", |
67 | "IO_SAPIC", |
64 | "L_SAPIC", |
68 | "L_SAPIC", |
65 | "PLATFORM_INTR_SRC" |
69 | "PLATFORM_INTR_SRC" |
66 | }; |
70 | }; |
67 | 71 | ||
- | 72 | /* |
|
- | 73 | * ACPI MADT Implementation of SMP configuration interface. |
|
- | 74 | */ |
|
- | 75 | static count_t madt_cpu_count(void); |
|
- | 76 | static bool madt_cpu_enabled(index_t i); |
|
- | 77 | static bool madt_cpu_bootstrap(index_t i); |
|
- | 78 | static __u8 madt_cpu_apic_id(index_t i); |
|
- | 79 | ||
- | 80 | struct smp_config_operations madt_config_operations = { |
|
- | 81 | .cpu_count = madt_cpu_count, |
|
- | 82 | .cpu_enabled = madt_cpu_enabled, |
|
- | 83 | .cpu_bootstrap = madt_cpu_bootstrap, |
|
- | 84 | .cpu_apic_id = madt_cpu_apic_id |
|
- | 85 | }; |
|
- | 86 | ||
- | 87 | static count_t madt_cpu_count(void) |
|
- | 88 | { |
|
- | 89 | return madt_l_apic_entry_cnt; |
|
- | 90 | } |
|
- | 91 | ||
- | 92 | static bool madt_cpu_enabled(index_t i) |
|
- | 93 | { |
|
- | 94 | ASSERT(i < madt_l_apic_entry_cnt); |
|
- | 95 | return madt_l_apic_entries[i].flags & 0x1; |
|
- | 96 | } |
|
- | 97 | ||
- | 98 | static bool madt_cpu_bootstrap(index_t i) |
|
- | 99 | { |
|
- | 100 | ASSERT(i < madt_l_apic_entry_cnt); |
|
- | 101 | return madt_l_apic_entries[i].apic_id == l_apic_id(); |
|
- | 102 | } |
|
- | 103 | ||
- | 104 | static __u8 madt_cpu_apic_id(index_t i) |
|
- | 105 | { |
|
- | 106 | ASSERT(i < madt_l_apic_entry_cnt); |
|
- | 107 | return madt_l_apic_entries[i].apic_id; |
|
- | 108 | } |
|
- | 109 | ||
68 | void acpi_madt_parse(void) |
110 | void acpi_madt_parse(void) |
69 | { |
111 | { |
70 | struct madt_apic_header *end = (struct madt_apic_header *) (((__u8 *) acpi_madt) + acpi_madt->header.length); |
112 | struct madt_apic_header *end = (struct madt_apic_header *) (((__u8 *) acpi_madt) + acpi_madt->header.length); |
71 | struct madt_apic_header *h = &acpi_madt->apic_header[0]; |
113 | struct madt_apic_header *h = &acpi_madt->apic_header[0]; |
72 | __u8 prev_type = 0; /* used to detect incosecutive entries */ |
114 | __u8 prev_type = 0; /* used to detect incosecutive entries */ |
Line 103... | Line 145... | ||
103 | } |
145 | } |
104 | prev_type = h->type; |
146 | prev_type = h->type; |
105 | h = (struct madt_apic_header *) (((__u8 *) h) + h->length); |
147 | h = (struct madt_apic_header *) (((__u8 *) h) + h->length); |
106 | } |
148 | } |
107 | 149 | ||
- | 150 | if (madt_l_apic_entry_cnt) |
|
- | 151 | config.cpu_count = madt_l_apic_entry_cnt; |
|
108 | } |
152 | } |
109 | 153 | ||
110 | void madt_l_apic_entry(struct madt_l_apic *la, __u8 prev_type) |
154 | void madt_l_apic_entry(struct madt_l_apic *la, __u8 prev_type) |
111 | { |
155 | { |
112 | /* check for consecutiveness */ |
156 | /* check for consecutiveness */ |