1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */ 2*4882a593Smuzhiyun /* 3*4882a593Smuzhiyun * Private structs/constants for PARISC IOSAPIC support 4*4882a593Smuzhiyun * 5*4882a593Smuzhiyun * Copyright (C) 2000 Hewlett Packard (Grant Grundler) 6*4882a593Smuzhiyun * Copyright (C) 2000,2003 Grant Grundler (grundler at parisc-linux.org) 7*4882a593Smuzhiyun * Copyright (C) 2002 Matthew Wilcox (willy at parisc-linux.org) 8*4882a593Smuzhiyun */ 9*4882a593Smuzhiyun 10*4882a593Smuzhiyun /* 11*4882a593Smuzhiyun ** This file is private to iosapic driver. 12*4882a593Smuzhiyun ** If stuff needs to be used by another driver, move it to a common file. 13*4882a593Smuzhiyun ** 14*4882a593Smuzhiyun ** WARNING: fields most data structures here are ordered to make sure 15*4882a593Smuzhiyun ** they pack nicely for 64-bit compilation. (ie sizeof(long) == 8) 16*4882a593Smuzhiyun */ 17*4882a593Smuzhiyun 18*4882a593Smuzhiyun 19*4882a593Smuzhiyun /* 20*4882a593Smuzhiyun ** Interrupt Routing Stuff 21*4882a593Smuzhiyun ** ----------------------- 22*4882a593Smuzhiyun ** The interrupt routing table consists of entries derived from 23*4882a593Smuzhiyun ** MP Specification Draft 1.5. There is one interrupt routing 24*4882a593Smuzhiyun ** table per cell. N- and L-class consist of a single cell. 25*4882a593Smuzhiyun */ 26*4882a593Smuzhiyun struct irt_entry { 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun /* Entry Type 139 identifies an I/O SAPIC interrupt entry */ 29*4882a593Smuzhiyun u8 entry_type; 30*4882a593Smuzhiyun 31*4882a593Smuzhiyun /* Entry Length 16 indicates entry is 16 bytes long */ 32*4882a593Smuzhiyun u8 entry_length; 33*4882a593Smuzhiyun 34*4882a593Smuzhiyun /* 35*4882a593Smuzhiyun ** Interrupt Type of 0 indicates a vectored interrupt, 36*4882a593Smuzhiyun ** all other values are reserved 37*4882a593Smuzhiyun */ 38*4882a593Smuzhiyun u8 interrupt_type; 39*4882a593Smuzhiyun 40*4882a593Smuzhiyun /* 41*4882a593Smuzhiyun ** PO and EL 42*4882a593Smuzhiyun ** Polarity of SAPIC I/O input signals: 43*4882a593Smuzhiyun ** 00 = Reserved 44*4882a593Smuzhiyun ** 01 = Active high 45*4882a593Smuzhiyun ** 10 = Reserved 46*4882a593Smuzhiyun ** 11 = Active low 47*4882a593Smuzhiyun ** Trigger mode of SAPIC I/O input signals: 48*4882a593Smuzhiyun ** 00 = Reserved 49*4882a593Smuzhiyun ** 01 = Edge-triggered 50*4882a593Smuzhiyun ** 10 = Reserved 51*4882a593Smuzhiyun ** 11 = Level-triggered 52*4882a593Smuzhiyun */ 53*4882a593Smuzhiyun u8 polarity_trigger; 54*4882a593Smuzhiyun 55*4882a593Smuzhiyun /* 56*4882a593Smuzhiyun ** IRQ and DEVNO 57*4882a593Smuzhiyun ** irq identifies PCI interrupt signal where 58*4882a593Smuzhiyun ** 0x0 corresponds to INT_A#, 59*4882a593Smuzhiyun ** 0x1 corresponds to INT_B#, 60*4882a593Smuzhiyun ** 0x2 corresponds to INT_C# 61*4882a593Smuzhiyun ** 0x3 corresponds to INT_D# 62*4882a593Smuzhiyun ** PCI device number where interrupt originates 63*4882a593Smuzhiyun */ 64*4882a593Smuzhiyun u8 src_bus_irq_devno; 65*4882a593Smuzhiyun 66*4882a593Smuzhiyun /* Source Bus ID identifies the bus where interrupt signal comes from */ 67*4882a593Smuzhiyun u8 src_bus_id; 68*4882a593Smuzhiyun 69*4882a593Smuzhiyun /* 70*4882a593Smuzhiyun ** Segment ID is unique across a protection domain and 71*4882a593Smuzhiyun ** identifies a segment of PCI buses (reserved in 72*4882a593Smuzhiyun ** MP Specification Draft 1.5) 73*4882a593Smuzhiyun */ 74*4882a593Smuzhiyun u8 src_seg_id; 75*4882a593Smuzhiyun 76*4882a593Smuzhiyun /* 77*4882a593Smuzhiyun ** Destination I/O SAPIC INTIN# identifies the INTIN n pin 78*4882a593Smuzhiyun ** to which the signal is connected 79*4882a593Smuzhiyun */ 80*4882a593Smuzhiyun u8 dest_iosapic_intin; 81*4882a593Smuzhiyun 82*4882a593Smuzhiyun /* 83*4882a593Smuzhiyun ** Destination I/O SAPIC Address identifies the I/O SAPIC 84*4882a593Smuzhiyun ** to which the signal is connected 85*4882a593Smuzhiyun */ 86*4882a593Smuzhiyun u64 dest_iosapic_addr; 87*4882a593Smuzhiyun }; 88*4882a593Smuzhiyun 89*4882a593Smuzhiyun #define IRT_IOSAPIC_TYPE 139 90*4882a593Smuzhiyun #define IRT_IOSAPIC_LENGTH 16 91*4882a593Smuzhiyun 92*4882a593Smuzhiyun #define IRT_VECTORED_INTR 0 93*4882a593Smuzhiyun 94*4882a593Smuzhiyun #define IRT_PO_MASK 0x3 95*4882a593Smuzhiyun #define IRT_ACTIVE_HI 1 96*4882a593Smuzhiyun #define IRT_ACTIVE_LO 3 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun #define IRT_EL_MASK 0x3 99*4882a593Smuzhiyun #define IRT_EL_SHIFT 2 100*4882a593Smuzhiyun #define IRT_EDGE_TRIG 1 101*4882a593Smuzhiyun #define IRT_LEVEL_TRIG 3 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun #define IRT_IRQ_MASK 0x3 104*4882a593Smuzhiyun #define IRT_DEV_MASK 0x1f 105*4882a593Smuzhiyun #define IRT_DEV_SHIFT 2 106*4882a593Smuzhiyun 107*4882a593Smuzhiyun #define IRT_IRQ_DEVNO_MASK ((IRT_DEV_MASK << IRT_DEV_SHIFT) | IRT_IRQ_MASK) 108*4882a593Smuzhiyun 109*4882a593Smuzhiyun #ifdef SUPPORT_MULTI_CELL 110*4882a593Smuzhiyun struct iosapic_irt { 111*4882a593Smuzhiyun struct iosapic_irt *irt_next; /* next routing table */ 112*4882a593Smuzhiyun struct irt_entry *irt_base; /* intr routing table address */ 113*4882a593Smuzhiyun size_t irte_count; /* number of entries in the table */ 114*4882a593Smuzhiyun size_t irte_size; /* size (bytes) of each entry */ 115*4882a593Smuzhiyun }; 116*4882a593Smuzhiyun #endif 117*4882a593Smuzhiyun 118*4882a593Smuzhiyun struct vector_info { 119*4882a593Smuzhiyun struct iosapic_info *iosapic; /* I/O SAPIC this vector is on */ 120*4882a593Smuzhiyun struct irt_entry *irte; /* IRT entry */ 121*4882a593Smuzhiyun u32 __iomem *eoi_addr; /* precalculate EOI reg address */ 122*4882a593Smuzhiyun u32 eoi_data; /* IA64: ? PA: swapped txn_data */ 123*4882a593Smuzhiyun int txn_irq; /* virtual IRQ number for processor */ 124*4882a593Smuzhiyun ulong txn_addr; /* IA64: id_eid PA: partial HPA */ 125*4882a593Smuzhiyun u32 txn_data; /* CPU interrupt bit */ 126*4882a593Smuzhiyun u8 status; /* status/flags */ 127*4882a593Smuzhiyun u8 irqline; /* INTINn(IRQ) */ 128*4882a593Smuzhiyun }; 129*4882a593Smuzhiyun 130*4882a593Smuzhiyun 131*4882a593Smuzhiyun struct iosapic_info { 132*4882a593Smuzhiyun struct iosapic_info * isi_next; /* list of I/O SAPIC */ 133*4882a593Smuzhiyun void __iomem * addr; /* remapped address */ 134*4882a593Smuzhiyun unsigned long isi_hpa; /* physical base address */ 135*4882a593Smuzhiyun struct vector_info * isi_vector; /* IRdT (IRQ line) array */ 136*4882a593Smuzhiyun int isi_num_vectors; /* size of IRdT array */ 137*4882a593Smuzhiyun int isi_status; /* status/flags */ 138*4882a593Smuzhiyun unsigned int isi_version; /* DEBUG: data fr version reg */ 139*4882a593Smuzhiyun }; 140*4882a593Smuzhiyun 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun 143*4882a593Smuzhiyun #ifdef __IA64__ 144*4882a593Smuzhiyun /* 145*4882a593Smuzhiyun ** PA risc does NOT have any local sapics. IA64 does. 146*4882a593Smuzhiyun ** PIB (Processor Interrupt Block) is handled by Astro or Dew (Stretch CEC). 147*4882a593Smuzhiyun ** 148*4882a593Smuzhiyun ** PA: Get id_eid from IRT and hardcode PIB to 0xfeeNNNN0 149*4882a593Smuzhiyun ** Emulate the data on PAT platforms. 150*4882a593Smuzhiyun */ 151*4882a593Smuzhiyun struct local_sapic_info { 152*4882a593Smuzhiyun struct local_sapic_info *lsi_next; /* point to next CPU info */ 153*4882a593Smuzhiyun int *lsi_cpu_id; /* point to logical CPU id */ 154*4882a593Smuzhiyun unsigned long *lsi_id_eid; /* point to IA-64 CPU id */ 155*4882a593Smuzhiyun int *lsi_status; /* point to CPU status */ 156*4882a593Smuzhiyun void *lsi_private; /* point to special info */ 157*4882a593Smuzhiyun }; 158*4882a593Smuzhiyun 159*4882a593Smuzhiyun /* 160*4882a593Smuzhiyun ** "root" data structure which ties everything together. 161*4882a593Smuzhiyun ** Should always be able to start with sapic_root and locate 162*4882a593Smuzhiyun ** the desired information. 163*4882a593Smuzhiyun */ 164*4882a593Smuzhiyun struct sapic_info { 165*4882a593Smuzhiyun struct sapic_info *si_next; /* info is per cell */ 166*4882a593Smuzhiyun int si_cellid; /* cell id */ 167*4882a593Smuzhiyun unsigned int si_status; /* status */ 168*4882a593Smuzhiyun char *si_pib_base; /* intr blk base address */ 169*4882a593Smuzhiyun local_sapic_info_t *si_local_info; 170*4882a593Smuzhiyun io_sapic_info_t *si_io_info; 171*4882a593Smuzhiyun extint_info_t *si_extint_info;/* External Intr info */ 172*4882a593Smuzhiyun }; 173*4882a593Smuzhiyun #endif 174*4882a593Smuzhiyun 175