diff options
Diffstat (limited to 'sys/include/arch/amd64')
-rw-r--r-- | sys/include/arch/amd64/cpu.h | 5 | ||||
-rw-r--r-- | sys/include/arch/amd64/ipi.h | 51 |
2 files changed, 3 insertions, 53 deletions
diff --git a/sys/include/arch/amd64/cpu.h b/sys/include/arch/amd64/cpu.h index cf073fe..5adff29 100644 --- a/sys/include/arch/amd64/cpu.h +++ b/sys/include/arch/amd64/cpu.h @@ -52,7 +52,7 @@ #define CPU_VENDOR_INTEL 0x00000001 #define CPU_VENDOR_AMD 0x00000002 -typedef uint16_t ipi_pend_t; +typedef uint32_t ipi_pend_t; struct cpu_info { uint32_t apicid; @@ -60,8 +60,7 @@ struct cpu_info { uint32_t vendor; /* Vendor (see CPU_VENDOR_*) */ uint8_t preempt : 1; /* CPU is preemptable */ uint8_t ipi_dispatch : 1; /* 1: IPIs being dispatched */ - uint8_t ipi_id; - ipi_pend_t ipi_pending[N_IPIVEC]; + ipi_pend_t ipi_pending; uint8_t id; /* MI Logical ID */ uint8_t model : 4; /* CPU model number */ uint8_t family : 4; /* CPU family ID */ diff --git a/sys/include/arch/amd64/ipi.h b/sys/include/arch/amd64/ipi.h index 1a3b51c..452d006 100644 --- a/sys/include/arch/amd64/ipi.h +++ b/sys/include/arch/amd64/ipi.h @@ -53,57 +53,8 @@ struct cpu_ipi { int(*handler)(struct cpu_ipi *ipi); }; -/* - * Represents an interrupt vector for a - * specific IPI - * - * @ipi: IPIs associated with this vector - * @cookie: Used to verify an instance - * @nipi: Number of IPIs associated - * @vec: System interrupt vector number - */ -struct ipi_vector { - struct cpu_ipi ipi[IPI_PER_VEC]; - uint16_t cookie; - uint8_t nipi; - uint8_t vec; -}; - int md_ipi_alloc(struct cpu_ipi **res); -int md_ipi_send(struct cpu_info *ci); +int md_ipi_send(struct cpu_info *ci, ipi_pend_t ipi); void md_ipi_init(void); -/* - * Get the vector an IPI belongs to - * - * @ipi: IPI to check - */ -__always_inline static inline uint8_t -ipi_vector(uint8_t ipi) -{ - return ipi / N_IPIVEC; -} - -/* - * Get the handler index an IPI belongs - * to - * - * @ipi: IPI to check - */ -__always_inline static inline uint8_t -ipi_index(uint8_t ipi) -{ - return ipi % (sizeof(ipi_pend_t) * 8); -} - -__always_inline static inline int -cpu_ipi_send(struct cpu_info *ci, uint8_t ipi) -{ - uint8_t vec = ipi_vector(ipi); - uint8_t idx = ipi_index(ipi); - - ci->ipi_pending[vec] |= BIT(idx); - return md_ipi_send(ci); -} - #endif /* !_MACHINE_IPI_H_ */ |