drivers: fix gcc14 errors for PCI

fix gcc14 errors for PCI

Signed-off-by: p-szafonimateusz <p-szafonimateusz@xiaomi.com>
This commit is contained in:
p-szafonimateusz 2024-09-12 11:00:36 +02:00 committed by Xiang Xiao
parent 60b0f44369
commit 51909ed59f
2 changed files with 171 additions and 2 deletions

View File

@ -2066,15 +2066,84 @@ int pci_dev_register(void)
return register_driver("/dev/pci", &g_pci_fops, 0666, NULL);
}
/****************************************************************************
* Name: pci_bus_read_config_xxx
*
* Description:
* Read pci device config space
*
* Input Parameters:
* bus - The PCI device to belong to
* devfn - The PCI device number and function number
* where - The register address
* val - The data buf
*
* Returned Value:
* Zero if success, otherwise nagative
*
****************************************************************************/
PCI_BUS_READ_CONFIG(byte, uint8_t, 1)
PCI_BUS_READ_CONFIG(word, uint16_t, 2)
PCI_BUS_READ_CONFIG(dword, uint32_t, 4)
/****************************************************************************
* Name: pci_bus_write_config_xxx
*
* Description:
* Write pci device config space
*
* Input Parameters:
* bus - The PCI device to belong to
* devfn - The PCI device number and function number
* where - The register address
* val - The data
*
* Returned Value:
* Zero if success, otherwise nagative
*
****************************************************************************/
PCI_BUS_WRITE_CONFIG(byte, uint8_t, 1)
PCI_BUS_WRITE_CONFIG(word, uint16_t, 2)
PCI_BUS_WRITE_CONFIG(dword, uint32_t, 4)
/****************************************************************************
* Name: pci_bus_read_io_xxx
*
* Description:
* Read pci device io space
*
* Input Parameters:
* bus - The PCI device belong to
* where - The address to read
* val - The data buffer
*
* Returned Value:
* Zero if success, otherwise nagative
*
****************************************************************************/
PCI_BUS_READ_IO(byte, uint8_t, 1)
PCI_BUS_READ_IO(word, uint16_t, 2)
PCI_BUS_READ_IO(dword, uint32_t, 4)
/****************************************************************************
* Name: pci_bus_write_io_xxx
*
* Description:
* Write pci device io space
*
* Input Parameters:
* bus - The PCI device belong to
* where - The address to write
* val - The data
*
* Returned Value:
* Zero if success, otherwise nagative
*
****************************************************************************/
PCI_BUS_WRITE_IO(byte, uint8_t, 1)
PCI_BUS_WRITE_IO(word, uint16_t, 2)
PCI_BUS_WRITE_IO(dword, uint32_t, 4)

View File

@ -359,11 +359,38 @@ int pci_bus_read_config(FAR struct pci_bus_s *bus,
unsigned int devfn, int where,
int size, FAR uint32_t *val);
/****************************************************************************
* Name: pci_bus_read_config_xxx
*
* Description:
* Read pci device config space
*
* Input Parameters:
* bus - The PCI device to belong to
* devfn - The PCI device number and function number
* where - The register address
* val - The data buf
*
* Returned Value:
* Zero if success, otherwise nagative
*
****************************************************************************/
int pci_bus_read_config_byte(FAR struct pci_bus_s *bus,
unsigned int devfn, int where,
FAR uint8_t *val);
int pci_bus_read_config_word(FAR struct pci_bus_s *bus,
unsigned int devfn, int where,
FAR uint16_t *val);
int pci_bus_read_config_dword(FAR struct pci_bus_s *bus,
unsigned int devfn, int where,
FAR uint32_t *val);
/****************************************************************************
* Name: pci_bus_write_config
*
* Description:
* read pci device config space
* Write pci device config space
*
* Input Parameters:
* bus - The PCI device to belong to
@ -381,6 +408,33 @@ int pci_bus_write_config(FAR struct pci_bus_s *bus,
unsigned int devfn, int where,
int size, uint32_t val);
/****************************************************************************
* Name: pci_bus_write_config_xxx
*
* Description:
* Write pci device config space
*
* Input Parameters:
* bus - The PCI device to belong to
* devfn - The PCI device number and function number
* where - The register address
* val - The data
*
* Returned Value:
* Zero if success, otherwise nagative
*
****************************************************************************/
int pci_bus_write_config_byte(FAR struct pci_bus_s *bus,
unsigned int devfn, int where,
uint8_t val);
int pci_bus_write_config_word(FAR struct pci_bus_s *bus,
unsigned int devfn, int where,
uint16_t val);
int pci_bus_write_config_dword(FAR struct pci_bus_s *bus,
unsigned int devfn, int where,
uint32_t val);
/****************************************************************************
* Name: pci_bus_read_io
*
@ -402,13 +456,36 @@ int pci_bus_read_io(FAR struct pci_bus_s *bus, uintptr_t addr,
int size, FAR uint32_t *val);
/****************************************************************************
* Name: pci_bus_write_io
* Name: pci_bus_read_io_xxx
*
* Description:
* Read pci device io space
*
* Input Parameters:
* bus - The PCI device belong to
* where - The address to read
* val - The data buffer
*
* Returned Value:
* Zero if success, otherwise nagative
*
****************************************************************************/
int pci_bus_read_io_byte(FAR struct pci_bus_s *bus, uintptr_t where,
FAR uint8_t *val);
int pci_bus_read_io_word(FAR struct pci_bus_s *bus, uintptr_t where,
FAR uint16_t *val);
int pci_bus_read_io_dword(FAR struct pci_bus_s *bus, uintptr_t where,
FAR uint32_t *val);
/****************************************************************************
* Name: pci_bus_write_io
*
* Description:
* Write pci device io space
*
* Input Parameters:
* bus - The PCI device belong to
* addr - The address to write
* size - The data length
* val - The data
@ -421,6 +498,29 @@ int pci_bus_read_io(FAR struct pci_bus_s *bus, uintptr_t addr,
int pci_bus_write_io(FAR struct pci_bus_s *bus, uintptr_t addr,
int size, uint32_t val);
/****************************************************************************
* Name: pci_bus_write_io_xxx
*
* Description:
* Write pci device io space
*
* Input Parameters:
* bus - The PCI device belong to
* where - The address to write
* val - The data
*
* Returned Value:
* Zero if success, otherwise nagative
*
****************************************************************************/
int pci_bus_write_io_byte(FAR struct pci_bus_s *bus, uintptr_t where,
uint8_t value);
int pci_bus_write_io_word(FAR struct pci_bus_s *bus, uintptr_t where,
uint16_t value);
int pci_bus_write_io_dword(FAR struct pci_bus_s *bus, uintptr_t where,
uint32_t value);
/****************************************************************************
* Name: pci_set_master
*