drivers/pci: fix pci framework warning in 32bit chip

In file included from pci/pci.c:30:
pci/pci.c: In function 'pci_setup_device':
pci/pci.c:449:66: warning: right shift count >= width of type [-Wshift-count-overflow]
  449 |           pci_write_config_dword(dev, base_address_1, res->start >> 32);
      |                                                                  ^~
pci/pci.c: In function 'pci_presetup_bridge':
pci/pci.c:541:51: warning: right shift count >= width of type [-Wshift-count-overflow]
  541 |                              ctrl->mem_pref.start >> 32);
      |                                                   ^~
pci/pci.c: In function 'pci_postsetup_bridge':
pci/pci.c:604:57: warning: right shift count >= width of type [-Wshift-count-overflow]
  604 |                              (ctrl->mem_pref.start - 1) >> 32);
      |                                                         ^~
CC:  pthread/pthread_release.c pci/pci_ecam.c:71:12: warning: initialization of 'int (*)(struct pci_bus_s *, unsigned int,  int,  int,  uint32_t *)' {aka 'int (*)(struct pci_bus_s *, unsigned int,  int,  int,  long unsigned int *)'} from incompatible pointer type 'int (*)(struct pci_bus_s *, uint32_t,  int,  int,  uint32_t *)' {aka 'int (*)(struct pci_bus_s *, long unsigned int,  int,  int,  long unsigned int *)'} [-Wincompatible-pointer-types]
   71 |   .read  = pci_ecam_read_config,
      |            ^~~~~~~~~~~~~~~~~~~~
pci/pci_ecam.c:71:12: note: (near initialization for 'g_pci_ecam_ops.read')
pci/pci_ecam.c:72:12: warning: initialization of 'int (*)(struct pci_bus_s *, unsigned int,  int,  int,  uint32_t)' {aka 'int (*)(struct pci_bus_s *, unsigned int,  int,  int,  long unsigned int)'} from incompatible pointer type 'int (*)(struct pci_bus_s *, uint32_t,  int,  int,  uint32_t)' {aka 'int (*)(struct pci_bus_s *, long unsigned int,  int,  int,  long unsigned int)'} [-Wincompatible-pointer-types]
   72 |   .write = pci_ecam_write_config,

Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
This commit is contained in:
Bowen Wang
2024-02-28 17:15:36 +08:00
committed by Xiang Xiao
parent 444a9fbcd6
commit 143466baed
3 changed files with 10 additions and 9 deletions
+4 -4
View File
@@ -60,9 +60,9 @@
* Private Functions Definitions * Private Functions Definitions
****************************************************************************/ ****************************************************************************/
static int x86_64_pci_write(struct pci_bus_s *bus, unsigned int devfn, static int x86_64_pci_write(struct pci_bus_s *bus, uint32_t devfn,
int where, int size, uint32_t val); int where, int size, uint32_t val);
static int x86_64_pci_read(struct pci_bus_s *bus, unsigned int devfn, static int x86_64_pci_read(struct pci_bus_s *bus, uint32_t devfn,
int where, int size, uint32_t *val); int where, int size, uint32_t *val);
static uintptr_t x86_64_pci_map(struct pci_bus_s *bus, uintptr_t start, static uintptr_t x86_64_pci_map(struct pci_bus_s *bus, uintptr_t start,
uintptr_t end); uintptr_t end);
@@ -127,7 +127,7 @@ static struct pci_controller_s g_x86_64_pci =
* *
****************************************************************************/ ****************************************************************************/
static int x86_64_pci_write(struct pci_bus_s *bus, unsigned int devfn, static int x86_64_pci_write(struct pci_bus_s *bus, uint32_t devfn,
int where, int size, uint32_t val) int where, int size, uint32_t val)
{ {
uint8_t offset_mask = (4 - size); uint8_t offset_mask = (4 - size);
@@ -173,7 +173,7 @@ static int x86_64_pci_write(struct pci_bus_s *bus, unsigned int devfn,
* *
****************************************************************************/ ****************************************************************************/
static int x86_64_pci_read(struct pci_bus_s *bus, unsigned int devfn, static int x86_64_pci_read(struct pci_bus_s *bus, uint32_t devfn,
int where, int size, uint32_t *val) int where, int size, uint32_t *val)
{ {
uint8_t offset_mask = 4 - size; uint8_t offset_mask = 4 - size;
+4 -3
View File
@@ -758,7 +758,8 @@ static void pci_setup_device(FAR struct pci_device_s *dev, int max_bar,
pci_write_config_dword(dev, base_address_0, res->start); pci_write_config_dword(dev, base_address_0, res->start);
if (mask & PCI_BASE_ADDRESS_MEM_TYPE_64) if (mask & PCI_BASE_ADDRESS_MEM_TYPE_64)
{ {
pci_write_config_dword(dev, base_address_1, res->start >> 32); pci_write_config_dword(dev, base_address_1,
(uint64_t)res->start >> 32);
} }
start = res->start; start = res->start;
@@ -865,7 +866,7 @@ static void pci_presetup_bridge(FAR struct pci_device_s *dev)
pci_write_config_word(dev, PCI_PREF_MEMORY_BASE, pci_write_config_word(dev, PCI_PREF_MEMORY_BASE,
(ctrl->mem_pref.start & 0xfff00000) >> 16); (ctrl->mem_pref.start & 0xfff00000) >> 16);
pci_write_config_dword(dev, PCI_PREF_BASE_UPPER32, pci_write_config_dword(dev, PCI_PREF_BASE_UPPER32,
ctrl->mem_pref.start >> 32); (uint64_t)ctrl->mem_pref.start >> 32);
cmdstat |= PCI_COMMAND_MEMORY; cmdstat |= PCI_COMMAND_MEMORY;
} }
else else
@@ -929,7 +930,7 @@ static void pci_postsetup_bridge(FAR struct pci_device_s *dev)
pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT, pci_write_config_word(dev, PCI_PREF_MEMORY_LIMIT,
((ctrl->mem_pref.start - 1) & 0xfff00000) >> 16); ((ctrl->mem_pref.start - 1) & 0xfff00000) >> 16);
pci_write_config_dword(dev, PCI_PREF_LIMIT_UPPER32, pci_write_config_dword(dev, PCI_PREF_LIMIT_UPPER32,
(ctrl->mem_pref.start - 1) >> 32); (uint64_t)(ctrl->mem_pref.start - 1) >> 32);
} }
if (pci_resource_size(&ctrl->io)) if (pci_resource_size(&ctrl->io))
+2 -2
View File
@@ -313,9 +313,9 @@ struct pci_bus_s
struct pci_ops_s struct pci_ops_s
{ {
CODE int (*read)(FAR struct pci_bus_s *bus, unsigned int devfn, int where, CODE int (*read)(FAR struct pci_bus_s *bus, uint32_t devfn, int where,
int size, FAR uint32_t *val); int size, FAR uint32_t *val);
CODE int (*write)(FAR struct pci_bus_s *bus, unsigned int devfn, int where, CODE int (*write)(FAR struct pci_bus_s *bus, uint32_t devfn, int where,
int size, uint32_t val); int size, uint32_t val);
/* Return memory address for pci resource */ /* Return memory address for pci resource */