pci_io.h

Go to the documentation of this file.
00001 #ifndef _GPXE_PCI_IO_H
00002 #define _GPXE_PCI_IO_H
00003 
00004 /** @file
00005  *
00006  * PCI I/O API
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER );
00011 
00012 #include <stdint.h>
00013 #include <gpxe/api.h>
00014 #include <config/ioapi.h>
00015 
00016 /**
00017  * Calculate static inline PCI I/O API function name
00018  *
00019  * @v _prefix           Subsystem prefix
00020  * @v _api_func         API function
00021  * @ret _subsys_func    Subsystem API function
00022  */
00023 #define PCIAPI_INLINE( _subsys, _api_func ) \
00024         SINGLE_API_INLINE ( PCIAPI_PREFIX_ ## _subsys, _api_func )
00025 
00026 /**
00027  * Provide a PCI I/O API implementation
00028  *
00029  * @v _prefix           Subsystem prefix
00030  * @v _api_func         API function
00031  * @v _func             Implementing function
00032  */
00033 #define PROVIDE_PCIAPI( _subsys, _api_func, _func ) \
00034         PROVIDE_SINGLE_API ( PCIAPI_PREFIX_ ## _subsys, _api_func, _func )
00035 
00036 /**
00037  * Provide a static inline PCI I/O API implementation
00038  *
00039  * @v _prefix           Subsystem prefix
00040  * @v _api_func         API function
00041  */
00042 #define PROVIDE_PCIAPI_INLINE( _subsys, _api_func ) \
00043         PROVIDE_SINGLE_API_INLINE ( PCIAPI_PREFIX_ ## _subsys, _api_func )
00044 
00045 /* Include all architecture-independent I/O API headers */
00046 #include <gpxe/efi/efi_pci.h>
00047 
00048 /* Include all architecture-dependent I/O API headers */
00049 #include <bits/pci_io.h>
00050 
00051 /**
00052  * Determine maximum PCI bus number within system
00053  *
00054  * @ret max_bus         Maximum bus number
00055  */
00056 int pci_max_bus ( void );
00057 
00058 /**
00059  * Read byte from PCI configuration space
00060  *
00061  * @v pci       PCI device
00062  * @v where     Location within PCI configuration space
00063  * @v value     Value read
00064  * @ret rc      Return status code
00065  */
00066 int pci_read_config_byte ( struct pci_device *pci, unsigned int where,
00067                            uint8_t *value );
00068 
00069 /**
00070  * Read 16-bit word from PCI configuration space
00071  *
00072  * @v pci       PCI device
00073  * @v where     Location within PCI configuration space
00074  * @v value     Value read
00075  * @ret rc      Return status code
00076  */
00077 int pci_read_config_word ( struct pci_device *pci, unsigned int where,
00078                            uint16_t *value );
00079 
00080 /**
00081  * Read 32-bit dword from PCI configuration space
00082  *
00083  * @v pci       PCI device
00084  * @v where     Location within PCI configuration space
00085  * @v value     Value read
00086  * @ret rc      Return status code
00087  */
00088 int pci_read_config_dword ( struct pci_device *pci, unsigned int where,
00089                             uint32_t *value );
00090 
00091 /**
00092  * Write byte to PCI configuration space
00093  *
00094  * @v pci       PCI device
00095  * @v where     Location within PCI configuration space
00096  * @v value     Value to be written
00097  * @ret rc      Return status code
00098  */
00099 int pci_write_config_byte ( struct pci_device *pci, unsigned int where,
00100                             uint8_t value );
00101 
00102 /**
00103  * Write 16-bit word to PCI configuration space
00104  *
00105  * @v pci       PCI device
00106  * @v where     Location within PCI configuration space
00107  * @v value     Value to be written
00108  * @ret rc      Return status code
00109  */
00110 int pci_write_config_word ( struct pci_device *pci, unsigned int where,
00111                             uint16_t value );
00112 
00113 /**
00114  * Write 32-bit dword to PCI configuration space
00115  *
00116  * @v pci       PCI device
00117  * @v where     Location within PCI configuration space
00118  * @v value     Value to be written
00119  * @ret rc      Return status code
00120  */
00121 int pci_write_config_dword ( struct pci_device *pci, unsigned int where,
00122                              uint32_t value );
00123 
00124 #endif /* _GPXE_PCI_IO_H */

Generated on Tue Apr 6 20:01:08 2010 for gPXE by  doxygen 1.5.7.1