pci: extend MSI interrupt vector number to 32 bits

Also increase MSI message data size to 32 bits according to PCIe spec.

Remove 0xff check for MSI interrupts because it is potentially valid
interrupt vector number. Reject 0xff only for legacy pin interrupts.

- MSI-X supports up to 2048 interrupts per device that do not fit to
`uint8`.

- Non-x86 systems may use separate interrupt vector ranges for
hard-wired interrupts and MSI interrupts so `uint8` is not enough to
represent all of them.

Change-Id: Iaf9ffb197ec23db0f97ffe3ea756d28d7bfc8705
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7433
Reviewed-by: waddlesplash <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
X512
2024-02-28 23:17:42 +00:00
committed by waddlesplash
parent da24b14bf2
commit 629f071bb9
31 changed files with 143 additions and 106 deletions
+6 -6
View File
@@ -186,7 +186,7 @@ struct pci_module_info {
status_t (*get_powerstate)(uint8 bus, uint8 device, uint8 function, uint8* state);
status_t (*set_powerstate)(uint8 bus, uint8 device, uint8 function, uint8 newState);
uint8 (*get_msi_count)(
uint32 (*get_msi_count)(
uint8 bus, /* bus number */
uint8 device, /* device # on bus */
uint8 function); /* function # in device */
@@ -195,8 +195,8 @@ struct pci_module_info {
uint8 bus, /* bus number */
uint8 device, /* device # on bus */
uint8 function, /* function # in device */
uint8 count, /* count of vectors desired */
uint8 *startVector); /* first configured vector */
uint32 count, /* count of vectors desired */
uint32 *startVector); /* first configured vector */
status_t (*unconfigure_msi)(
uint8 bus, /* bus number */
uint8 device, /* device # on bus */
@@ -211,7 +211,7 @@ struct pci_module_info {
uint8 device, /* device # on bus */
uint8 function); /* function # in device */
uint8 (*get_msix_count)(
uint32 (*get_msix_count)(
uint8 bus, /* bus number */
uint8 device, /* device # on bus */
uint8 function); /* function # in device */
@@ -220,8 +220,8 @@ struct pci_module_info {
uint8 bus, /* bus number */
uint8 device, /* device # on bus */
uint8 function, /* function # in device */
uint8 count, /* count of vectors desired */
uint8 *startVector); /* first configured vector */
uint32 count, /* count of vectors desired */
uint32 *startVector); /* first configured vector */
status_t (*enable_msix)(
uint8 bus, /* bus number */
uint8 device, /* device # on bus */
+6 -6
View File
@@ -40,19 +40,19 @@ typedef struct pci_device_module_info {
void (*set_powerstate)(pci_device *device, uint8 state);
// MSI/MSI-X
uint8 (*get_msi_count)(pci_device *device);
uint32 (*get_msi_count)(pci_device *device);
status_t (*configure_msi)(pci_device *device,
uint8 count,
uint8 *startVector);
uint32 count,
uint32 *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);
uint32 (*get_msix_count)(pci_device *device);
status_t (*configure_msix)(pci_device *device,
uint8 count,
uint8 *startVector);
uint32 count,
uint32 *startVector);
status_t (*enable_msix)(pci_device *device);
} pci_device_module_info;
+5 -5
View File
@@ -13,8 +13,8 @@
class MSIInterface {
public:
virtual status_t AllocateVectors(
uint8 count, uint8& startVector, uint64& address, uint16& data) = 0;
virtual void FreeVectors(uint8 count, uint8 startVector) = 0;
uint32 count, uint32& startVector, uint64& address, uint32& data) = 0;
virtual void FreeVectors(uint32 count, uint32 startVector) = 0;
};
@@ -23,9 +23,9 @@ 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);
status_t msi_allocate_vectors(uint32 count, uint32 *startVector,
uint64 *address, uint32 *data);
void msi_free_vectors(uint32 count, uint32 startVector);
#ifdef __cplusplus
}
+1 -1
View File
@@ -24,7 +24,7 @@
#define MSI_DELIVERY_MODE_EXT_INT 0x00000700
void msi_assign_interrupt_to_cpu(uint8 irq, int32 cpu);
void msi_assign_interrupt_to_cpu(uint32 irq, int32 cpu);
#endif // _KERNEL_ARCH_x86_MSI_H