From 64f495323c9a902b3e59fe0a588585102bb3b13e Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Sat, 22 Apr 2006 00:48:22 -0600 Subject: [PARISC] Ensure all ldcw uses are ldcw,co on pa2.0 ldcw,co should always be used on pa2.0, otherwise the strict cache width alignment requirement is not relaxed. Signed-off-by: Kyle McMartin --- include/asm-parisc/assembly.h | 2 ++ include/asm-parisc/system.h | 26 ++++++++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'include/asm-parisc') diff --git a/include/asm-parisc/assembly.h b/include/asm-parisc/assembly.h index 3ce3440..1a7bfe6 100644 --- a/include/asm-parisc/assembly.h +++ b/include/asm-parisc/assembly.h @@ -48,6 +48,7 @@ #define CALLEE_SAVE_FRAME_SIZE (CALLEE_REG_FRAME_SIZE + CALLEE_FLOAT_FRAME_SIZE) #ifdef CONFIG_PA20 +#define LDCW ldcw,co #define BL b,l # ifdef CONFIG_64BIT # define LEVEL 2.0w @@ -55,6 +56,7 @@ # define LEVEL 2.0 # endif #else +#define LDCW ldcw #define BL bl #define LEVEL 1.1 #endif diff --git a/include/asm-parisc/system.h b/include/asm-parisc/system.h index 8638761..5fe2d23 100644 --- a/include/asm-parisc/system.h +++ b/include/asm-parisc/system.h @@ -155,13 +155,14 @@ static inline void set_eiem(unsigned long val) type and dynamically select the 16-byte aligned int from the array for the semaphore. */ -#define __PA_LDCW_ALIGNMENT 16 -#define __ldcw_align(a) ({ \ - unsigned long __ret = (unsigned long) &(a)->lock[0]; \ - __ret = (__ret + __PA_LDCW_ALIGNMENT - 1) & ~(__PA_LDCW_ALIGNMENT - 1); \ - (volatile unsigned int *) __ret; \ +#define __PA_LDCW_ALIGNMENT 16 +#define __ldcw_align(a) ({ \ + unsigned long __ret = (unsigned long) &(a)->lock[0]; \ + __ret = (__ret + __PA_LDCW_ALIGNMENT - 1) \ + & ~(__PA_LDCW_ALIGNMENT - 1); \ + (volatile unsigned int *) __ret; \ }) -#define LDCW "ldcw" +#define __LDCW "ldcw" #else /*CONFIG_PA20*/ /* From: "Jim Hull" @@ -171,17 +172,18 @@ static inline void set_eiem(unsigned long val) they only require "natural" alignment (4-byte for ldcw, 8-byte for ldcd). */ -#define __PA_LDCW_ALIGNMENT 4 +#define __PA_LDCW_ALIGNMENT 4 #define __ldcw_align(a) ((volatile unsigned int *)a) -#define LDCW "ldcw,co" +#define __LDCW "ldcw,co" #endif /*!CONFIG_PA20*/ /* LDCW, the only atomic read-write operation PA-RISC has. *sigh*. */ -#define __ldcw(a) ({ \ - unsigned __ret; \ - __asm__ __volatile__(LDCW " 0(%1),%0" : "=r" (__ret) : "r" (a)); \ - __ret; \ +#define __ldcw(a) ({ \ + unsigned __ret; \ + __asm__ __volatile__(__LDCW " 0(%1),%0" \ + : "=r" (__ret) : "r" (a)); \ + __ret; \ }) #ifdef CONFIG_SMP -- cgit v1.1 From c8224e0074f1dce12e95e53ca469f6fe49cc9101 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Fri, 21 Apr 2006 02:20:37 +0000 Subject: [PARISC] Whitespace clean up in asm/pgtable.h Signed-off-by: Kyle McMartin --- include/asm-parisc/pgtable.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'include/asm-parisc') diff --git a/include/asm-parisc/pgtable.h b/include/asm-parisc/pgtable.h index b6bcc67..5066c54 100644 --- a/include/asm-parisc/pgtable.h +++ b/include/asm-parisc/pgtable.h @@ -506,13 +506,13 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, /* TLB page size encoding - see table 3-1 in parisc20.pdf */ #define _PAGE_SIZE_ENCODING_4K 0 -#define _PAGE_SIZE_ENCODING_16K 1 -#define _PAGE_SIZE_ENCODING_64K 2 +#define _PAGE_SIZE_ENCODING_16K 1 +#define _PAGE_SIZE_ENCODING_64K 2 #define _PAGE_SIZE_ENCODING_256K 3 #define _PAGE_SIZE_ENCODING_1M 4 #define _PAGE_SIZE_ENCODING_4M 5 -#define _PAGE_SIZE_ENCODING_16M 6 -#define _PAGE_SIZE_ENCODING_64M 7 +#define _PAGE_SIZE_ENCODING_16M 6 +#define _PAGE_SIZE_ENCODING_64M 7 #if defined(CONFIG_PARISC_PAGE_SIZE_4KB) # define _PAGE_SIZE_ENCODING_DEFAULT _PAGE_SIZE_ENCODING_4K -- cgit v1.1 From 3fd3a74f45c935f7d6d5c2fb48f06324b18826b7 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Sat, 22 Apr 2006 14:47:21 -0600 Subject: [PARISC] Use FIXUP_BRANCH_CLOBBER to asm clobber list Joel Soete noticed correctly that the fixup's clobbers must be listed as the ASM clobbers. FIXUP_BRANCH in unaligned.c has a new macro which lists all the clobbers in the fixup, we use this throughout the file to simplify the process of listing clobbers in the future. A missing "r1" clobber is added to our uaccess.h for the 64-bit __put_kernel_asm. Interestingly this is a pretty serious bug since gcc generates pretty good use of r1 as a temporary and the uses of __put_kernel_asm are varied and dangerous if r1 is scratched during an invalid write. Signed-off-by: Joel Soete Signed-off-by: Carlos O'Donell Signed-off-by: Kyle McMartin --- include/asm-parisc/uaccess.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/asm-parisc') diff --git a/include/asm-parisc/uaccess.h b/include/asm-parisc/uaccess.h index f6c417c..d973e8b 100644 --- a/include/asm-parisc/uaccess.h +++ b/include/asm-parisc/uaccess.h @@ -172,7 +172,11 @@ struct exception_data { /* * The "__put_user/kernel_asm()" macros tell gcc they read from memory * instead of writing. This is because they do not write to any memory - * gcc knows about, so there are no aliasing issues. + * gcc knows about, so there are no aliasing issues. These macros must + * also be aware that "fixup_put_user_skip_[12]" are executed in the + * context of the fault, and any registers used there must be listed + * as clobbers. In this case only "r1" is used by the current routines. + * r8/r9 are already listed as err/val. */ #ifdef __LP64__ @@ -183,7 +187,8 @@ struct exception_data { "\t.dword\t1b,fixup_put_user_skip_1\n" \ "\t.previous" \ : "=r"(__pu_err) \ - : "r"(ptr), "r"(x), "0"(__pu_err)) + : "r"(ptr), "r"(x), "0"(__pu_err) \ + : "r1") #define __put_user_asm(stx,x,ptr) \ __asm__ __volatile__ ( \ -- cgit v1.1 From 1b6d1b5e073ad9313ad64da49dff649f5c06e546 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Fri, 19 May 2006 20:18:17 +0000 Subject: [PARISC] Use MFIA in current_text_addr on pa2.0 processors Signed-off-by: Kyle McMartin --- include/asm-parisc/processor.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'include/asm-parisc') diff --git a/include/asm-parisc/processor.h b/include/asm-parisc/processor.h index ca49dc9..b73626f 100644 --- a/include/asm-parisc/processor.h +++ b/include/asm-parisc/processor.h @@ -26,14 +26,12 @@ * Default implementation of macro that returns current * instruction pointer ("program counter"). */ - -/* We cannot use MFIA as it was added for PA2.0 - prumpf - - At one point there were no "0f/0b" type local symbols in gas for - PA-RISC. This is no longer true, but this still seems like the - nicest way to implement this. */ - -#define current_text_addr() ({ void *pc; __asm__("\n\tblr 0,%0\n\tnop":"=r" (pc)); pc; }) +#ifdef CONFIG_PA20 +#define current_ia(x) __asm__("mfia %0" : "=r"(x)) +#else /* mfia added in pa2.0 */ +#define current_ia(x) __asm__("blr 0,%0\n\tnop" : "=r"(x)) +#endif +#define current_text_addr() ({ void *pc; current_ia(pc); pc; }) #define TASK_SIZE (current->thread.task_size) #define TASK_UNMAPPED_BASE (current->thread.map_base) -- cgit v1.1 From c95f2e5f2f6f61d734a025414c9eb81872a5c831 Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Wed, 21 Jun 2006 03:43:52 +0000 Subject: [PARISC] Remove unconditional #define PIC in syscall macros Signed-off-by: Carlos O'Donell Signed-off-by: Kyle McMartin --- include/asm-parisc/unistd.h | 5 ----- 1 file changed, 5 deletions(-) (limited to 'include/asm-parisc') diff --git a/include/asm-parisc/unistd.h b/include/asm-parisc/unistd.h index 12b8672..27bcfad 100644 --- a/include/asm-parisc/unistd.h +++ b/include/asm-parisc/unistd.h @@ -797,11 +797,6 @@ #define SYS_ify(syscall_name) __NR_##syscall_name -/* Assume all syscalls are done from PIC code just to be - * safe. The worst case scenario is that you lose a register - * and save/restore r19 across the syscall. */ -#define PIC - #ifndef ASM_LINE_SEP # define ASM_LINE_SEP ; #endif -- cgit v1.1 From 8ffaeaf42e91930888df09d696a8a6ebe056d0e0 Mon Sep 17 00:00:00 2001 From: Thibaut Varene Date: Wed, 3 May 2006 17:27:35 -0600 Subject: [PARISC] PDC_CHASSIS is implemented on all machines This patch removes a limitation of the original code, so that CHASSIS codes can be sent to all machines. On machines with a LCD panel, this code displays "INI" during bootup, "RUN" when the system is booted and running, "FLT" when a panic occurs, etc. This part of the code can be enabled/disabled through CONFIG_PDC_CHASSIS This patch also adds minimalistic support for Chassis warnings, through a proc entry '/proc/chassis', which will reflect the warnings status (PSU or fans failure when they happen, NVRAM battery level and temperature thresholds overflows). This part of the code can be enabled/disabled through CONFIG_PDC_CHASSIS_WARN Signed-off-by: Thibaut VARENE Signed-off-by: Kyle McMartin --- include/asm-parisc/pdc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/asm-parisc') diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h index 08364f9..7d8a71a 100644 --- a/include/asm-parisc/pdc.h +++ b/include/asm-parisc/pdc.h @@ -719,6 +719,7 @@ void setup_pdc(void); /* in inventory.c */ int pdc_add_valid(unsigned long address); int pdc_chassis_info(struct pdc_chassis_info *chassis_info, void *led_info, unsigned long len); int pdc_chassis_disp(unsigned long disp); +int pdc_chassis_warn(unsigned long *warn); int pdc_coproc_cfg(struct pdc_coproc_cfg *pdc_coproc_info); int pdc_iodc_read(unsigned long *actcnt, unsigned long hpa, unsigned int index, void *iodc_data, unsigned int iodc_data_size); -- cgit v1.1 From a3ea84fabacd9cc5bcc3fda67c35e692ca10dc8c Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Fri, 16 Jun 2006 19:10:02 +0000 Subject: [PARISC] Add is_compat_task() helper ... And convert signal.c and ptrace.c to use it instead of open coded equivalents. Signed-off-by: Kyle McMartin --- include/asm-parisc/compat.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/asm-parisc') diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h index 289624d..71b4eee 100644 --- a/include/asm-parisc/compat.h +++ b/include/asm-parisc/compat.h @@ -5,6 +5,7 @@ */ #include #include +#include #define COMPAT_USER_HZ 100 @@ -149,4 +150,14 @@ static __inline__ void __user *compat_alloc_user_space(long len) return (void __user *)regs->gr[30]; } +static inline int __is_compat_task(struct task_struct *t) +{ + return personality(t->personality) == PER_LINUX32; +} + +static inline int is_compat_task(void) +{ + return __is_compat_task(current); +} + #endif /* _ASM_PARISC_COMPAT_H */ -- cgit v1.1 From e5a2e7fdb53028ce187c0ce0ae0d45ca7546fd5e Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Wed, 14 Jun 2006 20:26:25 +0000 Subject: [PARISC] Match show_cache_info with reality show_cache_info and struct pdc_cache_cf were out of sync with published documentation. Fix the reporting of cache associativity and update the pdc_cache_cf bitfields to match documentation. Signed-off-by: Kyle McMartin --- include/asm-parisc/pdc.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'include/asm-parisc') diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h index 7d8a71a..592f13b 100644 --- a/include/asm-parisc/pdc.h +++ b/include/asm-parisc/pdc.h @@ -352,8 +352,8 @@ struct pdc_cache_cf { /* for PDC_CACHE (I/D-caches) */ cc_wt : 1, /* 0 = WT-Dcache, 1 = WB-Dcache */ cc_sh : 2, /* 0 = separate I/D-cache, else shared I/D-cache */ cc_cst : 3, /* 0 = incoherent D-cache, 1=coherent D-cache */ - cc_pad1 : 5, /* reserved */ - cc_assoc: 8; /* associativity of I/D-cache */ + cc_pad1 : 10, /* reserved */ + cc_hv : 3; /* hversion dependent */ }; struct pdc_tlb_cf { /* for PDC_CACHE (I/D-TLB's) */ -- cgit v1.1 From a9d2d386c42b816a81eb1d02dfb7b502ba8cea82 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Fri, 16 Jun 2006 18:20:00 -0400 Subject: [PARISC] Ensure Space ID hashing is turned off Check PDC_CACHE to see if spaceid hashing is turned on, and fail to boot if that is the case. However, some old machines do not implement the PDC_CACHE_RET_SPID firmware call, so continue to boot if the call fails because of PDC_BAD_OPTION (but fail in all other error returns). Signed-off-by: Kyle McMartin --- include/asm-parisc/pdc.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/asm-parisc') diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h index 592f13b..3d3446e 100644 --- a/include/asm-parisc/pdc.h +++ b/include/asm-parisc/pdc.h @@ -733,6 +733,7 @@ int pdc_model_cpuid(unsigned long *cpu_id); int pdc_model_versions(unsigned long *versions, int id); int pdc_model_capabilities(unsigned long *capabilities); int pdc_cache_info(struct pdc_cache_info *cache); +int pdc_spaceid_bits(unsigned long *space_bits); #ifndef CONFIG_PA20 int pdc_btlb_info(struct pdc_btlb_info *btlb); int pdc_mem_map_hpa(struct pdc_memory_map *r_addr, struct pdc_module_path *mod_path); -- cgit v1.1 From ec1fdc24c2ae012b078ba0187ceef208e08a3aec Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Wed, 21 Jun 2006 19:27:29 +0000 Subject: [PARISC] OS_ID_LINUX == 0x0006 We were assigned an OS_ID of 0x0006. Consistently use OS_ID_LINUX instead of using the magic number. Also update the OS_ID_ defines in asm/pdc.h to reflect this. Signed-off-by: Kyle McMartin --- include/asm-parisc/pdc.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'include/asm-parisc') diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h index 3d3446e..33bff61 100644 --- a/include/asm-parisc/pdc.h +++ b/include/asm-parisc/pdc.h @@ -278,12 +278,11 @@ typedef struct { /* constants for OS (NVM...) */ #define OS_ID_NONE 0 /* Undefined OS ID */ #define OS_ID_HPUX 1 /* HP-UX OS */ -#define OS_ID_LINUX OS_ID_HPUX /* just use the same value as hpux */ #define OS_ID_MPEXL 2 /* MPE XL OS */ #define OS_ID_OSF 3 /* OSF OS */ #define OS_ID_HPRT 4 /* HP-RT OS */ #define OS_ID_NOVEL 5 /* NOVELL OS */ -#define OS_ID_NT 6 /* NT OS */ +#define OS_ID_LINUX 6 /* Linux */ /* constants for PDC_CHASSIS */ -- cgit v1.1 From 67a061a191017f984a1ef0ff73ae988b9b15f6d3 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Sun, 25 Jun 2006 16:58:57 +0000 Subject: [PARISC] Add os_id_to_string helper Add a helper to asm/pdc.h to translate OS_ID values to strings and use it in the pdc_stable driver. Signed-off-by: Kyle McMartin --- include/asm-parisc/pdc.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/asm-parisc') diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h index 33bff61..7a21f10 100644 --- a/include/asm-parisc/pdc.h +++ b/include/asm-parisc/pdc.h @@ -284,6 +284,19 @@ typedef struct { #define OS_ID_NOVEL 5 /* NOVELL OS */ #define OS_ID_LINUX 6 /* Linux */ +static inline char * os_id_to_string(u16 os_id) { + switch(os_id) { + case OS_ID_NONE: return "No OS"; + case OS_ID_HPUX: return "HP-UX"; + case OS_ID_MPEXL: return "MPE-iX"; + case OS_ID_OSF: return "OSF"; + case OS_ID_HPRT: return "HP-RT"; + case OS_ID_NOVEL: return "Novell Netware"; + case OS_ID_LINUX: return "Linux"; + default: return "Unknown"; + } +} + /* constants for PDC_CHASSIS */ #define OSTAT_OFF 0 -- cgit v1.1 From c1a7a755be26f68d7f21ee769584149a96185ea8 Mon Sep 17 00:00:00 2001 From: Kyle McMartin Date: Mon, 26 Jun 2006 11:28:09 -0400 Subject: [PARISC] Move os_id_to_string() inside #ifndef __ASSEMBLY__ Assembly files should be protected from os_id_to_string()... Pass me a brown paper bag, please. Signed-off-by: Kyle McMartin --- include/asm-parisc/pdc.h | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'include/asm-parisc') diff --git a/include/asm-parisc/pdc.h b/include/asm-parisc/pdc.h index 7a21f10..c9b2e35 100644 --- a/include/asm-parisc/pdc.h +++ b/include/asm-parisc/pdc.h @@ -284,19 +284,6 @@ typedef struct { #define OS_ID_NOVEL 5 /* NOVELL OS */ #define OS_ID_LINUX 6 /* Linux */ -static inline char * os_id_to_string(u16 os_id) { - switch(os_id) { - case OS_ID_NONE: return "No OS"; - case OS_ID_HPUX: return "HP-UX"; - case OS_ID_MPEXL: return "MPE-iX"; - case OS_ID_OSF: return "OSF"; - case OS_ID_HPRT: return "HP-RT"; - case OS_ID_NOVEL: return "Novell Netware"; - case OS_ID_LINUX: return "Linux"; - default: return "Unknown"; - } -} - /* constants for PDC_CHASSIS */ #define OSTAT_OFF 0 @@ -789,6 +776,18 @@ int pdc_sti_call(unsigned long func, unsigned long flags, extern void pdc_init(void); +static inline char * os_id_to_string(u16 os_id) { + switch(os_id) { + case OS_ID_NONE: return "No OS"; + case OS_ID_HPUX: return "HP-UX"; + case OS_ID_MPEXL: return "MPE-iX"; + case OS_ID_OSF: return "OSF"; + case OS_ID_HPRT: return "HP-RT"; + case OS_ID_NOVEL: return "Novell Netware"; + case OS_ID_LINUX: return "Linux"; + default: return "Unknown"; + } +} #endif /* __ASSEMBLY__ */ #endif /* _PARISC_PDC_H */ -- cgit v1.1