j
: Next unread message k
: Previous unread message j a
: Jump to all threads
j l
: Jump to MailingList overview
Author: mcayland Date: Mon Sep 2 15:46:01 2013 New Revision: 1226 URL: http://tracker.coreboot.org/trac/openbios/changeset/1226
Log: PCI: switch calculation of host PCI memory base to use an offset
Instead of using two different variables to track the absolute values of the PCI memory base and the host memory base, change the host memory base to be an offset which is added to the PCI memory base during conversion. As a consequence of this, the code in pci_bus_addr_to_host_addr() can be unified to be consistent across all architectures.
Note that this commit also renames arch->host_mem_base to arch->host_pci_base in order to better describe its function.
Signed-off-by: Mark Cave-Ayland mark.cave-ayland@ilande.co.uk
Modified: trunk/openbios-devel/arch/ppc/qemu/init.c trunk/openbios-devel/arch/sparc64/openbios.c trunk/openbios-devel/drivers/pci.c trunk/openbios-devel/include/drivers/pci.h
Modified: trunk/openbios-devel/arch/ppc/qemu/init.c ============================================================================== --- trunk/openbios-devel/arch/ppc/qemu/init.c Mon Sep 2 15:45:56 2013 (r1225) +++ trunk/openbios-devel/arch/ppc/qemu/init.c Mon Sep 2 15:46:01 2013 (r1226) @@ -99,7 +99,7 @@ .cfg_data = 0x800c0000, .cfg_base = 0x80000000, .cfg_len = 0x00100000, - .host_mem_base = 0xf0000000, + .host_pci_base = 0x0, .pci_mem_base = 0xf0000000, .mem_len = 0x10000000, .io_base = 0x80000000, @@ -116,7 +116,7 @@ .cfg_data = 0xf2c00000, .cfg_base = 0xf2000000, .cfg_len = 0x02000000, - .host_mem_base = 0x80000000, + .host_pci_base = 0x0, .pci_mem_base = 0x80000000, .mem_len = 0x10000000, .io_base = 0xf2000000, @@ -133,7 +133,7 @@ .cfg_data = 0xf0c00000, .cfg_base = 0xf0000000, .cfg_len = 0x02000000, - .host_mem_base = 0x80000000, + .host_pci_base = 0x0, .pci_mem_base = 0x80000000, .mem_len = 0x10000000, .io_base = 0xf2000000, @@ -150,7 +150,7 @@ .cfg_data = 0xfee00000, .cfg_base = 0x80000000, .cfg_len = 0x7f000000, - .host_mem_base = 0x80000000, + .host_pci_base = 0x0, .pci_mem_base = 0x80000000, .mem_len = 0x10000000, .io_base = 0xfe000000,
Modified: trunk/openbios-devel/arch/sparc64/openbios.c ============================================================================== --- trunk/openbios-devel/arch/sparc64/openbios.c Mon Sep 2 15:45:56 2013 (r1225) +++ trunk/openbios-devel/arch/sparc64/openbios.c Mon Sep 2 15:46:01 2013 (r1226) @@ -59,7 +59,7 @@ .cfg_data = APB_MEM_BASE, // PCI bus memory space .cfg_base = APB_SPECIAL_BASE, .cfg_len = 0x2000000, - .host_mem_base = APB_MEM_BASE, + .host_pci_base = APB_MEM_BASE, .pci_mem_base = 0x100000, /* avoid VGA at 0xa0000 */ .mem_len = 0x10000000, .io_base = APB_SPECIAL_BASE + 0x2000000ULL, // PCI Bus I/O space
Modified: trunk/openbios-devel/drivers/pci.c ============================================================================== --- trunk/openbios-devel/drivers/pci.c Mon Sep 2 15:45:56 2013 (r1225) +++ trunk/openbios-devel/drivers/pci.c Mon Sep 2 15:46:01 2013 (r1226) @@ -143,11 +143,7 @@
static unsigned long pci_bus_addr_to_host_addr(uint32_t ba) { -#ifdef CONFIG_SPARC64 - return arch->cfg_data + (unsigned long)ba; -#else - return (unsigned long)ba; -#endif + return arch->host_pci_base + (unsigned long)ba; }
static void @@ -525,11 +521,12 @@ ncells += host_encode_phys_addr(props + ncells, arch->rbase); ncells += pci_encode_size(props + ncells, arch->rlen); } - if (arch->host_mem_base) { + if (arch->pci_mem_base) { ncells += pci_encode_phys_addr(props + ncells, 0, MEMORY_SPACE_32, config->dev, 0, arch->pci_mem_base); - ncells += host_encode_phys_addr(props + ncells, arch->host_mem_base); - ncells += pci_encode_size(props + ncells, arch->mem_len); + ncells += host_encode_phys_addr(props + ncells, arch->host_pci_base + + arch->pci_mem_base); + ncells += pci_encode_size(props + ncells, arch->mem_len); } set_property(dev, "ranges", (char *)props, ncells * sizeof(props[0])); }
Modified: trunk/openbios-devel/include/drivers/pci.h ============================================================================== --- trunk/openbios-devel/include/drivers/pci.h Mon Sep 2 15:45:56 2013 (r1225) +++ trunk/openbios-devel/include/drivers/pci.h Mon Sep 2 15:46:01 2013 (r1226) @@ -13,7 +13,7 @@ unsigned long cfg_data; unsigned long cfg_base; unsigned long cfg_len; - unsigned long host_mem_base; /* in host memory space */ + unsigned long host_pci_base; /* offset of PCI memory space within host memory space */ unsigned long pci_mem_base; /* in PCI memory space */ unsigned long mem_len; unsigned long io_base;