From patchwork Sat Nov 5 02:21:50 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Graeme Russ X-Patchwork-Id: 123798 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 77899B70CA for ; Sat, 5 Nov 2011 13:23:33 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0F3EE289BE; Sat, 5 Nov 2011 03:23:32 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hdQuc5+f6gAA; Sat, 5 Nov 2011 03:23:31 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id F206F29AE0; Sat, 5 Nov 2011 03:22:33 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0814329ACF for ; Sat, 5 Nov 2011 03:22:30 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 9h1RwkjrTPat for ; Sat, 5 Nov 2011 03:22:29 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-gy0-f172.google.com (mail-gy0-f172.google.com [209.85.160.172]) by theia.denx.de (Postfix) with ESMTPS id 0DF0229035 for ; Sat, 5 Nov 2011 03:22:13 +0100 (CET) Received: by gye5 with SMTP id 5so3039296gye.3 for ; Fri, 04 Nov 2011 19:22:11 -0700 (PDT) Received: by 10.42.123.212 with SMTP id t20mr20352535icr.12.1320459731687; Fri, 04 Nov 2011 19:22:11 -0700 (PDT) Received: from localhost.localdomain (d122-104-32-210.sbr6.nsw.optusnet.com.au. [122.104.32.210]) by mx.google.com with ESMTPS id t5sm14414001pbb.13.2011.11.04.19.22.09 (version=SSLv3 cipher=OTHER); Fri, 04 Nov 2011 19:22:11 -0700 (PDT) From: Graeme Russ To: u-boot@lists.denx.de Date: Sat, 5 Nov 2011 13:21:50 +1100 Message-Id: <1320459711-20257-7-git-send-email-graeme.russ@gmail.com> X-Mailer: git-send-email 1.7.5.2.317.g391b14 In-Reply-To: <1320459711-20257-1-git-send-email-graeme.russ@gmail.com> References: <1320459711-20257-1-git-send-email-graeme.russ@gmail.com> Cc: Graeme Russ Subject: [U-Boot] [PATCH v0 6/7] x86: Misc PCI touchups X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Graeme Russ --- arch/x86/cpu/sc520/sc520_pci.c | 4 +--- arch/x86/include/asm/pci.h | 2 +- arch/x86/lib/pci_type1.c | 10 +++++++--- drivers/pci/pci.c | 4 ++-- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/arch/x86/cpu/sc520/sc520_pci.c b/arch/x86/cpu/sc520/sc520_pci.c index e26793a..01b13e9 100644 --- a/arch/x86/cpu/sc520/sc520_pci.c +++ b/arch/x86/cpu/sc520/sc520_pci.c @@ -126,9 +126,7 @@ void pci_sc520_init(struct pci_controller *hose) hose->last_busno = 0xff; hose->region_count = pci_set_regions(hose); - pci_setup_type1(hose, - SC520_REG_ADDR, - SC520_REG_DATA); + pci_setup_type1(hose); pci_register_hose(hose); diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h index 85f60d7..4acd76f 100644 --- a/arch/x86/include/asm/pci.h +++ b/arch/x86/include/asm/pci.h @@ -26,7 +26,7 @@ #ifndef _PCI_I386_H_ #define _PCI_I386_H_ 1 -void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data); +void pci_setup_type1(struct pci_controller* hose); int pci_enable_legacy_video_ports(struct pci_controller* hose); int pci_shadow_rom(pci_dev_t dev, unsigned char *dest); void pci_remove_rom_window(struct pci_controller* hose, u32 addr); diff --git a/arch/x86/lib/pci_type1.c b/arch/x86/lib/pci_type1.c index da1d356..2df4bf8 100644 --- a/arch/x86/lib/pci_type1.c +++ b/arch/x86/lib/pci_type1.c @@ -51,7 +51,11 @@ TYPE1_PCI_OP(write, byte, u8, outb, 3) TYPE1_PCI_OP(write, word, u16, outw, 2) TYPE1_PCI_OP(write, dword, u32, outl, 0) -void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data) +/* bus mapping constants (used for PCI core initialization) */ /* bus mapping constants */ +#define PCI_REG_ADDR 0x00000cf8 +#define PCI_REG_DATA 0x00000cfc + +void pci_setup_type1(struct pci_controller* hose) { pci_set_ops(hose, type1_read_config_byte, @@ -61,6 +65,6 @@ void pci_setup_type1(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data) type1_write_config_word, type1_write_config_dword); - hose->cfg_addr = (unsigned int *) cfg_addr; - hose->cfg_data = (unsigned char *) cfg_data; + hose->cfg_addr = (unsigned int *)PCI_REG_ADDR; + hose->cfg_data = (unsigned char *)PCI_REG_DATA; } diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 5f1f128..7adb0c9 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -280,7 +280,7 @@ int __pci_hose_phys_to_bus (struct pci_controller *hose, bus_addr = phys_addr - res->phys_start + res->bus_start; if (bus_addr >= res->bus_start && - bus_addr < res->bus_start + res->size) { + bus_addr < (res->bus_start + res->size - 1)) { *ba = bus_addr; return 0; } @@ -337,7 +337,7 @@ int __pci_hose_bus_to_phys (struct pci_controller *hose, continue; if (bus_addr >= res->bus_start && - bus_addr < res->bus_start + res->size) { + bus_addr < (res->bus_start + res->size - 1)) { *pa = (bus_addr - res->bus_start + res->phys_start); return 0; }