Consolidate formating
This commit is contained in:
@@ -6,8 +6,7 @@
|
||||
|
||||
// ACPI Specification https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf
|
||||
|
||||
struct rsdp // 5.2.5.3
|
||||
{
|
||||
struct rsdp { // 5.2.5.3
|
||||
char signature[8];
|
||||
uint8_t checksum;
|
||||
char OEMID[6];
|
||||
@@ -19,8 +18,7 @@ struct rsdp // 5.2.5.3
|
||||
uint8_t reserved[3]; // only if revision >= 2
|
||||
}__attribute__((packed));
|
||||
|
||||
struct sdt_header // 5.2.6
|
||||
{
|
||||
struct sdt_header { // 5.2.6
|
||||
char signature[4];
|
||||
uint32_t length;
|
||||
uint8_t revision;
|
||||
@@ -33,15 +31,13 @@ struct sdt_header // 5.2.6
|
||||
uint8_t data[];
|
||||
}__attribute__((packed));
|
||||
|
||||
struct madt_header // 5.2.12
|
||||
{
|
||||
struct madt_header { // 5.2.12
|
||||
uint32_t controllerAddress;
|
||||
uint32_t flags;
|
||||
uint8_t fields[];
|
||||
}__attribute__((packed));
|
||||
|
||||
struct madt_field
|
||||
{
|
||||
struct madt_field {
|
||||
uint8_t type;
|
||||
uint8_t length;
|
||||
uint8_t data[];
|
||||
@@ -49,8 +45,7 @@ struct madt_field
|
||||
|
||||
// MADT field type: 0
|
||||
#define MADT_TYPE_LAPIC 0
|
||||
struct madt_data_lapic
|
||||
{ // 5.2.12.2
|
||||
struct madt_data_lapic { // 5.2.12.2
|
||||
uint8_t id;
|
||||
uint8_t apic;
|
||||
uint32_t flags;
|
||||
@@ -58,8 +53,7 @@ struct madt_data_lapic
|
||||
|
||||
// MADT field type: 1
|
||||
#define MADT_TYPE_IOAPIC 1
|
||||
struct madt_data_ioapic
|
||||
{ // 5.2.12.3
|
||||
struct madt_data_ioapic { // 5.2.12.3
|
||||
uint8_t id;
|
||||
uint8_t reserved;
|
||||
uint32_t address;
|
||||
@@ -68,8 +62,7 @@ struct madt_data_ioapic
|
||||
|
||||
// MADT field type: 2
|
||||
#define MADT_TYPE_ISO 2
|
||||
struct madt_data_iso
|
||||
{ // 5.2.12.5
|
||||
struct madt_data_iso { // 5.2.12.5
|
||||
uint8_t bus;
|
||||
uint8_t source;
|
||||
uint32_t interrupt;
|
||||
@@ -77,8 +70,7 @@ struct madt_data_iso
|
||||
}__attribute__((packed));
|
||||
|
||||
|
||||
void acpi_parse()
|
||||
{
|
||||
void acpi_parse() {
|
||||
int cpu_i=0;
|
||||
|
||||
struct rsdp *rsdp = kernel_boot_data.rsdp;
|
||||
@@ -86,23 +78,19 @@ void acpi_parse()
|
||||
|
||||
uint32_t *table = (void *)rsdt->data;
|
||||
int entries = (rsdt->length - sizeof(struct sdt_header))/sizeof(uint32_t);
|
||||
for(int i = 0; i < entries; i++)
|
||||
{
|
||||
for(int i = 0; i < entries; i++) {
|
||||
struct sdt_header *h = P2V(table[i]);
|
||||
if(h->length == 0) continue;
|
||||
|
||||
if(!strncmp(h->signature, "APIC", 4)) // 5.2.12
|
||||
{
|
||||
if(!strncmp(h->signature, "APIC", 4)) { // 5.2.12
|
||||
struct madt_header *madt = P2V(h->data);
|
||||
for(
|
||||
struct madt_field *f = (void *)madt->fields;
|
||||
(size_t)f <= (size_t)h + h->length;
|
||||
f = incptr(f, f->length)
|
||||
)
|
||||
{
|
||||
) {
|
||||
switch(f->type) {
|
||||
case MADT_TYPE_LAPIC:
|
||||
{
|
||||
case MADT_TYPE_LAPIC: {
|
||||
struct madt_data_lapic *lapic = (void *)f->data;
|
||||
struct cpu *cpu = P2V(pmm_alloc());
|
||||
cpus[cpu_i++] = cpu;
|
||||
@@ -111,16 +99,14 @@ void acpi_parse()
|
||||
cpu->flags = lapic->flags;
|
||||
break;
|
||||
}
|
||||
case MADT_TYPE_IOAPIC:
|
||||
{
|
||||
case MADT_TYPE_IOAPIC: {
|
||||
struct madt_data_ioapic *_ioapic = (void *)f->data;
|
||||
ioapic.id = _ioapic->id;
|
||||
ioapic.addr = _ioapic->address;
|
||||
ioapic.base = _ioapic->base;
|
||||
break;
|
||||
}
|
||||
case MADT_TYPE_ISO:
|
||||
{
|
||||
case MADT_TYPE_ISO: {
|
||||
struct madt_data_iso *iso = (void *)f->data;
|
||||
irq_redirects[iso->source] = iso->interrupt;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user