Changeset a35b458 in mainline for kernel/genarch/src/acpi/madt.c
- Timestamp:
- 2018-03-02T20:10:49Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f1380b7
- Parents:
- 3061bc1
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:38:31)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-03-02 20:10:49)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/genarch/src/acpi/madt.c
r3061bc1 ra35b458 83 83 { 84 84 assert(i < madt_l_apic_entry_cnt); 85 85 86 86 return ((struct madt_l_apic *) 87 87 madt_entries_index[madt_l_apic_entry_index + i])->apic_id; … … 91 91 { 92 92 assert(i < madt_l_apic_entry_cnt); 93 93 94 94 /* 95 95 * FIXME: The current local APIC driver limits usable … … 99 99 if (i > 7) 100 100 return false; 101 101 102 102 return ((struct madt_l_apic *) 103 103 madt_entries_index[madt_l_apic_entry_index + i])->flags & 0x1; … … 107 107 { 108 108 assert(i < madt_l_apic_entry_cnt); 109 109 110 110 return ((struct madt_l_apic *) 111 111 madt_entries_index[madt_l_apic_entry_index + i])->apic_id == … … 117 117 if (irq >= sizeof(isa_irq_map) / sizeof(int)) 118 118 return (int) irq; 119 119 120 120 return isa_irq_map[irq]; 121 121 } … … 135 135 uint8_t typea = (*((struct madt_apic_header **) a))->type; 136 136 uint8_t typeb = (*((struct madt_apic_header **) b))->type; 137 137 138 138 if (typea > typeb) 139 139 return 1; 140 140 141 141 if (typea < typeb) 142 142 return -1; 143 143 144 144 return 0; 145 145 } … … 149 149 if (madt_l_apic_entry_cnt == 0) 150 150 madt_l_apic_entry_index = i; 151 151 152 152 madt_l_apic_entry_cnt++; 153 153 154 154 if (!(la->flags & 0x1)) { 155 155 /* Processor is unusable, skip it. */ 156 156 return; 157 157 } 158 158 159 159 apic_id_mask |= 1 << la->apic_id; 160 160 } … … 169 169 /* Currently not supported */ 170 170 } 171 171 172 172 madt_io_apic_entry_cnt++; 173 173 } … … 177 177 { 178 178 assert(override->source < sizeof(isa_irq_map) / sizeof(int)); 179 179 180 180 isa_irq_map[override->source] = override->global_int; 181 181 } … … 186 186 (((uint8_t *) acpi_madt) + acpi_madt->header.length); 187 187 struct madt_apic_header *hdr; 188 188 189 189 l_apic = (uint32_t *) (sysarg_t) acpi_madt->l_apic_address; 190 190 191 191 /* Count MADT entries */ 192 192 unsigned int madt_entries_index_cnt = 0; … … 194 194 hdr = (struct madt_apic_header *) (((uint8_t *) hdr) + hdr->length)) 195 195 madt_entries_index_cnt++; 196 196 197 197 /* Create MADT APIC entries index array */ 198 198 madt_entries_index = (struct madt_apic_header **) … … 201 201 if (!madt_entries_index) 202 202 panic("Memory allocation error."); 203 203 204 204 size_t i = 0; 205 205 206 206 for (hdr = acpi_madt->apic_header; hdr < end; 207 207 hdr = (struct madt_apic_header *) (((uint8_t *) hdr) + hdr->length)) { … … 209 209 i++; 210 210 } 211 211 212 212 /* Sort MADT index structure */ 213 213 if (!gsort(madt_entries_index, madt_entries_index_cnt, 214 214 sizeof(struct madt_apic_header *), madt_cmp, NULL)) 215 215 panic("Sorting error."); 216 216 217 217 /* Parse MADT entries */ 218 218 for (i = 0; i < madt_entries_index_cnt; i++) { 219 219 hdr = madt_entries_index[i]; 220 220 221 221 switch (hdr->type) { 222 222 case MADT_L_APIC: … … 245 245 "MADT: Skipping reserved entry (type=%" PRIu8 ")", 246 246 hdr->type); 247 247 248 248 if (hdr->type >= MADT_RESERVED_OEM_BEGIN) 249 249 log(LF_ARCH, LVL_NOTE, 250 250 "MADT: Skipping OEM entry (type=%" PRIu8 ")", 251 251 hdr->type); 252 252 253 253 break; 254 254 } 255 255 } 256 256 257 257 if (madt_l_apic_entry_cnt > 0) 258 258 config.cpu_count = madt_l_apic_entry_cnt;
Note:
See TracChangeset
for help on using the changeset viewer.