pci: Allow for PCI addresses to be 64-bit
PATCH 1/1 pci: Allow for PCI addresses to be 64-bit
PCI bus is inherently 64-bit. While not all system require access to the full 64-bit PCI address range some do. This allows those systems to enable the full PCI address width via CONFIG_PCI_64BIT.
--- drivers/pci/pci.c | 4 ++-- drivers/pci/pci_auto.c | 22 +++++++++++----------- include/pci.h | 24 ++++++++++++++++-------- 3 files changed, 29 insertions(+), 21 deletions(-)
drivers/pci/pci.c +2 -2
@@ -223,7 +223,7 @@ unsigned long pci_hose_phys_to_bus (struct pci_controller *hose, unsigned long flags) {struct pci_region *res; -unsigned long bus_addr; +pci_addr_t bus_addr;int i;if (!hose) {
@@ -252,7 +252,7 @@ Done: }phys_addr_t pci_hose_bus_to_phys (struct pci_controller * hose, -unsigned long bus_addr, +pci_addr_t bus_addr,unsigned long flags) {struct pci_region *res;
drivers/pci/pci_auto.c +11 -11
@@ -52,7 +52,7 @@ void pciauto_region_align(struct pci_region *res, unsigned long size)int pciauto_region_allocate (struct pci_region * res,unsigned int size,unsigned int *bar) { -unsigned long addr; +pci_addr_t addr;if (!res) {DEBUGF ("No resource" );
@@ -68,7 +68,7 @@ int pciauto_region_allocate(struct pci_region* res, unsigned int size, unsigned res->bus_lower = addr + size; -DEBUGF ("address=0x%lx bus_lower=%x" , addr, res->bus_lower); +DEBUGF ("address=0x%llx bus_lower=%llx" , (u64 )addr, (u64 )res->bus_lower); *bar = addr;return 0 ;
@@ -289,10 +289,10 @@ void pciauto_config_init(struct pci_controller *hose)if (hose->pci_mem) {pciauto_region_init (hose->pci_mem); -DEBUGF ("PCI Autoconfig: Bus Memory region: [%lx-%lx],\n" +DEBUGF ("PCI Autoconfig: Bus Memory region: [%llx-%llx],\n" "\t\tPhysical Memory [%x-%x]\n" , - hose->pci_mem->bus_start, - hose->pci_mem->bus_start + hose->pci_mem->size -1 , + (u64 )hose->pci_mem->bus_start, + (u64)(hose->pci_mem->bus_start + hose->pci_mem->size -1 ), hose->pci_mem->phys_start, hose->pci_mem->phys_start + hose->pci_mem->size -1 ); }
@@ -300,10 +300,10 @@ void pciauto_config_init(struct pci_controller *hose)if (hose->pci_prefetch) {pciauto_region_init (hose->pci_prefetch); -DEBUGF ("PCI Autoconfig: Bus Prefetchable Mem: [%lx-%lx],\n" +DEBUGF ("PCI Autoconfig: Bus Prefetchable Mem: [%llx-%llx],\n" "\t\tPhysical Memory [%x-%x]\n" , - hose->pci_prefetch->bus_start, - hose->pci_prefetch->bus_start + hose->pci_prefetch->size -1 , + (u64 )hose->pci_prefetch->bus_start, + (u64)(hose->pci_prefetch->bus_start + hose->pci_prefetch->size -1 ), hose->pci_prefetch->phys_start, hose->pci_prefetch->phys_start + hose->pci_prefetch->size -1 );
@@ -312,10 +312,10 @@ void pciauto_config_init(struct pci_controller *hose)if (hose->pci_io) {pciauto_region_init (hose->pci_io); -DEBUGF ("PCI Autoconfig: Bus I/O region: [%lx-%lx],\n" +DEBUGF ("PCI Autoconfig: Bus I/O region: [%llx-%llx],\n" "\t\tPhysical Memory: [%x-%x]\n" , - hose->pci_io->bus_start, - hose->pci_io->bus_start + hose->pci_io->size -1 , + (u64 )hose->pci_io->bus_start, + (u64)(hose->pci_io->bus_start + hose->pci_io->size -1 ), hose->pci_io->phys_start, hose->pci_io->phys_start + hose->pci_io->size -1 );
include/pci.h +16 -8
@@ -312,13 +312,21 @@#include <pci_ids.h> +#ifdef CONFIG_PCI_64BIT +typedef u64 pci_addr_t ; +typedef u64 pci_size_t ; +#else +typedef u32 pci_addr_t ; +typedef u32 pci_size_t ; +#endif +struct pci_region { -unsigned long bus_start;/* Start on the bus */ -phys_addr_t phys_start;/* Start in physical address space */ -unsigned long size;/* Size */ -unsigned long flags;/* Resource flags */ +pci_addr_t bus_start;/* Start on the bus */ +phys_addr_t phys_start;/* Start in physical address space */ +pci_size_t size;/* Size */ +unsigned long flags;/* Resource flags */ -unsigned long bus_lower; +pci_addr_t bus_lower; };#define PCI_REGION_MEM 0x00000000/* PCI memory space */
@@ -330,9 +338,9 @@ struct pci_region {#define PCI_REGION_RO 0x00000200/* Read-only memory */ extern __inline__void pci_set_region (struct pci_region *reg, -unsigned long bus_start, +pci_addr_t bus_start,phys_addr_t phys_start, -unsigned long size, +pci_size_t size,unsigned long flags) { reg->bus_start = bus_start; reg->phys_start = phys_start;
@@ -433,7 +441,7 @@ extern __inline__ void pci_set_ops(struct pci_controller *hose,extern void pci_setup_indirect (struct pci_controller * hose,u32 cfg_addr,u32 cfg_data);extern phys_addr_t pci_hose_bus_to_phys (struct pci_controller * hose, -unsigned long addr,unsigned long flags); +pci_addr_t addr,unsigned long flags);extern unsigned long pci_hose_phys_to_bus (struct pci_controller * hose,phys_addr_t addr,unsigned long flags);
Signature · 1 line
1.5.5.1
PATCH 1/1 pci: Allow for PCI addresses to be 64-bit
Dear Kumar Gala,
Quoted 5 lines · In message <[email protected]> you…
PCI bus is inherently 64-bit. While not all system require access to the full 64-bit PCI address range some do. This allows those systems to enable the full PCI address width via
CONFIG_PCI_64BIT.Signed-off-by Kumar Gala <[email protected]>
Mostly an ACK, except one tiny detail...
include/pci.h line 315
Quoted 7 lines
include/pci.h +1
-0@@ -312,13 +312,21 @@#include <pci_ids.h> +#ifdef CONFIG_PCI_64BIT
I think we should make this "CONFIG_SYS_PCI_64BIT" instead.
This is really a low-level config option where the end user is not supposed to mess with.
Best regards,
Wolfgang Denk
Signature · 6 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de THIS IS A 100% MATTER PRODUCT: In the Unlikely Event That This Merchandise Should Contact Antimatter in Any Form, a Catastrophic Explosion Will Result.
PATCH 1/1 pci: Allow for PCI addresses to be 64-bit
Quoted 16 lines · Wolfgang Denk
Dear Kumar Gala,
In message <[email protected]
Quoted 6 lines
you wrote:
PCI bus is inherently 64-bit. While not all system require access to the full 64-bit PCI address range some do. This allows those systems to enable the full PCI address width viaCONFIG_PCI_64BIT.Signed-off-by Kumar Gala <[email protected]>Mostly an ACK, except one tiny detail...
Quoted 4 lines
include/pci.h +0
-0@@ -312,13 +312,21 @@
Quoted 8 lines
include/pci.h line 315
Quoted 3 lines
include/pci.h +1
-0#include <pci_ids.h> +#ifdef CONFIG_PCI_64BIT I think we should make this "
CONFIG_SYS_PCI_64BIT" instead.This is really a low-level config option where the end user is not supposed to mess with.
ok. will make the change and repost.
- k