iPXE
pcimsix.h
Go to the documentation of this file.
1 #ifndef _IPXE_PCIMSIX_H
2 #define _IPXE_PCIMSIX_H
3 
4 /** @file
5  *
6  * PCI MSI-X interrupts
7  *
8  */
9 
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11 
12 #include <ipxe/pci.h>
13 
14 /** MSI-X BAR mapped length */
15 #define PCI_MSIX_LEN 0x1000
16 
17 /** MSI-X vector offset */
18 #define PCI_MSIX_VECTOR(n) ( (n) * 0x10 )
19 
20 /** MSI-X vector address low 32 bits */
21 #define PCI_MSIX_ADDRESS_LO 0x0
22 
23 /** MSI-X vector address high 32 bits */
24 #define PCI_MSIX_ADDRESS_HI 0x4
25 
26 /** MSI-X vector data */
27 #define PCI_MSIX_DATA 0x8
28 
29 /** MSI-X vector control */
30 #define PCI_MSIX_CONTROL 0xc
31 #define PCI_MSIX_CONTROL_MASK 0x00000001 /**< Vector is masked */
32 
33 /** PCI MSI-X capability */
34 struct pci_msix {
35  /** Capability offset */
36  unsigned int cap;
37  /** Number of vectors */
38  unsigned int count;
39  /** MSI-X table */
40  void *table;
41  /** Pending bit array */
42  void *pba;
43 };
44 
45 extern int pci_msix_enable ( struct pci_device *pci, struct pci_msix *msix );
46 extern void pci_msix_disable ( struct pci_device *pci, struct pci_msix *msix );
47 extern void pci_msix_map ( struct pci_msix *msix, unsigned int vector,
49 extern void pci_msix_control ( struct pci_msix *msix, unsigned int vector,
50  uint32_t mask );
51 extern void pci_msix_dump ( struct pci_msix *msix, unsigned int vector );
52 
53 /**
54  * Mask MSI-X interrupt vector
55  *
56  * @v msix MSI-X capability
57  * @v vector MSI-X vector
58  */
59 static inline __attribute__ (( always_inline )) void
60 pci_msix_mask ( struct pci_msix *msix, unsigned int vector ) {
61 
63 }
64 
65 /**
66  * Unmask MSI-X interrupt vector
67  *
68  * @v msix MSI-X capability
69  * @v vector MSI-X vector
70  */
71 static inline __attribute__ (( always_inline )) void
72 pci_msix_unmask ( struct pci_msix *msix, unsigned int vector ) {
73 
74  pci_msix_control ( msix, vector, 0 );
75 }
76 
77 #endif /* _IPXE_PCIMSIX_H */
int pci_msix_enable(struct pci_device *pci, struct pci_msix *msix)
Enable MSI-X interrupts.
Definition: pcimsix.c:104
#define __attribute__(x)
Definition: compiler.h:10
void pci_msix_control(struct pci_msix *msix, unsigned int vector, uint32_t mask)
Control MSI-X interrupt vector.
Definition: pcimsix.c:207
void pci_msix_map(struct pci_msix *msix, unsigned int vector, physaddr_t address, uint32_t data)
Map MSI-X interrupt vector.
Definition: pcimsix.c:181
uint32_t vector
MSI-X vector.
Definition: ena.h:20
uint64_t address
Base address.
Definition: ena.h:24
static void pci_msix_mask(struct pci_msix *msix, unsigned int vector)
Mask MSI-X interrupt vector.
Definition: pcimsix.h:60
PCI MSI-X capability.
Definition: pcimsix.h:34
static void pci_msix_unmask(struct pci_msix *msix, unsigned int vector)
Unmask MSI-X interrupt vector.
Definition: pcimsix.h:72
unsigned int cap
Capability offset.
Definition: pcimsix.h:36
PCI bus.
A PCI device.
Definition: pci.h:187
void * table
MSI-X table.
Definition: pcimsix.h:40
unsigned int uint32_t
Definition: stdint.h:12
unsigned long physaddr_t
Definition: stdint.h:20
FILE_LICENCE(GPL2_OR_LATER_OR_UBDL)
#define PCI_MSIX_CONTROL_MASK
Vector is masked.
Definition: pcimsix.h:31
void pci_msix_disable(struct pci_device *pci, struct pci_msix *msix)
Disable MSI-X interrupts.
Definition: pcimsix.c:158
void pci_msix_dump(struct pci_msix *msix, unsigned int vector)
Dump MSI-X interrupt state (for debugging)
Definition: pcimsix.c:226
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
void * pba
Pending bit array.
Definition: pcimsix.h:42
unsigned int count
Number of vectors.
Definition: pcimsix.h:38