1 /* 2 * Copyright 2008, Dustin Howett, dustin.howett@gmail.com. All rights reserved. 3 * Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved. 4 * Distributed under the terms of the MIT License. 5 * 6 * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. 7 * Distributed under the terms of the NewOS License. 8 */ 9 #ifndef _KERNEL_ARCH_x86_ARCH_SMP_H 10 #define _KERNEL_ARCH_x86_ARCH_SMP_H 11 12 #define MP_FLOATING_SIGNATURE '_PM_' 13 #define MP_CONFIG_TABLE_SIGNATURE 'PCMP' 14 15 /* 16 #define IPI_CACHE_FLUSH 0x40 17 #define IPI_INV_TLB 0x41 18 #define IPI_INV_PTE 0x42 19 #define IPI_INV_RESCHED 0x43 20 #define IPI_STOP 0x44 21 */ 22 23 struct mp_config_table { 24 uint32 signature; /* "PCMP" */ 25 uint16 base_table_length; /* length of the base table entries and this structure */ 26 uint8 spec_revision; /* spec supported, 1 for 1.1 or 4 for 1.4 */ 27 uint8 checksum; /* checksum, all bytes add up to zero */ 28 char oem[8]; /* oem identification, not null-terminated */ 29 char product[12]; /* product name, not null-terminated */ 30 void *oem_table; /* addr of oem-defined table, zero if none */ 31 uint16 oem_length; /* length of oem table */ 32 uint16 num_base_entries; /* number of entries in base table */ 33 uint32 apic; /* address of apic */ 34 uint16 ext_length; /* length of extended section */ 35 uint8 ext_checksum; /* checksum of extended table entries */ 36 uint8 reserved; 37 }; 38 39 struct mp_floating_struct { 40 uint32 signature; /* "_MP_" */ 41 struct mp_config_table *config_table; /* address of mp configuration table */ 42 uint8 config_length; /* length of the table in 16-byte units */ 43 uint8 spec_revision; /* spec supported, 1 for 1.1 or 4 for 1.4 */ 44 uint8 checksum; /* checksum, all bytes add up to zero */ 45 uint8 mp_feature_1; /* mp system configuration type if no mpc */ 46 uint8 mp_feature_2; /* imcrp */ 47 uint8 mp_feature_3, mp_feature_4, mp_feature_5; /* reserved */ 48 }; 49 50 /* base config entry types */ 51 enum { 52 MP_BASE_PROCESSOR = 0, 53 MP_BASE_BUS, 54 MP_BASE_IO_APIC, 55 MP_BASE_IO_INTR, 56 MP_BASE_LOCAL_INTR, 57 }; 58 59 struct mp_base_processor { 60 uint8 type; 61 uint8 apic_id; 62 uint8 apic_version; 63 uint8 cpu_flags; 64 uint32 signature; /* stepping, model, family, each four bits */ 65 uint32 feature_flags; 66 uint32 res1, res2; 67 }; 68 69 struct mp_base_ioapic { 70 uint8 type; 71 uint8 ioapic_id; 72 uint8 ioapic_version; 73 uint8 ioapic_flags; 74 uint32 *addr; 75 }; 76 77 struct mp_base_bus { 78 uint8 type; 79 uint8 bus_id; 80 char name[6]; 81 }; 82 83 struct mp_base_interrupt { 84 uint8 type; 85 uint8 interrupt_type; 86 uint16 polarity : 2; 87 uint16 trigger_mode : 2; 88 uint16 _reserved : 12; 89 uint8 source_bus_id; 90 uint8 source_bus_irq; 91 uint8 dest_apic_id; 92 uint8 dest_apic_int; 93 }; 94 95 enum { 96 MP_INTR_TYPE_INT = 0, 97 MP_INTR_TYPE_NMI, 98 MP_INTR_TYPE_SMI, 99 MP_INTR_TYPE_ExtINT, 100 }; 101 102 103 #ifdef __cplusplus 104 extern "C" { 105 #endif 106 107 108 uint32 x86_get_cpu_apic_id(int32 cpu); 109 110 111 #ifdef __cplusplus 112 } 113 #endif 114 115 116 #endif /* _KERNEL_ARCH_x86_ARCH_SMP_H */ 117