From b5166cc252190be80465f3b4f050e4a0310f71af Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Tue, 15 Nov 2005 16:05:33 +1100 Subject: [PATCH] powerpc: pci_64 fixes & cleanups I discovered that in some cases (PowerMac for example) we wouldn't properly map the PCI IO space on recent kernels. In addition, the code for initializing PCI host bridges was scattered all over the place with some duplication between platforms. This patch fixes the problem and does a small cleanup by creating a pcibios_alloc_controller() in pci_64.c that is similar to the one in pci_32.c (just takes an additional device node argument) that takes care of all the grunt allocation and initialisation work. It should work for both boot time and dynamically allocated PHBs. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- include/asm-powerpc/ppc-pci.h | 1 - include/asm-ppc64/pci-bridge.h | 14 ++++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/ppc-pci.h b/include/asm-powerpc/ppc-pci.h index 9896fade98a7..2e36e5a7f4f3 100644 --- a/include/asm-powerpc/ppc-pci.h +++ b/include/asm-powerpc/ppc-pci.h @@ -14,7 +14,6 @@ extern unsigned long isa_io_base; -extern void pci_setup_pci_controller(struct pci_controller *hose); extern void pci_setup_phb_io(struct pci_controller *hose, int primary); extern void pci_setup_phb_io_dynamic(struct pci_controller *hose, int primary); diff --git a/include/asm-ppc64/pci-bridge.h b/include/asm-ppc64/pci-bridge.h index efbdaece0cf0..cf04327a597a 100644 --- a/include/asm-ppc64/pci-bridge.h +++ b/include/asm-ppc64/pci-bridge.h @@ -61,12 +61,14 @@ struct pci_dn { int busno; /* for pci devices */ int bussubno; /* for pci devices */ int devfn; /* for pci devices */ + +#ifdef CONFIG_PPC_PSERIES int eeh_mode; /* See eeh.h for possible EEH_MODEs */ int eeh_config_addr; int eeh_check_count; /* # times driver ignored error */ int eeh_freeze_count; /* # times this device froze up. */ int eeh_is_bridge; /* device is pci-to-pci bridge */ - +#endif int pci_ext_config_space; /* for pci devices */ struct pci_controller *phb; /* for pci devices */ struct iommu_table *iommu_table; /* for phb's or bridges */ @@ -74,9 +76,9 @@ struct pci_dn { struct device_node *node; /* back-pointer to the device_node */ #ifdef CONFIG_PPC_ISERIES struct list_head Device_List; - int Irq; /* Assigned IRQ */ - int Flags; /* Possible flags(disable/bist)*/ - u8 LogicalSlot; /* Hv Slot Index for Tces */ + int Irq; /* Assigned IRQ */ + int Flags; /* Possible flags(disable/bist)*/ + u8 LogicalSlot; /* Hv Slot Index for Tces */ #endif u32 config_space[16]; /* saved PCI config space */ }; @@ -136,6 +138,10 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus) return PCI_DN(busdn)->phb; } +extern struct pci_controller * +pcibios_alloc_controller(struct device_node *dev); +extern void pcibios_free_controller(struct pci_controller *phb); + /* Return values for ppc_md.pci_probe_mode function */ #define PCI_PROBE_NONE -1 /* Don't look at this bus at all */ #define PCI_PROBE_NORMAL 0 /* Do normal PCI probing */ -- cgit v1.2.3-59-g8ed1b From 7486a38f683d49e6f8b2b9050ff06778b151a40c Mon Sep 17 00:00:00 2001 From: Kumar Gala Date: Tue, 15 Nov 2005 11:03:24 -0600 Subject: [PATCH] powerpc: replace page_to_virt() with lowmem_page_address() for Book-E page_to_virt and lowmem_page_address provided equiavlent functionality so use the more standard lowmem_page_address This also addresses build issue in ARCH=powerpc since page_to_virt() has been removed from include/asm-powerpc/page.h Signed-off-by: Kumar Gala Signed-off-by: Paul Mackerras --- include/asm-ppc/pgalloc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-ppc/pgalloc.h b/include/asm-ppc/pgalloc.h index 931b6de7ef53..bdefd1c4a558 100644 --- a/include/asm-ppc/pgalloc.h +++ b/include/asm-ppc/pgalloc.h @@ -28,7 +28,7 @@ extern void pgd_free(pgd_t *pgd); #define pmd_populate_kernel(mm, pmd, pte) \ (pmd_val(*(pmd)) = (unsigned long)pte | _PMD_PRESENT) #define pmd_populate(mm, pmd, pte) \ - (pmd_val(*(pmd)) = (unsigned long)page_to_virt(pte) | _PMD_PRESENT) + (pmd_val(*(pmd)) = (unsigned long)lowmem_page_address(pte) | _PMD_PRESENT) #endif extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr); -- cgit v1.2.3-59-g8ed1b From 5d66da3d71e6aeca80ca08dbebd8a1cd72e6ee1f Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Wed, 16 Nov 2005 13:54:32 +1100 Subject: [PATCH] powerpc: Make the vDSO functions set error code (#2) The vDSO functions should have the same calling convention as a syscall. Unfortunately, they currently don't set the cr0.so bit which is used to indicate an error. This patch makes them clear this bit unconditionally since all functions currently succeed. The syscall fallback done by some of them will eventually override this if the syscall fails. This also changes the symbol version of all vdso exports to make sure glibc can differenciate between old and fixed calls for existing ones like __kernel_gettimeofday. Signed-off-by: Benjamin Herrenschmidt Signed-off-by: Paul Mackerras --- arch/powerpc/kernel/vdso32/cacheflush.S | 2 ++ arch/powerpc/kernel/vdso32/datapage.S | 3 ++- arch/powerpc/kernel/vdso32/gettimeofday.S | 4 ++++ arch/powerpc/kernel/vdso64/cacheflush.S | 2 ++ arch/powerpc/kernel/vdso64/datapage.S | 3 ++- arch/powerpc/kernel/vdso64/gettimeofday.S | 4 ++++ include/asm-powerpc/vdso.h | 2 +- 7 files changed, 17 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/arch/powerpc/kernel/vdso32/cacheflush.S b/arch/powerpc/kernel/vdso32/cacheflush.S index c8db993574ee..09629aea3e47 100644 --- a/arch/powerpc/kernel/vdso32/cacheflush.S +++ b/arch/powerpc/kernel/vdso32/cacheflush.S @@ -35,6 +35,7 @@ V_FUNCTION_BEGIN(__kernel_sync_dicache) subf r8,r6,r4 /* compute length */ add r8,r8,r5 /* ensure we get enough */ srwi. r8,r8,7 /* compute line count */ + crclr cr0*4+so beqlr /* nothing to do? */ mtctr r8 mr r3,r6 @@ -58,6 +59,7 @@ V_FUNCTION_END(__kernel_sync_dicache) */ V_FUNCTION_BEGIN(__kernel_sync_dicache_p5) .cfi_startproc + crclr cr0*4+so sync isync li r3,0 diff --git a/arch/powerpc/kernel/vdso32/datapage.S b/arch/powerpc/kernel/vdso32/datapage.S index f6b38472318d..4709f1d9542c 100644 --- a/arch/powerpc/kernel/vdso32/datapage.S +++ b/arch/powerpc/kernel/vdso32/datapage.S @@ -54,7 +54,6 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map) .cfi_startproc mflr r12 .cfi_register lr,r12 - mr r4,r3 bl __get_datapage@local mtlr r12 @@ -63,6 +62,7 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map) beqlr li r0,__NR_syscalls stw r0,0(r4) + crclr cr0*4+so blr .cfi_endproc V_FUNCTION_END(__kernel_get_syscall_map) @@ -80,6 +80,7 @@ V_FUNCTION_BEGIN(__kernel_get_tbfreq) lwz r4,(CFG_TB_TICKS_PER_SEC + 4)(r3) lwz r3,CFG_TB_TICKS_PER_SEC(r3) mtlr r12 + crclr cr0*4+so blr .cfi_endproc V_FUNCTION_END(__kernel_get_tbfreq) diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S index 0a32a41d50b0..7eebff03a041 100644 --- a/arch/powerpc/kernel/vdso32/gettimeofday.S +++ b/arch/powerpc/kernel/vdso32/gettimeofday.S @@ -59,6 +59,7 @@ V_FUNCTION_BEGIN(__kernel_gettimeofday) stw r5,TZONE_TZ_DSTTIME(r11) 1: mtlr r12 + crclr cr0*4+so li r3,0 blr @@ -117,6 +118,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime) mulli r5,r5,1000 stw r5,TSPC32_TV_NSEC(r11) mtlr r12 + crclr cr0*4+so li r3,0 blr @@ -185,6 +187,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime) stw r4,TSPC32_TV_NSEC(r11) mtlr r12 + crclr cr0*4+so li r3,0 blr @@ -219,6 +222,7 @@ V_FUNCTION_BEGIN(__kernel_clock_getres) li r3,0 cmpli cr0,r4,0 + crclr cr0*4+so beqlr lis r5,CLOCK_REALTIME_RES@h ori r5,r5,CLOCK_REALTIME_RES@l diff --git a/arch/powerpc/kernel/vdso64/cacheflush.S b/arch/powerpc/kernel/vdso64/cacheflush.S index d4a0ad28d534..cb4ae0a5edd0 100644 --- a/arch/powerpc/kernel/vdso64/cacheflush.S +++ b/arch/powerpc/kernel/vdso64/cacheflush.S @@ -35,6 +35,7 @@ V_FUNCTION_BEGIN(__kernel_sync_dicache) subf r8,r6,r4 /* compute length */ add r8,r8,r5 /* ensure we get enough */ srwi. r8,r8,7 /* compute line count */ + crclr cr0*4+so beqlr /* nothing to do? */ mtctr r8 mr r3,r6 @@ -58,6 +59,7 @@ V_FUNCTION_END(__kernel_sync_dicache) */ V_FUNCTION_BEGIN(__kernel_sync_dicache_p5) .cfi_startproc + crclr cr0*4+so sync isync li r3,0 diff --git a/arch/powerpc/kernel/vdso64/datapage.S b/arch/powerpc/kernel/vdso64/datapage.S index 6393e4137bc7..3b2dd7d0c1eb 100644 --- a/arch/powerpc/kernel/vdso64/datapage.S +++ b/arch/powerpc/kernel/vdso64/datapage.S @@ -54,12 +54,12 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map) .cfi_startproc mflr r12 .cfi_register lr,r12 - mr r4,r3 bl V_LOCAL_FUNC(__get_datapage) mtlr r12 addi r3,r3,CFG_SYSCALL_MAP64 cmpli cr0,r4,0 + crclr cr0*4+so beqlr li r0,__NR_syscalls stw r0,0(r4) @@ -80,6 +80,7 @@ V_FUNCTION_BEGIN(__kernel_get_tbfreq) bl V_LOCAL_FUNC(__get_datapage) ld r3,CFG_TB_TICKS_PER_SEC(r3) mtlr r12 + crclr cr0*4+so blr .cfi_endproc V_FUNCTION_END(__kernel_get_tbfreq) diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S index 1a89094715cc..ccaeda5136d1 100644 --- a/arch/powerpc/kernel/vdso64/gettimeofday.S +++ b/arch/powerpc/kernel/vdso64/gettimeofday.S @@ -52,6 +52,7 @@ V_FUNCTION_BEGIN(__kernel_gettimeofday) stw r4,TZONE_TZ_MINWEST(r10) stw r5,TZONE_TZ_DSTTIME(r10) 1: mtlr r12 + crclr cr0*4+so li r3,0 /* always success */ blr .cfi_endproc @@ -99,6 +100,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime) std r0,TSPC64_TV_NSEC(r11) /* store nsec in tp */ mtlr r12 + crclr cr0*4+so li r3,0 blr @@ -159,6 +161,7 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime) std r7,TSPC64_TV_NSEC(r11) mtlr r12 + crclr cr0*4+so li r3,0 blr @@ -193,6 +196,7 @@ V_FUNCTION_BEGIN(__kernel_clock_getres) li r3,0 cmpli cr0,r4,0 + crclr cr0*4+so beqlr lis r5,CLOCK_REALTIME_RES@h ori r5,r5,CLOCK_REALTIME_RES@l diff --git a/include/asm-powerpc/vdso.h b/include/asm-powerpc/vdso.h index 85d8a7be25c4..b9f9118b1607 100644 --- a/include/asm-powerpc/vdso.h +++ b/include/asm-powerpc/vdso.h @@ -11,7 +11,7 @@ #define VDSO32_MBASE VDSO32_LBASE #define VDSO64_MBASE VDSO64_LBASE -#define VDSO_VERSION_STRING LINUX_2.6.12 +#define VDSO_VERSION_STRING LINUX_2.6.15 /* Define if 64 bits VDSO has procedure descriptors */ #undef VDS64_HAS_DESCRIPTORS -- cgit v1.2.3-59-g8ed1b