unsigned long acpi_fill_madt(unsigned long current) { unsigned int gsi_base = 0x18; /* Create all subtables for processors. */ current = acpi_create_madt_lapics(current); /* Write SB IOAPIC. */ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, VT8237R_APIC_ID, IO_APIC_ADDR, 0); /* Write NB IOAPIC. */ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, K8T890_APIC_ID, K8T890_APIC_BASE, gsi_base); /* IRQ9 ACPI active low. */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW); /* IRQ0 -> APIC IRQ2. */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 0, 2, 0x0); /* Create all subtables for processors. */ current = acpi_create_madt_lapic_nmis(current, MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, 1); return current; }
unsigned long acpi_fill_madt(unsigned long current) { unsigned int gsi_base = 0x18; struct mb_sysconf_t *m; //extern unsigned char bus_mcp55[8]; //extern unsigned apicid_mcp55; unsigned sbdn; struct resource *res; device_t dev; get_bus_conf(); sbdn = sysconf.sbdn; m = sysconf.mb; /* Create all subtables for processors. */ current = acpi_create_madt_lapics(current); /* Write SB IOAPIC. */ dev = dev_find_slot(m->bus_mcp55[0], PCI_DEVFN(sbdn+ 0x1,0)); if (dev) { res = find_resource(dev, PCI_BASE_ADDRESS_1); if (res) { current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, m->apicid_mcp55, res->base, 0); } } /* Write NB IOAPIC. */ dev = dev_find_slot(m->bus_mcp55[0], PCI_DEVFN(sbdn+ 0x12,1)); if (dev) { res = find_resource(dev, PCI_BASE_ADDRESS_1); if (res) { current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, m->apicid_mcp55++, res->base, gsi_base); } } /* IRQ9 ACPI active low. */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW); /* IRQ0 -> APIC IRQ2. */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 0, 2, 0x0); /* Create all subtables for processors. */ current = acpi_create_madt_lapic_nmis(current, MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, 1); return current; }
/* APIC */ unsigned long acpi_fill_madt(unsigned long current) { device_t dev; struct resource *res; /* create all subtables for processors */ current = acpi_create_madt_lapics(current); /* Write NVIDIA CK804 IOAPIC. */ dev = dev_find_slot(0x0, PCI_DEVFN(sysconf.sbdn + 0x1, 0)); ASSERT(dev != NULL); res = find_resource(dev, PCI_BASE_ADDRESS_1); ASSERT(res != NULL); current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, CONFIG_MAX_CPUS * CONFIG_MAX_PHYSICAL_CPUS, res->base, 0); /* Initialize interrupt mapping if mptable.c didn't. */ if (!IS_ENABLED(CONFIG_GENERATE_MP_TABLE)) { /* Copied from mptable.c */ /* Enable interrupts for commonly used devices (USB, SATA, etc.) */ pci_write_config32(dev, 0x7c, 0x0d800018); pci_write_config32(dev, 0x80, 0xd8002009); pci_write_config32(dev, 0x84, 0x00000001); } // /* IRQ of timer (override IRQ0 --> APIC IRQ2) */ // current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) // current, 0, 0, 2, 0); /* IRQ9 */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_HIGH); /* IRQ14 */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 14, 14, MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH); /* IRQ15 */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 15, 15, MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH); /* create all subtables for processors */ /* acpi_create_madt_lapic_nmis returns current, not size. */ current = acpi_create_madt_lapic_nmis(current, MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, 1); return current; }
/* APIC */ unsigned long acpi_fill_madt(unsigned long current) { device_t dev; struct resource *res; get_bus_conf(); /* create all subtables for processors */ current = acpi_create_madt_lapics(current); /* Write NVIDIA CK804 IOAPIC. */ dev = dev_find_slot(0x0, PCI_DEVFN(0x1,0)); ASSERT(dev != NULL); res = find_resource(dev, PCI_BASE_ADDRESS_1); ASSERT(res != NULL); current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, 4, res->base, 0); /* Initialize interrupt mapping if mptable.c didn't. */ #if (!CONFIG_GENERATE_MP_TABLE) pci_write_config32(dev, 0x7c, 0x0120d218); pci_write_config32(dev, 0x80, 0x12008a00); pci_write_config32(dev, 0x84, 0x0000007d); #endif /* IRQ9 */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW); /* 0: mean bus 0--->ISA */ /* 0: PIC 0 */ /* 2: APIC 2 */ /* 5 mean: 0101 --> Edge-triggered, Active high */ /* create all subtables for processors */ /* acpi_create_madt_lapic_nmis returns current, not size. */ current = acpi_create_madt_lapic_nmis(current, 5, 1); return current; }
/* APIC */ unsigned long acpi_fill_madt(unsigned long current) { device_t dev; struct resource *res; /* create all subtables for processors */ current = acpi_create_madt_lapics(current); /* Write NVIDIA CK804 IOAPIC. */ dev = dev_find_slot(0x0, PCI_DEVFN(0x1,0)); ASSERT(dev != NULL); res = find_resource(dev, PCI_BASE_ADDRESS_1); ASSERT(res != NULL); current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, CONFIG_MAX_CPUS * CONFIG_MAX_PHYSICAL_CPUS, res->base, 0); /* Initialize interrupt mapping if mptable.c didn't. */ #if (!CONFIG_GENERATE_MP_TABLE) #error untested config pci_write_config32(dev, 0x7c, 0x0120d218); pci_write_config32(dev, 0x80, 0x12008a00); pci_write_config32(dev, 0x84, 0x0000007d); #endif /* IRQ of timer */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 0, 2, 0); /* IRQ9 */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW); /* create all subtables for processors */ /* acpi_create_madt_lapic_nmis returns current, not size. */ current = acpi_create_madt_lapic_nmis(current, MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, 1); return current; }
unsigned long acpi_fill_madt(unsigned long current) { /* Create all subtables for processors. */ current = acpi_create_madt_lapics(current); /* Write SB IOAPIC. */ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, VX800SB_APIC_ID, VX800SB_APIC_BASE, 0); /* IRQ0 -> APIC IRQ2. */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 0, 2, 0x0); /* IRQ9 ACPI active low. */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 9, 9, MP_IRQ_TRIGGER_LEVEL | MP_IRQ_POLARITY_LOW); /* Create all subtables for processors. */ current = acpi_create_madt_lapic_nmis(current, MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_HIGH, 1); return current; }
unsigned long acpi_fill_madt(unsigned long current) { u32 gsi_base=0x18; struct mb_sysconf_t *m; m = sysconf.mb; /* create all subtables for processors */ current = acpi_create_madt_lapics(current); /* Write 8111 IOAPIC */ current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8111, IO_APIC_ADDR, 0); /* Write all 8131 IOAPICs */ { device_t dev; struct resource *res; dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN((sysconf.hcdn[0]&0xff), 1)); if (dev) { res = find_resource(dev, PCI_BASE_ADDRESS_0); if (res) { current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132_1, res->base, gsi_base ); gsi_base+=7; } } dev = dev_find_slot(m->bus_8132_0, PCI_DEVFN((sysconf.hcdn[0] & 0xff)+1, 1)); if (dev) { res = find_resource(dev, PCI_BASE_ADDRESS_0); if (res) { current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132_2, res->base, gsi_base ); gsi_base+=7; } } int i; int j = 0; for(i=1; i< sysconf.hc_possible_num; i++) { u32 d = 0; if(!(sysconf.pci1234[i] & 0x1) ) continue; // 8131 need to use +4 switch (sysconf.hcid[i]) { case 1: d = 7; break; case 3: d = 4; break; } switch (sysconf.hcid[i]) { case 1: case 3: dev = dev_find_slot(m->bus_8132a[j][0], PCI_DEVFN(m->sbdn3a[j], 1)); if (dev) { res = find_resource(dev, PCI_BASE_ADDRESS_0); if (res) { current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132a[j][0], res->base, gsi_base ); gsi_base+=d; } } dev = dev_find_slot(m->bus_8132a[j][0], PCI_DEVFN(m->sbdn3a[j]+1, 1)); if (dev) { res = find_resource(dev, PCI_BASE_ADDRESS_0); if (res) { current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, m->apicid_8132a[j][1], res->base, gsi_base ); gsi_base+=d; } } break; } j++; } } current += acpi_create_madt_irqoverride( (acpi_madt_irqoverride_t *) current, 0, 0, 2, 5 ); /* 0: mean bus 0--->ISA */ /* 0: PIC 0 */ /* 2: APIC 2 */ /* 5 mean: 0101 --> Edige-triggered, Active high*/ /* create all subtables for processors */ current = acpi_create_madt_lapic_nmis(current, 5, 1); /* 1: LINT1 connect to NMI */ return current; }
/* APIC */ unsigned long acpi_fill_madt(unsigned long current) { unsigned long apic_addr; device_t dev; /* create all subtables for processors */ current = acpi_create_madt_lapics(current); /* Write NVIDIA CK804 IOAPIC. */ dev = dev_find_slot(0x0, PCI_DEVFN(0x1,0)); if (dev) { apic_addr = pci_read_config32(dev, PCI_BASE_ADDRESS_1) & ~0xf; current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, 4, apic_addr, 0); /* Initialize interrupt mapping if mptable.c didn't. */ #if (!CONFIG_GENERATE_MP_TABLE) { u32 dword; dword = 0x0120d218; pci_write_config32(dev, 0x7c, dword); dword = 0x12008a00; pci_write_config32(dev, 0x80, dword); dword = 0x00080d7d; pci_write_config32(dev, 0x84, dword); } #endif } /* Write AMD 8131 two IOAPICs. */ dev = dev_find_slot(0x40, PCI_DEVFN(0x0,1)); if (dev) { apic_addr = pci_read_config32(dev, PCI_BASE_ADDRESS_0) & ~0xf; current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, 5, apic_addr, 0x18); } dev = dev_find_slot(0x40, PCI_DEVFN(0x1, 1)); if (dev) { apic_addr = pci_read_config32(dev, PCI_BASE_ADDRESS_0) & ~0xf; current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, 6, apic_addr, 0x1C); } /* Write second NVIDIA CK804 IOAPIC. */ dev = dev_find_slot(0x80, PCI_DEVFN(0x1, 0)); if (dev) { apic_addr = pci_read_config32(dev, PCI_BASE_ADDRESS_1) & ~0xf; current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *) current, 7, apic_addr, 0x20); /* Initialize interrupt mapping if mptable.c didn't. */ #if (!CONFIG_GENERATE_MP_TABLE) { u32 dword; dword = 0x0000d218; // Why does the factory BIOS have 0? pci_write_config32(dev, 0x7c, dword); dword = 0x00000000; pci_write_config32(dev, 0x80, dword); dword = 0x00000d00; // Same here. pci_write_config32(dev, 0x84, dword); } #endif } /* IRQ9 */ current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *) current, 0, 9, 9, MP_IRQ_TRIGGER_EDGE | MP_IRQ_POLARITY_LOW); /* IRQ0 -> APIC IRQ2. */ /* Doesn't work on this board. */ /* 0: mean bus 0--->ISA */ /* 0: PIC 0 */ /* 2: APIC 2 */ /* 5 mean: 0101 --> Edge-triggered, Active high */ /* create all subtables for processors */ /* acpi_create_madt_lapic_nmis returns current, not size. */ current = acpi_create_madt_lapic_nmis(current, 5, 1); return current; }