1c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#ifndef __ASM_IO_APIC_H 2c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#define __ASM_IO_APIC_H 3c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 4c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#include <asm/types.h> 5c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#include <asm/mpspec.h> 6c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#include <asm/apicdef.h> 7c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 8c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 9c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * Intel IO-APIC support for SMP and UP systems. 10c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * 11c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * Copyright (C) 1997, 1998, 1999, 2000 Ingo Molnar 12c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 13c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 14c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 15c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * The structure of the IO-APIC: 16c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 17c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruunion IO_APIC_reg_00 { 18c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru u32 raw; 19c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct { 20c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru u32 __reserved_2 : 14, 21c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru LTS : 1, 22c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru delivery_type : 1, 23c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru __reserved_1 : 8, 24c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru ID : 8; 25c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru } __attribute__ ((packed)) bits; 26c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru}; 27c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 28c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruunion IO_APIC_reg_01 { 29c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru u32 raw; 30c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct { 31c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru u32 version : 8, 32c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru __reserved_2 : 7, 33c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru PRQ : 1, 34c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru entries : 8, 35c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru __reserved_1 : 8; 36c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru } __attribute__ ((packed)) bits; 37c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru}; 38c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 39c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruunion IO_APIC_reg_02 { 40c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru u32 raw; 41c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct { 42c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru u32 __reserved_2 : 24, 43c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru arbitration : 4, 44c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru __reserved_1 : 4; 45c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru } __attribute__ ((packed)) bits; 46c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru}; 47c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 48c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruunion IO_APIC_reg_03 { 49c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru u32 raw; 50c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct { 51c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru u32 boot_DT : 1, 52c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru __reserved_1 : 31; 53c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru } __attribute__ ((packed)) bits; 54c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru}; 55c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 56c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruenum ioapic_irq_destination_types { 57c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru dest_Fixed = 0, 58c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru dest_LowestPrio = 1, 59c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru dest_SMI = 2, 60c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru dest__reserved_1 = 3, 61c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru dest_NMI = 4, 62c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru dest_INIT = 5, 63c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru dest__reserved_2 = 6, 64c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru dest_ExtINT = 7 65c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru}; 66c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 67c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustruct IO_APIC_route_entry { 68c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru __u32 vector : 8, 69c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru delivery_mode : 3, /* 000: FIXED 70c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * 001: lowest prio 71c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * 111: ExtINT 72c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 73c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru dest_mode : 1, /* 0: physical, 1: logical */ 74c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru delivery_status : 1, 75c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru polarity : 1, 76c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru irr : 1, 77c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru trigger : 1, /* 0: edge, 1: level */ 78c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru mask : 1, /* 0: enabled, 1: disabled */ 79c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru __reserved_2 : 15; 80c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 81c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru union { struct { __u32 82c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru __reserved_1 : 24, 83c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru physical_dest : 4, 84c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru __reserved_2 : 4; 85c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru } physical; 86c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 87c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru struct { __u32 88c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru __reserved_1 : 24, 89c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru logical_dest : 8; 90c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru } logical; 91c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru } dest; 92c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 93c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru} __attribute__ ((packed)); 94c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 95c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#ifdef CONFIG_X86_IO_APIC 96c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 97c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 98c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * # of IO-APICs and # of IRQ routing registers 99c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 100c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int nr_ioapics; 101c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int nr_ioapic_registers[MAX_IO_APICS]; 102c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 103c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 104c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * MP-BIOS irq configuration table structures: 105c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 106c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 107c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* I/O APIC entries */ 108c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct mpc_config_ioapic mp_ioapics[MAX_IO_APICS]; 109c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 110c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* # of MP IRQ source entries */ 111c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int mp_irq_entries; 112c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 113c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* MP IRQ source entries */ 114c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern struct mpc_config_intsrc mp_irqs[MAX_IRQ_SOURCES]; 115c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 116c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* non-0 if default (table-less) MP configuration */ 117c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int mpc_default_type; 118c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 119c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* Older SiS APIC requires we rewrite the index register */ 120c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int sis_apic_bug; 121c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 122c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 1 if "noapic" boot option passed */ 123c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int skip_ioapic_setup; 124c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 125c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline void disable_ioapic_setup(void) 126c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru{ 127c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru skip_ioapic_setup = 1; 128c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru} 129c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 130c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Querustatic inline int ioapic_setup_disabled(void) 131c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru{ 132c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru return skip_ioapic_setup; 133c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru} 134c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 135c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru/* 136c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * If we use the IO-APIC for IRQ routing, disable automatic 137c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru * assignment of PCI IRQ's. 138c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru */ 139c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup && io_apic_irqs) 140c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 141c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#ifdef CONFIG_ACPI 142c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int io_apic_get_unique_id (int ioapic, int apic_id); 143c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int io_apic_get_version (int ioapic); 144c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int io_apic_get_redir_entries (int ioapic); 145c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low); 146c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int timer_uses_ioapic_pin_0; 147c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#endif /* CONFIG_ACPI */ 148c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 149c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queruextern int (*ioapic_renumber_irq)(int ioapic, int irq); 150c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 151c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#else /* !CONFIG_X86_IO_APIC */ 152c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#define io_apic_assign_pci_irqs 0 153c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#endif 154c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru 155c559cd81139f97cecad1ad91a0b2e25a5936d53Jean-Baptiste Queru#endif 156