Changeset e2ea4ab1 in mainline for kernel/genarch/src/acpi/madt.c
- Timestamp:
- 2010-07-02T14:22:35Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 09b859c
- Parents:
- 4d1be48 (diff), e3ee9b9 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/acpi/madt.c
r4d1be48 re2ea4ab1 95 95 /* 96 96 * FIXME: The current local APIC driver limits usable 97 * APICIDs to 8.97 * CPU IDs to 8. 98 98 * 99 99 */ 100 if ( madt_cpu_apic_id(i)> 7)100 if (i > 7) 101 101 return false; 102 102 … … 111 111 return ((struct madt_l_apic *) 112 112 madt_entries_index[madt_l_apic_entry_index + i])->apic_id == 113 l_apic_id();113 bsp_l_apic; 114 114 } 115 115 … … 131 131 }; 132 132 133 static int madt_cmp(void *a, void *b )134 { 135 uint8_t typea = ( (struct madt_apic_header *) a)->type;136 uint8_t typeb = ( (struct madt_apic_header *) b)->type;133 static int madt_cmp(void *a, void *b, void *arg) 134 { 135 uint8_t typea = (*((struct madt_apic_header **) a))->type; 136 uint8_t typeb = (*((struct madt_apic_header **) b))->type; 137 137 138 138 if (typea > typeb) … … 147 147 static void madt_l_apic_entry(struct madt_l_apic *la, size_t i) 148 148 { 149 if ( !madt_l_apic_entry_cnt++)149 if (madt_l_apic_entry_cnt == 0) 150 150 madt_l_apic_entry_index = i; 151 152 madt_l_apic_entry_cnt++; 151 153 152 154 if (!(la->flags & 0x1)) { … … 160 162 static void madt_io_apic_entry(struct madt_io_apic *ioa, size_t i) 161 163 { 162 if ( !madt_io_apic_entry_cnt++) {164 if (madt_io_apic_entry_cnt == 0) { 163 165 /* Remember index of the first io apic entry */ 164 166 madt_io_apic_entry_index = i; … … 167 169 /* Currently not supported */ 168 170 } 171 172 madt_io_apic_entry_cnt++; 169 173 } 170 174 … … 190 194 /* Count MADT entries */ 191 195 unsigned int madt_entries_index_cnt = 0; 192 for (hdr = &acpi_madt->apic_header[0]; hdr < end;196 for (hdr = acpi_madt->apic_header; hdr < end; 193 197 hdr = (struct madt_apic_header *) (((uint8_t *) hdr) + hdr->length)) 194 198 madt_entries_index_cnt++; … … 196 200 /* Create MADT APIC entries index array */ 197 201 madt_entries_index = (struct madt_apic_header **) 198 malloc(madt_entries_index_cnt * sizeof(struct madt_apic_header * *),202 malloc(madt_entries_index_cnt * sizeof(struct madt_apic_header *), 199 203 FRAME_ATOMIC); 200 204 if (!madt_entries_index) … … 203 207 size_t i = 0; 204 208 205 for (hdr = &acpi_madt->apic_header[0]; hdr < end; 206 hdr = (struct madt_apic_header *) (((uint8_t *) hdr) + hdr->length)) 207 madt_entries_index[i++] = hdr; 209 for (hdr = acpi_madt->apic_header; hdr < end; 210 hdr = (struct madt_apic_header *) (((uint8_t *) hdr) + hdr->length)) { 211 madt_entries_index[i] = hdr; 212 i++; 213 } 208 214 209 215 /* Sort MADT index structure */ 210 qsort(madt_entries_index, madt_entries_index_cnt, sizeof(uintptr_t), 211 &madt_cmp); 216 if (!gsort(madt_entries_index, madt_entries_index_cnt, 217 sizeof(struct madt_apic_header *), madt_cmp, NULL)) 218 panic("Sorting error."); 212 219 213 220 /* Parse MADT entries */
Note:
See TracChangeset
for help on using the changeset viewer.