// Kernel interrupt objects and platform source registration. #pragma once #include #include typedef struct KE_INTERRUPT KE_INTERRUPT; typedef void (*KE_INTERRUPT_ROUTINE)(void* context); typedef struct KE_INTERRUPT_INFO { uint32_t CpuIndex; uint32_t HardwareId; uint32_t Gsi; uint16_t Flags; uint8_t Vector; uint8_t IsMessage; uint64_t Delivered; } KE_INTERRUPT_INFO; typedef enum KE_INTERRUPT_MESSAGE_OPERATION { KeInterruptMessageQuiesce = 1, KeInterruptMessageProgram, KeInterruptMessageResume } KE_INTERRUPT_MESSAGE_OPERATION; typedef struct NTL_DDK_MSI_MESSAGE { uint64_t Address; uint32_t Data; uint32_t Reserved; } NTL_DDK_MSI_MESSAGE; // Only the bus owner programs a device's message source. The interrupt manager // selects CPUs/vectors and coordinates quiescence with this device callback. typedef KSTATUS (*KE_INTERRUPT_MESSAGE_PROGRAM)(void* context, KE_INTERRUPT_MESSAGE_OPERATION operation, const NTL_DDK_MSI_MESSAGE* message); // The platform owns GSI routing and ISA overrides; drivers own only their handler. __declspec(dllexport) KSTATUS KeInterruptConnectGsi(uint32_t gsi, uint16_t flags, uint64_t affinity, KE_INTERRUPT_ROUTINE routine, void* context, KE_INTERRUPT** out); __declspec(dllexport) KSTATUS KeInterruptConnectIsa(uint8_t isaIrq, uint16_t sourceFlags, uint64_t affinity, KE_INTERRUPT_ROUTINE routine, void* context, KE_INTERRUPT** out); // PCI enables the device's MSI/MSI-X source after reserving the CPU/vector route. __declspec(dllexport) KSTATUS KeInterruptReserveMessage(uint64_t affinity, KE_INTERRUPT_ROUTINE routine, void* context, KE_INTERRUPT** out); __declspec(dllexport) KSTATUS KeInterruptComposeMessage(const KE_INTERRUPT* interrupt, NTL_DDK_MSI_MESSAGE* out); __declspec(dllexport) KSTATUS KeInterruptQuery(const KE_INTERRUPT* interrupt, KE_INTERRUPT_INFO* out); __declspec(dllexport) KSTATUS KeInterruptBindMessageSource(KE_INTERRUPT* interrupt, KE_INTERRUPT_MESSAGE_PROGRAM program, void* context); __declspec(dllexport) KSTATUS KeInterruptActivateMessage(KE_INTERRUPT* interrupt); __declspec(dllexport) KSTATUS KeInterruptSetAffinity(KE_INTERRUPT* interrupt, uint64_t permittedCpuMask); // Bus drivers close a route before disabling its source, serializing migration. __declspec(dllexport) void KeInterruptBeginDisconnect(KE_INTERRUPT* interrupt); // Disconnect waits for active handlers and requires PASSIVE_LEVEL. __declspec(dllexport) void KeInterruptDisconnect(KE_INTERRUPT* interrupt);