From 0ce928e1b2ad4309fae6c4324b9e9e433fbf62a2 Mon Sep 17 00:00:00 2001 From: Vitaly Bordug Date: Sun, 15 Jan 2006 17:30:29 +0300 Subject: [PATCH] ppc32 8xx: Added setbitsXX/clrbitsXX macro for read-modify-write operations This adds setbitsXX/clrbitsXX macro for read-modify-write operations and converts the 8xx core and drivers to use them. Signed-off-by: Vitaly Bordug Signed-off-by: Marcelo Tosatti Signed-off-by: Paul Mackerras --- include/asm-ppc/io.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/asm-ppc/io.h b/include/asm-ppc/io.h index df9cf6ed189..b919d8fb7d9 100644 --- a/include/asm-ppc/io.h +++ b/include/asm-ppc/io.h @@ -575,4 +575,11 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *); */ #define xlate_dev_kmem_ptr(p) p +/* access ports */ +#define setbits32(_addr, _v) out_be32((_addr), in_be32(_addr) | (_v)) +#define clrbits32(_addr, _v) out_be32((_addr), in_be32(_addr) & ~(_v)) + +#define setbits16(_addr, _v) out_be16((_addr), in_be16(_addr) | (_v)) +#define clrbits16(_addr, _v) out_be16((_addr), in_be16(_addr) & ~(_v)) + #endif /* __KERNEL__ */ -- cgit v1.2.3 From 0ec57e53c945fe962b190953f61e1ffd127e68d3 Mon Sep 17 00:00:00 2001 From: Marcelo Tosatti Date: Tue, 17 Jan 2006 00:24:42 -0200 Subject: [PATCH] powerpc: generalize PPC44x_PIN_SIZE The following patch generalizes PPC44x_PIN_SIZE by changing it to PPC_PIN_SIZE, which can be defined by any sub-arch to automatically adjust VMALLOC_START. Define PPC_PIN_SIZE on 8xx, avoiding potential conflicts with the pinned space. Signed-off-by: Marcelo Tosatti Signed-off-by: Paul Mackerras --- include/asm-ppc/ibm44x.h | 2 +- include/asm-ppc/mpc8xx.h | 2 ++ include/asm-ppc/pgtable.h | 6 +++--- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/asm-ppc/ibm44x.h b/include/asm-ppc/ibm44x.h index f835066fb3c..3acc382cc83 100644 --- a/include/asm-ppc/ibm44x.h +++ b/include/asm-ppc/ibm44x.h @@ -29,7 +29,7 @@ /* TLB entry offset/size used for pinning kernel lowmem */ #define PPC44x_PIN_SHIFT 28 -#define PPC44x_PIN_SIZE (1 << PPC44x_PIN_SHIFT) +#define PPC_PIN_SIZE (1 << PPC44x_PIN_SHIFT) /* Lowest TLB slot consumed by the default pinned TLBs */ #define PPC44x_LOW_SLOT 63 diff --git a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h index 46f159cf589..73ec9a6db0b 100644 --- a/include/asm-ppc/mpc8xx.h +++ b/include/asm-ppc/mpc8xx.h @@ -113,6 +113,8 @@ enum ppc_sys_devices { MPC8xx_CPM_USB, }; +#define PPC_PIN_SIZE (24 * 1024 * 1024) /* 24Mbytes of data pinned */ + #ifndef BOARD_CHIP_NAME #define BOARD_CHIP_NAME "" #endif diff --git a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h index 6d1c39e8a6a..e1c62da12e7 100644 --- a/include/asm-ppc/pgtable.h +++ b/include/asm-ppc/pgtable.h @@ -12,6 +12,7 @@ #include /* For TASK_SIZE */ #include #include +#include /* For sub-arch specific PPC_PIN_SIZE */ struct mm_struct; extern unsigned long va_to_phys(unsigned long address); @@ -127,9 +128,8 @@ extern unsigned long ioremap_bot, ioremap_base; * of RAM. -- Cort */ #define VMALLOC_OFFSET (0x1000000) /* 16M */ -#ifdef CONFIG_44x -#include -#define VMALLOC_START (((_ALIGN((long)high_memory, PPC44x_PIN_SIZE) + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))) +#ifdef PPC_PIN_SIZE +#define VMALLOC_START (((_ALIGN((long)high_memory, PPC_PIN_SIZE) + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))) #else #define VMALLOC_START ((((long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))) #endif -- cgit v1.2.3 From b4367e7451f19a3ae8b453e8b7ac0a1fdd9bca04 Mon Sep 17 00:00:00 2001 From: "Grant C. Likely" Date: Thu, 19 Jan 2006 01:12:32 -0700 Subject: [PATCH] powerpc: Move xparameters.h into xilinx virtex device specific path xparameters should not be needed by anything but virtex platform code. Move it from include/asm-ppc/ to platforms/4xx/xparameters/ This is preparing for work to remove xparameters from the dependancy tree for most c files. xparam changes should not cause a recompile of the world. Instead, drivers should get device info from the platform bus (populated by the boot code) Signed-off-by: Grant C. Likely Signed-off-by: Paul Mackerras --- include/asm-ppc/xparameters.h | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 include/asm-ppc/xparameters.h (limited to 'include') diff --git a/include/asm-ppc/xparameters.h b/include/asm-ppc/xparameters.h deleted file mode 100644 index fe4eac62913..00000000000 --- a/include/asm-ppc/xparameters.h +++ /dev/null @@ -1,18 +0,0 @@ -/* - * include/asm-ppc/xparameters.h - * - * This file includes the correct xparameters.h for the CONFIG'ed board - * - * Author: MontaVista Software, Inc. - * source@mvista.com - * - * 2004 (c) MontaVista Software, Inc. This file is licensed under the terms - * of the GNU General Public License version 2. This program is licensed - * "as is" without any warranty of any kind, whether express or implied. - */ - -#include - -#if defined(CONFIG_XILINX_ML300) -#include -#endif -- cgit v1.2.3 From 1a42e53d175074f340a3f85042ed64cfc51be216 Mon Sep 17 00:00:00 2001 From: "Grant C. Likely" Date: Thu, 19 Jan 2006 01:12:48 -0700 Subject: [PATCH] powerpc: Migrate Xilinx Vertex support from the OCP bus to the platfom bus. This patch only deals with the serial port definitions as there is no support for any other xilinx IP cores in the kernel tree at the moment. Board specific configuration moved out of virtex.[ch] and into the xparameters.h wrapper. This also prepares for the transition to the flattened device tree model. When the bootloader provides a device tree generated from an xparameters.h files, the kernel will no longer need xparameters/*. The platform bus will get populated with data from the device tree, and the device drivers will be automatically connected to the devices. Only the bootloader (or ppcboot) will need xparameters directly. Signed-off-by: Grant C. Likely Signed-off-by: Paul Mackerras --- include/asm-ppc/ppc_sys.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h index 83d8c77c124..bdc4dde35ed 100644 --- a/include/asm-ppc/ppc_sys.h +++ b/include/asm-ppc/ppc_sys.h @@ -33,6 +33,8 @@ #include #elif defined(CONFIG_MPC10X_BRIDGE) #include +#elif defined(CONFIG_XILINX_VIRTEX) +#include #else #error "need definition of ppc_sys_devices" #endif -- cgit v1.2.3 From 909aeca664dd1fe55111dc4ec25c1bebe91674a2 Mon Sep 17 00:00:00 2001 From: "Grant C. Likely" Date: Thu, 19 Jan 2006 01:13:37 -0700 Subject: [PATCH] powerpc: Add support for Xilinx ML403 reference design Includes fix for Xilinx silicon errata 213 Signed-off-by: Grant C. Likely Signed-off-by: Paul Mackerras --- include/asm-ppc/ibm4xx.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/asm-ppc/ibm4xx.h b/include/asm-ppc/ibm4xx.h index 6c28ae7807f..38f99710752 100644 --- a/include/asm-ppc/ibm4xx.h +++ b/include/asm-ppc/ibm4xx.h @@ -51,6 +51,10 @@ #include #endif +#if defined(CONFIG_XILINX_ML403) +#include +#endif + #ifndef __ASSEMBLY__ #ifdef CONFIG_40x -- cgit v1.2.3 From d7a5b2ffa1352f0310630934a56aecbdfb617b72 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Wed, 25 Jan 2006 21:31:28 +1300 Subject: [PATCH] powerpc: Always panic if lmb_alloc() fails Currently most callers of lmb_alloc() don't check if it worked or not, if it ever does weird bad things will probably happen. The few callers who do check just panic or BUG_ON. So make lmb_alloc() panic internally, to catch bugs at the source. The few callers who did check the result no longer need to. The only caller that did anything interesting with the return result was careful_allocation(). For it we create __lmb_alloc_base() which _doesn't_ panic automatically, a little messy, but passable. Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- include/asm-powerpc/lmb.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/asm-powerpc/lmb.h b/include/asm-powerpc/lmb.h index d3546c4c9f4..4fda8eaaeaf 100644 --- a/include/asm-powerpc/lmb.h +++ b/include/asm-powerpc/lmb.h @@ -48,6 +48,8 @@ extern long __init lmb_reserve(unsigned long, unsigned long); extern unsigned long __init lmb_alloc(unsigned long, unsigned long); extern unsigned long __init lmb_alloc_base(unsigned long, unsigned long, unsigned long); +extern unsigned long __init __lmb_alloc_base(unsigned long, unsigned long, + unsigned long); extern unsigned long __init lmb_phys_mem_size(void); extern unsigned long __init lmb_end_of_DRAM(void); extern unsigned long __init lmb_abs_to_phys(unsigned long); -- cgit v1.2.3 From 3b9331dac16555e8788ae21723f2146c3f994ebb Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Wed, 25 Jan 2006 21:31:30 +1300 Subject: [PATCH] powerpc: Move LMB_ALLOC_ANYWHERE out of lmb.h LMB_ALLOC_ANYWHERE doesn't need to be part of the API, it's only used in lmb.c - so move it out of the header file. Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- include/asm-powerpc/lmb.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/lmb.h b/include/asm-powerpc/lmb.h index 4fda8eaaeaf..fbb7bde8fb0 100644 --- a/include/asm-powerpc/lmb.h +++ b/include/asm-powerpc/lmb.h @@ -19,8 +19,6 @@ #define MAX_LMB_REGIONS 128 -#define LMB_ALLOC_ANYWHERE 0 - struct lmb_property { unsigned long base; unsigned long size; -- cgit v1.2.3 From 56b5c9737cdd8814a10f3022fc0cef8af9ea9ba5 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Wed, 25 Jan 2006 21:31:36 +1300 Subject: [PATCH] powerpc: Put parameter names in lmb.h prototypes Prototypes aren't so useful without parameter names, add them to lmb.h based on the names in lmb.c Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- include/asm-powerpc/lmb.h | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/lmb.h b/include/asm-powerpc/lmb.h index fbb7bde8fb0..377ac1b23aa 100644 --- a/include/asm-powerpc/lmb.h +++ b/include/asm-powerpc/lmb.h @@ -41,17 +41,16 @@ extern struct lmb lmb; extern void __init lmb_init(void); extern void __init lmb_analyze(void); -extern long __init lmb_add(unsigned long, unsigned long); -extern long __init lmb_reserve(unsigned long, unsigned long); -extern unsigned long __init lmb_alloc(unsigned long, unsigned long); -extern unsigned long __init lmb_alloc_base(unsigned long, unsigned long, - unsigned long); -extern unsigned long __init __lmb_alloc_base(unsigned long, unsigned long, - unsigned long); +extern long __init lmb_add(unsigned long base, unsigned long size); +extern long __init lmb_reserve(unsigned long base, unsigned long size); +extern unsigned long __init lmb_alloc(unsigned long size, unsigned long align); +extern unsigned long __init lmb_alloc_base(unsigned long size, + unsigned long align, unsigned long max_addr); +extern unsigned long __init __lmb_alloc_base(unsigned long size, + unsigned long align, unsigned long max_addr); extern unsigned long __init lmb_phys_mem_size(void); extern unsigned long __init lmb_end_of_DRAM(void); -extern unsigned long __init lmb_abs_to_phys(unsigned long); -extern void __init lmb_enforce_memory_limit(unsigned long); +extern void __init lmb_enforce_memory_limit(unsigned long memory_limit); extern void lmb_dump_all(void); -- cgit v1.2.3 From 1965746bce49ddf001af52c7985e16343c768021 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Fri, 10 Feb 2006 15:47:36 +1100 Subject: [PATCH] powerpc: Move pSeries firmware feature setup into platforms/pseries Currently we have some stuff in firmware.h and kernel/firmware.c that is #ifdef CONFIG_PPC_PSERIES. Move it all into platforms/pseries. Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- include/asm-powerpc/firmware.h | 9 --------- 1 file changed, 9 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h index f804b34cf06..b7791a1b05d 100644 --- a/include/asm-powerpc/firmware.h +++ b/include/asm-powerpc/firmware.h @@ -89,15 +89,6 @@ static inline unsigned long firmware_has_feature(unsigned long feature) (FW_FEATURE_POSSIBLE & ppc64_firmware_features & feature); } -#ifdef CONFIG_PPC_PSERIES -typedef struct { - unsigned long val; - char * name; -} firmware_feature_t; - -extern firmware_feature_t firmware_features_table[]; -#endif - extern void system_reset_fwnmi(void); extern void machine_check_fwnmi(void); -- cgit v1.2.3 From 75288c78c69020a574d93770c3a941b785f3d93d Mon Sep 17 00:00:00 2001 From: Vitaly Bordug Date: Fri, 20 Jan 2006 22:22:34 +0300 Subject: [PATCH] ppc32: Make platform devices being able to assign functions Implemented by modification of the .name field of the platform device, when PDs with the same names are to be used within different drivers, as -> : Corresponding drivers should change the .name in struct device_driver to reflect upper of course. Added ppc_sys_device_disable/enable function set, making it easier to disable all the inexistent/not utilized platform device way pdevs. By the check of the "disabled" bit in the config field of ppc_sys_specs, disabled platform devices will be either added/removed from the bus, or simply not registered on it, depending on the time when disable/enable call asserted. The default behaviour when nothing is disabled/enabled will be "all devices are enabled", which is the same as before. Also helper platform_notify_map function added, making assignment of board-specific platform_info more consistent and generic. Signed-off-by: Vitaly Bordug Signed-off-by: Marcelo Tosatti Signed-off-by: Paul Mackerras --- include/asm-ppc/mpc10x.h | 1 + include/asm-ppc/mpc52xx.h | 1 + include/asm-ppc/mpc8260.h | 1 + include/asm-ppc/mpc83xx.h | 1 + include/asm-ppc/mpc85xx.h | 1 + include/asm-ppc/mpc8xx.h | 1 + include/asm-ppc/ppc_sys.h | 32 ++++++++++++++++++++++++++++++++ 7 files changed, 38 insertions(+) (limited to 'include') diff --git a/include/asm-ppc/mpc10x.h b/include/asm-ppc/mpc10x.h index 77b1e092c20..976ad3d94f2 100644 --- a/include/asm-ppc/mpc10x.h +++ b/include/asm-ppc/mpc10x.h @@ -165,6 +165,7 @@ enum ppc_sys_devices { MPC10X_DMA1, MPC10X_UART0, MPC10X_UART1, + NUM_PPC_SYS_DEVS, }; int mpc10x_bridge_init(struct pci_controller *hose, diff --git a/include/asm-ppc/mpc52xx.h b/include/asm-ppc/mpc52xx.h index a055e0756b9..6167f74635f 100644 --- a/include/asm-ppc/mpc52xx.h +++ b/include/asm-ppc/mpc52xx.h @@ -60,6 +60,7 @@ enum ppc_sys_devices { MPC52xx_ATA, MPC52xx_I2C1, MPC52xx_I2C2, + NUM_PPC_SYS_DEVS, }; diff --git a/include/asm-ppc/mpc8260.h b/include/asm-ppc/mpc8260.h index 32145269503..6ba69a86b9d 100644 --- a/include/asm-ppc/mpc8260.h +++ b/include/asm-ppc/mpc8260.h @@ -83,6 +83,7 @@ enum ppc_sys_devices { MPC82xx_CPM_SMC2, MPC82xx_CPM_USB, MPC82xx_SEC1, + NUM_PPC_SYS_DEVS, }; #ifndef __ASSEMBLY__ diff --git a/include/asm-ppc/mpc83xx.h b/include/asm-ppc/mpc83xx.h index 7cdf60fa69b..3c23fc43bfb 100644 --- a/include/asm-ppc/mpc83xx.h +++ b/include/asm-ppc/mpc83xx.h @@ -108,6 +108,7 @@ enum ppc_sys_devices { MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO, + NUM_PPC_SYS_DEVS, }; #endif /* CONFIG_83xx */ diff --git a/include/asm-ppc/mpc85xx.h b/include/asm-ppc/mpc85xx.h index c8a96aa44fb..f47002a60ed 100644 --- a/include/asm-ppc/mpc85xx.h +++ b/include/asm-ppc/mpc85xx.h @@ -139,6 +139,7 @@ enum ppc_sys_devices { MPC85xx_eTSEC4, MPC85xx_IIC2, MPC85xx_MDIO, + NUM_PPC_SYS_DEVS, }; /* Internal interrupts are all Level Sensitive, and Positive Polarity */ diff --git a/include/asm-ppc/mpc8xx.h b/include/asm-ppc/mpc8xx.h index 73ec9a6db0b..3515a7fa6c8 100644 --- a/include/asm-ppc/mpc8xx.h +++ b/include/asm-ppc/mpc8xx.h @@ -111,6 +111,7 @@ enum ppc_sys_devices { MPC8xx_CPM_SMC1, MPC8xx_CPM_SMC2, MPC8xx_CPM_USB, + NUM_PPC_SYS_DEVS, }; #define PPC_PIN_SIZE (24 * 1024 * 1024) /* 24Mbytes of data pinned */ diff --git a/include/asm-ppc/ppc_sys.h b/include/asm-ppc/ppc_sys.h index bdc4dde35ed..4b94f7059eb 100644 --- a/include/asm-ppc/ppc_sys.h +++ b/include/asm-ppc/ppc_sys.h @@ -46,9 +46,26 @@ struct ppc_sys_spec { u32 value; u32 num_devices; char *ppc_sys_name; + u8 config[NUM_PPC_SYS_DEVS]; enum ppc_sys_devices *device_list; }; +struct platform_notify_dev_map { + const char *bus_id; + void (*rtn)(struct platform_device * pdev, int idx); +}; + +enum platform_device_func { + PPC_SYS_FUNC_DUMMY = 0, + PPC_SYS_FUNC_ETH = 1, + PPC_SYS_FUNC_UART = 2, + PPC_SYS_FUNC_HLDC = 3, + PPC_SYS_FUNC_USB = 4, + PPC_SYS_FUNC_IRDA = 5, +}; + +#define PPC_SYS_CONFIG_DISABLED 1 + /* describes all specific chips and which devices they have on them */ extern struct ppc_sys_spec ppc_sys_specs[]; extern struct ppc_sys_spec *cur_ppc_sys_spec; @@ -74,5 +91,20 @@ extern void *ppc_sys_get_pdata(enum ppc_sys_devices dev) __init; /* remove a device from the system */ extern void ppc_sys_device_remove(enum ppc_sys_devices dev); +/* Function assignment stuff */ +void ppc_sys_device_initfunc(void); +void ppc_sys_device_setfunc(enum ppc_sys_devices dev, + enum platform_device_func func); +void ppc_sys_device_set_func_all(enum platform_device_func func); + +void platform_notify_map(const struct platform_notify_dev_map *map, + struct device *dev); + +/* Enable / disable stuff */ +void ppc_sys_device_disable(enum ppc_sys_devices dev); +void ppc_sys_device_enable(enum ppc_sys_devices dev); +void ppc_sys_device_enable_all(void); +void ppc_sys_device_disable_all(void); + #endif /* __ASM_PPC_SYS_H */ #endif /* __KERNEL__ */ -- cgit v1.2.3 From 2ef9481e666b4654159ac9f847e6963809e3c470 Mon Sep 17 00:00:00 2001 From: Jon Mason Date: Mon, 23 Jan 2006 10:58:20 -0600 Subject: [PATCH] powerpc: trivial: modify comments to refer to new location of files This patch removes all self references and fixes references to files in the now defunct arch/ppc64 tree. I think this accomplises everything wanted, though there might be a few references I missed. Signed-off-by: Jon Mason Signed-off-by: Paul Mackerras --- include/asm-powerpc/paca.h | 2 +- include/asm-powerpc/rwsem.h | 2 +- include/asm-ppc/harrier.h | 2 -- include/asm-ppc/mpc10x.h | 2 -- include/asm-ppc/todc.h | 2 -- 5 files changed, 2 insertions(+), 8 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h index c9add8f1ad9..ec94b51074f 100644 --- a/include/asm-powerpc/paca.h +++ b/include/asm-powerpc/paca.h @@ -54,7 +54,7 @@ struct paca_struct { #endif /* CONFIG_PPC_ISERIES */ /* - * MAGIC: the spinlock functions in arch/ppc64/lib/locks.c + * MAGIC: the spinlock functions in arch/powerpc/lib/locks.c * load lock_token and paca_index with a single lwz * instruction. They must travel together and be properly * aligned. diff --git a/include/asm-powerpc/rwsem.h b/include/asm-powerpc/rwsem.h index 79bae4933b7..2c2fe964759 100644 --- a/include/asm-powerpc/rwsem.h +++ b/include/asm-powerpc/rwsem.h @@ -4,7 +4,7 @@ #ifdef __KERNEL__ /* - * include/asm-ppc64/rwsem.h: R/W semaphores for PPC using the stuff + * include/asm-powerpc/rwsem.h: R/W semaphores for PPC using the stuff * in lib/rwsem.c. Adapted largely from include/asm-i386/rwsem.h * by Paul Mackerras . */ diff --git a/include/asm-ppc/harrier.h b/include/asm-ppc/harrier.h index 36c73ab7e43..7acd7fc126e 100644 --- a/include/asm-ppc/harrier.h +++ b/include/asm-ppc/harrier.h @@ -1,6 +1,4 @@ /* - * arch/ppc/kernel/harrier.h - * * Definitions for Motorola MCG Harrier North Bridge & Memory controller * * Author: Dale Farnsworth diff --git a/include/asm-ppc/mpc10x.h b/include/asm-ppc/mpc10x.h index 976ad3d94f2..b30a6a3b5bd 100644 --- a/include/asm-ppc/mpc10x.h +++ b/include/asm-ppc/mpc10x.h @@ -1,6 +1,4 @@ /* - * arch/ppc/kernel/mpc10x.h - * * Common routines for the Motorola SPS MPC106/8240/107 Host bridge/Mem * ctlr/EPIC/etc. * diff --git a/include/asm-ppc/todc.h b/include/asm-ppc/todc.h index 84bae7d7681..937c7dbe6e5 100644 --- a/include/asm-ppc/todc.h +++ b/include/asm-ppc/todc.h @@ -1,6 +1,4 @@ /* - * include/asm-ppc/todc.h - * * Definitions for the M48Txx and mc146818 series of Time of day/Real Time * Clock chips. * -- cgit v1.2.3 From c6622f63db86fcbd41bf6fe05ddf2e00c1e51ced Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Fri, 24 Feb 2006 10:06:59 +1100 Subject: powerpc: Implement accurate task and CPU time accounting This implements accurate task and cpu time accounting for 64-bit powerpc kernels. Instead of accounting a whole jiffy of time to a task on a timer interrupt because that task happened to be running at the time, we now account time in units of timebase ticks according to the actual time spent by the task in user mode and kernel mode. We also count the time spent processing hardware and software interrupts accurately. This is conditional on CONFIG_VIRT_CPU_ACCOUNTING. If that is not set, we do tick-based approximate accounting as before. To get this accurate information, we read either the PURR (processor utilization of resources register) on POWER5 machines, or the timebase on other machines on * each entry to the kernel from usermode * each exit to usermode * transitions between process context, hard irq context and soft irq context in kernel mode * context switches. On POWER5 systems with shared-processor logical partitioning we also read both the PURR and the timebase at each timer interrupt and context switch in order to determine how much time has been taken by the hypervisor to run other partitions ("steal" time). Unfortunately, since we need values of the PURR on both threads at the same time to accurately calculate the steal time, and since we can only calculate steal time on a per-core basis, the apportioning of the steal time between idle time (time which we ceded to the hypervisor in the idle loop) and actual stolen time is somewhat approximate at the moment. This is all based quite heavily on what s390 does, and it uses the generic interfaces that were added by the s390 developers, i.e. account_system_time(), account_user_time(), etc. This patch doesn't add any new interfaces between the kernel and userspace, and doesn't change the units in which time is reported to userspace by things such as /proc/stat, /proc//stat, getrusage(), times(), etc. Internally the various task and cpu times are stored in timebase units, but they are converted to USER_HZ units (1/100th of a second) when reported to userspace. Some precision is therefore lost but there should not be any accumulating error, since the internal accumulation is at full precision. Signed-off-by: Paul Mackerras --- include/asm-powerpc/cputable.h | 4 +- include/asm-powerpc/cputime.h | 202 +++++++++++++++++++++++++++++++++++++++++ include/asm-powerpc/irq.h | 6 +- include/asm-powerpc/paca.h | 5 + include/asm-powerpc/ppc_asm.h | 42 +++++++++ include/asm-powerpc/system.h | 4 + include/asm-powerpc/time.h | 15 +++ include/asm-ppc/time.h | 5 + 8 files changed, 280 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h index 90d005bb4d1..99d12ff6346 100644 --- a/include/asm-powerpc/cputable.h +++ b/include/asm-powerpc/cputable.h @@ -117,6 +117,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset); #define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) #define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000) #define CPU_FTR_PAUSE_ZERO ASM_CONST(0x0000200000000000) +#define CPU_FTR_PURR ASM_CONST(0x0000400000000000) #else /* ensure on 32b processors the flags are available for compiling but * don't do anything */ @@ -132,6 +133,7 @@ extern void do_cpu_ftr_fixups(unsigned long offset); #define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0) #define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0) #define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0) +#define CPU_FTR_PURR ASM_CONST(0x0) #endif #ifndef __ASSEMBLY__ @@ -316,7 +318,7 @@ enum { CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA | CPU_FTR_SMT | CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | - CPU_FTR_MMCRA_SIHV, + CPU_FTR_MMCRA_SIHV | CPU_FTR_PURR, CPU_FTRS_CELL = CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | diff --git a/include/asm-powerpc/cputime.h b/include/asm-powerpc/cputime.h index 6d68ad7e0ea..a21185d4788 100644 --- a/include/asm-powerpc/cputime.h +++ b/include/asm-powerpc/cputime.h @@ -1 +1,203 @@ +/* + * Definitions for measuring cputime on powerpc machines. + * + * Copyright (C) 2006 Paul Mackerras, IBM Corp. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + * + * If we have CONFIG_VIRT_CPU_ACCOUNTING, we measure cpu time in + * the same units as the timebase. Otherwise we measure cpu time + * in jiffies using the generic definitions. + */ + +#ifndef __POWERPC_CPUTIME_H +#define __POWERPC_CPUTIME_H + +#ifndef CONFIG_VIRT_CPU_ACCOUNTING #include +#else + +#include +#include +#include +#include +#include + +typedef u64 cputime_t; +typedef u64 cputime64_t; + +#define cputime_zero ((cputime_t)0) +#define cputime_max ((~((cputime_t)0) >> 1) - 1) +#define cputime_add(__a, __b) ((__a) + (__b)) +#define cputime_sub(__a, __b) ((__a) - (__b)) +#define cputime_div(__a, __n) ((__a) / (__n)) +#define cputime_halve(__a) ((__a) >> 1) +#define cputime_eq(__a, __b) ((__a) == (__b)) +#define cputime_gt(__a, __b) ((__a) > (__b)) +#define cputime_ge(__a, __b) ((__a) >= (__b)) +#define cputime_lt(__a, __b) ((__a) < (__b)) +#define cputime_le(__a, __b) ((__a) <= (__b)) + +#define cputime64_zero ((cputime64_t)0) +#define cputime64_add(__a, __b) ((__a) + (__b)) +#define cputime_to_cputime64(__ct) (__ct) + +#ifdef __KERNEL__ + +/* + * Convert cputime <-> jiffies + */ +extern u64 __cputime_jiffies_factor; + +static inline unsigned long cputime_to_jiffies(const cputime_t ct) +{ + return mulhdu(ct, __cputime_jiffies_factor); +} + +static inline cputime_t jiffies_to_cputime(const unsigned long jif) +{ + cputime_t ct; + unsigned long sec; + + /* have to be a little careful about overflow */ + ct = jif % HZ; + sec = jif / HZ; + if (ct) { + ct *= tb_ticks_per_sec; + do_div(ct, HZ); + } + if (sec) + ct += (cputime_t) sec * tb_ticks_per_sec; + return ct; +} + +static inline u64 cputime64_to_jiffies64(const cputime_t ct) +{ + return mulhdu(ct, __cputime_jiffies_factor); +} + +/* + * Convert cputime <-> milliseconds + */ +extern u64 __cputime_msec_factor; + +static inline unsigned long cputime_to_msecs(const cputime_t ct) +{ + return mulhdu(ct, __cputime_msec_factor); +} + +static inline cputime_t msecs_to_cputime(const unsigned long ms) +{ + cputime_t ct; + unsigned long sec; + + /* have to be a little careful about overflow */ + ct = ms % 1000; + sec = ms / 1000; + if (ct) { + ct *= tb_ticks_per_sec; + do_div(ct, 1000); + } + if (sec) + ct += (cputime_t) sec * tb_ticks_per_sec; + return ct; +} + +/* + * Convert cputime <-> seconds + */ +extern u64 __cputime_sec_factor; + +static inline unsigned long cputime_to_secs(const cputime_t ct) +{ + return mulhdu(ct, __cputime_sec_factor); +} + +static inline cputime_t secs_to_cputime(const unsigned long sec) +{ + return (cputime_t) sec * tb_ticks_per_sec; +} + +/* + * Convert cputime <-> timespec + */ +static inline void cputime_to_timespec(const cputime_t ct, struct timespec *p) +{ + u64 x = ct; + unsigned int frac; + + frac = do_div(x, tb_ticks_per_sec); + p->tv_sec = x; + x = (u64) frac * 1000000000; + do_div(x, tb_ticks_per_sec); + p->tv_nsec = x; +} + +static inline cputime_t timespec_to_cputime(const struct timespec *p) +{ + cputime_t ct; + + ct = (u64) p->tv_nsec * tb_ticks_per_sec; + do_div(ct, 1000000000); + return ct + (u64) p->tv_sec * tb_ticks_per_sec; +} + +/* + * Convert cputime <-> timeval + */ +static inline void cputime_to_timeval(const cputime_t ct, struct timeval *p) +{ + u64 x = ct; + unsigned int frac; + + frac = do_div(x, tb_ticks_per_sec); + p->tv_sec = x; + x = (u64) frac * 1000000; + do_div(x, tb_ticks_per_sec); + p->tv_usec = x; +} + +static inline cputime_t timeval_to_cputime(const struct timeval *p) +{ + cputime_t ct; + + ct = (u64) p->tv_usec * tb_ticks_per_sec; + do_div(ct, 1000000); + return ct + (u64) p->tv_sec * tb_ticks_per_sec; +} + +/* + * Convert cputime <-> clock_t (units of 1/USER_HZ seconds) + */ +extern u64 __cputime_clockt_factor; + +static inline unsigned long cputime_to_clock_t(const cputime_t ct) +{ + return mulhdu(ct, __cputime_clockt_factor); +} + +static inline cputime_t clock_t_to_cputime(const unsigned long clk) +{ + cputime_t ct; + unsigned long sec; + + /* have to be a little careful about overflow */ + ct = clk % USER_HZ; + sec = clk / USER_HZ; + if (ct) { + ct *= tb_ticks_per_sec; + do_div(ct, USER_HZ); + } + if (sec) + ct += (cputime_t) sec * tb_ticks_per_sec; + return ct; +} + +#define cputime64_to_clock_t(ct) cputime_to_clock_t((cputime_t)(ct)) + +#endif /* __KERNEL__ */ +#endif /* CONFIG_VIRT_CPU_ACCOUNTING */ +#endif /* __POWERPC_CPUTIME_H */ diff --git a/include/asm-powerpc/irq.h b/include/asm-powerpc/irq.h index 8eb7e857ec4..51f87d9993b 100644 --- a/include/asm-powerpc/irq.h +++ b/include/asm-powerpc/irq.h @@ -479,6 +479,10 @@ extern int distribute_irqs; struct irqaction; struct pt_regs; +#define __ARCH_HAS_DO_SOFTIRQ + +extern void __do_softirq(void); + #ifdef CONFIG_IRQSTACKS /* * Per-cpu stacks for handling hard and soft interrupts. @@ -491,8 +495,6 @@ extern void call_do_softirq(struct thread_info *tp); extern int call___do_IRQ(int irq, struct pt_regs *regs, struct thread_info *tp); -#define __ARCH_HAS_DO_SOFTIRQ - #else #define irq_ctx_init() diff --git a/include/asm-powerpc/paca.h b/include/asm-powerpc/paca.h index ec94b51074f..4465b95ebef 100644 --- a/include/asm-powerpc/paca.h +++ b/include/asm-powerpc/paca.h @@ -96,6 +96,11 @@ struct paca_struct { u64 saved_r1; /* r1 save for RTAS calls */ u64 saved_msr; /* MSR saved here by enter_rtas */ u8 proc_enabled; /* irq soft-enable flag */ + + /* Stuff for accurate time accounting */ + u64 user_time; /* accumulated usermode TB ticks */ + u64 system_time; /* accumulated system TB ticks */ + u64 startpurr; /* PURR/TB value snapshot */ }; extern struct paca_struct paca[]; diff --git a/include/asm-powerpc/ppc_asm.h b/include/asm-powerpc/ppc_asm.h index ab8688d3902..dd1c0a913d5 100644 --- a/include/asm-powerpc/ppc_asm.h +++ b/include/asm-powerpc/ppc_asm.h @@ -14,6 +14,48 @@ #define SZL (BITS_PER_LONG/8) +/* + * Stuff for accurate CPU time accounting. + * These macros handle transitions between user and system state + * in exception entry and exit and accumulate time to the + * user_time and system_time fields in the paca. + */ + +#ifndef CONFIG_VIRT_CPU_ACCOUNTING +#define ACCOUNT_CPU_USER_ENTRY(ra, rb) +#define ACCOUNT_CPU_USER_EXIT(ra, rb) +#else +#define ACCOUNT_CPU_USER_ENTRY(ra, rb) \ + beq 2f; /* if from kernel mode */ \ +BEGIN_FTR_SECTION; \ + mfspr ra,SPRN_PURR; /* get processor util. reg */ \ +END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ +BEGIN_FTR_SECTION; \ + mftb ra; /* or get TB if no PURR */ \ +END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ + ld rb,PACA_STARTPURR(r13); \ + std ra,PACA_STARTPURR(r13); \ + subf rb,rb,ra; /* subtract start value */ \ + ld ra,PACA_USER_TIME(r13); \ + add ra,ra,rb; /* add on to user time */ \ + std ra,PACA_USER_TIME(r13); \ +2: + +#define ACCOUNT_CPU_USER_EXIT(ra, rb) \ +BEGIN_FTR_SECTION; \ + mfspr ra,SPRN_PURR; /* get processor util. reg */ \ +END_FTR_SECTION_IFSET(CPU_FTR_PURR); \ +BEGIN_FTR_SECTION; \ + mftb ra; /* or get TB if no PURR */ \ +END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ + ld rb,PACA_STARTPURR(r13); \ + std ra,PACA_STARTPURR(r13); \ + subf rb,rb,ra; /* subtract start value */ \ + ld ra,PACA_SYSTEM_TIME(r13); \ + add ra,ra,rb; /* add on to user time */ \ + std ra,PACA_SYSTEM_TIME(r13); +#endif + /* * Macros for storing registers into and loading registers from * exception frames. diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h index d9bf53653b1..41b7a5b3d70 100644 --- a/include/asm-powerpc/system.h +++ b/include/asm-powerpc/system.h @@ -424,5 +424,9 @@ static inline void create_function_call(unsigned long addr, void * func) create_branch(addr, func_addr, BRANCH_SET_LINK); } +#ifdef CONFIG_VIRT_CPU_ACCOUNTING +extern void account_system_vtime(struct task_struct *); +#endif + #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_SYSTEM_H */ diff --git a/include/asm-powerpc/time.h b/include/asm-powerpc/time.h index baddc9ab57a..912118db13a 100644 --- a/include/asm-powerpc/time.h +++ b/include/asm-powerpc/time.h @@ -41,6 +41,7 @@ extern time_t last_rtc_update; extern void generic_calibrate_decr(void); extern void wakeup_decrementer(void); +extern void snapshot_timebase(void); /* Some sane defaults: 125 MHz timebase, 1GHz processor */ extern unsigned long ppc_proc_freq; @@ -221,5 +222,19 @@ struct cpu_usage { DECLARE_PER_CPU(struct cpu_usage, cpu_usage_array); +#ifdef CONFIG_VIRT_CPU_ACCOUNTING +extern void account_process_vtime(struct task_struct *tsk); +#else +#define account_process_vtime(tsk) do { } while (0) +#endif + +#if defined(CONFIG_VIRT_CPU_ACCOUNTING) && defined(CONFIG_PPC_SPLPAR) +extern void calculate_steal_time(void); +extern void snapshot_timebases(void); +#else +#define calculate_steal_time() do { } while (0) +#define snapshot_timebases() do { } while (0) +#endif + #endif /* __KERNEL__ */ #endif /* __PPC64_TIME_H */ diff --git a/include/asm-ppc/time.h b/include/asm-ppc/time.h index 321fb75b5f2..c86112323c9 100644 --- a/include/asm-ppc/time.h +++ b/include/asm-ppc/time.h @@ -153,5 +153,10 @@ extern __inline__ unsigned binary_tbl(void) { ({unsigned z; asm ("mulhwu %0,%1,%2" : "=r" (z) : "r" (x), "r" (y)); z;}) unsigned mulhwu_scale_factor(unsigned, unsigned); + +#define account_process_vtime(tsk) do { } while (0) +#define calculate_steal_time() do { } while (0) +#define snapshot_timebases() do { } while (0) + #endif /* __ASM_TIME_H__ */ #endif /* __KERNEL__ */ -- cgit v1.2.3 From 20f4eb3e502d68b12224577ebcd2cd50cc6e14e4 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 20 Feb 2006 14:05:56 +1100 Subject: [PATCH] powerpc: Fixup for STRICT_MM_TYPECHECKS Currently ARCH=powerpc will not compile when STRICT_MM_TYPECHECKS is turned on and CONFIG_64K_PAGES is turned off. This corrects the problem. Signed-off-by: David Gibson Signed-off-by: Paul Mackerras --- include/asm-powerpc/pgtable-4k.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/pgtable-4k.h b/include/asm-powerpc/pgtable-4k.h index e9590c06ad9..35f92813464 100644 --- a/include/asm-powerpc/pgtable-4k.h +++ b/include/asm-powerpc/pgtable-4k.h @@ -62,9 +62,14 @@ /* shift to put page number into pte */ #define PTE_RPN_SHIFT (17) -#define __real_pte(e,p) ((real_pte_t)(e)) -#define __rpte_to_pte(r) (r) -#define __rpte_to_hidx(r,index) (pte_val((r)) >> 12) +#ifdef STRICT_MM_TYPECHECKS +#define __real_pte(e,p) ((real_pte_t){(e)}) +#define __rpte_to_pte(r) ((r).pte) +#else +#define __real_pte(e,p) (e) +#define __rpte_to_pte(r) (__pte(r)) +#endif +#define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> 12) #define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \ do { \ -- cgit v1.2.3 From 4f629d7db32decbadaab2abfa4d021fee94990ef Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Mon, 20 Feb 2006 10:40:28 +0100 Subject: [PATCH] powerpc: newline for ISYNC_ON_SMP Add a newline at the end of the ISYNC_ON_SMP string. Needed for a subsequent patch. Signed-off-by: Nick Piggin Signed-off-by: Paul Mackerras --- include/asm-powerpc/synch.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-powerpc/synch.h b/include/asm-powerpc/synch.h index c90d9d9aae7..2cda3c38a9f 100644 --- a/include/asm-powerpc/synch.h +++ b/include/asm-powerpc/synch.h @@ -15,7 +15,7 @@ #endif #ifdef CONFIG_SMP -#define ISYNC_ON_SMP "\n\tisync" +#define ISYNC_ON_SMP "\n\tisync\n" #define LWSYNC_ON_SMP __stringify(LWSYNC) "\n" #else #define ISYNC_ON_SMP -- cgit v1.2.3 From f055affb89f587a03f3411c3fd49ef31295c3d48 Mon Sep 17 00:00:00 2001 From: Nick Piggin Date: Mon, 20 Feb 2006 10:41:40 +0100 Subject: [PATCH] powerpc: native atomic_add_unless Do atomic_add_unless natively instead of using cmpxchg. Improved register allocation idea from Joel Schopp. Signed-off-by: Nick Piggin Signed-off-by: Paul Mackerras --- include/asm-powerpc/atomic.h | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/atomic.h b/include/asm-powerpc/atomic.h index 147a38dcc76..bb3c0ab7e66 100644 --- a/include/asm-powerpc/atomic.h +++ b/include/asm-powerpc/atomic.h @@ -8,6 +8,7 @@ typedef struct { volatile int counter; } atomic_t; #ifdef __KERNEL__ +#include #include #include @@ -176,20 +177,29 @@ static __inline__ int atomic_dec_return(atomic_t *v) * Atomically adds @a to @v, so long as it was not @u. * Returns non-zero if @v was not @u, and zero otherwise. */ -#define atomic_add_unless(v, a, u) \ -({ \ - int c, old; \ - c = atomic_read(v); \ - for (;;) { \ - if (unlikely(c == (u))) \ - break; \ - old = atomic_cmpxchg((v), c, c + (a)); \ - if (likely(old == c)) \ - break; \ - c = old; \ - } \ - c != (u); \ -}) +static __inline__ int atomic_add_unless(atomic_t *v, int a, int u) +{ + int t; + + __asm__ __volatile__ ( + LWSYNC_ON_SMP +"1: lwarx %0,0,%1 # atomic_add_unless\n\ + cmpw 0,%0,%3 \n\ + beq- 2f \n\ + add %0,%2,%0 \n" + PPC405_ERR77(0,%2) +" stwcx. %0,0,%1 \n\ + bne- 1b \n" + ISYNC_ON_SMP +" subf %0,%2,%0 \n\ +2:" + : "=&r" (t) + : "r" (&v->counter), "r" (a), "r" (u) + : "cc", "memory"); + + return t != u; +} + #define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0) #define atomic_sub_and_test(a, v) (atomic_sub_return((a), (v)) == 0) -- cgit v1.2.3 From 0f6be7b77ceaea01a35b37fab26f4ea3b01efe14 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 6 Mar 2006 12:51:29 +1100 Subject: [PATCH] powerpc: Better pmd_bad() and pud_bad() checks At present, the powerpc pmd_bad() and pud_bad() macros return false unless the given pmd or pud is zero. This patch makes these tests more thorough, checking if the given pmd or pud looks like a plausible pte page or pmd page pointer respectively. This can result in helpful error messages when messing with the pagetable code. Signed-off-by: David Gibson Signed-off-by: Paul Mackerras --- include/asm-powerpc/pgtable.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/pgtable.h b/include/asm-powerpc/pgtable.h index e38931379a7..8dc3eb54276 100644 --- a/include/asm-powerpc/pgtable.h +++ b/include/asm-powerpc/pgtable.h @@ -188,9 +188,13 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) #define pte_pfn(x) ((unsigned long)((pte_val(x)>>PTE_RPN_SHIFT))) #define pte_page(x) pfn_to_page(pte_pfn(x)) +#define PMD_BAD_BITS (PTE_TABLE_SIZE-1) +#define PUD_BAD_BITS (PMD_TABLE_SIZE-1) + #define pmd_set(pmdp, pmdval) (pmd_val(*(pmdp)) = (pmdval)) #define pmd_none(pmd) (!pmd_val(pmd)) -#define pmd_bad(pmd) (pmd_val(pmd) == 0) +#define pmd_bad(pmd) (!is_kernel_addr(pmd_val(pmd)) \ + || (pmd_val(pmd) & PMD_BAD_BITS)) #define pmd_present(pmd) (pmd_val(pmd) != 0) #define pmd_clear(pmdp) (pmd_val(*(pmdp)) = 0) #define pmd_page_kernel(pmd) (pmd_val(pmd) & ~PMD_MASKED_BITS) @@ -198,7 +202,8 @@ static inline pte_t pfn_pte(unsigned long pfn, pgprot_t pgprot) #define pud_set(pudp, pudval) (pud_val(*(pudp)) = (pudval)) #define pud_none(pud) (!pud_val(pud)) -#define pud_bad(pud) ((pud_val(pud)) == 0) +#define pud_bad(pud) (!is_kernel_addr(pud_val(pud)) \ + || (pud_val(pud) & PUD_BAD_BITS)) #define pud_present(pud) (pud_val(pud) != 0) #define pud_clear(pudp) (pud_val(*(pudp)) = 0) #define pud_page(pud) (pud_val(pud) & ~PUD_MASKED_BITS) -- cgit v1.2.3 From e33852228f74b8ccbed8595083bb725b70902ed7 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Wed, 8 Mar 2006 16:47:00 +0100 Subject: [PATCH] powerpc: add for_each_node_by_foo helpers Typical use for of_find_node_by_name and of_find_node_by_type is to iterate over all nodes of a given type/name. Add a helper macro to do that (in spirit of the list_for_each* macros). Signed-off-by: Christoph Hellwig Signed-off-by: Paul Mackerras --- include/asm-powerpc/prom.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h index cbd297f44cc..782e13a070a 100644 --- a/include/asm-powerpc/prom.h +++ b/include/asm-powerpc/prom.h @@ -126,8 +126,14 @@ extern struct device_node *find_all_nodes(void); /* New style node lookup */ extern struct device_node *of_find_node_by_name(struct device_node *from, const char *name); +#define for_each_node_by_name(dn, name) \ + for (dn = of_find_node_by_name(NULL, name); dn; \ + dn = of_find_node_by_name(dn, name)) extern struct device_node *of_find_node_by_type(struct device_node *from, const char *type); +#define for_each_node_by_type(dn, type) \ + for (dn = of_find_node_by_type(NULL, type); dn; \ + dn = of_find_node_by_type(dn, type)) extern struct device_node *of_find_compatible_node(struct device_node *from, const char *type, const char *compat); extern struct device_node *of_find_node_by_path(const char *path); -- cgit v1.2.3 From 3d15910bfbeb02286ce4b5009c53754e88066ccb Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Tue, 21 Mar 2006 20:45:58 +1100 Subject: [PATCH] powerpc: trivial: Cleanup whitespace in cputable.h Remove redundant whitespace in include/asm-powerpc/cputable.h Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- include/asm-powerpc/cputable.h | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/cputable.h b/include/asm-powerpc/cputable.h index aaaeb452770..fe45f6f3a4b 100644 --- a/include/asm-powerpc/cputable.h +++ b/include/asm-powerpc/cputable.h @@ -102,19 +102,19 @@ extern void do_cpu_ftr_fixups(unsigned long offset); #define CPU_FTR_NEED_COHERENT ASM_CONST(0x0000000000020000) #define CPU_FTR_NO_BTIC ASM_CONST(0x0000000000040000) #define CPU_FTR_BIG_PHYS ASM_CONST(0x0000000000080000) -#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000000000100000) +#define CPU_FTR_NODSISRALIGN ASM_CONST(0x0000000000100000) #ifdef __powerpc64__ /* Add the 64b processor unique features in the top half of the word */ -#define CPU_FTR_SLB ASM_CONST(0x0000000100000000) -#define CPU_FTR_16M_PAGE ASM_CONST(0x0000000200000000) -#define CPU_FTR_TLBIEL ASM_CONST(0x0000000400000000) -#define CPU_FTR_NOEXECUTE ASM_CONST(0x0000000800000000) -#define CPU_FTR_IABR ASM_CONST(0x0000002000000000) -#define CPU_FTR_MMCRA ASM_CONST(0x0000004000000000) +#define CPU_FTR_SLB ASM_CONST(0x0000000100000000) +#define CPU_FTR_16M_PAGE ASM_CONST(0x0000000200000000) +#define CPU_FTR_TLBIEL ASM_CONST(0x0000000400000000) +#define CPU_FTR_NOEXECUTE ASM_CONST(0x0000000800000000) +#define CPU_FTR_IABR ASM_CONST(0x0000002000000000) +#define CPU_FTR_MMCRA ASM_CONST(0x0000004000000000) #define CPU_FTR_CTRL ASM_CONST(0x0000008000000000) -#define CPU_FTR_SMT ASM_CONST(0x0000010000000000) -#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000) +#define CPU_FTR_SMT ASM_CONST(0x0000010000000000) +#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0000020000000000) #define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0000040000000000) #define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0000080000000000) #define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0000100000000000) @@ -123,15 +123,15 @@ extern void do_cpu_ftr_fixups(unsigned long offset); #else /* ensure on 32b processors the flags are available for compiling but * don't do anything */ -#define CPU_FTR_SLB ASM_CONST(0x0) -#define CPU_FTR_16M_PAGE ASM_CONST(0x0) -#define CPU_FTR_TLBIEL ASM_CONST(0x0) -#define CPU_FTR_NOEXECUTE ASM_CONST(0x0) -#define CPU_FTR_IABR ASM_CONST(0x0) -#define CPU_FTR_MMCRA ASM_CONST(0x0) +#define CPU_FTR_SLB ASM_CONST(0x0) +#define CPU_FTR_16M_PAGE ASM_CONST(0x0) +#define CPU_FTR_TLBIEL ASM_CONST(0x0) +#define CPU_FTR_NOEXECUTE ASM_CONST(0x0) +#define CPU_FTR_IABR ASM_CONST(0x0) +#define CPU_FTR_MMCRA ASM_CONST(0x0) #define CPU_FTR_CTRL ASM_CONST(0x0) -#define CPU_FTR_SMT ASM_CONST(0x0) -#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0) +#define CPU_FTR_SMT ASM_CONST(0x0) +#define CPU_FTR_COHERENT_ICACHE ASM_CONST(0x0) #define CPU_FTR_LOCKLESS_TLBIE ASM_CONST(0x0) #define CPU_FTR_MMCRA_SIHV ASM_CONST(0x0) #define CPU_FTR_CI_LARGE_PAGE ASM_CONST(0x0) -- cgit v1.2.3 From 57cfb814f698d30894bc28e22125550193ebe549 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Tue, 21 Mar 2006 20:45:59 +1100 Subject: [PATCH] powerpc: Replace platform_is_lpar() with a firmware feature It has been decreed that platform numbers are evil, so as a step in that direction, replace platform_is_lpar() with a FW_FEATURE_LPAR bit. Currently FW_FEATURE_LPAR really means i/pSeries LPAR, in the future we might have to clean that up if we need to be more specific about what LPAR actually means. But that's another patch ... Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- include/asm-powerpc/firmware.h | 7 ++++--- include/asm-powerpc/processor.h | 1 - 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/firmware.h b/include/asm-powerpc/firmware.h index b7791a1b05d..ce3788224ed 100644 --- a/include/asm-powerpc/firmware.h +++ b/include/asm-powerpc/firmware.h @@ -41,6 +41,7 @@ #define FW_FEATURE_MULTITCE (1UL<<19) #define FW_FEATURE_SPLPAR (1UL<<20) #define FW_FEATURE_ISERIES (1UL<<21) +#define FW_FEATURE_LPAR (1UL<<22) enum { #ifdef CONFIG_PPC64 @@ -51,10 +52,10 @@ enum { FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ | FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN | FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE | - FW_FEATURE_SPLPAR, + FW_FEATURE_SPLPAR | FW_FEATURE_LPAR, FW_FEATURE_PSERIES_ALWAYS = 0, - FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES, - FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES, + FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR, + FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR, FW_FEATURE_POSSIBLE = #ifdef CONFIG_PPC_PSERIES FW_FEATURE_PSERIES_POSSIBLE | diff --git a/include/asm-powerpc/processor.h b/include/asm-powerpc/processor.h index 415fa393b00..1c64a211cf1 100644 --- a/include/asm-powerpc/processor.h +++ b/include/asm-powerpc/processor.h @@ -52,7 +52,6 @@ #ifdef __KERNEL__ #define platform_is_pseries() (_machine == PLATFORM_PSERIES || \ _machine == PLATFORM_PSERIES_LPAR) -#define platform_is_lpar() (!!(_machine & PLATFORM_LPAR)) #if defined(CONFIG_PPC_MULTIPLATFORM) extern int _machine; -- cgit v1.2.3 From 260de22faac4d336ca122ebd0f1e59279d0b1dfd Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Tue, 21 Mar 2006 20:46:02 +1100 Subject: [PATCH] powerpc: iseries: mf related cleanups Some cleanups in the iSeries code. - Make mf_display_progress() check mf_initialized rather than the caller. - Set mf_initialized in mf_init() rather than in setup.c - Then move mf_initialized into mf.c, the only place it's used. - Move the mf related logic from iSeries_progress() to mf_display_progress() - Use a #define to size the pending_event_prealloc array - Use that define in the initialsation loop rather than sizeof jiggery pokery - Remove stupid comment(s) - Mark stuff static and/or __init Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- include/asm-powerpc/iseries/mf.h | 1 - 1 file changed, 1 deletion(-) (limited to 'include') diff --git a/include/asm-powerpc/iseries/mf.h b/include/asm-powerpc/iseries/mf.h index 857e5202fc7..335e163daaf 100644 --- a/include/asm-powerpc/iseries/mf.h +++ b/include/asm-powerpc/iseries/mf.h @@ -45,7 +45,6 @@ extern void mf_reboot(void); extern void mf_display_src(u32 word); extern void mf_display_progress(u16 value); -extern void mf_clear_src(void); extern void mf_init(void); -- cgit v1.2.3 From a9ea2101aaa7fe73cb352cea4145853efdabaa0d Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Tue, 21 Mar 2006 20:46:04 +1100 Subject: [PATCH] powerpc: iseries: Remove pointless iSeries_(restart|power_off|halt) These routines just call through to the mf routines, so point ppc_md straight at the mf routines. We need to pass the cmd through to mf_reboot to make it work, but that seems reasonable. Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- include/asm-powerpc/iseries/mf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') diff --git a/include/asm-powerpc/iseries/mf.h b/include/asm-powerpc/iseries/mf.h index 335e163daaf..89f3282df04 100644 --- a/include/asm-powerpc/iseries/mf.h +++ b/include/asm-powerpc/iseries/mf.h @@ -41,7 +41,7 @@ extern void mf_deallocate_lp_events(HvLpIndex targetLp, HvLpEvent_Type type, unsigned count, MFCompleteHandler hdlr, void *userToken); extern void mf_power_off(void); -extern void mf_reboot(void); +extern void mf_reboot(char *cmd); extern void mf_display_src(u32 word); extern void mf_display_progress(u16 value); -- cgit v1.2.3 From 00611c5cfc8dea0914c65134f62948a484780a30 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Tue, 21 Mar 2006 20:46:05 +1100 Subject: [PATCH] powerpc: iseries: Make more stuff static in platforms/iseries/mf.c Make mf_get_rtc(), mf_get_boot_rtc() and mf_set_rtc() static, cause they can be. We need to move mf_set_rtc() to avoid a forward declaration. Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- include/asm-powerpc/iseries/mf.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/iseries/mf.h b/include/asm-powerpc/iseries/mf.h index 89f3282df04..eb851a9c9e5 100644 --- a/include/asm-powerpc/iseries/mf.h +++ b/include/asm-powerpc/iseries/mf.h @@ -48,8 +48,4 @@ extern void mf_display_progress(u16 value); extern void mf_init(void); -extern int mf_get_rtc(struct rtc_time *tm); -extern int mf_get_boot_rtc(struct rtc_time *tm); -extern int mf_set_rtc(struct rtc_time *tm); - #endif /* _ASM_POWERPC_ISERIES_MF_H */ -- cgit v1.2.3 From 584fc6d111c34a9a2512f6c7652dff29232bf70d Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Tue, 21 Mar 2006 20:46:08 +1100 Subject: [PATCH] powerpc: Add strne2a() to convert a string from EBCDIC to ASCII Add strne2a() which converts a string from EBCDIC to ASCII. Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- include/asm-powerpc/system.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/asm-powerpc/system.h b/include/asm-powerpc/system.h index 41b7a5b3d70..65f5a7b2646 100644 --- a/include/asm-powerpc/system.h +++ b/include/asm-powerpc/system.h @@ -171,6 +171,8 @@ extern u32 booke_wdt_period; /* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */ extern unsigned char e2a(unsigned char); +extern unsigned char* strne2a(unsigned char *dest, + const unsigned char *src, size_t n); struct device_node; extern void note_scsi_host(struct device_node *, void *); -- cgit v1.2.3 From f8642ebee8e46d054d83828a4048fba4ebcd8f68 Mon Sep 17 00:00:00 2001 From: Michael Ellerman Date: Tue, 21 Mar 2006 20:46:11 +1100 Subject: [PATCH] powerpc: Remove calculation of io hole In mm_init_ppc64() we calculate the location of the "IO hole", but then no one ever looks at the value. So don't bother. That's actually all mm_init_ppc64() does, so get rid of it too. Signed-off-by: Michael Ellerman Signed-off-by: Paul Mackerras --- include/asm-powerpc/lmb.h | 2 -- include/asm-powerpc/mmu.h | 1 - 2 files changed, 3 deletions(-) (limited to 'include') diff --git a/include/asm-powerpc/lmb.h b/include/asm-powerpc/lmb.h index 377ac1b23aa..0c5880f7022 100644 --- a/include/asm-powerpc/lmb.h +++ b/include/asm-powerpc/lmb.h @@ -54,8 +54,6 @@ extern void __init lmb_enforce_memory_limit(unsigned long memory_limit); extern void lmb_dump_all(void); -extern unsigned long io_hole_start; - static inline unsigned long lmb_size_bytes(struct lmb_region *type, unsigned long region_nr) { diff --git a/include/asm-powerpc/mmu.h b/include/asm-powerpc/mmu.h index b0b9a3f8cdc..31f721994bd 100644 --- a/include/asm-powerpc/mmu.h +++ b/include/asm-powerpc/mmu.h @@ -236,7 +236,6 @@ extern void htab_initialize_secondary(void); extern void hpte_init_native(void); extern void hpte_init_lpar(void); extern void hpte_init_iSeries(void); -extern void mm_init_ppc64(void); extern long pSeries_lpar_hpte_insert(unsigned long hpte_group, unsigned long va, unsigned long prpn, -- cgit v1.2.3