From e2b5a588691c6b0bdb99ca4b27cb8c5ea0ac712b Mon Sep 17 00:00:00 2001 From: Michael Brown Date: Mon, 14 Feb 2011 01:37:44 +0000 Subject: [efi] Rename efi_pci.h to efi_pci_api.h Signed-off-by: Michael Brown --- src/include/ipxe/efi/efi_pci.h | 148 ------------------------------------- src/include/ipxe/efi/efi_pci_api.h | 148 +++++++++++++++++++++++++++++++++++++ src/include/ipxe/pci_io.h | 2 +- 3 files changed, 149 insertions(+), 149 deletions(-) delete mode 100644 src/include/ipxe/efi/efi_pci.h create mode 100644 src/include/ipxe/efi/efi_pci_api.h diff --git a/src/include/ipxe/efi/efi_pci.h b/src/include/ipxe/efi/efi_pci.h deleted file mode 100644 index e06473d3e..000000000 --- a/src/include/ipxe/efi/efi_pci.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef _IPXE_EFI_PCI_H -#define _IPXE_EFI_PCI_H - -/** @file - * - * iPXE PCI I/O API for EFI - * - */ - -FILE_LICENCE ( GPL2_OR_LATER ); - -#ifdef PCIAPI_EFI -#define PCIAPI_PREFIX_efi -#else -#define PCIAPI_PREFIX_efi __efi_ -#endif - -/* EFI PCI width codes defined by EFI spec */ -#define EFIPCI_WIDTH_BYTE 0 -#define EFIPCI_WIDTH_WORD 1 -#define EFIPCI_WIDTH_DWORD 2 - -#define EFIPCI_LOCATION( _offset, _width ) \ - ( (_offset) | ( (_width) << 16 ) ) -#define EFIPCI_OFFSET( _location ) ( (_location) & 0xffff ) -#define EFIPCI_WIDTH( _location ) ( (_location) >> 16 ) - -struct pci_device; - -extern int efipci_read ( struct pci_device *pci, unsigned long location, - void *value ); -extern int efipci_write ( struct pci_device *pci, unsigned long location, - unsigned long value ); - -/** - * Determine number of PCI buses within system - * - * @ret num_bus Number of buses - */ -static inline __always_inline int -PCIAPI_INLINE ( efi, pci_num_bus ) ( void ) { - /* No way to work this out via EFI */ - return 0x100; -} - -/** - * Read byte from PCI configuration space via EFI - * - * @v pci PCI device - * @v where Location within PCI configuration space - * @v value Value read - * @ret rc Return status code - */ -static inline __always_inline int -PCIAPI_INLINE ( efi, pci_read_config_byte ) ( struct pci_device *pci, - unsigned int where, - uint8_t *value ) { - return efipci_read ( pci, - EFIPCI_LOCATION ( where, EFIPCI_WIDTH_BYTE ), - value ); -} - -/** - * Read word from PCI configuration space via EFI - * - * @v pci PCI device - * @v where Location within PCI configuration space - * @v value Value read - * @ret rc Return status code - */ -static inline __always_inline int -PCIAPI_INLINE ( efi, pci_read_config_word ) ( struct pci_device *pci, - unsigned int where, - uint16_t *value ) { - return efipci_read ( pci, - EFIPCI_LOCATION ( where, EFIPCI_WIDTH_WORD ), - value ); -} - -/** - * Read dword from PCI configuration space via EFI - * - * @v pci PCI device - * @v where Location within PCI configuration space - * @v value Value read - * @ret rc Return status code - */ -static inline __always_inline int -PCIAPI_INLINE ( efi, pci_read_config_dword ) ( struct pci_device *pci, - unsigned int where, - uint32_t *value ) { - return efipci_read ( pci, - EFIPCI_LOCATION ( where, EFIPCI_WIDTH_DWORD ), - value ); -} - -/** - * Write byte to PCI configuration space via EFI - * - * @v pci PCI device - * @v where Location within PCI configuration space - * @v value Value to be written - * @ret rc Return status code - */ -static inline __always_inline int -PCIAPI_INLINE ( efi, pci_write_config_byte ) ( struct pci_device *pci, - unsigned int where, - uint8_t value ) { - return efipci_write ( pci, - EFIPCI_LOCATION ( where, EFIPCI_WIDTH_BYTE ), - value ); -} - -/** - * Write word to PCI configuration space via EFI - * - * @v pci PCI device - * @v where Location within PCI configuration space - * @v value Value to be written - * @ret rc Return status code - */ -static inline __always_inline int -PCIAPI_INLINE ( efi, pci_write_config_word ) ( struct pci_device *pci, - unsigned int where, - uint16_t value ) { - return efipci_write ( pci, - EFIPCI_LOCATION ( where, EFIPCI_WIDTH_WORD ), - value ); -} - -/** - * Write dword to PCI configuration space via EFI - * - * @v pci PCI device - * @v where Location within PCI configuration space - * @v value Value to be written - * @ret rc Return status code - */ -static inline __always_inline int -PCIAPI_INLINE ( efi, pci_write_config_dword ) ( struct pci_device *pci, - unsigned int where, - uint32_t value ) { - return efipci_write ( pci, - EFIPCI_LOCATION ( where, EFIPCI_WIDTH_DWORD ), - value ); -} - -#endif /* _IPXE_EFI_PCI_H */ diff --git a/src/include/ipxe/efi/efi_pci_api.h b/src/include/ipxe/efi/efi_pci_api.h new file mode 100644 index 000000000..1bc43e303 --- /dev/null +++ b/src/include/ipxe/efi/efi_pci_api.h @@ -0,0 +1,148 @@ +#ifndef _IPXE_EFI_PCI_API_H +#define _IPXE_EFI_PCI_API_H + +/** @file + * + * iPXE PCI I/O API for EFI + * + */ + +FILE_LICENCE ( GPL2_OR_LATER ); + +#ifdef PCIAPI_EFI +#define PCIAPI_PREFIX_efi +#else +#define PCIAPI_PREFIX_efi __efi_ +#endif + +/* EFI PCI width codes defined by EFI spec */ +#define EFIPCI_WIDTH_BYTE 0 +#define EFIPCI_WIDTH_WORD 1 +#define EFIPCI_WIDTH_DWORD 2 + +#define EFIPCI_LOCATION( _offset, _width ) \ + ( (_offset) | ( (_width) << 16 ) ) +#define EFIPCI_OFFSET( _location ) ( (_location) & 0xffff ) +#define EFIPCI_WIDTH( _location ) ( (_location) >> 16 ) + +struct pci_device; + +extern int efipci_read ( struct pci_device *pci, unsigned long location, + void *value ); +extern int efipci_write ( struct pci_device *pci, unsigned long location, + unsigned long value ); + +/** + * Determine number of PCI buses within system + * + * @ret num_bus Number of buses + */ +static inline __always_inline int +PCIAPI_INLINE ( efi, pci_num_bus ) ( void ) { + /* EFI does not want us to scan the PCI bus ourselves */ + return 0; +} + +/** + * Read byte from PCI configuration space via EFI + * + * @v pci PCI device + * @v where Location within PCI configuration space + * @v value Value read + * @ret rc Return status code + */ +static inline __always_inline int +PCIAPI_INLINE ( efi, pci_read_config_byte ) ( struct pci_device *pci, + unsigned int where, + uint8_t *value ) { + return efipci_read ( pci, + EFIPCI_LOCATION ( where, EFIPCI_WIDTH_BYTE ), + value ); +} + +/** + * Read word from PCI configuration space via EFI + * + * @v pci PCI device + * @v where Location within PCI configuration space + * @v value Value read + * @ret rc Return status code + */ +static inline __always_inline int +PCIAPI_INLINE ( efi, pci_read_config_word ) ( struct pci_device *pci, + unsigned int where, + uint16_t *value ) { + return efipci_read ( pci, + EFIPCI_LOCATION ( where, EFIPCI_WIDTH_WORD ), + value ); +} + +/** + * Read dword from PCI configuration space via EFI + * + * @v pci PCI device + * @v where Location within PCI configuration space + * @v value Value read + * @ret rc Return status code + */ +static inline __always_inline int +PCIAPI_INLINE ( efi, pci_read_config_dword ) ( struct pci_device *pci, + unsigned int where, + uint32_t *value ) { + return efipci_read ( pci, + EFIPCI_LOCATION ( where, EFIPCI_WIDTH_DWORD ), + value ); +} + +/** + * Write byte to PCI configuration space via EFI + * + * @v pci PCI device + * @v where Location within PCI configuration space + * @v value Value to be written + * @ret rc Return status code + */ +static inline __always_inline int +PCIAPI_INLINE ( efi, pci_write_config_byte ) ( struct pci_device *pci, + unsigned int where, + uint8_t value ) { + return efipci_write ( pci, + EFIPCI_LOCATION ( where, EFIPCI_WIDTH_BYTE ), + value ); +} + +/** + * Write word to PCI configuration space via EFI + * + * @v pci PCI device + * @v where Location within PCI configuration space + * @v value Value to be written + * @ret rc Return status code + */ +static inline __always_inline int +PCIAPI_INLINE ( efi, pci_write_config_word ) ( struct pci_device *pci, + unsigned int where, + uint16_t value ) { + return efipci_write ( pci, + EFIPCI_LOCATION ( where, EFIPCI_WIDTH_WORD ), + value ); +} + +/** + * Write dword to PCI configuration space via EFI + * + * @v pci PCI device + * @v where Location within PCI configuration space + * @v value Value to be written + * @ret rc Return status code + */ +static inline __always_inline int +PCIAPI_INLINE ( efi, pci_write_config_dword ) ( struct pci_device *pci, + unsigned int where, + uint32_t value ) { + return efipci_write ( pci, + EFIPCI_LOCATION ( where, EFIPCI_WIDTH_DWORD ), + value ); +} + +#endif /* _IPXE_EFI_PCI_API_H */ diff --git a/src/include/ipxe/pci_io.h b/src/include/ipxe/pci_io.h index dab5b7807..7368cf48b 100644 --- a/src/include/ipxe/pci_io.h +++ b/src/include/ipxe/pci_io.h @@ -43,7 +43,7 @@ FILE_LICENCE ( GPL2_OR_LATER ); PROVIDE_SINGLE_API_INLINE ( PCIAPI_PREFIX_ ## _subsys, _api_func ) /* Include all architecture-independent I/O API headers */ -#include +#include /* Include all architecture-dependent I/O API headers */ #include -- cgit