pci: generic MSI interrupts support

Change-Id: Ib4fd23f6bca867a2b428bf2651234d719ee08672
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6221
Reviewed-by: waddlesplash <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
X512
2023-04-25 15:54:32 +00:00
committed by waddlesplash
parent 26704b5974
commit e942269a1f
19 changed files with 256 additions and 198 deletions
+17
View File
@@ -38,6 +38,23 @@ typedef struct pci_device_module_info {
uint16 *offset);
uint8 (*get_powerstate)(pci_device *device);
void (*set_powerstate)(pci_device *device, uint8 state);
// MSI/MSI-X
uint8 (*get_msi_count)(pci_device *device);
status_t (*configure_msi)(pci_device *device,
uint8 count,
uint8 *startVector);
status_t (*unconfigure_msi)(pci_device *device);
status_t (*enable_msi)(pci_device *device);
status_t (*disable_msi)(pci_device *device);
uint8 (*get_msix_count)(pci_device *device);
status_t (*configure_msix)(pci_device *device,
uint8 count,
uint8 *startVector);
status_t (*enable_msix)(pci_device *device);
} pci_device_module_info;
+35
View File
@@ -0,0 +1,35 @@
/*
* Copyright 2022, Haiku Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _KERNEL_ARCH_GENERIC_MSI_H
#define _KERNEL_ARCH_GENERIC_MSI_H
#include <SupportDefs.h>
#ifdef __cplusplus
class MSIInterface {
public:
virtual status_t AllocateVectors(
uint8 count, uint8& startVector, uint64& address, uint16& data) = 0;
virtual void FreeVectors(uint8 count, uint8 startVector) = 0;
};
extern "C" {
void msi_set_interface(MSIInterface* interface);
#endif
bool msi_supported();
status_t msi_allocate_vectors(uint8 count, uint8 *startVector,
uint64 *address, uint16 *data);
void msi_free_vectors(uint8 count, uint8 startVector);
#ifdef __cplusplus
}
#endif
#endif // _KERNEL_ARCH_GENERIC_MSI_H
+2 -5
View File
@@ -1,7 +1,7 @@
#ifndef _KERNEL_ARCH_x86_MSI_H
#define _KERNEL_ARCH_x86_MSI_H
#include <SupportDefs.h>
#include <arch/generic/msi.h>
// address register
#define MSI_ADDRESS_BASE 0xfee00000
@@ -24,10 +24,7 @@
#define MSI_DELIVERY_MODE_EXT_INT 0x00000700
bool msi_supported();
status_t msi_allocate_vectors(uint8 count, uint8 *startVector,
uint64 *address, uint16 *data);
void msi_free_vectors(uint8 count, uint8 startVector);
void msi_assign_interrupt_to_cpu(uint8 irq, int32 cpu);
#endif // _KERNEL_ARCH_x86_MSI_H