4 Copyright © 1995-2017, The AROS Development Team. All rights reserved.
7 Desc: Generic AROS APIC definitions.
13 #define APIC_MSI_BASE 0x7FFFFFFF
17 * Even old IntelMP spec say that we should be prepared to handle different CPUs.
18 * This is why we have timer frequency here, not globally.
33 ULONG cpu_TimerFreq
; /* Timer clock frequency */
34 UQUAD cpu_TSCFreq
; /* Timestamp counter frequency */
35 apicid_t cpu_LocalID
; /* Local APIC ID */
36 apicid_t cpu_PrivateID
; /* Sub-system private (ACPI, whatever) ID - can differ */
37 icintrid_t cpu_ICID
; /* NB - this is icintrid_t not icid_t */
41 struct CPUMMUConfig
*cpu_MMU
;
43 UQUAD cpu_LastCPULoadTime
;
50 IPTR lapicBase
; /* Local APIC base address */
51 ULONG apic_count
; /* Total number of APICs in the system */
52 UWORD flags
; /* See below */
53 struct CPUData cores
[0]; /* Per-CPU data */
56 #define APF_8259 (1 << 0) /* Legacy PIC present */
57 #define APF_TIMER (1 << 1) /* APIC uses its own heartbeat timer */
60 #define APIC_BASE_MASK 0x000FFFFFFFFFF000
62 #define APIC_BASE_MASK 0xFFFFF000
65 struct APICCPUWake_Data
67 APTR cpuw_apicstartrip
;
73 ULONG
core_APIC_Wake(APTR start_addr
, apicid_t id
, IPTR base
);
74 UBYTE
core_APIC_GetID(IPTR base
);
75 void core_APIC_Init(struct APICData
*data
, apicid_t cpuNum
);
76 void core_APIC_AckIntr(void);
78 /* This is callable in supervisor only */
79 static inline IPTR
core_APIC_GetBase(void)
81 return rdmsri(0x1B) & APIC_BASE_MASK
;
84 struct APICData
*core_APIC_Probe(void);
86 apicid_t
core_APIC_GetNumberFromLocal(struct APICData
*, apicid_t
);
87 apicid_t
core_APIC_GetNumber(struct APICData
*);
88 void core_APIC_GetMask(struct APICData
*, apicid_t
, cpumask_t
*);
89 BOOL
core_APIC_CPUInMask(apicid_t
, cpumask_t
*);
91 void core_SetupIDT(apicid_t
, apicidt_t
*);
92 BOOL
core_SetIDTGate(apicidt_t
*, int, uintptr_t, BOOL
);
93 BOOL
core_SetIRQGate(void *, int, uintptr_t);
94 void core_DefaultIRETQ();
96 ULONG
core_APIC_AllocMSI(ULONG
);
97 void core_APIC_RegisterMSI(void *);
99 extern struct IntrController APICInt_IntrController
;
101 #endif /* !KERNEL_APIC_H */