You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #ifndef _IPXE_PCIEA_H
  2. #define _IPXE_PCIEA_H
  3. /** @file
  4. *
  5. * PCI Enhanced Allocation
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <ipxe/pci.h>
  10. /** Number of entries */
  11. #define PCIEA_ENTRIES 2
  12. #define PCIEA_ENTRIES_MASK 0x3f
  13. /** First entry */
  14. #define PCIEA_FIRST 4
  15. /** Entry descriptor */
  16. #define PCIEA_DESC 0
  17. /** Entry size */
  18. #define PCIEA_DESC_SIZE(desc) ( ( (desc) >> 0 ) & 0x7 )
  19. /** BAR equivalent indicator */
  20. #define PCIEA_DESC_BEI(desc) ( ( (desc) >> 4 ) & 0xf )
  21. /** BAR equivalent indicators */
  22. enum pciea_bei {
  23. PCIEA_BEI_BAR_0 = 0, /**< Standard BAR 0 */
  24. PCIEA_BEI_BAR_1 = 1, /**< Standard BAR 1 */
  25. PCIEA_BEI_BAR_2 = 2, /**< Standard BAR 2 */
  26. PCIEA_BEI_BAR_3 = 3, /**< Standard BAR 3 */
  27. PCIEA_BEI_BAR_4 = 4, /**< Standard BAR 4 */
  28. PCIEA_BEI_BAR_5 = 5, /**< Standard BAR 5 */
  29. PCIEA_BEI_ROM = 8, /**< Expansion ROM BAR */
  30. PCIEA_BEI_VF_BAR_0 = 9, /**< Virtual function BAR 0 */
  31. PCIEA_BEI_VF_BAR_1 = 10, /**< Virtual function BAR 1 */
  32. PCIEA_BEI_VF_BAR_2 = 11, /**< Virtual function BAR 2 */
  33. PCIEA_BEI_VF_BAR_3 = 12, /**< Virtual function BAR 3 */
  34. PCIEA_BEI_VF_BAR_4 = 13, /**< Virtual function BAR 4 */
  35. PCIEA_BEI_VF_BAR_5 = 14, /**< Virtual function BAR 5 */
  36. };
  37. /** Entry is enabled */
  38. #define PCIEA_DESC_ENABLED 0x80000000UL
  39. /** Base address low dword */
  40. #define PCIEA_LOW_BASE 4
  41. /** Limit low dword */
  42. #define PCIEA_LOW_LIMIT 8
  43. /** BAR is 64-bit */
  44. #define PCIEA_LOW_ATTR_64BIT 0x00000002UL
  45. /** Low dword attribute bit mask */
  46. #define PCIEA_LOW_ATTR_MASK 0x00000003UL
  47. /** Offset to high dwords */
  48. #define PCIEA_LOW_HIGH 8
  49. extern unsigned long pciea_bar_start ( struct pci_device *pci,
  50. unsigned int bei );
  51. extern unsigned long pciea_bar_size ( struct pci_device *pci,
  52. unsigned int bei );
  53. #endif /* _IPXE_PCIEA_H */