blob: 4febfafd3791494b02d4a3165b7523aa65aa658a [file] [log] [blame]
Angel Pons5c596802020-04-03 01:21:01 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Siyuan Wang80cf7d52013-07-09 17:42:43 +08002
Furquan Shaikh76cedd22020-05-02 10:24:23 -07003#include <acpi/acpi.h>
Siyuan Wang80cf7d52013-07-09 17:42:43 +08004#include <arch/ioapic.h>
Siyuan Wang80cf7d52013-07-09 17:42:43 +08005
Siyuan Wang80cf7d52013-07-09 17:42:43 +08006unsigned long acpi_fill_madt(unsigned long current)
7{
8 /* create all subtables for processors */
9 current = acpi_create_madt_lapics(current);
10
11 /* Write SB800 IOAPIC, only one */
Elyes Haouasf9b535e2022-07-16 09:47:42 +020012 current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, CONFIG_MAX_CPUS,
Siyuan Wang80cf7d52013-07-09 17:42:43 +080013 IO_APIC_ADDR, 0);
14
15 /* TODO: Remove the hardcode */
Elyes Haouas3a998072022-11-18 15:11:02 +010016 current += acpi_create_madt_ioapic((acpi_madt_ioapic_t *)current, CONFIG_MAX_CPUS + 1,
Siyuan Wang80cf7d52013-07-09 17:42:43 +080017 0xFEC20000, 24);
18
19 current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
20 current, 0, 0, 2, 0);
21 current += acpi_create_madt_irqoverride((acpi_madt_irqoverride_t *)
22 current, 0, 9, 9, 0xF);
23 /* 0: mean bus 0--->ISA */
24 /* 0: PIC 0 */
25 /* 2: APIC 2 */
Kyösti Mälkkid8747572014-06-26 05:30:54 +030026 /* 5 mean: 0101 --> Edge-triggered, Active high */
Siyuan Wang80cf7d52013-07-09 17:42:43 +080027
28 /* create all subtables for processors */
29 current += acpi_create_madt_lapic_nmi((acpi_madt_lapic_nmi_t *)current, 0xff, 5, 1);
30 /* 1: LINT1 connect to NMI */
31
32 return current;
33}