Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc

* git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (114 commits)
[POWERPC] Fix ohare IDE irq workaround on old powermacs
[POWERPC] EEH: Power4 systems sometimes need multiple resets.
[POWERPC] Include <asm/mmu.h> in arch/powerpc/sysdev/fsl_soc.h for phys_addr_t.
[POWERPC] Demacrofy arch/powerpc/platforms/maple/pci.c
[POWERPC] Maple U3 HT - reject inappropriate config space access
[POWERPC] Fix IPIC pending register assignments
[POWERPC] powerpc: fix building gdb against asm/ptrace.h
[POWERPC] Remove DISCONTIGMEM cruft from page.h
[POWERPC] Merge iSeries i/o operations with the rest
[POWERPC] 40x: Fix debug status register defines
[POWERPC] Fix compile error in sbc8560
[POWERPC] EEH: support MMIO enable recovery step
[POWERPC] EEH: enable MMIO/DMA on frozen slot
[POWERPC] EEH: code comment cleanup
[POWERPC] EEH: balance pcidev_get/put calls
[POWERPC] PPC: Fix xmon stack frame address in backtrace
[POWERPC] Add AT_PLATFORM value for Xilinx Virtex-4 FX
[POWERPC] Start arch/powerpc/boot code reorganization
[POWERPC] Define of_read_ulong helper
[POWERPC] iseries: eliminate a couple of warnings
...

+4346 -2454
+7
MAINTAINERS
··· 1783 1783 L: linuxppc-embedded@ozlabs.org 1784 1784 S: Maintained 1785 1785 1786 + LINUX FOR POWERPC PA SEMI PWRFICIENT 1787 + P: Olof Johansson 1788 + M: olof@lixom.net 1789 + W: http://www.pasemi.com/ 1790 + L: linuxppc-dev@ozlabs.org 1791 + S: Supported 1792 + 1786 1793 LLC (802.2) 1787 1794 P: Arnaldo Carvalho de Melo 1788 1795 M: acme@conectiva.com.br
+13 -1
arch/powerpc/Kconfig
··· 417 417 This option enables support for the Maple 970FX Evaluation Board. 418 418 For more informations, refer to <http://www.970eval.com> 419 419 420 + config PPC_PASEMI 421 + depends on PPC_MULTIPLATFORM && PPC64 422 + bool "PA Semi SoC-based platforms" 423 + default n 424 + select MPIC 425 + select PPC_UDBG_16550 426 + select GENERIC_TBSYNC 427 + help 428 + This option enables support for PA Semi's PWRficient line 429 + of SoC processors, including PA6T-1682M 430 + 420 431 config PPC_CELL 421 432 bool 422 433 default n ··· 447 436 select UDBG_RTAS_CONSOLE 448 437 449 438 config UDBG_RTAS_CONSOLE 450 - bool 439 + bool "RTAS based debug console" 440 + depends on PPC_RTAS 451 441 default n 452 442 453 443 config XICS
+16
arch/powerpc/Kconfig.debug
··· 18 18 19 19 This option will slow down process creation somewhat. 20 20 21 + config HCALL_STATS 22 + bool "Hypervisor call instrumentation" 23 + depends on PPC_PSERIES && DEBUG_FS 24 + help 25 + Adds code to keep track of the number of hypervisor calls made and 26 + the amount of time spent in hypervisor callsr. Wall time spent in 27 + each call is always calculated, and if available CPU cycles spent 28 + are also calculated. A directory named hcall_inst is added at the 29 + root of the debugfs filesystem. Within the hcall_inst directory 30 + are files that contain CPU specific call statistics. 31 + 32 + This option will add a small amount of overhead to all hypervisor 33 + calls. 34 + 21 35 config DEBUGGER 22 36 bool "Enable debugger hooks" 23 37 depends on DEBUG_KERNEL ··· 88 74 very early during boot. 'xmon=on' will just enable the xmon 89 75 debugger hooks. 'xmon=off' will disable the debugger hooks 90 76 if CONFIG_XMON_DEFAULT is set. 77 + xmon will print a backtrace on the very first invocation. 78 + 'xmon=nobt' will disable this autobacktrace. 91 79 92 80 config XMON_DEFAULT 93 81 bool "Enable xmon by default"
+6 -1
arch/powerpc/boot/Makefile
··· 36 36 $(addprefix $(obj)/,$(zlib) main.o): $(addprefix $(obj)/,$(zliblinuxheader)) $(addprefix $(obj)/,$(zlibheader)) 37 37 #$(addprefix $(obj)/,main.o): $(addprefix $(obj)/,zlib.h) 38 38 39 - src-boot := crt0.S string.S prom.c stdio.c main.c div64.S 39 + src-boot-$(CONFIG_PPC_MULTIPLATFORM) := of.c 40 + src-boot := crt0.S string.S stdio.c main.c div64.S $(src-boot-y) 40 41 src-boot += $(zlib) 41 42 src-boot := $(addprefix $(obj)/, $(src-boot)) 42 43 obj-boot := $(addsuffix .o, $(basename $(src-boot))) 44 + 45 + ifeq ($(call cc-option-yn, -fstack-protector),y) 46 + BOOTCFLAGS += -fno-stack-protector 47 + endif 43 48 44 49 BOOTCFLAGS += -I$(obj) -I$(srctree)/$(obj) 45 50
+8 -8
arch/powerpc/boot/dts/mpc8349emds.dts
··· 214 214 b800 0 0 4 700 15 8 215 215 216 216 /* IDSEL 0x18 */ 217 - b000 0 0 1 700 15 8 218 - b000 0 0 2 700 16 8 219 - b000 0 0 3 700 17 8 220 - b000 0 0 4 700 14 8>; 217 + c000 0 0 1 700 15 8 218 + c000 0 0 2 700 16 8 219 + c000 0 0 3 700 17 8 220 + c000 0 0 4 700 14 8>; 221 221 interrupt-parent = <700>; 222 222 interrupts = <42 8>; 223 223 bus-range = <0 0>; ··· 274 274 b800 0 0 4 700 15 8 275 275 276 276 /* IDSEL 0x18 */ 277 - b000 0 0 1 700 15 8 278 - b000 0 0 2 700 16 8 279 - b000 0 0 3 700 17 8 280 - b000 0 0 4 700 14 8>; 277 + c000 0 0 1 700 15 8 278 + c000 0 0 2 700 16 8 279 + c000 0 0 3 700 17 8 280 + c000 0 0 4 700 14 8>; 281 281 interrupt-parent = <700>; 282 282 interrupts = <42 8>; 283 283 bus-range = <0 0>;
+46
arch/powerpc/boot/flatdevtree.h
··· 1 + /* 2 + * This program is free software; you can redistribute it and/or modify 3 + * it under the terms of the GNU General Public License as published by 4 + * the Free Software Foundation; either version 2 of the License, or 5 + * (at your option) any later version. 6 + * 7 + * This program is distributed in the hope that it will be useful, 8 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 + * GNU General Public License for more details. 11 + * 12 + * You should have received a copy of the GNU General Public License 13 + * along with this program; if not, write to the Free Software 14 + * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 + */ 16 + 17 + #ifndef FLATDEVTREE_H 18 + #define FLATDEVTREE_H 19 + 20 + #include "types.h" 21 + 22 + /* Definitions used by the flattened device tree */ 23 + #define OF_DT_HEADER 0xd00dfeed /* marker */ 24 + #define OF_DT_BEGIN_NODE 0x1 /* Start of node, full name */ 25 + #define OF_DT_END_NODE 0x2 /* End node */ 26 + #define OF_DT_PROP 0x3 /* Property: name off, size, content */ 27 + #define OF_DT_NOP 0x4 /* nop */ 28 + #define OF_DT_END 0x9 29 + 30 + #define OF_DT_VERSION 0x10 31 + 32 + struct boot_param_header { 33 + u32 magic; /* magic word OF_DT_HEADER */ 34 + u32 totalsize; /* total size of DT block */ 35 + u32 off_dt_struct; /* offset to structure */ 36 + u32 off_dt_strings; /* offset to strings */ 37 + u32 off_mem_rsvmap; /* offset to memory reserve map */ 38 + u32 version; /* format version */ 39 + u32 last_comp_version; /* last compatible version */ 40 + /* version 2 fields below */ 41 + u32 boot_cpuid_phys; /* Physical CPU id we're booting on */ 42 + /* version 3 fields below */ 43 + u32 dt_strings_size; /* size of the DT strings block */ 44 + }; 45 + 46 + #endif /* FLATDEVTREE_H */
+133 -125
arch/powerpc/boot/main.c
··· 14 14 #include "page.h" 15 15 #include "string.h" 16 16 #include "stdio.h" 17 - #include "prom.h" 18 17 #include "zlib.h" 18 + #include "ops.h" 19 + #include "flatdevtree.h" 19 20 20 21 extern void flush_cache(void *, unsigned long); 21 - 22 - 23 - /* Value picked to match that used by yaboot */ 24 - #define PROG_START 0x01400000 /* only used on 64-bit systems */ 25 - #define RAM_END (512<<20) /* Fixme: use OF */ 26 - #define ONE_MB 0x100000 27 22 28 23 extern char _start[]; 29 24 extern char __bss_start[]; ··· 27 32 extern char _vmlinux_end[]; 28 33 extern char _initrd_start[]; 29 34 extern char _initrd_end[]; 30 - 31 - /* A buffer that may be edited by tools operating on a zImage binary so as to 32 - * edit the command line passed to vmlinux (by setting /chosen/bootargs). 33 - * The buffer is put in it's own section so that tools may locate it easier. 34 - */ 35 - static char builtin_cmdline[512] 36 - __attribute__((section("__builtin_cmdline"))); 37 - 38 35 39 36 struct addr_range { 40 37 unsigned long addr; ··· 38 51 static struct addr_range initrd; 39 52 40 53 static unsigned long elfoffset; 54 + static int is_64bit; 41 55 42 - static char scratch[46912]; /* scratch space for gunzip, from zlib_inflate_workspacesize() */ 56 + /* scratch space for gunzip; 46912 is from zlib_inflate_workspacesize() */ 57 + static char scratch[46912]; 43 58 static char elfheader[256]; 44 59 45 - 46 - typedef void (*kernel_entry_t)( unsigned long, 47 - unsigned long, 48 - void *, 49 - void *); 50 - 60 + typedef void (*kernel_entry_t)(unsigned long, unsigned long, void *); 51 61 52 62 #undef DEBUG 53 - 54 - static unsigned long claim_base; 55 63 56 64 #define HEAD_CRC 2 57 65 #define EXTRA_FIELD 4 ··· 105 123 zlib_inflateEnd(&s); 106 124 } 107 125 108 - static unsigned long try_claim(unsigned long size) 109 - { 110 - unsigned long addr = 0; 111 - 112 - for(; claim_base < RAM_END; claim_base += ONE_MB) { 113 - #ifdef DEBUG 114 - printf(" trying: 0x%08lx\n\r", claim_base); 115 - #endif 116 - addr = (unsigned long)claim(claim_base, size, 0); 117 - if ((void *)addr != (void *)-1) 118 - break; 119 - } 120 - if (addr == 0) 121 - return 0; 122 - claim_base = PAGE_ALIGN(claim_base + size); 123 - return addr; 124 - } 125 - 126 126 static int is_elf64(void *hdr) 127 127 { 128 128 Elf64_Ehdr *elf64 = hdr; ··· 133 169 vmlinux.size = (unsigned long)elf64ph->p_filesz + elfoffset; 134 170 vmlinux.memsize = (unsigned long)elf64ph->p_memsz + elfoffset; 135 171 136 - #if defined(PROG_START) 137 - /* 138 - * Maintain a "magic" minimum address. This keeps some older 139 - * firmware platforms running. 140 - */ 141 - 142 - if (claim_base < PROG_START) 143 - claim_base = PROG_START; 144 - #endif 145 - 172 + is_64bit = 1; 146 173 return 1; 147 174 } 148 175 ··· 167 212 return 1; 168 213 } 169 214 170 - void export_cmdline(void* chosen_handle) 171 - { 172 - int len; 173 - char cmdline[2] = { 0, 0 }; 174 - 175 - if (builtin_cmdline[0] == 0) 176 - return; 177 - 178 - len = getprop(chosen_handle, "bootargs", cmdline, sizeof(cmdline)); 179 - if (len > 0 && cmdline[0] != 0) 180 - return; 181 - 182 - setprop(chosen_handle, "bootargs", builtin_cmdline, 183 - strlen(builtin_cmdline) + 1); 184 - } 185 - 186 - 187 - void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) 215 + static void prep_kernel(unsigned long *a1, unsigned long *a2) 188 216 { 189 217 int len; 190 - kernel_entry_t kernel_entry; 191 - 192 - memset(__bss_start, 0, _end - __bss_start); 193 - 194 - prom = (int (*)(void *)) promptr; 195 - chosen_handle = finddevice("/chosen"); 196 - if (chosen_handle == (void *) -1) 197 - exit(); 198 - if (getprop(chosen_handle, "stdout", &stdout, sizeof(stdout)) != 4) 199 - exit(); 200 - 201 - printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", _start, sp); 202 - 203 - /* 204 - * The first available claim_base must be above the end of the 205 - * the loaded kernel wrapper file (_start to _end includes the 206 - * initrd image if it is present) and rounded up to a nice 207 - * 1 MB boundary for good measure. 208 - */ 209 - 210 - claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB); 211 218 212 219 vmlinuz.addr = (unsigned long)_vmlinux_start; 213 220 vmlinuz.size = (unsigned long)(_vmlinux_end - _vmlinux_start); ··· 180 263 gunzip(elfheader, sizeof(elfheader), 181 264 (unsigned char *)vmlinuz.addr, &len); 182 265 } else 183 - memcpy(elfheader, (const void *)vmlinuz.addr, sizeof(elfheader)); 266 + memcpy(elfheader, (const void *)vmlinuz.addr, 267 + sizeof(elfheader)); 184 268 185 269 if (!is_elf64(elfheader) && !is_elf32(elfheader)) { 186 270 printf("Error: not a valid PPC32 or PPC64 ELF file!\n\r"); 187 271 exit(); 188 272 } 273 + if (platform_ops.image_hdr) 274 + platform_ops.image_hdr(elfheader); 189 275 190 - /* We need to claim the memsize plus the file offset since gzip 276 + /* We need to alloc the memsize plus the file offset since gzip 191 277 * will expand the header (file offset), then the kernel, then 192 278 * possible rubbish we don't care about. But the kernel bss must 193 279 * be claimed (it will be zero'd by the kernel itself) 194 280 */ 195 281 printf("Allocating 0x%lx bytes for kernel ...\n\r", vmlinux.memsize); 196 - vmlinux.addr = try_claim(vmlinux.memsize); 282 + vmlinux.addr = (unsigned long)malloc(vmlinux.memsize); 197 283 if (vmlinux.addr == 0) { 198 284 printf("Can't allocate memory for kernel image !\n\r"); 199 285 exit(); 200 286 } 201 287 202 288 /* 203 - * Now we try to claim memory for the initrd (and copy it there) 289 + * Now we try to alloc memory for the initrd (and copy it there) 204 290 */ 205 291 initrd.size = (unsigned long)(_initrd_end - _initrd_start); 206 292 initrd.memsize = initrd.size; 207 293 if ( initrd.size > 0 ) { 208 - printf("Allocating 0x%lx bytes for initrd ...\n\r", initrd.size); 209 - initrd.addr = try_claim(initrd.size); 294 + printf("Allocating 0x%lx bytes for initrd ...\n\r", 295 + initrd.size); 296 + initrd.addr = (unsigned long)malloc((u32)initrd.size); 210 297 if (initrd.addr == 0) { 211 - printf("Can't allocate memory for initial ramdisk !\n\r"); 298 + printf("Can't allocate memory for initial " 299 + "ramdisk !\n\r"); 212 300 exit(); 213 301 } 214 - a1 = initrd.addr; 215 - a2 = initrd.size; 216 - printf("initial ramdisk moving 0x%lx <- 0x%lx (0x%lx bytes)\n\r", 217 - initrd.addr, (unsigned long)_initrd_start, initrd.size); 218 - memmove((void *)initrd.addr, (void *)_initrd_start, initrd.size); 219 - printf("initrd head: 0x%lx\n\r", *((unsigned long *)initrd.addr)); 302 + *a1 = initrd.addr; 303 + *a2 = initrd.size; 304 + printf("initial ramdisk moving 0x%lx <- 0x%lx " 305 + "(0x%lx bytes)\n\r", initrd.addr, 306 + (unsigned long)_initrd_start, initrd.size); 307 + memmove((void *)initrd.addr, (void *)_initrd_start, 308 + initrd.size); 309 + printf("initrd head: 0x%lx\n\r", 310 + *((unsigned long *)initrd.addr)); 220 311 } 221 312 222 313 /* Eventually gunzip the kernel */ ··· 236 311 (unsigned char *)vmlinuz.addr, &len); 237 312 printf("done 0x%lx bytes\n\r", len); 238 313 } else { 239 - memmove((void *)vmlinux.addr,(void *)vmlinuz.addr,vmlinuz.size); 314 + memmove((void *)vmlinux.addr,(void *)vmlinuz.addr, 315 + vmlinuz.size); 240 316 } 241 - 242 - export_cmdline(chosen_handle); 243 317 244 318 /* Skip over the ELF header */ 245 319 #ifdef DEBUG ··· 248 324 vmlinux.addr += elfoffset; 249 325 250 326 flush_cache((void *)vmlinux.addr, vmlinux.size); 251 - 252 - kernel_entry = (kernel_entry_t)vmlinux.addr; 253 - #ifdef DEBUG 254 - printf( "kernel:\n\r" 255 - " entry addr = 0x%lx\n\r" 256 - " a1 = 0x%lx,\n\r" 257 - " a2 = 0x%lx,\n\r" 258 - " prom = 0x%lx,\n\r" 259 - " bi_recs = 0x%lx,\n\r", 260 - (unsigned long)kernel_entry, a1, a2, 261 - (unsigned long)prom, NULL); 262 - #endif 263 - 264 - kernel_entry(a1, a2, prom, NULL); 265 - 266 - printf("Error: Linux kernel returned to zImage bootloader!\n\r"); 267 - 268 - exit(); 269 327 } 270 328 329 + void __attribute__ ((weak)) ft_init(void *dt_blob) 330 + { 331 + } 332 + 333 + /* A buffer that may be edited by tools operating on a zImage binary so as to 334 + * edit the command line passed to vmlinux (by setting /chosen/bootargs). 335 + * The buffer is put in it's own section so that tools may locate it easier. 336 + */ 337 + static char builtin_cmdline[COMMAND_LINE_SIZE] 338 + __attribute__((__section__("__builtin_cmdline"))); 339 + 340 + static void get_cmdline(char *buf, int size) 341 + { 342 + void *devp; 343 + int len = strlen(builtin_cmdline); 344 + 345 + buf[0] = '\0'; 346 + 347 + if (len > 0) { /* builtin_cmdline overrides dt's /chosen/bootargs */ 348 + len = min(len, size-1); 349 + strncpy(buf, builtin_cmdline, len); 350 + buf[len] = '\0'; 351 + } 352 + else if ((devp = finddevice("/chosen"))) 353 + getprop(devp, "bootargs", buf, size); 354 + } 355 + 356 + static void set_cmdline(char *buf) 357 + { 358 + void *devp; 359 + 360 + if ((devp = finddevice("/chosen"))) 361 + setprop(devp, "bootargs", buf, strlen(buf) + 1); 362 + } 363 + 364 + /* Section where ft can be tacked on after zImage is built */ 365 + union blobspace { 366 + struct boot_param_header hdr; 367 + char space[8*1024]; 368 + } dt_blob __attribute__((__section__("__builtin_ft"))); 369 + 370 + struct platform_ops platform_ops; 371 + struct dt_ops dt_ops; 372 + struct console_ops console_ops; 373 + 374 + void start(unsigned long a1, unsigned long a2, void *promptr, void *sp) 375 + { 376 + int have_dt = 0; 377 + kernel_entry_t kentry; 378 + char cmdline[COMMAND_LINE_SIZE]; 379 + 380 + memset(__bss_start, 0, _end - __bss_start); 381 + memset(&platform_ops, 0, sizeof(platform_ops)); 382 + memset(&dt_ops, 0, sizeof(dt_ops)); 383 + memset(&console_ops, 0, sizeof(console_ops)); 384 + 385 + /* Override the dt_ops and device tree if there was an flat dev 386 + * tree attached to the zImage. 387 + */ 388 + if (dt_blob.hdr.magic == OF_DT_HEADER) { 389 + have_dt = 1; 390 + ft_init(&dt_blob); 391 + } 392 + 393 + if (platform_init(promptr)) 394 + exit(); 395 + if (console_ops.open && (console_ops.open() < 0)) 396 + exit(); 397 + if (platform_ops.fixups) 398 + platform_ops.fixups(); 399 + 400 + printf("\n\rzImage starting: loaded at 0x%p (sp: 0x%p)\n\r", 401 + _start, sp); 402 + 403 + prep_kernel(&a1, &a2); 404 + 405 + /* If cmdline came from zimage wrapper or if we can edit the one 406 + * in the dt, print it out and edit it, if possible. 407 + */ 408 + if ((strlen(builtin_cmdline) > 0) || console_ops.edit_cmdline) { 409 + get_cmdline(cmdline, COMMAND_LINE_SIZE); 410 + printf("\n\rLinux/PowerPC load: %s", cmdline); 411 + if (console_ops.edit_cmdline) 412 + console_ops.edit_cmdline(cmdline, COMMAND_LINE_SIZE); 413 + printf("\n\r"); 414 + set_cmdline(cmdline); 415 + } 416 + 417 + if (console_ops.close) 418 + console_ops.close(); 419 + 420 + kentry = (kernel_entry_t) vmlinux.addr; 421 + if (have_dt) 422 + kentry(dt_ops.ft_addr(), 0, NULL); 423 + else 424 + /* XXX initrd addr/size should be passed in properties */ 425 + kentry(a1, a2, promptr); 426 + 427 + /* console closed so printf below may not work */ 428 + printf("Error: Linux kernel returned to zImage boot wrapper!\n\r"); 429 + exit(); 430 + }
+100
arch/powerpc/boot/ops.h
··· 1 + /* 2 + * Global definition of all the bootwrapper operations. 3 + * 4 + * Author: Mark A. Greer <mgreer@mvista.com> 5 + * 6 + * 2006 (c) MontaVista Software, Inc. This file is licensed under 7 + * the terms of the GNU General Public License version 2. This program 8 + * is licensed "as is" without any warranty of any kind, whether express 9 + * or implied. 10 + */ 11 + #ifndef _PPC_BOOT_OPS_H_ 12 + #define _PPC_BOOT_OPS_H_ 13 + 14 + #include "types.h" 15 + 16 + #define COMMAND_LINE_SIZE 512 17 + #define MAX_PATH_LEN 256 18 + #define MAX_PROP_LEN 256 /* What should this be? */ 19 + 20 + /* Platform specific operations */ 21 + struct platform_ops { 22 + void (*fixups)(void); 23 + void (*image_hdr)(const void *); 24 + void * (*malloc)(u32 size); 25 + void (*free)(void *ptr, u32 size); 26 + void (*exit)(void); 27 + }; 28 + extern struct platform_ops platform_ops; 29 + 30 + /* Device Tree operations */ 31 + struct dt_ops { 32 + void * (*finddevice)(const char *name); 33 + int (*getprop)(const void *node, const char *name, void *buf, 34 + const int buflen); 35 + int (*setprop)(const void *node, const char *name, 36 + const void *buf, const int buflen); 37 + u64 (*translate_addr)(const char *path, const u32 *in_addr, 38 + const u32 addr_len); 39 + unsigned long (*ft_addr)(void); 40 + }; 41 + extern struct dt_ops dt_ops; 42 + 43 + /* Console operations */ 44 + struct console_ops { 45 + int (*open)(void); 46 + void (*write)(char *buf, int len); 47 + void (*edit_cmdline)(char *buf, int len); 48 + void (*close)(void); 49 + void *data; 50 + }; 51 + extern struct console_ops console_ops; 52 + 53 + /* Serial console operations */ 54 + struct serial_console_data { 55 + int (*open)(void); 56 + void (*putc)(unsigned char c); 57 + unsigned char (*getc)(void); 58 + u8 (*tstc)(void); 59 + void (*close)(void); 60 + }; 61 + 62 + extern int platform_init(void *promptr); 63 + extern void simple_alloc_init(void); 64 + extern void ft_init(void *dt_blob); 65 + extern int serial_console_init(void); 66 + 67 + static inline void *finddevice(const char *name) 68 + { 69 + return (dt_ops.finddevice) ? dt_ops.finddevice(name) : NULL; 70 + } 71 + 72 + static inline int getprop(void *devp, const char *name, void *buf, int buflen) 73 + { 74 + return (dt_ops.getprop) ? dt_ops.getprop(devp, name, buf, buflen) : -1; 75 + } 76 + 77 + static inline int setprop(void *devp, const char *name, void *buf, int buflen) 78 + { 79 + return (dt_ops.setprop) ? dt_ops.setprop(devp, name, buf, buflen) : -1; 80 + } 81 + 82 + static inline void *malloc(u32 size) 83 + { 84 + return (platform_ops.malloc) ? platform_ops.malloc(size) : NULL; 85 + } 86 + 87 + static inline void free(void *ptr, u32 size) 88 + { 89 + if (platform_ops.free) 90 + platform_ops.free(ptr, size); 91 + } 92 + 93 + static inline void exit(void) 94 + { 95 + if (platform_ops.exit) 96 + platform_ops.exit(); 97 + for(;;); 98 + } 99 + 100 + #endif /* _PPC_BOOT_OPS_H_ */
+131 -13
arch/powerpc/boot/prom.c arch/powerpc/boot/of.c
··· 8 8 */ 9 9 #include <stdarg.h> 10 10 #include <stddef.h> 11 + #include "types.h" 12 + #include "elf.h" 11 13 #include "string.h" 12 14 #include "stdio.h" 13 - #include "prom.h" 15 + #include "page.h" 16 + #include "ops.h" 14 17 15 - int (*prom)(void *); 16 - phandle chosen_handle; 17 - ihandle stdout; 18 + typedef void *ihandle; 19 + typedef void *phandle; 18 20 19 - int call_prom(const char *service, int nargs, int nret, ...) 21 + extern char _end[]; 22 + 23 + /* Value picked to match that used by yaboot */ 24 + #define PROG_START 0x01400000 /* only used on 64-bit systems */ 25 + #define RAM_END (512<<20) /* Fixme: use OF */ 26 + #define ONE_MB 0x100000 27 + 28 + int (*prom) (void *); 29 + 30 + 31 + static unsigned long claim_base; 32 + 33 + static int call_prom(const char *service, int nargs, int nret, ...) 20 34 { 21 35 int i; 22 36 struct prom_args { ··· 59 45 return (nret > 0)? args.args[nargs]: 0; 60 46 } 61 47 62 - int call_prom_ret(const char *service, int nargs, int nret, 48 + static int call_prom_ret(const char *service, int nargs, int nret, 63 49 unsigned int *rets, ...) 64 50 { 65 51 int i; ··· 91 77 rets[i-1] = args.args[nargs+i]; 92 78 93 79 return (nret > 0)? args.args[nargs]: 0; 94 - } 95 - 96 - int write(void *handle, void *ptr, int nb) 97 - { 98 - return call_prom("write", 3, 1, handle, ptr, nb); 99 80 } 100 81 101 82 /* ··· 151 142 return 1; 152 143 } 153 144 154 - void *claim(unsigned long virt, unsigned long size, unsigned long align) 145 + static void *claim(unsigned long virt, unsigned long size, unsigned long align) 155 146 { 156 147 int ret; 157 148 unsigned int result; ··· 160 151 need_map = check_of_version(); 161 152 if (align || !need_map) 162 153 return (void *) call_prom("claim", 3, 1, virt, size, align); 163 - 154 + 164 155 ret = call_prom_ret("call-method", 5, 2, &result, "claim", memory, 165 156 align, size, virt); 166 157 if (ret != 0 || result == -1) ··· 171 162 ret = call_prom("call-method", 6, 1, "map", chosen_mmu, 172 163 0x12, size, virt, virt); 173 164 return (void *) virt; 165 + } 166 + 167 + static void *of_try_claim(u32 size) 168 + { 169 + unsigned long addr = 0; 170 + static u8 first_time = 1; 171 + 172 + if (first_time) { 173 + claim_base = _ALIGN_UP((unsigned long)_end, ONE_MB); 174 + first_time = 0; 175 + } 176 + 177 + for(; claim_base < RAM_END; claim_base += ONE_MB) { 178 + #ifdef DEBUG 179 + printf(" trying: 0x%08lx\n\r", claim_base); 180 + #endif 181 + addr = (unsigned long)claim(claim_base, size, 0); 182 + if ((void *)addr != (void *)-1) 183 + break; 184 + } 185 + if (addr == 0) 186 + return NULL; 187 + claim_base = PAGE_ALIGN(claim_base + size); 188 + return (void *)addr; 189 + } 190 + 191 + static void of_image_hdr(const void *hdr) 192 + { 193 + const Elf64_Ehdr *elf64 = hdr; 194 + 195 + if (elf64->e_ident[EI_CLASS] == ELFCLASS64) { 196 + /* 197 + * Maintain a "magic" minimum address. This keeps some older 198 + * firmware platforms running. 199 + */ 200 + if (claim_base < PROG_START) 201 + claim_base = PROG_START; 202 + } 203 + } 204 + 205 + static void of_exit(void) 206 + { 207 + call_prom("exit", 0, 0); 208 + } 209 + 210 + /* 211 + * OF device tree routines 212 + */ 213 + static void *of_finddevice(const char *name) 214 + { 215 + return (phandle) call_prom("finddevice", 1, 1, name); 216 + } 217 + 218 + static int of_getprop(const void *phandle, const char *name, void *buf, 219 + const int buflen) 220 + { 221 + return call_prom("getprop", 4, 1, phandle, name, buf, buflen); 222 + } 223 + 224 + static int of_setprop(const void *phandle, const char *name, const void *buf, 225 + const int buflen) 226 + { 227 + return call_prom("setprop", 4, 1, phandle, name, buf, buflen); 228 + } 229 + 230 + /* 231 + * OF console routines 232 + */ 233 + static void *of_stdout_handle; 234 + 235 + static int of_console_open(void) 236 + { 237 + void *devp; 238 + 239 + if (((devp = finddevice("/chosen")) != NULL) 240 + && (getprop(devp, "stdout", &of_stdout_handle, 241 + sizeof(of_stdout_handle)) 242 + == sizeof(of_stdout_handle))) 243 + return 0; 244 + 245 + return -1; 246 + } 247 + 248 + static void of_console_write(char *buf, int len) 249 + { 250 + call_prom("write", 3, 1, of_stdout_handle, buf, len); 251 + } 252 + 253 + int platform_init(void *promptr) 254 + { 255 + platform_ops.fixups = NULL; 256 + platform_ops.image_hdr = of_image_hdr; 257 + platform_ops.malloc = of_try_claim; 258 + platform_ops.free = NULL; 259 + platform_ops.exit = of_exit; 260 + 261 + dt_ops.finddevice = of_finddevice; 262 + dt_ops.getprop = of_getprop; 263 + dt_ops.setprop = of_setprop; 264 + dt_ops.translate_addr = NULL; 265 + 266 + console_ops.open = of_console_open; 267 + console_ops.write = of_console_write; 268 + console_ops.edit_cmdline = NULL; 269 + console_ops.close = NULL; 270 + console_ops.data = NULL; 271 + 272 + prom = (int (*)(void *))promptr; 273 + return 0; 174 274 }
-41
arch/powerpc/boot/prom.h
··· 1 - #ifndef _PPC_BOOT_PROM_H_ 2 - #define _PPC_BOOT_PROM_H_ 3 - 4 - typedef void *phandle; 5 - typedef void *ihandle; 6 - 7 - extern int (*prom) (void *); 8 - extern phandle chosen_handle; 9 - extern ihandle stdout; 10 - 11 - int call_prom(const char *service, int nargs, int nret, ...); 12 - int call_prom_ret(const char *service, int nargs, int nret, 13 - unsigned int *rets, ...); 14 - 15 - extern int write(void *handle, void *ptr, int nb); 16 - extern void *claim(unsigned long virt, unsigned long size, unsigned long aln); 17 - 18 - static inline void exit(void) 19 - { 20 - call_prom("exit", 0, 0); 21 - } 22 - 23 - static inline phandle finddevice(const char *name) 24 - { 25 - return (phandle) call_prom("finddevice", 1, 1, name); 26 - } 27 - 28 - static inline int getprop(void *phandle, const char *name, 29 - void *buf, int buflen) 30 - { 31 - return call_prom("getprop", 4, 1, phandle, name, buf, buflen); 32 - } 33 - 34 - 35 - static inline int setprop(void *phandle, const char *name, 36 - void *buf, int buflen) 37 - { 38 - return call_prom("setprop", 4, 1, phandle, name, buf, buflen); 39 - } 40 - 41 - #endif /* _PPC_BOOT_PROM_H_ */
+2 -2
arch/powerpc/boot/stdio.c
··· 10 10 #include <stddef.h> 11 11 #include "string.h" 12 12 #include "stdio.h" 13 - #include "prom.h" 13 + #include "ops.h" 14 14 15 15 size_t strnlen(const char * s, size_t count) 16 16 { ··· 320 320 va_start(args, fmt); 321 321 n = vsprintf(sprint_buf, fmt, args); 322 322 va_end(args); 323 - write(stdout, sprint_buf, n); 323 + console_ops.write(sprint_buf, n); 324 324 return n; 325 325 }
+8
arch/powerpc/boot/stdio.h
··· 1 1 #ifndef _PPC_BOOT_STDIO_H_ 2 2 #define _PPC_BOOT_STDIO_H_ 3 3 4 + #include <stdarg.h> 5 + 6 + #define ENOMEM 12 /* Out of Memory */ 7 + #define EINVAL 22 /* Invalid argument */ 8 + #define ENOSPC 28 /* No space left on device */ 9 + 4 10 extern int printf(const char *fmt, ...); 11 + 12 + #define fprintf(fmt, args...) printf(args) 5 13 6 14 extern int sprintf(char *buf, const char *fmt, ...); 7 15
+23
arch/powerpc/boot/types.h
··· 1 + #ifndef _TYPES_H_ 2 + #define _TYPES_H_ 3 + 4 + #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 5 + 6 + typedef unsigned char u8; 7 + typedef unsigned short u16; 8 + typedef unsigned int u32; 9 + typedef unsigned long long u64; 10 + 11 + #define min(x,y) ({ \ 12 + typeof(x) _x = (x); \ 13 + typeof(y) _y = (y); \ 14 + (void) (&_x == &_y); \ 15 + _x < _y ? _x : _y; }) 16 + 17 + #define max(x,y) ({ \ 18 + typeof(x) _x = (x); \ 19 + typeof(y) _y = (y); \ 20 + (void) (&_x == &_y); \ 21 + _x > _y ? _x : _y; }) 22 + 23 + #endif /* _TYPES_H_ */
+1 -1
arch/powerpc/configs/maple_defconfig
··· 496 496 # CONFIG_SKY2 is not set 497 497 # CONFIG_SK98LIN is not set 498 498 # CONFIG_VIA_VELOCITY is not set 499 - # CONFIG_TIGON3 is not set 499 + CONFIG_TIGON3=y 500 500 # CONFIG_BNX2 is not set 501 501 # CONFIG_MV643XX_ETH is not set 502 502
+2 -2
arch/powerpc/kernel/Makefile
··· 16 16 obj-y += vdso32/ 17 17 obj-$(CONFIG_PPC64) += setup_64.o binfmt_elf32.o sys_ppc32.o \ 18 18 signal_64.o ptrace32.o \ 19 - paca.o cpu_setup_power4.o \ 19 + paca.o cpu_setup_ppc970.o \ 20 20 firmware.o sysfs.o 21 21 obj-$(CONFIG_PPC64) += vdso64/ 22 22 obj-$(CONFIG_ALTIVEC) += vecemu.o vector.o ··· 51 51 extra-y += vmlinux.lds 52 52 53 53 obj-y += time.o prom.o traps.o setup-common.o \ 54 - udbg.o misc.o 54 + udbg.o misc.o io.o 55 55 obj-$(CONFIG_PPC32) += entry_32.o setup_32.o misc_32.o 56 56 obj-$(CONFIG_PPC64) += misc_64.o dma_64.o iommu.o 57 57 obj-$(CONFIG_PPC_MULTIPLATFORM) += prom_init.o
+16 -1
arch/powerpc/kernel/asm-offsets.c
··· 40 40 #ifdef CONFIG_PPC64 41 41 #include <asm/paca.h> 42 42 #include <asm/lppaca.h> 43 - #include <asm/iseries/hv_lp_event.h> 44 43 #include <asm/cache.h> 45 44 #include <asm/compat.h> 45 + #include <asm/mmu.h> 46 + #include <asm/hvcall.h> 46 47 #endif 47 48 48 49 #define DEFINE(sym, val) \ ··· 137 136 DEFINE(PACA_STARTPURR, offsetof(struct paca_struct, startpurr)); 138 137 DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time)); 139 138 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); 139 + DEFINE(PACA_SLBSHADOWPTR, offsetof(struct paca_struct, slb_shadow_ptr)); 140 + DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset)); 140 141 142 + DEFINE(SLBSHADOW_STACKVSID, 143 + offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].vsid)); 144 + DEFINE(SLBSHADOW_STACKESID, 145 + offsetof(struct slb_shadow, save_area[SLB_NUM_BOLTED - 1].esid)); 141 146 DEFINE(LPPACASRR0, offsetof(struct lppaca, saved_srr0)); 142 147 DEFINE(LPPACASRR1, offsetof(struct lppaca, saved_srr1)); 143 148 DEFINE(LPPACAANYINT, offsetof(struct lppaca, int_dword.any_int)); 144 149 DEFINE(LPPACADECRINT, offsetof(struct lppaca, int_dword.fields.decr_int)); 150 + DEFINE(SLBSHADOW_SAVEAREA, offsetof(struct slb_shadow, save_area)); 145 151 #endif /* CONFIG_PPC64 */ 146 152 147 153 /* RTAS */ ··· 167 159 /* Create extra stack space for SRR0 and SRR1 when calling prom/rtas. */ 168 160 DEFINE(PROM_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16); 169 161 DEFINE(RTAS_FRAME_SIZE, STACK_FRAME_OVERHEAD + sizeof(struct pt_regs) + 16); 162 + 163 + /* hcall statistics */ 164 + DEFINE(HCALL_STAT_SIZE, sizeof(struct hcall_stats)); 165 + DEFINE(HCALL_STAT_CALLS, offsetof(struct hcall_stats, num_calls)); 166 + DEFINE(HCALL_STAT_TB, offsetof(struct hcall_stats, tb_total)); 167 + DEFINE(HCALL_STAT_PURR, offsetof(struct hcall_stats, purr_total)); 170 168 #endif /* CONFIG_PPC64 */ 171 169 DEFINE(GPR0, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[0])); 172 170 DEFINE(GPR1, STACK_FRAME_OVERHEAD+offsetof(struct pt_regs, gpr[1])); ··· 254 240 DEFINE(CPU_SPEC_PVR_VALUE, offsetof(struct cpu_spec, pvr_value)); 255 241 DEFINE(CPU_SPEC_FEATURES, offsetof(struct cpu_spec, cpu_features)); 256 242 DEFINE(CPU_SPEC_SETUP, offsetof(struct cpu_spec, cpu_setup)); 243 + DEFINE(CPU_SPEC_RESTORE, offsetof(struct cpu_spec, cpu_restore)); 257 244 258 245 #ifndef CONFIG_PPC64 259 246 DEFINE(pbe_address, offsetof(struct pbe, address));
+12 -12
arch/powerpc/kernel/btext.c
··· 158 158 { 159 159 unsigned int width, height, depth, pitch; 160 160 unsigned long address = 0; 161 - u32 *prop; 161 + const u32 *prop; 162 162 163 - prop = (u32 *)get_property(np, "linux,bootx-width", NULL); 163 + prop = get_property(np, "linux,bootx-width", NULL); 164 164 if (prop == NULL) 165 - prop = (u32 *)get_property(np, "width", NULL); 165 + prop = get_property(np, "width", NULL); 166 166 if (prop == NULL) 167 167 return -EINVAL; 168 168 width = *prop; 169 - prop = (u32 *)get_property(np, "linux,bootx-height", NULL); 169 + prop = get_property(np, "linux,bootx-height", NULL); 170 170 if (prop == NULL) 171 - prop = (u32 *)get_property(np, "height", NULL); 171 + prop = get_property(np, "height", NULL); 172 172 if (prop == NULL) 173 173 return -EINVAL; 174 174 height = *prop; 175 - prop = (u32 *)get_property(np, "linux,bootx-depth", NULL); 175 + prop = get_property(np, "linux,bootx-depth", NULL); 176 176 if (prop == NULL) 177 - prop = (u32 *)get_property(np, "depth", NULL); 177 + prop = get_property(np, "depth", NULL); 178 178 if (prop == NULL) 179 179 return -EINVAL; 180 180 depth = *prop; 181 181 pitch = width * ((depth + 7) / 8); 182 - prop = (u32 *)get_property(np, "linux,bootx-linebytes", NULL); 182 + prop = get_property(np, "linux,bootx-linebytes", NULL); 183 183 if (prop == NULL) 184 - prop = (u32 *)get_property(np, "linebytes", NULL); 184 + prop = get_property(np, "linebytes", NULL); 185 185 if (prop) 186 186 pitch = *prop; 187 187 if (pitch == 1) 188 188 pitch = 0x1000; 189 - prop = (u32 *)get_property(np, "address", NULL); 189 + prop = get_property(np, "address", NULL); 190 190 if (prop) 191 191 address = *prop; 192 192 ··· 214 214 215 215 int __init btext_find_display(int allow_nonstdout) 216 216 { 217 - char *name; 217 + const char *name; 218 218 struct device_node *np = NULL; 219 219 int rc = -ENODEV; 220 220 221 - name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); 221 + name = get_property(of_chosen, "linux,stdout-path", NULL); 222 222 if (name != NULL) { 223 223 np = of_find_node_by_path(name); 224 224 if (np != NULL) {
+26 -77
arch/powerpc/kernel/cpu_setup_power4.S arch/powerpc/kernel/cpu_setup_ppc970.S
··· 16 16 #include <asm/asm-offsets.h> 17 17 #include <asm/cache.h> 18 18 19 - _GLOBAL(__970_cpu_preinit) 20 - /* 21 - * Do nothing if not running in HV mode 22 - */ 19 + _GLOBAL(__cpu_preinit_ppc970) 20 + /* Do nothing if not running in HV mode */ 23 21 mfmsr r0 24 22 rldicl. r0,r0,4,63 25 23 beqlr 26 - 27 - /* 28 - * Deal only with PPC970 and PPC970FX. 29 - */ 30 - mfspr r0,SPRN_PVR 31 - srwi r0,r0,16 32 - cmpwi r0,0x39 33 - beq 1f 34 - cmpwi r0,0x3c 35 - beq 1f 36 - cmpwi r0,0x44 37 - bnelr 38 - 1: 39 24 40 25 /* Make sure HID4:rm_ci is off before MMU is turned off, that large 41 26 * pages are enabled with HID4:61 and clear HID5:DCBZ_size and ··· 57 72 isync 58 73 blr 59 74 60 - _GLOBAL(__setup_cpu_ppc970) 61 - mfspr r0,SPRN_HID0 62 - li r11,5 /* clear DOZE and SLEEP */ 63 - rldimi r0,r11,52,8 /* set NAP and DPM */ 64 - li r11,0 65 - rldimi r0,r11,32,31 /* clear EN_ATTN */ 66 - mtspr SPRN_HID0,r0 67 - mfspr r0,SPRN_HID0 68 - mfspr r0,SPRN_HID0 69 - mfspr r0,SPRN_HID0 70 - mfspr r0,SPRN_HID0 71 - mfspr r0,SPRN_HID0 72 - mfspr r0,SPRN_HID0 73 - sync 74 - isync 75 - blr 76 - 77 75 /* Definitions for the table use to save CPU states */ 78 76 #define CS_HID0 0 79 77 #define CS_HID1 8 ··· 71 103 .balign L1_CACHE_BYTES,0 72 104 .text 73 105 74 - /* Called in normal context to backup CPU 0 state. This 75 - * does not include cache settings. This function is also 76 - * called for machine sleep. This does not include the MMU 77 - * setup, BATs, etc... but rather the "special" registers 78 - * like HID0, HID1, HID4, etc... 79 - */ 80 - _GLOBAL(__save_cpu_setup) 81 - /* Some CR fields are volatile, we back it up all */ 82 - mfcr r7 83 106 84 - /* Get storage ptr */ 85 - LOAD_REG_IMMEDIATE(r5,cpu_state_storage) 86 - 87 - /* We only deal with 970 for now */ 88 - mfspr r0,SPRN_PVR 89 - srwi r0,r0,16 90 - cmpwi r0,0x39 91 - beq 1f 92 - cmpwi r0,0x3c 93 - beq 1f 94 - cmpwi r0,0x44 95 - bne 2f 96 - 97 - 1: /* skip if not running in HV mode */ 107 + _GLOBAL(__setup_cpu_ppc970) 108 + /* Do nothing if not running in HV mode */ 98 109 mfmsr r0 99 110 rldicl. r0,r0,4,63 100 - beq 2f 111 + beqlr 112 + 113 + mfspr r0,SPRN_HID0 114 + li r11,5 /* clear DOZE and SLEEP */ 115 + rldimi r0,r11,52,8 /* set NAP and DPM */ 116 + li r11,0 117 + rldimi r0,r11,32,31 /* clear EN_ATTN */ 118 + mtspr SPRN_HID0,r0 119 + mfspr r0,SPRN_HID0 120 + mfspr r0,SPRN_HID0 121 + mfspr r0,SPRN_HID0 122 + mfspr r0,SPRN_HID0 123 + mfspr r0,SPRN_HID0 124 + mfspr r0,SPRN_HID0 125 + sync 126 + isync 127 + 128 + /* Save away cpu state */ 129 + LOAD_REG_IMMEDIATE(r5,cpu_state_storage) 101 130 102 131 /* Save HID0,1,4 and 5 */ 103 132 mfspr r3,SPRN_HID0 ··· 106 141 mfspr r3,SPRN_HID5 107 142 std r3,CS_HID5(r5) 108 143 109 - 2: 110 - mtcr r7 111 144 blr 112 145 113 146 /* Called with no MMU context (typically MSR:IR/DR off) to 114 147 * restore CPU state as backed up by the previous 115 148 * function. This does not include cache setting 116 149 */ 117 - _GLOBAL(__restore_cpu_setup) 118 - /* Get storage ptr (FIXME when using anton reloc as we 119 - * are running with translation disabled here 120 - */ 121 - LOAD_REG_IMMEDIATE(r5,cpu_state_storage) 122 - 123 - /* We only deal with 970 for now */ 124 - mfspr r0,SPRN_PVR 125 - srwi r0,r0,16 126 - cmpwi r0,0x39 127 - beq 1f 128 - cmpwi r0,0x3c 129 - beq 1f 130 - cmpwi r0,0x44 131 - bnelr 132 - 133 - 1: /* skip if not running in HV mode */ 150 + _GLOBAL(__restore_cpu_ppc970) 151 + /* Do nothing if not running in HV mode */ 134 152 mfmsr r0 135 153 rldicl. r0,r0,4,63 136 154 beqlr 137 155 156 + LOAD_REG_IMMEDIATE(r5,cpu_state_storage) 138 157 /* Before accessing memory, we make sure rm_ci is clear */ 139 158 li r0,0 140 159 mfspr r3,SPRN_HID4
+21
arch/powerpc/kernel/cputable.c
··· 39 39 extern void __setup_cpu_7410(unsigned long offset, struct cpu_spec* spec); 40 40 extern void __setup_cpu_745x(unsigned long offset, struct cpu_spec* spec); 41 41 #endif /* CONFIG_PPC32 */ 42 + #ifdef CONFIG_PPC64 42 43 extern void __setup_cpu_ppc970(unsigned long offset, struct cpu_spec* spec); 44 + extern void __restore_cpu_ppc970(void); 45 + #endif /* CONFIG_PPC64 */ 43 46 44 47 /* This table only contains "desktop" CPUs, it need to be filled with embedded 45 48 * ones as well... ··· 58 55 #define COMMON_USER_POWER6 (COMMON_USER_PPC64 | PPC_FEATURE_ARCH_2_05 |\ 59 56 PPC_FEATURE_SMT | PPC_FEATURE_ICACHE_SNOOP | \ 60 57 PPC_FEATURE_TRUE_LE) 58 + #define COMMON_USER_PA6T (COMMON_USER_PPC64 | PPC_FEATURE_PA6T |\ 59 + PPC_FEATURE_TRUE_LE | \ 60 + PPC_FEATURE_HAS_ALTIVEC_COMP) 61 61 #define COMMON_USER_BOOKE (PPC_FEATURE_32 | PPC_FEATURE_HAS_MMU | \ 62 62 PPC_FEATURE_BOOKE) 63 63 ··· 190 184 .dcache_bsize = 128, 191 185 .num_pmcs = 8, 192 186 .cpu_setup = __setup_cpu_ppc970, 187 + .cpu_restore = __restore_cpu_ppc970, 193 188 .oprofile_cpu_type = "ppc64/970", 194 189 .oprofile_type = PPC_OPROFILE_POWER4, 195 190 .platform = "ppc970", ··· 206 199 .dcache_bsize = 128, 207 200 .num_pmcs = 8, 208 201 .cpu_setup = __setup_cpu_ppc970, 202 + .cpu_restore = __restore_cpu_ppc970, 209 203 .oprofile_cpu_type = "ppc64/970", 210 204 .oprofile_type = PPC_OPROFILE_POWER4, 211 205 .platform = "ppc970", ··· 222 214 .dcache_bsize = 128, 223 215 .num_pmcs = 8, 224 216 .cpu_setup = __setup_cpu_ppc970, 217 + .cpu_restore = __restore_cpu_ppc970, 225 218 .oprofile_cpu_type = "ppc64/970", 226 219 .oprofile_type = PPC_OPROFILE_POWER4, 227 220 .platform = "ppc970", ··· 288 279 .icache_bsize = 128, 289 280 .dcache_bsize = 128, 290 281 .platform = "ppc-cell-be", 282 + }, 283 + { /* PA Semi PA6T */ 284 + .pvr_mask = 0x7fff0000, 285 + .pvr_value = 0x00900000, 286 + .cpu_name = "PA6T", 287 + .cpu_features = CPU_FTRS_PA6T, 288 + .cpu_user_features = COMMON_USER_PA6T, 289 + .icache_bsize = 64, 290 + .dcache_bsize = 64, 291 + .num_pmcs = 6, 292 + .platform = "pa6t", 291 293 }, 292 294 { /* default match */ 293 295 .pvr_mask = 0x00000000, ··· 949 929 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 950 930 .icache_bsize = 32, 951 931 .dcache_bsize = 32, 932 + .platform = "ppc405", 952 933 }, 953 934 { /* 405EP */ 954 935 .pvr_mask = 0xffff0000,
+1 -1
arch/powerpc/kernel/crash_dump.c
··· 80 80 } 81 81 __setup("savemaxmem=", parse_savemaxmem); 82 82 83 - /* 83 + /** 84 84 * copy_oldmem_page - copy one page from "oldmem" 85 85 * @pfn: page frame number to be copied 86 86 * @buf: target memory address for the copy; this can be in kernel address
+28 -37
arch/powerpc/kernel/dma_64.c
··· 35 35 { 36 36 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 37 37 38 - if (dma_ops) 39 - return dma_ops->dma_supported(dev, mask); 40 - BUG(); 41 - return 0; 38 + BUG_ON(!dma_ops); 39 + 40 + return dma_ops->dma_supported(dev, mask); 42 41 } 43 42 EXPORT_SYMBOL(dma_supported); 44 43 ··· 65 66 { 66 67 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 67 68 68 - if (dma_ops) 69 - return dma_ops->alloc_coherent(dev, size, dma_handle, flag); 70 - BUG(); 71 - return NULL; 69 + BUG_ON(!dma_ops); 70 + 71 + return dma_ops->alloc_coherent(dev, size, dma_handle, flag); 72 72 } 73 73 EXPORT_SYMBOL(dma_alloc_coherent); 74 74 ··· 76 78 { 77 79 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 78 80 79 - if (dma_ops) 80 - dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); 81 - else 82 - BUG(); 81 + BUG_ON(!dma_ops); 82 + 83 + dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); 83 84 } 84 85 EXPORT_SYMBOL(dma_free_coherent); 85 86 ··· 87 90 { 88 91 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 89 92 90 - if (dma_ops) 91 - return dma_ops->map_single(dev, cpu_addr, size, direction); 92 - BUG(); 93 - return (dma_addr_t)0; 93 + BUG_ON(!dma_ops); 94 + 95 + return dma_ops->map_single(dev, cpu_addr, size, direction); 94 96 } 95 97 EXPORT_SYMBOL(dma_map_single); 96 98 ··· 98 102 { 99 103 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 100 104 101 - if (dma_ops) 102 - dma_ops->unmap_single(dev, dma_addr, size, direction); 103 - else 104 - BUG(); 105 + BUG_ON(!dma_ops); 106 + 107 + dma_ops->unmap_single(dev, dma_addr, size, direction); 105 108 } 106 109 EXPORT_SYMBOL(dma_unmap_single); 107 110 ··· 110 115 { 111 116 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 112 117 113 - if (dma_ops) 114 - return dma_ops->map_single(dev, 115 - (page_address(page) + offset), size, direction); 116 - BUG(); 117 - return (dma_addr_t)0; 118 + BUG_ON(!dma_ops); 119 + 120 + return dma_ops->map_single(dev, page_address(page) + offset, size, 121 + direction); 118 122 } 119 123 EXPORT_SYMBOL(dma_map_page); 120 124 ··· 122 128 { 123 129 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 124 130 125 - if (dma_ops) 126 - dma_ops->unmap_single(dev, dma_address, size, direction); 127 - else 128 - BUG(); 131 + BUG_ON(!dma_ops); 132 + 133 + dma_ops->unmap_single(dev, dma_address, size, direction); 129 134 } 130 135 EXPORT_SYMBOL(dma_unmap_page); 131 136 ··· 133 140 { 134 141 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 135 142 136 - if (dma_ops) 137 - return dma_ops->map_sg(dev, sg, nents, direction); 138 - BUG(); 139 - return 0; 143 + BUG_ON(!dma_ops); 144 + 145 + return dma_ops->map_sg(dev, sg, nents, direction); 140 146 } 141 147 EXPORT_SYMBOL(dma_map_sg); 142 148 ··· 144 152 { 145 153 struct dma_mapping_ops *dma_ops = get_dma_ops(dev); 146 154 147 - if (dma_ops) 148 - dma_ops->unmap_sg(dev, sg, nhwentries, direction); 149 - else 150 - BUG(); 155 + BUG_ON(!dma_ops); 156 + 157 + dma_ops->unmap_sg(dev, sg, nhwentries, direction); 151 158 } 152 159 EXPORT_SYMBOL(dma_unmap_sg);
+8
arch/powerpc/kernel/entry_64.S
··· 375 375 ld r7,KSP_VSID(r4) /* Get new stack's VSID */ 376 376 oris r0,r6,(SLB_ESID_V)@h 377 377 ori r0,r0,(SLB_NUM_BOLTED-1)@l 378 + 379 + /* Update the last bolted SLB */ 380 + ld r9,PACA_SLBSHADOWPTR(r13) 381 + li r12,0 382 + std r12,SLBSHADOW_STACKESID(r9) /* Clear ESID */ 383 + std r7,SLBSHADOW_STACKVSID(r9) /* Save VSID */ 384 + std r0,SLBSHADOW_STACKESID(r9) /* Save ESID */ 385 + 378 386 slbie r6 379 387 slbie r6 /* Workaround POWER5 < DD2.1 issue */ 380 388 slbmte r7,r0
+34 -20
arch/powerpc/kernel/head_64.S
··· 132 132 bne 100b 133 133 134 134 #if defined(CONFIG_SMP) || defined(CONFIG_KEXEC) 135 - LOAD_REG_IMMEDIATE(r4, .pSeries_secondary_smp_init) 135 + LOAD_REG_IMMEDIATE(r4, .generic_secondary_smp_init) 136 136 mtctr r4 137 137 mr r3,r24 138 138 bctr ··· 1484 1484 . = 0x8000 1485 1485 1486 1486 /* 1487 - * On pSeries, secondary processors spin in the following code. 1487 + * On pSeries and most other platforms, secondary processors spin 1488 + * in the following code. 1488 1489 * At entry, r3 = this processor's number (physical cpu id) 1489 1490 */ 1490 - _GLOBAL(pSeries_secondary_smp_init) 1491 + _GLOBAL(generic_secondary_smp_init) 1491 1492 mr r24,r3 1492 1493 1493 1494 /* turn on 64-bit mode */ 1494 1495 bl .enable_64b_mode 1495 1496 isync 1496 - 1497 - /* Copy some CPU settings from CPU 0 */ 1498 - bl .__restore_cpu_setup 1499 1497 1500 1498 /* Set up a paca value for this processor. Since we have the 1501 1499 * physical cpu id in r24, we need to search the pacas to find ··· 1520 1522 /* start. */ 1521 1523 sync 1522 1524 1523 - /* Create a temp kernel stack for use before relocation is on. */ 1525 + #ifndef CONFIG_SMP 1526 + b 3b /* Never go on non-SMP */ 1527 + #else 1528 + cmpwi 0,r23,0 1529 + beq 3b /* Loop until told to go */ 1530 + 1531 + /* See if we need to call a cpu state restore handler */ 1532 + LOAD_REG_IMMEDIATE(r23, cur_cpu_spec) 1533 + ld r23,0(r23) 1534 + ld r23,CPU_SPEC_RESTORE(r23) 1535 + cmpdi 0,r23,0 1536 + beq 4f 1537 + ld r23,0(r23) 1538 + mtctr r23 1539 + bctrl 1540 + 1541 + 4: /* Create a temp kernel stack for use before relocation is on. */ 1524 1542 ld r1,PACAEMERGSP(r13) 1525 1543 subi r1,r1,STACK_FRAME_OVERHEAD 1526 1544 1527 - cmpwi 0,r23,0 1528 - #ifdef CONFIG_SMP 1529 - bne .__secondary_start 1545 + b .__secondary_start 1530 1546 #endif 1531 - b 3b /* Loop until told to go */ 1532 1547 1533 1548 #ifdef CONFIG_PPC_ISERIES 1534 1549 _STATIC(__start_initialization_iSeries) ··· 1622 1611 bl .enable_64b_mode 1623 1612 1624 1613 /* Setup some critical 970 SPRs before switching MMU off */ 1625 - bl .__970_cpu_preinit 1614 + mfspr r0,SPRN_PVR 1615 + srwi r0,r0,16 1616 + cmpwi r0,0x39 /* 970 */ 1617 + beq 1f 1618 + cmpwi r0,0x3c /* 970FX */ 1619 + beq 1f 1620 + cmpwi r0,0x44 /* 970MP */ 1621 + bne 2f 1622 + 1: bl .__cpu_preinit_ppc970 1623 + 2: 1626 1624 1627 1625 /* Switch off MMU if not already */ 1628 1626 LOAD_REG_IMMEDIATE(r4, .__after_prom_start - KERNELBASE) ··· 1748 1728 _GLOBAL(copy_and_flush) 1749 1729 addi r5,r5,-8 1750 1730 addi r6,r6,-8 1751 - 4: li r0,16 /* Use the least common */ 1731 + 4: li r0,8 /* Use the smallest common */ 1752 1732 /* denominator cache line */ 1753 1733 /* size. This results in */ 1754 1734 /* extra cache line flushes */ ··· 1802 1782 isync 1803 1783 1804 1784 /* Copy some CPU settings from CPU 0 */ 1805 - bl .__restore_cpu_setup 1785 + bl .__restore_cpu_ppc970 1806 1786 1807 1787 /* pSeries do that early though I don't think we really need it */ 1808 1788 mfmsr r3 ··· 1951 1931 add r4,r4,r26 1952 1932 mr r5,r26 1953 1933 bl .identify_cpu 1954 - 1955 - /* Save some low level config HIDs of CPU0 to be copied to 1956 - * other CPUs later on, or used for suspend/resume 1957 - */ 1958 - bl .__save_cpu_setup 1959 - sync 1960 1934 1961 1935 /* Do very early kernel initializations, including initial hash table, 1962 1936 * stab and slb setup before we turn on relocation. */
+3 -3
arch/powerpc/kernel/ibmebus.c
··· 167 167 NULL); 168 168 169 169 static struct ibmebus_dev* __devinit ibmebus_register_device_common( 170 - struct ibmebus_dev *dev, char *name) 170 + struct ibmebus_dev *dev, const char *name) 171 171 { 172 172 int err = 0; 173 173 ··· 194 194 struct device_node *dn) 195 195 { 196 196 struct ibmebus_dev *dev; 197 - char *loc_code; 197 + const char *loc_code; 198 198 int length; 199 199 200 - loc_code = (char *)get_property(dn, "ibm,loc-code", NULL); 200 + loc_code = get_property(dn, "ibm,loc-code", NULL); 201 201 if (!loc_code) { 202 202 printk(KERN_WARNING "%s: node %s missing 'ibm,loc-code'\n", 203 203 __FUNCTION__, dn->name ? dn->name : "<unknown>");
+131
arch/powerpc/kernel/io.c
··· 1 + /* 2 + * I/O string operations 3 + * Copyright (C) 1995-1996 Gary Thomas (gdt@linuxppc.org) 4 + * Copyright (C) 2006 IBM Corporation 5 + * 6 + * Largely rewritten by Cort Dougan (cort@cs.nmt.edu) 7 + * and Paul Mackerras. 8 + * 9 + * Adapted for iSeries by Mike Corrigan (mikejc@us.ibm.com) 10 + * PPC64 updates by Dave Engebretsen (engebret@us.ibm.com) 11 + * 12 + * Rewritten in C by Stephen Rothwell. 13 + * 14 + * This program is free software; you can redistribute it and/or 15 + * modify it under the terms of the GNU General Public License 16 + * as published by the Free Software Foundation; either version 17 + * 2 of the License, or (at your option) any later version. 18 + */ 19 + #include <linux/kernel.h> 20 + #include <linux/types.h> 21 + #include <linux/compiler.h> 22 + #include <linux/module.h> 23 + 24 + #include <asm/io.h> 25 + #include <asm/firmware.h> 26 + #include <asm/bug.h> 27 + 28 + void _insb(volatile u8 __iomem *port, void *buf, long count) 29 + { 30 + u8 *tbuf = buf; 31 + u8 tmp; 32 + 33 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 34 + 35 + if (unlikely(count <= 0)) 36 + return; 37 + asm volatile("sync"); 38 + do { 39 + tmp = *port; 40 + asm volatile("eieio"); 41 + *tbuf++ = tmp; 42 + } while (--count != 0); 43 + asm volatile("twi 0,%0,0; isync" : : "r" (tmp)); 44 + } 45 + EXPORT_SYMBOL(_insb); 46 + 47 + void _outsb(volatile u8 __iomem *port, const void *buf, long count) 48 + { 49 + const u8 *tbuf = buf; 50 + 51 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 52 + 53 + if (unlikely(count <= 0)) 54 + return; 55 + asm volatile("sync"); 56 + do { 57 + *port = *tbuf++; 58 + } while (--count != 0); 59 + asm volatile("sync"); 60 + } 61 + EXPORT_SYMBOL(_outsb); 62 + 63 + void _insw_ns(volatile u16 __iomem *port, void *buf, long count) 64 + { 65 + u16 *tbuf = buf; 66 + u16 tmp; 67 + 68 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 69 + 70 + if (unlikely(count <= 0)) 71 + return; 72 + asm volatile("sync"); 73 + do { 74 + tmp = *port; 75 + asm volatile("eieio"); 76 + *tbuf++ = tmp; 77 + } while (--count != 0); 78 + asm volatile("twi 0,%0,0; isync" : : "r" (tmp)); 79 + } 80 + EXPORT_SYMBOL(_insw_ns); 81 + 82 + void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count) 83 + { 84 + const u16 *tbuf = buf; 85 + 86 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 87 + 88 + if (unlikely(count <= 0)) 89 + return; 90 + asm volatile("sync"); 91 + do { 92 + *port = *tbuf++; 93 + } while (--count != 0); 94 + asm volatile("sync"); 95 + } 96 + EXPORT_SYMBOL(_outsw_ns); 97 + 98 + void _insl_ns(volatile u32 __iomem *port, void *buf, long count) 99 + { 100 + u32 *tbuf = buf; 101 + u32 tmp; 102 + 103 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 104 + 105 + if (unlikely(count <= 0)) 106 + return; 107 + asm volatile("sync"); 108 + do { 109 + tmp = *port; 110 + asm volatile("eieio"); 111 + *tbuf++ = tmp; 112 + } while (--count != 0); 113 + asm volatile("twi 0,%0,0; isync" : : "r" (tmp)); 114 + } 115 + EXPORT_SYMBOL(_insl_ns); 116 + 117 + void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count) 118 + { 119 + const u32 *tbuf = buf; 120 + 121 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 122 + 123 + if (unlikely(count <= 0)) 124 + return; 125 + asm volatile("sync"); 126 + do { 127 + *port = *tbuf++; 128 + } while (--count != 0); 129 + asm volatile("sync"); 130 + } 131 + EXPORT_SYMBOL(_outsl_ns);
+5
arch/powerpc/kernel/irq.c
··· 52 52 #include <linux/radix-tree.h> 53 53 #include <linux/mutex.h> 54 54 #include <linux/bootmem.h> 55 + #include <linux/pci.h> 55 56 56 57 #include <asm/uaccess.h> 57 58 #include <asm/system.h> ··· 876 875 else 877 876 return -1; 878 877 } 878 + EXPORT_SYMBOL(pci_enable_msi); 879 879 880 880 void pci_disable_msi(struct pci_dev * pdev) 881 881 { 882 882 if (ppc_md.disable_msi) 883 883 ppc_md.disable_msi(pdev); 884 884 } 885 + EXPORT_SYMBOL(pci_disable_msi); 885 886 886 887 void pci_scan_msi_device(struct pci_dev *dev) {} 887 888 int pci_enable_msix(struct pci_dev* dev, struct msix_entry *entries, int nvec) {return -1;} ··· 891 888 void msi_remove_pci_irq_vectors(struct pci_dev *dev) {} 892 889 void disable_msi_mode(struct pci_dev *dev, int pos, int type) {} 893 890 void pci_no_msi(void) {} 891 + EXPORT_SYMBOL(pci_enable_msix); 892 + EXPORT_SYMBOL(pci_disable_msix); 894 893 895 894 #endif 896 895
+18 -17
arch/powerpc/kernel/legacy_serial.c
··· 39 39 phys_addr_t taddr, unsigned long irq, 40 40 upf_t flags, int irq_check_parent) 41 41 { 42 - u32 *clk, *spd, clock = BASE_BAUD * 16; 42 + const u32 *clk, *spd; 43 + u32 clock = BASE_BAUD * 16; 43 44 int index; 44 45 45 46 /* get clock freq. if present */ 46 - clk = (u32 *)get_property(np, "clock-frequency", NULL); 47 + clk = get_property(np, "clock-frequency", NULL); 47 48 if (clk && *clk) 48 49 clock = *clk; 49 50 50 51 /* get default speed if present */ 51 - spd = (u32 *)get_property(np, "current-speed", NULL); 52 + spd = get_property(np, "current-speed", NULL); 52 53 53 54 /* If we have a location index, then try to use it */ 54 55 if (want_index >= 0 && want_index < MAX_LEGACY_SERIAL_PORTS) ··· 114 113 struct device_node *soc_dev) 115 114 { 116 115 u64 addr; 117 - u32 *addrp; 116 + const u32 *addrp; 118 117 upf_t flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_SHARE_IRQ; 119 118 struct device_node *tsi = of_get_parent(np); 120 119 ··· 145 144 static int __init add_legacy_isa_port(struct device_node *np, 146 145 struct device_node *isa_brg) 147 146 { 148 - u32 *reg; 149 - char *typep; 147 + const u32 *reg; 148 + const char *typep; 150 149 int index = -1; 151 150 u64 taddr; 152 151 153 152 DBG(" -> add_legacy_isa_port(%s)\n", np->full_name); 154 153 155 154 /* Get the ISA port number */ 156 - reg = (u32 *)get_property(np, "reg", NULL); 155 + reg = get_property(np, "reg", NULL); 157 156 if (reg == NULL) 158 157 return -1; 159 158 ··· 164 163 /* Now look for an "ibm,aix-loc" property that gives us ordering 165 164 * if any... 166 165 */ 167 - typep = (char *)get_property(np, "ibm,aix-loc", NULL); 166 + typep = get_property(np, "ibm,aix-loc", NULL); 168 167 169 168 /* If we have a location index, then use it */ 170 169 if (typep && *typep == 'S') ··· 189 188 struct device_node *pci_dev) 190 189 { 191 190 u64 addr, base; 192 - u32 *addrp; 191 + const u32 *addrp; 193 192 unsigned int flags; 194 193 int iotype, index = -1, lindex = 0; 195 194 ··· 228 227 * we get to their "reg" property 229 228 */ 230 229 if (np != pci_dev) { 231 - u32 *reg = (u32 *)get_property(np, "reg", NULL); 230 + const u32 *reg = get_property(np, "reg", NULL); 232 231 if (reg && (*reg < 4)) 233 232 index = lindex = *reg; 234 233 } ··· 286 285 void __init find_legacy_serial_ports(void) 287 286 { 288 287 struct device_node *np, *stdout = NULL; 289 - char *path; 288 + const char *path; 290 289 int index; 291 290 292 291 DBG(" -> find_legacy_serial_port()\n"); 293 292 294 293 /* Now find out if one of these is out firmware console */ 295 - path = (char *)get_property(of_chosen, "linux,stdout-path", NULL); 294 + path = get_property(of_chosen, "linux,stdout-path", NULL); 296 295 if (path != NULL) { 297 296 stdout = of_find_node_by_path(path); 298 297 if (stdout) ··· 492 491 { 493 492 struct device_node *prom_stdout = NULL; 494 493 int speed = 0, offset = 0; 495 - char *name; 496 - u32 *spd; 494 + const char *name; 495 + const u32 *spd; 497 496 498 497 DBG(" -> check_legacy_serial_console()\n"); 499 498 ··· 514 513 } 515 514 /* We are getting a weird phandle from OF ... */ 516 515 /* ... So use the full path instead */ 517 - name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); 516 + name = get_property(of_chosen, "linux,stdout-path", NULL); 518 517 if (name == NULL) { 519 518 DBG(" no linux,stdout-path !\n"); 520 519 return -ENODEV; ··· 526 525 } 527 526 DBG("stdout is %s\n", prom_stdout->full_name); 528 527 529 - name = (char *)get_property(prom_stdout, "name", NULL); 528 + name = get_property(prom_stdout, "name", NULL); 530 529 if (!name) { 531 530 DBG(" stdout package has no name !\n"); 532 531 goto not_found; 533 532 } 534 - spd = (u32 *)get_property(prom_stdout, "current-speed", NULL); 533 + spd = get_property(prom_stdout, "current-speed", NULL); 535 534 if (spd) 536 535 speed = *spd; 537 536
+19 -11
arch/powerpc/kernel/lparcfg.c
··· 32 32 #include <asm/rtas.h> 33 33 #include <asm/system.h> 34 34 #include <asm/time.h> 35 - #include <asm/iseries/it_exp_vpd_panel.h> 36 35 #include <asm/prom.h> 37 36 #include <asm/vdso_datapage.h> 38 37 ··· 182 183 unsigned long *resource) 183 184 { 184 185 unsigned long rc; 185 - rc = plpar_hcall_4out(H_GET_PPP, 0, 0, 0, 0, entitled, unallocated, 186 - aggregation, resource); 186 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 187 + 188 + rc = plpar_hcall(H_GET_PPP, retbuf); 189 + 190 + *entitled = retbuf[0]; 191 + *unallocated = retbuf[1]; 192 + *aggregation = retbuf[2]; 193 + *resource = retbuf[3]; 187 194 188 195 log_plpar_hcall_return(rc, "H_GET_PPP"); 189 196 ··· 199 194 static void h_pic(unsigned long *pool_idle_time, unsigned long *num_procs) 200 195 { 201 196 unsigned long rc; 202 - unsigned long dummy; 203 - rc = plpar_hcall(H_PIC, 0, 0, 0, 0, pool_idle_time, num_procs, &dummy); 197 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 198 + 199 + rc = plpar_hcall(H_PIC, retbuf); 200 + 201 + *pool_idle_time = retbuf[0]; 202 + *num_procs = retbuf[1]; 204 203 205 204 if (rc != H_AUTHORITY) 206 205 log_plpar_hcall_return(rc, "H_PIC"); ··· 319 310 int partition_potential_processors; 320 311 int partition_active_processors; 321 312 struct device_node *rtas_node; 322 - int *lrdrp = NULL; 313 + const int *lrdrp = NULL; 323 314 324 315 rtas_node = find_path_device("/rtas"); 325 316 if (rtas_node) 326 - lrdrp = (int *)get_property(rtas_node, "ibm,lrdr-capacity", 327 - NULL); 317 + lrdrp = get_property(rtas_node, "ibm,lrdr-capacity", NULL); 328 318 329 319 if (lrdrp == NULL) { 330 320 partition_potential_processors = vdso_data->processorCount; ··· 528 520 const char *model = ""; 529 521 const char *system_id = ""; 530 522 const char *tmp; 531 - unsigned int *lp_index_ptr, lp_index = 0; 523 + const unsigned int *lp_index_ptr; 524 + unsigned int lp_index = 0; 532 525 533 526 seq_printf(m, "%s %s \n", MODULE_NAME, MODULE_VERS); 534 527 ··· 549 540 if (firmware_has_feature(FW_FEATURE_ISERIES)) 550 541 system_id += 4; 551 542 } 552 - lp_index_ptr = (unsigned int *) 553 - get_property(rootdn, "ibm,partition-no", NULL); 543 + lp_index_ptr = get_property(rootdn, "ibm,partition-no", NULL); 554 544 if (lp_index_ptr) 555 545 lp_index = *lp_index_ptr; 556 546 }
+4 -6
arch/powerpc/kernel/machine_kexec_64.c
··· 31 31 unsigned long begin, end; /* limits of segment */ 32 32 unsigned long low, high; /* limits of blocked memory range */ 33 33 struct device_node *node; 34 - unsigned long *basep; 35 - unsigned int *sizep; 34 + const unsigned long *basep; 35 + const unsigned int *sizep; 36 36 37 37 if (!ppc_md.hpte_clear_all) 38 38 return -ENOENT; ··· 72 72 /* We also should not overwrite the tce tables */ 73 73 for (node = of_find_node_by_type(NULL, "pci"); node != NULL; 74 74 node = of_find_node_by_type(node, "pci")) { 75 - basep = (unsigned long *)get_property(node, "linux,tce-base", 76 - NULL); 77 - sizep = (unsigned int *)get_property(node, "linux,tce-size", 78 - NULL); 75 + basep = get_property(node, "linux,tce-base", NULL); 76 + sizep = get_property(node, "linux,tce-size", NULL); 79 77 if (basep == NULL || sizep == NULL) 80 78 continue; 81 79
-159
arch/powerpc/kernel/misc.S
··· 43 43 add r3,r3,r5 44 44 mtlr r0 45 45 blr 46 - 47 - /* 48 - * I/O string operations 49 - * 50 - * insb(port, buf, len) 51 - * outsb(port, buf, len) 52 - * insw(port, buf, len) 53 - * outsw(port, buf, len) 54 - * insl(port, buf, len) 55 - * outsl(port, buf, len) 56 - * insw_ns(port, buf, len) 57 - * outsw_ns(port, buf, len) 58 - * insl_ns(port, buf, len) 59 - * outsl_ns(port, buf, len) 60 - * 61 - * The *_ns versions don't do byte-swapping. 62 - */ 63 - _GLOBAL(_insb) 64 - sync 65 - cmpwi 0,r5,0 66 - mtctr r5 67 - subi r4,r4,1 68 - blelr- 69 - 00: lbz r5,0(r3) 70 - eieio 71 - stbu r5,1(r4) 72 - bdnz 00b 73 - twi 0,r5,0 74 - isync 75 - blr 76 - 77 - _GLOBAL(_outsb) 78 - cmpwi 0,r5,0 79 - mtctr r5 80 - subi r4,r4,1 81 - blelr- 82 - sync 83 - 00: lbzu r5,1(r4) 84 - stb r5,0(r3) 85 - bdnz 00b 86 - sync 87 - blr 88 - 89 - _GLOBAL(_insw) 90 - sync 91 - cmpwi 0,r5,0 92 - mtctr r5 93 - subi r4,r4,2 94 - blelr- 95 - 00: lhbrx r5,0,r3 96 - eieio 97 - sthu r5,2(r4) 98 - bdnz 00b 99 - twi 0,r5,0 100 - isync 101 - blr 102 - 103 - _GLOBAL(_outsw) 104 - cmpwi 0,r5,0 105 - mtctr r5 106 - subi r4,r4,2 107 - blelr- 108 - sync 109 - 00: lhzu r5,2(r4) 110 - sthbrx r5,0,r3 111 - bdnz 00b 112 - sync 113 - blr 114 - 115 - _GLOBAL(_insl) 116 - sync 117 - cmpwi 0,r5,0 118 - mtctr r5 119 - subi r4,r4,4 120 - blelr- 121 - 00: lwbrx r5,0,r3 122 - eieio 123 - stwu r5,4(r4) 124 - bdnz 00b 125 - twi 0,r5,0 126 - isync 127 - blr 128 - 129 - _GLOBAL(_outsl) 130 - cmpwi 0,r5,0 131 - mtctr r5 132 - subi r4,r4,4 133 - blelr- 134 - sync 135 - 00: lwzu r5,4(r4) 136 - stwbrx r5,0,r3 137 - bdnz 00b 138 - sync 139 - blr 140 - 141 - #ifdef CONFIG_PPC32 142 - _GLOBAL(__ide_mm_insw) 143 - #endif 144 - _GLOBAL(_insw_ns) 145 - sync 146 - cmpwi 0,r5,0 147 - mtctr r5 148 - subi r4,r4,2 149 - blelr- 150 - 00: lhz r5,0(r3) 151 - eieio 152 - sthu r5,2(r4) 153 - bdnz 00b 154 - twi 0,r5,0 155 - isync 156 - blr 157 - 158 - #ifdef CONFIG_PPC32 159 - _GLOBAL(__ide_mm_outsw) 160 - #endif 161 - _GLOBAL(_outsw_ns) 162 - cmpwi 0,r5,0 163 - mtctr r5 164 - subi r4,r4,2 165 - blelr- 166 - sync 167 - 00: lhzu r5,2(r4) 168 - sth r5,0(r3) 169 - bdnz 00b 170 - sync 171 - blr 172 - 173 - #ifdef CONFIG_PPC32 174 - _GLOBAL(__ide_mm_insl) 175 - #endif 176 - _GLOBAL(_insl_ns) 177 - sync 178 - cmpwi 0,r5,0 179 - mtctr r5 180 - subi r4,r4,4 181 - blelr- 182 - 00: lwz r5,0(r3) 183 - eieio 184 - stwu r5,4(r4) 185 - bdnz 00b 186 - twi 0,r5,0 187 - isync 188 - blr 189 - 190 - #ifdef CONFIG_PPC32 191 - _GLOBAL(__ide_mm_outsl) 192 - #endif 193 - _GLOBAL(_outsl_ns) 194 - cmpwi 0,r5,0 195 - mtctr r5 196 - subi r4,r4,4 197 - blelr- 198 - sync 199 - 00: lwzu r5,4(r4) 200 - stw r5,0(r3) 201 - bdnz 00b 202 - sync 203 - blr 204 -
-24
arch/powerpc/kernel/of_device.c
··· 189 189 int of_device_register(struct of_device *ofdev) 190 190 { 191 191 int rc; 192 - struct of_device **odprop; 193 192 194 193 BUG_ON(ofdev->node == NULL); 195 - 196 - odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL); 197 - if (!odprop) { 198 - struct property *new_prop; 199 - 200 - new_prop = kmalloc(sizeof(struct property) + sizeof(struct of_device *), 201 - GFP_KERNEL); 202 - if (new_prop == NULL) 203 - return -ENOMEM; 204 - new_prop->name = "linux,device"; 205 - new_prop->length = sizeof(sizeof(struct of_device *)); 206 - new_prop->value = (unsigned char *)&new_prop[1]; 207 - odprop = (struct of_device **)new_prop->value; 208 - *odprop = NULL; 209 - prom_add_property(ofdev->node, new_prop); 210 - } 211 - *odprop = ofdev; 212 194 213 195 rc = device_register(&ofdev->dev); 214 196 if (rc) ··· 203 221 204 222 void of_device_unregister(struct of_device *ofdev) 205 223 { 206 - struct of_device **odprop; 207 - 208 224 device_remove_file(&ofdev->dev, &dev_attr_devspec); 209 - 210 - odprop = (struct of_device **)get_property(ofdev->node, "linux,device", NULL); 211 - if (odprop) 212 - *odprop = NULL; 213 225 214 226 device_unregister(&ofdev->dev); 215 227 }
+14 -1
arch/powerpc/kernel/paca.c
··· 17 17 #include <asm/lppaca.h> 18 18 #include <asm/iseries/it_lp_reg_save.h> 19 19 #include <asm/paca.h> 20 + #include <asm/mmu.h> 20 21 21 22 22 23 /* This symbol is provided by the linker - let it fill in the paca ··· 46 45 }, 47 46 }; 48 47 48 + /* 49 + * 3 persistent SLBs are registered here. The buffer will be zero 50 + * initially, hence will all be invaild until we actually write them. 51 + */ 52 + struct slb_shadow slb_shadow[] __cacheline_aligned = { 53 + [0 ... (NR_CPUS-1)] = { 54 + .persistent = SLB_NUM_BOLTED, 55 + .buffer_length = sizeof(struct slb_shadow), 56 + }, 57 + }; 58 + 49 59 /* The Paca is an array with one entry per processor. Each contains an 50 60 * lppaca, which contains the information shared between the 51 61 * hypervisor and Linux. ··· 71 59 .lock_token = 0x8000, \ 72 60 .paca_index = (number), /* Paca Index */ \ 73 61 .kernel_toc = (unsigned long)(&__toc_start) + 0x8000UL, \ 74 - .hw_cpu_id = 0xffff, 62 + .hw_cpu_id = 0xffff, \ 63 + .slb_shadow_ptr = &slb_shadow[number], 75 64 76 65 #ifdef CONFIG_PPC_ISERIES 77 66 #define PACA_INIT_ISERIES(number) \
+21 -18
arch/powerpc/kernel/pci_32.c
··· 633 633 static void 634 634 make_one_node_map(struct device_node* node, u8 pci_bus) 635 635 { 636 - int *bus_range; 636 + const int *bus_range; 637 637 int len; 638 638 639 639 if (pci_bus >= pci_bus_count) 640 640 return; 641 - bus_range = (int *) get_property(node, "bus-range", &len); 641 + bus_range = get_property(node, "bus-range", &len); 642 642 if (bus_range == NULL || len < 2 * sizeof(int)) { 643 643 printk(KERN_WARNING "Can't get bus-range for %s, " 644 644 "assuming it starts at 0\n", node->full_name); ··· 648 648 649 649 for (node=node->child; node != 0;node = node->sibling) { 650 650 struct pci_dev* dev; 651 - unsigned int *class_code, *reg; 651 + const unsigned int *class_code, *reg; 652 652 653 - class_code = (unsigned int *) get_property(node, "class-code", NULL); 653 + class_code = get_property(node, "class-code", NULL); 654 654 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && 655 655 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) 656 656 continue; 657 - reg = (unsigned int *)get_property(node, "reg", NULL); 657 + reg = get_property(node, "reg", NULL); 658 658 if (!reg) 659 659 continue; 660 660 dev = pci_find_slot(pci_bus, ((reg[0] >> 8) & 0xff)); ··· 669 669 { 670 670 int i; 671 671 struct pci_controller* hose; 672 - u8* of_prop_map; 672 + struct property *map_prop; 673 673 674 674 pci_to_OF_bus_map = (u8*)kmalloc(pci_bus_count, GFP_KERNEL); 675 675 if (!pci_to_OF_bus_map) { ··· 691 691 continue; 692 692 make_one_node_map(node, hose->first_busno); 693 693 } 694 - of_prop_map = get_property(find_path_device("/"), "pci-OF-bus-map", NULL); 695 - if (of_prop_map) 696 - memcpy(of_prop_map, pci_to_OF_bus_map, pci_bus_count); 694 + map_prop = of_find_property(find_path_device("/"), 695 + "pci-OF-bus-map", NULL); 696 + if (map_prop) { 697 + BUG_ON(pci_bus_count > map_prop->length); 698 + memcpy(map_prop->value, pci_to_OF_bus_map, pci_bus_count); 699 + } 697 700 #ifdef DEBUG 698 701 printk("PCI->OF bus map:\n"); 699 702 for (i=0; i<pci_bus_count; i++) { ··· 715 712 struct device_node* sub_node; 716 713 717 714 for (; node != 0;node = node->sibling) { 718 - unsigned int *class_code; 715 + const unsigned int *class_code; 719 716 720 717 if (filter(node, data)) 721 718 return node; ··· 725 722 * a fake root for all functions of a multi-function device, 726 723 * we go down them as well. 727 724 */ 728 - class_code = (unsigned int *) get_property(node, "class-code", NULL); 725 + class_code = get_property(node, "class-code", NULL); 729 726 if ((!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && 730 727 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) && 731 728 strcmp(node->name, "multifunc-device")) ··· 740 737 static int 741 738 scan_OF_pci_childs_iterator(struct device_node* node, void* data) 742 739 { 743 - unsigned int *reg; 740 + const unsigned int *reg; 744 741 u8* fdata = (u8*)data; 745 742 746 - reg = (unsigned int *) get_property(node, "reg", NULL); 743 + reg = get_property(node, "reg", NULL); 747 744 if (reg && ((reg[0] >> 8) & 0xff) == fdata[1] 748 745 && ((reg[0] >> 16) & 0xff) == fdata[0]) 749 746 return 1; ··· 844 841 int 845 842 pci_device_from_OF_node(struct device_node* node, u8* bus, u8* devfn) 846 843 { 847 - unsigned int *reg; 844 + const unsigned int *reg; 848 845 struct pci_controller* hose; 849 846 struct pci_dev* dev = NULL; 850 847 ··· 857 854 if (!scan_OF_pci_childs(((struct device_node*)hose->arch_data)->child, 858 855 find_OF_pci_device_filter, (void *)node)) 859 856 return -ENODEV; 860 - reg = (unsigned int *) get_property(node, "reg", NULL); 857 + reg = get_property(node, "reg", NULL); 861 858 if (!reg) 862 859 return -ENODEV; 863 860 *bus = (reg[0] >> 16) & 0xff; ··· 888 885 struct device_node *dev, int primary) 889 886 { 890 887 static unsigned int static_lc_ranges[256] __initdata; 891 - unsigned int *dt_ranges, *lc_ranges, *ranges, *prev; 892 - unsigned int size; 888 + const unsigned int *dt_ranges; 889 + unsigned int *lc_ranges, *ranges, *prev, size; 893 890 int rlen = 0, orig_rlen; 894 891 int memno = 0; 895 892 struct resource *res; ··· 900 897 * that can have more than 3 ranges, fortunately using contiguous 901 898 * addresses -- BenH 902 899 */ 903 - dt_ranges = (unsigned int *) get_property(dev, "ranges", &rlen); 900 + dt_ranges = get_property(dev, "ranges", &rlen); 904 901 if (!dt_ranges) 905 902 return; 906 903 /* Sanity check, though hopefully that never happens */
+16 -51
arch/powerpc/kernel/pci_64.c
··· 185 185 spin_unlock(&hose_spinlock); 186 186 } 187 187 188 - static void add_linux_pci_domain(struct device_node *dev, 189 - struct pci_controller *phb) 190 - { 191 - struct property *of_prop; 192 - unsigned int size; 193 - 194 - of_prop = (struct property *) 195 - get_property(dev, "linux,pci-domain", &size); 196 - if (of_prop != NULL) 197 - return; 198 - WARN_ON(of_prop && size < sizeof(int)); 199 - if (of_prop && size < sizeof(int)) 200 - of_prop = NULL; 201 - size = sizeof(struct property) + sizeof(int); 202 - if (of_prop == NULL) { 203 - if (mem_init_done) 204 - of_prop = kmalloc(size, GFP_KERNEL); 205 - else 206 - of_prop = alloc_bootmem(size); 207 - } 208 - memset(of_prop, 0, sizeof(struct property)); 209 - of_prop->name = "linux,pci-domain"; 210 - of_prop->length = sizeof(int); 211 - of_prop->value = (unsigned char *)&of_prop[1]; 212 - *((int *)of_prop->value) = phb->global_number; 213 - prom_add_property(dev, of_prop); 214 - } 215 - 216 188 struct pci_controller * pcibios_alloc_controller(struct device_node *dev) 217 189 { 218 190 struct pci_controller *phb; ··· 198 226 pci_setup_pci_controller(phb); 199 227 phb->arch_data = dev; 200 228 phb->is_dynamic = mem_init_done; 201 - if (dev) { 229 + if (dev) 202 230 PHB_SET_NODE(phb, of_node_to_nid(dev)); 203 - add_linux_pci_domain(dev, phb); 204 - } 205 231 return phb; 206 232 } 207 233 208 234 void pcibios_free_controller(struct pci_controller *phb) 209 235 { 210 - if (phb->arch_data) { 211 - struct device_node *np = phb->arch_data; 212 - int *domain = (int *)get_property(np, 213 - "linux,pci-domain", NULL); 214 - if (domain) 215 - *domain = -1; 216 - } 217 236 if (phb->is_dynamic) 218 237 kfree(phb); 219 238 } ··· 246 283 #ifdef CONFIG_PPC_MULTIPLATFORM 247 284 static u32 get_int_prop(struct device_node *np, const char *name, u32 def) 248 285 { 249 - u32 *prop; 286 + const u32 *prop; 250 287 int len; 251 288 252 - prop = (u32 *) get_property(np, name, &len); 289 + prop = get_property(np, name, &len); 253 290 if (prop && len >= 4) 254 291 return *prop; 255 292 return def; ··· 278 315 u64 base, size; 279 316 unsigned int flags; 280 317 struct resource *res; 281 - u32 *addrs, i; 318 + const u32 *addrs; 319 + u32 i; 282 320 int proplen; 283 321 284 - addrs = (u32 *) get_property(node, "assigned-addresses", &proplen); 322 + addrs = get_property(node, "assigned-addresses", &proplen); 285 323 if (!addrs) 286 324 return; 287 325 DBG(" parse addresses (%d bytes) @ %p\n", proplen, addrs); ··· 382 418 struct pci_bus *bus) 383 419 { 384 420 struct device_node *child = NULL; 385 - u32 *reg; 421 + const u32 *reg; 386 422 int reglen, devfn; 387 423 struct pci_dev *dev; 388 424 ··· 390 426 391 427 while ((child = of_get_next_child(node, child)) != NULL) { 392 428 DBG(" * %s\n", child->full_name); 393 - reg = (u32 *) get_property(child, "reg", &reglen); 429 + reg = get_property(child, "reg", &reglen); 394 430 if (reg == NULL || reglen < 20) 395 431 continue; 396 432 devfn = (reg[0] >> 8) & 0xff; ··· 414 450 struct pci_dev *dev) 415 451 { 416 452 struct pci_bus *bus; 417 - u32 *busrange, *ranges; 453 + const u32 *busrange, *ranges; 418 454 int len, i, mode; 419 455 struct resource *res; 420 456 unsigned int flags; ··· 423 459 DBG("of_scan_pci_bridge(%s)\n", node->full_name); 424 460 425 461 /* parse bus-range property */ 426 - busrange = (u32 *) get_property(node, "bus-range", &len); 462 + busrange = get_property(node, "bus-range", &len); 427 463 if (busrange == NULL || len != 8) { 428 464 printk(KERN_DEBUG "Can't get bus-range for PCI-PCI bridge %s\n", 429 465 node->full_name); 430 466 return; 431 467 } 432 - ranges = (u32 *) get_property(node, "ranges", &len); 468 + ranges = get_property(node, "ranges", &len); 433 469 if (ranges == NULL) { 434 470 printk(KERN_DEBUG "Can't get ranges for PCI-PCI bridge %s\n", 435 471 node->full_name); ··· 893 929 unsigned int size; 894 930 }; 895 931 896 - struct isa_range *range; 932 + const struct isa_range *range; 897 933 unsigned long pci_addr; 898 934 unsigned int isa_addr; 899 935 unsigned int size; 900 936 int rlen = 0; 901 937 902 - range = (struct isa_range *) get_property(isa_node, "ranges", &rlen); 938 + range = get_property(isa_node, "ranges", &rlen); 903 939 if (range == NULL || (rlen < sizeof(struct isa_range))) { 904 940 printk(KERN_ERR "no ISA ranges or unexpected isa range size," 905 941 "mapping 64k\n"); ··· 940 976 void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, 941 977 struct device_node *dev, int prim) 942 978 { 943 - unsigned int *ranges, pci_space; 979 + const unsigned int *ranges; 980 + unsigned int pci_space; 944 981 unsigned long size; 945 982 int rlen = 0; 946 983 int memno = 0; ··· 959 994 * (size depending on dev->n_addr_cells) 960 995 * cells 4+5 or 5+6: the size of the range 961 996 */ 962 - ranges = (unsigned int *) get_property(dev, "ranges", &rlen); 997 + ranges = get_property(dev, "ranges", &rlen); 963 998 if (ranges == NULL) 964 999 return; 965 1000 hose->io_base_phys = 0;
+7 -6
arch/powerpc/kernel/pci_dn.c
··· 40 40 static void * __devinit update_dn_pci_info(struct device_node *dn, void *data) 41 41 { 42 42 struct pci_controller *phb = data; 43 - int *type = (int *)get_property(dn, "ibm,pci-config-space-type", NULL); 44 - u32 *regs; 43 + const int *type = get_property(dn, "ibm,pci-config-space-type", NULL); 44 + const u32 *regs; 45 45 struct pci_dn *pdn; 46 46 47 47 if (mem_init_done) ··· 54 54 dn->data = pdn; 55 55 pdn->node = dn; 56 56 pdn->phb = phb; 57 - regs = (u32 *)get_property(dn, "reg", NULL); 57 + regs = get_property(dn, "reg", NULL); 58 58 if (regs) { 59 59 /* First register entry is addr (00BBSS00) */ 60 60 pdn->busno = (regs[0] >> 16) & 0xff; 61 61 pdn->devfn = (regs[0] >> 8) & 0xff; 62 62 } 63 63 if (firmware_has_feature(FW_FEATURE_ISERIES)) { 64 - u32 *busp = (u32 *)get_property(dn, "linux,subbus", NULL); 64 + const u32 *busp = get_property(dn, "linux,subbus", NULL); 65 65 if (busp) 66 66 pdn->bussubno = *busp; 67 67 } ··· 96 96 97 97 /* We started with a phb, iterate all childs */ 98 98 for (dn = start->child; dn; dn = nextdn) { 99 - u32 *classp, class; 99 + const u32 *classp; 100 + u32 class; 100 101 101 102 nextdn = NULL; 102 - classp = (u32 *)get_property(dn, "class-code", NULL); 103 + classp = get_property(dn, "class-code", NULL); 103 104 class = classp ? *classp : 0; 104 105 105 106 if (pre && ((ret = pre(dn, data)) != NULL))
+2 -17
arch/powerpc/kernel/ppc_ksyms.c
··· 91 91 EXPORT_SYMBOL(__clear_user); 92 92 EXPORT_SYMBOL(__strncpy_from_user); 93 93 EXPORT_SYMBOL(__strnlen_user); 94 - 95 - #ifndef __powerpc64__ 96 - EXPORT_SYMBOL(__ide_mm_insl); 97 - EXPORT_SYMBOL(__ide_mm_outsw); 98 - EXPORT_SYMBOL(__ide_mm_insw); 99 - EXPORT_SYMBOL(__ide_mm_outsl); 94 + #ifdef CONFIG_PPC64 95 + EXPORT_SYMBOL(copy_4K_page); 100 96 #endif 101 - 102 - EXPORT_SYMBOL(_insb); 103 - EXPORT_SYMBOL(_outsb); 104 - EXPORT_SYMBOL(_insw); 105 - EXPORT_SYMBOL(_outsw); 106 - EXPORT_SYMBOL(_insl); 107 - EXPORT_SYMBOL(_outsl); 108 - EXPORT_SYMBOL(_insw_ns); 109 - EXPORT_SYMBOL(_outsw_ns); 110 - EXPORT_SYMBOL(_insl_ns); 111 - EXPORT_SYMBOL(_outsl_ns); 112 97 113 98 #if defined(CONFIG_PPC32) && (defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)) 114 99 EXPORT_SYMBOL(ppc_ide_md);
+14 -30
arch/powerpc/kernel/prom.c
··· 757 757 static unsigned long __init dt_mem_next_cell(int s, cell_t **cellp) 758 758 { 759 759 cell_t *p = *cellp; 760 - unsigned long r; 761 760 762 - /* Ignore more than 2 cells */ 763 - while (s > sizeof(unsigned long) / 4) { 764 - p++; 765 - s--; 766 - } 767 - r = *p++; 768 - #ifdef CONFIG_PPC64 769 - if (s > 1) { 770 - r <<= 32; 771 - r |= *(p++); 772 - s--; 773 - } 774 - #endif 775 - 776 - *cellp = p; 777 - return r; 761 + *cellp = p + s; 762 + return of_read_ulong(p, s); 778 763 } 779 764 780 765 ··· 927 942 int 928 943 prom_n_addr_cells(struct device_node* np) 929 944 { 930 - int* ip; 945 + const int *ip; 931 946 do { 932 947 if (np->parent) 933 948 np = np->parent; 934 - ip = (int *) get_property(np, "#address-cells", NULL); 949 + ip = get_property(np, "#address-cells", NULL); 935 950 if (ip != NULL) 936 951 return *ip; 937 952 } while (np->parent); ··· 943 958 int 944 959 prom_n_size_cells(struct device_node* np) 945 960 { 946 - int* ip; 961 + const int* ip; 947 962 do { 948 963 if (np->parent) 949 964 np = np->parent; 950 - ip = (int *) get_property(np, "#size-cells", NULL); 965 + ip = get_property(np, "#size-cells", NULL); 951 966 if (ip != NULL) 952 967 return *ip; 953 968 } while (np->parent); ··· 1019 1034 const char* cp; 1020 1035 int cplen, l; 1021 1036 1022 - cp = (char *) get_property(device, "compatible", &cplen); 1037 + cp = get_property(device, "compatible", &cplen); 1023 1038 if (cp == NULL) 1024 1039 return 0; 1025 1040 while (cplen > 0) { ··· 1434 1449 { 1435 1450 struct device_node *parent = of_get_parent(node); 1436 1451 int err = 0; 1437 - phandle *ibm_phandle; 1452 + const phandle *ibm_phandle; 1438 1453 1439 1454 node->name = get_property(node, "name", NULL); 1440 1455 node->type = get_property(node, "device_type", NULL); ··· 1451 1466 return -ENODEV; 1452 1467 1453 1468 /* fix up new node's linux_phandle field */ 1454 - if ((ibm_phandle = (unsigned int *)get_property(node, 1455 - "ibm,phandle", NULL))) 1469 + if ((ibm_phandle = get_property(node, "ibm,phandle", NULL))) 1456 1470 node->linux_phandle = *ibm_phandle; 1457 1471 1458 1472 out: ··· 1512 1528 * Find a property with a given name for a given node 1513 1529 * and return the value. 1514 1530 */ 1515 - void *get_property(struct device_node *np, const char *name, int *lenp) 1531 + const void *get_property(struct device_node *np, const char *name, int *lenp) 1516 1532 { 1517 1533 struct property *pp = of_find_property(np,name,lenp); 1518 1534 return pp ? pp->value : NULL; ··· 1642 1658 hardid = get_hard_smp_processor_id(cpu); 1643 1659 1644 1660 for_each_node_by_type(np, "cpu") { 1645 - u32 *intserv; 1661 + const u32 *intserv; 1646 1662 unsigned int plen, t; 1647 1663 1648 1664 /* Check for ibm,ppc-interrupt-server#s. If it doesn't exist 1649 1665 * fallback to "reg" property and assume no threads 1650 1666 */ 1651 - intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", 1652 - &plen); 1667 + intserv = get_property(np, "ibm,ppc-interrupt-server#s", 1668 + &plen); 1653 1669 if (intserv == NULL) { 1654 - u32 *reg = (u32 *)get_property(np, "reg", NULL); 1670 + const u32 *reg = get_property(np, "reg", NULL); 1655 1671 if (reg == NULL) 1656 1672 continue; 1657 1673 if (*reg == hardid) {
+8 -2
arch/powerpc/kernel/prom_init.c
··· 2033 2033 #endif 2034 2034 2035 2035 #ifdef CONFIG_PPC_CHRP 2036 - /* Pegasos lacks the "ranges" property in the isa node */ 2036 + /* Pegasos and BriQ lacks the "ranges" property in the isa node */ 2037 2037 static void __init fixup_device_tree_chrp(void) 2038 2038 { 2039 2039 phandle isa; 2040 2040 u32 isa_ranges[6]; 2041 + u32 rloc = 0x01006000; /* IO space; PCI device = 12 */ 2041 2042 char *name; 2042 2043 int rc; 2043 2044 2044 2045 name = "/pci@80000000/isa@c"; 2045 2046 isa = call_prom("finddevice", 1, 1, ADDR(name)); 2047 + if (!PHANDLE_VALID(isa)) { 2048 + name = "/pci@ff500000/isa@6"; 2049 + isa = call_prom("finddevice", 1, 1, ADDR(name)); 2050 + rloc = 0x01003000; /* IO space; PCI device = 6 */ 2051 + } 2046 2052 if (!PHANDLE_VALID(isa)) 2047 2053 return; 2048 2054 ··· 2060 2054 2061 2055 isa_ranges[0] = 0x1; 2062 2056 isa_ranges[1] = 0x0; 2063 - isa_ranges[2] = 0x01006000; 2057 + isa_ranges[2] = rloc; 2064 2058 isa_ranges[3] = 0x0; 2065 2059 isa_ranges[4] = 0x0; 2066 2060 isa_ranges[5] = 0x00010000;
+47 -43
arch/powerpc/kernel/prom_parse.c
··· 27 27 28 28 /* Debug utility */ 29 29 #ifdef DEBUG 30 - static void of_dump_addr(const char *s, u32 *addr, int na) 30 + static void of_dump_addr(const char *s, const u32 *addr, int na) 31 31 { 32 32 printk("%s", s); 33 33 while(na--) ··· 35 35 printk("\n"); 36 36 } 37 37 #else 38 - static void of_dump_addr(const char *s, u32 *addr, int na) { } 38 + static void of_dump_addr(const char *s, const u32 *addr, int na) { } 39 39 #endif 40 40 41 41 ··· 46 46 int (*match)(struct device_node *parent); 47 47 void (*count_cells)(struct device_node *child, 48 48 int *addrc, int *sizec); 49 - u64 (*map)(u32 *addr, u32 *range, int na, int ns, int pna); 49 + u64 (*map)(u32 *addr, const u32 *range, 50 + int na, int ns, int pna); 50 51 int (*translate)(u32 *addr, u64 offset, int na); 51 - unsigned int (*get_flags)(u32 *addr); 52 + unsigned int (*get_flags)(const u32 *addr); 52 53 }; 53 54 54 55 ··· 66 65 *sizec = prom_n_size_cells(dev); 67 66 } 68 67 69 - static u64 of_bus_default_map(u32 *addr, u32 *range, int na, int ns, int pna) 68 + static u64 of_bus_default_map(u32 *addr, const u32 *range, 69 + int na, int ns, int pna) 70 70 { 71 71 u64 cp, s, da; 72 72 ··· 95 93 return 0; 96 94 } 97 95 98 - static unsigned int of_bus_default_get_flags(u32 *addr) 96 + static unsigned int of_bus_default_get_flags(const u32 *addr) 99 97 { 100 98 return IORESOURCE_MEM; 101 99 } ··· 120 118 *sizec = 2; 121 119 } 122 120 123 - static u64 of_bus_pci_map(u32 *addr, u32 *range, int na, int ns, int pna) 121 + static u64 of_bus_pci_map(u32 *addr, const u32 *range, int na, int ns, int pna) 124 122 { 125 123 u64 cp, s, da; 126 124 ··· 145 143 return of_bus_default_translate(addr + 1, offset, na - 1); 146 144 } 147 145 148 - static unsigned int of_bus_pci_get_flags(u32 *addr) 146 + static unsigned int of_bus_pci_get_flags(const u32 *addr) 149 147 { 150 148 unsigned int flags = 0; 151 149 u32 w = addr[0]; ··· 180 178 *sizec = 1; 181 179 } 182 180 183 - static u64 of_bus_isa_map(u32 *addr, u32 *range, int na, int ns, int pna) 181 + static u64 of_bus_isa_map(u32 *addr, const u32 *range, int na, int ns, int pna) 184 182 { 185 183 u64 cp, s, da; 186 184 ··· 205 203 return of_bus_default_translate(addr + 1, offset, na - 1); 206 204 } 207 205 208 - static unsigned int of_bus_isa_get_flags(u32 *addr) 206 + static unsigned int of_bus_isa_get_flags(const u32 *addr) 209 207 { 210 208 unsigned int flags = 0; 211 209 u32 w = addr[0]; ··· 270 268 struct of_bus *pbus, u32 *addr, 271 269 int na, int ns, int pna) 272 270 { 273 - u32 *ranges; 271 + const u32 *ranges; 274 272 unsigned int rlen; 275 273 int rone; 276 274 u64 offset = OF_BAD_ADDR; ··· 287 285 * to translate addresses that aren't supposed to be translated in 288 286 * the first place. --BenH. 289 287 */ 290 - ranges = (u32 *)get_property(parent, "ranges", &rlen); 288 + ranges = get_property(parent, "ranges", &rlen); 291 289 if (ranges == NULL || rlen == 0) { 292 290 offset = of_read_number(addr, na); 293 291 memset(addr, 0, pna * 4); ··· 330 328 * that can be mapped to a cpu physical address). This is not really specified 331 329 * that way, but this is traditionally the way IBM at least do things 332 330 */ 333 - u64 of_translate_address(struct device_node *dev, u32 *in_addr) 331 + u64 of_translate_address(struct device_node *dev, const u32 *in_addr) 334 332 { 335 333 struct device_node *parent = NULL; 336 334 struct of_bus *bus, *pbus; ··· 407 405 } 408 406 EXPORT_SYMBOL(of_translate_address); 409 407 410 - u32 *of_get_address(struct device_node *dev, int index, u64 *size, 408 + const u32 *of_get_address(struct device_node *dev, int index, u64 *size, 411 409 unsigned int *flags) 412 410 { 413 - u32 *prop; 411 + const u32 *prop; 414 412 unsigned int psize; 415 413 struct device_node *parent; 416 414 struct of_bus *bus; ··· 427 425 return NULL; 428 426 429 427 /* Get "reg" or "assigned-addresses" property */ 430 - prop = (u32 *)get_property(dev, bus->addresses, &psize); 428 + prop = get_property(dev, bus->addresses, &psize); 431 429 if (prop == NULL) 432 430 return NULL; 433 431 psize /= 4; ··· 445 443 } 446 444 EXPORT_SYMBOL(of_get_address); 447 445 448 - u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, 446 + const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, 449 447 unsigned int *flags) 450 448 { 451 - u32 *prop; 449 + const u32 *prop; 452 450 unsigned int psize; 453 451 struct device_node *parent; 454 452 struct of_bus *bus; ··· 469 467 return NULL; 470 468 471 469 /* Get "reg" or "assigned-addresses" property */ 472 - prop = (u32 *)get_property(dev, bus->addresses, &psize); 470 + prop = get_property(dev, bus->addresses, &psize); 473 471 if (prop == NULL) 474 472 return NULL; 475 473 psize /= 4; ··· 487 485 } 488 486 EXPORT_SYMBOL(of_get_pci_address); 489 487 490 - static int __of_address_to_resource(struct device_node *dev, u32 *addrp, 488 + static int __of_address_to_resource(struct device_node *dev, const u32 *addrp, 491 489 u64 size, unsigned int flags, 492 490 struct resource *r) 493 491 { ··· 518 516 int of_address_to_resource(struct device_node *dev, int index, 519 517 struct resource *r) 520 518 { 521 - u32 *addrp; 519 + const u32 *addrp; 522 520 u64 size; 523 521 unsigned int flags; 524 522 ··· 532 530 int of_pci_address_to_resource(struct device_node *dev, int bar, 533 531 struct resource *r) 534 532 { 535 - u32 *addrp; 533 + const u32 *addrp; 536 534 u64 size; 537 535 unsigned int flags; 538 536 ··· 543 541 } 544 542 EXPORT_SYMBOL_GPL(of_pci_address_to_resource); 545 543 546 - void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop, 544 + void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, 547 545 unsigned long *busno, unsigned long *phys, unsigned long *size) 548 546 { 549 - u32 *dma_window, cells; 550 - unsigned char *prop; 547 + const u32 *dma_window; 548 + u32 cells; 549 + const unsigned char *prop; 551 550 552 - dma_window = (u32 *)dma_window_prop; 551 + dma_window = dma_window_prop; 553 552 554 553 /* busno is always one cell */ 555 554 *busno = *(dma_window++); ··· 579 576 static struct device_node *of_irq_find_parent(struct device_node *child) 580 577 { 581 578 struct device_node *p; 582 - phandle *parp; 579 + const phandle *parp; 583 580 584 581 if (!of_node_get(child)) 585 582 return NULL; 586 583 587 584 do { 588 - parp = (phandle *)get_property(child, "interrupt-parent", NULL); 585 + parp = get_property(child, "interrupt-parent", NULL); 589 586 if (parp == NULL) 590 587 p = of_get_parent(child); 591 588 else { ··· 642 639 643 640 } 644 641 645 - int of_irq_map_raw(struct device_node *parent, u32 *intspec, u32 ointsize, 646 - u32 *addr, struct of_irq *out_irq) 642 + int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize, 643 + const u32 *addr, struct of_irq *out_irq) 647 644 { 648 645 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL; 649 - u32 *tmp, *imap, *imask; 646 + const u32 *tmp, *imap, *imask; 650 647 u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0; 651 648 int imaplen, match, i; 652 649 ··· 660 657 * is none, we are nice and just walk up the tree 661 658 */ 662 659 do { 663 - tmp = (u32 *)get_property(ipar, "#interrupt-cells", NULL); 660 + tmp = get_property(ipar, "#interrupt-cells", NULL); 664 661 if (tmp != NULL) { 665 662 intsize = *tmp; 666 663 break; ··· 684 681 */ 685 682 old = of_node_get(ipar); 686 683 do { 687 - tmp = (u32 *)get_property(old, "#address-cells", NULL); 684 + tmp = get_property(old, "#address-cells", NULL); 688 685 tnode = of_get_parent(old); 689 686 of_node_put(old); 690 687 old = tnode; ··· 711 708 } 712 709 713 710 /* Now look for an interrupt-map */ 714 - imap = (u32 *)get_property(ipar, "interrupt-map", &imaplen); 711 + imap = get_property(ipar, "interrupt-map", &imaplen); 715 712 /* No interrupt map, check for an interrupt parent */ 716 713 if (imap == NULL) { 717 714 DBG(" -> no map, getting parent\n"); ··· 721 718 imaplen /= sizeof(u32); 722 719 723 720 /* Look for a mask */ 724 - imask = (u32 *)get_property(ipar, "interrupt-map-mask", NULL); 721 + imask = get_property(ipar, "interrupt-map-mask", NULL); 725 722 726 723 /* If we were passed no "reg" property and we attempt to parse 727 724 * an interrupt-map, then #address-cells must be 0. ··· 768 765 /* Get #interrupt-cells and #address-cells of new 769 766 * parent 770 767 */ 771 - tmp = (u32 *)get_property(newpar, "#interrupt-cells", 768 + tmp = get_property(newpar, "#interrupt-cells", 772 769 NULL); 773 770 if (tmp == NULL) { 774 771 DBG(" -> parent lacks #interrupt-cells !\n"); 775 772 goto fail; 776 773 } 777 774 newintsize = *tmp; 778 - tmp = (u32 *)get_property(newpar, "#address-cells", 775 + tmp = get_property(newpar, "#address-cells", 779 776 NULL); 780 777 newaddrsize = (tmp == NULL) ? 0 : *tmp; 781 778 ··· 821 818 static int of_irq_map_oldworld(struct device_node *device, int index, 822 819 struct of_irq *out_irq) 823 820 { 824 - u32 *ints; 821 + const u32 *ints; 825 822 int intlen; 826 823 827 824 /* 828 825 * Old machines just have a list of interrupt numbers 829 826 * and no interrupt-controller nodes. 830 827 */ 831 - ints = (u32 *) get_property(device, "AAPL,interrupts", &intlen); 828 + ints = get_property(device, "AAPL,interrupts", &intlen); 832 829 if (ints == NULL) 833 830 return -EINVAL; 834 831 intlen /= sizeof(u32); ··· 853 850 int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq) 854 851 { 855 852 struct device_node *p; 856 - u32 *intspec, *tmp, intsize, intlen, *addr; 853 + const u32 *intspec, *tmp, *addr; 854 + u32 intsize, intlen; 857 855 int res; 858 856 859 857 DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index); ··· 864 860 return of_irq_map_oldworld(device, index, out_irq); 865 861 866 862 /* Get the interrupts property */ 867 - intspec = (u32 *)get_property(device, "interrupts", &intlen); 863 + intspec = get_property(device, "interrupts", &intlen); 868 864 if (intspec == NULL) 869 865 return -EINVAL; 870 866 intlen /= sizeof(u32); 871 867 872 868 /* Get the reg property (if any) */ 873 - addr = (u32 *)get_property(device, "reg", NULL); 869 + addr = get_property(device, "reg", NULL); 874 870 875 871 /* Look for the interrupt parent. */ 876 872 p = of_irq_find_parent(device); ··· 878 874 return -EINVAL; 879 875 880 876 /* Get size of interrupt specifier */ 881 - tmp = (u32 *)get_property(p, "#interrupt-cells", NULL); 877 + tmp = get_property(p, "#interrupt-cells", NULL); 882 878 if (tmp == NULL) { 883 879 of_node_put(p); 884 880 return -EINVAL;
+13 -12
arch/powerpc/kernel/rtas-proc.c
··· 246 246 247 247 static int ppc_rtas_find_all_sensors(void); 248 248 static void ppc_rtas_process_sensor(struct seq_file *m, 249 - struct individual_sensor *s, int state, int error, char *loc); 249 + struct individual_sensor *s, int state, int error, const char *loc); 250 250 static char *ppc_rtas_process_error(int error); 251 251 static void get_location_code(struct seq_file *m, 252 - struct individual_sensor *s, char *loc); 253 - static void check_location_string(struct seq_file *m, char *c); 254 - static void check_location(struct seq_file *m, char *c); 252 + struct individual_sensor *s, const char *loc); 253 + static void check_location_string(struct seq_file *m, const char *c); 254 + static void check_location(struct seq_file *m, const char *c); 255 255 256 256 static int __init proc_rtas_init(void) 257 257 { ··· 446 446 for (i=0; i<sensors.quant; i++) { 447 447 struct individual_sensor *p = &sensors.sensor[i]; 448 448 char rstr[64]; 449 - char *loc; 449 + const char *loc; 450 450 int llen, offs; 451 451 452 452 sprintf (rstr, SENSOR_PREFIX"%04d", p->token); 453 - loc = (char *) get_property(rtas_node, rstr, &llen); 453 + loc = get_property(rtas_node, rstr, &llen); 454 454 455 455 /* A sensor may have multiple instances */ 456 456 for (j = 0, offs = 0; j <= p->quant; j++) { ··· 474 474 475 475 static int ppc_rtas_find_all_sensors(void) 476 476 { 477 - unsigned int *utmp; 477 + const unsigned int *utmp; 478 478 int len, i; 479 479 480 - utmp = (unsigned int *) get_property(rtas_node, "rtas-sensors", &len); 480 + utmp = get_property(rtas_node, "rtas-sensors", &len); 481 481 if (utmp == NULL) { 482 482 printk (KERN_ERR "error: could not get rtas-sensors\n"); 483 483 return 1; ··· 530 530 */ 531 531 532 532 static void ppc_rtas_process_sensor(struct seq_file *m, 533 - struct individual_sensor *s, int state, int error, char *loc) 533 + struct individual_sensor *s, int state, int error, const char *loc) 534 534 { 535 535 /* Defined return vales */ 536 536 const char * key_switch[] = { "Off\t", "Normal\t", "Secure\t", ··· 682 682 683 683 /* ****************************************************************** */ 684 684 685 - static void check_location(struct seq_file *m, char *c) 685 + static void check_location(struct seq_file *m, const char *c) 686 686 { 687 687 switch (c[0]) { 688 688 case LOC_PLANAR: ··· 719 719 * ${LETTER}${NUMBER}[[-/]${LETTER}${NUMBER} [ ... ] ] 720 720 * the '.' may be an abbrevation 721 721 */ 722 - static void check_location_string(struct seq_file *m, char *c) 722 + static void check_location_string(struct seq_file *m, const char *c) 723 723 { 724 724 while (*c) { 725 725 if (isalpha(*c) || *c == '.') ··· 733 733 734 734 /* ****************************************************************** */ 735 735 736 - static void get_location_code(struct seq_file *m, struct individual_sensor *s, char *loc) 736 + static void get_location_code(struct seq_file *m, struct individual_sensor *s, 737 + const char *loc) 737 738 { 738 739 if (!loc || !*loc) { 739 740 seq_printf(m, "---");/* does not have a location */
+28 -19
arch/powerpc/kernel/rtas.c
··· 177 177 void rtas_progress(char *s, unsigned short hex) 178 178 { 179 179 struct device_node *root; 180 - int width, *p; 180 + int width; 181 + const int *p; 181 182 char *os; 182 183 static int display_character, set_indicator; 183 - static int display_width, display_lines, *row_width, form_feed; 184 + static int display_width, display_lines, form_feed; 185 + const static int *row_width; 184 186 static DEFINE_SPINLOCK(progress_lock); 185 187 static int current_line; 186 188 static int pending_newline = 0; /* did last write end with unprinted newline? */ ··· 193 191 if (display_width == 0) { 194 192 display_width = 0x10; 195 193 if ((root = find_path_device("/rtas"))) { 196 - if ((p = (unsigned int *)get_property(root, 194 + if ((p = get_property(root, 197 195 "ibm,display-line-length", NULL))) 198 196 display_width = *p; 199 - if ((p = (unsigned int *)get_property(root, 197 + if ((p = get_property(root, 200 198 "ibm,form-feed", NULL))) 201 199 form_feed = *p; 202 - if ((p = (unsigned int *)get_property(root, 200 + if ((p = get_property(root, 203 201 "ibm,display-number-of-lines", NULL))) 204 202 display_lines = *p; 205 - row_width = (unsigned int *)get_property(root, 203 + row_width = get_property(root, 206 204 "ibm,display-truncation-length", NULL); 207 205 } 208 206 display_character = rtas_token("display-character"); ··· 295 293 296 294 int rtas_token(const char *service) 297 295 { 298 - int *tokp; 296 + const int *tokp; 299 297 if (rtas.dev == NULL) 300 298 return RTAS_UNKNOWN_SERVICE; 301 - tokp = (int *) get_property(rtas.dev, service, NULL); 299 + tokp = get_property(rtas.dev, service, NULL); 302 300 return tokp ? *tokp : RTAS_UNKNOWN_SERVICE; 303 301 } 304 302 EXPORT_SYMBOL(rtas_token); ··· 628 626 { 629 627 int status; 630 628 629 + if (panic_timeout) 630 + return; 631 + 631 632 if (RTAS_UNKNOWN_SERVICE == rtas_token("ibm,os-term")) 632 633 return; 633 634 ··· 692 687 int i; 693 688 long state; 694 689 long rc; 695 - unsigned long dummy; 696 - 690 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 697 691 struct rtas_suspend_me_data data; 698 692 699 693 /* Make sure the state is valid */ 700 - rc = plpar_hcall(H_VASI_STATE, 701 - ((u64)args->args[0] << 32) | args->args[1], 702 - 0, 0, 0, 703 - &state, &dummy, &dummy); 694 + rc = plpar_hcall(H_VASI_STATE, retbuf, 695 + ((u64)args->args[0] << 32) | args->args[1]); 696 + 697 + state = retbuf[0]; 704 698 705 699 if (rc) { 706 700 printk(KERN_ERR "rtas_ibm_suspend_me: vasi_state returned %ld\n",rc); ··· 849 845 */ 850 846 rtas.dev = of_find_node_by_name(NULL, "rtas"); 851 847 if (rtas.dev) { 852 - u32 *basep, *entryp; 853 - u32 *sizep; 848 + const u32 *basep, *entryp, *sizep; 854 849 855 - basep = (u32 *)get_property(rtas.dev, "linux,rtas-base", NULL); 856 - sizep = (u32 *)get_property(rtas.dev, "rtas-size", NULL); 850 + basep = get_property(rtas.dev, "linux,rtas-base", NULL); 851 + sizep = get_property(rtas.dev, "rtas-size", NULL); 857 852 if (basep != NULL && sizep != NULL) { 858 853 rtas.base = *basep; 859 854 rtas.size = *sizep; 860 - entryp = (u32 *)get_property(rtas.dev, "linux,rtas-entry", NULL); 855 + entryp = get_property(rtas.dev, 856 + "linux,rtas-entry", NULL); 861 857 if (entryp == NULL) /* Ugh */ 862 858 rtas.entry = rtas.base; 863 859 else ··· 913 909 basep = of_get_flat_dt_prop(node, "get-term-char", NULL); 914 910 if (basep) 915 911 rtas_getchar_token = *basep; 912 + 913 + if (rtas_putchar_token != RTAS_UNKNOWN_SERVICE && 914 + rtas_getchar_token != RTAS_UNKNOWN_SERVICE) 915 + udbg_init_rtas_console(); 916 + 916 917 #endif 917 918 918 919 /* break now */
+13 -15
arch/powerpc/kernel/rtas_pci.c
··· 57 57 58 58 static int of_device_available(struct device_node * dn) 59 59 { 60 - char * status; 60 + const char *status; 61 61 62 62 status = get_property(dn, "status", NULL); 63 63 ··· 81 81 if (!config_access_valid(pdn, where)) 82 82 return PCIBIOS_BAD_REGISTER_NUMBER; 83 83 84 - addr = ((where & 0xf00) << 20) | (pdn->busno << 16) | 85 - (pdn->devfn << 8) | (where & 0xff); 84 + addr = rtas_config_addr(pdn->busno, pdn->devfn, where); 86 85 buid = pdn->phb->buid; 87 86 if (buid) { 88 87 ret = rtas_call(ibm_read_pci_config, 4, 2, &returnval, ··· 133 134 if (!config_access_valid(pdn, where)) 134 135 return PCIBIOS_BAD_REGISTER_NUMBER; 135 136 136 - addr = ((where & 0xf00) << 20) | (pdn->busno << 16) | 137 - (pdn->devfn << 8) | (where & 0xff); 137 + addr = rtas_config_addr(pdn->busno, pdn->devfn, where); 138 138 buid = pdn->phb->buid; 139 139 if (buid) { 140 140 ret = rtas_call(ibm_write_pci_config, 5, 1, NULL, addr, ··· 176 178 177 179 int is_python(struct device_node *dev) 178 180 { 179 - char *model = (char *)get_property(dev, "model", NULL); 181 + const char *model = get_property(dev, "model", NULL); 180 182 181 183 if (model && strstr(model, "Python")) 182 184 return 1; ··· 232 234 unsigned long __devinit get_phb_buid (struct device_node *phb) 233 235 { 234 236 int addr_cells; 235 - unsigned int *buid_vals; 237 + const unsigned int *buid_vals; 236 238 unsigned int len; 237 239 unsigned long buid; 238 240 ··· 245 247 if (phb->parent->parent) 246 248 return 0; 247 249 248 - buid_vals = (unsigned int *) get_property(phb, "reg", &len); 250 + buid_vals = get_property(phb, "reg", &len); 249 251 if (buid_vals == NULL) 250 252 return 0; 251 253 ··· 262 264 static int phb_set_bus_ranges(struct device_node *dev, 263 265 struct pci_controller *phb) 264 266 { 265 - int *bus_range; 267 + const int *bus_range; 266 268 unsigned int len; 267 269 268 - bus_range = (int *) get_property(dev, "bus-range", &len); 270 + bus_range = get_property(dev, "bus-range", &len); 269 271 if (bus_range == NULL || len < 2 * sizeof(int)) { 270 272 return 1; 271 273 } ··· 323 325 * in chosen. 324 326 */ 325 327 if (of_chosen) { 326 - int *prop; 328 + const int *prop; 327 329 328 - prop = (int *)get_property(of_chosen, "linux,pci-probe-only", 329 - NULL); 330 + prop = get_property(of_chosen, 331 + "linux,pci-probe-only", NULL); 330 332 if (prop) 331 333 pci_probe_only = *prop; 332 334 333 - prop = (int *)get_property(of_chosen, 334 - "linux,pci-assign-all-buses", NULL); 335 + prop = get_property(of_chosen, 336 + "linux,pci-assign-all-buses", NULL); 335 337 if (prop) 336 338 pci_assign_all_buses = *prop; 337 339 }
+18 -14
arch/powerpc/kernel/setup-common.c
··· 304 304 void __init check_for_initrd(void) 305 305 { 306 306 #ifdef CONFIG_BLK_DEV_INITRD 307 - unsigned long *prop; 307 + const unsigned int *prop; 308 + int len; 308 309 309 310 DBG(" -> check_for_initrd()\n"); 310 311 311 312 if (of_chosen) { 312 - prop = (unsigned long *)get_property(of_chosen, 313 - "linux,initrd-start", NULL); 313 + prop = get_property(of_chosen, "linux,initrd-start", &len); 314 314 if (prop != NULL) { 315 - initrd_start = (unsigned long)__va(*prop); 316 - prop = (unsigned long *)get_property(of_chosen, 317 - "linux,initrd-end", NULL); 315 + initrd_start = (unsigned long) 316 + __va(of_read_ulong(prop, len / 4)); 317 + prop = get_property(of_chosen, 318 + "linux,initrd-end", &len); 318 319 if (prop != NULL) { 319 - initrd_end = (unsigned long)__va(*prop); 320 + initrd_end = (unsigned long) 321 + __va(of_read_ulong(prop, len / 4)); 320 322 initrd_below_start_ok = 1; 321 323 } else 322 324 initrd_start = 0; ··· 368 366 int cpu = 0; 369 367 370 368 while ((dn = of_find_node_by_type(dn, "cpu")) && cpu < NR_CPUS) { 371 - int *intserv; 369 + const int *intserv; 372 370 int j, len = sizeof(u32), nthreads = 1; 373 371 374 - intserv = (int *)get_property(dn, "ibm,ppc-interrupt-server#s", 375 - &len); 372 + intserv = get_property(dn, "ibm,ppc-interrupt-server#s", &len); 376 373 if (intserv) 377 374 nthreads = len / sizeof(int); 378 375 else { 379 - intserv = (int *) get_property(dn, "reg", NULL); 376 + intserv = get_property(dn, "reg", NULL); 380 377 if (!intserv) 381 378 intserv = &cpu; /* assume logical == phys */ 382 379 } ··· 396 395 if (machine_is(pseries) && firmware_has_feature(FW_FEATURE_LPAR) && 397 396 (dn = of_find_node_by_path("/rtas"))) { 398 397 int num_addr_cell, num_size_cell, maxcpus; 399 - unsigned int *ireg; 398 + const unsigned int *ireg; 400 399 401 400 num_addr_cell = prom_n_addr_cells(dn); 402 401 num_size_cell = prom_n_size_cells(dn); 403 402 404 - ireg = (unsigned int *) 405 - get_property(dn, "ibm,lrdr-capacity", NULL); 403 + ireg = get_property(dn, "ibm,lrdr-capacity", NULL); 406 404 407 405 if (!ireg) 408 406 goto out; ··· 444 444 445 445 int __initdata do_early_xmon; 446 446 #ifdef CONFIG_XMON 447 + extern int xmon_no_auto_backtrace; 448 + 447 449 static int __init early_xmon(char *p) 448 450 { 449 451 /* ensure xmon is enabled */ ··· 454 452 xmon_init(1); 455 453 if (strncmp(p, "off", 3) == 0) 456 454 xmon_init(0); 455 + if (strncmp(p, "nobt", 4) == 0) 456 + xmon_no_auto_backtrace = 1; 457 457 if (strncmp(p, "early", 5) != 0) 458 458 return 0; 459 459 }
+11 -12
arch/powerpc/kernel/setup_64.c
··· 56 56 #include <asm/page.h> 57 57 #include <asm/mmu.h> 58 58 #include <asm/lmb.h> 59 - #include <asm/iseries/it_lp_naca.h> 60 59 #include <asm/firmware.h> 61 60 #include <asm/xmon.h> 62 61 #include <asm/udbg.h> ··· 78 79 * before we've read this from the device tree. 79 80 */ 80 81 struct ppc64_caches ppc64_caches = { 81 - .dline_size = 0x80, 82 - .log_dline_size = 7, 83 - .iline_size = 0x80, 84 - .log_iline_size = 7 82 + .dline_size = 0x40, 83 + .log_dline_size = 6, 84 + .iline_size = 0x40, 85 + .log_iline_size = 6 85 86 }; 86 87 EXPORT_SYMBOL_GPL(ppc64_caches); 87 88 ··· 106 107 static void check_smt_enabled(void) 107 108 { 108 109 struct device_node *dn; 109 - char *smt_option; 110 + const char *smt_option; 110 111 111 112 /* Allow the command line to overrule the OF option */ 112 113 if (smt_enabled_cmdline) ··· 115 116 dn = of_find_node_by_path("/options"); 116 117 117 118 if (dn) { 118 - smt_option = (char *)get_property(dn, "ibm,smt-enabled", NULL); 119 + smt_option = get_property(dn, "ibm,smt-enabled", NULL); 119 120 120 121 if (smt_option) { 121 122 if (!strcmp(smt_option, "on")) ··· 292 293 */ 293 294 294 295 if ( num_cpus == 1 ) { 295 - u32 *sizep, *lsizep; 296 + const u32 *sizep, *lsizep; 296 297 u32 size, lsize; 297 298 const char *dc, *ic; 298 299 ··· 307 308 308 309 size = 0; 309 310 lsize = cur_cpu_spec->dcache_bsize; 310 - sizep = (u32 *)get_property(np, "d-cache-size", NULL); 311 + sizep = get_property(np, "d-cache-size", NULL); 311 312 if (sizep != NULL) 312 313 size = *sizep; 313 - lsizep = (u32 *) get_property(np, dc, NULL); 314 + lsizep = get_property(np, dc, NULL); 314 315 if (lsizep != NULL) 315 316 lsize = *lsizep; 316 317 if (sizep == 0 || lsizep == 0) ··· 324 325 325 326 size = 0; 326 327 lsize = cur_cpu_spec->icache_bsize; 327 - sizep = (u32 *)get_property(np, "i-cache-size", NULL); 328 + sizep = get_property(np, "i-cache-size", NULL); 328 329 if (sizep != NULL) 329 330 size = *sizep; 330 - lsizep = (u32 *)get_property(np, ic, NULL); 331 + lsizep = get_property(np, ic, NULL); 331 332 if (lsizep != NULL) 332 333 lsize = *lsizep; 333 334 if (sizep == 0 || lsizep == 0)
+4 -5
arch/powerpc/kernel/sysfs.c
··· 60 60 static int __init smt_setup(void) 61 61 { 62 62 struct device_node *options; 63 - unsigned int *val; 63 + const unsigned int *val; 64 64 unsigned int cpu; 65 65 66 66 if (!cpu_has_feature(CPU_FTR_SMT)) ··· 70 70 if (!options) 71 71 return -ENODEV; 72 72 73 - val = (unsigned int *)get_property(options, "ibm,smt-snooze-delay", 74 - NULL); 73 + val = get_property(options, "ibm,smt-snooze-delay", NULL); 75 74 if (!smt_snooze_cmdline && val) { 76 75 for_each_possible_cpu(cpu) 77 76 per_cpu(smt_snooze_delay, cpu) = *val; ··· 230 231 if (cur_cpu_spec->num_pmcs >= 8) 231 232 sysdev_create_file(s, &attr_pmc8); 232 233 233 - if (cpu_has_feature(CPU_FTR_SMT)) 234 + if (cpu_has_feature(CPU_FTR_PURR)) 234 235 sysdev_create_file(s, &attr_purr); 235 236 } 236 237 ··· 272 273 if (cur_cpu_spec->num_pmcs >= 8) 273 274 sysdev_remove_file(s, &attr_pmc8); 274 275 275 - if (cpu_has_feature(CPU_FTR_SMT)) 276 + if (cpu_has_feature(CPU_FTR_PURR)) 276 277 sysdev_remove_file(s, &attr_purr); 277 278 } 278 279 #endif /* CONFIG_HOTPLUG_CPU */
+3 -5
arch/powerpc/kernel/time.c
··· 860 860 static int __init get_freq(char *name, int cells, unsigned long *val) 861 861 { 862 862 struct device_node *cpu; 863 - unsigned int *fp; 863 + const unsigned int *fp; 864 864 int found = 0; 865 865 866 866 /* The cpu node should have timebase and clock frequency properties */ 867 867 cpu = of_find_node_by_type(NULL, "cpu"); 868 868 869 869 if (cpu) { 870 - fp = (unsigned int *)get_property(cpu, name, NULL); 870 + fp = get_property(cpu, name, NULL); 871 871 if (fp) { 872 872 found = 1; 873 - *val = 0; 874 - while (cells--) 875 - *val = (*val << 32) | *fp++; 873 + *val = of_read_ulong(fp, cells); 876 874 } 877 875 878 876 of_node_put(cpu);
+25
arch/powerpc/kernel/traps.c
··· 598 598 #define INST_STSWI 0x7c0005aa 599 599 #define INST_STSWX 0x7c00052a 600 600 601 + #define INST_POPCNTB 0x7c0000f4 602 + #define INST_POPCNTB_MASK 0xfc0007fe 603 + 601 604 static int emulate_string_inst(struct pt_regs *regs, u32 instword) 602 605 { 603 606 u8 rT = (instword >> 21) & 0x1f; ··· 669 666 return 0; 670 667 } 671 668 669 + static int emulate_popcntb_inst(struct pt_regs *regs, u32 instword) 670 + { 671 + u32 ra,rs; 672 + unsigned long tmp; 673 + 674 + ra = (instword >> 16) & 0x1f; 675 + rs = (instword >> 21) & 0x1f; 676 + 677 + tmp = regs->gpr[rs]; 678 + tmp = tmp - ((tmp >> 1) & 0x5555555555555555ULL); 679 + tmp = (tmp & 0x3333333333333333ULL) + ((tmp >> 2) & 0x3333333333333333ULL); 680 + tmp = (tmp + (tmp >> 4)) & 0x0f0f0f0f0f0f0f0fULL; 681 + regs->gpr[ra] = tmp; 682 + 683 + return 0; 684 + } 685 + 672 686 static int emulate_instruction(struct pt_regs *regs) 673 687 { 674 688 u32 instword; ··· 722 702 /* Emulate load/store string insn. */ 723 703 if ((instword & INST_STRING_GEN_MASK) == INST_STRING) 724 704 return emulate_string_inst(regs, instword); 705 + 706 + /* Emulate the popcntb (Population Count Bytes) instruction. */ 707 + if ((instword & INST_POPCNTB_MASK) == INST_POPCNTB) { 708 + return emulate_popcntb_inst(regs, instword); 709 + } 725 710 726 711 return -EINVAL; 727 712 }
+8 -8
arch/powerpc/kernel/vio.c
··· 77 77 } else 78 78 #endif 79 79 { 80 - unsigned char *dma_window; 80 + const unsigned char *dma_window; 81 81 struct iommu_table *tbl; 82 82 unsigned long offset, size; 83 83 ··· 217 217 struct vio_dev * __devinit vio_register_device_node(struct device_node *of_node) 218 218 { 219 219 struct vio_dev *viodev; 220 - unsigned int *unit_address; 220 + const unsigned int *unit_address; 221 221 222 222 /* we need the 'device_type' property, in order to match with drivers */ 223 223 if (of_node->type == NULL) { ··· 227 227 return NULL; 228 228 } 229 229 230 - unit_address = (unsigned int *)get_property(of_node, "reg", NULL); 230 + unit_address = get_property(of_node, "reg", NULL); 231 231 if (unit_address == NULL) { 232 232 printk(KERN_WARNING "%s: node %s missing 'reg'\n", 233 233 __FUNCTION__, ··· 249 249 viodev->type = of_node->type; 250 250 viodev->unit_address = *unit_address; 251 251 if (firmware_has_feature(FW_FEATURE_ISERIES)) { 252 - unit_address = (unsigned int *)get_property(of_node, 252 + unit_address = get_property(of_node, 253 253 "linux,unit_address", NULL); 254 254 if (unit_address != NULL) 255 255 viodev->unit_address = *unit_address; ··· 423 423 { 424 424 const struct vio_dev *vio_dev = to_vio_dev(dev); 425 425 struct device_node *dn = dev->platform_data; 426 - char *cp; 426 + const char *cp; 427 427 int length; 428 428 429 429 if (!num_envp) ··· 431 431 432 432 if (!dn) 433 433 return -ENODEV; 434 - cp = (char *)get_property(dn, "compatible", &length); 434 + cp = get_property(dn, "compatible", &length); 435 435 if (!cp) 436 436 return -ENODEV; 437 437 ··· 493 493 */ 494 494 struct vio_dev *vio_find_node(struct device_node *vnode) 495 495 { 496 - uint32_t *unit_address; 496 + const uint32_t *unit_address; 497 497 char kobj_name[BUS_ID_SIZE]; 498 498 499 499 /* construct the kobject name from the device node */ 500 - unit_address = (uint32_t *)get_property(vnode, "reg", NULL); 500 + unit_address = get_property(vnode, "reg", NULL); 501 501 if (!unit_address) 502 502 return NULL; 503 503 snprintf(kobj_name, BUS_ID_SIZE, "%x", *unit_address);
-1
arch/powerpc/lib/Makefile
··· 14 14 obj-$(CONFIG_PPC64) += checksum_64.o copypage_64.o copyuser_64.o \ 15 15 memcpy_64.o usercopy_64.o mem_64.o string.o \ 16 16 strcase.o 17 - obj-$(CONFIG_PPC_ISERIES) += e2a.o 18 17 obj-$(CONFIG_XMON) += sstep.o 19 18 20 19 ifeq ($(CONFIG_PPC64),y)
-116
arch/powerpc/lib/e2a.c
··· 1 - /* 2 - * EBCDIC to ASCII conversion 3 - * 4 - * This function moved here from arch/powerpc/platforms/iseries/viopath.c 5 - * 6 - * (C) Copyright 2000-2004 IBM Corporation 7 - * 8 - * This program is free software; you can redistribute it and/or 9 - * modify it under the terms of the GNU General Public License as 10 - * published by the Free Software Foundation; either version 2 of the 11 - * License, or (at your option) anyu later version. 12 - * 13 - * This program is distributed in the hope that it will be useful, but 14 - * WITHOUT ANY WARRANTY; without even the implied warranty of 15 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 - * General Public License for more details. 17 - * 18 - * You should have received a copy of the GNU General Public License 19 - * along with this program; if not, write to the Free Software Foundation, 20 - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 - * 22 - */ 23 - 24 - #include <linux/module.h> 25 - 26 - unsigned char e2a(unsigned char x) 27 - { 28 - switch (x) { 29 - case 0xF0: 30 - return '0'; 31 - case 0xF1: 32 - return '1'; 33 - case 0xF2: 34 - return '2'; 35 - case 0xF3: 36 - return '3'; 37 - case 0xF4: 38 - return '4'; 39 - case 0xF5: 40 - return '5'; 41 - case 0xF6: 42 - return '6'; 43 - case 0xF7: 44 - return '7'; 45 - case 0xF8: 46 - return '8'; 47 - case 0xF9: 48 - return '9'; 49 - case 0xC1: 50 - return 'A'; 51 - case 0xC2: 52 - return 'B'; 53 - case 0xC3: 54 - return 'C'; 55 - case 0xC4: 56 - return 'D'; 57 - case 0xC5: 58 - return 'E'; 59 - case 0xC6: 60 - return 'F'; 61 - case 0xC7: 62 - return 'G'; 63 - case 0xC8: 64 - return 'H'; 65 - case 0xC9: 66 - return 'I'; 67 - case 0xD1: 68 - return 'J'; 69 - case 0xD2: 70 - return 'K'; 71 - case 0xD3: 72 - return 'L'; 73 - case 0xD4: 74 - return 'M'; 75 - case 0xD5: 76 - return 'N'; 77 - case 0xD6: 78 - return 'O'; 79 - case 0xD7: 80 - return 'P'; 81 - case 0xD8: 82 - return 'Q'; 83 - case 0xD9: 84 - return 'R'; 85 - case 0xE2: 86 - return 'S'; 87 - case 0xE3: 88 - return 'T'; 89 - case 0xE4: 90 - return 'U'; 91 - case 0xE5: 92 - return 'V'; 93 - case 0xE6: 94 - return 'W'; 95 - case 0xE7: 96 - return 'X'; 97 - case 0xE8: 98 - return 'Y'; 99 - case 0xE9: 100 - return 'Z'; 101 - } 102 - return ' '; 103 - } 104 - EXPORT_SYMBOL(e2a); 105 - 106 - unsigned char* strne2a(unsigned char *dest, const unsigned char *src, size_t n) 107 - { 108 - int i; 109 - 110 - n = strnlen(src, n); 111 - 112 - for (i = 0; i < n; i++) 113 - dest[i] = e2a(src[i]); 114 - 115 - return dest; 116 - }
+13 -14
arch/powerpc/lib/locks.c
··· 23 23 #include <asm/hvcall.h> 24 24 #include <asm/iseries/hv_call.h> 25 25 #include <asm/smp.h> 26 + #include <asm/firmware.h> 26 27 27 28 void __spin_yield(raw_spinlock_t *lock) 28 29 { ··· 40 39 rmb(); 41 40 if (lock->slock != lock_value) 42 41 return; /* something has changed */ 43 - #ifdef CONFIG_PPC_ISERIES 44 - HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, 45 - ((u64)holder_cpu << 32) | yield_count); 46 - #else 47 - plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(holder_cpu), 48 - yield_count); 49 - #endif 42 + if (firmware_has_feature(FW_FEATURE_ISERIES)) 43 + HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, 44 + ((u64)holder_cpu << 32) | yield_count); 45 + else 46 + plpar_hcall_norets(H_CONFER, 47 + get_hard_smp_processor_id(holder_cpu), yield_count); 50 48 } 51 49 52 50 /* ··· 69 69 rmb(); 70 70 if (rw->lock != lock_value) 71 71 return; /* something has changed */ 72 - #ifdef CONFIG_PPC_ISERIES 73 - HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, 74 - ((u64)holder_cpu << 32) | yield_count); 75 - #else 76 - plpar_hcall_norets(H_CONFER, get_hard_smp_processor_id(holder_cpu), 77 - yield_count); 78 - #endif 72 + if (firmware_has_feature(FW_FEATURE_ISERIES)) 73 + HvCall2(HvCallBaseYieldProcessor, HvCall_YieldToProc, 74 + ((u64)holder_cpu << 32) | yield_count); 75 + else 76 + plpar_hcall_norets(H_CONFER, 77 + get_hard_smp_processor_id(holder_cpu), yield_count); 79 78 } 80 79 #endif 81 80
+14 -17
arch/powerpc/mm/numa.c
··· 159 159 { 160 160 unsigned int hw_cpuid = get_hard_smp_processor_id(cpu); 161 161 struct device_node *cpu_node = NULL; 162 - unsigned int *interrupt_server, *reg; 162 + const unsigned int *interrupt_server, *reg; 163 163 int len; 164 164 165 165 while ((cpu_node = of_find_node_by_type(cpu_node, "cpu")) != NULL) { 166 166 /* Try interrupt server first */ 167 - interrupt_server = (unsigned int *)get_property(cpu_node, 167 + interrupt_server = get_property(cpu_node, 168 168 "ibm,ppc-interrupt-server#s", &len); 169 169 170 170 len = len / sizeof(u32); ··· 175 175 return cpu_node; 176 176 } 177 177 } else { 178 - reg = (unsigned int *)get_property(cpu_node, 179 - "reg", &len); 178 + reg = get_property(cpu_node, "reg", &len); 180 179 if (reg && (len > 0) && (reg[0] == hw_cpuid)) 181 180 return cpu_node; 182 181 } ··· 185 186 } 186 187 187 188 /* must hold reference to node during call */ 188 - static int *of_get_associativity(struct device_node *dev) 189 + static const int *of_get_associativity(struct device_node *dev) 189 190 { 190 - return (unsigned int *)get_property(dev, "ibm,associativity", NULL); 191 + return get_property(dev, "ibm,associativity", NULL); 191 192 } 192 193 193 194 /* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa ··· 196 197 static int of_node_to_nid_single(struct device_node *device) 197 198 { 198 199 int nid = -1; 199 - unsigned int *tmp; 200 + const unsigned int *tmp; 200 201 201 202 if (min_common_depth == -1) 202 203 goto out; ··· 254 255 static int __init find_min_common_depth(void) 255 256 { 256 257 int depth; 257 - unsigned int *ref_points; 258 + const unsigned int *ref_points; 258 259 struct device_node *rtas_root; 259 260 unsigned int len; 260 261 ··· 269 270 * configuration (should be all 0's) and the second is for a normal 270 271 * NUMA configuration. 271 272 */ 272 - ref_points = (unsigned int *)get_property(rtas_root, 273 + ref_points = get_property(rtas_root, 273 274 "ibm,associativity-reference-points", &len); 274 275 275 276 if ((len >= 1) && ref_points) { ··· 296 297 of_node_put(memory); 297 298 } 298 299 299 - static unsigned long __devinit read_n_cells(int n, unsigned int **buf) 300 + static unsigned long __devinit read_n_cells(int n, const unsigned int **buf) 300 301 { 301 302 unsigned long result = 0; 302 303 ··· 434 435 unsigned long size; 435 436 int nid; 436 437 int ranges; 437 - unsigned int *memcell_buf; 438 + const unsigned int *memcell_buf; 438 439 unsigned int len; 439 440 440 - memcell_buf = (unsigned int *)get_property(memory, 441 + memcell_buf = get_property(memory, 441 442 "linux,usable-memory", &len); 442 443 if (!memcell_buf || len <= 0) 443 - memcell_buf = 444 - (unsigned int *)get_property(memory, "reg", 445 - &len); 444 + memcell_buf = get_property(memory, "reg", &len); 446 445 if (!memcell_buf || len <= 0) 447 446 continue; 448 447 ··· 784 787 while ((memory = of_find_node_by_type(memory, "memory")) != NULL) { 785 788 unsigned long start, size; 786 789 int ranges; 787 - unsigned int *memcell_buf; 790 + const unsigned int *memcell_buf; 788 791 unsigned int len; 789 792 790 - memcell_buf = (unsigned int *)get_property(memory, "reg", &len); 793 + memcell_buf = get_property(memory, "reg", &len); 791 794 if (!memcell_buf || len <= 0) 792 795 continue; 793 796
+33 -4
arch/powerpc/mm/slb.c
··· 22 22 #include <asm/paca.h> 23 23 #include <asm/cputable.h> 24 24 #include <asm/cacheflush.h> 25 + #include <asm/smp.h> 26 + #include <linux/compiler.h> 25 27 26 28 #ifdef DEBUG 27 29 #define DBG(fmt...) udbg_printf(fmt) ··· 52 50 return (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | flags; 53 51 } 54 52 55 - static inline void create_slbe(unsigned long ea, unsigned long flags, 56 - unsigned long entry) 53 + static inline void slb_shadow_update(unsigned long esid, unsigned long vsid, 54 + unsigned long entry) 57 55 { 56 + /* 57 + * Clear the ESID first so the entry is not valid while we are 58 + * updating it. 59 + */ 60 + get_slb_shadow()->save_area[entry].esid = 0; 61 + barrier(); 62 + get_slb_shadow()->save_area[entry].vsid = vsid; 63 + barrier(); 64 + get_slb_shadow()->save_area[entry].esid = esid; 65 + 66 + } 67 + 68 + static inline void create_shadowed_slbe(unsigned long ea, unsigned long flags, 69 + unsigned long entry) 70 + { 71 + /* 72 + * Updating the shadow buffer before writing the SLB ensures 73 + * we don't get a stale entry here if we get preempted by PHYP 74 + * between these two statements. 75 + */ 76 + slb_shadow_update(mk_esid_data(ea, entry), mk_vsid_data(ea, flags), 77 + entry); 78 + 58 79 asm volatile("slbmte %0,%1" : 59 80 : "r" (mk_vsid_data(ea, flags)), 60 81 "r" (mk_esid_data(ea, entry)) ··· 101 76 ksp_esid_data = mk_esid_data(get_paca()->kstack, 2); 102 77 if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET) 103 78 ksp_esid_data &= ~SLB_ESID_V; 79 + 80 + /* Only third entry (stack) may change here so only resave that */ 81 + slb_shadow_update(ksp_esid_data, 82 + mk_vsid_data(ksp_esid_data, lflags), 2); 104 83 105 84 /* We need to do this all in asm, so we're sure we don't touch 106 85 * the stack between the slbia and rebolting it. */ ··· 238 209 asm volatile("isync":::"memory"); 239 210 asm volatile("slbmte %0,%0"::"r" (0) : "memory"); 240 211 asm volatile("isync; slbia; isync":::"memory"); 241 - create_slbe(PAGE_OFFSET, lflags, 0); 212 + create_shadowed_slbe(PAGE_OFFSET, lflags, 0); 242 213 243 - create_slbe(VMALLOC_START, vflags, 1); 214 + create_shadowed_slbe(VMALLOC_START, vflags, 1); 244 215 245 216 /* We don't bolt the stack for the time being - we're in boot, 246 217 * so the stack is in the bolted segment. By the time it goes
+1
arch/powerpc/mm/tlb_64.c
··· 146 146 psize = mmu_huge_psize; 147 147 #else 148 148 BUG(); 149 + psize = pte_pagesize_index(pte); /* shutup gcc */ 149 150 #endif 150 151 } else 151 152 psize = pte_pagesize_index(pte);
+2 -2
arch/powerpc/platforms/83xx/mpc834x_itx.c
··· 60 60 61 61 np = of_find_node_by_type(NULL, "cpu"); 62 62 if (np != 0) { 63 - unsigned int *fp = 64 - (int *)get_property(np, "clock-frequency", NULL); 63 + const unsigned int *fp = 64 + get_property(np, "clock-frequency", NULL); 65 65 if (fp != 0) 66 66 loops_per_jiffy = *fp / HZ; 67 67 else
+2 -2
arch/powerpc/platforms/83xx/mpc834x_sys.c
··· 57 57 58 58 np = of_find_node_by_type(NULL, "cpu"); 59 59 if (np != 0) { 60 - unsigned int *fp = 61 - (int *)get_property(np, "clock-frequency", NULL); 60 + const unsigned int *fp = 61 + get_property(np, "clock-frequency", NULL); 62 62 if (fp != 0) 63 63 loops_per_jiffy = *fp / HZ; 64 64 else
+2 -2
arch/powerpc/platforms/83xx/pci.c
··· 59 59 int len; 60 60 struct pci_controller *hose; 61 61 struct resource rsrc; 62 - int *bus_range; 62 + const int *bus_range; 63 63 int primary = 1, has_address = 0; 64 64 phys_addr_t immr = get_immrbase(); 65 65 ··· 69 69 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 70 70 71 71 /* Get bus range if any */ 72 - bus_range = (int *)get_property(dev, "bus-range", &len); 72 + bus_range = get_property(dev, "bus-range", &len); 73 73 if (bus_range == NULL || len < 2 * sizeof(int)) { 74 74 printk(KERN_WARNING "Can't get bus-range for %s, assume" 75 75 " bus 0\n", dev->full_name);
+2 -2
arch/powerpc/platforms/85xx/mpc85xx_ads.c
··· 121 121 122 122 cpu = of_find_node_by_type(NULL, "cpu"); 123 123 if (cpu != 0) { 124 - unsigned int *fp; 124 + const unsigned int *fp; 125 125 126 - fp = (int *)get_property(cpu, "clock-frequency", NULL); 126 + fp = get_property(cpu, "clock-frequency", NULL); 127 127 if (fp != 0) 128 128 loops_per_jiffy = *fp / HZ; 129 129 else
+2 -2
arch/powerpc/platforms/85xx/mpc85xx_cds.c
··· 241 241 242 242 cpu = of_find_node_by_type(NULL, "cpu"); 243 243 if (cpu != 0) { 244 - unsigned int *fp; 244 + const unsigned int *fp; 245 245 246 - fp = (int *)get_property(cpu, "clock-frequency", NULL); 246 + fp = get_property(cpu, "clock-frequency", NULL); 247 247 if (fp != 0) 248 248 loops_per_jiffy = *fp / HZ; 249 249 else
+2 -2
arch/powerpc/platforms/85xx/pci.c
··· 41 41 int len; 42 42 struct pci_controller *hose; 43 43 struct resource rsrc; 44 - int *bus_range; 44 + const int *bus_range; 45 45 int primary = 1, has_address = 0; 46 46 phys_addr_t immr = get_immrbase(); 47 47 ··· 51 51 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 52 52 53 53 /* Get bus range if any */ 54 - bus_range = (int *) get_property(dev, "bus-range", &len); 54 + bus_range = get_property(dev, "bus-range", &len); 55 55 if (bus_range == NULL || len < 2 * sizeof(int)) { 56 56 printk(KERN_WARNING "Can't get bus-range for %s, assume" 57 57 " bus 0\n", dev->full_name);
+2 -2
arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
··· 347 347 348 348 np = of_find_node_by_type(NULL, "cpu"); 349 349 if (np != 0) { 350 - unsigned int *fp; 350 + const unsigned int *fp; 351 351 352 - fp = (int *)get_property(np, "clock-frequency", NULL); 352 + fp = get_property(np, "clock-frequency", NULL); 353 353 if (fp != 0) 354 354 loops_per_jiffy = *fp / HZ; 355 355 else
+2 -2
arch/powerpc/platforms/86xx/pci.c
··· 153 153 int len; 154 154 struct pci_controller *hose; 155 155 struct resource rsrc; 156 - int *bus_range; 156 + const int *bus_range; 157 157 int has_address = 0; 158 158 int primary = 0; 159 159 ··· 163 163 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 164 164 165 165 /* Get bus range if any */ 166 - bus_range = (int *) get_property(dev, "bus-range", &len); 166 + bus_range = get_property(dev, "bus-range", &len); 167 167 if (bus_range == NULL || len < 2 * sizeof(int)) 168 168 printk(KERN_WARNING "Can't get bus-range for %s, assume" 169 169 " bus 0\n", dev->full_name);
+1
arch/powerpc/platforms/Makefile
··· 13 13 obj-$(CONFIG_PPC_PSERIES) += pseries/ 14 14 obj-$(CONFIG_PPC_ISERIES) += iseries/ 15 15 obj-$(CONFIG_PPC_MAPLE) += maple/ 16 + obj-$(CONFIG_PPC_PASEMI) += pasemi/ 16 17 obj-$(CONFIG_PPC_CELL) += cell/ 17 18 obj-$(CONFIG_EMBEDDED6xx) += embedded6xx/
+3 -5
arch/powerpc/platforms/cell/cbe_regs.c
··· 97 97 struct cbe_regs_map *map = &cbe_regs_maps[cbe_regs_map_count++]; 98 98 99 99 /* That hack must die die die ! */ 100 - struct address_prop { 100 + const struct address_prop { 101 101 unsigned long address; 102 102 unsigned int len; 103 103 } __attribute__((packed)) *prop; ··· 114 114 if (cbe_thread_map[i].cpu_node == cpu) 115 115 cbe_thread_map[i].regs = map; 116 116 117 - prop = (struct address_prop *)get_property(cpu, "pervasive", 118 - NULL); 117 + prop = get_property(cpu, "pervasive", NULL); 119 118 if (prop != NULL) 120 119 map->pmd_regs = ioremap(prop->address, prop->len); 121 120 122 - prop = (struct address_prop *)get_property(cpu, "iic", 123 - NULL); 121 + prop = get_property(cpu, "iic", NULL); 124 122 if (prop != NULL) 125 123 map->iic_regs = ioremap(prop->address, prop->len); 126 124 }
+11 -12
arch/powerpc/platforms/cell/interrupt.c
··· 89 89 /* Get an IRQ number from the pending state register of the IIC */ 90 90 static unsigned int iic_get_irq(struct pt_regs *regs) 91 91 { 92 - struct cbe_iic_pending_bits pending; 93 - struct iic *iic; 92 + struct cbe_iic_pending_bits pending; 93 + struct iic *iic; 94 94 95 - iic = &__get_cpu_var(iic); 96 - *(unsigned long *) &pending = 97 - in_be64((unsigned long __iomem *) &iic->regs->pending_destr); 98 - iic->eoi_stack[++iic->eoi_ptr] = pending.prio; 99 - BUG_ON(iic->eoi_ptr > 15); 95 + iic = &__get_cpu_var(iic); 96 + *(unsigned long *) &pending = 97 + in_be64((unsigned long __iomem *) &iic->regs->pending_destr); 98 + iic->eoi_stack[++iic->eoi_ptr] = pending.prio; 99 + BUG_ON(iic->eoi_ptr > 15); 100 100 if (pending.flags & CBE_IIC_IRQ_VALID) 101 101 return irq_linear_revmap(iic->host, 102 - iic_pending_to_hwnum(pending)); 102 + iic_pending_to_hwnum(pending)); 103 103 return NO_IRQ; 104 104 } 105 105 ··· 250 250 struct resource r0, r1; 251 251 struct irq_host *host; 252 252 int found = 0; 253 - u32 *np; 253 + const u32 *np; 254 254 255 255 for (dn = NULL; 256 256 (dn = of_find_node_by_name(dn,"interrupt-controller")) != NULL;) { 257 257 if (!device_is_compatible(dn, 258 258 "IBM,CBEA-Internal-Interrupt-Controller")) 259 259 continue; 260 - np = (u32 *)get_property(dn, "ibm,interrupt-server-ranges", 261 - NULL); 262 - if (np == NULL) { 260 + np = get_property(dn, "ibm,interrupt-server-ranges", NULL); 261 + if (np == NULL) { 263 262 printk(KERN_WARNING "IIC: CPU association not found\n"); 264 263 of_node_put(dn); 265 264 return -ENODEV;
+12 -10
arch/powerpc/platforms/cell/iommu.c
··· 308 308 309 309 static void iommu_devnode_setup(struct device_node *d) 310 310 { 311 - unsigned int *ioid; 312 - unsigned long *dma_window, map_start, map_size, token; 311 + const unsigned int *ioid; 312 + unsigned long map_start, map_size, token; 313 + const unsigned long *dma_window; 313 314 struct cell_iommu *iommu; 314 315 315 - ioid = (unsigned int *)get_property(d, "ioid", NULL); 316 + ioid = get_property(d, "ioid", NULL); 316 317 if (!ioid) 317 318 pr_debug("No ioid entry found !\n"); 318 319 319 - dma_window = (unsigned long *)get_property(d, "ibm,dma-window", NULL); 320 + dma_window = get_property(d, "ibm,dma-window", NULL); 320 321 if (!dma_window) 321 322 pr_debug("No ibm,dma-window entry found !\n"); 322 323 ··· 372 371 373 372 static int cell_map_iommu(void) 374 373 { 375 - unsigned int num_nodes = 0, *node_id; 376 - unsigned long *base, *mmio_base; 374 + unsigned int num_nodes = 0; 375 + const unsigned int *node_id; 376 + const unsigned long *base, *mmio_base; 377 377 struct device_node *dn; 378 378 struct cell_iommu *iommu = NULL; 379 379 ··· 383 381 for(dn = of_find_node_by_type(NULL, "cpu"); 384 382 dn; 385 383 dn = of_find_node_by_type(dn, "cpu")) { 386 - node_id = (unsigned int *)get_property(dn, "node-id", NULL); 384 + node_id = get_property(dn, "node-id", NULL); 387 385 388 386 if (num_nodes < *node_id) 389 387 num_nodes = *node_id; ··· 398 396 dn; 399 397 dn = of_find_node_by_type(dn, "cpu")) { 400 398 401 - node_id = (unsigned int *)get_property(dn, "node-id", NULL); 402 - base = (unsigned long *)get_property(dn, "ioc-cache", NULL); 403 - mmio_base = (unsigned long *)get_property(dn, "ioc-translation", NULL); 399 + node_id = get_property(dn, "node-id", NULL); 400 + base = get_property(dn, "ioc-cache", NULL); 401 + mmio_base = get_property(dn, "ioc-translation", NULL); 404 402 405 403 if (!base || !mmio_base || !node_id) 406 404 return cell_map_iommu_hardcoded(num_nodes);
-4
arch/powerpc/platforms/cell/setup.c
··· 150 150 !of_flat_dt_is_compatible(root, "IBM,CPBW-1.0")) 151 151 return 0; 152 152 153 - #ifdef CONFIG_UDBG_RTAS_CONSOLE 154 - udbg_init_rtas_console(); 155 - #endif 156 - 157 153 hpte_init_native(); 158 154 159 155 return 1;
+2 -2
arch/powerpc/platforms/cell/smp.c
··· 57 57 */ 58 58 static cpumask_t of_spin_map; 59 59 60 - extern void pSeries_secondary_smp_init(unsigned long); 60 + extern void generic_secondary_smp_init(unsigned long); 61 61 62 62 /** 63 63 * smp_startup_cpu() - start the given cpu ··· 74 74 { 75 75 int status; 76 76 unsigned long start_here = __pa((u32)*((unsigned long *) 77 - pSeries_secondary_smp_init)); 77 + generic_secondary_smp_init)); 78 78 unsigned int pcpu; 79 79 int start_cpu; 80 80
+5 -5
arch/powerpc/platforms/cell/spider-pic.c
··· 240 240 static unsigned int __init spider_find_cascade_and_node(struct spider_pic *pic) 241 241 { 242 242 unsigned int virq; 243 - u32 *imap, *tmp; 243 + const u32 *imap, *tmp; 244 244 int imaplen, intsize, unit; 245 245 struct device_node *iic; 246 246 struct irq_host *iic_host; ··· 258 258 #endif 259 259 260 260 /* Now do the horrible hacks */ 261 - tmp = (u32 *)get_property(pic->of_node, "#interrupt-cells", NULL); 261 + tmp = get_property(pic->of_node, "#interrupt-cells", NULL); 262 262 if (tmp == NULL) 263 263 return NO_IRQ; 264 264 intsize = *tmp; 265 - imap = (u32 *)get_property(pic->of_node, "interrupt-map", &imaplen); 265 + imap = get_property(pic->of_node, "interrupt-map", &imaplen); 266 266 if (imap == NULL || imaplen < (intsize + 1)) 267 267 return NO_IRQ; 268 268 iic = of_find_node_by_phandle(imap[intsize]); 269 269 if (iic == NULL) 270 270 return NO_IRQ; 271 271 imap += intsize + 1; 272 - tmp = (u32 *)get_property(iic, "#interrupt-cells", NULL); 272 + tmp = get_property(iic, "#interrupt-cells", NULL); 273 273 if (tmp == NULL) 274 274 return NO_IRQ; 275 275 intsize = *tmp; 276 276 /* Assume unit is last entry of interrupt specifier */ 277 277 unit = imap[intsize - 1]; 278 278 /* Ok, we have a unit, now let's try to get the node */ 279 - tmp = (u32 *)get_property(iic, "ibm,interrupt-server-ranges", NULL); 279 + tmp = get_property(iic, "ibm,interrupt-server-ranges", NULL); 280 280 if (tmp == NULL) { 281 281 of_node_put(iic); 282 282 return NO_IRQ;
+9 -9
arch/powerpc/platforms/cell/spu_base.c
··· 488 488 489 489 static int __init find_spu_node_id(struct device_node *spe) 490 490 { 491 - unsigned int *id; 491 + const unsigned int *id; 492 492 struct device_node *cpu; 493 493 cpu = spe->parent->parent; 494 - id = (unsigned int *)get_property(cpu, "node-id", NULL); 494 + id = get_property(cpu, "node-id", NULL); 495 495 return id ? *id : 0; 496 496 } 497 497 ··· 500 500 { 501 501 static DEFINE_MUTEX(add_spumem_mutex); 502 502 503 - struct address_prop { 503 + const struct address_prop { 504 504 unsigned long address; 505 505 unsigned int len; 506 506 } __attribute__((packed)) *p; ··· 511 511 struct zone *zone; 512 512 int ret; 513 513 514 - p = (void*)get_property(spe, prop, &proplen); 514 + p = get_property(spe, prop, &proplen); 515 515 WARN_ON(proplen != sizeof (*p)); 516 516 517 517 start_pfn = p->address >> PAGE_SHIFT; ··· 531 531 static void __iomem * __init map_spe_prop(struct spu *spu, 532 532 struct device_node *n, const char *name) 533 533 { 534 - struct address_prop { 534 + const struct address_prop { 535 535 unsigned long address; 536 536 unsigned int len; 537 537 } __attribute__((packed)) *prop; 538 538 539 - void *p; 539 + const void *p; 540 540 int proplen; 541 541 void* ret = NULL; 542 542 int err = 0; ··· 570 570 { 571 571 struct irq_host *host; 572 572 unsigned int isrc; 573 - u32 *tmp; 573 + const u32 *tmp; 574 574 575 575 host = iic_get_irq_host(spu->node); 576 576 if (host == NULL) 577 577 return -ENODEV; 578 578 579 579 /* Get the interrupt source from the device-tree */ 580 - tmp = (u32 *)get_property(np, "isrc", NULL); 580 + tmp = get_property(np, "isrc", NULL); 581 581 if (!tmp) 582 582 return -ENODEV; 583 583 spu->isrc = isrc = tmp[0]; ··· 593 593 594 594 static int __init spu_map_device(struct spu *spu, struct device_node *node) 595 595 { 596 - char *prop; 596 + const char *prop; 597 597 int ret; 598 598 599 599 ret = -ENODEV;
+3 -2
arch/powerpc/platforms/chrp/nvram.c
··· 67 67 void __init chrp_nvram_init(void) 68 68 { 69 69 struct device_node *nvram; 70 - unsigned int *nbytes_p, proplen; 70 + const unsigned int *nbytes_p; 71 + unsigned int proplen; 71 72 72 73 nvram = of_find_node_by_type(NULL, "nvram"); 73 74 if (nvram == NULL) 74 75 return; 75 76 76 - nbytes_p = (unsigned int *)get_property(nvram, "#bytes", &proplen); 77 + nbytes_p = get_property(nvram, "#bytes", &proplen); 77 78 if (nbytes_p == NULL || proplen != sizeof(unsigned int)) 78 79 return; 79 80
+44 -11
arch/powerpc/platforms/chrp/pci.c
··· 214 214 chrp_find_bridges(void) 215 215 { 216 216 struct device_node *dev; 217 - int *bus_range; 217 + const int *bus_range; 218 218 int len, index = -1; 219 219 struct pci_controller *hose; 220 - unsigned int *dma; 221 - char *model, *machine; 220 + const unsigned int *dma; 221 + const char *model, *machine; 222 222 int is_longtrail = 0, is_mot = 0, is_pegasos = 0; 223 223 struct device_node *root = find_path_device("/"); 224 224 struct resource r; ··· 246 246 dev->full_name); 247 247 continue; 248 248 } 249 - bus_range = (int *) get_property(dev, "bus-range", &len); 249 + bus_range = get_property(dev, "bus-range", &len); 250 250 if (bus_range == NULL || len < 2 * sizeof(int)) { 251 251 printk(KERN_WARNING "Can't get bus-range for %s\n", 252 252 dev->full_name); ··· 257 257 else 258 258 printk(KERN_INFO "PCI buses %d..%d", 259 259 bus_range[0], bus_range[1]); 260 - printk(" controlled by %s", dev->type); 260 + printk(" controlled by %s", dev->full_name); 261 261 if (!is_longtrail) 262 262 printk(" at %llx", (unsigned long long)r.start); 263 263 printk("\n"); ··· 289 289 setup_indirect_pci(hose, 0xfec00cf8, 0xfee00cfc); 290 290 } else if (is_pegasos == 2) { 291 291 setup_peg2(hose, dev); 292 + } else if (!strncmp(model, "IBM,CPC710", 10)) { 293 + setup_indirect_pci(hose, 294 + r.start + 0x000f8000, 295 + r.start + 0x000f8010); 296 + if (index == 0) { 297 + dma = get_property(dev, "system-dma-base",&len); 298 + if (dma && len >= sizeof(*dma)) { 299 + dma = (unsigned int *) 300 + (((unsigned long)dma) + 301 + len - sizeof(*dma)); 302 + pci_dram_offset = *dma; 303 + } 304 + } 292 305 } else { 293 306 printk("No methods for %s (model %s), using RTAS\n", 294 307 dev->full_name, model); ··· 312 299 313 300 /* check the first bridge for a property that we can 314 301 use to set pci_dram_offset */ 315 - dma = (unsigned int *) 316 - get_property(dev, "ibm,dma-ranges", &len); 302 + dma = get_property(dev, "ibm,dma-ranges", &len); 317 303 if (index == 0 && dma != NULL && len >= 6 * sizeof(*dma)) { 318 304 pci_dram_offset = dma[2] - dma[3]; 319 305 printk("pci_dram_offset = %lx\n", pci_dram_offset); 320 306 } 321 307 } 322 - 323 - /* Do not fixup interrupts from OF tree on pegasos */ 324 - if (is_pegasos) 325 - ppc_md.pcibios_fixup = NULL; 326 308 } 309 + 310 + /* SL82C105 IDE Control/Status Register */ 311 + #define SL82C105_IDECSR 0x40 312 + 313 + /* Fixup for Winbond ATA quirk, required for briq */ 314 + void chrp_pci_fixup_winbond_ata(struct pci_dev *sl82c105) 315 + { 316 + u8 progif; 317 + 318 + /* If non-briq machines need that fixup too, please speak up */ 319 + if (!machine_is(chrp) || _chrp_type != _CHRP_briq) 320 + return; 321 + 322 + if ((sl82c105->class & 5) != 5) { 323 + printk("W83C553: Switching SL82C105 IDE to PCI native mode\n"); 324 + /* Enable SL82C105 PCI native IDE mode */ 325 + pci_read_config_byte(sl82c105, PCI_CLASS_PROG, &progif); 326 + pci_write_config_byte(sl82c105, PCI_CLASS_PROG, progif | 0x05); 327 + sl82c105->class |= 0x05; 328 + /* Disable SL82C105 second port */ 329 + pci_write_config_word(sl82c105, SL82C105_IDECSR, 0x0003); 330 + } 331 + } 332 + DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, 333 + chrp_pci_fixup_winbond_ata);
+35 -13
arch/powerpc/platforms/chrp/setup.c
··· 74 74 75 75 extern unsigned long loops_per_jiffy; 76 76 77 + /* To be replaced by RTAS when available */ 78 + static unsigned int *briq_SPOR; 79 + 77 80 #ifdef CONFIG_SMP 78 81 extern struct smp_ops_t chrp_smp_ops; 79 82 #endif ··· 93 90 }; 94 91 static const char *gg2_cachemodes[4] = { 95 92 "Disabled", "Write-Through", "Copy-Back", "Transparent Mode" 93 + }; 94 + 95 + static const char *chrp_names[] = { 96 + "Unknown", 97 + "","","", 98 + "Motorola", 99 + "IBM or Longtrail", 100 + "Genesi Pegasos", 101 + "Total Impact Briq" 96 102 }; 97 103 98 104 void chrp_show_cpuinfo(struct seq_file *m) ··· 226 214 /* Enable L2 cache if needed */ 227 215 np = find_type_devices("cpu"); 228 216 if (np != NULL) { 229 - unsigned int *l2cr = (unsigned int *) 230 - get_property (np, "l2cr", NULL); 217 + const unsigned int *l2cr = get_property(np, "l2cr", NULL); 231 218 if (l2cr == NULL) { 232 219 printk ("Pegasos l2cr : no cpu l2cr property found\n"); 233 220 return; ··· 240 229 } 241 230 } 242 231 232 + static void briq_restart(char *cmd) 233 + { 234 + local_irq_disable(); 235 + if (briq_SPOR) 236 + out_be32(briq_SPOR, 0); 237 + for(;;); 238 + } 239 + 243 240 void __init chrp_setup_arch(void) 244 241 { 245 242 struct device_node *root = find_path_device ("/"); 246 - char *machine = NULL; 243 + const char *machine = NULL; 247 244 248 245 /* init to some ~sane value until calibrate_delay() runs */ 249 246 loops_per_jiffy = 50000000/HZ; ··· 264 245 _chrp_type = _CHRP_IBM; 265 246 } else if (machine && strncmp(machine, "MOT", 3) == 0) { 266 247 _chrp_type = _CHRP_Motorola; 248 + } else if (machine && strncmp(machine, "TotalImpact,BRIQ-1", 18) == 0) { 249 + _chrp_type = _CHRP_briq; 250 + /* Map the SPOR register on briq and change the restart hook */ 251 + briq_SPOR = (unsigned int *)ioremap(0xff0000e8, 4); 252 + ppc_md.restart = briq_restart; 267 253 } else { 268 254 /* Let's assume it is an IBM chrp if all else fails */ 269 255 _chrp_type = _CHRP_IBM; 270 256 } 271 - printk("chrp type = %x\n", _chrp_type); 257 + printk("chrp type = %x [%s]\n", _chrp_type, chrp_names[_chrp_type]); 272 258 273 259 rtas_initialize(); 274 260 if (rtas_token("display-character") >= 0) ··· 352 328 struct device_node *np, *root; 353 329 int len, i, j; 354 330 int isu_size, idu_size; 355 - unsigned int *iranges, *opprop = NULL; 331 + const unsigned int *iranges, *opprop = NULL; 356 332 int oplen = 0; 357 333 unsigned long opaddr; 358 334 int na = 1; ··· 362 338 return; 363 339 root = of_find_node_by_path("/"); 364 340 if (root) { 365 - opprop = (unsigned int *) get_property 366 - (root, "platform-open-pic", &oplen); 341 + opprop = get_property(root, "platform-open-pic", &oplen); 367 342 na = prom_n_addr_cells(root); 368 343 } 369 344 if (opprop && oplen >= na * sizeof(unsigned int)) { ··· 379 356 380 357 printk(KERN_INFO "OpenPIC at %lx\n", opaddr); 381 358 382 - iranges = (unsigned int *) get_property(np, "interrupt-ranges", &len); 359 + iranges = get_property(np, "interrupt-ranges", &len); 383 360 if (iranges == NULL) 384 361 len = 0; /* non-distributed mpic */ 385 362 else ··· 465 442 * from anyway 466 443 */ 467 444 for (np = find_devices("pci"); np != NULL; np = np->next) { 468 - unsigned int *addrp = (unsigned int *) 469 - get_property(np, "8259-interrupt-acknowledge", NULL); 445 + const unsigned int *addrp = get_property(np, 446 + "8259-interrupt-acknowledge", NULL); 470 447 471 448 if (addrp == NULL) 472 449 continue; ··· 525 502 chrp_init2(void) 526 503 { 527 504 struct device_node *device; 528 - unsigned int *p = NULL; 505 + const unsigned int *p = NULL; 529 506 530 507 #ifdef CONFIG_NVRAM 531 508 chrp_nvram_init(); ··· 543 520 */ 544 521 device = find_devices("rtas"); 545 522 if (device) 546 - p = (unsigned int *) get_property 547 - (device, "rtas-event-scan-rate", NULL); 523 + p = get_property(device, "rtas-event-scan-rate", NULL); 548 524 if (p && *p) { 549 525 /* 550 526 * Arrange to call chrp_event_scan at least *p times
+4 -4
arch/powerpc/platforms/embedded6xx/mpc7448_hpc2.c
··· 95 95 { 96 96 struct pci_controller *hose; 97 97 struct device_node *node; 98 - unsigned int *interrupt; 98 + const unsigned int *interrupt; 99 99 int busnr; 100 100 int len; 101 101 u8 slot; ··· 112 112 if (!node) 113 113 printk(KERN_ERR "No pci node found\n"); 114 114 115 - interrupt = (unsigned int *) get_property(node, "interrupt-map", &len); 115 + interrupt = get_property(node, "interrupt-map", &len); 116 116 slot = find_slot_by_devfn(interrupt, dev->devfn); 117 117 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); 118 118 if (pin == 0 || pin > 4) ··· 141 141 142 142 cpu = of_find_node_by_type(NULL, "cpu"); 143 143 if (cpu != 0) { 144 - unsigned int *fp; 144 + const unsigned int *fp; 145 145 146 - fp = (int *)get_property(cpu, "clock-frequency", NULL); 146 + fp = get_property(cpu, "clock-frequency", NULL); 147 147 if (fp != 0) 148 148 loops_per_jiffy = *fp / HZ; 149 149 else
+6 -2
arch/powerpc/platforms/iseries/Kconfig
··· 3 3 depends on PPC_ISERIES 4 4 5 5 config VIOCONS 6 - tristate "iSeries Virtual Console Support" 6 + tristate "iSeries Virtual Console Support (Obsolete)" 7 + help 8 + This is the old virtual console driver for legacy iSeries. 9 + You should use the iSeries Hypervisor Virtual Console 10 + support instead. 7 11 8 12 config VIODASD 9 13 tristate "iSeries Virtual I/O disk support" 10 14 help 11 15 If you are running on an iSeries system and you want to use 12 - virtual disks created and managed by OS/400, say Y. 16 + virtual disks created and managed by OS/400, say Y. 13 17 14 18 config VIOCD 15 19 tristate "iSeries Virtual I/O CD support"
+42 -3
arch/powerpc/platforms/iseries/dt.c
··· 1 1 /* 2 - * Copyright (c) 2005-2006 Michael Ellerman, IBM Corporation 2 + * Copyright (C) 2005-2006 Michael Ellerman, IBM Corporation 3 + * Copyright (C) 2000-2004, IBM Corporation 3 4 * 4 5 * Description: 5 6 * This file contains all the routines to build a flattened device ··· 34 33 #include <asm/iseries/hv_types.h> 35 34 #include <asm/iseries/hv_lp_config.h> 36 35 #include <asm/iseries/hv_call_xm.h> 37 - #include <asm/iseries/it_exp_vpd_panel.h> 38 36 #include <asm/udbg.h> 39 37 40 38 #include "processor_vpd.h" 41 39 #include "call_hpt.h" 42 40 #include "call_pci.h" 43 41 #include "pci.h" 42 + #include "it_exp_vpd_panel.h" 44 43 45 44 #ifdef DEBUG 46 45 #define DBG(fmt...) udbg_printf(fmt) ··· 76 75 static char __initdata device_type_pci[] = "pci"; 77 76 static char __initdata device_type_vdevice[] = "vdevice"; 78 77 static char __initdata device_type_vscsi[] = "vscsi"; 78 + 79 + 80 + /* EBCDIC to ASCII conversion routines */ 81 + 82 + static unsigned char __init e2a(unsigned char x) 83 + { 84 + switch (x) { 85 + case 0x81 ... 0x89: 86 + return x - 0x81 + 'a'; 87 + case 0x91 ... 0x99: 88 + return x - 0x91 + 'j'; 89 + case 0xA2 ... 0xA9: 90 + return x - 0xA2 + 's'; 91 + case 0xC1 ... 0xC9: 92 + return x - 0xC1 + 'A'; 93 + case 0xD1 ... 0xD9: 94 + return x - 0xD1 + 'J'; 95 + case 0xE2 ... 0xE9: 96 + return x - 0xE2 + 'S'; 97 + case 0xF0 ... 0xF9: 98 + return x - 0xF0 + '0'; 99 + } 100 + return ' '; 101 + } 102 + 103 + static unsigned char * __init strne2a(unsigned char *dest, 104 + const unsigned char *src, size_t n) 105 + { 106 + int i; 107 + 108 + n = strnlen(src, n); 109 + 110 + for (i = 0; i < n; i++) 111 + dest[i] = e2a(src[i]); 112 + 113 + return dest; 114 + } 79 115 80 116 static struct iseries_flat_dt * __init dt_init(void) 81 117 { ··· 336 298 dt_prop_u32(dt, "#address-cells", 1); 337 299 dt_prop_u32(dt, "#size-cells", 0); 338 300 339 - dt_do_vdevice(dt, "vty", reg, -1, device_type_serial, NULL, 1); 301 + dt_do_vdevice(dt, "vty", reg, -1, device_type_serial, 302 + "IBM,iSeries-vty", 1); 340 303 reg++; 341 304 342 305 dt_do_vdevice(dt, "v-scsi", reg, -1, device_type_vscsi,
+13
arch/powerpc/platforms/iseries/hvlpconfig.c
··· 18 18 19 19 #include <linux/module.h> 20 20 #include <asm/iseries/hv_lp_config.h> 21 + #include "it_lp_naca.h" 21 22 22 23 HvLpIndex HvLpConfig_getLpIndex_outline(void) 23 24 { 24 25 return HvLpConfig_getLpIndex(); 25 26 } 26 27 EXPORT_SYMBOL(HvLpConfig_getLpIndex_outline); 28 + 29 + HvLpIndex HvLpConfig_getLpIndex(void) 30 + { 31 + return itLpNaca.xLpIndex; 32 + } 33 + EXPORT_SYMBOL(HvLpConfig_getLpIndex); 34 + 35 + HvLpIndex HvLpConfig_getPrimaryLpIndex(void) 36 + { 37 + return itLpNaca.xPrimaryLpIndex; 38 + } 39 + EXPORT_SYMBOL_GPL(HvLpConfig_getPrimaryLpIndex);
+18 -1
arch/powerpc/platforms/iseries/iommu.c
··· 88 88 } 89 89 90 90 /* 91 + * Structure passed to HvCallXm_getTceTableParms 92 + */ 93 + struct iommu_table_cb { 94 + unsigned long itc_busno; /* Bus number for this tce table */ 95 + unsigned long itc_start; /* Will be NULL for secondary */ 96 + unsigned long itc_totalsize; /* Size (in pages) of whole table */ 97 + unsigned long itc_offset; /* Index into real tce table of the 98 + start of our section */ 99 + unsigned long itc_size; /* Size (in pages) of our section */ 100 + unsigned long itc_index; /* Index of this tce table */ 101 + unsigned short itc_maxtables; /* Max num of tables for partition */ 102 + unsigned char itc_virtbus; /* Flag to indicate virtual bus */ 103 + unsigned char itc_slotno; /* IOA Tce Slot Index */ 104 + unsigned char itc_rsvd[4]; 105 + }; 106 + 107 + /* 91 108 * Call Hv with the architected data structure to get TCE table info. 92 109 * info. Put the returned data into the Linux representation of the 93 110 * TCE table data. ··· 179 162 { 180 163 struct iommu_table *tbl; 181 164 struct pci_dn *pdn = PCI_DN(dn); 182 - u32 *lsn = (u32 *)get_property(dn, "linux,logical-slot-number", NULL); 165 + const u32 *lsn = get_property(dn, "linux,logical-slot-number", NULL); 183 166 184 167 BUG_ON(lsn == NULL); 185 168
+2 -4
arch/powerpc/platforms/iseries/lpardata.c
··· 13 13 #include <asm/processor.h> 14 14 #include <asm/ptrace.h> 15 15 #include <asm/abs_addr.h> 16 - #include <asm/iseries/it_lp_naca.h> 17 16 #include <asm/lppaca.h> 18 17 #include <asm/iseries/it_lp_reg_save.h> 19 18 #include <asm/paca.h> 20 19 #include <asm/iseries/lpar_map.h> 21 - #include <asm/iseries/it_exp_vpd_panel.h> 22 20 #include <asm/iseries/it_lp_queue.h> 23 21 24 22 #include "naca.h" ··· 25 27 #include "ipl_parms.h" 26 28 #include "processor_vpd.h" 27 29 #include "release_data.h" 30 + #include "it_exp_vpd_panel.h" 31 + #include "it_lp_naca.h" 28 32 29 33 /* The HvReleaseData is the root of the information shared between 30 34 * the hypervisor and Linux. ··· 127 127 (u64)instruction_access_slb_iSeries /* 0x480 I-SLB */ 128 128 } 129 129 }; 130 - EXPORT_SYMBOL(itLpNaca); 131 130 132 131 /* May be filled in by the hypervisor so cannot end up in the BSS */ 133 132 struct ItIplParmsReal xItIplParmsReal __attribute__((__section__(".data"))); 134 133 135 134 /* May be filled in by the hypervisor so cannot end up in the BSS */ 136 135 struct ItExtVpdPanel xItExtVpdPanel __attribute__((__section__(".data"))); 137 - EXPORT_SYMBOL(xItExtVpdPanel); 138 136 139 137 #define maxPhysicalProcessors 32 140 138
+1 -1
arch/powerpc/platforms/iseries/lpevents.c
··· 20 20 #include <asm/iseries/it_lp_queue.h> 21 21 #include <asm/iseries/hv_lp_event.h> 22 22 #include <asm/iseries/hv_call_event.h> 23 - #include <asm/iseries/it_lp_naca.h> 23 + #include "it_lp_naca.h" 24 24 25 25 /* 26 26 * The LpQueue is used to pass event data from the hypervisor to
+52 -52
arch/powerpc/platforms/iseries/main_store.h
··· 61 61 }; 62 62 63 63 /* Main Store VPD for Power4 */ 64 - struct IoHriMainStoreChipInfo1 { 65 - u32 chipMfgID __attribute((packed)); 66 - char chipECLevel[4] __attribute((packed)); 64 + struct __attribute((packed)) IoHriMainStoreChipInfo1 { 65 + u32 chipMfgID; 66 + char chipECLevel[4]; 67 67 }; 68 68 69 69 struct IoHriMainStoreVpdIdData { ··· 73 73 char serialNumber[12]; 74 74 }; 75 75 76 - struct IoHriMainStoreVpdFruData { 77 - char fruLabel[8] __attribute((packed)); 78 - u8 numberOfSlots __attribute((packed)); 79 - u8 pluggingType __attribute((packed)); 80 - u16 slotMapIndex __attribute((packed)); 76 + struct __attribute((packed)) IoHriMainStoreVpdFruData { 77 + char fruLabel[8]; 78 + u8 numberOfSlots; 79 + u8 pluggingType; 80 + u16 slotMapIndex; 81 81 }; 82 82 83 - struct IoHriMainStoreAdrRangeBlock { 84 - void *blockStart __attribute((packed)); 85 - void *blockEnd __attribute((packed)); 86 - u32 blockProcChipId __attribute((packed)); 83 + struct __attribute((packed)) IoHriMainStoreAdrRangeBlock { 84 + void *blockStart; 85 + void *blockEnd; 86 + u32 blockProcChipId; 87 87 }; 88 88 89 89 #define MaxAreaAdrRangeBlocks 4 90 90 91 - struct IoHriMainStoreArea4 { 92 - u32 msVpdFormat __attribute((packed)); 93 - u8 containedVpdType __attribute((packed)); 94 - u8 reserved1 __attribute((packed)); 95 - u16 reserved2 __attribute((packed)); 91 + struct __attribute((packed)) IoHriMainStoreArea4 { 92 + u32 msVpdFormat; 93 + u8 containedVpdType; 94 + u8 reserved1; 95 + u16 reserved2; 96 96 97 - u64 msExists __attribute((packed)); 98 - u64 msFunctional __attribute((packed)); 97 + u64 msExists; 98 + u64 msFunctional; 99 99 100 - u32 memorySize __attribute((packed)); 101 - u32 procNodeId __attribute((packed)); 100 + u32 memorySize; 101 + u32 procNodeId; 102 102 103 - u32 numAdrRangeBlocks __attribute((packed)); 104 - struct IoHriMainStoreAdrRangeBlock xAdrRangeBlock[MaxAreaAdrRangeBlocks] __attribute((packed)); 103 + u32 numAdrRangeBlocks; 104 + struct IoHriMainStoreAdrRangeBlock xAdrRangeBlock[MaxAreaAdrRangeBlocks]; 105 105 106 - struct IoHriMainStoreChipInfo1 chipInfo0 __attribute((packed)); 107 - struct IoHriMainStoreChipInfo1 chipInfo1 __attribute((packed)); 108 - struct IoHriMainStoreChipInfo1 chipInfo2 __attribute((packed)); 109 - struct IoHriMainStoreChipInfo1 chipInfo3 __attribute((packed)); 110 - struct IoHriMainStoreChipInfo1 chipInfo4 __attribute((packed)); 111 - struct IoHriMainStoreChipInfo1 chipInfo5 __attribute((packed)); 112 - struct IoHriMainStoreChipInfo1 chipInfo6 __attribute((packed)); 113 - struct IoHriMainStoreChipInfo1 chipInfo7 __attribute((packed)); 106 + struct IoHriMainStoreChipInfo1 chipInfo0; 107 + struct IoHriMainStoreChipInfo1 chipInfo1; 108 + struct IoHriMainStoreChipInfo1 chipInfo2; 109 + struct IoHriMainStoreChipInfo1 chipInfo3; 110 + struct IoHriMainStoreChipInfo1 chipInfo4; 111 + struct IoHriMainStoreChipInfo1 chipInfo5; 112 + struct IoHriMainStoreChipInfo1 chipInfo6; 113 + struct IoHriMainStoreChipInfo1 chipInfo7; 114 114 115 - void *msRamAreaArray __attribute((packed)); 116 - u32 msRamAreaArrayNumEntries __attribute((packed)); 117 - u32 msRamAreaArrayEntrySize __attribute((packed)); 115 + void *msRamAreaArray; 116 + u32 msRamAreaArrayNumEntries; 117 + u32 msRamAreaArrayEntrySize; 118 118 119 - u32 numaDimmExists __attribute((packed)); 120 - u32 numaDimmFunctional __attribute((packed)); 121 - void *numaDimmArray __attribute((packed)); 122 - u32 numaDimmArrayNumEntries __attribute((packed)); 123 - u32 numaDimmArrayEntrySize __attribute((packed)); 119 + u32 numaDimmExists; 120 + u32 numaDimmFunctional; 121 + void *numaDimmArray; 122 + u32 numaDimmArrayNumEntries; 123 + u32 numaDimmArrayEntrySize; 124 124 125 - struct IoHriMainStoreVpdIdData idData __attribute((packed)); 125 + struct IoHriMainStoreVpdIdData idData; 126 126 127 - u64 powerData __attribute((packed)); 128 - u64 cardAssemblyPartNum __attribute((packed)); 129 - u64 chipSerialNum __attribute((packed)); 127 + u64 powerData; 128 + u64 cardAssemblyPartNum; 129 + u64 chipSerialNum; 130 130 131 - u64 reserved3 __attribute((packed)); 132 - char reserved4[16] __attribute((packed)); 131 + u64 reserved3; 132 + char reserved4[16]; 133 133 134 - struct IoHriMainStoreVpdFruData fruData __attribute((packed)); 134 + struct IoHriMainStoreVpdFruData fruData; 135 135 136 - u8 vpdPortNum __attribute((packed)); 137 - u8 reserved5 __attribute((packed)); 138 - u8 frameId __attribute((packed)); 139 - u8 rackUnit __attribute((packed)); 140 - char asciiKeywordVpd[256] __attribute((packed)); 141 - u32 reserved6 __attribute((packed)); 136 + u8 vpdPortNum; 137 + u8 reserved5; 138 + u8 frameId; 139 + u8 rackUnit; 140 + char asciiKeywordVpd[256]; 141 + u32 reserved6; 142 142 }; 143 143 144 144
+232 -57
arch/powerpc/platforms/iseries/pci.c
··· 34 34 #include <asm/pci-bridge.h> 35 35 #include <asm/iommu.h> 36 36 #include <asm/abs_addr.h> 37 + #include <asm/firmware.h> 37 38 38 39 #include <asm/iseries/hv_call_xm.h> 39 40 #include <asm/iseries/mf.h> ··· 177 176 } 178 177 while ((node = of_get_next_child(root, node)) != NULL) { 179 178 HvBusNumber bus; 180 - u32 *busp; 179 + const u32 *busp; 181 180 182 181 if ((node->type == NULL) || (strcmp(node->type, "pci") != 0)) 183 182 continue; 184 183 185 - busp = (u32 *)get_property(node, "bus-range", NULL); 184 + busp = get_property(node, "bus-range", NULL); 186 185 if (busp == NULL) 187 186 continue; 188 187 bus = *busp; ··· 222 221 223 222 if (node != NULL) { 224 223 struct pci_dn *pdn = PCI_DN(node); 225 - u32 *agent; 224 + const u32 *agent; 226 225 227 - agent = (u32 *)get_property(node, "linux,agent-id", 228 - NULL); 226 + agent = get_property(node, "linux,agent-id", NULL); 229 227 if ((pdn != NULL) && (agent != NULL)) { 230 228 u8 irq = iSeries_allocate_IRQ(pdn->busno, 0, 231 229 pdn->bussubno); ··· 269 269 void pcibios_fixup_resources(struct pci_dev *pdev) 270 270 { 271 271 } 272 - 273 - /* 274 - * I/0 Memory copy MUST use mmio commands on iSeries 275 - * To do; For performance, include the hv call directly 276 - */ 277 - void iSeries_memset_io(volatile void __iomem *dest, char c, size_t Count) 278 - { 279 - u8 ByteValue = c; 280 - long NumberOfBytes = Count; 281 - 282 - while (NumberOfBytes > 0) { 283 - iSeries_Write_Byte(ByteValue, dest++); 284 - -- NumberOfBytes; 285 - } 286 - } 287 - EXPORT_SYMBOL(iSeries_memset_io); 288 - 289 - void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, size_t count) 290 - { 291 - char *src = source; 292 - long NumberOfBytes = count; 293 - 294 - while (NumberOfBytes > 0) { 295 - iSeries_Write_Byte(*src++, dest++); 296 - -- NumberOfBytes; 297 - } 298 - } 299 - EXPORT_SYMBOL(iSeries_memcpy_toio); 300 - 301 - void iSeries_memcpy_fromio(void *dest, const volatile void __iomem *src, size_t count) 302 - { 303 - char *dst = dest; 304 - long NumberOfBytes = count; 305 - 306 - while (NumberOfBytes > 0) { 307 - *dst++ = iSeries_Read_Byte(src++); 308 - -- NumberOfBytes; 309 - } 310 - } 311 - EXPORT_SYMBOL(iSeries_memcpy_fromio); 312 272 313 273 /* 314 274 * Look down the chain to find the matching Device Device ··· 452 492 * iSeries_Read_Word = Read Word (16 bit) 453 493 * iSeries_Read_Long = Read Long (32 bit) 454 494 */ 455 - u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) 495 + static u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) 456 496 { 457 497 u64 BarOffset; 458 498 u64 dsa; ··· 479 519 480 520 return (u8)ret.value; 481 521 } 482 - EXPORT_SYMBOL(iSeries_Read_Byte); 483 522 484 - u16 iSeries_Read_Word(const volatile void __iomem *IoAddress) 523 + static u16 iSeries_Read_Word(const volatile void __iomem *IoAddress) 485 524 { 486 525 u64 BarOffset; 487 526 u64 dsa; ··· 508 549 509 550 return swab16((u16)ret.value); 510 551 } 511 - EXPORT_SYMBOL(iSeries_Read_Word); 512 552 513 - u32 iSeries_Read_Long(const volatile void __iomem *IoAddress) 553 + static u32 iSeries_Read_Long(const volatile void __iomem *IoAddress) 514 554 { 515 555 u64 BarOffset; 516 556 u64 dsa; ··· 537 579 538 580 return swab32((u32)ret.value); 539 581 } 540 - EXPORT_SYMBOL(iSeries_Read_Long); 541 582 542 583 /* 543 584 * Write MM I/O Instructions for the iSeries ··· 545 588 * iSeries_Write_Word = Write Word(16 bit) 546 589 * iSeries_Write_Long = Write Long(32 bit) 547 590 */ 548 - void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress) 591 + static void iSeries_Write_Byte(u8 data, volatile void __iomem *IoAddress) 549 592 { 550 593 u64 BarOffset; 551 594 u64 dsa; ··· 570 613 rc = HvCall4(HvCallPciBarStore8, dsa, BarOffset, data, 0); 571 614 } while (CheckReturnCode("WWB", DevNode, &retry, rc) != 0); 572 615 } 573 - EXPORT_SYMBOL(iSeries_Write_Byte); 574 616 575 - void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress) 617 + static void iSeries_Write_Word(u16 data, volatile void __iomem *IoAddress) 576 618 { 577 619 u64 BarOffset; 578 620 u64 dsa; ··· 596 640 rc = HvCall4(HvCallPciBarStore16, dsa, BarOffset, swab16(data), 0); 597 641 } while (CheckReturnCode("WWW", DevNode, &retry, rc) != 0); 598 642 } 599 - EXPORT_SYMBOL(iSeries_Write_Word); 600 643 601 - void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress) 644 + static void iSeries_Write_Long(u32 data, volatile void __iomem *IoAddress) 602 645 { 603 646 u64 BarOffset; 604 647 u64 dsa; ··· 622 667 rc = HvCall4(HvCallPciBarStore32, dsa, BarOffset, swab32(data), 0); 623 668 } while (CheckReturnCode("WWL", DevNode, &retry, rc) != 0); 624 669 } 625 - EXPORT_SYMBOL(iSeries_Write_Long); 670 + 671 + extern unsigned char __raw_readb(const volatile void __iomem *addr) 672 + { 673 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 674 + 675 + return *(volatile unsigned char __force *)addr; 676 + } 677 + EXPORT_SYMBOL(__raw_readb); 678 + 679 + extern unsigned short __raw_readw(const volatile void __iomem *addr) 680 + { 681 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 682 + 683 + return *(volatile unsigned short __force *)addr; 684 + } 685 + EXPORT_SYMBOL(__raw_readw); 686 + 687 + extern unsigned int __raw_readl(const volatile void __iomem *addr) 688 + { 689 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 690 + 691 + return *(volatile unsigned int __force *)addr; 692 + } 693 + EXPORT_SYMBOL(__raw_readl); 694 + 695 + extern unsigned long __raw_readq(const volatile void __iomem *addr) 696 + { 697 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 698 + 699 + return *(volatile unsigned long __force *)addr; 700 + } 701 + EXPORT_SYMBOL(__raw_readq); 702 + 703 + extern void __raw_writeb(unsigned char v, volatile void __iomem *addr) 704 + { 705 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 706 + 707 + *(volatile unsigned char __force *)addr = v; 708 + } 709 + EXPORT_SYMBOL(__raw_writeb); 710 + 711 + extern void __raw_writew(unsigned short v, volatile void __iomem *addr) 712 + { 713 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 714 + 715 + *(volatile unsigned short __force *)addr = v; 716 + } 717 + EXPORT_SYMBOL(__raw_writew); 718 + 719 + extern void __raw_writel(unsigned int v, volatile void __iomem *addr) 720 + { 721 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 722 + 723 + *(volatile unsigned int __force *)addr = v; 724 + } 725 + EXPORT_SYMBOL(__raw_writel); 726 + 727 + extern void __raw_writeq(unsigned long v, volatile void __iomem *addr) 728 + { 729 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 730 + 731 + *(volatile unsigned long __force *)addr = v; 732 + } 733 + EXPORT_SYMBOL(__raw_writeq); 734 + 735 + int in_8(const volatile unsigned char __iomem *addr) 736 + { 737 + if (firmware_has_feature(FW_FEATURE_ISERIES)) 738 + return iSeries_Read_Byte(addr); 739 + return __in_8(addr); 740 + } 741 + EXPORT_SYMBOL(in_8); 742 + 743 + void out_8(volatile unsigned char __iomem *addr, int val) 744 + { 745 + if (firmware_has_feature(FW_FEATURE_ISERIES)) 746 + iSeries_Write_Byte(val, addr); 747 + else 748 + __out_8(addr, val); 749 + } 750 + EXPORT_SYMBOL(out_8); 751 + 752 + int in_le16(const volatile unsigned short __iomem *addr) 753 + { 754 + if (firmware_has_feature(FW_FEATURE_ISERIES)) 755 + return iSeries_Read_Word(addr); 756 + return __in_le16(addr); 757 + } 758 + EXPORT_SYMBOL(in_le16); 759 + 760 + int in_be16(const volatile unsigned short __iomem *addr) 761 + { 762 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 763 + 764 + return __in_be16(addr); 765 + } 766 + EXPORT_SYMBOL(in_be16); 767 + 768 + void out_le16(volatile unsigned short __iomem *addr, int val) 769 + { 770 + if (firmware_has_feature(FW_FEATURE_ISERIES)) 771 + iSeries_Write_Word(val, addr); 772 + else 773 + __out_le16(addr, val); 774 + } 775 + EXPORT_SYMBOL(out_le16); 776 + 777 + void out_be16(volatile unsigned short __iomem *addr, int val) 778 + { 779 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 780 + 781 + __out_be16(addr, val); 782 + } 783 + EXPORT_SYMBOL(out_be16); 784 + 785 + unsigned in_le32(const volatile unsigned __iomem *addr) 786 + { 787 + if (firmware_has_feature(FW_FEATURE_ISERIES)) 788 + return iSeries_Read_Long(addr); 789 + return __in_le32(addr); 790 + } 791 + EXPORT_SYMBOL(in_le32); 792 + 793 + unsigned in_be32(const volatile unsigned __iomem *addr) 794 + { 795 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 796 + 797 + return __in_be32(addr); 798 + } 799 + EXPORT_SYMBOL(in_be32); 800 + 801 + void out_le32(volatile unsigned __iomem *addr, int val) 802 + { 803 + if (firmware_has_feature(FW_FEATURE_ISERIES)) 804 + iSeries_Write_Long(val, addr); 805 + else 806 + __out_le32(addr, val); 807 + } 808 + EXPORT_SYMBOL(out_le32); 809 + 810 + void out_be32(volatile unsigned __iomem *addr, int val) 811 + { 812 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 813 + 814 + __out_be32(addr, val); 815 + } 816 + EXPORT_SYMBOL(out_be32); 817 + 818 + unsigned long in_le64(const volatile unsigned long __iomem *addr) 819 + { 820 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 821 + 822 + return __in_le64(addr); 823 + } 824 + EXPORT_SYMBOL(in_le64); 825 + 826 + unsigned long in_be64(const volatile unsigned long __iomem *addr) 827 + { 828 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 829 + 830 + return __in_be64(addr); 831 + } 832 + EXPORT_SYMBOL(in_be64); 833 + 834 + void out_le64(volatile unsigned long __iomem *addr, unsigned long val) 835 + { 836 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 837 + 838 + __out_le64(addr, val); 839 + } 840 + EXPORT_SYMBOL(out_le64); 841 + 842 + void out_be64(volatile unsigned long __iomem *addr, unsigned long val) 843 + { 844 + BUG_ON(firmware_has_feature(FW_FEATURE_ISERIES)); 845 + 846 + __out_be64(addr, val); 847 + } 848 + EXPORT_SYMBOL(out_be64); 849 + 850 + void memset_io(volatile void __iomem *addr, int c, unsigned long n) 851 + { 852 + if (firmware_has_feature(FW_FEATURE_ISERIES)) { 853 + volatile char __iomem *d = addr; 854 + 855 + while (n-- > 0) { 856 + iSeries_Write_Byte(c, d++); 857 + } 858 + } else 859 + eeh_memset_io(addr, c, n); 860 + } 861 + EXPORT_SYMBOL(memset_io); 862 + 863 + void memcpy_fromio(void *dest, const volatile void __iomem *src, 864 + unsigned long n) 865 + { 866 + if (firmware_has_feature(FW_FEATURE_ISERIES)) { 867 + char *d = dest; 868 + const volatile char __iomem *s = src; 869 + 870 + while (n-- > 0) { 871 + *d++ = iSeries_Read_Byte(s++); 872 + } 873 + } else 874 + eeh_memcpy_fromio(dest, src, n); 875 + } 876 + EXPORT_SYMBOL(memcpy_fromio); 877 + 878 + void memcpy_toio(volatile void __iomem *dest, const void *src, unsigned long n) 879 + { 880 + if (firmware_has_feature(FW_FEATURE_ISERIES)) { 881 + const char *s = src; 882 + volatile char __iomem *d = dest; 883 + 884 + while (n-- > 0) { 885 + iSeries_Write_Byte(*s++, d++); 886 + } 887 + } else 888 + eeh_memcpy_toio(dest, src, n); 889 + } 890 + EXPORT_SYMBOL(memcpy_toio);
+1
arch/powerpc/platforms/iseries/setup.c
··· 59 59 #include "irq.h" 60 60 #include "vpd_areas.h" 61 61 #include "processor_vpd.h" 62 + #include "it_lp_naca.h" 62 63 #include "main_store.h" 63 64 #include "call_sm.h" 64 65 #include "call_hpt.h"
+18 -10
arch/powerpc/platforms/iseries/viopath.c
··· 41 41 42 42 #include <asm/system.h> 43 43 #include <asm/uaccess.h> 44 + #include <asm/prom.h> 44 45 #include <asm/iseries/hv_types.h> 45 - #include <asm/iseries/it_exp_vpd_panel.h> 46 46 #include <asm/iseries/hv_lp_event.h> 47 47 #include <asm/iseries/hv_lp_config.h> 48 48 #include <asm/iseries/mf.h> ··· 116 116 dma_addr_t handle; 117 117 HvLpEvent_Rc hvrc; 118 118 DECLARE_MUTEX_LOCKED(Semaphore); 119 + struct device_node *node; 120 + const char *sysid; 119 121 120 122 buf = kmalloc(HW_PAGE_SIZE, GFP_KERNEL); 121 123 if (!buf) ··· 145 143 146 144 buf[HW_PAGE_SIZE-1] = '\0'; 147 145 seq_printf(m, "%s", buf); 148 - seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap); 149 - seq_printf(m, "SRLNBR=%c%c%c%c%c%c%c\n", 150 - e2a(xItExtVpdPanel.mfgID[2]), 151 - e2a(xItExtVpdPanel.mfgID[3]), 152 - e2a(xItExtVpdPanel.systemSerial[1]), 153 - e2a(xItExtVpdPanel.systemSerial[2]), 154 - e2a(xItExtVpdPanel.systemSerial[3]), 155 - e2a(xItExtVpdPanel.systemSerial[4]), 156 - e2a(xItExtVpdPanel.systemSerial[5])); 157 146 158 147 dma_unmap_single(iSeries_vio_dev, handle, HW_PAGE_SIZE, 159 148 DMA_FROM_DEVICE); 160 149 kfree(buf); 150 + 151 + seq_printf(m, "AVAILABLE_VETH=%x\n", vlanMap); 152 + 153 + node = of_find_node_by_path("/"); 154 + sysid = NULL; 155 + if (node != NULL) 156 + sysid = get_property(node, "system-id", NULL); 157 + 158 + if (sysid == NULL) 159 + seq_printf(m, "SRLNBR=<UNKNOWN>\n"); 160 + else 161 + /* Skip "IBM," on front of serial number, see dt.c */ 162 + seq_printf(m, "SRLNBR=%s\n", sysid + 4); 163 + 164 + of_node_put(node); 161 165 162 166 return 0; 163 167 }
+13 -9
arch/powerpc/platforms/iseries/vpdinfo.c
··· 188 188 { 189 189 u8 *TagPtr = VpdData; 190 190 int DataLen = VpdDataLen - 3; 191 - u8 PhbId; 191 + u8 PhbId = 0xff; 192 192 193 193 while ((*TagPtr != VpdEndOfAreaTag) && (DataLen > 0)) { 194 194 int AreaLen = *(TagPtr + 1) + (*(TagPtr + 2) * 256); ··· 205 205 } 206 206 } 207 207 208 - static void __init iSeries_Get_Location_Code(u16 bus, HvAgentId agent, 208 + static int __init iSeries_Get_Location_Code(u16 bus, HvAgentId agent, 209 209 u8 *frame, char card[4]) 210 210 { 211 + int status = 0; 211 212 int BusVpdLen = 0; 212 213 u8 *BusVpdPtr = kmalloc(BUS_VPDSIZE, GFP_KERNEL); 213 214 214 215 if (BusVpdPtr == NULL) { 215 216 printk("PCI: Bus VPD Buffer allocation failure.\n"); 216 - return; 217 + return 0; 217 218 } 218 219 BusVpdLen = HvCallPci_getBusVpd(bus, iseries_hv_addr(BusVpdPtr), 219 220 BUS_VPDSIZE); ··· 229 228 goto out_free; 230 229 } 231 230 iSeries_Parse_Vpd(BusVpdPtr, BusVpdLen, agent, frame, card); 231 + status = 1; 232 232 out_free: 233 233 kfree(BusVpdPtr); 234 + return status; 234 235 } 235 236 236 237 /* ··· 249 246 struct device_node *DevNode = PciDev->sysdata; 250 247 struct pci_dn *pdn; 251 248 u16 bus; 252 - u8 frame; 249 + u8 frame = 0; 253 250 char card[4]; 254 251 HvSubBusNumber subbus; 255 252 HvAgentId agent; ··· 265 262 subbus = pdn->bussubno; 266 263 agent = ISERIES_PCI_AGENTID(ISERIES_GET_DEVICE_FROM_SUBBUS(subbus), 267 264 ISERIES_GET_FUNCTION_FROM_SUBBUS(subbus)); 268 - iSeries_Get_Location_Code(bus, agent, &frame, card); 269 265 270 - printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, Card %4s ", 271 - count, bus, PCI_SLOT(PciDev->devfn), PciDev->vendor, 272 - frame, card); 273 - printk("0x%04X\n", (int)(PciDev->class >> 8)); 266 + if (iSeries_Get_Location_Code(bus, agent, &frame, card)) { 267 + printk("%d. PCI: Bus%3d, Device%3d, Vendor %04X Frame%3d, " 268 + "Card %4s 0x%04X\n", count, bus, 269 + PCI_SLOT(PciDev->devfn), PciDev->vendor, frame, 270 + card, (int)(PciDev->class >> 8)); 271 + } 274 272 }
+42 -28
arch/powerpc/platforms/maple/pci.c
··· 38 38 static int __init fixup_one_level_bus_range(struct device_node *node, int higher) 39 39 { 40 40 for (; node != 0;node = node->sibling) { 41 - int * bus_range; 42 - unsigned int *class_code; 41 + const int *bus_range; 42 + const unsigned int *class_code; 43 43 int len; 44 44 45 45 /* For PCI<->PCI bridges or CardBus bridges, we go down */ 46 - class_code = (unsigned int *) get_property(node, "class-code", NULL); 46 + class_code = get_property(node, "class-code", NULL); 47 47 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && 48 48 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) 49 49 continue; 50 - bus_range = (int *) get_property(node, "bus-range", &len); 50 + bus_range = get_property(node, "bus-range", &len); 51 51 if (bus_range != NULL && len > 2 * sizeof(int)) { 52 52 if (bus_range[1] > higher) 53 53 higher = bus_range[1]; ··· 65 65 */ 66 66 static void __init fixup_bus_range(struct device_node *bridge) 67 67 { 68 - int * bus_range; 68 + int *bus_range; 69 + struct property *prop; 69 70 int len; 70 71 71 72 /* Lookup the "bus-range" property for the hose */ 72 - bus_range = (int *) get_property(bridge, "bus-range", &len); 73 - if (bus_range == NULL || len < 2 * sizeof(int)) { 73 + prop = of_find_property(bridge, "bus-range", &len); 74 + if (prop == NULL || prop->value == NULL || len < 2 * sizeof(int)) { 74 75 printk(KERN_WARNING "Can't get bus-range for %s\n", 75 76 bridge->full_name); 76 77 return; 77 78 } 79 + bus_range = (int *)prop->value; 78 80 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); 79 81 } 80 82 81 83 82 - #define U3_AGP_CFA0(devfn, off) \ 83 - ((1 << (unsigned long)PCI_SLOT(dev_fn)) \ 84 - | (((unsigned long)PCI_FUNC(dev_fn)) << 8) \ 85 - | (((unsigned long)(off)) & 0xFCUL)) 84 + static unsigned long u3_agp_cfa0(u8 devfn, u8 off) 85 + { 86 + return (1 << (unsigned long)PCI_SLOT(devfn)) | 87 + ((unsigned long)PCI_FUNC(devfn) << 8) | 88 + ((unsigned long)off & 0xFCUL); 89 + } 86 90 87 - #define U3_AGP_CFA1(bus, devfn, off) \ 88 - ((((unsigned long)(bus)) << 16) \ 89 - |(((unsigned long)(devfn)) << 8) \ 90 - |(((unsigned long)(off)) & 0xFCUL) \ 91 - |1UL) 91 + static unsigned long u3_agp_cfa1(u8 bus, u8 devfn, u8 off) 92 + { 93 + return ((unsigned long)bus << 16) | 94 + ((unsigned long)devfn << 8) | 95 + ((unsigned long)off & 0xFCUL) | 96 + 1UL; 97 + } 92 98 93 99 static unsigned long u3_agp_cfg_access(struct pci_controller* hose, 94 100 u8 bus, u8 dev_fn, u8 offset) ··· 104 98 if (bus == hose->first_busno) { 105 99 if (dev_fn < (11 << 3)) 106 100 return 0; 107 - caddr = U3_AGP_CFA0(dev_fn, offset); 101 + caddr = u3_agp_cfa0(dev_fn, offset); 108 102 } else 109 - caddr = U3_AGP_CFA1(bus, dev_fn, offset); 103 + caddr = u3_agp_cfa1(bus, dev_fn, offset); 110 104 111 105 /* Uninorth will return garbage if we don't read back the value ! */ 112 106 do { ··· 188 182 u3_agp_write_config 189 183 }; 190 184 185 + static unsigned long u3_ht_cfa0(u8 devfn, u8 off) 186 + { 187 + return (devfn << 8) | off; 188 + } 191 189 192 - #define U3_HT_CFA0(devfn, off) \ 193 - ((((unsigned long)devfn) << 8) | offset) 194 - #define U3_HT_CFA1(bus, devfn, off) \ 195 - (U3_HT_CFA0(devfn, off) \ 196 - + (((unsigned long)bus) << 16) \ 197 - + 0x01000000UL) 190 + static unsigned long u3_ht_cfa1(u8 bus, u8 devfn, u8 off) 191 + { 192 + return u3_ht_cfa0(devfn, off) + (bus << 16) + 0x01000000UL; 193 + } 198 194 199 195 static unsigned long u3_ht_cfg_access(struct pci_controller* hose, 200 196 u8 bus, u8 devfn, u8 offset) ··· 204 196 if (bus == hose->first_busno) { 205 197 if (PCI_SLOT(devfn) == 0) 206 198 return 0; 207 - return ((unsigned long)hose->cfg_data) + U3_HT_CFA0(devfn, offset); 199 + return ((unsigned long)hose->cfg_data) + u3_ht_cfa0(devfn, offset); 208 200 } else 209 - return ((unsigned long)hose->cfg_data) + U3_HT_CFA1(bus, devfn, offset); 201 + return ((unsigned long)hose->cfg_data) + u3_ht_cfa1(bus, devfn, offset); 210 202 } 211 203 212 204 static int u3_ht_read_config(struct pci_bus *bus, unsigned int devfn, ··· 218 210 hose = pci_bus_to_host(bus); 219 211 if (hose == NULL) 220 212 return PCIBIOS_DEVICE_NOT_FOUND; 213 + 214 + if (offset > 0xff) 215 + return PCIBIOS_BAD_REGISTER_NUMBER; 221 216 222 217 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); 223 218 if (!addr) ··· 253 242 hose = pci_bus_to_host(bus); 254 243 if (hose == NULL) 255 244 return PCIBIOS_DEVICE_NOT_FOUND; 245 + 246 + if (offset > 0xff) 247 + return PCIBIOS_BAD_REGISTER_NUMBER; 256 248 257 249 addr = u3_ht_cfg_access(hose, bus->number, devfn, offset); 258 250 if (!addr) ··· 328 314 int len; 329 315 struct pci_controller *hose; 330 316 char* disp_name; 331 - int *bus_range; 317 + const int *bus_range; 332 318 int primary = 1; 333 319 334 320 DBG("Adding PCI host bridge %s\n", dev->full_name); 335 321 336 - bus_range = (int *) get_property(dev, "bus-range", &len); 322 + bus_range = get_property(dev, "bus-range", &len); 337 323 if (bus_range == NULL || len < 2 * sizeof(int)) { 338 324 printk(KERN_WARNING "Can't get bus-range for %s, assume bus 0\n", 339 325 dev->full_name);
+10 -17
arch/powerpc/platforms/maple/setup.c
··· 99 99 static void maple_restart(char *cmd) 100 100 { 101 101 unsigned int maple_nvram_base; 102 - unsigned int maple_nvram_offset; 103 - unsigned int maple_nvram_command; 102 + const unsigned int *maple_nvram_offset, *maple_nvram_command; 104 103 struct device_node *sp; 105 104 106 105 maple_nvram_base = maple_find_nvram_base(); ··· 112 113 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 113 114 goto fail; 114 115 } 115 - maple_nvram_offset = *(unsigned int*) get_property(sp, 116 - "restart-addr", NULL); 117 - maple_nvram_command = *(unsigned int*) get_property(sp, 118 - "restart-value", NULL); 116 + maple_nvram_offset = get_property(sp, "restart-addr", NULL); 117 + maple_nvram_command = get_property(sp, "restart-value", NULL); 119 118 of_node_put(sp); 120 119 121 120 /* send command */ 122 - outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); 121 + outb_p(*maple_nvram_command, maple_nvram_base + *maple_nvram_offset); 123 122 for (;;) ; 124 123 fail: 125 124 printk(KERN_EMERG "Maple: Manual Restart Required\n"); ··· 126 129 static void maple_power_off(void) 127 130 { 128 131 unsigned int maple_nvram_base; 129 - unsigned int maple_nvram_offset; 130 - unsigned int maple_nvram_command; 132 + const unsigned int *maple_nvram_offset, *maple_nvram_command; 131 133 struct device_node *sp; 132 134 133 135 maple_nvram_base = maple_find_nvram_base(); ··· 139 143 printk(KERN_EMERG "Maple: Unable to find Service Processor\n"); 140 144 goto fail; 141 145 } 142 - maple_nvram_offset = *(unsigned int*) get_property(sp, 143 - "power-off-addr", NULL); 144 - maple_nvram_command = *(unsigned int*) get_property(sp, 145 - "power-off-value", NULL); 146 + maple_nvram_offset = get_property(sp, "power-off-addr", NULL); 147 + maple_nvram_command = get_property(sp, "power-off-value", NULL); 146 148 of_node_put(sp); 147 149 148 150 /* send command */ 149 - outb_p(maple_nvram_command, maple_nvram_base + maple_nvram_offset); 151 + outb_p(*maple_nvram_command, maple_nvram_base + *maple_nvram_offset); 150 152 for (;;) ; 151 153 fail: 152 154 printk(KERN_EMERG "Maple: Manual Power-Down Required\n"); ··· 205 211 static void __init maple_init_IRQ(void) 206 212 { 207 213 struct device_node *root, *np, *mpic_node = NULL; 208 - unsigned int *opprop; 214 + const unsigned int *opprop; 209 215 unsigned long openpic_addr = 0; 210 216 int naddr, n, i, opplen, has_isus = 0; 211 217 struct mpic *mpic; ··· 235 241 /* Find address list in /platform-open-pic */ 236 242 root = of_find_node_by_path("/"); 237 243 naddr = prom_n_addr_cells(root); 238 - opprop = (unsigned int *) get_property(root, "platform-open-pic", 239 - &opplen); 244 + opprop = get_property(root, "platform-open-pic", &opplen); 240 245 if (opprop != 0) { 241 246 openpic_addr = of_read_number(opprop, naddr); 242 247 has_isus = (opplen > naddr);
+1
arch/powerpc/platforms/pasemi/Makefile
··· 1 + obj-y += setup.o pci.o time.o
+8
arch/powerpc/platforms/pasemi/pasemi.h
··· 1 + #ifndef _PASEMI_PASEMI_H 2 + #define _PASEMI_PASEMI_H 3 + 4 + extern unsigned long pas_get_boot_time(void); 5 + extern void pas_pci_init(void); 6 + extern void pas_pcibios_fixup(void); 7 + 8 + #endif /* _PASEMI_PASEMI_H */
+198
arch/powerpc/platforms/pasemi/pci.c
··· 1 + /* 2 + * Copyright (C) 2006 PA Semi, Inc 3 + * 4 + * Authors: Kip Walker, PA Semi 5 + * Olof Johansson, PA Semi 6 + * 7 + * Maintained by: Olof Johansson <olof@lixom.net> 8 + * 9 + * Based on arch/powerpc/platforms/maple/pci.c 10 + * 11 + * This program is free software; you can redistribute it and/or modify 12 + * it under the terms of the GNU General Public License version 2 as 13 + * published by the Free Software Foundation. 14 + * 15 + * This program is distributed in the hope that it will be useful, 16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 + * GNU General Public License for more details. 19 + * 20 + * You should have received a copy of the GNU General Public License 21 + * along with this program; if not, write to the Free Software 22 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 + */ 24 + 25 + 26 + #include <linux/kernel.h> 27 + #include <linux/pci.h> 28 + 29 + #include <asm/pci-bridge.h> 30 + #include <asm/machdep.h> 31 + 32 + #include <asm/ppc-pci.h> 33 + 34 + #define PA_PXP_CFA(bus, devfn, off) (((bus) << 20) | ((devfn) << 12) | (off)) 35 + 36 + #define CONFIG_OFFSET_VALID(off) ((off) < 4096) 37 + 38 + static unsigned long pa_pxp_cfg_addr(struct pci_controller *hose, 39 + u8 bus, u8 devfn, int offset) 40 + { 41 + return ((unsigned long)hose->cfg_data) + PA_PXP_CFA(bus, devfn, offset); 42 + } 43 + 44 + static int pa_pxp_read_config(struct pci_bus *bus, unsigned int devfn, 45 + int offset, int len, u32 *val) 46 + { 47 + struct pci_controller *hose; 48 + unsigned long addr; 49 + 50 + hose = pci_bus_to_host(bus); 51 + if (!hose) 52 + return PCIBIOS_DEVICE_NOT_FOUND; 53 + 54 + if (!CONFIG_OFFSET_VALID(offset)) 55 + return PCIBIOS_BAD_REGISTER_NUMBER; 56 + 57 + addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); 58 + 59 + /* 60 + * Note: the caller has already checked that offset is 61 + * suitably aligned and that len is 1, 2 or 4. 62 + */ 63 + switch (len) { 64 + case 1: 65 + *val = in_8((u8 *)addr); 66 + break; 67 + case 2: 68 + *val = in_le16((u16 *)addr); 69 + break; 70 + default: 71 + *val = in_le32((u32 *)addr); 72 + break; 73 + } 74 + 75 + return PCIBIOS_SUCCESSFUL; 76 + } 77 + 78 + static int pa_pxp_write_config(struct pci_bus *bus, unsigned int devfn, 79 + int offset, int len, u32 val) 80 + { 81 + struct pci_controller *hose; 82 + unsigned long addr; 83 + 84 + hose = pci_bus_to_host(bus); 85 + if (!hose) 86 + return PCIBIOS_DEVICE_NOT_FOUND; 87 + 88 + if (!CONFIG_OFFSET_VALID(offset)) 89 + return PCIBIOS_BAD_REGISTER_NUMBER; 90 + 91 + addr = pa_pxp_cfg_addr(hose, bus->number, devfn, offset); 92 + 93 + /* 94 + * Note: the caller has already checked that offset is 95 + * suitably aligned and that len is 1, 2 or 4. 96 + */ 97 + switch (len) { 98 + case 1: 99 + out_8((u8 *)addr, val); 100 + (void) in_8((u8 *)addr); 101 + break; 102 + case 2: 103 + out_le16((u16 *)addr, val); 104 + (void) in_le16((u16 *)addr); 105 + break; 106 + default: 107 + out_le32((u32 *)addr, val); 108 + (void) in_le32((u32 *)addr); 109 + break; 110 + } 111 + return PCIBIOS_SUCCESSFUL; 112 + } 113 + 114 + static struct pci_ops pa_pxp_ops = { 115 + pa_pxp_read_config, 116 + pa_pxp_write_config, 117 + }; 118 + 119 + static void __init setup_pa_pxp(struct pci_controller *hose) 120 + { 121 + hose->ops = &pa_pxp_ops; 122 + hose->cfg_data = ioremap(0xe0000000, 0x10000000); 123 + } 124 + 125 + static int __init add_bridge(struct device_node *dev) 126 + { 127 + struct pci_controller *hose; 128 + 129 + pr_debug("Adding PCI host bridge %s\n", dev->full_name); 130 + 131 + hose = pcibios_alloc_controller(dev); 132 + if (!hose) 133 + return -ENOMEM; 134 + 135 + hose->first_busno = 0; 136 + hose->last_busno = 0xff; 137 + 138 + setup_pa_pxp(hose); 139 + 140 + printk(KERN_INFO "Found PA-PXP PCI host bridge.\n"); 141 + 142 + /* Interpret the "ranges" property */ 143 + /* This also maps the I/O region and sets isa_io/mem_base */ 144 + pci_process_bridge_OF_ranges(hose, dev, 1); 145 + pci_setup_phb_io(hose, 1); 146 + 147 + return 0; 148 + } 149 + 150 + 151 + void __init pas_pcibios_fixup(void) 152 + { 153 + struct pci_dev *dev = NULL; 154 + 155 + for_each_pci_dev(dev) 156 + pci_read_irq_line(dev); 157 + } 158 + 159 + static void __init pas_fixup_phb_resources(void) 160 + { 161 + struct pci_controller *hose, *tmp; 162 + 163 + list_for_each_entry_safe(hose, tmp, &hose_list, list_node) { 164 + unsigned long offset = (unsigned long)hose->io_base_virt - pci_io_base; 165 + hose->io_resource.start += offset; 166 + hose->io_resource.end += offset; 167 + printk(KERN_INFO "PCI Host %d, io start: %lx; io end: %lx\n", 168 + hose->global_number, 169 + hose->io_resource.start, hose->io_resource.end); 170 + } 171 + } 172 + 173 + 174 + void __init pas_pci_init(void) 175 + { 176 + struct device_node *np, *root; 177 + 178 + root = of_find_node_by_path("/"); 179 + if (!root) { 180 + printk(KERN_CRIT "pas_pci_init: can't find root " 181 + "of device tree\n"); 182 + return; 183 + } 184 + 185 + for (np = NULL; (np = of_get_next_child(root, np)) != NULL;) 186 + if (np->name && !strcmp(np->name, "pxp") && !add_bridge(np)) 187 + of_node_get(np); 188 + 189 + of_node_put(root); 190 + 191 + pas_fixup_phb_resources(); 192 + 193 + /* Setup the linkage between OF nodes and PHBs */ 194 + pci_devs_phb_init(); 195 + 196 + /* Use the common resource allocation mechanism */ 197 + pci_probe_only = 1; 198 + }
+188
arch/powerpc/platforms/pasemi/setup.c
··· 1 + /* 2 + * Copyright (C) 2006 PA Semi, Inc 3 + * 4 + * Authors: Kip Walker, PA Semi 5 + * Olof Johansson, PA Semi 6 + * 7 + * Maintained by: Olof Johansson <olof@lixom.net> 8 + * 9 + * Based on arch/powerpc/platforms/maple/setup.c 10 + * 11 + * This program is free software; you can redistribute it and/or modify 12 + * it under the terms of the GNU General Public License version 2 as 13 + * published by the Free Software Foundation. 14 + * 15 + * This program is distributed in the hope that it will be useful, 16 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 + * GNU General Public License for more details. 19 + * 20 + * You should have received a copy of the GNU General Public License 21 + * along with this program; if not, write to the Free Software 22 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 + */ 24 + 25 + #include <linux/config.h> 26 + #include <linux/errno.h> 27 + #include <linux/kernel.h> 28 + #include <linux/delay.h> 29 + #include <linux/console.h> 30 + 31 + #include <asm/prom.h> 32 + #include <asm/system.h> 33 + #include <asm/iommu.h> 34 + #include <asm/machdep.h> 35 + #include <asm/mpic.h> 36 + #include <asm/smp.h> 37 + #include <asm/time.h> 38 + 39 + #include "pasemi.h" 40 + 41 + static void pas_restart(char *cmd) 42 + { 43 + printk("restart unimplemented, looping...\n"); 44 + for (;;) ; 45 + } 46 + 47 + static void pas_power_off(void) 48 + { 49 + printk("power off unimplemented, looping...\n"); 50 + for (;;) ; 51 + } 52 + 53 + static void pas_halt(void) 54 + { 55 + pas_power_off(); 56 + } 57 + 58 + #ifdef CONFIG_SMP 59 + struct smp_ops_t pas_smp_ops = { 60 + .probe = smp_mpic_probe, 61 + .message_pass = smp_mpic_message_pass, 62 + .kick_cpu = smp_generic_kick_cpu, 63 + .setup_cpu = smp_mpic_setup_cpu, 64 + .give_timebase = smp_generic_give_timebase, 65 + .take_timebase = smp_generic_take_timebase, 66 + }; 67 + #endif /* CONFIG_SMP */ 68 + 69 + void __init pas_setup_arch(void) 70 + { 71 + #ifdef CONFIG_SMP 72 + /* Setup SMP callback */ 73 + smp_ops = &pas_smp_ops; 74 + #endif 75 + /* Lookup PCI hosts */ 76 + pas_pci_init(); 77 + 78 + #ifdef CONFIG_DUMMY_CONSOLE 79 + conswitchp = &dummy_con; 80 + #endif 81 + 82 + printk(KERN_DEBUG "Using default idle loop\n"); 83 + } 84 + 85 + static void iommu_dev_setup_null(struct pci_dev *dev) { } 86 + static void iommu_bus_setup_null(struct pci_bus *bus) { } 87 + 88 + static void __init pas_init_early(void) 89 + { 90 + /* No iommu code yet */ 91 + ppc_md.iommu_dev_setup = iommu_dev_setup_null; 92 + ppc_md.iommu_bus_setup = iommu_bus_setup_null; 93 + pci_direct_iommu_init(); 94 + } 95 + 96 + /* No legacy IO on our parts */ 97 + static int pas_check_legacy_ioport(unsigned int baseport) 98 + { 99 + return -ENODEV; 100 + } 101 + 102 + static __init void pas_init_IRQ(void) 103 + { 104 + struct device_node *np; 105 + struct device_node *root, *mpic_node; 106 + unsigned long openpic_addr; 107 + const unsigned int *opprop; 108 + int naddr, opplen; 109 + struct mpic *mpic; 110 + 111 + mpic_node = NULL; 112 + 113 + for_each_node_by_type(np, "interrupt-controller") 114 + if (device_is_compatible(np, "open-pic")) { 115 + mpic_node = np; 116 + break; 117 + } 118 + if (!mpic_node) 119 + for_each_node_by_type(np, "open-pic") { 120 + mpic_node = np; 121 + break; 122 + } 123 + if (!mpic_node) { 124 + printk(KERN_ERR 125 + "Failed to locate the MPIC interrupt controller\n"); 126 + return; 127 + } 128 + 129 + /* Find address list in /platform-open-pic */ 130 + root = of_find_node_by_path("/"); 131 + naddr = prom_n_addr_cells(root); 132 + opprop = get_property(root, "platform-open-pic", &opplen); 133 + if (!opprop) { 134 + printk(KERN_ERR "No platform-open-pic property.\n"); 135 + of_node_put(root); 136 + return; 137 + } 138 + openpic_addr = of_read_number(opprop, naddr); 139 + printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); 140 + of_node_put(root); 141 + 142 + mpic = mpic_alloc(mpic_node, openpic_addr, MPIC_PRIMARY, 0, 0, 143 + " PAS-OPIC "); 144 + BUG_ON(!mpic); 145 + 146 + mpic_assign_isu(mpic, 0, openpic_addr + 0x10000); 147 + mpic_init(mpic); 148 + of_node_put(mpic_node); 149 + of_node_put(root); 150 + } 151 + 152 + static void __init pas_progress(char *s, unsigned short hex) 153 + { 154 + printk("[%04x] : %s\n", hex, s ? s : ""); 155 + } 156 + 157 + 158 + /* 159 + * Called very early, MMU is off, device-tree isn't unflattened 160 + */ 161 + static int __init pas_probe(void) 162 + { 163 + unsigned long root = of_get_flat_dt_root(); 164 + 165 + if (!of_flat_dt_is_compatible(root, "PA6T-1682M")) 166 + return 0; 167 + 168 + hpte_init_native(); 169 + 170 + return 1; 171 + } 172 + 173 + define_machine(pas) { 174 + .name = "PA Semi PA6T-1682M", 175 + .probe = pas_probe, 176 + .setup_arch = pas_setup_arch, 177 + .init_early = pas_init_early, 178 + .init_IRQ = pas_init_IRQ, 179 + .get_irq = mpic_get_irq, 180 + .pcibios_fixup = pas_pcibios_fixup, 181 + .restart = pas_restart, 182 + .power_off = pas_power_off, 183 + .halt = pas_halt, 184 + .get_boot_time = pas_get_boot_time, 185 + .calibrate_decr = generic_calibrate_decr, 186 + .check_legacy_ioport = pas_check_legacy_ioport, 187 + .progress = pas_progress, 188 + };
+29
arch/powerpc/platforms/pasemi/time.c
··· 1 + /* 2 + * Copyright (C) 2006 PA Semi, Inc 3 + * 4 + * Maintained by: Olof Johansson <olof@lixom.net> 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License version 2 as 8 + * published by the Free Software Foundation. 9 + * 10 + * This program is distributed in the hope that it will be useful, 11 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 + * GNU General Public License for more details. 14 + * 15 + * You should have received a copy of the GNU General Public License 16 + * along with this program; if not, write to the Free Software 17 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 + */ 19 + 20 + #include <linux/config.h> 21 + #include <linux/time.h> 22 + 23 + #include <asm/time.h> 24 + 25 + unsigned long __init pas_get_boot_time(void) 26 + { 27 + /* Let's just return a fake date right now */ 28 + return mktime(2006, 1, 1, 12, 0, 0); 29 + }
+2 -1
arch/powerpc/platforms/powermac/backlight.c
··· 60 60 struct device_node* bk_node = find_devices("backlight"); 61 61 62 62 if (bk_node) { 63 - char *prop = get_property(bk_node, "backlight-control", NULL); 63 + const char *prop = get_property(bk_node, 64 + "backlight-control", NULL); 64 65 if (prop && strncmp(prop, type, strlen(type)) == 0) 65 66 return 1; 66 67 }
+12 -11
arch/powerpc/platforms/powermac/cpufreq_32.c
··· 421 421 422 422 static u32 read_gpio(struct device_node *np) 423 423 { 424 - u32 *reg = (u32 *)get_property(np, "reg", NULL); 424 + const u32 *reg = get_property(np, "reg", NULL); 425 425 u32 offset; 426 426 427 427 if (reg == NULL) ··· 497 497 "frequency-gpio"); 498 498 struct device_node *slew_done_gpio_np = of_find_node_by_name(NULL, 499 499 "slewing-done"); 500 - u32 *value; 500 + const u32 *value; 501 501 502 502 /* 503 503 * Check to see if it's GPIO driven or PMU only ··· 519 519 */ 520 520 if (frequency_gpio && slew_done_gpio) { 521 521 int lenp, rc; 522 - u32 *freqs, *ratio; 522 + const u32 *freqs, *ratio; 523 523 524 - freqs = (u32 *)get_property(cpunode, "bus-frequencies", &lenp); 524 + freqs = get_property(cpunode, "bus-frequencies", &lenp); 525 525 lenp /= sizeof(u32); 526 526 if (freqs == NULL || lenp != 2) { 527 527 printk(KERN_ERR "cpufreq: bus-frequencies incorrect or missing\n"); 528 528 return 1; 529 529 } 530 - ratio = (u32 *)get_property(cpunode, "processor-to-bus-ratio*2", NULL); 530 + ratio = get_property(cpunode, "processor-to-bus-ratio*2", NULL); 531 531 if (ratio == NULL) { 532 532 printk(KERN_ERR "cpufreq: processor-to-bus-ratio*2 missing\n"); 533 533 return 1; ··· 562 562 /* If we use the PMU, look for the min & max frequencies in the 563 563 * device-tree 564 564 */ 565 - value = (u32 *)get_property(cpunode, "min-clock-frequency", NULL); 565 + value = get_property(cpunode, "min-clock-frequency", NULL); 566 566 if (!value) 567 567 return 1; 568 568 low_freq = (*value) / 1000; ··· 571 571 if (low_freq < 100000) 572 572 low_freq *= 10; 573 573 574 - value = (u32 *)get_property(cpunode, "max-clock-frequency", NULL); 574 + value = get_property(cpunode, "max-clock-frequency", NULL); 575 575 if (!value) 576 576 return 1; 577 577 hi_freq = (*value) / 1000; ··· 611 611 static int pmac_cpufreq_init_750FX(struct device_node *cpunode) 612 612 { 613 613 struct device_node *volt_gpio_np; 614 - u32 pvr, *value; 614 + u32 pvr; 615 + const u32 *value; 615 616 616 617 if (get_property(cpunode, "dynamic-power-step", NULL) == NULL) 617 618 return 1; 618 619 619 620 hi_freq = cur_freq; 620 - value = (u32 *)get_property(cpunode, "reduced-clock-frequency", NULL); 621 + value = get_property(cpunode, "reduced-clock-frequency", NULL); 621 622 if (!value) 622 623 return 1; 623 624 low_freq = (*value) / 1000; ··· 651 650 static int __init pmac_cpufreq_setup(void) 652 651 { 653 652 struct device_node *cpunode; 654 - u32 *value; 653 + const u32 *value; 655 654 656 655 if (strstr(cmd_line, "nocpufreq")) 657 656 return 0; ··· 662 661 goto out; 663 662 664 663 /* Get current cpu clock freq */ 665 - value = (u32 *)get_property(cpunode, "clock-frequency", NULL); 664 + value = get_property(cpunode, "clock-frequency", NULL); 666 665 if (!value) 667 666 goto out; 668 667 cur_freq = (*value) / 1000;
+14 -13
arch/powerpc/platforms/powermac/cpufreq_64.c
··· 89 89 90 90 #ifdef CONFIG_PMAC_SMU 91 91 92 - static u32 *g5_pmode_data; 92 + static const u32 *g5_pmode_data; 93 93 static int g5_pmode_max; 94 94 95 95 static struct smu_sdbp_fvt *g5_fvt_table; /* table of op. points */ ··· 391 391 unsigned int psize, ssize; 392 392 unsigned long max_freq; 393 393 char *freq_method, *volt_method; 394 - u32 *valp, pvr_hi; 394 + const u32 *valp; 395 + u32 pvr_hi; 395 396 int use_volts_vdnap = 0; 396 397 int use_volts_smu = 0; 397 398 int rc = -ENODEV; ··· 410 409 /* Get first CPU node */ 411 410 for (cpunode = NULL; 412 411 (cpunode = of_get_next_child(cpus, cpunode)) != NULL;) { 413 - u32 *reg = 414 - (u32 *)get_property(cpunode, "reg", NULL); 412 + const u32 *reg = get_property(cpunode, "reg", NULL); 415 413 if (reg == NULL || (*reg) != 0) 416 414 continue; 417 415 if (!strcmp(cpunode->type, "cpu")) ··· 422 422 } 423 423 424 424 /* Check 970FX for now */ 425 - valp = (u32 *)get_property(cpunode, "cpu-version", NULL); 425 + valp = get_property(cpunode, "cpu-version", NULL); 426 426 if (!valp) { 427 427 DBG("No cpu-version property !\n"); 428 428 goto bail_noprops; ··· 434 434 } 435 435 436 436 /* Look for the powertune data in the device-tree */ 437 - g5_pmode_data = (u32 *)get_property(cpunode, "power-mode-data",&psize); 437 + g5_pmode_data = get_property(cpunode, "power-mode-data",&psize); 438 438 if (!g5_pmode_data) { 439 439 DBG("No power-mode-data !\n"); 440 440 goto bail_noprops; ··· 442 442 g5_pmode_max = psize / sizeof(u32) - 1; 443 443 444 444 if (use_volts_smu) { 445 - struct smu_sdbp_header *shdr; 445 + const struct smu_sdbp_header *shdr; 446 446 447 447 /* Look for the FVT table */ 448 448 shdr = smu_get_sdb_partition(SMU_SDB_FVT_ID, NULL); ··· 493 493 * half freq in this version. So far, I haven't yet seen a machine 494 494 * supporting anything else. 495 495 */ 496 - valp = (u32 *)get_property(cpunode, "clock-frequency", NULL); 496 + valp = get_property(cpunode, "clock-frequency", NULL); 497 497 if (!valp) 498 498 return -ENODEV; 499 499 max_freq = (*valp)/1000; ··· 541 541 static int __init g5_pm72_cpufreq_init(struct device_node *cpus) 542 542 { 543 543 struct device_node *cpuid = NULL, *hwclock = NULL, *cpunode = NULL; 544 - u8 *eeprom = NULL; 545 - u32 *valp; 544 + const u8 *eeprom = NULL; 545 + const u32 *valp; 546 546 u64 max_freq, min_freq, ih, il; 547 547 int has_volt = 1, rc = 0; 548 548 ··· 563 563 /* Lookup the cpuid eeprom node */ 564 564 cpuid = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/cpuid@a0"); 565 565 if (cpuid != NULL) 566 - eeprom = (u8 *)get_property(cpuid, "cpuid", NULL); 566 + eeprom = get_property(cpuid, "cpuid", NULL); 567 567 if (eeprom == NULL) { 568 568 printk(KERN_ERR "cpufreq: Can't find cpuid EEPROM !\n"); 569 569 rc = -ENODEV; ··· 573 573 /* Lookup the i2c hwclock */ 574 574 for (hwclock = NULL; 575 575 (hwclock = of_find_node_by_name(hwclock, "i2c-hwclock")) != NULL;){ 576 - char *loc = get_property(hwclock, "hwctrl-location", NULL); 576 + const char *loc = get_property(hwclock, 577 + "hwctrl-location", NULL); 577 578 if (loc == NULL) 578 579 continue; 579 580 if (strcmp(loc, "CPU CLOCK")) ··· 638 637 */ 639 638 640 639 /* Get max frequency from device-tree */ 641 - valp = (u32 *)get_property(cpunode, "clock-frequency", NULL); 640 + valp = get_property(cpunode, "clock-frequency", NULL); 642 641 if (!valp) { 643 642 printk(KERN_ERR "cpufreq: Can't find CPU frequency !\n"); 644 643 rc = -ENODEV;
+15 -15
arch/powerpc/platforms/powermac/feature.c
··· 1058 1058 if (np == NULL) 1059 1059 return -ENODEV; 1060 1060 for (np = np->child; np != NULL; np = np->sibling) { 1061 - u32 *num = (u32 *)get_property(np, "reg", NULL); 1062 - u32 *rst = (u32 *)get_property(np, "soft-reset", NULL); 1061 + u32 *num = get_property(np, "reg", NULL); 1062 + u32 *rst = get_property(np, "soft-reset", NULL); 1063 1063 if (num == NULL || rst == NULL) 1064 1064 continue; 1065 1065 if (param == *num) { ··· 1087 1087 { 1088 1088 struct macio_chip *macio; 1089 1089 unsigned long flags; 1090 - char *prop; 1090 + const char *prop; 1091 1091 int number; 1092 1092 u32 reg; 1093 1093 ··· 1096 1096 macio->type != macio_intrepid) 1097 1097 return -ENODEV; 1098 1098 1099 - prop = (char *)get_property(node, "AAPL,clock-id", NULL); 1099 + prop = get_property(node, "AAPL,clock-id", NULL); 1100 1100 if (!prop) 1101 1101 return -ENODEV; 1102 1102 if (strncmp(prop, "usb0u048", 8) == 0) ··· 1507 1507 if (np == NULL) 1508 1508 return -ENODEV; 1509 1509 for (np = np->child; np != NULL; np = np->sibling) { 1510 - u32 *num = (u32 *)get_property(np, "reg", NULL); 1511 - u32 *rst = (u32 *)get_property(np, "soft-reset", NULL); 1510 + const u32 *num = get_property(np, "reg", NULL); 1511 + const u32 *rst = get_property(np, "soft-reset", NULL); 1512 1512 if (num == NULL || rst == NULL) 1513 1513 continue; 1514 1514 if (param == *num) { ··· 2408 2408 */ 2409 2409 dt = find_devices("device-tree"); 2410 2410 if (dt != NULL) 2411 - model = (const char *) get_property(dt, "model", NULL); 2411 + model = get_property(dt, "model", NULL); 2412 2412 for(i=0; model && i<(sizeof(pmac_mb_defs)/sizeof(struct pmac_mb_def)); i++) { 2413 2413 if (strcmp(model, pmac_mb_defs[i].model_string) == 0) { 2414 2414 pmac_mb = pmac_mb_defs[i]; ··· 2536 2536 */ 2537 2537 static void __init probe_uninorth(void) 2538 2538 { 2539 - u32 *addrp; 2539 + const u32 *addrp; 2540 2540 phys_addr_t address; 2541 2541 unsigned long actrl; 2542 2542 ··· 2555 2555 if (uninorth_node == NULL) 2556 2556 return; 2557 2557 2558 - addrp = (u32 *)get_property(uninorth_node, "reg", NULL); 2558 + addrp = get_property(uninorth_node, "reg", NULL); 2559 2559 if (addrp == NULL) 2560 2560 return; 2561 2561 address = of_translate_address(uninorth_node, addrp); ··· 2596 2596 struct device_node* node; 2597 2597 int i; 2598 2598 volatile u32 __iomem *base; 2599 - u32 *addrp, *revp; 2599 + const u32 *addrp, *revp; 2600 2600 phys_addr_t addr; 2601 2601 u64 size; 2602 2602 ··· 2639 2639 return; 2640 2640 } 2641 2641 if (type == macio_keylargo || type == macio_keylargo2) { 2642 - u32 *did = (u32 *)get_property(node, "device-id", NULL); 2642 + const u32 *did = get_property(node, "device-id", NULL); 2643 2643 if (*did == 0x00000025) 2644 2644 type = macio_pangea; 2645 2645 if (*did == 0x0000003e) ··· 2652 2652 macio_chips[i].base = base; 2653 2653 macio_chips[i].flags = MACIO_FLAG_SCCB_ON | MACIO_FLAG_SCCB_ON; 2654 2654 macio_chips[i].name = macio_names[type]; 2655 - revp = (u32 *)get_property(node, "revision-id", NULL); 2655 + revp = get_property(node, "revision-id", NULL); 2656 2656 if (revp) 2657 2657 macio_chips[i].rev = *revp; 2658 2658 printk(KERN_INFO "Found a %s mac-io controller, rev: %d, mapped at 0x%p\n", ··· 2695 2695 initial_serial_shutdown(struct device_node *np) 2696 2696 { 2697 2697 int len; 2698 - struct slot_names_prop { 2698 + const struct slot_names_prop { 2699 2699 int count; 2700 2700 char name[1]; 2701 2701 } *slots; 2702 - char *conn; 2702 + const char *conn; 2703 2703 int port_type = PMAC_SCC_ASYNC; 2704 2704 int modem = 0; 2705 2705 2706 - slots = (struct slot_names_prop *)get_property(np, "slot-names", &len); 2706 + slots = get_property(np, "slot-names", &len); 2707 2707 conn = get_property(np, "AAPL,connector", &len); 2708 2708 if (conn && (strcmp(conn, "infrared") == 0)) 2709 2709 port_type = PMAC_SCC_IRDA;
+12 -12
arch/powerpc/platforms/powermac/low_i2c.c
··· 477 477 static struct pmac_i2c_host_kw *__init kw_i2c_host_init(struct device_node *np) 478 478 { 479 479 struct pmac_i2c_host_kw *host; 480 - u32 *psteps, *prate, *addrp, steps; 480 + const u32 *psteps, *prate, *addrp; 481 + u32 steps; 481 482 482 483 host = kzalloc(sizeof(struct pmac_i2c_host_kw), GFP_KERNEL); 483 484 if (host == NULL) { ··· 491 490 * on all i2c keywest nodes so far ... we would have to fallback 492 491 * to macio parsing if that wasn't the case 493 492 */ 494 - addrp = (u32 *)get_property(np, "AAPL,address", NULL); 493 + addrp = get_property(np, "AAPL,address", NULL); 495 494 if (addrp == NULL) { 496 495 printk(KERN_ERR "low_i2c: Can't find address for %s\n", 497 496 np->full_name); ··· 505 504 host->timeout_timer.function = kw_i2c_timeout; 506 505 host->timeout_timer.data = (unsigned long)host; 507 506 508 - psteps = (u32 *)get_property(np, "AAPL,address-step", NULL); 507 + psteps = get_property(np, "AAPL,address-step", NULL); 509 508 steps = psteps ? (*psteps) : 0x10; 510 509 for (host->bsteps = 0; (steps & 0x01) == 0; host->bsteps++) 511 510 steps >>= 1; 512 511 /* Select interface rate */ 513 512 host->speed = KW_I2C_MODE_25KHZ; 514 - prate = (u32 *)get_property(np, "AAPL,i2c-rate", NULL); 513 + prate = get_property(np, "AAPL,i2c-rate", NULL); 515 514 if (prate) switch(*prate) { 516 515 case 100: 517 516 host->speed = KW_I2C_MODE_100KHZ; ··· 619 618 } else { 620 619 for (child = NULL; 621 620 (child = of_get_next_child(np, child)) != NULL;) { 622 - u32 *reg = 623 - (u32 *)get_property(child, "reg", NULL); 621 + const u32 *reg = get_property(child, 622 + "reg", NULL); 624 623 if (reg == NULL) 625 624 continue; 626 625 kw_i2c_add(host, np, child, *reg); ··· 882 881 { 883 882 struct device_node *controller, *busnode; 884 883 struct pmac_i2c_bus *bus; 885 - u32 *reg; 884 + const u32 *reg; 886 885 int sz; 887 886 888 887 if (!smu_present()) ··· 905 904 if (strcmp(busnode->type, "i2c") && 906 905 strcmp(busnode->type, "i2c-bus")) 907 906 continue; 908 - reg = (u32 *)get_property(busnode, "reg", NULL); 907 + reg = get_property(busnode, "reg", NULL); 909 908 if (reg == NULL) 910 909 continue; 911 910 ··· 949 948 list_for_each_entry(bus, &pmac_i2c_busses, link) { 950 949 if (p == bus->busnode) { 951 950 if (prev && bus->flags & pmac_i2c_multibus) { 952 - u32 *reg; 953 - reg = (u32 *)get_property(prev, "reg", 954 - NULL); 951 + const u32 *reg; 952 + reg = get_property(prev, "reg", NULL); 955 953 if (!reg) 956 954 continue; 957 955 if (((*reg) >> 8) != bus->channel) ··· 971 971 972 972 u8 pmac_i2c_get_dev_addr(struct device_node *device) 973 973 { 974 - u32 *reg = (u32 *)get_property(device, "reg", NULL); 974 + const u32 *reg = get_property(device, "reg", NULL); 975 975 976 976 if (reg == NULL) 977 977 return 0;
+20 -17
arch/powerpc/platforms/powermac/pci.c
··· 66 66 static int __init fixup_one_level_bus_range(struct device_node *node, int higher) 67 67 { 68 68 for (; node != 0;node = node->sibling) { 69 - int * bus_range; 70 - unsigned int *class_code; 69 + const int * bus_range; 70 + const unsigned int *class_code; 71 71 int len; 72 72 73 73 /* For PCI<->PCI bridges or CardBus bridges, we go down */ 74 - class_code = (unsigned int *) get_property(node, "class-code", NULL); 74 + class_code = get_property(node, "class-code", NULL); 75 75 if (!class_code || ((*class_code >> 8) != PCI_CLASS_BRIDGE_PCI && 76 76 (*class_code >> 8) != PCI_CLASS_BRIDGE_CARDBUS)) 77 77 continue; 78 - bus_range = (int *) get_property(node, "bus-range", &len); 78 + bus_range = get_property(node, "bus-range", &len); 79 79 if (bus_range != NULL && len > 2 * sizeof(int)) { 80 80 if (bus_range[1] > higher) 81 81 higher = bus_range[1]; ··· 93 93 */ 94 94 static void __init fixup_bus_range(struct device_node *bridge) 95 95 { 96 - int * bus_range; 97 - int len; 96 + int *bus_range, len; 97 + struct property *prop; 98 98 99 99 /* Lookup the "bus-range" property for the hose */ 100 - bus_range = (int *) get_property(bridge, "bus-range", &len); 101 - if (bus_range == NULL || len < 2 * sizeof(int)) 100 + prop = of_find_property(bridge, "bus-range", &len); 101 + if (prop == NULL || prop->length < 2 * sizeof(int)) 102 102 return; 103 + 104 + bus_range = (int *)prop->value; 103 105 bus_range[1] = fixup_one_level_bus_range(bridge->child, bus_range[1]); 104 106 } 105 107 ··· 239 237 static int chaos_validate_dev(struct pci_bus *bus, int devfn, int offset) 240 238 { 241 239 struct device_node *np; 242 - u32 *vendor, *device; 240 + const u32 *vendor, *device; 243 241 244 242 if (offset >= 0x100) 245 243 return PCIBIOS_BAD_REGISTER_NUMBER; ··· 247 245 if (np == NULL) 248 246 return PCIBIOS_DEVICE_NOT_FOUND; 249 247 250 - vendor = (u32 *)get_property(np, "vendor-id", NULL); 251 - device = (u32 *)get_property(np, "device-id", NULL); 248 + vendor = get_property(np, "vendor-id", NULL); 249 + device = get_property(np, "device-id", NULL); 252 250 if (vendor == NULL || device == NULL) 253 251 return PCIBIOS_DEVICE_NOT_FOUND; 254 252 ··· 688 686 689 687 for (nec = NULL; (nec = of_find_node_by_name(nec, "usb")) != NULL;) { 690 688 struct pci_controller *hose; 691 - u32 data, *prop; 689 + u32 data; 690 + const u32 *prop; 692 691 u8 bus, devfn; 693 692 694 - prop = (u32 *)get_property(nec, "vendor-id", NULL); 693 + prop = get_property(nec, "vendor-id", NULL); 695 694 if (prop == NULL) 696 695 continue; 697 696 if (0x1033 != *prop) 698 697 continue; 699 - prop = (u32 *)get_property(nec, "device-id", NULL); 698 + prop = get_property(nec, "device-id", NULL); 700 699 if (prop == NULL) 701 700 continue; 702 701 if (0x0035 != *prop) 703 702 continue; 704 - prop = (u32 *)get_property(nec, "reg", NULL); 703 + prop = get_property(nec, "reg", NULL); 705 704 if (prop == NULL) 706 705 continue; 707 706 devfn = (prop[0] >> 8) & 0xff; ··· 901 898 struct pci_controller *hose; 902 899 struct resource rsrc; 903 900 char *disp_name; 904 - int *bus_range; 901 + const int *bus_range; 905 902 int primary = 1, has_address = 0; 906 903 907 904 DBG("Adding PCI host bridge %s\n", dev->full_name); ··· 910 907 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 911 908 912 909 /* Get bus range if any */ 913 - bus_range = (int *) get_property(dev, "bus-range", &len); 910 + bus_range = get_property(dev, "bus-range", &len); 914 911 if (bus_range == NULL || len < 2 * sizeof(int)) { 915 912 printk(KERN_WARNING "Can't get bus-range for %s, assume" 916 913 " bus 0\n", dev->full_name);
+1 -1
arch/powerpc/platforms/powermac/pfunc_base.c
··· 114 114 * we just create them all 115 115 */ 116 116 for (gp = NULL; (gp = of_get_next_child(gparent, gp)) != NULL;) { 117 - u32 *reg = (u32 *)get_property(gp, "reg", NULL); 117 + const u32 *reg = get_property(gp, "reg", NULL); 118 118 unsigned long offset; 119 119 if (reg == NULL) 120 120 continue;
+3 -2
arch/powerpc/platforms/powermac/pfunc_core.c
··· 813 813 struct pmf_device *dev; 814 814 struct pmf_function *func, *result = NULL; 815 815 char fname[64]; 816 - u32 *prop, ph; 816 + const u32 *prop; 817 + u32 ph; 817 818 818 819 /* 819 820 * Look for a "platform-*" function reference. If we can't find 820 821 * one, then we fallback to a direct call attempt 821 822 */ 822 823 snprintf(fname, 63, "platform-%s", name); 823 - prop = (u32 *)get_property(target, fname, NULL); 824 + prop = get_property(target, fname, NULL); 824 825 if (prop == NULL) 825 826 goto find_it; 826 827 ph = *prop;
+8 -10
arch/powerpc/platforms/powermac/setup.c
··· 116 116 static void pmac_show_cpuinfo(struct seq_file *m) 117 117 { 118 118 struct device_node *np; 119 - char *pp; 119 + const char *pp; 120 120 int plen; 121 121 int mbmodel; 122 122 unsigned int mbflags; ··· 134 134 seq_printf(m, "machine\t\t: "); 135 135 np = of_find_node_by_path("/"); 136 136 if (np != NULL) { 137 - pp = (char *) get_property(np, "model", NULL); 137 + pp = get_property(np, "model", NULL); 138 138 if (pp != NULL) 139 139 seq_printf(m, "%s\n", pp); 140 140 else 141 141 seq_printf(m, "PowerMac\n"); 142 - pp = (char *) get_property(np, "compatible", &plen); 142 + pp = get_property(np, "compatible", &plen); 143 143 if (pp != NULL) { 144 144 seq_printf(m, "motherboard\t:"); 145 145 while (plen > 0) { ··· 163 163 if (np == NULL) 164 164 np = of_find_node_by_type(NULL, "cache"); 165 165 if (np != NULL) { 166 - unsigned int *ic = (unsigned int *) 167 - get_property(np, "i-cache-size", NULL); 168 - unsigned int *dc = (unsigned int *) 169 - get_property(np, "d-cache-size", NULL); 166 + const unsigned int *ic = get_property(np, "i-cache-size", NULL); 167 + const unsigned int *dc = get_property(np, "d-cache-size", NULL); 170 168 seq_printf(m, "L2 cache\t:"); 171 169 has_l2cache = 1; 172 170 if (get_property(np, "cache-unified", NULL) != 0 && dc) { ··· 252 254 if (np == 0) 253 255 np = find_type_devices("cpu"); 254 256 if (np != 0) { 255 - unsigned int *l2cr = (unsigned int *) 257 + const unsigned int *l2cr = 256 258 get_property(np, "l2cr-value", NULL); 257 259 if (l2cr != 0) { 258 260 ppc_override_l2cr = 1; ··· 275 277 static void __init pmac_setup_arch(void) 276 278 { 277 279 struct device_node *cpu, *ic; 278 - int *fp; 280 + const int *fp; 279 281 unsigned long pvr; 280 282 281 283 pvr = PVR_VER(mfspr(SPRN_PVR)); ··· 285 287 loops_per_jiffy = 50000000 / HZ; 286 288 cpu = of_find_node_by_type(NULL, "cpu"); 287 289 if (cpu != NULL) { 288 - fp = (int *) get_property(cpu, "clock-frequency", NULL); 290 + fp = get_property(cpu, "clock-frequency", NULL); 289 291 if (fp != NULL) { 290 292 if (pvr >= 0x30 && pvr < 0x80) 291 293 /* PPC970 etc. */
+3 -4
arch/powerpc/platforms/powermac/smp.c
··· 548 548 struct device_node *cc = NULL; 549 549 struct device_node *p; 550 550 const char *name = NULL; 551 - u32 *reg; 551 + const u32 *reg; 552 552 int ok; 553 553 554 554 /* Look for the clock chip */ ··· 562 562 pmac_tb_clock_chip_host = pmac_i2c_find_bus(cc); 563 563 if (pmac_tb_clock_chip_host == NULL) 564 564 continue; 565 - reg = (u32 *)get_property(cc, "reg", NULL); 565 + reg = get_property(cc, "reg", NULL); 566 566 if (reg == NULL) 567 567 continue; 568 568 switch (*reg) { ··· 707 707 core99_tb_gpio = KL_GPIO_TB_ENABLE; /* default value */ 708 708 cpu = of_find_node_by_type(NULL, "cpu"); 709 709 if (cpu != NULL) { 710 - tbprop = (u32 *)get_property(cpu, "timebase-enable", 711 - NULL); 710 + tbprop = get_property(cpu, "timebase-enable", NULL); 712 711 if (tbprop) 713 712 core99_tb_gpio = *tbprop; 714 713 of_node_put(cpu);
+5 -5
arch/powerpc/platforms/powermac/udbg_scc.c
··· 68 68 69 69 void udbg_scc_init(int force_scc) 70 70 { 71 - u32 *reg; 71 + const u32 *reg; 72 72 unsigned long addr; 73 73 struct device_node *stdout = NULL, *escc = NULL, *macio = NULL; 74 74 struct device_node *ch, *ch_def = NULL, *ch_a = NULL; 75 - char *path; 75 + const char *path; 76 76 int i, x; 77 77 78 78 escc = of_find_node_by_name(NULL, "escc"); ··· 81 81 macio = of_get_parent(escc); 82 82 if (macio == NULL) 83 83 goto bail; 84 - path = (char *)get_property(of_chosen, "linux,stdout-path", NULL); 84 + path = get_property(of_chosen, "linux,stdout-path", NULL); 85 85 if (path != NULL) 86 86 stdout = of_find_node_by_path(path); 87 87 for (ch = NULL; (ch = of_get_next_child(escc, ch)) != NULL;) { ··· 96 96 ch = ch_def ? ch_def : ch_a; 97 97 98 98 /* Get address within mac-io ASIC */ 99 - reg = (u32 *)get_property(escc, "reg", NULL); 99 + reg = get_property(escc, "reg", NULL); 100 100 if (reg == NULL) 101 101 goto bail; 102 102 addr = reg[0]; 103 103 104 104 /* Get address of mac-io PCI itself */ 105 - reg = (u32 *)get_property(macio, "assigned-addresses", NULL); 105 + reg = get_property(macio, "assigned-addresses", NULL); 106 106 if (reg == NULL) 107 107 goto bail; 108 108 addr += reg[2];
+1
arch/powerpc/platforms/pseries/Makefile
··· 12 12 13 13 obj-$(CONFIG_HVC_CONSOLE) += hvconsole.o 14 14 obj-$(CONFIG_HVCS) += hvcserver.o 15 + obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
+73 -23
arch/powerpc/platforms/pseries/eeh.c
··· 449 449 /* ------------------------------------------------------------- */ 450 450 /* The code below deals with error recovery */ 451 451 452 - /** Return negative value if a permanent error, else return 452 + /** 453 + * eeh_slot_availability - returns error status of slot 454 + * @pdn pci device node 455 + * 456 + * Return negative value if a permanent error, else return 453 457 * a number of milliseconds to wait until the PCI slot is 454 458 * ready to be used. 455 459 */ ··· 478 474 479 475 printk (KERN_ERR "EEH: Slot unavailable: rc=%d, rets=%d %d %d\n", 480 476 rc, rets[0], rets[1], rets[2]); 481 - return -1; 477 + return -2; 482 478 } 483 479 484 - /** rtas_pci_slot_reset raises/lowers the pci #RST line 485 - * state: 1/0 to raise/lower the #RST 480 + /** 481 + * rtas_pci_enable - enable MMIO or DMA transfers for this slot 482 + * @pdn pci device node 483 + */ 484 + 485 + int 486 + rtas_pci_enable(struct pci_dn *pdn, int function) 487 + { 488 + int config_addr; 489 + int rc; 490 + 491 + /* Use PE configuration address, if present */ 492 + config_addr = pdn->eeh_config_addr; 493 + if (pdn->eeh_pe_config_addr) 494 + config_addr = pdn->eeh_pe_config_addr; 495 + 496 + rc = rtas_call(ibm_set_eeh_option, 4, 1, NULL, 497 + config_addr, 498 + BUID_HI(pdn->phb->buid), 499 + BUID_LO(pdn->phb->buid), 500 + function); 501 + 502 + if (rc) 503 + printk(KERN_WARNING "EEH: Cannot enable function %d, err=%d dn=%s\n", 504 + function, rc, pdn->node->full_name); 505 + 506 + return rc; 507 + } 508 + 509 + /** 510 + * rtas_pci_slot_reset - raises/lowers the pci #RST line 511 + * @pdn pci device node 512 + * @state: 1/0 to raise/lower the #RST 486 513 * 487 514 * Clear the EEH-frozen condition on a slot. This routine 488 515 * asserts the PCI #RST line if the 'state' argument is '1', ··· 546 511 BUID_HI(pdn->phb->buid), 547 512 BUID_LO(pdn->phb->buid), 548 513 state); 549 - if (rc) { 550 - printk (KERN_WARNING "EEH: Unable to reset the failed slot, (%d) #RST=%d dn=%s\n", 514 + if (rc) 515 + printk (KERN_WARNING "EEH: Unable to reset the failed slot," 516 + " (%d) #RST=%d dn=%s\n", 551 517 rc, state, pdn->node->full_name); 552 - return; 553 - } 554 518 } 555 519 556 - /** rtas_set_slot_reset -- assert the pci #RST line for 1/4 second 557 - * dn -- device node to be reset. 520 + /** 521 + * rtas_set_slot_reset -- assert the pci #RST line for 1/4 second 522 + * @pdn: pci device node to be reset. 558 523 * 559 524 * Return 0 if success, else a non-zero value. 560 525 */ 561 526 562 - int 563 - rtas_set_slot_reset(struct pci_dn *pdn) 527 + static void __rtas_set_slot_reset(struct pci_dn *pdn) 564 528 { 565 - int i, rc; 566 - 567 529 rtas_pci_slot_reset (pdn, 1); 568 530 569 531 /* The PCI bus requires that the reset be held high for at least ··· 581 549 * up traffic. */ 582 550 #define PCI_BUS_SETTLE_TIME_MSEC 1800 583 551 msleep (PCI_BUS_SETTLE_TIME_MSEC); 552 + } 553 + 554 + int rtas_set_slot_reset(struct pci_dn *pdn) 555 + { 556 + int i, rc; 557 + 558 + __rtas_set_slot_reset(pdn); 584 559 585 560 /* Now double check with the firmware to make sure the device is 586 561 * ready to be used; if not, wait for recovery. */ 587 562 for (i=0; i<10; i++) { 588 563 rc = eeh_slot_availability (pdn); 589 - if (rc < 0) 590 - printk (KERN_ERR "EEH: failed (%d) to reset slot %s\n", rc, pdn->node->full_name); 591 564 if (rc == 0) 592 565 return 0; 593 - if (rc < 0) 566 + 567 + if (rc == -2) { 568 + printk (KERN_ERR "EEH: failed (%d) to reset slot %s\n", 569 + i, pdn->node->full_name); 570 + __rtas_set_slot_reset(pdn); 571 + continue; 572 + } 573 + 574 + if (rc < 0) { 575 + printk (KERN_ERR "EEH: unrecoverable slot failure %s\n", 576 + pdn->node->full_name); 594 577 return -1; 578 + } 595 579 596 580 msleep (rc+100); 597 581 } ··· 630 582 631 583 /** 632 584 * __restore_bars - Restore the Base Address Registers 585 + * @pdn: pci device node 586 + * 633 587 * Loads the PCI configuration space base address registers, 634 588 * the expansion ROM base address, the latency timer, and etc. 635 589 * from the saved values in the device node. ··· 741 691 { 742 692 struct eeh_early_enable_info *info = data; 743 693 int ret; 744 - char *status = get_property(dn, "status", NULL); 745 - u32 *class_code = (u32 *)get_property(dn, "class-code", NULL); 746 - u32 *vendor_id = (u32 *)get_property(dn, "vendor-id", NULL); 747 - u32 *device_id = (u32 *)get_property(dn, "device-id", NULL); 748 - u32 *regs; 694 + const char *status = get_property(dn, "status", NULL); 695 + const u32 *class_code = get_property(dn, "class-code", NULL); 696 + const u32 *vendor_id = get_property(dn, "vendor-id", NULL); 697 + const u32 *device_id = get_property(dn, "device-id", NULL); 698 + const u32 *regs; 749 699 int enable; 750 700 struct pci_dn *pdn = PCI_DN(dn); 751 701 ··· 787 737 788 738 /* Ok... see if this device supports EEH. Some do, some don't, 789 739 * and the only way to find out is to check each and every one. */ 790 - regs = (u32 *)get_property(dn, "reg", NULL); 740 + regs = get_property(dn, "reg", NULL); 791 741 if (regs) { 792 742 /* First register entry is addr (00BBSS00) */ 793 743 /* Try to enable eeh */
+2 -15
arch/powerpc/platforms/pseries/eeh_cache.c
··· 157 157 if (!piar) 158 158 return NULL; 159 159 160 + pci_dev_get(dev); 160 161 piar->addr_lo = alo; 161 162 piar->addr_hi = ahi; 162 163 piar->pcidev = dev; ··· 179 178 struct device_node *dn; 180 179 struct pci_dn *pdn; 181 180 int i; 182 - int inserted = 0; 183 181 184 182 dn = pci_device_to_OF_node(dev); 185 183 if (!dn) { ··· 197 197 return; 198 198 } 199 199 200 - /* The cache holds a reference to the device... */ 201 - pci_dev_get(dev); 202 - 203 200 /* Walk resources on this device, poke them into the tree */ 204 201 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 205 202 unsigned long start = pci_resource_start(dev,i); ··· 209 212 if (start == 0 || ~start == 0 || end == 0 || ~end == 0) 210 213 continue; 211 214 pci_addr_cache_insert(dev, start, end, flags); 212 - inserted = 1; 213 215 } 214 - 215 - /* If there was nothing to add, the cache has no reference... */ 216 - if (!inserted) 217 - pci_dev_put(dev); 218 216 } 219 217 220 218 /** ··· 232 240 static inline void __pci_addr_cache_remove_device(struct pci_dev *dev) 233 241 { 234 242 struct rb_node *n; 235 - int removed = 0; 236 243 237 244 restart: 238 245 n = rb_first(&pci_io_addr_cache_root.rb_root); ··· 241 250 242 251 if (piar->pcidev == dev) { 243 252 rb_erase(n, &pci_io_addr_cache_root.rb_root); 244 - removed = 1; 253 + pci_dev_put(piar->pcidev); 245 254 kfree(piar); 246 255 goto restart; 247 256 } 248 257 n = rb_next(n); 249 258 } 250 - 251 - /* The cache no longer holds its reference to this device... */ 252 - if (removed) 253 - pci_dev_put(dev); 254 259 } 255 260 256 261 /**
+87 -25
arch/powerpc/platforms/pseries/eeh_driver.c
··· 77 77 } 78 78 79 79 /* ------------------------------------------------------- */ 80 - /** eeh_report_error - report an EEH error to each device, 81 - * collect up and merge the device responses. 80 + /** 81 + * eeh_report_error - report pci error to each device driver 82 + * 83 + * Report an EEH error to each device driver, collect up and 84 + * merge the device driver responses. Cumulative response 85 + * passed back in "userdata". 82 86 */ 83 87 84 88 static void eeh_report_error(struct pci_dev *dev, void *userdata) ··· 100 96 PCI_DN(dn)->eeh_mode |= EEH_MODE_IRQ_DISABLED; 101 97 disable_irq_nosync(dev->irq); 102 98 } 103 - if (!driver->err_handler) 104 - return; 105 - if (!driver->err_handler->error_detected) 99 + if (!driver->err_handler || 100 + !driver->err_handler->error_detected) 106 101 return; 107 102 108 103 rc = driver->err_handler->error_detected (dev, pci_channel_io_frozen); 109 104 if (*res == PCI_ERS_RESULT_NONE) *res = rc; 110 - if (*res == PCI_ERS_RESULT_NEED_RESET) return; 111 105 if (*res == PCI_ERS_RESULT_DISCONNECT && 112 106 rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 113 107 } 114 108 115 - /** eeh_report_reset -- tell this device that the pci slot 116 - * has been reset. 109 + /** 110 + * eeh_report_mmio_enabled - tell drivers that MMIO has been enabled 111 + * 112 + * Report an EEH error to each device driver, collect up and 113 + * merge the device driver responses. Cumulative response 114 + * passed back in "userdata". 115 + */ 116 + 117 + static void eeh_report_mmio_enabled(struct pci_dev *dev, void *userdata) 118 + { 119 + enum pci_ers_result rc, *res = userdata; 120 + struct pci_driver *driver = dev->driver; 121 + 122 + // dev->error_state = pci_channel_mmio_enabled; 123 + 124 + if (!driver || 125 + !driver->err_handler || 126 + !driver->err_handler->mmio_enabled) 127 + return; 128 + 129 + rc = driver->err_handler->mmio_enabled (dev); 130 + if (*res == PCI_ERS_RESULT_NONE) *res = rc; 131 + if (*res == PCI_ERS_RESULT_DISCONNECT && 132 + rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 133 + } 134 + 135 + /** 136 + * eeh_report_reset - tell device that slot has been reset 117 137 */ 118 138 119 139 static void eeh_report_reset(struct pci_dev *dev, void *userdata) 120 140 { 141 + enum pci_ers_result rc, *res = userdata; 121 142 struct pci_driver *driver = dev->driver; 122 143 struct device_node *dn = pci_device_to_OF_node(dev); 123 144 ··· 153 124 PCI_DN(dn)->eeh_mode &= ~EEH_MODE_IRQ_DISABLED; 154 125 enable_irq(dev->irq); 155 126 } 156 - if (!driver->err_handler) 157 - return; 158 - if (!driver->err_handler->slot_reset) 127 + if (!driver->err_handler || 128 + !driver->err_handler->slot_reset) 159 129 return; 160 130 161 - driver->err_handler->slot_reset(dev); 131 + rc = driver->err_handler->slot_reset(dev); 132 + if (*res == PCI_ERS_RESULT_NONE) *res = rc; 133 + if (*res == PCI_ERS_RESULT_DISCONNECT && 134 + rc == PCI_ERS_RESULT_NEED_RESET) *res = rc; 162 135 } 136 + 137 + /** 138 + * eeh_report_resume - tell device to resume normal operations 139 + */ 163 140 164 141 static void eeh_report_resume(struct pci_dev *dev, void *userdata) 165 142 { ··· 182 147 183 148 driver->err_handler->resume(dev); 184 149 } 150 + 151 + /** 152 + * eeh_report_failure - tell device driver that device is dead. 153 + * 154 + * This informs the device driver that the device is permanently 155 + * dead, and that no further recovery attempts will be made on it. 156 + */ 185 157 186 158 static void eeh_report_failure(struct pci_dev *dev, void *userdata) 187 159 { ··· 232 190 233 191 /** 234 192 * eeh_reset_device() -- perform actual reset of a pci slot 235 - * Args: bus: pointer to the pci bus structure corresponding 193 + * @bus: pointer to the pci bus structure corresponding 236 194 * to the isolated slot. A non-null value will 237 195 * cause all devices under the bus to be removed 238 196 * and then re-added. 239 - * pe_dn: pointer to a "Partionable Endpoint" device node. 197 + * @pe_dn: pointer to a "Partionable Endpoint" device node. 240 198 * This is the top-level structure on which pci 241 199 * bus resets can be performed. 242 200 */ ··· 310 268 311 269 if (!frozen_dn) { 312 270 313 - location = (char *) get_property(event->dn, "ibm,loc-code", NULL); 271 + location = get_property(event->dn, "ibm,loc-code", NULL); 314 272 location = location ? location : "unknown"; 315 273 printk(KERN_ERR "EEH: Error: Cannot find partition endpoint " 316 274 "for location=%s pci addr=%s\n", 317 275 location, pci_name(event->dev)); 318 276 return NULL; 319 277 } 320 - location = (char *) get_property(frozen_dn, "ibm,loc-code", NULL); 278 + location = get_property(frozen_dn, "ibm,loc-code", NULL); 321 279 location = location ? location : "unknown"; 322 280 323 281 /* There are two different styles for coming up with the PE. ··· 389 347 goto hard_fail; 390 348 } 391 349 350 + /* If all devices reported they can proceed, then re-enable MMIO */ 351 + if (result == PCI_ERS_RESULT_CAN_RECOVER) { 352 + rc = rtas_pci_enable(frozen_pdn, EEH_THAW_MMIO); 353 + 354 + if (rc) { 355 + result = PCI_ERS_RESULT_NEED_RESET; 356 + } else { 357 + result = PCI_ERS_RESULT_NONE; 358 + pci_walk_bus(frozen_bus, eeh_report_mmio_enabled, &result); 359 + } 360 + } 361 + 362 + /* If all devices reported they can proceed, then re-enable DMA */ 363 + if (result == PCI_ERS_RESULT_CAN_RECOVER) { 364 + rc = rtas_pci_enable(frozen_pdn, EEH_THAW_DMA); 365 + 366 + if (rc) 367 + result = PCI_ERS_RESULT_NEED_RESET; 368 + } 369 + 370 + /* If any device has a hard failure, then shut off everything. */ 371 + if (result == PCI_ERS_RESULT_DISCONNECT) 372 + goto hard_fail; 373 + 392 374 /* If any device called out for a reset, then reset the slot */ 393 375 if (result == PCI_ERS_RESULT_NEED_RESET) { 394 376 rc = eeh_reset_device(frozen_pdn, NULL); 395 377 if (rc) 396 378 goto hard_fail; 397 - pci_walk_bus(frozen_bus, eeh_report_reset, NULL); 379 + result = PCI_ERS_RESULT_NONE; 380 + pci_walk_bus(frozen_bus, eeh_report_reset, &result); 398 381 } 399 382 400 - /* If all devices reported they can proceed, the re-enable PIO */ 401 - if (result == PCI_ERS_RESULT_CAN_RECOVER) { 402 - /* XXX Not supported; we brute-force reset the device */ 403 - rc = eeh_reset_device(frozen_pdn, NULL); 404 - if (rc) 405 - goto hard_fail; 406 - pci_walk_bus(frozen_bus, eeh_report_reset, NULL); 407 - } 383 + /* All devices should claim they have recovered by now. */ 384 + if (result != PCI_ERS_RESULT_RECOVERED) 385 + goto hard_fail; 408 386 409 387 /* Tell all device drivers that they can resume operations */ 410 388 pci_walk_bus(frozen_bus, eeh_report_resume, NULL);
+2 -2
arch/powerpc/platforms/pseries/eeh_event.c
··· 124 124 { 125 125 unsigned long flags; 126 126 struct eeh_event *event; 127 - char *location; 127 + const char *location; 128 128 129 129 if (!mem_init_done) { 130 130 printk(KERN_ERR "EEH: event during early boot not handled\n"); 131 - location = (char *) get_property(dn, "ibm,loc-code", NULL); 131 + location = get_property(dn, "ibm,loc-code", NULL); 132 132 printk(KERN_ERR "EEH: device node = %s\n", dn->full_name); 133 133 printk(KERN_ERR "EEH: PCI location = %s\n", location); 134 134 return 1;
+1 -1
arch/powerpc/platforms/pseries/firmware.c
··· 68 68 void __init fw_feature_init(void) 69 69 { 70 70 struct device_node *dn; 71 - char *hypertas, *s; 71 + const char *hypertas, *s; 72 72 int len, i; 73 73 74 74 DBG(" -> fw_feature_init()\n");
+107 -172
arch/powerpc/platforms/pseries/hvCall.S
··· 1 1 /* 2 2 * This file contains the generic code to perform a call to the 3 3 * pSeries LPAR hypervisor. 4 - * NOTE: this file will go away when we move to inline this work. 5 4 * 6 5 * This program is free software; you can redistribute it and/or 7 6 * modify it under the terms of the GNU General Public License ··· 10 11 #include <asm/hvcall.h> 11 12 #include <asm/processor.h> 12 13 #include <asm/ppc_asm.h> 14 + #include <asm/asm-offsets.h> 13 15 14 16 #define STK_PARM(i) (48 + ((i)-3)*8) 15 17 18 + #ifdef CONFIG_HCALL_STATS 19 + /* 20 + * precall must preserve all registers. use unused STK_PARM() 21 + * areas to save snapshots and opcode. 22 + */ 23 + #define HCALL_INST_PRECALL \ 24 + std r3,STK_PARM(r3)(r1); /* save opcode */ \ 25 + mftb r0; /* get timebase and */ \ 26 + std r0,STK_PARM(r5)(r1); /* save for later */ \ 27 + BEGIN_FTR_SECTION; \ 28 + mfspr r0,SPRN_PURR; /* get PURR and */ \ 29 + std r0,STK_PARM(r6)(r1); /* save for later */ \ 30 + END_FTR_SECTION_IFCLR(CPU_FTR_PURR); 31 + 32 + /* 33 + * postcall is performed immediately before function return which 34 + * allows liberal use of volatile registers. 35 + */ 36 + #define HCALL_INST_POSTCALL \ 37 + ld r4,STK_PARM(r3)(r1); /* validate opcode */ \ 38 + cmpldi cr7,r4,MAX_HCALL_OPCODE; \ 39 + bgt- cr7,1f; \ 40 + \ 41 + /* get time and PURR snapshots after hcall */ \ 42 + mftb r7; /* timebase after */ \ 43 + BEGIN_FTR_SECTION; \ 44 + mfspr r8,SPRN_PURR; /* PURR after */ \ 45 + ld r6,STK_PARM(r6)(r1); /* PURR before */ \ 46 + subf r6,r6,r8; /* delta */ \ 47 + END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ 48 + ld r5,STK_PARM(r5)(r1); /* timebase before */ \ 49 + subf r5,r5,r7; /* time delta */ \ 50 + \ 51 + /* calculate address of stat structure r4 = opcode */ \ 52 + srdi r4,r4,2; /* index into array */ \ 53 + mulli r4,r4,HCALL_STAT_SIZE; \ 54 + LOAD_REG_ADDR(r7, per_cpu__hcall_stats); \ 55 + add r4,r4,r7; \ 56 + ld r7,PACA_DATA_OFFSET(r13); /* per cpu offset */ \ 57 + add r4,r4,r7; \ 58 + \ 59 + /* update stats */ \ 60 + ld r7,HCALL_STAT_CALLS(r4); /* count */ \ 61 + addi r7,r7,1; \ 62 + std r7,HCALL_STAT_CALLS(r4); \ 63 + ld r7,HCALL_STAT_TB(r4); /* timebase */ \ 64 + add r7,r7,r5; \ 65 + std r7,HCALL_STAT_TB(r4); \ 66 + BEGIN_FTR_SECTION; \ 67 + ld r7,HCALL_STAT_PURR(r4); /* PURR */ \ 68 + add r7,r7,r6; \ 69 + std r7,HCALL_STAT_PURR(r4); \ 70 + END_FTR_SECTION_IFCLR(CPU_FTR_PURR); \ 71 + 1: 72 + #else 73 + #define HCALL_INST_PRECALL 74 + #define HCALL_INST_POSTCALL 75 + #endif 76 + 16 77 .text 17 78 18 - /* long plpar_hcall(unsigned long opcode, R3 19 - unsigned long arg1, R4 20 - unsigned long arg2, R5 21 - unsigned long arg3, R6 22 - unsigned long arg4, R7 23 - unsigned long *out1, R8 24 - unsigned long *out2, R9 25 - unsigned long *out3); R10 26 - */ 27 - _GLOBAL(plpar_hcall) 28 - HMT_MEDIUM 29 - 30 - mfcr r0 31 - 32 - std r8,STK_PARM(r8)(r1) /* Save out ptrs */ 33 - std r9,STK_PARM(r9)(r1) 34 - std r10,STK_PARM(r10)(r1) 35 - 36 - stw r0,8(r1) 37 - 38 - HVSC /* invoke the hypervisor */ 39 - 40 - lwz r0,8(r1) 41 - 42 - ld r8,STK_PARM(r8)(r1) /* Fetch r4-r6 ret args */ 43 - ld r9,STK_PARM(r9)(r1) 44 - ld r10,STK_PARM(r10)(r1) 45 - std r4,0(r8) 46 - std r5,0(r9) 47 - std r6,0(r10) 48 - 49 - mtcrf 0xff,r0 50 - blr /* return r3 = status */ 51 - 52 - 53 - /* Simple interface with no output values (other than status) */ 54 79 _GLOBAL(plpar_hcall_norets) 55 80 HMT_MEDIUM 56 81 57 82 mfcr r0 58 83 stw r0,8(r1) 59 84 85 + HCALL_INST_PRECALL 86 + 60 87 HVSC /* invoke the hypervisor */ 88 + 89 + HCALL_INST_POSTCALL 61 90 62 91 lwz r0,8(r1) 63 92 mtcrf 0xff,r0 64 93 blr /* return r3 = status */ 65 94 66 - 67 - /* long plpar_hcall_8arg_2ret(unsigned long opcode, R3 68 - unsigned long arg1, R4 69 - unsigned long arg2, R5 70 - unsigned long arg3, R6 71 - unsigned long arg4, R7 72 - unsigned long arg5, R8 73 - unsigned long arg6, R9 74 - unsigned long arg7, R10 75 - unsigned long arg8, 112(R1) 76 - unsigned long *out1); 120(R1) 77 - */ 78 - _GLOBAL(plpar_hcall_8arg_2ret) 79 - HMT_MEDIUM 80 - 81 - mfcr r0 82 - ld r11,STK_PARM(r11)(r1) /* put arg8 in R11 */ 83 - stw r0,8(r1) 84 - 85 - HVSC /* invoke the hypervisor */ 86 - 87 - lwz r0,8(r1) 88 - ld r10,STK_PARM(r12)(r1) /* Fetch r4 ret arg */ 89 - std r4,0(r10) 90 - mtcrf 0xff,r0 91 - blr /* return r3 = status */ 92 - 93 - 94 - /* long plpar_hcall_4out(unsigned long opcode, R3 95 - unsigned long arg1, R4 96 - unsigned long arg2, R5 97 - unsigned long arg3, R6 98 - unsigned long arg4, R7 99 - unsigned long *out1, R8 100 - unsigned long *out2, R9 101 - unsigned long *out3, R10 102 - unsigned long *out4); 112(R1) 103 - */ 104 - _GLOBAL(plpar_hcall_4out) 95 + _GLOBAL(plpar_hcall) 105 96 HMT_MEDIUM 106 97 107 98 mfcr r0 108 99 stw r0,8(r1) 109 100 110 - std r8,STK_PARM(r8)(r1) /* Save out ptrs */ 111 - std r9,STK_PARM(r9)(r1) 112 - std r10,STK_PARM(r10)(r1) 101 + HCALL_INST_PRECALL 102 + 103 + std r4,STK_PARM(r4)(r1) /* Save ret buffer */ 104 + 105 + mr r4,r5 106 + mr r5,r6 107 + mr r6,r7 108 + mr r7,r8 109 + mr r8,r9 110 + mr r9,r10 113 111 114 112 HVSC /* invoke the hypervisor */ 115 113 116 - lwz r0,8(r1) 114 + ld r12,STK_PARM(r4)(r1) 115 + std r4, 0(r12) 116 + std r5, 8(r12) 117 + std r6, 16(r12) 118 + std r7, 24(r12) 117 119 118 - ld r8,STK_PARM(r8)(r1) /* Fetch r4-r7 ret args */ 119 - ld r9,STK_PARM(r9)(r1) 120 - ld r10,STK_PARM(r10)(r1) 121 - ld r11,STK_PARM(r11)(r1) 122 - std r4,0(r8) 123 - std r5,0(r9) 124 - std r6,0(r10) 125 - std r7,0(r11) 126 - 127 - mtcrf 0xff,r0 128 - blr /* return r3 = status */ 129 - 130 - /* plpar_hcall_7arg_7ret(unsigned long opcode, R3 131 - unsigned long arg1, R4 132 - unsigned long arg2, R5 133 - unsigned long arg3, R6 134 - unsigned long arg4, R7 135 - unsigned long arg5, R8 136 - unsigned long arg6, R9 137 - unsigned long arg7, R10 138 - unsigned long *out1, 112(R1) 139 - unsigned long *out2, 110(R1) 140 - unsigned long *out3, 108(R1) 141 - unsigned long *out4, 106(R1) 142 - unsigned long *out5, 104(R1) 143 - unsigned long *out6, 102(R1) 144 - unsigned long *out7); 100(R1) 145 - */ 146 - _GLOBAL(plpar_hcall_7arg_7ret) 147 - HMT_MEDIUM 148 - 149 - mfcr r0 150 - stw r0,8(r1) 151 - 152 - HVSC /* invoke the hypervisor */ 120 + HCALL_INST_POSTCALL 153 121 154 122 lwz r0,8(r1) 155 - 156 - ld r11,STK_PARM(r11)(r1) /* Fetch r4 ret arg */ 157 - std r4,0(r11) 158 - ld r11,STK_PARM(r12)(r1) /* Fetch r5 ret arg */ 159 - std r5,0(r11) 160 - ld r11,STK_PARM(r13)(r1) /* Fetch r6 ret arg */ 161 - std r6,0(r11) 162 - ld r11,STK_PARM(r14)(r1) /* Fetch r7 ret arg */ 163 - std r7,0(r11) 164 - ld r11,STK_PARM(r15)(r1) /* Fetch r8 ret arg */ 165 - std r8,0(r11) 166 - ld r11,STK_PARM(r16)(r1) /* Fetch r9 ret arg */ 167 - std r9,0(r11) 168 - ld r11,STK_PARM(r17)(r1) /* Fetch r10 ret arg */ 169 - std r10,0(r11) 170 - 171 123 mtcrf 0xff,r0 172 124 173 125 blr /* return r3 = status */ 174 126 175 - /* plpar_hcall_9arg_9ret(unsigned long opcode, R3 176 - unsigned long arg1, R4 177 - unsigned long arg2, R5 178 - unsigned long arg3, R6 179 - unsigned long arg4, R7 180 - unsigned long arg5, R8 181 - unsigned long arg6, R9 182 - unsigned long arg7, R10 183 - unsigned long arg8, 112(R1) 184 - unsigned long arg9, 110(R1) 185 - unsigned long *out1, 108(R1) 186 - unsigned long *out2, 106(R1) 187 - unsigned long *out3, 104(R1) 188 - unsigned long *out4, 102(R1) 189 - unsigned long *out5, 100(R1) 190 - unsigned long *out6, 98(R1) 191 - unsigned long *out7); 96(R1) 192 - unsigned long *out8, 94(R1) 193 - unsigned long *out9, 92(R1) 194 - */ 195 - _GLOBAL(plpar_hcall_9arg_9ret) 127 + _GLOBAL(plpar_hcall9) 196 128 HMT_MEDIUM 197 129 198 130 mfcr r0 199 131 stw r0,8(r1) 200 132 201 - ld r11,STK_PARM(r11)(r1) /* put arg8 in R11 */ 202 - ld r12,STK_PARM(r12)(r1) /* put arg9 in R12 */ 133 + HCALL_INST_PRECALL 134 + 135 + std r4,STK_PARM(r4)(r1) /* Save ret buffer */ 136 + 137 + mr r4,r5 138 + mr r5,r6 139 + mr r6,r7 140 + mr r7,r8 141 + mr r8,r9 142 + mr r9,r10 143 + ld r10,STK_PARM(r11)(r1) /* put arg7 in R10 */ 144 + ld r11,STK_PARM(r12)(r1) /* put arg8 in R11 */ 145 + ld r12,STK_PARM(r13)(r1) /* put arg9 in R12 */ 203 146 204 147 HVSC /* invoke the hypervisor */ 205 148 206 - ld r0,STK_PARM(r13)(r1) /* Fetch r4 ret arg */ 207 - stdx r4,r0,r0 208 - ld r0,STK_PARM(r14)(r1) /* Fetch r5 ret arg */ 209 - stdx r5,r0,r0 210 - ld r0,STK_PARM(r15)(r1) /* Fetch r6 ret arg */ 211 - stdx r6,r0,r0 212 - ld r0,STK_PARM(r16)(r1) /* Fetch r7 ret arg */ 213 - stdx r7,r0,r0 214 - ld r0,STK_PARM(r17)(r1) /* Fetch r8 ret arg */ 215 - stdx r8,r0,r0 216 - ld r0,STK_PARM(r18)(r1) /* Fetch r9 ret arg */ 217 - stdx r9,r0,r0 218 - ld r0,STK_PARM(r19)(r1) /* Fetch r10 ret arg */ 219 - stdx r10,r0,r0 220 - ld r0,STK_PARM(r20)(r1) /* Fetch r11 ret arg */ 221 - stdx r11,r0,r0 222 - ld r0,STK_PARM(r21)(r1) /* Fetch r12 ret arg */ 223 - stdx r12,r0,r0 149 + ld r12,STK_PARM(r4)(r1) 150 + std r4, 0(r12) 151 + std r5, 8(r12) 152 + std r6, 16(r12) 153 + std r7, 24(r12) 154 + std r8, 32(r12) 155 + std r9, 40(r12) 156 + std r10,48(r12) 157 + std r11,56(r12) 158 + std r12,64(r12) 159 + 160 + HCALL_INST_POSTCALL 224 161 225 162 lwz r0,8(r1) 226 163 mtcrf 0xff,r0
+129
arch/powerpc/platforms/pseries/hvCall_inst.c
··· 1 + /* 2 + * Copyright (C) 2006 Mike Kravetz IBM Corporation 3 + * 4 + * Hypervisor Call Instrumentation 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + * 16 + * You should have received a copy of the GNU General Public License 17 + * along with this program; if not, write to the Free Software 18 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 + */ 20 + 21 + #include <linux/kernel.h> 22 + #include <linux/percpu.h> 23 + #include <linux/debugfs.h> 24 + #include <linux/seq_file.h> 25 + #include <linux/cpumask.h> 26 + #include <asm/hvcall.h> 27 + #include <asm/firmware.h> 28 + #include <asm/cputable.h> 29 + 30 + DEFINE_PER_CPU(struct hcall_stats[HCALL_STAT_ARRAY_SIZE], hcall_stats); 31 + 32 + /* 33 + * Routines for displaying the statistics in debugfs 34 + */ 35 + static void *hc_start(struct seq_file *m, loff_t *pos) 36 + { 37 + if ((int)*pos < HCALL_STAT_ARRAY_SIZE) 38 + return (void *)(unsigned long)(*pos + 1); 39 + 40 + return NULL; 41 + } 42 + 43 + static void *hc_next(struct seq_file *m, void *p, loff_t * pos) 44 + { 45 + ++*pos; 46 + 47 + return hc_start(m, pos); 48 + } 49 + 50 + static void hc_stop(struct seq_file *m, void *p) 51 + { 52 + } 53 + 54 + static int hc_show(struct seq_file *m, void *p) 55 + { 56 + unsigned long h_num = (unsigned long)p; 57 + struct hcall_stats *hs = (struct hcall_stats *)m->private; 58 + 59 + if (hs[h_num].num_calls) { 60 + if (!cpu_has_feature(CPU_FTR_PURR)) 61 + seq_printf(m, "%lu %lu %lu %lu\n", h_num<<2, 62 + hs[h_num].num_calls, 63 + hs[h_num].tb_total, 64 + hs[h_num].purr_total); 65 + else 66 + seq_printf(m, "%lu %lu %lu\n", h_num<<2, 67 + hs[h_num].num_calls, 68 + hs[h_num].tb_total); 69 + } 70 + 71 + return 0; 72 + } 73 + 74 + static struct seq_operations hcall_inst_seq_ops = { 75 + .start = hc_start, 76 + .next = hc_next, 77 + .stop = hc_stop, 78 + .show = hc_show 79 + }; 80 + 81 + static int hcall_inst_seq_open(struct inode *inode, struct file *file) 82 + { 83 + int rc; 84 + struct seq_file *seq; 85 + 86 + rc = seq_open(file, &hcall_inst_seq_ops); 87 + seq = file->private_data; 88 + seq->private = file->f_dentry->d_inode->u.generic_ip; 89 + 90 + return rc; 91 + } 92 + 93 + static struct file_operations hcall_inst_seq_fops = { 94 + .open = hcall_inst_seq_open, 95 + .read = seq_read, 96 + .llseek = seq_lseek, 97 + .release = seq_release, 98 + }; 99 + 100 + #define HCALL_ROOT_DIR "hcall_inst" 101 + #define CPU_NAME_BUF_SIZE 32 102 + 103 + static int __init hcall_inst_init(void) 104 + { 105 + struct dentry *hcall_root; 106 + struct dentry *hcall_file; 107 + char cpu_name_buf[CPU_NAME_BUF_SIZE]; 108 + int cpu; 109 + 110 + if (!firmware_has_feature(FW_FEATURE_LPAR)) 111 + return 0; 112 + 113 + hcall_root = debugfs_create_dir(HCALL_ROOT_DIR, NULL); 114 + if (!hcall_root) 115 + return -ENOMEM; 116 + 117 + for_each_possible_cpu(cpu) { 118 + snprintf(cpu_name_buf, CPU_NAME_BUF_SIZE, "cpu%d", cpu); 119 + hcall_file = debugfs_create_file(cpu_name_buf, S_IRUGO, 120 + hcall_root, 121 + per_cpu(hcall_stats, cpu), 122 + &hcall_inst_seq_fops); 123 + if (!hcall_file) 124 + return -ENOMEM; 125 + } 126 + 127 + return 0; 128 + } 129 + __initcall(hcall_inst_init);
+3 -2
arch/powerpc/platforms/pseries/hvconsole.c
··· 27 27 #include <linux/module.h> 28 28 #include <asm/hvcall.h> 29 29 #include <asm/hvconsole.h> 30 + #include "plpar_wrappers.h" 30 31 31 32 /** 32 33 * hvc_get_chars - retrieve characters from firmware for denoted vterm adatper ··· 41 40 { 42 41 unsigned long got; 43 42 44 - if (plpar_hcall(H_GET_TERM_CHAR, vtermno, 0, 0, 0, &got, 45 - (unsigned long *)buf, (unsigned long *)buf+1) == H_SUCCESS) 43 + if (plpar_get_term_char(vtermno, &got, buf) == H_SUCCESS) 46 44 return got; 45 + 47 46 return 0; 48 47 } 49 48
+6 -7
arch/powerpc/platforms/pseries/iommu.c
··· 267 267 struct iommu_table *tbl) 268 268 { 269 269 struct device_node *node; 270 - unsigned long *basep; 271 - unsigned int *sizep; 270 + const unsigned long *basep, *sizep; 272 271 273 272 node = (struct device_node *)phb->arch_data; 274 273 275 - basep = (unsigned long *)get_property(node, "linux,tce-base", NULL); 276 - sizep = (unsigned int *)get_property(node, "linux,tce-size", NULL); 274 + basep = get_property(node, "linux,tce-base", NULL); 275 + sizep = get_property(node, "linux,tce-size", NULL); 277 276 if (basep == NULL || sizep == NULL) { 278 277 printk(KERN_ERR "PCI_DMA: iommu_table_setparms: %s has " 279 278 "missing tce entries !\n", dn->full_name); ··· 314 315 static void iommu_table_setparms_lpar(struct pci_controller *phb, 315 316 struct device_node *dn, 316 317 struct iommu_table *tbl, 317 - unsigned char *dma_window) 318 + const void *dma_window) 318 319 { 319 320 unsigned long offset, size; 320 321 ··· 414 415 struct iommu_table *tbl; 415 416 struct device_node *dn, *pdn; 416 417 struct pci_dn *ppci; 417 - unsigned char *dma_window = NULL; 418 + const void *dma_window = NULL; 418 419 419 420 DBG("iommu_bus_setup_pSeriesLP, bus %p, bus->self %p\n", bus, bus->self); 420 421 ··· 518 519 { 519 520 struct device_node *pdn, *dn; 520 521 struct iommu_table *tbl; 521 - unsigned char *dma_window = NULL; 522 + const void *dma_window = NULL; 522 523 struct pci_dn *pci; 523 524 524 525 DBG("iommu_dev_setup_pSeriesLP, dev %p (%s)\n", dev, pci_name(dev));
+29 -17
arch/powerpc/platforms/pseries/lpar.c
··· 48 48 #define DBG_LOW(fmt...) do { } while(0) 49 49 #endif 50 50 51 - /* in pSeries_hvCall.S */ 51 + /* in hvCall.S */ 52 52 EXPORT_SYMBOL(plpar_hcall); 53 - EXPORT_SYMBOL(plpar_hcall_4out); 53 + EXPORT_SYMBOL(plpar_hcall9); 54 54 EXPORT_SYMBOL(plpar_hcall_norets); 55 - EXPORT_SYMBOL(plpar_hcall_8arg_2ret); 56 - EXPORT_SYMBOL(plpar_hcall_7arg_7ret); 57 - EXPORT_SYMBOL(plpar_hcall_9arg_9ret); 55 + 58 56 extern void pSeries_find_serial_port(void); 59 57 60 58 ··· 202 204 void __init find_udbg_vterm(void) 203 205 { 204 206 struct device_node *stdout_node; 205 - u32 *termno; 206 - char *name; 207 + const u32 *termno; 208 + const char *name; 207 209 int add_console; 208 210 209 211 /* find the boot console from /chosen/stdout */ 210 212 if (!of_chosen) 211 213 return; 212 - name = (char *)get_property(of_chosen, "linux,stdout-path", NULL); 214 + name = get_property(of_chosen, "linux,stdout-path", NULL); 213 215 if (name == NULL) 214 216 return; 215 217 stdout_node = of_find_node_by_path(name); 216 218 if (!stdout_node) 217 219 return; 218 - name = (char *)get_property(stdout_node, "name", NULL); 220 + name = get_property(stdout_node, "name", NULL); 219 221 if (!name) { 220 222 printk(KERN_WARNING "stdout node missing 'name' property!\n"); 221 223 goto out; ··· 226 228 /* Check if it's a virtual terminal */ 227 229 if (strncmp(name, "vty", 3) != 0) 228 230 goto out; 229 - termno = (u32 *)get_property(stdout_node, "reg", NULL); 231 + termno = get_property(stdout_node, "reg", NULL); 230 232 if (termno == NULL) 231 233 goto out; 232 234 vtermno = termno[0]; ··· 252 254 void vpa_init(int cpu) 253 255 { 254 256 int hwcpu = get_hard_smp_processor_id(cpu); 255 - unsigned long vpa = __pa(&lppaca[cpu]); 257 + unsigned long addr; 256 258 long ret; 257 259 258 260 if (cpu_has_feature(CPU_FTR_ALTIVEC)) 259 261 lppaca[cpu].vmxregs_in_use = 1; 260 262 261 - ret = register_vpa(hwcpu, vpa); 263 + addr = __pa(&lppaca[cpu]); 264 + ret = register_vpa(hwcpu, addr); 262 265 263 - if (ret) 266 + if (ret) { 264 267 printk(KERN_ERR "WARNING: vpa_init: VPA registration for " 265 268 "cpu %d (hw %d) of area %lx returns %ld\n", 266 - cpu, hwcpu, vpa, ret); 269 + cpu, hwcpu, addr, ret); 270 + return; 271 + } 272 + /* 273 + * PAPR says this feature is SLB-Buffer but firmware never 274 + * reports that. All SPLPAR support SLB shadow buffer. 275 + */ 276 + addr = __pa(&slb_shadow[cpu]); 277 + if (firmware_has_feature(FW_FEATURE_SPLPAR)) { 278 + ret = register_slb_shadow(hwcpu, addr); 279 + if (ret) 280 + printk(KERN_ERR 281 + "WARNING: vpa_init: SLB shadow buffer " 282 + "registration for cpu %d (hw %d) of area %lx " 283 + "returns %ld\n", cpu, hwcpu, addr, ret); 284 + } 267 285 } 268 286 269 287 long pSeries_lpar_hpte_insert(unsigned long hpte_group, ··· 291 277 unsigned long flags; 292 278 unsigned long slot; 293 279 unsigned long hpte_v, hpte_r; 294 - unsigned long dummy0, dummy1; 295 280 296 281 if (!(vflags & HPTE_V_BOLTED)) 297 282 DBG_LOW("hpte_insert(group=%lx, va=%016lx, pa=%016lx, " ··· 315 302 if (rflags & (_PAGE_GUARDED|_PAGE_NO_CACHE)) 316 303 hpte_r &= ~_PAGE_COHERENT; 317 304 318 - lpar_rc = plpar_hcall(H_ENTER, flags, hpte_group, hpte_v, 319 - hpte_r, &slot, &dummy0, &dummy1); 305 + lpar_rc = plpar_pte_enter(flags, hpte_group, hpte_v, hpte_r, &slot); 320 306 if (unlikely(lpar_rc == H_PTEG_FULL)) { 321 307 if (!(vflags & HPTE_V_BOLTED)) 322 308 DBG_LOW(" full\n");
+3 -2
arch/powerpc/platforms/pseries/nvram.c
··· 123 123 int __init pSeries_nvram_init(void) 124 124 { 125 125 struct device_node *nvram; 126 - unsigned int *nbytes_p, proplen; 126 + const unsigned int *nbytes_p; 127 + unsigned int proplen; 127 128 128 129 nvram = of_find_node_by_type(NULL, "nvram"); 129 130 if (nvram == NULL) 130 131 return -ENODEV; 131 132 132 - nbytes_p = (unsigned int *)get_property(nvram, "#bytes", &proplen); 133 + nbytes_p = get_property(nvram, "#bytes", &proplen); 133 134 if (nbytes_p == NULL || proplen != sizeof(unsigned int)) 134 135 return -EIO; 135 136
+1 -1
arch/powerpc/platforms/pseries/pci.c
··· 60 60 static void __devinit check_s7a(void) 61 61 { 62 62 struct device_node *root; 63 - char *model; 63 + const char *model; 64 64 65 65 s7a_workaround = 0; 66 66 root = of_find_node_by_path("/");
+90 -17
arch/powerpc/platforms/pseries/plpar_wrappers.h
··· 5 5 6 6 static inline long poll_pending(void) 7 7 { 8 - unsigned long dummy; 9 - return plpar_hcall(H_POLL_PENDING, 0, 0, 0, 0, &dummy, &dummy, &dummy); 8 + return plpar_hcall_norets(H_POLL_PENDING); 10 9 } 11 10 12 11 static inline long prod_processor(void) 13 12 { 14 - plpar_hcall_norets(H_PROD); 15 - return 0; 13 + return plpar_hcall_norets(H_PROD); 16 14 } 17 15 18 16 static inline long cede_processor(void) 19 17 { 20 - plpar_hcall_norets(H_CEDE); 21 - return 0; 18 + return plpar_hcall_norets(H_CEDE); 22 19 } 23 20 24 21 static inline long vpa_call(unsigned long flags, unsigned long cpu, ··· 37 40 return vpa_call(0x1, cpu, vpa); 38 41 } 39 42 43 + static inline long unregister_slb_shadow(unsigned long cpu, unsigned long vpa) 44 + { 45 + return vpa_call(0x7, cpu, vpa); 46 + } 47 + 48 + static inline long register_slb_shadow(unsigned long cpu, unsigned long vpa) 49 + { 50 + return vpa_call(0x3, cpu, vpa); 51 + } 52 + 40 53 extern void vpa_init(int cpu); 54 + 55 + static inline long plpar_pte_enter(unsigned long flags, 56 + unsigned long hpte_group, unsigned long hpte_v, 57 + unsigned long hpte_r, unsigned long *slot) 58 + { 59 + long rc; 60 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 61 + 62 + rc = plpar_hcall(H_ENTER, retbuf, flags, hpte_group, hpte_v, hpte_r); 63 + 64 + *slot = retbuf[0]; 65 + 66 + return rc; 67 + } 41 68 42 69 static inline long plpar_pte_remove(unsigned long flags, unsigned long ptex, 43 70 unsigned long avpn, unsigned long *old_pteh_ret, 44 71 unsigned long *old_ptel_ret) 45 72 { 46 - unsigned long dummy; 47 - return plpar_hcall(H_REMOVE, flags, ptex, avpn, 0, old_pteh_ret, 48 - old_ptel_ret, &dummy); 73 + long rc; 74 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 75 + 76 + rc = plpar_hcall(H_REMOVE, retbuf, flags, ptex, avpn); 77 + 78 + *old_pteh_ret = retbuf[0]; 79 + *old_ptel_ret = retbuf[1]; 80 + 81 + return rc; 49 82 } 50 83 51 84 static inline long plpar_pte_read(unsigned long flags, unsigned long ptex, 52 85 unsigned long *old_pteh_ret, unsigned long *old_ptel_ret) 53 86 { 54 - unsigned long dummy; 55 - return plpar_hcall(H_READ, flags, ptex, 0, 0, old_pteh_ret, 56 - old_ptel_ret, &dummy); 87 + long rc; 88 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 89 + 90 + rc = plpar_hcall(H_READ, retbuf, flags, ptex); 91 + 92 + *old_pteh_ret = retbuf[0]; 93 + *old_ptel_ret = retbuf[1]; 94 + 95 + return rc; 57 96 } 58 97 59 98 static inline long plpar_pte_protect(unsigned long flags, unsigned long ptex, ··· 101 68 static inline long plpar_tce_get(unsigned long liobn, unsigned long ioba, 102 69 unsigned long *tce_ret) 103 70 { 104 - unsigned long dummy; 105 - return plpar_hcall(H_GET_TCE, liobn, ioba, 0, 0, tce_ret, &dummy, 106 - &dummy); 71 + long rc; 72 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 73 + 74 + rc = plpar_hcall(H_GET_TCE, retbuf, liobn, ioba); 75 + 76 + *tce_ret = retbuf[0]; 77 + 78 + return rc; 107 79 } 108 80 109 81 static inline long plpar_tce_put(unsigned long liobn, unsigned long ioba, ··· 132 94 static inline long plpar_get_term_char(unsigned long termno, 133 95 unsigned long *len_ret, char *buf_ret) 134 96 { 97 + long rc; 98 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 135 99 unsigned long *lbuf = (unsigned long *)buf_ret; /* TODO: alignment? */ 136 - return plpar_hcall(H_GET_TERM_CHAR, termno, 0, 0, 0, len_ret, 137 - lbuf + 0, lbuf + 1); 100 + 101 + rc = plpar_hcall(H_GET_TERM_CHAR, retbuf, termno); 102 + 103 + *len_ret = retbuf[0]; 104 + lbuf[0] = retbuf[1]; 105 + lbuf[1] = retbuf[2]; 106 + 107 + return rc; 138 108 } 139 109 140 110 static inline long plpar_put_term_char(unsigned long termno, unsigned long len, ··· 151 105 unsigned long *lbuf = (unsigned long *)buffer; /* TODO: alignment? */ 152 106 return plpar_hcall_norets(H_PUT_TERM_CHAR, termno, len, lbuf[0], 153 107 lbuf[1]); 108 + } 109 + 110 + static inline long plpar_eoi(unsigned long xirr) 111 + { 112 + return plpar_hcall_norets(H_EOI, xirr); 113 + } 114 + 115 + static inline long plpar_cppr(unsigned long cppr) 116 + { 117 + return plpar_hcall_norets(H_CPPR, cppr); 118 + } 119 + 120 + static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr) 121 + { 122 + return plpar_hcall_norets(H_IPI, servernum, mfrr); 123 + } 124 + 125 + static inline long plpar_xirr(unsigned long *xirr_ret) 126 + { 127 + long rc; 128 + unsigned long retbuf[PLPAR_HCALL_BUFSIZE]; 129 + 130 + rc = plpar_hcall(H_XIRR, retbuf); 131 + 132 + *xirr_ret = retbuf[0]; 133 + 134 + return rc; 154 135 } 155 136 156 137 #endif /* _PSERIES_PLPAR_WRAPPERS_H */
+2 -2
arch/powerpc/platforms/pseries/ras.c
··· 79 79 { 80 80 int i, index, count = 0; 81 81 struct of_irq oirq; 82 - u32 *opicprop; 82 + const u32 *opicprop; 83 83 unsigned int opicplen; 84 84 unsigned int virqs[16]; 85 85 ··· 87 87 * map those interrupts using the default interrupt host and default 88 88 * trigger 89 89 */ 90 - opicprop = (u32 *)get_property(np, "open-pic-interrupt", &opicplen); 90 + opicprop = get_property(np, "open-pic-interrupt", &opicplen); 91 91 if (opicprop) { 92 92 opicplen /= sizeof(u32); 93 93 for (i = 0; i < opicplen; i++) {
+2 -2
arch/powerpc/platforms/pseries/rtasd.c
··· 359 359 static int get_eventscan_parms(void) 360 360 { 361 361 struct device_node *node; 362 - int *ip; 362 + const int *ip; 363 363 364 364 node = of_find_node_by_path("/rtas"); 365 365 366 - ip = (int *)get_property(node, "rtas-event-scan-rate", NULL); 366 + ip = get_property(node, "rtas-event-scan-rate", NULL); 367 367 if (ip == NULL) { 368 368 printk(KERN_ERR "rtasd: no rtas-event-scan-rate\n"); 369 369 of_node_put(node);
+28 -14
arch/powerpc/platforms/pseries/setup.c
··· 133 133 static void __init pseries_mpic_init_IRQ(void) 134 134 { 135 135 struct device_node *np, *old, *cascade = NULL; 136 - unsigned int *addrp; 136 + const unsigned int *addrp; 137 137 unsigned long intack = 0; 138 - unsigned int *opprop; 138 + const unsigned int *opprop; 139 139 unsigned long openpic_addr = 0; 140 140 unsigned int cascade_irq; 141 141 int naddr, n, i, opplen; ··· 143 143 144 144 np = of_find_node_by_path("/"); 145 145 naddr = prom_n_addr_cells(np); 146 - opprop = (unsigned int *) get_property(np, "platform-open-pic", &opplen); 146 + opprop = get_property(np, "platform-open-pic", &opplen); 147 147 if (opprop != 0) { 148 148 openpic_addr = of_read_number(opprop, naddr); 149 149 printk(KERN_DEBUG "OpenPIC addr: %lx\n", openpic_addr); ··· 192 192 break; 193 193 if (strcmp(np->name, "pci") != 0) 194 194 continue; 195 - addrp = (u32 *)get_property(np, "8259-interrupt-acknowledge", 195 + addrp = get_property(np, "8259-interrupt-acknowledge", 196 196 NULL); 197 197 if (addrp == NULL) 198 198 continue; ··· 223 223 } 224 224 225 225 #ifdef CONFIG_KEXEC 226 - static void pseries_kexec_cpu_down_mpic(int crash_shutdown, int secondary) 227 - { 228 - mpic_teardown_this_cpu(secondary); 229 - } 230 - 231 - static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary) 226 + static void pseries_kexec_cpu_down(int crash_shutdown, int secondary) 232 227 { 233 228 /* Don't risk a hypervisor call if we're crashing */ 234 229 if (firmware_has_feature(FW_FEATURE_SPLPAR) && !crash_shutdown) { 235 - unsigned long vpa = __pa(get_lppaca()); 230 + unsigned long addr; 236 231 237 - if (unregister_vpa(hard_smp_processor_id(), vpa)) { 232 + addr = __pa(get_slb_shadow()); 233 + if (unregister_slb_shadow(hard_smp_processor_id(), addr)) 234 + printk("SLB shadow buffer deregistration of " 235 + "cpu %u (hw_cpu_id %d) failed\n", 236 + smp_processor_id(), 237 + hard_smp_processor_id()); 238 + 239 + addr = __pa(get_lppaca()); 240 + if (unregister_vpa(hard_smp_processor_id(), addr)) { 238 241 printk("VPA deregistration of cpu %u (hw_cpu_id %d) " 239 242 "failed\n", smp_processor_id(), 240 243 hard_smp_processor_id()); 241 244 } 242 245 } 246 + } 247 + 248 + static void pseries_kexec_cpu_down_mpic(int crash_shutdown, int secondary) 249 + { 250 + pseries_kexec_cpu_down(crash_shutdown, secondary); 251 + mpic_teardown_this_cpu(secondary); 252 + } 253 + 254 + static void pseries_kexec_cpu_down_xics(int crash_shutdown, int secondary) 255 + { 256 + pseries_kexec_cpu_down(crash_shutdown, secondary); 243 257 xics_teardown_cpu(secondary); 244 258 } 245 259 #endif /* CONFIG_KEXEC */ ··· 261 247 static void __init pseries_discover_pic(void) 262 248 { 263 249 struct device_node *np; 264 - char *typep; 250 + const char *typep; 265 251 266 252 for (np = NULL; (np = of_find_node_by_name(np, 267 253 "interrupt-controller"));) { 268 - typep = (char *)get_property(np, "compatible", NULL); 254 + typep = get_property(np, "compatible", NULL); 269 255 if (strstr(typep, "open-pic")) { 270 256 pSeries_mpic_node = of_node_get(np); 271 257 ppc_md.init_IRQ = pseries_mpic_init_IRQ;
+6 -6
arch/powerpc/platforms/pseries/smp.c
··· 62 62 */ 63 63 static cpumask_t of_spin_map; 64 64 65 - extern void pSeries_secondary_smp_init(unsigned long); 65 + extern void generic_secondary_smp_init(unsigned long); 66 66 67 67 #ifdef CONFIG_HOTPLUG_CPU 68 68 ··· 145 145 unsigned int cpu; 146 146 cpumask_t candidate_map, tmp = CPU_MASK_NONE; 147 147 int err = -ENOSPC, len, nthreads, i; 148 - u32 *intserv; 148 + const u32 *intserv; 149 149 150 - intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", &len); 150 + intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); 151 151 if (!intserv) 152 152 return 0; 153 153 ··· 205 205 { 206 206 unsigned int cpu; 207 207 int len, nthreads, i; 208 - u32 *intserv; 208 + const u32 *intserv; 209 209 210 - intserv = (u32 *)get_property(np, "ibm,ppc-interrupt-server#s", &len); 210 + intserv = get_property(np, "ibm,ppc-interrupt-server#s", &len); 211 211 if (!intserv) 212 212 return; 213 213 ··· 270 270 { 271 271 int status; 272 272 unsigned long start_here = __pa((u32)*((unsigned long *) 273 - pSeries_secondary_smp_init)); 273 + generic_secondary_smp_init)); 274 274 unsigned int pcpu; 275 275 int start_cpu; 276 276
+12 -32
arch/powerpc/platforms/pseries/xics.c
··· 34 34 #include <asm/i8259.h> 35 35 36 36 #include "xics.h" 37 + #include "plpar_wrappers.h" 37 38 38 39 #define XICS_IPI 2 39 40 #define XICS_IRQ_SPURIOUS 0 ··· 110 109 111 110 /* LPAR low level accessors */ 112 111 113 - 114 - static inline long plpar_eoi(unsigned long xirr) 115 - { 116 - return plpar_hcall_norets(H_EOI, xirr); 117 - } 118 - 119 - static inline long plpar_cppr(unsigned long cppr) 120 - { 121 - return plpar_hcall_norets(H_CPPR, cppr); 122 - } 123 - 124 - static inline long plpar_ipi(unsigned long servernum, unsigned long mfrr) 125 - { 126 - return plpar_hcall_norets(H_IPI, servernum, mfrr); 127 - } 128 - 129 - static inline long plpar_xirr(unsigned long *xirr_ret) 130 - { 131 - unsigned long dummy; 132 - return plpar_hcall(H_XIRR, 0, 0, 0, 0, xirr_ret, &dummy, &dummy); 133 - } 134 112 135 113 static inline unsigned int lpar_xirr_info_get(int n_cpu) 136 114 { ··· 570 590 unsigned int *indx) 571 591 { 572 592 unsigned int ilen; 573 - u32 *ireg; 593 + const u32 *ireg; 574 594 575 595 /* This code does the theorically broken assumption that the interrupt 576 596 * server numbers are the same as the hard CPU numbers. 577 597 * This happens to be the case so far but we are playing with fire... 578 598 * should be fixed one of these days. -BenH. 579 599 */ 580 - ireg = (u32 *)get_property(np, "ibm,interrupt-server-ranges", NULL); 600 + ireg = get_property(np, "ibm,interrupt-server-ranges", NULL); 581 601 582 602 /* Do that ever happen ? we'll know soon enough... but even good'old 583 603 * f80 does have that property .. ··· 589 609 */ 590 610 *indx = *ireg; 591 611 } 592 - ireg = (u32 *)get_property(np, "reg", &ilen); 612 + ireg = get_property(np, "reg", &ilen); 593 613 if (!ireg) 594 614 panic("xics_init_IRQ: can't find interrupt reg property"); 595 615 ··· 615 635 { 616 636 struct device_node *np, *old, *found = NULL; 617 637 int cascade, naddr; 618 - u32 *addrp; 638 + const u32 *addrp; 619 639 unsigned long intack = 0; 620 640 621 641 for_each_node_by_type(np, "interrupt-controller") ··· 641 661 break; 642 662 if (strcmp(np->name, "pci") != 0) 643 663 continue; 644 - addrp = (u32 *)get_property(np, "8259-interrupt-acknowledge", NULL); 664 + addrp = get_property(np, "8259-interrupt-acknowledge", NULL); 645 665 if (addrp == NULL) 646 666 continue; 647 667 naddr = prom_n_addr_cells(np); ··· 660 680 { 661 681 int i; 662 682 struct device_node *np; 663 - u32 *ireg, ilen, indx = 0; 683 + u32 ilen, indx = 0; 684 + const u32 *ireg; 664 685 int found = 0; 665 686 666 687 ppc64_boot_msg(0x20, "XICS Init"); ··· 686 705 for (np = of_find_node_by_type(NULL, "cpu"); 687 706 np; 688 707 np = of_find_node_by_type(np, "cpu")) { 689 - ireg = (u32 *)get_property(np, "reg", &ilen); 708 + ireg = get_property(np, "reg", &ilen); 690 709 if (ireg && ireg[0] == get_hard_smp_processor_id(boot_cpuid)) { 691 - ireg = (u32 *)get_property(np, 692 - "ibm,ppc-interrupt-gserver#s", 693 - &ilen); 710 + ireg = get_property(np, 711 + "ibm,ppc-interrupt-gserver#s", &ilen); 694 712 i = ilen / sizeof(int); 695 713 if (ireg && i > 0) { 696 714 default_server = ireg[0]; 697 715 /* take last element */ 698 716 default_distrib_server = ireg[i-1]; 699 717 } 700 - ireg = (u32 *)get_property(np, 718 + ireg = get_property(np, 701 719 "ibm,interrupt-server#-size", NULL); 702 720 if (ireg) 703 721 interrupt_server_size = *ireg;
+14 -14
arch/powerpc/sysdev/fsl_soc.c
··· 41 41 soc = of_find_node_by_type(NULL, "soc"); 42 42 if (soc) { 43 43 unsigned int size; 44 - void *prop = get_property(soc, "reg", &size); 44 + const void *prop = get_property(soc, "reg", &size); 45 45 immrbase = of_translate_address(soc, prop); 46 46 of_node_put(soc); 47 47 }; ··· 85 85 mdio_data.irq[k] = -1; 86 86 87 87 while ((child = of_get_next_child(np, child)) != NULL) { 88 - u32 *id = get_property(child, "reg", NULL); 88 + const u32 *id = get_property(child, "reg", NULL); 89 89 mdio_data.irq[*id] = irq_of_parse_and_map(child, 0); 90 90 } 91 91 ··· 124 124 struct resource r[4]; 125 125 struct device_node *phy, *mdio; 126 126 struct gianfar_platform_data gfar_data; 127 - unsigned int *id; 128 - char *model; 129 - void *mac_addr; 130 - phandle *ph; 127 + const unsigned int *id; 128 + const char *model; 129 + const void *mac_addr; 130 + const phandle *ph; 131 131 int n_res = 1; 132 132 133 133 memset(r, 0, sizeof(r)); ··· 193 193 FSL_GIANFAR_DEV_HAS_VLAN | 194 194 FSL_GIANFAR_DEV_HAS_EXTENDED_HASH; 195 195 196 - ph = (phandle *) get_property(np, "phy-handle", NULL); 196 + ph = get_property(np, "phy-handle", NULL); 197 197 phy = of_find_node_by_phandle(*ph); 198 198 199 199 if (phy == NULL) { ··· 203 203 204 204 mdio = of_get_parent(phy); 205 205 206 - id = (u32 *) get_property(phy, "reg", NULL); 206 + id = get_property(phy, "reg", NULL); 207 207 ret = of_address_to_resource(mdio, 0, &res); 208 208 if (ret) { 209 209 of_node_put(phy); ··· 247 247 i++) { 248 248 struct resource r[2]; 249 249 struct fsl_i2c_platform_data i2c_data; 250 - unsigned char *flags = NULL; 250 + const unsigned char *flags = NULL; 251 251 252 252 memset(&r, 0, sizeof(r)); 253 253 memset(&i2c_data, 0, sizeof(i2c_data)); ··· 298 298 struct resource r; 299 299 struct device_node *soc, *np; 300 300 struct platform_device *dev; 301 - unsigned int *freq; 301 + const unsigned int *freq; 302 302 int ret; 303 303 304 304 np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt"); ··· 315 315 goto nosoc; 316 316 } 317 317 318 - freq = (unsigned int *)get_property(soc, "bus-frequency", NULL); 318 + freq = get_property(soc, "bus-frequency", NULL); 319 319 if (!freq) { 320 320 ret = -ENODEV; 321 321 goto err; ··· 355 355 arch_initcall(mpc83xx_wdt_init); 356 356 #endif 357 357 358 - static enum fsl_usb2_phy_modes determine_usb_phy(char * phy_type) 358 + static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type) 359 359 { 360 360 if (!phy_type) 361 361 return FSL_USB2_PHY_NONE; ··· 383 383 i++) { 384 384 struct resource r[2]; 385 385 struct fsl_usb2_platform_data usb_data; 386 - unsigned char *prop = NULL; 386 + const unsigned char *prop = NULL; 387 387 388 388 memset(&r, 0, sizeof(r)); 389 389 memset(&usb_data, 0, sizeof(usb_data)); ··· 431 431 i++) { 432 432 struct resource r[2]; 433 433 struct fsl_usb2_platform_data usb_data; 434 - unsigned char *prop = NULL; 434 + const unsigned char *prop = NULL; 435 435 436 436 memset(&r, 0, sizeof(r)); 437 437 memset(&usb_data, 0, sizeof(usb_data));
+2
arch/powerpc/sysdev/fsl_soc.h
··· 2 2 #define __PPC_FSL_SOC_H 3 3 #ifdef __KERNEL__ 4 4 5 + #include <asm/mmu.h> 6 + 5 7 extern phys_addr_t get_immrbase(void); 6 8 7 9 #endif
+1 -1
arch/powerpc/sysdev/i8259.c
··· 224 224 .xlate = i8259_host_xlate, 225 225 }; 226 226 227 - /**** 227 + /** 228 228 * i8259_init - Initialize the legacy controller 229 229 * @node: device node of the legacy PIC (can be NULL, but then, it will match 230 230 * all interrupts, so beware)
+21 -21
arch/powerpc/sysdev/ipic.c
··· 210 210 .prio_mask = 4, 211 211 }, 212 212 [64] = { 213 - .pend = IPIC_SIPNR_H, 213 + .pend = IPIC_SIPNR_L, 214 214 .mask = IPIC_SIMSR_L, 215 215 .prio = IPIC_SMPRR_A, 216 216 .force = IPIC_SIFCR_L, ··· 218 218 .prio_mask = 0, 219 219 }, 220 220 [65] = { 221 - .pend = IPIC_SIPNR_H, 221 + .pend = IPIC_SIPNR_L, 222 222 .mask = IPIC_SIMSR_L, 223 223 .prio = IPIC_SMPRR_A, 224 224 .force = IPIC_SIFCR_L, ··· 226 226 .prio_mask = 1, 227 227 }, 228 228 [66] = { 229 - .pend = IPIC_SIPNR_H, 229 + .pend = IPIC_SIPNR_L, 230 230 .mask = IPIC_SIMSR_L, 231 231 .prio = IPIC_SMPRR_A, 232 232 .force = IPIC_SIFCR_L, ··· 234 234 .prio_mask = 2, 235 235 }, 236 236 [67] = { 237 - .pend = IPIC_SIPNR_H, 237 + .pend = IPIC_SIPNR_L, 238 238 .mask = IPIC_SIMSR_L, 239 239 .prio = IPIC_SMPRR_A, 240 240 .force = IPIC_SIFCR_L, ··· 242 242 .prio_mask = 3, 243 243 }, 244 244 [68] = { 245 - .pend = IPIC_SIPNR_H, 245 + .pend = IPIC_SIPNR_L, 246 246 .mask = IPIC_SIMSR_L, 247 247 .prio = IPIC_SMPRR_B, 248 248 .force = IPIC_SIFCR_L, ··· 250 250 .prio_mask = 0, 251 251 }, 252 252 [69] = { 253 - .pend = IPIC_SIPNR_H, 253 + .pend = IPIC_SIPNR_L, 254 254 .mask = IPIC_SIMSR_L, 255 255 .prio = IPIC_SMPRR_B, 256 256 .force = IPIC_SIFCR_L, ··· 258 258 .prio_mask = 1, 259 259 }, 260 260 [70] = { 261 - .pend = IPIC_SIPNR_H, 261 + .pend = IPIC_SIPNR_L, 262 262 .mask = IPIC_SIMSR_L, 263 263 .prio = IPIC_SMPRR_B, 264 264 .force = IPIC_SIFCR_L, ··· 266 266 .prio_mask = 2, 267 267 }, 268 268 [71] = { 269 - .pend = IPIC_SIPNR_H, 269 + .pend = IPIC_SIPNR_L, 270 270 .mask = IPIC_SIMSR_L, 271 271 .prio = IPIC_SMPRR_B, 272 272 .force = IPIC_SIFCR_L, ··· 274 274 .prio_mask = 3, 275 275 }, 276 276 [72] = { 277 - .pend = IPIC_SIPNR_H, 277 + .pend = IPIC_SIPNR_L, 278 278 .mask = IPIC_SIMSR_L, 279 279 .prio = 0, 280 280 .force = IPIC_SIFCR_L, 281 281 .bit = 8, 282 282 }, 283 283 [73] = { 284 - .pend = IPIC_SIPNR_H, 284 + .pend = IPIC_SIPNR_L, 285 285 .mask = IPIC_SIMSR_L, 286 286 .prio = 0, 287 287 .force = IPIC_SIFCR_L, 288 288 .bit = 9, 289 289 }, 290 290 [74] = { 291 - .pend = IPIC_SIPNR_H, 291 + .pend = IPIC_SIPNR_L, 292 292 .mask = IPIC_SIMSR_L, 293 293 .prio = 0, 294 294 .force = IPIC_SIFCR_L, 295 295 .bit = 10, 296 296 }, 297 297 [75] = { 298 - .pend = IPIC_SIPNR_H, 298 + .pend = IPIC_SIPNR_L, 299 299 .mask = IPIC_SIMSR_L, 300 300 .prio = 0, 301 301 .force = IPIC_SIFCR_L, 302 302 .bit = 11, 303 303 }, 304 304 [76] = { 305 - .pend = IPIC_SIPNR_H, 305 + .pend = IPIC_SIPNR_L, 306 306 .mask = IPIC_SIMSR_L, 307 307 .prio = 0, 308 308 .force = IPIC_SIFCR_L, 309 309 .bit = 12, 310 310 }, 311 311 [77] = { 312 - .pend = IPIC_SIPNR_H, 312 + .pend = IPIC_SIPNR_L, 313 313 .mask = IPIC_SIMSR_L, 314 314 .prio = 0, 315 315 .force = IPIC_SIFCR_L, 316 316 .bit = 13, 317 317 }, 318 318 [78] = { 319 - .pend = IPIC_SIPNR_H, 319 + .pend = IPIC_SIPNR_L, 320 320 .mask = IPIC_SIMSR_L, 321 321 .prio = 0, 322 322 .force = IPIC_SIFCR_L, 323 323 .bit = 14, 324 324 }, 325 325 [79] = { 326 - .pend = IPIC_SIPNR_H, 326 + .pend = IPIC_SIPNR_L, 327 327 .mask = IPIC_SIMSR_L, 328 328 .prio = 0, 329 329 .force = IPIC_SIFCR_L, 330 330 .bit = 15, 331 331 }, 332 332 [80] = { 333 - .pend = IPIC_SIPNR_H, 333 + .pend = IPIC_SIPNR_L, 334 334 .mask = IPIC_SIMSR_L, 335 335 .prio = 0, 336 336 .force = IPIC_SIFCR_L, 337 337 .bit = 16, 338 338 }, 339 339 [84] = { 340 - .pend = IPIC_SIPNR_H, 340 + .pend = IPIC_SIPNR_L, 341 341 .mask = IPIC_SIMSR_L, 342 342 .prio = 0, 343 343 .force = IPIC_SIFCR_L, 344 344 .bit = 20, 345 345 }, 346 346 [85] = { 347 - .pend = IPIC_SIPNR_H, 347 + .pend = IPIC_SIPNR_L, 348 348 .mask = IPIC_SIMSR_L, 349 349 .prio = 0, 350 350 .force = IPIC_SIFCR_L, 351 351 .bit = 21, 352 352 }, 353 353 [90] = { 354 - .pend = IPIC_SIPNR_H, 354 + .pend = IPIC_SIPNR_L, 355 355 .mask = IPIC_SIMSR_L, 356 356 .prio = 0, 357 357 .force = IPIC_SIFCR_L, 358 358 .bit = 26, 359 359 }, 360 360 [91] = { 361 - .pend = IPIC_SIPNR_H, 361 + .pend = IPIC_SIPNR_L, 362 362 .mask = IPIC_SIMSR_L, 363 363 .prio = 0, 364 364 .force = IPIC_SIFCR_L,
+2 -2
arch/powerpc/sysdev/mmio_nvram.c
··· 80 80 int __init mmio_nvram_init(void) 81 81 { 82 82 struct device_node *nvram_node; 83 - unsigned long *buffer; 83 + const unsigned long *buffer; 84 84 int proplen; 85 85 unsigned long nvram_addr; 86 86 int ret; ··· 91 91 goto out; 92 92 93 93 ret = -EIO; 94 - buffer = (unsigned long *)get_property(nvram_node, "reg", &proplen); 94 + buffer = get_property(nvram_node, "reg", &proplen); 95 95 if (proplen != 2*sizeof(unsigned long)) 96 96 goto out; 97 97
+2 -2
arch/powerpc/sysdev/tsi108_pci.c
··· 194 194 int len; 195 195 struct pci_controller *hose; 196 196 struct resource rsrc; 197 - int *bus_range; 197 + const int *bus_range; 198 198 int primary = 0, has_address = 0; 199 199 200 200 /* PCI Config mapping */ ··· 207 207 has_address = (of_address_to_resource(dev, 0, &rsrc) == 0); 208 208 209 209 /* Get bus range if any */ 210 - bus_range = (int *)get_property(dev, "bus-range", &len); 210 + bus_range = get_property(dev, "bus-range", &len); 211 211 if (bus_range == NULL || len < 2 * sizeof(int)) { 212 212 printk(KERN_WARNING "Can't get bus-range for %s, assume" 213 213 " bus 0\n", dev->full_name);
+10
arch/powerpc/xmon/xmon.c
··· 137 137 static void proccall(void); 138 138 void dump_segments(void); 139 139 static void symbol_lookup(void); 140 + static void xmon_show_stack(unsigned long sp, unsigned long lr, 141 + unsigned long pc); 140 142 static void xmon_print_symbol(unsigned long address, const char *mid, 141 143 const char *after); 142 144 static const char *getvecname(unsigned long vec); 145 + 146 + int xmon_no_auto_backtrace; 143 147 144 148 extern int print_insn_powerpc(unsigned long, unsigned long, int); 145 149 ··· 740 736 741 737 last_cmd = NULL; 742 738 xmon_regs = excp; 739 + 740 + if (!xmon_no_auto_backtrace) { 741 + xmon_no_auto_backtrace = 1; 742 + xmon_show_stack(excp->gpr[1], excp->link, excp->nip); 743 + } 744 + 743 745 for(;;) { 744 746 #ifdef CONFIG_SMP 745 747 printf("%x:", smp_processor_id());
+3 -3
arch/ppc/Kconfig
··· 1204 1204 default PCI 1205 1205 1206 1206 config MPC83xx_PCI2 1207 - bool " Supprt for 2nd PCI host controller" 1207 + bool "Support for 2nd PCI host controller" 1208 1208 depends on PCI && MPC834x 1209 1209 default y if MPC834x_SYS 1210 1210 ··· 1223 1223 default y 1224 1224 1225 1225 config 8260_PCI9 1226 - bool " Enable workaround for MPC826x erratum PCI 9" 1226 + bool "Enable workaround for MPC826x erratum PCI 9" 1227 1227 depends on PCI_8260 && !ADS8272 1228 1228 default y 1229 1229 1230 1230 choice 1231 - prompt " IDMA channel for PCI 9 workaround" 1231 + prompt "IDMA channel for PCI 9 workaround" 1232 1232 depends on 8260_PCI9 1233 1233 1234 1234 config 8260_PCI9_IDMA1
-88
arch/ppc/kernel/misc.S
··· 768 768 bdnz 00b 769 769 blr 770 770 771 - _GLOBAL(_insw) 772 - cmpwi 0,r5,0 773 - mtctr r5 774 - subi r4,r4,2 775 - blelr- 776 - 00: lhbrx r5,0,r3 777 - 01: eieio 778 - 02: sthu r5,2(r4) 779 - ISYNC_8xx 780 - .section .fixup,"ax" 781 - 03: blr 782 - .text 783 - .section __ex_table, "a" 784 - .align 2 785 - .long 00b, 03b 786 - .long 01b, 03b 787 - .long 02b, 03b 788 - .text 789 - bdnz 00b 790 - blr 791 - 792 - _GLOBAL(_outsw) 793 - cmpwi 0,r5,0 794 - mtctr r5 795 - subi r4,r4,2 796 - blelr- 797 - 00: lhzu r5,2(r4) 798 - 01: eieio 799 - 02: sthbrx r5,0,r3 800 - ISYNC_8xx 801 - .section .fixup,"ax" 802 - 03: blr 803 - .text 804 - .section __ex_table, "a" 805 - .align 2 806 - .long 00b, 03b 807 - .long 01b, 03b 808 - .long 02b, 03b 809 - .text 810 - bdnz 00b 811 - blr 812 - 813 - _GLOBAL(_insl) 814 - cmpwi 0,r5,0 815 - mtctr r5 816 - subi r4,r4,4 817 - blelr- 818 - 00: lwbrx r5,0,r3 819 - 01: eieio 820 - 02: stwu r5,4(r4) 821 - ISYNC_8xx 822 - .section .fixup,"ax" 823 - 03: blr 824 - .text 825 - .section __ex_table, "a" 826 - .align 2 827 - .long 00b, 03b 828 - .long 01b, 03b 829 - .long 02b, 03b 830 - .text 831 - bdnz 00b 832 - blr 833 - 834 - _GLOBAL(_outsl) 835 - cmpwi 0,r5,0 836 - mtctr r5 837 - subi r4,r4,4 838 - blelr- 839 - 00: lwzu r5,4(r4) 840 - 01: stwbrx r5,0,r3 841 - 02: eieio 842 - ISYNC_8xx 843 - .section .fixup,"ax" 844 - 03: blr 845 - .text 846 - .section __ex_table, "a" 847 - .align 2 848 - .long 00b, 03b 849 - .long 01b, 03b 850 - .long 02b, 03b 851 - .text 852 - bdnz 00b 853 - blr 854 - 855 - _GLOBAL(__ide_mm_insw) 856 771 _GLOBAL(_insw_ns) 857 772 cmpwi 0,r5,0 858 773 mtctr r5 ··· 789 874 bdnz 00b 790 875 blr 791 876 792 - _GLOBAL(__ide_mm_outsw) 793 877 _GLOBAL(_outsw_ns) 794 878 cmpwi 0,r5,0 795 879 mtctr r5 ··· 810 896 bdnz 00b 811 897 blr 812 898 813 - _GLOBAL(__ide_mm_insl) 814 899 _GLOBAL(_insl_ns) 815 900 cmpwi 0,r5,0 816 901 mtctr r5 ··· 831 918 bdnz 00b 832 919 blr 833 920 834 - _GLOBAL(__ide_mm_outsl) 835 921 _GLOBAL(_outsl_ns) 836 922 cmpwi 0,r5,0 837 923 mtctr r5
-9
arch/ppc/kernel/ppc_ksyms.c
··· 115 115 EXPORT_SYMBOL(outl); 116 116 EXPORT_SYMBOL(outsl);*/ 117 117 118 - EXPORT_SYMBOL(__ide_mm_insl); 119 - EXPORT_SYMBOL(__ide_mm_outsw); 120 - EXPORT_SYMBOL(__ide_mm_insw); 121 - EXPORT_SYMBOL(__ide_mm_outsl); 122 - 123 118 EXPORT_SYMBOL(_insb); 124 119 EXPORT_SYMBOL(_outsb); 125 - EXPORT_SYMBOL(_insw); 126 - EXPORT_SYMBOL(_outsw); 127 - EXPORT_SYMBOL(_insl); 128 - EXPORT_SYMBOL(_outsl); 129 120 EXPORT_SYMBOL(_insw_ns); 130 121 EXPORT_SYMBOL(_outsw_ns); 131 122 EXPORT_SYMBOL(_insl_ns);
+12 -5
arch/ppc/kernel/setup.c
··· 127 127 ppc_md.restart(cmd); 128 128 } 129 129 130 - void machine_power_off(void) 130 + static void ppc_generic_power_off(void) 131 131 { 132 - #ifdef CONFIG_NVRAM 133 - nvram_sync(); 134 - #endif 135 132 ppc_md.power_off(); 136 133 } 137 134 ··· 140 143 ppc_md.halt(); 141 144 } 142 145 143 - void (*pm_power_off)(void) = machine_power_off; 146 + void (*pm_power_off)(void) = ppc_generic_power_off; 147 + 148 + void machine_power_off(void) 149 + { 150 + #ifdef CONFIG_NVRAM 151 + nvram_sync(); 152 + #endif 153 + if (pm_power_off) 154 + pm_power_off(); 155 + ppc_generic_power_off(); 156 + } 144 157 145 158 #ifdef CONFIG_TAU 146 159 extern u32 cpu_temp(unsigned long cpu);
+1
arch/ppc/platforms/85xx/sbc8560.h
··· 14 14 #define __MACH_SBC8560_H__ 15 15 16 16 #include <platforms/85xx/sbc85xx.h> 17 + #include <asm/irq.h> 17 18 18 19 #define CPM_MAP_ADDR (CCSRBAR + MPC85xx_CPM_OFFSET) 19 20
+18
arch/ppc/platforms/85xx/sbc85xx.h
··· 49 49 50 50 #define MPC85XX_PCI1_IO_SIZE 0x01000000 51 51 52 + /* FCC1 Clock Source Configuration. These can be 53 + * redefined in the board specific file. 54 + * Can only choose from CLK9-12 */ 55 + #define F1_RXCLK 12 56 + #define F1_TXCLK 11 57 + 58 + /* FCC2 Clock Source Configuration. These can be 59 + * redefined in the board specific file. 60 + * Can only choose from CLK13-16 */ 61 + #define F2_RXCLK 13 62 + #define F2_TXCLK 14 63 + 64 + /* FCC3 Clock Source Configuration. These can be 65 + * redefined in the board specific file. 66 + * Can only choose from CLK13-16 */ 67 + #define F3_RXCLK 15 68 + #define F3_TXCLK 16 69 + 52 70 #endif /* __PLATFORMS_85XX_SBC85XX_H__ */
-16
arch/ppc/syslib/m8260_pci_erratum9.c
··· 339 339 idma_pci9_read((u8 *)buf, (u8 *)addr, nl*sizeof(u32), sizeof(u32), 0); 340 340 } 341 341 342 - void insw_ns(unsigned port, void *buf, int ns) 343 - { 344 - u8 *addr = (u8 *)(port + _IO_BASE); 345 - 346 - idma_pci9_read((u8 *)buf, (u8 *)addr, ns*sizeof(u16), sizeof(u16), 0); 347 - } 348 - 349 - void insl_ns(unsigned port, void *buf, int nl) 350 - { 351 - u8 *addr = (u8 *)(port + _IO_BASE); 352 - 353 - idma_pci9_read((u8 *)buf, (u8 *)addr, nl*sizeof(u32), sizeof(u32), 0); 354 - } 355 - 356 342 void *memcpy_fromio(void *dest, unsigned long src, size_t count) 357 343 { 358 344 unsigned long pa = iopa((unsigned long) src); ··· 359 373 EXPORT_SYMBOL(insb); 360 374 EXPORT_SYMBOL(insw); 361 375 EXPORT_SYMBOL(insl); 362 - EXPORT_SYMBOL(insw_ns); 363 - EXPORT_SYMBOL(insl_ns); 364 376 EXPORT_SYMBOL(memcpy_fromio); 365 377 366 378 #endif /* ifdef CONFIG_8260_PCI9 */
+18 -10
arch/ppc/xmon/start.c
··· 15 15 #include <asm/processor.h> 16 16 #include <asm/delay.h> 17 17 #include <asm/btext.h> 18 + #include <asm/ibm4xx.h> 18 19 19 20 static volatile unsigned char *sccc, *sccd; 20 21 unsigned int TXRDY, RXRDY, DLAB; ··· 58 57 void 59 58 xmon_map_scc(void) 60 59 { 61 - #ifdef CONFIG_PPC_PREP 62 - volatile unsigned char *base; 63 - 64 - #elif defined(CONFIG_GEMINI) 60 + #if defined(CONFIG_GEMINI) 65 61 /* should already be mapped by the kernel boot */ 66 - sccc = (volatile unsigned char *) 0xffeffb0d; 67 62 sccd = (volatile unsigned char *) 0xffeffb08; 68 - TXRDY = 0x20; 69 - RXRDY = 1; 70 - DLAB = 0x80; 71 63 #elif defined(CONFIG_405GP) 72 - sccc = (volatile unsigned char *)0xef600305; 73 64 sccd = (volatile unsigned char *)0xef600300; 65 + #elif defined(CONFIG_440EP) 66 + sccd = (volatile unsigned char *) ioremap(PPC440EP_UART0_ADDR, 8); 67 + #elif defined(CONFIG_440SP) 68 + sccd = (volatile unsigned char *) ioremap64(PPC440SP_UART0_ADDR, 8); 69 + #elif defined(CONFIG_440SPE) 70 + sccd = (volatile unsigned char *) ioremap64(PPC440SPE_UART0_ADDR, 8); 71 + #elif defined(CONFIG_44x) 72 + /* This is the default for 44x platforms. Any boards that have a 73 + different UART address need to be put in cases before this or the 74 + port will be mapped incorrectly */ 75 + sccd = (volatile unsigned char *) ioremap64(PPC440GP_UART0_ADDR, 8); 76 + #endif /* platform */ 77 + 78 + #ifndef CONFIG_PPC_PREP 79 + sccc = sccd + 5; 74 80 TXRDY = 0x20; 75 81 RXRDY = 1; 76 82 DLAB = 0x80; 77 - #endif /* platform */ 83 + #endif 78 84 79 85 register_sysrq_key('x', &sysrq_xmon_op); 80 86 }
+21 -7
arch/ppc/xmon/xmon.c
··· 153 153 #define SSTEP 1 /* stepping because of 's' command */ 154 154 #define BRSTEP 2 /* stepping over breakpoint */ 155 155 156 + #ifdef CONFIG_4xx 157 + #define MSR_SSTEP_ENABLE 0x200 158 + #else 159 + #define MSR_SSTEP_ENABLE 0x400 160 + #endif 161 + 156 162 static struct pt_regs *xmon_regs[NR_CPUS]; 157 163 158 164 extern inline void sync(void) ··· 217 211 p[1] = lo; 218 212 } 219 213 214 + static inline void xmon_enable_sstep(struct pt_regs *regs) 215 + { 216 + regs->msr |= MSR_SSTEP_ENABLE; 217 + #ifdef CONFIG_4xx 218 + mtspr(SPRN_DBCR0, mfspr(SPRN_DBCR0) | DBCR0_IC | DBCR0_IDM); 219 + #endif 220 + } 221 + 220 222 int xmon(struct pt_regs *excp) 221 223 { 222 224 struct pt_regs regs; ··· 268 254 cmd = cmds(excp); 269 255 if (cmd == 's') { 270 256 xmon_trace[smp_processor_id()] = SSTEP; 271 - excp->msr |= 0x400; 257 + xmon_enable_sstep(excp); 272 258 } else if (at_breakpoint(excp->nip)) { 273 259 xmon_trace[smp_processor_id()] = BRSTEP; 274 - excp->msr |= 0x400; 260 + xmon_enable_sstep(excp); 275 261 } else { 276 262 xmon_trace[smp_processor_id()] = 0; 277 263 insert_bpts(); ··· 312 298 remove_bpts(); 313 299 excprint(regs); 314 300 xmon_trace[smp_processor_id()] = BRSTEP; 315 - regs->msr |= 0x400; 301 + xmon_enable_sstep(regs); 316 302 } else { 317 303 xmon(regs); 318 304 } ··· 399 385 } 400 386 store_inst((void *) bp->address); 401 387 } 402 - #if !defined(CONFIG_8xx) 388 + #if ! (defined(CONFIG_8xx) || defined(CONFIG_4xx)) 403 389 if (dabr.enabled) 404 390 set_dabr(dabr.address); 405 391 if (iabr.enabled) ··· 414 400 struct bpt *bp; 415 401 unsigned instr; 416 402 417 - #if !defined(CONFIG_8xx) 403 + #if ! (defined(CONFIG_8xx) || defined(CONFIG_4xx)) 418 404 set_dabr(0); 419 405 set_iabr(0); 420 406 #endif ··· 691 677 692 678 cmd = inchar(); 693 679 switch (cmd) { 694 - #if !defined(CONFIG_8xx) 680 + #if ! (defined(CONFIG_8xx) || defined(CONFIG_4xx)) 695 681 case 'd': 696 682 mode = 7; 697 683 cmd = inchar(); ··· 806 792 for (; sp != 0; sp = stack[0]) { 807 793 if (mread(sp, stack, sizeof(stack)) != sizeof(stack)) 808 794 break; 809 - printf("[%.8lx] ", stack); 795 + printf("[%.8lx] ", stack[0]); 810 796 xmon_print_symbol(stack[1], " ", "\n"); 811 797 if (stack[1] == (unsigned) &ret_from_except 812 798 || stack[1] == (unsigned) &ret_from_except_full
+22
drivers/char/Kconfig
··· 495 495 When not in use, each legacy PTY occupies 12 bytes on 32-bit 496 496 architectures and 24 bytes on 64-bit architectures. 497 497 498 + config BRIQ_PANEL 499 + tristate 'Total Impact briQ front panel driver' 500 + depends on PPC_CHRP 501 + ---help--- 502 + The briQ is a small footprint CHRP computer with a frontpanel VFD, a 503 + tristate led and two switches. It is the size of a CDROM drive. 504 + 505 + If you have such one and want anything showing on the VFD then you 506 + must answer Y here. 507 + 508 + To compile this driver as a module, choose M here: the 509 + module will be called briq_panel. 510 + 511 + It's safe to say N here. 512 + 498 513 config PRINTER 499 514 tristate "Parallel printer support" 500 515 depends on PARPORT ··· 610 595 pSeries machines when partitioned support a hypervisor virtual 611 596 console. This driver allows each pSeries partition to have a console 612 597 which is accessed via the HMC. 598 + 599 + config HVC_ISERIES 600 + bool "iSeries Hypervisor Virtual Console support" 601 + depends on PPC_ISERIES && !VIOCONS 602 + select HVC_DRIVER 603 + help 604 + iSeries machines support a hypervisor virtual console. 613 605 614 606 config HVC_RTAS 615 607 bool "IBM RTAS Console support"
+2
drivers/char/Makefile
··· 42 42 obj-$(CONFIG_SX) += sx.o generic_serial.o 43 43 obj-$(CONFIG_RIO) += rio/ generic_serial.o 44 44 obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o 45 + obj-$(CONFIG_HVC_ISERIES) += hvc_iseries.o 45 46 obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o 46 47 obj-$(CONFIG_HVC_DRIVER) += hvc_console.o 47 48 obj-$(CONFIG_RAW_DRIVER) += raw.o ··· 52 51 obj-$(CONFIG_VIOTAPE) += viotape.o 53 52 obj-$(CONFIG_HVCS) += hvcs.o 54 53 obj-$(CONFIG_SGI_MBCS) += mbcs.o 54 + obj-$(CONFIG_BRIQ_PANEL) += briq_panel.o 55 55 56 56 obj-$(CONFIG_PRINTER) += lp.o 57 57 obj-$(CONFIG_TIPAR) += tipar.o
+2 -2
drivers/char/agp/uninorth-agp.c
··· 601 601 uninorth_node = of_find_node_by_name(NULL, "u3"); 602 602 } 603 603 if (uninorth_node) { 604 - int *revprop = (int *) 605 - get_property(uninorth_node, "device-rev", NULL); 604 + const int *revprop = get_property(uninorth_node, 605 + "device-rev", NULL); 606 606 if (revprop != NULL) 607 607 uninorth_rev = *revprop & 0x3f; 608 608 of_node_put(uninorth_node);
+268
drivers/char/briq_panel.c
··· 1 + /* 2 + * Drivers for the Total Impact PPC based computer "BRIQ" 3 + * by Dr. Karsten Jeppesen 4 + * 5 + */ 6 + 7 + #include <linux/module.h> 8 + 9 + #include <linux/types.h> 10 + #include <linux/errno.h> 11 + #include <linux/sched.h> 12 + #include <linux/tty.h> 13 + #include <linux/timer.h> 14 + #include <linux/config.h> 15 + #include <linux/kernel.h> 16 + #include <linux/wait.h> 17 + #include <linux/string.h> 18 + #include <linux/slab.h> 19 + #include <linux/ioport.h> 20 + #include <linux/delay.h> 21 + #include <linux/miscdevice.h> 22 + #include <linux/fs.h> 23 + #include <linux/mm.h> 24 + #include <linux/init.h> 25 + 26 + #include <asm/uaccess.h> 27 + #include <asm/io.h> 28 + #include <asm/prom.h> 29 + 30 + #define BRIQ_PANEL_MINOR 156 31 + #define BRIQ_PANEL_VFD_IOPORT 0x0390 32 + #define BRIQ_PANEL_LED_IOPORT 0x0398 33 + #define BRIQ_PANEL_VER "1.1 (04/20/2002)" 34 + #define BRIQ_PANEL_MSG0 "Loading Linux" 35 + 36 + static int vfd_is_open; 37 + static unsigned char vfd[40]; 38 + static int vfd_cursor; 39 + static unsigned char ledpb, led; 40 + 41 + static void update_vfd(void) 42 + { 43 + int i; 44 + 45 + /* cursor home */ 46 + outb(0x02, BRIQ_PANEL_VFD_IOPORT); 47 + for (i=0; i<20; i++) 48 + outb(vfd[i], BRIQ_PANEL_VFD_IOPORT + 1); 49 + 50 + /* cursor to next line */ 51 + outb(0xc0, BRIQ_PANEL_VFD_IOPORT); 52 + for (i=20; i<40; i++) 53 + outb(vfd[i], BRIQ_PANEL_VFD_IOPORT + 1); 54 + 55 + } 56 + 57 + static void set_led(char state) 58 + { 59 + if (state == 'R') 60 + led = 0x01; 61 + else if (state == 'G') 62 + led = 0x02; 63 + else if (state == 'Y') 64 + led = 0x03; 65 + else if (state == 'X') 66 + led = 0x00; 67 + outb(led, BRIQ_PANEL_LED_IOPORT); 68 + } 69 + 70 + static int briq_panel_open(struct inode *ino, struct file *filep) 71 + { 72 + /* enforce single access */ 73 + if (vfd_is_open) 74 + return -EBUSY; 75 + vfd_is_open = 1; 76 + 77 + return 0; 78 + } 79 + 80 + static int briq_panel_release(struct inode *ino, struct file *filep) 81 + { 82 + if (!vfd_is_open) 83 + return -ENODEV; 84 + 85 + vfd_is_open = 0; 86 + 87 + return 0; 88 + } 89 + 90 + static ssize_t briq_panel_read(struct file *file, char *buf, size_t count, 91 + loff_t *ppos) 92 + { 93 + unsigned short c; 94 + unsigned char cp; 95 + 96 + #if 0 /* Can't seek (pread) on this device */ 97 + if (ppos != &file->f_pos) 98 + return -ESPIPE; 99 + #endif 100 + 101 + if (!vfd_is_open) 102 + return -ENODEV; 103 + 104 + c = (inb(BRIQ_PANEL_LED_IOPORT) & 0x000c) | (ledpb & 0x0003); 105 + set_led(' '); 106 + /* upper button released */ 107 + if ((!(ledpb & 0x0004)) && (c & 0x0004)) { 108 + cp = ' '; 109 + ledpb = c; 110 + if (copy_to_user(buf, &cp, 1)) 111 + return -EFAULT; 112 + return 1; 113 + } 114 + /* lower button released */ 115 + else if ((!(ledpb & 0x0008)) && (c & 0x0008)) { 116 + cp = '\r'; 117 + ledpb = c; 118 + if (copy_to_user(buf, &cp, 1)) 119 + return -EFAULT; 120 + return 1; 121 + } else { 122 + ledpb = c; 123 + return 0; 124 + } 125 + } 126 + 127 + static void scroll_vfd( void ) 128 + { 129 + int i; 130 + 131 + for (i=0; i<20; i++) { 132 + vfd[i] = vfd[i+20]; 133 + vfd[i+20] = ' '; 134 + } 135 + vfd_cursor = 20; 136 + } 137 + 138 + static ssize_t briq_panel_write(struct file *file, const char *buf, size_t len, 139 + loff_t *ppos) 140 + { 141 + size_t indx = len; 142 + int i, esc = 0; 143 + 144 + #if 0 /* Can't seek (pwrite) on this device */ 145 + if (ppos != &file->f_pos) 146 + return -ESPIPE; 147 + #endif 148 + 149 + if (!vfd_is_open) 150 + return -EBUSY; 151 + 152 + for (;;) { 153 + if (!indx) 154 + break; 155 + if (esc) { 156 + set_led(*buf); 157 + esc = 0; 158 + } else if (*buf == 27) { 159 + esc = 1; 160 + } else if (*buf == 12) { 161 + /* do a form feed */ 162 + for (i=0; i<40; i++) 163 + vfd[i] = ' '; 164 + vfd_cursor = 0; 165 + } else if (*buf == 10) { 166 + if (vfd_cursor < 20) 167 + vfd_cursor = 20; 168 + else if (vfd_cursor < 40) 169 + vfd_cursor = 40; 170 + else if (vfd_cursor < 60) 171 + vfd_cursor = 60; 172 + if (vfd_cursor > 59) 173 + scroll_vfd(); 174 + } else { 175 + /* just a character */ 176 + if (vfd_cursor > 39) 177 + scroll_vfd(); 178 + vfd[vfd_cursor++] = *buf; 179 + } 180 + indx--; 181 + buf++; 182 + } 183 + update_vfd(); 184 + 185 + return len; 186 + } 187 + 188 + static struct file_operations briq_panel_fops = { 189 + .owner = THIS_MODULE, 190 + .read = briq_panel_read, 191 + .write = briq_panel_write, 192 + .open = briq_panel_open, 193 + .release = briq_panel_release, 194 + }; 195 + 196 + static struct miscdevice briq_panel_miscdev = { 197 + BRIQ_PANEL_MINOR, 198 + "briq_panel", 199 + &briq_panel_fops 200 + }; 201 + 202 + static int __init briq_panel_init(void) 203 + { 204 + struct device_node *root = find_path_device("/"); 205 + char *machine; 206 + int i; 207 + 208 + machine = get_property(root, "model", NULL); 209 + if (!machine || strncmp(machine, "TotalImpact,BRIQ-1", 18) != 0) 210 + return -ENODEV; 211 + 212 + printk(KERN_INFO 213 + "briq_panel: v%s Dr. Karsten Jeppesen (kj@totalimpact.com)\n", 214 + BRIQ_PANEL_VER); 215 + 216 + if (!request_region(BRIQ_PANEL_VFD_IOPORT, 4, "BRIQ Front Panel")) 217 + return -EBUSY; 218 + 219 + if (!request_region(BRIQ_PANEL_LED_IOPORT, 2, "BRIQ Front Panel")) { 220 + release_region(BRIQ_PANEL_VFD_IOPORT, 4); 221 + return -EBUSY; 222 + } 223 + ledpb = inb(BRIQ_PANEL_LED_IOPORT) & 0x000c; 224 + 225 + if (misc_register(&briq_panel_miscdev) < 0) { 226 + release_region(BRIQ_PANEL_VFD_IOPORT, 4); 227 + release_region(BRIQ_PANEL_LED_IOPORT, 2); 228 + return -EBUSY; 229 + } 230 + 231 + outb(0x38, BRIQ_PANEL_VFD_IOPORT); /* Function set */ 232 + outb(0x01, BRIQ_PANEL_VFD_IOPORT); /* Clear display */ 233 + outb(0x0c, BRIQ_PANEL_VFD_IOPORT); /* Display on */ 234 + outb(0x06, BRIQ_PANEL_VFD_IOPORT); /* Entry normal */ 235 + for (i=0; i<40; i++) 236 + vfd[i]=' '; 237 + #ifndef MODULE 238 + vfd[0] = 'L'; 239 + vfd[1] = 'o'; 240 + vfd[2] = 'a'; 241 + vfd[3] = 'd'; 242 + vfd[4] = 'i'; 243 + vfd[5] = 'n'; 244 + vfd[6] = 'g'; 245 + vfd[7] = ' '; 246 + vfd[8] = '.'; 247 + vfd[9] = '.'; 248 + vfd[10] = '.'; 249 + #endif /* !MODULE */ 250 + 251 + update_vfd(); 252 + 253 + return 0; 254 + } 255 + 256 + static void __exit briq_panel_exit(void) 257 + { 258 + misc_deregister(&briq_panel_miscdev); 259 + release_region(BRIQ_PANEL_VFD_IOPORT, 4); 260 + release_region(BRIQ_PANEL_LED_IOPORT, 2); 261 + } 262 + 263 + module_init(briq_panel_init); 264 + module_exit(briq_panel_exit); 265 + 266 + MODULE_LICENSE("GPL"); 267 + MODULE_AUTHOR("Karsten Jeppesen <karsten@jeppesens.com>"); 268 + MODULE_DESCRIPTION("Driver for the Total Impact briQ front panel");
+10 -8
drivers/char/hvc_console.c
··· 80 80 struct tty_struct *tty; 81 81 unsigned int count; 82 82 int do_wakeup; 83 - char outbuf[N_OUTBUF] __ALIGNED__; 83 + char *outbuf; 84 + int outbuf_size; 84 85 int n_outbuf; 85 86 uint32_t vtermno; 86 87 struct hv_ops *ops; ··· 320 319 struct kobject *kobjp; 321 320 322 321 /* Auto increments kobject reference if found. */ 323 - if (!(hp = hvc_get_by_index(tty->index))) { 324 - printk(KERN_WARNING "hvc_console: tty open failed, no vty associated with tty.\n"); 322 + if (!(hp = hvc_get_by_index(tty->index))) 325 323 return -ENODEV; 326 - } 327 324 328 325 spin_lock_irqsave(&hp->lock, flags); 329 326 /* Check and then increment for fast path open. */ ··· 504 505 if (hp->n_outbuf > 0) 505 506 hvc_push(hp); 506 507 507 - while (count > 0 && (rsize = N_OUTBUF - hp->n_outbuf) > 0) { 508 + while (count > 0 && (rsize = hp->outbuf_size - hp->n_outbuf) > 0) { 508 509 if (rsize > count) 509 510 rsize = count; 510 511 memcpy(hp->outbuf + hp->n_outbuf, buf, rsize); ··· 537 538 if (!hp) 538 539 return -1; 539 540 540 - return N_OUTBUF - hp->n_outbuf; 541 + return hp->outbuf_size - hp->n_outbuf; 541 542 } 542 543 543 544 static int hvc_chars_in_buffer(struct tty_struct *tty) ··· 728 729 }; 729 730 730 731 struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, 731 - struct hv_ops *ops) 732 + struct hv_ops *ops, int outbuf_size) 732 733 { 733 734 struct hvc_struct *hp; 734 735 int i; 735 736 736 - hp = kmalloc(sizeof(*hp), GFP_KERNEL); 737 + hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, 738 + GFP_KERNEL); 737 739 if (!hp) 738 740 return ERR_PTR(-ENOMEM); 739 741 ··· 743 743 hp->vtermno = vtermno; 744 744 hp->irq = irq; 745 745 hp->ops = ops; 746 + hp->outbuf_size = outbuf_size; 747 + hp->outbuf = &((char *)hp)[ALIGN(sizeof(*hp), sizeof(long))]; 746 748 747 749 kobject_init(&hp->kobj); 748 750 hp->kobj.ktype = &hvc_kobj_type;
+1 -1
drivers/char/hvc_console.h
··· 56 56 57 57 /* register a vterm for hvc tty operation (module_init or hotplug add) */ 58 58 extern struct hvc_struct * __devinit hvc_alloc(uint32_t vtermno, int irq, 59 - struct hv_ops *ops); 59 + struct hv_ops *ops, int outbuf_size); 60 60 /* remove a vterm from hvc tty operation (modele_exit or hotplug remove) */ 61 61 extern int __devexit hvc_remove(struct hvc_struct *hp); 62 62
+594
drivers/char/hvc_iseries.c
··· 1 + /* 2 + * iSeries vio driver interface to hvc_console.c 3 + * 4 + * This code is based heavily on hvc_vio.c and viocons.c 5 + * 6 + * Copyright (C) 2006 Stephen Rothwell, IBM Corporation 7 + * 8 + * This program is free software; you can redistribute it and/or modify 9 + * it under the terms of the GNU General Public License as published by 10 + * the Free Software Foundation; either version 2 of the License, or 11 + * (at your option) any later version. 12 + * 13 + * This program is distributed in the hope that it will be useful, 14 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 + * GNU General Public License for more details. 17 + * 18 + * You should have received a copy of the GNU General Public License 19 + * along with this program; if not, write to the Free Software 20 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21 + */ 22 + #include <stdarg.h> 23 + #include <linux/types.h> 24 + #include <linux/init.h> 25 + #include <linux/kernel.h> 26 + #include <linux/spinlock.h> 27 + #include <linux/console.h> 28 + 29 + #include <asm/hvconsole.h> 30 + #include <asm/vio.h> 31 + #include <asm/prom.h> 32 + #include <asm/iseries/vio.h> 33 + #include <asm/iseries/hv_call.h> 34 + #include <asm/iseries/hv_lp_config.h> 35 + #include <asm/iseries/hv_lp_event.h> 36 + 37 + #include "hvc_console.h" 38 + 39 + #define VTTY_PORTS 10 40 + 41 + static DEFINE_SPINLOCK(consolelock); 42 + static DEFINE_SPINLOCK(consoleloglock); 43 + 44 + static const char hvc_driver_name[] = "hvc_console"; 45 + 46 + #define IN_BUF_SIZE 200 47 + 48 + /* 49 + * Our port information. 50 + */ 51 + static struct port_info { 52 + HvLpIndex lp; 53 + u64 seq; /* sequence number of last HV send */ 54 + u64 ack; /* last ack from HV */ 55 + struct hvc_struct *hp; 56 + int in_start; 57 + int in_end; 58 + unsigned char in_buf[IN_BUF_SIZE]; 59 + } port_info[VTTY_PORTS] = { 60 + [ 0 ... VTTY_PORTS - 1 ] = { 61 + .lp = HvLpIndexInvalid 62 + } 63 + }; 64 + 65 + #define viochar_is_console(pi) ((pi) == &port_info[0]) 66 + 67 + static struct vio_device_id hvc_driver_table[] __devinitdata = { 68 + {"serial", "IBM,iSeries-vty"}, 69 + { "", "" } 70 + }; 71 + MODULE_DEVICE_TABLE(vio, hvc_driver_table); 72 + 73 + static void hvlog(char *fmt, ...) 74 + { 75 + int i; 76 + unsigned long flags; 77 + va_list args; 78 + static char buf[256]; 79 + 80 + spin_lock_irqsave(&consoleloglock, flags); 81 + va_start(args, fmt); 82 + i = vscnprintf(buf, sizeof(buf) - 1, fmt, args); 83 + va_end(args); 84 + buf[i++] = '\r'; 85 + HvCall_writeLogBuffer(buf, i); 86 + spin_unlock_irqrestore(&consoleloglock, flags); 87 + } 88 + 89 + /* 90 + * Initialize the common fields in a charLpEvent 91 + */ 92 + static void init_data_event(struct viocharlpevent *viochar, HvLpIndex lp) 93 + { 94 + struct HvLpEvent *hev = &viochar->event; 95 + 96 + memset(viochar, 0, sizeof(struct viocharlpevent)); 97 + 98 + hev->flags = HV_LP_EVENT_VALID | HV_LP_EVENT_DEFERRED_ACK | 99 + HV_LP_EVENT_INT; 100 + hev->xType = HvLpEvent_Type_VirtualIo; 101 + hev->xSubtype = viomajorsubtype_chario | viochardata; 102 + hev->xSourceLp = HvLpConfig_getLpIndex(); 103 + hev->xTargetLp = lp; 104 + hev->xSizeMinus1 = sizeof(struct viocharlpevent); 105 + hev->xSourceInstanceId = viopath_sourceinst(lp); 106 + hev->xTargetInstanceId = viopath_targetinst(lp); 107 + } 108 + 109 + static int get_chars(uint32_t vtermno, char *buf, int count) 110 + { 111 + struct port_info *pi; 112 + int n = 0; 113 + unsigned long flags; 114 + 115 + if (vtermno >= VTTY_PORTS) 116 + return -EINVAL; 117 + if (count == 0) 118 + return 0; 119 + 120 + pi = &port_info[vtermno]; 121 + spin_lock_irqsave(&consolelock, flags); 122 + 123 + if (pi->in_end == 0) 124 + goto done; 125 + 126 + n = pi->in_end - pi->in_start; 127 + if (n > count) 128 + n = count; 129 + memcpy(buf, &pi->in_buf[pi->in_start], n); 130 + pi->in_start += n; 131 + if (pi->in_start == pi->in_end) { 132 + pi->in_start = 0; 133 + pi->in_end = 0; 134 + } 135 + done: 136 + spin_unlock_irqrestore(&consolelock, flags); 137 + return n; 138 + } 139 + 140 + static int put_chars(uint32_t vtermno, const char *buf, int count) 141 + { 142 + struct viocharlpevent *viochar; 143 + struct port_info *pi; 144 + HvLpEvent_Rc hvrc; 145 + unsigned long flags; 146 + int sent = 0; 147 + 148 + if (vtermno >= VTTY_PORTS) 149 + return -EINVAL; 150 + 151 + pi = &port_info[vtermno]; 152 + 153 + spin_lock_irqsave(&consolelock, flags); 154 + 155 + if (viochar_is_console(pi) && !viopath_isactive(pi->lp)) { 156 + spin_lock_irqsave(&consoleloglock, flags); 157 + HvCall_writeLogBuffer(buf, count); 158 + spin_unlock_irqrestore(&consoleloglock, flags); 159 + sent = count; 160 + goto done; 161 + } 162 + 163 + viochar = vio_get_event_buffer(viomajorsubtype_chario); 164 + if (viochar == NULL) { 165 + hvlog("\n\rviocons: Can't get viochar buffer."); 166 + goto done; 167 + } 168 + 169 + while ((count > 0) && ((pi->seq - pi->ack) < VIOCHAR_WINDOW)) { 170 + int len; 171 + 172 + len = (count > VIOCHAR_MAX_DATA) ? VIOCHAR_MAX_DATA : count; 173 + 174 + if (viochar_is_console(pi)) { 175 + spin_lock_irqsave(&consoleloglock, flags); 176 + HvCall_writeLogBuffer(buf, len); 177 + spin_unlock_irqrestore(&consoleloglock, flags); 178 + } 179 + 180 + init_data_event(viochar, pi->lp); 181 + 182 + viochar->len = len; 183 + viochar->event.xCorrelationToken = pi->seq++; 184 + viochar->event.xSizeMinus1 = 185 + offsetof(struct viocharlpevent, data) + len; 186 + 187 + memcpy(viochar->data, buf, len); 188 + 189 + hvrc = HvCallEvent_signalLpEvent(&viochar->event); 190 + if (hvrc) 191 + hvlog("\n\rerror sending event! return code %d\n\r", 192 + (int)hvrc); 193 + sent += len; 194 + count -= len; 195 + buf += len; 196 + } 197 + 198 + vio_free_event_buffer(viomajorsubtype_chario, viochar); 199 + done: 200 + spin_unlock_irqrestore(&consolelock, flags); 201 + return sent; 202 + } 203 + 204 + static struct hv_ops hvc_get_put_ops = { 205 + .get_chars = get_chars, 206 + .put_chars = put_chars, 207 + }; 208 + 209 + static int __devinit hvc_vio_probe(struct vio_dev *vdev, 210 + const struct vio_device_id *id) 211 + { 212 + struct hvc_struct *hp; 213 + struct port_info *pi; 214 + 215 + /* probed with invalid parameters. */ 216 + if (!vdev || !id) 217 + return -EPERM; 218 + 219 + if (vdev->unit_address >= VTTY_PORTS) 220 + return -ENODEV; 221 + 222 + pi = &port_info[vdev->unit_address]; 223 + 224 + hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops, 225 + VIOCHAR_MAX_DATA); 226 + if (IS_ERR(hp)) 227 + return PTR_ERR(hp); 228 + pi->hp = hp; 229 + dev_set_drvdata(&vdev->dev, pi); 230 + 231 + return 0; 232 + } 233 + 234 + static int __devexit hvc_vio_remove(struct vio_dev *vdev) 235 + { 236 + struct port_info *pi = dev_get_drvdata(&vdev->dev); 237 + struct hvc_struct *hp = pi->hp; 238 + 239 + return hvc_remove(hp); 240 + } 241 + 242 + static struct vio_driver hvc_vio_driver = { 243 + .id_table = hvc_driver_table, 244 + .probe = hvc_vio_probe, 245 + .remove = hvc_vio_remove, 246 + .driver = { 247 + .name = hvc_driver_name, 248 + .owner = THIS_MODULE, 249 + } 250 + }; 251 + 252 + static void hvc_open_event(struct HvLpEvent *event) 253 + { 254 + unsigned long flags; 255 + struct viocharlpevent *cevent = (struct viocharlpevent *)event; 256 + u8 port = cevent->virtual_device; 257 + struct port_info *pi; 258 + int reject = 0; 259 + 260 + if (hvlpevent_is_ack(event)) { 261 + if (port >= VTTY_PORTS) 262 + return; 263 + 264 + spin_lock_irqsave(&consolelock, flags); 265 + 266 + pi = &port_info[port]; 267 + if (event->xRc == HvLpEvent_Rc_Good) { 268 + pi->seq = pi->ack = 0; 269 + /* 270 + * This line allows connections from the primary 271 + * partition but once one is connected from the 272 + * primary partition nothing short of a reboot 273 + * of linux will allow access from the hosting 274 + * partition again without a required iSeries fix. 275 + */ 276 + pi->lp = event->xTargetLp; 277 + } 278 + 279 + spin_unlock_irqrestore(&consolelock, flags); 280 + if (event->xRc != HvLpEvent_Rc_Good) 281 + printk(KERN_WARNING 282 + "hvc: handle_open_event: event->xRc == (%d).\n", 283 + event->xRc); 284 + 285 + if (event->xCorrelationToken != 0) { 286 + atomic_t *aptr= (atomic_t *)event->xCorrelationToken; 287 + atomic_set(aptr, 1); 288 + } else 289 + printk(KERN_WARNING 290 + "hvc: weird...got open ack without atomic\n"); 291 + return; 292 + } 293 + 294 + /* This had better require an ack, otherwise complain */ 295 + if (!hvlpevent_need_ack(event)) { 296 + printk(KERN_WARNING "hvc: viocharopen without ack bit!\n"); 297 + return; 298 + } 299 + 300 + spin_lock_irqsave(&consolelock, flags); 301 + 302 + /* Make sure this is a good virtual tty */ 303 + if (port >= VTTY_PORTS) { 304 + event->xRc = HvLpEvent_Rc_SubtypeError; 305 + cevent->subtype_result_code = viorc_openRejected; 306 + /* 307 + * Flag state here since we can't printk while holding 308 + * the consolelock spinlock. 309 + */ 310 + reject = 1; 311 + } else { 312 + pi = &port_info[port]; 313 + if ((pi->lp != HvLpIndexInvalid) && 314 + (pi->lp != event->xSourceLp)) { 315 + /* 316 + * If this is tty is already connected to a different 317 + * partition, fail. 318 + */ 319 + event->xRc = HvLpEvent_Rc_SubtypeError; 320 + cevent->subtype_result_code = viorc_openRejected; 321 + reject = 2; 322 + } else { 323 + pi->lp = event->xSourceLp; 324 + event->xRc = HvLpEvent_Rc_Good; 325 + cevent->subtype_result_code = viorc_good; 326 + pi->seq = pi->ack = 0; 327 + } 328 + } 329 + 330 + spin_unlock_irqrestore(&consolelock, flags); 331 + 332 + if (reject == 1) 333 + printk(KERN_WARNING "hvc: open rejected: bad virtual tty.\n"); 334 + else if (reject == 2) 335 + printk(KERN_WARNING "hvc: open rejected: console in exclusive " 336 + "use by another partition.\n"); 337 + 338 + /* Return the acknowledgement */ 339 + HvCallEvent_ackLpEvent(event); 340 + } 341 + 342 + /* 343 + * Handle a close charLpEvent. This should ONLY be an Interrupt because the 344 + * virtual console should never actually issue a close event to the hypervisor 345 + * because the virtual console never goes away. A close event coming from the 346 + * hypervisor simply means that there are no client consoles connected to the 347 + * virtual console. 348 + */ 349 + static void hvc_close_event(struct HvLpEvent *event) 350 + { 351 + unsigned long flags; 352 + struct viocharlpevent *cevent = (struct viocharlpevent *)event; 353 + u8 port = cevent->virtual_device; 354 + 355 + if (!hvlpevent_is_int(event)) { 356 + printk(KERN_WARNING 357 + "hvc: got unexpected close acknowlegement\n"); 358 + return; 359 + } 360 + 361 + if (port >= VTTY_PORTS) { 362 + printk(KERN_WARNING 363 + "hvc: close message from invalid virtual device.\n"); 364 + return; 365 + } 366 + 367 + /* For closes, just mark the console partition invalid */ 368 + spin_lock_irqsave(&consolelock, flags); 369 + 370 + if (port_info[port].lp == event->xSourceLp) 371 + port_info[port].lp = HvLpIndexInvalid; 372 + 373 + spin_unlock_irqrestore(&consolelock, flags); 374 + } 375 + 376 + static void hvc_data_event(struct HvLpEvent *event) 377 + { 378 + unsigned long flags; 379 + struct viocharlpevent *cevent = (struct viocharlpevent *)event; 380 + struct port_info *pi; 381 + int n; 382 + u8 port = cevent->virtual_device; 383 + 384 + if (port >= VTTY_PORTS) { 385 + printk(KERN_WARNING "hvc: data on invalid virtual device %d\n", 386 + port); 387 + return; 388 + } 389 + if (cevent->len == 0) 390 + return; 391 + 392 + /* 393 + * Change 05/01/2003 - Ryan Arnold: If a partition other than 394 + * the current exclusive partition tries to send us data 395 + * events then just drop them on the floor because we don't 396 + * want his stinking data. He isn't authorized to receive 397 + * data because he wasn't the first one to get the console, 398 + * therefore he shouldn't be allowed to send data either. 399 + * This will work without an iSeries fix. 400 + */ 401 + pi = &port_info[port]; 402 + if (pi->lp != event->xSourceLp) 403 + return; 404 + 405 + spin_lock_irqsave(&consolelock, flags); 406 + 407 + n = IN_BUF_SIZE - pi->in_end; 408 + if (n > cevent->len) 409 + n = cevent->len; 410 + if (n > 0) { 411 + memcpy(&pi->in_buf[pi->in_end], cevent->data, n); 412 + pi->in_end += n; 413 + } 414 + spin_unlock_irqrestore(&consolelock, flags); 415 + if (n == 0) 416 + printk(KERN_WARNING "hvc: input buffer overflow\n"); 417 + } 418 + 419 + static void hvc_ack_event(struct HvLpEvent *event) 420 + { 421 + struct viocharlpevent *cevent = (struct viocharlpevent *)event; 422 + unsigned long flags; 423 + u8 port = cevent->virtual_device; 424 + 425 + if (port >= VTTY_PORTS) { 426 + printk(KERN_WARNING "hvc: data on invalid virtual device\n"); 427 + return; 428 + } 429 + 430 + spin_lock_irqsave(&consolelock, flags); 431 + port_info[port].ack = event->xCorrelationToken; 432 + spin_unlock_irqrestore(&consolelock, flags); 433 + } 434 + 435 + static void hvc_config_event(struct HvLpEvent *event) 436 + { 437 + struct viocharlpevent *cevent = (struct viocharlpevent *)event; 438 + 439 + if (cevent->data[0] == 0x01) 440 + printk(KERN_INFO "hvc: window resized to %d: %d: %d: %d\n", 441 + cevent->data[1], cevent->data[2], 442 + cevent->data[3], cevent->data[4]); 443 + else 444 + printk(KERN_WARNING "hvc: unknown config event\n"); 445 + } 446 + 447 + static void hvc_handle_event(struct HvLpEvent *event) 448 + { 449 + int charminor; 450 + 451 + if (event == NULL) 452 + return; 453 + 454 + charminor = event->xSubtype & VIOMINOR_SUBTYPE_MASK; 455 + switch (charminor) { 456 + case viocharopen: 457 + hvc_open_event(event); 458 + break; 459 + case viocharclose: 460 + hvc_close_event(event); 461 + break; 462 + case viochardata: 463 + hvc_data_event(event); 464 + break; 465 + case viocharack: 466 + hvc_ack_event(event); 467 + break; 468 + case viocharconfig: 469 + hvc_config_event(event); 470 + break; 471 + default: 472 + if (hvlpevent_is_int(event) && hvlpevent_need_ack(event)) { 473 + event->xRc = HvLpEvent_Rc_InvalidSubtype; 474 + HvCallEvent_ackLpEvent(event); 475 + } 476 + } 477 + } 478 + 479 + static int send_open(HvLpIndex remoteLp, void *sem) 480 + { 481 + return HvCallEvent_signalLpEventFast(remoteLp, 482 + HvLpEvent_Type_VirtualIo, 483 + viomajorsubtype_chario | viocharopen, 484 + HvLpEvent_AckInd_DoAck, HvLpEvent_AckType_ImmediateAck, 485 + viopath_sourceinst(remoteLp), 486 + viopath_targetinst(remoteLp), 487 + (u64)(unsigned long)sem, VIOVERSION << 16, 488 + 0, 0, 0, 0); 489 + } 490 + 491 + static int hvc_vio_init(void) 492 + { 493 + atomic_t wait_flag; 494 + int rc; 495 + 496 + /* +2 for fudge */ 497 + rc = viopath_open(HvLpConfig_getPrimaryLpIndex(), 498 + viomajorsubtype_chario, VIOCHAR_WINDOW + 2); 499 + if (rc) 500 + printk(KERN_WARNING "hvc: error opening to primary %d\n", rc); 501 + 502 + if (viopath_hostLp == HvLpIndexInvalid) 503 + vio_set_hostlp(); 504 + 505 + /* 506 + * And if the primary is not the same as the hosting LP, open to the 507 + * hosting lp 508 + */ 509 + if ((viopath_hostLp != HvLpIndexInvalid) && 510 + (viopath_hostLp != HvLpConfig_getPrimaryLpIndex())) { 511 + printk(KERN_INFO "hvc: open path to hosting (%d)\n", 512 + viopath_hostLp); 513 + rc = viopath_open(viopath_hostLp, viomajorsubtype_chario, 514 + VIOCHAR_WINDOW + 2); /* +2 for fudge */ 515 + if (rc) 516 + printk(KERN_WARNING 517 + "error opening to partition %d: %d\n", 518 + viopath_hostLp, rc); 519 + } 520 + 521 + if (vio_setHandler(viomajorsubtype_chario, hvc_handle_event) < 0) 522 + printk(KERN_WARNING 523 + "hvc: error seting handler for console events!\n"); 524 + 525 + /* 526 + * First, try to open the console to the hosting lp. 527 + * Wait on a semaphore for the response. 528 + */ 529 + atomic_set(&wait_flag, 0); 530 + if ((viopath_isactive(viopath_hostLp)) && 531 + (send_open(viopath_hostLp, &wait_flag) == 0)) { 532 + printk(KERN_INFO "hvc: hosting partition %d\n", viopath_hostLp); 533 + while (atomic_read(&wait_flag) == 0) 534 + mb(); 535 + atomic_set(&wait_flag, 0); 536 + } 537 + 538 + /* 539 + * If we don't have an active console, try the primary 540 + */ 541 + if ((!viopath_isactive(port_info[0].lp)) && 542 + (viopath_isactive(HvLpConfig_getPrimaryLpIndex())) && 543 + (send_open(HvLpConfig_getPrimaryLpIndex(), &wait_flag) == 0)) { 544 + printk(KERN_INFO "hvc: opening console to primary partition\n"); 545 + while (atomic_read(&wait_flag) == 0) 546 + mb(); 547 + } 548 + 549 + /* Register as a vio device to receive callbacks */ 550 + rc = vio_register_driver(&hvc_vio_driver); 551 + 552 + return rc; 553 + } 554 + module_init(hvc_vio_init); /* after drivers/char/hvc_console.c */ 555 + 556 + static void hvc_vio_exit(void) 557 + { 558 + vio_unregister_driver(&hvc_vio_driver); 559 + } 560 + module_exit(hvc_vio_exit); 561 + 562 + /* the device tree order defines our numbering */ 563 + static int hvc_find_vtys(void) 564 + { 565 + struct device_node *vty; 566 + int num_found = 0; 567 + 568 + for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL; 569 + vty = of_find_node_by_name(vty, "vty")) { 570 + uint32_t *vtermno; 571 + 572 + /* We have statically defined space for only a certain number 573 + * of console adapters. 574 + */ 575 + if ((num_found >= MAX_NR_HVC_CONSOLES) || 576 + (num_found >= VTTY_PORTS)) 577 + break; 578 + 579 + vtermno = (uint32_t *)get_property(vty, "reg", NULL); 580 + if (!vtermno) 581 + continue; 582 + 583 + if (!device_is_compatible(vty, "IBM,iSeries-vty")) 584 + continue; 585 + 586 + if (num_found == 0) 587 + add_preferred_console("hvc", 0, NULL); 588 + hvc_instantiate(*vtermno, num_found, &hvc_get_put_ops); 589 + ++num_found; 590 + } 591 + 592 + return num_found; 593 + } 594 + console_initcall(hvc_find_vtys);
+1 -1
drivers/char/hvc_rtas.c
··· 94 94 95 95 /* Allocate an hvc_struct for the console device we instantiated 96 96 * earlier. Save off hp so that we can return it on exit */ 97 - hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops); 97 + hp = hvc_alloc(hvc_rtas_cookie, NO_IRQ, &hvc_rtas_get_put_ops, 16); 98 98 if (IS_ERR(hp)) 99 99 return PTR_ERR(hp); 100 100
+4 -3
drivers/char/hvc_vio.c
··· 90 90 if (!vdev || !id) 91 91 return -EPERM; 92 92 93 - hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops); 93 + hp = hvc_alloc(vdev->unit_address, vdev->irq, &hvc_get_put_ops, 94 + MAX_VIO_PUT_CHARS); 94 95 if (IS_ERR(hp)) 95 96 return PTR_ERR(hp); 96 97 dev_set_drvdata(&vdev->dev, hp); ··· 141 140 142 141 for (vty = of_find_node_by_name(NULL, "vty"); vty != NULL; 143 142 vty = of_find_node_by_name(vty, "vty")) { 144 - uint32_t *vtermno; 143 + const uint32_t *vtermno; 145 144 146 145 /* We have statically defined space for only a certain number 147 146 * of console adapters. ··· 149 148 if (num_found >= MAX_NR_HVC_CONSOLES) 150 149 break; 151 150 152 - vtermno = (uint32_t *)get_property(vty, "reg", NULL); 151 + vtermno = get_property(vty, "reg", NULL); 153 152 if (!vtermno) 154 153 continue; 155 154
+3 -4
drivers/char/hvsi.c
··· 1274 1274 vty != NULL; 1275 1275 vty = of_find_compatible_node(vty, "serial", "hvterm-protocol")) { 1276 1276 struct hvsi_struct *hp; 1277 - uint32_t *vtermno; 1278 - uint32_t *irq; 1277 + const uint32_t *vtermno, *irq; 1279 1278 1280 - vtermno = (uint32_t *)get_property(vty, "reg", NULL); 1281 - irq = (uint32_t *)get_property(vty, "interrupts", NULL); 1279 + vtermno = get_property(vty, "reg", NULL); 1280 + irq = get_property(vty, "interrupts", NULL); 1282 1281 if (!vtermno || !irq) 1283 1282 continue; 1284 1283
+2 -2
drivers/char/tpm/tpm_atmel.h
··· 37 37 { 38 38 struct device_node *dn; 39 39 unsigned long address, size; 40 - unsigned int *reg; 40 + const unsigned int *reg; 41 41 int reglen; 42 42 int naddrc; 43 43 int nsizec; ··· 52 52 return NULL; 53 53 } 54 54 55 - reg = (unsigned int *) get_property(dn, "reg", &reglen); 55 + reg = get_property(dn, "reg", &reglen); 56 56 naddrc = prom_n_addr_cells(dn); 57 57 nsizec = prom_n_size_cells(dn); 58 58
+1 -30
drivers/char/viocons.c
··· 43 43 #include <linux/sysrq.h> 44 44 45 45 #include <asm/iseries/vio.h> 46 - 47 46 #include <asm/iseries/hv_lp_event.h> 48 47 #include <asm/iseries/hv_call_event.h> 49 48 #include <asm/iseries/hv_lp_config.h> ··· 65 66 static int vio_sysrq_pressed; 66 67 extern int sysrq_enabled; 67 68 #endif 68 - 69 - /* 70 - * The structure of the events that flow between us and OS/400. You can't 71 - * mess with this unless the OS/400 side changes too 72 - */ 73 - struct viocharlpevent { 74 - struct HvLpEvent event; 75 - u32 reserved; 76 - u16 version; 77 - u16 subtype_result_code; 78 - u8 virtual_device; 79 - u8 len; 80 - u8 data[VIOCHAR_MAX_DATA]; 81 - }; 82 - 83 - #define VIOCHAR_WINDOW 10 84 - #define VIOCHAR_HIGHWATERMARK 3 85 - 86 - enum viocharsubtype { 87 - viocharopen = 0x0001, 88 - viocharclose = 0x0002, 89 - viochardata = 0x0003, 90 - viocharack = 0x0004, 91 - viocharconfig = 0x0005 92 - }; 93 - 94 - enum viochar_rc { 95 - viochar_rc_ebusy = 1 96 - }; 97 69 98 70 #define VIOCHAR_NUM_BUF 16 99 71 ··· 1153 1183 port_info[i].magic = VIOTTY_MAGIC; 1154 1184 } 1155 1185 HvCall_setLogBufferFormatAndCodepage(HvCall_LogBuffer_ASCII, 437); 1186 + add_preferred_console("viocons", 0, NULL); 1156 1187 register_console(&viocons_early); 1157 1188 return 0; 1158 1189 }
+2 -4
drivers/char/viotape.c
··· 940 940 941 941 static int viotape_probe(struct vio_dev *vdev, const struct vio_device_id *id) 942 942 { 943 - char tapename[32]; 944 943 int i = vdev->unit_address; 945 944 int j; 946 945 ··· 955 956 "iseries!vt%d", i); 956 957 class_device_create(tape_class, NULL, MKDEV(VIOTAPE_MAJOR, i | 0x80), 957 958 NULL, "iseries!nvt%d", i); 958 - sprintf(tapename, "iseries/vt%d", i); 959 - printk(VIOTAPE_KERN_INFO "tape %s is iSeries " 959 + printk(VIOTAPE_KERN_INFO "tape iseries/vt%d is iSeries " 960 960 "resource %10.10s type %4.4s, model %3.3s\n", 961 - tapename, viotape_unitinfo[i].rsrcname, 961 + i, viotape_unitinfo[i].rsrcname, 962 962 viotape_unitinfo[i].type, viotape_unitinfo[i].model); 963 963 return 0; 964 964 }
+2 -1
drivers/i2c/busses/i2c-powermac.c
··· 207 207 struct pmac_i2c_bus *bus = dev->platform_data; 208 208 struct device_node *parent = NULL; 209 209 struct i2c_adapter *adapter; 210 - char name[32], *basename; 210 + char name[32]; 211 + const char *basename; 211 212 int rc; 212 213 213 214 if (bus == NULL)
+4 -4
drivers/ide/ppc/pmac.c
··· 1154 1154 pmac_ide_setup_device(pmac_ide_hwif_t *pmif, ide_hwif_t *hwif) 1155 1155 { 1156 1156 struct device_node *np = pmif->node; 1157 - int *bidp; 1157 + const int *bidp; 1158 1158 1159 1159 pmif->cable_80 = 0; 1160 1160 pmif->broken_dma = pmif->broken_dma_warn = 0; ··· 1176 1176 pmif->broken_dma = 1; 1177 1177 } 1178 1178 1179 - bidp = (int *)get_property(np, "AAPL,bus-id", NULL); 1179 + bidp = get_property(np, "AAPL,bus-id", NULL); 1180 1180 pmif->aapl_bus_id = bidp ? *bidp : 0; 1181 1181 1182 1182 /* Get cable type from device-tree */ 1183 1183 if (pmif->kind == controller_kl_ata4 || pmif->kind == controller_un_ata6 1184 1184 || pmif->kind == controller_k2_ata6 1185 1185 || pmif->kind == controller_sh_ata6) { 1186 - char* cable = get_property(np, "cable-type", NULL); 1186 + const char* cable = get_property(np, "cable-type", NULL); 1187 1187 if (cable && !strncmp(cable, "80-", 3)) 1188 1188 pmif->cable_80 = 1; 1189 1189 } ··· 1326 1326 if (macio_irq_count(mdev) == 0) { 1327 1327 printk(KERN_WARNING "ide%d: no intrs for device %s, using 13\n", 1328 1328 i, mdev->ofdev.node->full_name); 1329 - irq = 13; 1329 + irq = irq_create_mapping(NULL, 13); 1330 1330 } else 1331 1331 irq = macio_irq(mdev, 0); 1332 1332
+6 -4
drivers/macintosh/macio_asic.c
··· 139 139 { 140 140 struct macio_dev * macio_dev; 141 141 struct of_device * of; 142 - char *scratch, *compat, *compat2; 142 + char *scratch; 143 + const char *compat, *compat2; 144 + 143 145 int i = 0; 144 146 int length, cplen, cplen2, seen = 0; 145 147 ··· 175 173 * it's not really legal to split it out with commas. We split it 176 174 * up using a number of environment variables instead. */ 177 175 178 - compat = (char *) get_property(of->node, "compatible", &cplen); 176 + compat = get_property(of->node, "compatible", &cplen); 179 177 compat2 = compat; 180 178 cplen2= cplen; 181 179 while (compat && cplen > 0) { ··· 456 454 struct resource *parent_res) 457 455 { 458 456 struct macio_dev *dev; 459 - u32 *reg; 457 + const u32 *reg; 460 458 461 459 if (np == NULL) 462 460 return NULL; ··· 491 489 #endif 492 490 MAX_NODE_NAME_SIZE, np->name); 493 491 } else { 494 - reg = (u32 *)get_property(np, "reg", NULL); 492 + reg = get_property(np, "reg", NULL); 495 493 sprintf(dev->ofdev.dev.bus_id, "%1d.%08x:%.*s", 496 494 chip->lbus.index, 497 495 reg ? *reg : 0, MAX_NODE_NAME_SIZE, np->name);
+4 -4
drivers/macintosh/macio_sysfs.c
··· 16 16 compatible_show (struct device *dev, struct device_attribute *attr, char *buf) 17 17 { 18 18 struct of_device *of; 19 - char *compat; 19 + const char *compat; 20 20 int cplen; 21 21 int length = 0; 22 22 23 23 of = &to_macio_device (dev)->ofdev; 24 - compat = (char *) get_property(of->node, "compatible", &cplen); 24 + compat = get_property(of->node, "compatible", &cplen); 25 25 if (!compat) { 26 26 *buf = '\0'; 27 27 return 0; ··· 42 42 char *buf) 43 43 { 44 44 struct of_device *of; 45 - char *compat; 45 + const char *compat; 46 46 int cplen; 47 47 int length; 48 48 49 49 of = &to_macio_device (dev)->ofdev; 50 - compat = (char *) get_property (of->node, "compatible", &cplen); 50 + compat = get_property(of->node, "compatible", &cplen); 51 51 if (!compat) compat = "", cplen = 1; 52 52 length = sprintf (buf, "of:N%sT%s", of->node->name, of->node->type); 53 53 buf += length;
+9 -10
drivers/macintosh/smu.c
··· 454 454 int __init smu_init (void) 455 455 { 456 456 struct device_node *np; 457 - u32 *data; 457 + const u32 *data; 458 458 459 459 np = of_find_node_by_type(NULL, "smu"); 460 460 if (np == NULL) ··· 490 490 printk(KERN_ERR "SMU: Can't find doorbell GPIO !\n"); 491 491 goto fail; 492 492 } 493 - data = (u32 *)get_property(smu->db_node, "reg", NULL); 493 + data = get_property(smu->db_node, "reg", NULL); 494 494 if (data == NULL) { 495 495 of_node_put(smu->db_node); 496 496 smu->db_node = NULL; ··· 511 511 smu->msg_node = of_find_node_by_name(NULL, "smu-interrupt"); 512 512 if (smu->msg_node == NULL) 513 513 break; 514 - data = (u32 *)get_property(smu->msg_node, "reg", NULL); 514 + data = get_property(smu->msg_node, "reg", NULL); 515 515 if (data == NULL) { 516 516 of_node_put(smu->msg_node); 517 517 smu->msg_node = NULL; ··· 982 982 /* Note: Only allowed to return error code in pointers (using ERR_PTR) 983 983 * when interruptible is 1 984 984 */ 985 - struct smu_sdbp_header *__smu_get_sdb_partition(int id, unsigned int *size, 986 - int interruptible) 985 + const struct smu_sdbp_header *__smu_get_sdb_partition(int id, 986 + unsigned int *size, int interruptible) 987 987 { 988 988 char pname[32]; 989 - struct smu_sdbp_header *part; 989 + const struct smu_sdbp_header *part; 990 990 991 991 if (!smu) 992 992 return NULL; ··· 1003 1003 } else 1004 1004 mutex_lock(&smu_part_access); 1005 1005 1006 - part = (struct smu_sdbp_header *)get_property(smu->of_node, 1007 - pname, size); 1006 + part = get_property(smu->of_node, pname, size); 1008 1007 if (part == NULL) { 1009 1008 DPRINTK("trying to extract from SMU ...\n"); 1010 1009 part = smu_create_sdb_partition(id); ··· 1014 1015 return part; 1015 1016 } 1016 1017 1017 - struct smu_sdbp_header *smu_get_sdb_partition(int id, unsigned int *size) 1018 + const struct smu_sdbp_header *smu_get_sdb_partition(int id, unsigned int *size) 1018 1019 { 1019 1020 return __smu_get_sdb_partition(id, size, 0); 1020 1021 } ··· 1093 1094 pp->mode = smu_file_events; 1094 1095 return 0; 1095 1096 } else if (hdr.cmdtype == SMU_CMDTYPE_GET_PARTITION) { 1096 - struct smu_sdbp_header *part; 1097 + const struct smu_sdbp_header *part; 1097 1098 part = __smu_get_sdb_partition(hdr.cmd, NULL, 1); 1098 1099 if (part == NULL) 1099 1100 return -EINVAL;
+4 -4
drivers/macintosh/therm_adt746x.c
··· 47 47 48 48 static u8 default_limits_local[3] = {70, 50, 70}; /* local, sensor1, sensor2 */ 49 49 static u8 default_limits_chip[3] = {80, 65, 80}; /* local, sensor1, sensor2 */ 50 - static char *sensor_location[3] = {NULL, NULL, NULL}; 50 + static const char *sensor_location[3] = {NULL, NULL, NULL}; 51 51 52 52 static int limit_adjust = 0; 53 53 static int fan_speed = -1; ··· 553 553 thermostat_init(void) 554 554 { 555 555 struct device_node* np; 556 - u32 *prop; 556 + const u32 *prop; 557 557 int i = 0, offset = 0; 558 558 559 559 np = of_find_node_by_name(NULL, "fan"); ··· 566 566 else 567 567 return -ENODEV; 568 568 569 - prop = (u32 *)get_property(np, "hwsensor-params-version", NULL); 569 + prop = get_property(np, "hwsensor-params-version", NULL); 570 570 printk(KERN_INFO "adt746x: version %d (%ssupported)\n", *prop, 571 571 (*prop == 1)?"":"un"); 572 572 if (*prop != 1) 573 573 return -ENODEV; 574 574 575 - prop = (u32 *)get_property(np, "reg", NULL); 575 + prop = get_property(np, "reg", NULL); 576 576 if (!prop) 577 577 return -ENODEV; 578 578
+7 -7
drivers/macintosh/therm_pm72.c
··· 660 660 { 661 661 struct device_node *np; 662 662 char nodename[64]; 663 - u8 *data; 663 + const u8 *data; 664 664 int len; 665 665 666 666 /* prom.c routine for finding a node by path is a bit brain dead ··· 673 673 printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid node from device-tree\n"); 674 674 return -ENODEV; 675 675 } 676 - data = (u8 *)get_property(np, "cpuid", &len); 676 + data = get_property(np, "cpuid", &len); 677 677 if (data == NULL) { 678 678 printk(KERN_ERR "therm_pm72: Failed to retrieve cpuid property from device-tree\n"); 679 679 of_node_put(np); ··· 1336 1336 */ 1337 1337 u3 = of_find_node_by_path("/u3@0,f8000000"); 1338 1338 if (u3 != NULL) { 1339 - u32 *vers = (u32 *)get_property(u3, "device-rev", NULL); 1339 + const u32 *vers = get_property(u3, "device-rev", NULL); 1340 1340 if (vers) 1341 1341 if (((*vers) & 0x3f) < 0x34) 1342 1342 u3h = 0; ··· 2111 2111 2112 2112 while ((np = of_get_next_child(fcu_node, np)) != NULL) { 2113 2113 int type = -1; 2114 - char *loc; 2115 - u32 *reg; 2114 + const char *loc; 2115 + const u32 *reg; 2116 2116 2117 2117 DBG(" control: %s, type: %s\n", np->name, np->type); 2118 2118 ··· 2128 2128 continue; 2129 2129 2130 2130 /* Lookup for a matching location */ 2131 - loc = (char *)get_property(np, "location", NULL); 2132 - reg = (u32 *)get_property(np, "reg", NULL); 2131 + loc = get_property(np, "location", NULL); 2132 + reg = get_property(np, "reg", NULL); 2133 2133 if (loc == NULL || reg == NULL) 2134 2134 continue; 2135 2135 DBG(" matching location: %s, reg: 0x%08x\n", loc, *reg);
+2 -2
drivers/macintosh/therm_windtunnel.c
··· 484 484 static int __init 485 485 g4fan_init( void ) 486 486 { 487 - struct apple_thermal_info *info; 487 + const struct apple_thermal_info *info; 488 488 struct device_node *np; 489 489 490 490 init_MUTEX( &x.lock ); 491 491 492 492 if( !(np=of_find_node_by_name(NULL, "power-mgt")) ) 493 493 return -ENODEV; 494 - info = (struct apple_thermal_info*)get_property(np, "thermal-info", NULL); 494 + info = get_property(np, "thermal-info", NULL); 495 495 of_node_put(np); 496 496 497 497 if( !info || !machine_is_compatible("PowerMac3,6") )
+2 -2
drivers/macintosh/via-cuda.c
··· 123 123 { 124 124 struct adb_request req; 125 125 phys_addr_t taddr; 126 - u32 *reg; 126 + const u32 *reg; 127 127 int err; 128 128 129 129 if (vias != 0) ··· 132 132 if (vias == 0) 133 133 return 0; 134 134 135 - reg = (u32 *)get_property(vias, "reg", NULL); 135 + reg = get_property(vias, "reg", NULL); 136 136 if (reg == NULL) { 137 137 printk(KERN_ERR "via-cuda: No \"reg\" property !\n"); 138 138 goto fail;
+1 -1
drivers/macintosh/via-pmu-led.c
··· 120 120 dt = of_find_node_by_path("/"); 121 121 if (dt == NULL) 122 122 return -ENODEV; 123 - model = (const char *)get_property(dt, "model", NULL); 123 + model = get_property(dt, "model", NULL); 124 124 if (model == NULL) 125 125 return -ENODEV; 126 126 if (strncmp(model, "PowerBook", strlen("PowerBook")) != 0 &&
+5 -5
drivers/macintosh/via-pmu.c
··· 280 280 int __init find_via_pmu(void) 281 281 { 282 282 u64 taddr; 283 - u32 *reg; 283 + const u32 *reg; 284 284 285 285 if (via != 0) 286 286 return 1; ··· 288 288 if (vias == NULL) 289 289 return 0; 290 290 291 - reg = (u32 *)get_property(vias, "reg", NULL); 291 + reg = get_property(vias, "reg", NULL); 292 292 if (reg == NULL) { 293 293 printk(KERN_ERR "via-pmu: No \"reg\" property !\n"); 294 294 goto fail; ··· 330 330 331 331 gpiop = of_find_node_by_name(NULL, "gpio"); 332 332 if (gpiop) { 333 - reg = (u32 *)get_property(gpiop, "reg", NULL); 333 + reg = get_property(gpiop, "reg", NULL); 334 334 if (reg) 335 335 gaddr = of_translate_address(gpiop, reg); 336 336 if (gaddr != OF_BAD_ADDR) ··· 479 479 pmu_batteries[1].flags |= PMU_BATT_TYPE_SMART; 480 480 } else { 481 481 struct device_node* prim = find_devices("power-mgt"); 482 - u32 *prim_info = NULL; 482 + const u32 *prim_info = NULL; 483 483 if (prim) 484 - prim_info = (u32 *)get_property(prim, "prim-info", NULL); 484 + prim_info = get_property(prim, "prim-info", NULL); 485 485 if (prim_info) { 486 486 /* Other stuffs here yet unknown */ 487 487 pmu_battery_count = (prim_info[6] >> 16) & 0xff;
+2 -2
drivers/macintosh/windfarm_pm81.c
··· 396 396 static void wf_smu_create_cpu_fans(void) 397 397 { 398 398 struct wf_cpu_pid_param pid_param; 399 - struct smu_sdbp_header *hdr; 399 + const struct smu_sdbp_header *hdr; 400 400 struct smu_sdbp_cpupiddata *piddata; 401 401 struct smu_sdbp_fvt *fvt; 402 402 s32 tmax, tdelta, maxpow, powadj; ··· 702 702 703 703 static int wf_init_pm(void) 704 704 { 705 - struct smu_sdbp_header *hdr; 705 + const struct smu_sdbp_header *hdr; 706 706 707 707 hdr = smu_get_sdb_partition(SMU_SDB_SENSORTREE_ID, NULL); 708 708 if (hdr != 0) {
+1 -1
drivers/macintosh/windfarm_pm91.c
··· 144 144 static void wf_smu_create_cpu_fans(void) 145 145 { 146 146 struct wf_cpu_pid_param pid_param; 147 - struct smu_sdbp_header *hdr; 147 + const struct smu_sdbp_header *hdr; 148 148 struct smu_sdbp_cpupiddata *piddata; 149 149 struct smu_sdbp_fvt *fvt; 150 150 s32 tmax, tdelta, maxpow, powadj;
+7 -6
drivers/macintosh/windfarm_smu_controls.c
··· 159 159 int pwm_fan) 160 160 { 161 161 struct smu_fan_control *fct; 162 - s32 *v; u32 *reg; 163 - char *l; 162 + const s32 *v; 163 + const u32 *reg; 164 + const char *l; 164 165 165 166 fct = kmalloc(sizeof(struct smu_fan_control), GFP_KERNEL); 166 167 if (fct == NULL) 167 168 return NULL; 168 169 fct->ctrl.ops = &smu_fan_ops; 169 - l = (char *)get_property(node, "location", NULL); 170 + l = get_property(node, "location", NULL); 170 171 if (l == NULL) 171 172 goto fail; 172 173 ··· 224 223 goto fail; 225 224 226 225 /* Get min & max values*/ 227 - v = (s32 *)get_property(node, "min-value", NULL); 226 + v = get_property(node, "min-value", NULL); 228 227 if (v == NULL) 229 228 goto fail; 230 229 fct->min = *v; 231 - v = (s32 *)get_property(node, "max-value", NULL); 230 + v = get_property(node, "max-value", NULL); 232 231 if (v == NULL) 233 232 goto fail; 234 233 fct->max = *v; 235 234 236 235 /* Get "reg" value */ 237 - reg = (u32 *)get_property(node, "reg", NULL); 236 + reg = get_property(node, "reg", NULL); 238 237 if (reg == NULL) 239 238 goto fail; 240 239 fct->reg = *reg;
+4 -4
drivers/macintosh/windfarm_smu_sat.c
··· 233 233 { 234 234 struct wf_sat *sat; 235 235 struct wf_sat_sensor *sens; 236 - u32 *reg; 237 - char *loc, *type; 236 + const u32 *reg; 237 + const char *loc, *type; 238 238 u8 addr, chip, core; 239 239 struct device_node *child; 240 240 int shift, cpu, index; 241 241 char *name; 242 242 int vsens[2], isens[2]; 243 243 244 - reg = (u32 *) get_property(dev, "reg", NULL); 244 + reg = get_property(dev, "reg", NULL); 245 245 if (reg == NULL) 246 246 return; 247 247 addr = *reg; ··· 268 268 isens[0] = isens[1] = -1; 269 269 child = NULL; 270 270 while ((child = of_get_next_child(dev, child)) != NULL) { 271 - reg = (u32 *) get_property(child, "reg", NULL); 271 + reg = get_property(child, "reg", NULL); 272 272 type = get_property(child, "device_type", NULL); 273 273 loc = get_property(child, "location", NULL); 274 274 if (reg == NULL || loc == NULL)
+6 -6
drivers/macintosh/windfarm_smu_sensors.c
··· 198 198 static struct smu_ad_sensor *smu_ads_create(struct device_node *node) 199 199 { 200 200 struct smu_ad_sensor *ads; 201 - char *c, *l; 202 - u32 *v; 201 + const char *c, *l; 202 + const u32 *v; 203 203 204 204 ads = kmalloc(sizeof(struct smu_ad_sensor), GFP_KERNEL); 205 205 if (ads == NULL) 206 206 return NULL; 207 - c = (char *)get_property(node, "device_type", NULL); 208 - l = (char *)get_property(node, "location", NULL); 207 + c = get_property(node, "device_type", NULL); 208 + l = get_property(node, "location", NULL); 209 209 if (c == NULL || l == NULL) 210 210 goto fail; 211 211 ··· 255 255 } else 256 256 goto fail; 257 257 258 - v = (u32 *)get_property(node, "reg", NULL); 258 + v = get_property(node, "reg", NULL); 259 259 if (v == NULL) 260 260 goto fail; 261 261 ads->reg = *v; ··· 382 382 383 383 static void smu_fetch_param_partitions(void) 384 384 { 385 - struct smu_sdbp_header *hdr; 385 + const struct smu_sdbp_header *hdr; 386 386 387 387 /* Get CPU voltage/current/power calibration data */ 388 388 hdr = smu_get_sdb_partition(SMU_SDB_CPUVCP_ID, NULL);
+8 -5
drivers/net/bmac.c
··· 1264 1264 { 1265 1265 int j, rev, ret; 1266 1266 struct bmac_data *bp; 1267 - unsigned char *addr; 1267 + const unsigned char *prop_addr; 1268 + unsigned char addr[6]; 1268 1269 struct net_device *dev; 1269 1270 int is_bmac_plus = ((int)match->data) != 0; 1270 1271 ··· 1273 1272 printk(KERN_ERR "BMAC: can't use, need 3 addrs and 3 intrs\n"); 1274 1273 return -ENODEV; 1275 1274 } 1276 - addr = get_property(macio_get_of_node(mdev), "mac-address", NULL); 1277 - if (addr == NULL) { 1278 - addr = get_property(macio_get_of_node(mdev), "local-mac-address", NULL); 1279 - if (addr == NULL) { 1275 + prop_addr = get_property(macio_get_of_node(mdev), "mac-address", NULL); 1276 + if (prop_addr == NULL) { 1277 + prop_addr = get_property(macio_get_of_node(mdev), 1278 + "local-mac-address", NULL); 1279 + if (prop_addr == NULL) { 1280 1280 printk(KERN_ERR "BMAC: Can't get mac-address\n"); 1281 1281 return -ENODEV; 1282 1282 } 1283 1283 } 1284 + memcpy(addr, prop_addr, sizeof(addr)); 1284 1285 1285 1286 dev = alloc_etherdev(PRIV_BYTES); 1286 1287 if (!dev) {
+2 -1
drivers/net/ibmveth.c
··· 702 702 desc[3].desc, 703 703 desc[4].desc, 704 704 desc[5].desc, 705 - correlator); 705 + correlator, 706 + &correlator); 706 707 } while ((lpar_rc == H_BUSY) && (retry_count--)); 707 708 708 709 if(lpar_rc != H_SUCCESS && lpar_rc != H_DROPPED) {
+15 -12
drivers/net/ibmveth.h
··· 41 41 #define IbmVethMcastRemoveFilter 0x2UL 42 42 #define IbmVethMcastClearFilterTable 0x3UL 43 43 44 - /* hcall numbers */ 45 - #define H_VIO_SIGNAL 0x104 46 - #define H_REGISTER_LOGICAL_LAN 0x114 47 - #define H_FREE_LOGICAL_LAN 0x118 48 - #define H_ADD_LOGICAL_LAN_BUFFER 0x11C 49 - #define H_SEND_LOGICAL_LAN 0x120 50 - #define H_MULTICAST_CTRL 0x130 51 - #define H_CHANGE_LOGICAL_LAN_MAC 0x14C 52 - #define H_FREE_LOGICAL_LAN_BUFFER 0x1D4 53 - 54 44 /* hcall macros */ 55 45 #define h_register_logical_lan(ua, buflst, rxq, fltlst, mac) \ 56 46 plpar_hcall_norets(H_REGISTER_LOGICAL_LAN, ua, buflst, rxq, fltlst, mac) ··· 51 61 #define h_add_logical_lan_buffer(ua, buf) \ 52 62 plpar_hcall_norets(H_ADD_LOGICAL_LAN_BUFFER, ua, buf) 53 63 54 - #define h_send_logical_lan(ua, buf1, buf2, buf3, buf4, buf5, buf6, correlator) \ 55 - plpar_hcall_8arg_2ret(H_SEND_LOGICAL_LAN, ua, buf1, buf2, buf3, buf4, buf5, buf6, correlator, &correlator) 64 + static inline long h_send_logical_lan(unsigned long unit_address, 65 + unsigned long desc1, unsigned long desc2, unsigned long desc3, 66 + unsigned long desc4, unsigned long desc5, unsigned long desc6, 67 + unsigned long corellator_in, unsigned long *corellator_out) 68 + { 69 + long rc; 70 + unsigned long retbuf[PLPAR_HCALL9_BUFSIZE]; 71 + 72 + rc = plpar_hcall9(H_SEND_LOGICAL_LAN, retbuf, unit_address, desc1, 73 + desc2, desc3, desc4, desc5, desc6, corellator_in); 74 + 75 + *corellator_out = retbuf[0]; 76 + 77 + return rc; 78 + } 56 79 57 80 #define h_multicast_ctrl(ua, cmd, mac) \ 58 81 plpar_hcall_norets(H_MULTICAST_CTRL, ua, cmd, mac)
+1 -1
drivers/net/mace.c
··· 113 113 struct device_node *mace = macio_get_of_node(mdev); 114 114 struct net_device *dev; 115 115 struct mace_data *mp; 116 - unsigned char *addr; 116 + const unsigned char *addr; 117 117 int j, rev, rc = -EBUSY; 118 118 119 119 if (macio_resource_count(mdev) != 3 || macio_irq_count(mdev) != 3) {
+6 -6
drivers/net/spider_net.c
··· 1697 1697 */ 1698 1698 static int 1699 1699 spider_net_download_firmware(struct spider_net_card *card, 1700 - u8 *firmware_ptr) 1700 + const void *firmware_ptr) 1701 1701 { 1702 1702 int sequencer, i; 1703 - u32 *fw_ptr = (u32 *)firmware_ptr; 1703 + const u32 *fw_ptr = firmware_ptr; 1704 1704 1705 1705 /* stop sequencers */ 1706 1706 spider_net_write_reg(card, SPIDER_NET_GSINIT, ··· 1757 1757 { 1758 1758 struct firmware *firmware = NULL; 1759 1759 struct device_node *dn; 1760 - u8 *fw_prop = NULL; 1760 + const u8 *fw_prop = NULL; 1761 1761 int err = -ENOENT; 1762 1762 int fw_size; 1763 1763 ··· 1783 1783 if (!dn) 1784 1784 goto out_err; 1785 1785 1786 - fw_prop = (u8 *)get_property(dn, "firmware", &fw_size); 1786 + fw_prop = get_property(dn, "firmware", &fw_size); 1787 1787 if (!fw_prop) 1788 1788 goto out_err; 1789 1789 ··· 1986 1986 struct net_device *netdev = card->netdev; 1987 1987 struct device_node *dn; 1988 1988 struct sockaddr addr; 1989 - u8 *mac; 1989 + const u8 *mac; 1990 1990 1991 1991 SET_MODULE_OWNER(netdev); 1992 1992 SET_NETDEV_DEV(netdev, &card->pdev->dev); ··· 2019 2019 if (!dn) 2020 2020 return -EIO; 2021 2021 2022 - mac = (u8 *)get_property(dn, "local-mac-address", NULL); 2022 + mac = get_property(dn, "local-mac-address", NULL); 2023 2023 if (!mac) 2024 2024 return -EIO; 2025 2025 memcpy(addr.sa_data, mac, ETH_ALEN);
+1 -1
drivers/net/sungem.c
··· 2896 2896 if (use_idprom) 2897 2897 memcpy(dev->dev_addr, idprom->id_ethaddr, 6); 2898 2898 #elif defined(CONFIG_PPC_PMAC) 2899 - unsigned char *addr; 2899 + const unsigned char *addr; 2900 2900 2901 2901 addr = get_property(gp->of_node, "local-mac-address", NULL); 2902 2902 if (addr == NULL) {
+16 -16
drivers/pci/hotplug/rpaphp_core.c
··· 176 176 return 0; 177 177 } 178 178 179 - static int get_children_props(struct device_node *dn, int **drc_indexes, 180 - int **drc_names, int **drc_types, int **drc_power_domains) 179 + static int get_children_props(struct device_node *dn, const int **drc_indexes, 180 + const int **drc_names, const int **drc_types, 181 + const int **drc_power_domains) 181 182 { 182 - int *indexes, *names; 183 - int *types, *domains; 183 + const int *indexes, *names, *types, *domains; 184 184 185 - indexes = (int *) get_property(dn, "ibm,drc-indexes", NULL); 186 - names = (int *) get_property(dn, "ibm,drc-names", NULL); 187 - types = (int *) get_property(dn, "ibm,drc-types", NULL); 188 - domains = (int *) get_property(dn, "ibm,drc-power-domains", NULL); 185 + indexes = get_property(dn, "ibm,drc-indexes", NULL); 186 + names = get_property(dn, "ibm,drc-names", NULL); 187 + types = get_property(dn, "ibm,drc-types", NULL); 188 + domains = get_property(dn, "ibm,drc-power-domains", NULL); 189 189 190 190 if (!indexes || !names || !types || !domains) { 191 191 /* Slot does not have dynamically-removable children */ ··· 212 212 int rpaphp_get_drc_props(struct device_node *dn, int *drc_index, 213 213 char **drc_name, char **drc_type, int *drc_power_domain) 214 214 { 215 - int *indexes, *names; 216 - int *types, *domains; 217 - unsigned int *my_index; 215 + const int *indexes, *names; 216 + const int *types, *domains; 217 + const unsigned int *my_index; 218 218 char *name_tmp, *type_tmp; 219 219 int i, rc; 220 220 221 - my_index = (int *) get_property(dn, "ibm,my-drc-index", NULL); 221 + my_index = get_property(dn, "ibm,my-drc-index", NULL); 222 222 if (!my_index) { 223 223 /* Node isn't DLPAR/hotplug capable */ 224 224 return -EINVAL; ··· 265 265 return 1; 266 266 } 267 267 268 - static int is_php_dn(struct device_node *dn, int **indexes, int **names, 269 - int **types, int **power_domains) 268 + static int is_php_dn(struct device_node *dn, const int **indexes, 269 + const int **names, const int **types, const int **power_domains) 270 270 { 271 - int *drc_types; 271 + const int *drc_types; 272 272 int rc; 273 273 274 274 rc = get_children_props(dn, indexes, names, &drc_types, power_domains); ··· 296 296 struct slot *slot; 297 297 int retval = 0; 298 298 int i; 299 - int *indexes, *names, *types, *power_domains; 299 + const int *indexes, *names, *types, *power_domains; 300 300 char *name, *type; 301 301 302 302 dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name);
+4 -7
drivers/scsi/ibmvscsi/rpa_vscsi.c
··· 156 156 { 157 157 struct device_node *rootdn; 158 158 159 - char *ppartition_name; 160 - unsigned int *p_number_ptr; 159 + const char *ppartition_name; 160 + const unsigned int *p_number_ptr; 161 161 162 162 /* Retrieve information about this partition */ 163 163 rootdn = find_path_device("/"); ··· 165 165 return; 166 166 } 167 167 168 - ppartition_name = 169 - get_property(rootdn, "ibm,partition-name", NULL); 168 + ppartition_name = get_property(rootdn, "ibm,partition-name", NULL); 170 169 if (ppartition_name) 171 170 strncpy(partition_name, ppartition_name, 172 171 sizeof(partition_name)); 173 - p_number_ptr = 174 - (unsigned int *)get_property(rootdn, "ibm,partition-no", 175 - NULL); 172 + p_number_ptr = get_property(rootdn, "ibm,partition-no", NULL); 176 173 if (p_number_ptr) 177 174 partition_number = *p_number_ptr; 178 175 }
+1 -1
drivers/scsi/mac53c94.c
··· 431 431 struct fsc_state *state; 432 432 struct Scsi_Host *host; 433 433 void *dma_cmd_space; 434 - unsigned char *clkprop; 434 + const unsigned char *clkprop; 435 435 int proplen, rc = -ENODEV; 436 436 437 437 if (macio_resource_count(mdev) != 2 || macio_irq_count(mdev) != 2) {
+3 -2
drivers/scsi/mesh.c
··· 1850 1850 { 1851 1851 struct device_node *mesh = macio_get_of_node(mdev); 1852 1852 struct pci_dev* pdev = macio_get_pci_dev(mdev); 1853 - int tgt, *cfp, minper; 1853 + int tgt, minper; 1854 + const int *cfp; 1854 1855 struct mesh_state *ms; 1855 1856 struct Scsi_Host *mesh_host; 1856 1857 void *dma_cmd_space; ··· 1940 1939 ms->tgts[tgt].current_req = NULL; 1941 1940 } 1942 1941 1943 - if ((cfp = (int *) get_property(mesh, "clock-frequency", NULL))) 1942 + if ((cfp = get_property(mesh, "clock-frequency", NULL))) 1944 1943 ms->clk_freq = *cfp; 1945 1944 else { 1946 1945 printk(KERN_INFO "mesh: assuming 50MHz clock frequency\n");
+1 -1
drivers/scsi/sata_svw.c
··· 268 268 /* Match it to a port node */ 269 269 index = (ap == ap->host_set->ports[0]) ? 0 : 1; 270 270 for (np = np->child; np != NULL; np = np->sibling) { 271 - u32 *reg = (u32 *)get_property(np, "reg", NULL); 271 + const u32 *reg = get_property(np, "reg", NULL); 272 272 if (!reg) 273 273 continue; 274 274 if (index == *reg)
+5 -4
drivers/serial/pmac_zilog.c
··· 1400 1400 static int __init pmz_init_port(struct uart_pmac_port *uap) 1401 1401 { 1402 1402 struct device_node *np = uap->node; 1403 - char *conn; 1404 - struct slot_names_prop { 1403 + const char *conn; 1404 + const struct slot_names_prop { 1405 1405 int count; 1406 1406 char name[1]; 1407 1407 } *slots; ··· 1458 1458 uap->flags |= PMACZILOG_FLAG_IS_IRDA; 1459 1459 uap->port_type = PMAC_SCC_ASYNC; 1460 1460 /* 1999 Powerbook G3 has slot-names property instead */ 1461 - slots = (struct slot_names_prop *)get_property(np, "slot-names", &len); 1461 + slots = get_property(np, "slot-names", &len); 1462 1462 if (slots && slots->count > 0) { 1463 1463 if (strcmp(slots->name, "IrDA") == 0) 1464 1464 uap->flags |= PMACZILOG_FLAG_IS_IRDA; ··· 1470 1470 if (ZS_IS_INTMODEM(uap)) { 1471 1471 struct device_node* i2c_modem = find_devices("i2c-modem"); 1472 1472 if (i2c_modem) { 1473 - char* mid = get_property(i2c_modem, "modem-id", NULL); 1473 + const char* mid = 1474 + get_property(i2c_modem, "modem-id", NULL); 1474 1475 if (mid) switch(*mid) { 1475 1476 case 0x04 : 1476 1477 case 0x05 :
+6 -6
drivers/video/S3triofb.c
··· 349 349 s3trio_name[sizeof(s3trio_name)-1] = '\0'; 350 350 strcpy(fb_fix.id, s3trio_name); 351 351 352 - if((pp = (int *)get_property(dp, "vendor-id", &len)) != NULL 352 + if((pp = get_property(dp, "vendor-id", &len)) != NULL 353 353 && *pp!=PCI_VENDOR_ID_S3) { 354 354 printk("%s: can't find S3 Trio board\n", dp->full_name); 355 355 return; 356 356 } 357 357 358 - if((pp = (int *)get_property(dp, "device-id", &len)) != NULL 358 + if((pp = get_property(dp, "device-id", &len)) != NULL 359 359 && *pp!=PCI_DEVICE_ID_S3_TRIO) { 360 360 printk("%s: can't find S3 Trio board\n", dp->full_name); 361 361 return; 362 362 } 363 363 364 - if ((pp = (int *)get_property(dp, "depth", &len)) != NULL 364 + if ((pp = get_property(dp, "depth", &len)) != NULL 365 365 && len == sizeof(int) && *pp != 8) { 366 366 printk("%s: can't use depth = %d\n", dp->full_name, *pp); 367 367 return; 368 368 } 369 - if ((pp = (int *)get_property(dp, "width", &len)) != NULL 369 + if ((pp = get_property(dp, "width", &len)) != NULL 370 370 && len == sizeof(int)) 371 371 fb_var.xres = fb_var.xres_virtual = *pp; 372 - if ((pp = (int *)get_property(dp, "height", &len)) != NULL 372 + if ((pp = get_property(dp, "height", &len)) != NULL 373 373 && len == sizeof(int)) 374 374 fb_var.yres = fb_var.yres_virtual = *pp; 375 - if ((pp = (int *)get_property(dp, "linebytes", &len)) != NULL 375 + if ((pp = get_property(dp, "linebytes", &len)) != NULL 376 376 && len == sizeof(int)) 377 377 fb_fix.line_length = *pp; 378 378 else
+4 -4
drivers/video/aty/radeon_base.c
··· 413 413 static int __devinit radeon_read_xtal_OF (struct radeonfb_info *rinfo) 414 414 { 415 415 struct device_node *dp = rinfo->of_node; 416 - u32 *val; 416 + const u32 *val; 417 417 418 418 if (dp == NULL) 419 419 return -ENODEV; 420 - val = (u32 *) get_property(dp, "ATY,RefCLK", NULL); 420 + val = get_property(dp, "ATY,RefCLK", NULL); 421 421 if (!val || !*val) { 422 422 printk(KERN_WARNING "radeonfb: No ATY,RefCLK property !\n"); 423 423 return -EINVAL; ··· 425 425 426 426 rinfo->pll.ref_clk = (*val) / 10; 427 427 428 - val = (u32 *) get_property(dp, "ATY,SCLK", NULL); 428 + val = get_property(dp, "ATY,SCLK", NULL); 429 429 if (val && *val) 430 430 rinfo->pll.sclk = (*val) / 10; 431 431 432 - val = (u32 *) get_property(dp, "ATY,MCLK", NULL); 432 + val = get_property(dp, "ATY,MCLK", NULL); 433 433 if (val && *val) 434 434 rinfo->pll.mclk = (*val) / 10; 435 435
+6 -6
drivers/video/aty/radeon_monitor.c
··· 64 64 { 65 65 static char *propnames[] = { "DFP,EDID", "LCD,EDID", "EDID", 66 66 "EDID1", "EDID2", NULL }; 67 - u8 *pedid = NULL; 68 - u8 *pmt = NULL; 67 + const u8 *pedid = NULL; 68 + const u8 *pmt = NULL; 69 69 u8 *tmp; 70 70 int i, mt = MT_NONE; 71 71 72 72 RTRACE("analyzing OF properties...\n"); 73 - pmt = (u8 *)get_property(dp, "display-type", NULL); 73 + pmt = get_property(dp, "display-type", NULL); 74 74 if (!pmt) 75 75 return MT_NONE; 76 76 RTRACE("display-type: %s\n", pmt); ··· 89 89 } 90 90 91 91 for (i = 0; propnames[i] != NULL; ++i) { 92 - pedid = (u8 *)get_property(dp, propnames[i], NULL); 92 + pedid = get_property(dp, propnames[i], NULL); 93 93 if (pedid != NULL) 94 94 break; 95 95 } ··· 124 124 return MT_NONE; 125 125 126 126 if (rinfo->has_CRTC2) { 127 - char *pname; 127 + const char *pname; 128 128 int len, second = 0; 129 129 130 130 dp = dp->child; 131 131 do { 132 132 if (!dp) 133 133 return MT_NONE; 134 - pname = (char *)get_property(dp, "name", NULL); 134 + pname = get_property(dp, "name", NULL); 135 135 if (!pname) 136 136 return MT_NONE; 137 137 len = strlen(pname);
+2 -2
drivers/video/aty/radeon_pm.c
··· 1268 1268 0x21320032, 0xa1320032, 0x21320032, 0xffffffff, 1269 1269 0x31320032 }; 1270 1270 1271 - u32 *mrtable = default_mrtable; 1271 + const u32 *mrtable = default_mrtable; 1272 1272 int i, mrtable_size = ARRAY_SIZE(default_mrtable); 1273 1273 1274 1274 mdelay(30); ··· 1287 1287 if (rinfo->of_node != NULL) { 1288 1288 int size; 1289 1289 1290 - mrtable = (u32 *)get_property(rinfo->of_node, "ATY,MRT", &size); 1290 + mrtable = get_property(rinfo->of_node, "ATY,MRT", &size); 1291 1291 if (mrtable) 1292 1292 mrtable_size = size >> 2; 1293 1293 else
+5 -7
drivers/video/nvidia/nv_of.c
··· 32 32 { 33 33 struct nvidia_par *par = info->par; 34 34 struct device_node *parent, *dp; 35 - unsigned char *pedid = NULL; 35 + const unsigned char *pedid = NULL; 36 36 static char *propnames[] = { 37 37 "DFP,EDID", "LCD,EDID", "EDID", "EDID1", 38 38 "EDID,B", "EDID,A", NULL }; ··· 42 42 if (parent == NULL) 43 43 return -1; 44 44 if (par->twoHeads) { 45 - char *pname; 45 + const char *pname; 46 46 int len; 47 47 48 48 for (dp = NULL; 49 49 (dp = of_get_next_child(parent, dp)) != NULL;) { 50 - pname = (char *)get_property(dp, "name", NULL); 50 + pname = get_property(dp, "name", NULL); 51 51 if (!pname) 52 52 continue; 53 53 len = strlen(pname); 54 54 if ((pname[len-1] == 'A' && conn == 1) || 55 55 (pname[len-1] == 'B' && conn == 2)) { 56 56 for (i = 0; propnames[i] != NULL; ++i) { 57 - pedid = (unsigned char *) 58 - get_property(dp, propnames[i], 57 + pedid = get_property(dp, propnames[i], 59 58 NULL); 60 59 if (pedid != NULL) 61 60 break; ··· 66 67 } 67 68 if (pedid == NULL) { 68 69 for (i = 0; propnames[i] != NULL; ++i) { 69 - pedid = (unsigned char *) 70 - get_property(parent, propnames[i], NULL); 70 + pedid = get_property(parent, propnames[i], NULL); 71 71 if (pedid != NULL) 72 72 break; 73 73 }
+11 -11
drivers/video/offb.c
··· 409 409 unsigned int flags, rsize, addr_prop = 0; 410 410 unsigned long max_size = 0; 411 411 u64 rstart, address = OF_BAD_ADDR; 412 - u32 *pp, *addrp, *up; 412 + const u32 *pp, *addrp, *up; 413 413 u64 asize; 414 414 415 - pp = (u32 *)get_property(dp, "linux,bootx-depth", &len); 415 + pp = get_property(dp, "linux,bootx-depth", &len); 416 416 if (pp == NULL) 417 - pp = (u32 *)get_property(dp, "depth", &len); 417 + pp = get_property(dp, "depth", &len); 418 418 if (pp && len == sizeof(u32)) 419 419 depth = *pp; 420 420 421 - pp = (u32 *)get_property(dp, "linux,bootx-width", &len); 421 + pp = get_property(dp, "linux,bootx-width", &len); 422 422 if (pp == NULL) 423 - pp = (u32 *)get_property(dp, "width", &len); 423 + pp = get_property(dp, "width", &len); 424 424 if (pp && len == sizeof(u32)) 425 425 width = *pp; 426 426 427 - pp = (u32 *)get_property(dp, "linux,bootx-height", &len); 427 + pp = get_property(dp, "linux,bootx-height", &len); 428 428 if (pp == NULL) 429 - pp = (u32 *)get_property(dp, "height", &len); 429 + pp = get_property(dp, "height", &len); 430 430 if (pp && len == sizeof(u32)) 431 431 height = *pp; 432 432 433 - pp = (u32 *)get_property(dp, "linux,bootx-linebytes", &len); 433 + pp = get_property(dp, "linux,bootx-linebytes", &len); 434 434 if (pp == NULL) 435 - pp = (u32 *)get_property(dp, "linebytes", &len); 435 + pp = get_property(dp, "linebytes", &len); 436 436 if (pp && len == sizeof(u32)) 437 437 pitch = *pp; 438 438 else ··· 450 450 * ranges and pick one that is both big enough and if possible encloses 451 451 * the "address" property. If none match, we pick the biggest 452 452 */ 453 - up = (u32 *)get_property(dp, "linux,bootx-addr", &len); 453 + up = get_property(dp, "linux,bootx-addr", &len); 454 454 if (up == NULL) 455 - up = (u32 *)get_property(dp, "address", &len); 455 + up = get_property(dp, "address", &len); 456 456 if (up && len == sizeof(u32)) 457 457 addr_prop = *up; 458 458
+2 -3
drivers/video/riva/fbdev.c
··· 1835 1835 NVTRACE_ENTER(); 1836 1836 dp = pci_device_to_OF_node(pd); 1837 1837 for (; dp != NULL; dp = dp->child) { 1838 - disptype = (unsigned char *)get_property(dp, "display-type", NULL); 1838 + disptype = get_property(dp, "display-type", NULL); 1839 1839 if (disptype == NULL) 1840 1840 continue; 1841 1841 if (strncmp(disptype, "LCD", 3) != 0) 1842 1842 continue; 1843 1843 for (i = 0; propnames[i] != NULL; ++i) { 1844 - pedid = (unsigned char *) 1845 - get_property(dp, propnames[i], NULL); 1844 + pedid = get_property(dp, propnames[i], NULL); 1846 1845 if (pedid != NULL) { 1847 1846 par->EDID = pedid; 1848 1847 NVTRACE("LCD found.\n");
+18 -9
include/asm-powerpc/cputable.h
··· 23 23 #define PPC_FEATURE_SMT 0x00004000 24 24 #define PPC_FEATURE_ICACHE_SNOOP 0x00002000 25 25 #define PPC_FEATURE_ARCH_2_05 0x00001000 26 + #define PPC_FEATURE_PA6T 0x00000800 26 27 27 28 #define PPC_FEATURE_TRUE_LE 0x00000002 28 29 #define PPC_FEATURE_PPC_LE 0x00000001 ··· 37 36 struct cpu_spec; 38 37 39 38 typedef void (*cpu_setup_t)(unsigned long offset, struct cpu_spec* spec); 39 + typedef void (*cpu_restore_t)(void); 40 40 41 41 enum powerpc_oprofile_type { 42 42 PPC_OPROFILE_INVALID = 0, ··· 67 65 * BHT, SPD, etc... from head.S before branching to identify_machine 68 66 */ 69 67 cpu_setup_t cpu_setup; 68 + /* Used to restore cpu setup on secondary processors and at resume */ 69 + cpu_restore_t cpu_restore; 70 70 71 71 /* Used by oprofile userspace to select the right counters */ 72 72 char *oprofile_cpu_type; ··· 149 145 150 146 #define CPU_FTR_PPCAS_ARCH_V2_BASE (CPU_FTR_SLB | \ 151 147 CPU_FTR_TLBIEL | CPU_FTR_NOEXECUTE | \ 152 - CPU_FTR_NODSISRALIGN | CPU_FTR_CTRL) 148 + CPU_FTR_NODSISRALIGN) 153 149 154 150 /* iSeries doesn't support large pages */ 155 151 #ifdef CONFIG_PPC_ISERIES ··· 314 310 CPU_FTR_HPTE_TABLE | CPU_FTR_IABR | \ 315 311 CPU_FTR_MMCRA | CPU_FTR_CTRL) 316 312 #define CPU_FTRS_POWER4 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 317 - CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_MMCRA) 313 + CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 314 + CPU_FTR_MMCRA) 318 315 #define CPU_FTRS_PPC970 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 319 - CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 316 + CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 320 317 CPU_FTR_ALTIVEC_COMP | CPU_FTR_CAN_NAP | CPU_FTR_MMCRA) 321 318 #define CPU_FTRS_POWER5 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 322 - CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 319 + CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 323 320 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 324 321 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 325 322 CPU_FTR_PURR) 326 323 #define CPU_FTRS_POWER6 (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 327 - CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 324 + CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 328 325 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 329 326 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 330 327 CPU_FTR_PURR | CPU_FTR_CI_LARGE_PAGE | CPU_FTR_REAL_LE) 331 328 #define CPU_FTRS_CELL (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 332 - CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 329 + CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 333 330 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 334 - CPU_FTR_CTRL | CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE) 331 + CPU_FTR_PAUSE_ZERO | CPU_FTR_CI_LARGE_PAGE) 332 + #define CPU_FTRS_PA6T (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 333 + CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2 | \ 334 + CPU_FTR_ALTIVEC_COMP | CPU_FTR_CI_LARGE_PAGE | \ 335 + CPU_FTR_PURR | CPU_FTR_REAL_LE) 335 336 #define CPU_FTRS_COMPATIBLE (CPU_FTR_SPLIT_ID_CACHE | CPU_FTR_USE_TB | \ 336 337 CPU_FTR_HPTE_TABLE | CPU_FTR_PPCAS_ARCH_V2) 337 338 #endif ··· 345 336 #define CPU_FTRS_POSSIBLE \ 346 337 (CPU_FTRS_POWER3 | CPU_FTRS_RS64 | CPU_FTRS_POWER4 | \ 347 338 CPU_FTRS_PPC970 | CPU_FTRS_POWER5 | CPU_FTRS_POWER6 | \ 348 - CPU_FTRS_CELL | CPU_FTR_CI_LARGE_PAGE) 339 + CPU_FTRS_CELL | CPU_FTRS_PA6T) 349 340 #else 350 341 enum { 351 342 CPU_FTRS_POSSIBLE = ··· 384 375 #define CPU_FTRS_ALWAYS \ 385 376 (CPU_FTRS_POWER3 & CPU_FTRS_RS64 & CPU_FTRS_POWER4 & \ 386 377 CPU_FTRS_PPC970 & CPU_FTRS_POWER5 & CPU_FTRS_POWER6 & \ 387 - CPU_FTRS_CELL & CPU_FTRS_POSSIBLE) 378 + CPU_FTRS_CELL & CPU_FTRS_PA6T & CPU_FTRS_POSSIBLE) 388 379 #else 389 380 enum { 390 381 CPU_FTRS_ALWAYS =
+42 -79
include/asm-powerpc/hvcall.h
··· 164 164 #define H_VIO_SIGNAL 0x104 165 165 #define H_SEND_CRQ 0x108 166 166 #define H_COPY_RDMA 0x110 167 + #define H_REGISTER_LOGICAL_LAN 0x114 168 + #define H_FREE_LOGICAL_LAN 0x118 169 + #define H_ADD_LOGICAL_LAN_BUFFER 0x11C 170 + #define H_SEND_LOGICAL_LAN 0x120 171 + #define H_MULTICAST_CTRL 0x130 167 172 #define H_SET_XDABR 0x134 168 173 #define H_STUFF_TCE 0x138 169 174 #define H_PUT_TCE_INDIRECT 0x13C 175 + #define H_CHANGE_LOGICAL_LAN_MAC 0x14C 170 176 #define H_VTERM_PARTNER_INFO 0x150 171 177 #define H_REGISTER_VTERM 0x154 172 178 #define H_FREE_VTERM 0x158 ··· 202 196 #define H_GET_HCA_INFO 0x1B8 203 197 #define H_GET_PERF_COUNT 0x1BC 204 198 #define H_MANAGE_TRACE 0x1C0 199 + #define H_FREE_LOGICAL_LAN_BUFFER 0x1D4 205 200 #define H_QUERY_INT_STATE 0x1E4 206 201 #define H_POLL_PENDING 0x1D8 207 202 #define H_JOIN 0x298 208 203 #define H_VASI_STATE 0x2A4 209 204 #define H_ENABLE_CRQ 0x2B0 205 + #define MAX_HCALL_OPCODE H_ENABLE_CRQ 210 206 211 207 #ifndef __ASSEMBLY__ 212 208 213 - /* plpar_hcall() -- Generic call interface using above opcodes 209 + /** 210 + * plpar_hcall_norets: - Make a pseries hypervisor call with no return arguments 211 + * @opcode: The hypervisor call to make. 214 212 * 215 - * The actual call interface is a hypervisor call instruction with 216 - * the opcode in R3 and input args in R4-R7. 217 - * Status is returned in R3 with variable output values in R4-R11. 218 - * Only H_PTE_READ with H_READ_4 uses R6-R11 so we ignore it for now 219 - * and return only two out args which MUST ALWAYS BE PROVIDED. 220 - */ 221 - long plpar_hcall(unsigned long opcode, 222 - unsigned long arg1, 223 - unsigned long arg2, 224 - unsigned long arg3, 225 - unsigned long arg4, 226 - unsigned long *out1, 227 - unsigned long *out2, 228 - unsigned long *out3); 229 - 230 - /* Same as plpar_hcall but for those opcodes that return no values 231 - * other than status. Slightly more efficient. 213 + * This call supports up to 7 arguments and only returns the status of 214 + * the hcall. Use this version where possible, its slightly faster than 215 + * the other plpar_hcalls. 232 216 */ 233 217 long plpar_hcall_norets(unsigned long opcode, ...); 234 218 235 - /* 236 - * Special hcall interface for ibmveth support. 237 - * Takes 8 input parms. Returns a rc and stores the 238 - * R4 return value in *out1. 239 - */ 240 - long plpar_hcall_8arg_2ret(unsigned long opcode, 241 - unsigned long arg1, 242 - unsigned long arg2, 243 - unsigned long arg3, 244 - unsigned long arg4, 245 - unsigned long arg5, 246 - unsigned long arg6, 247 - unsigned long arg7, 248 - unsigned long arg8, 249 - unsigned long *out1); 250 - 251 - /* plpar_hcall_4out() 219 + /** 220 + * plpar_hcall: - Make a pseries hypervisor call 221 + * @opcode: The hypervisor call to make. 222 + * @retbuf: Buffer to store up to 4 return arguments in. 252 223 * 253 - * same as plpar_hcall except with 4 output arguments. 224 + * This call supports up to 6 arguments and 4 return arguments. Use 225 + * PLPAR_HCALL_BUFSIZE to size the return argument buffer. 254 226 * 227 + * Used for all but the craziest of phyp interfaces (see plpar_hcall9) 255 228 */ 256 - long plpar_hcall_4out(unsigned long opcode, 257 - unsigned long arg1, 258 - unsigned long arg2, 259 - unsigned long arg3, 260 - unsigned long arg4, 261 - unsigned long *out1, 262 - unsigned long *out2, 263 - unsigned long *out3, 264 - unsigned long *out4); 229 + #define PLPAR_HCALL_BUFSIZE 4 230 + long plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...); 265 231 266 - long plpar_hcall_7arg_7ret(unsigned long opcode, 267 - unsigned long arg1, 268 - unsigned long arg2, 269 - unsigned long arg3, 270 - unsigned long arg4, 271 - unsigned long arg5, 272 - unsigned long arg6, 273 - unsigned long arg7, 274 - unsigned long *out1, 275 - unsigned long *out2, 276 - unsigned long *out3, 277 - unsigned long *out4, 278 - unsigned long *out5, 279 - unsigned long *out6, 280 - unsigned long *out7); 232 + /** 233 + * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments 234 + * @opcode: The hypervisor call to make. 235 + * @retbuf: Buffer to store up to 9 return arguments in. 236 + * 237 + * This call supports up to 9 arguments and 9 return arguments. Use 238 + * PLPAR_HCALL9_BUFSIZE to size the return argument buffer. 239 + */ 240 + #define PLPAR_HCALL9_BUFSIZE 9 241 + long plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...); 281 242 282 - long plpar_hcall_9arg_9ret(unsigned long opcode, 283 - unsigned long arg1, 284 - unsigned long arg2, 285 - unsigned long arg3, 286 - unsigned long arg4, 287 - unsigned long arg5, 288 - unsigned long arg6, 289 - unsigned long arg7, 290 - unsigned long arg8, 291 - unsigned long arg9, 292 - unsigned long *out1, 293 - unsigned long *out2, 294 - unsigned long *out3, 295 - unsigned long *out4, 296 - unsigned long *out5, 297 - unsigned long *out6, 298 - unsigned long *out7, 299 - unsigned long *out8, 300 - unsigned long *out9); 243 + /* For hcall instrumentation. One structure per-hcall, per-CPU */ 244 + struct hcall_stats { 245 + unsigned long num_calls; /* number of calls (on this CPU) */ 246 + unsigned long tb_total; /* total wall time (mftb) of calls. */ 247 + unsigned long purr_total; /* total cpu time (PURR) of calls. */ 248 + }; 249 + void update_hcall_stats(unsigned long opcode, unsigned long tb_delta, 250 + unsigned long purr_delta); 251 + #define HCALL_STAT_ARRAY_SIZE ((MAX_HCALL_OPCODE >> 2) + 1) 301 252 302 253 #endif /* __ASSEMBLY__ */ 303 254 #endif /* __KERNEL__ */
+1 -1
include/asm-powerpc/ibmebus.h
··· 48 48 extern struct bus_type ibmebus_bus_type; 49 49 50 50 struct ibmebus_dev { 51 - char *name; 51 + const char *name; 52 52 struct of_device ofdev; 53 53 }; 54 54
+6 -6
include/asm-powerpc/ide.h
··· 12 12 #include <linux/sched.h> 13 13 #include <asm/mpc8xx.h> 14 14 #endif 15 + #include <asm/io.h> 15 16 16 17 #ifndef MAX_HWIFS 17 18 #ifdef __powerpc64__ ··· 22 21 #endif 23 22 #endif 24 23 24 + #define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c)) 25 + #define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c)) 26 + #define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c)) 27 + #define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c)) 28 + 25 29 #ifndef __powerpc64__ 26 30 #include <linux/hdreg.h> 27 31 #include <linux/ioport.h> 28 - #include <asm/io.h> 29 - 30 - extern void __ide_mm_insw(void __iomem *port, void *addr, u32 count); 31 - extern void __ide_mm_outsw(void __iomem *port, void *addr, u32 count); 32 - extern void __ide_mm_insl(void __iomem *port, void *addr, u32 count); 33 - extern void __ide_mm_outsl(void __iomem *port, void *addr, u32 count); 34 32 35 33 struct ide_machdep_calls { 36 34 int (*default_irq)(unsigned long base);
+83 -98
include/asm-powerpc/io.h
··· 20 20 #include <asm/page.h> 21 21 #include <asm/byteorder.h> 22 22 #include <asm/paca.h> 23 - #ifdef CONFIG_PPC_ISERIES 24 - #include <asm/iseries/iseries_io.h> 25 - #endif 26 23 #include <asm/synch.h> 27 24 #include <asm/delay.h> 28 25 29 26 #include <asm-generic/iomap.h> 30 - 31 - #define __ide_mm_insw(p, a, c) _insw_ns((volatile u16 __iomem *)(p), (a), (c)) 32 - #define __ide_mm_insl(p, a, c) _insl_ns((volatile u32 __iomem *)(p), (a), (c)) 33 - #define __ide_mm_outsw(p, a, c) _outsw_ns((volatile u16 __iomem *)(p), (a), (c)) 34 - #define __ide_mm_outsl(p, a, c) _outsl_ns((volatile u32 __iomem *)(p), (a), (c)) 35 - 36 27 37 28 #define SIO_CONFIG_RA 0x398 38 29 #define SIO_CONFIG_RD 0x399 ··· 34 43 extern unsigned long pci_io_base; 35 44 36 45 #ifdef CONFIG_PPC_ISERIES 37 - /* __raw_* accessors aren't supported on iSeries */ 38 - #define __raw_readb(addr) { BUG(); 0; } 39 - #define __raw_readw(addr) { BUG(); 0; } 40 - #define __raw_readl(addr) { BUG(); 0; } 41 - #define __raw_readq(addr) { BUG(); 0; } 42 - #define __raw_writeb(v, addr) { BUG(); 0; } 43 - #define __raw_writew(v, addr) { BUG(); 0; } 44 - #define __raw_writel(v, addr) { BUG(); 0; } 45 - #define __raw_writeq(v, addr) { BUG(); 0; } 46 - #define readb(addr) iSeries_Read_Byte(addr) 47 - #define readw(addr) iSeries_Read_Word(addr) 48 - #define readl(addr) iSeries_Read_Long(addr) 49 - #define writeb(data, addr) iSeries_Write_Byte((data),(addr)) 50 - #define writew(data, addr) iSeries_Write_Word((data),(addr)) 51 - #define writel(data, addr) iSeries_Write_Long((data),(addr)) 52 - #define memset_io(a,b,c) iSeries_memset_io((a),(b),(c)) 53 - #define memcpy_fromio(a,b,c) iSeries_memcpy_fromio((a), (b), (c)) 54 - #define memcpy_toio(a,b,c) iSeries_memcpy_toio((a), (b), (c)) 55 46 56 - #define inb(addr) readb(((void __iomem *)(long)(addr))) 57 - #define inw(addr) readw(((void __iomem *)(long)(addr))) 58 - #define inl(addr) readl(((void __iomem *)(long)(addr))) 59 - #define outb(data,addr) writeb(data,((void __iomem *)(long)(addr))) 60 - #define outw(data,addr) writew(data,((void __iomem *)(long)(addr))) 61 - #define outl(data,addr) writel(data,((void __iomem *)(long)(addr))) 62 - /* 63 - * The *_ns versions below don't do byte-swapping. 64 - * Neither do the standard versions now, these are just here 65 - * for older code. 66 - */ 67 - #define insb(port, buf, ns) _insb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) 68 - #define insw(port, buf, ns) _insw_ns((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) 69 - #define insl(port, buf, nl) _insl_ns((u8 __iomem *)((port)+pci_io_base), (buf), (nl)) 70 - #define insw_ns(port, buf, ns) _insw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) 71 - #define insl_ns(port, buf, nl) _insl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) 72 - #else 47 + extern int in_8(const volatile unsigned char __iomem *addr); 48 + extern void out_8(volatile unsigned char __iomem *addr, int val); 49 + extern int in_le16(const volatile unsigned short __iomem *addr); 50 + extern int in_be16(const volatile unsigned short __iomem *addr); 51 + extern void out_le16(volatile unsigned short __iomem *addr, int val); 52 + extern void out_be16(volatile unsigned short __iomem *addr, int val); 53 + extern unsigned in_le32(const volatile unsigned __iomem *addr); 54 + extern unsigned in_be32(const volatile unsigned __iomem *addr); 55 + extern void out_le32(volatile unsigned __iomem *addr, int val); 56 + extern void out_be32(volatile unsigned __iomem *addr, int val); 57 + extern unsigned long in_le64(const volatile unsigned long __iomem *addr); 58 + extern unsigned long in_be64(const volatile unsigned long __iomem *addr); 59 + extern void out_le64(volatile unsigned long __iomem *addr, unsigned long val); 60 + extern void out_be64(volatile unsigned long __iomem *addr, unsigned long val); 61 + 62 + extern unsigned char __raw_readb(const volatile void __iomem *addr); 63 + extern unsigned short __raw_readw(const volatile void __iomem *addr); 64 + extern unsigned int __raw_readl(const volatile void __iomem *addr); 65 + extern unsigned long __raw_readq(const volatile void __iomem *addr); 66 + extern void __raw_writeb(unsigned char v, volatile void __iomem *addr); 67 + extern void __raw_writew(unsigned short v, volatile void __iomem *addr); 68 + extern void __raw_writel(unsigned int v, volatile void __iomem *addr); 69 + extern void __raw_writeq(unsigned long v, volatile void __iomem *addr); 70 + 71 + extern void memset_io(volatile void __iomem *addr, int c, unsigned long n); 72 + extern void memcpy_fromio(void *dest, const volatile void __iomem *src, 73 + unsigned long n); 74 + extern void memcpy_toio(volatile void __iomem *dest, const void *src, 75 + unsigned long n); 76 + 77 + #else /* CONFIG_PPC_ISERIES */ 78 + 79 + #define in_8(addr) __in_8((addr)) 80 + #define out_8(addr, val) __out_8((addr), (val)) 81 + #define in_le16(addr) __in_le16((addr)) 82 + #define in_be16(addr) __in_be16((addr)) 83 + #define out_le16(addr, val) __out_le16((addr), (val)) 84 + #define out_be16(addr, val) __out_be16((addr), (val)) 85 + #define in_le32(addr) __in_le32((addr)) 86 + #define in_be32(addr) __in_be32((addr)) 87 + #define out_le32(addr, val) __out_le32((addr), (val)) 88 + #define out_be32(addr, val) __out_be32((addr), (val)) 89 + #define in_le64(addr) __in_le64((addr)) 90 + #define in_be64(addr) __in_be64((addr)) 91 + #define out_le64(addr, val) __out_le64((addr), (val)) 92 + #define out_be64(addr, val) __out_be64((addr), (val)) 73 93 74 94 static inline unsigned char __raw_readb(const volatile void __iomem *addr) 75 95 { ··· 114 112 { 115 113 *(volatile unsigned long __force *)addr = v; 116 114 } 117 - #define readb(addr) eeh_readb(addr) 118 - #define readw(addr) eeh_readw(addr) 119 - #define readl(addr) eeh_readl(addr) 120 - #define readq(addr) eeh_readq(addr) 121 - #define writeb(data, addr) eeh_writeb((data), (addr)) 122 - #define writew(data, addr) eeh_writew((data), (addr)) 123 - #define writel(data, addr) eeh_writel((data), (addr)) 124 - #define writeq(data, addr) eeh_writeq((data), (addr)) 125 115 #define memset_io(a,b,c) eeh_memset_io((a),(b),(c)) 126 116 #define memcpy_fromio(a,b,c) eeh_memcpy_fromio((a),(b),(c)) 127 117 #define memcpy_toio(a,b,c) eeh_memcpy_toio((a),(b),(c)) 128 - #define inb(port) eeh_inb((unsigned long)port) 129 - #define outb(val, port) eeh_outb(val, (unsigned long)port) 130 - #define inw(port) eeh_inw((unsigned long)port) 131 - #define outw(val, port) eeh_outw(val, (unsigned long)port) 132 - #define inl(port) eeh_inl((unsigned long)port) 133 - #define outl(val, port) eeh_outl(val, (unsigned long)port) 118 + 119 + #endif /* CONFIG_PPC_ISERIES */ 134 120 135 121 /* 136 122 * The insw/outsw/insl/outsl macros don't do byte-swapping. ··· 128 138 #define insb(port, buf, ns) eeh_insb((port), (buf), (ns)) 129 139 #define insw(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) 130 140 #define insl(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) 131 - #define insw_ns(port, buf, ns) eeh_insw_ns((port), (buf), (ns)) 132 - #define insl_ns(port, buf, nl) eeh_insl_ns((port), (buf), (nl)) 133 - 134 - #endif 135 141 136 142 #define outsb(port, buf, ns) _outsb((u8 __iomem *)((port)+pci_io_base), (buf), (ns)) 137 143 #define outsw(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) 138 144 #define outsl(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) 145 + 146 + #define readb(addr) eeh_readb(addr) 147 + #define readw(addr) eeh_readw(addr) 148 + #define readl(addr) eeh_readl(addr) 149 + #define readq(addr) eeh_readq(addr) 150 + #define writeb(data, addr) eeh_writeb((data), (addr)) 151 + #define writew(data, addr) eeh_writew((data), (addr)) 152 + #define writel(data, addr) eeh_writel((data), (addr)) 153 + #define writeq(data, addr) eeh_writeq((data), (addr)) 154 + #define inb(port) eeh_inb((unsigned long)port) 155 + #define outb(val, port) eeh_outb(val, (unsigned long)port) 156 + #define inw(port) eeh_inw((unsigned long)port) 157 + #define outw(val, port) eeh_outw(val, (unsigned long)port) 158 + #define inl(port) eeh_inl((unsigned long)port) 159 + #define outl(val, port) eeh_outl(val, (unsigned long)port) 139 160 140 161 #define readb_relaxed(addr) readb(addr) 141 162 #define readw_relaxed(addr) readw(addr) 142 163 #define readl_relaxed(addr) readl(addr) 143 164 #define readq_relaxed(addr) readq(addr) 144 165 145 - extern void _insb(volatile u8 __iomem *port, void *buf, int ns); 146 - extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns); 147 - extern void _insw(volatile u16 __iomem *port, void *buf, int ns); 148 - extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns); 149 - extern void _insl(volatile u32 __iomem *port, void *buf, int nl); 150 - extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl); 151 - extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns); 152 - extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns); 153 - extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl); 154 - extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl); 166 + extern void _insb(volatile u8 __iomem *port, void *buf, long count); 167 + extern void _outsb(volatile u8 __iomem *port, const void *buf, long count); 168 + extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count); 169 + extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count); 170 + extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count); 171 + extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count); 155 172 156 173 static inline void mmiowb(void) 157 174 { ··· 176 179 #define outw_p(val, port) (udelay(1), outw((val), (port))) 177 180 #define inl_p(port) inl(port) 178 181 #define outl_p(val, port) (udelay(1), outl((val), (port))) 179 - 180 - /* 181 - * The *_ns versions below don't do byte-swapping. 182 - * Neither do the standard versions now, these are just here 183 - * for older code. 184 - */ 185 - #define outsw_ns(port, buf, ns) _outsw_ns((u16 __iomem *)((port)+pci_io_base), (buf), (ns)) 186 - #define outsl_ns(port, buf, nl) _outsl_ns((u32 __iomem *)((port)+pci_io_base), (buf), (nl)) 187 182 188 183 189 184 #define IO_SPACE_LIMIT ~(0UL) ··· 268 279 * and should not be used directly by device drivers. Use inb/readb 269 280 * instead. 270 281 */ 271 - static inline int in_8(const volatile unsigned char __iomem *addr) 282 + static inline int __in_8(const volatile unsigned char __iomem *addr) 272 283 { 273 284 int ret; 274 285 ··· 277 288 return ret; 278 289 } 279 290 280 - static inline void out_8(volatile unsigned char __iomem *addr, int val) 291 + static inline void __out_8(volatile unsigned char __iomem *addr, int val) 281 292 { 282 293 __asm__ __volatile__("sync; stb%U0%X0 %1,%0" 283 294 : "=m" (*addr) : "r" (val)); 284 295 get_paca()->io_sync = 1; 285 296 } 286 297 287 - static inline int in_le16(const volatile unsigned short __iomem *addr) 298 + static inline int __in_le16(const volatile unsigned short __iomem *addr) 288 299 { 289 300 int ret; 290 301 ··· 293 304 return ret; 294 305 } 295 306 296 - static inline int in_be16(const volatile unsigned short __iomem *addr) 307 + static inline int __in_be16(const volatile unsigned short __iomem *addr) 297 308 { 298 309 int ret; 299 310 ··· 302 313 return ret; 303 314 } 304 315 305 - static inline void out_le16(volatile unsigned short __iomem *addr, int val) 316 + static inline void __out_le16(volatile unsigned short __iomem *addr, int val) 306 317 { 307 318 __asm__ __volatile__("sync; sthbrx %1,0,%2" 308 319 : "=m" (*addr) : "r" (val), "r" (addr)); 309 320 get_paca()->io_sync = 1; 310 321 } 311 322 312 - static inline void out_be16(volatile unsigned short __iomem *addr, int val) 323 + static inline void __out_be16(volatile unsigned short __iomem *addr, int val) 313 324 { 314 325 __asm__ __volatile__("sync; sth%U0%X0 %1,%0" 315 326 : "=m" (*addr) : "r" (val)); 316 327 get_paca()->io_sync = 1; 317 328 } 318 329 319 - static inline unsigned in_le32(const volatile unsigned __iomem *addr) 330 + static inline unsigned __in_le32(const volatile unsigned __iomem *addr) 320 331 { 321 332 unsigned ret; 322 333 ··· 325 336 return ret; 326 337 } 327 338 328 - static inline unsigned in_be32(const volatile unsigned __iomem *addr) 339 + static inline unsigned __in_be32(const volatile unsigned __iomem *addr) 329 340 { 330 341 unsigned ret; 331 342 ··· 334 345 return ret; 335 346 } 336 347 337 - static inline void out_le32(volatile unsigned __iomem *addr, int val) 348 + static inline void __out_le32(volatile unsigned __iomem *addr, int val) 338 349 { 339 350 __asm__ __volatile__("sync; stwbrx %1,0,%2" : "=m" (*addr) 340 351 : "r" (val), "r" (addr)); 341 352 get_paca()->io_sync = 1; 342 353 } 343 354 344 - static inline void out_be32(volatile unsigned __iomem *addr, int val) 355 + static inline void __out_be32(volatile unsigned __iomem *addr, int val) 345 356 { 346 357 __asm__ __volatile__("sync; stw%U0%X0 %1,%0" 347 358 : "=m" (*addr) : "r" (val)); 348 359 get_paca()->io_sync = 1; 349 360 } 350 361 351 - static inline unsigned long in_le64(const volatile unsigned long __iomem *addr) 362 + static inline unsigned long __in_le64(const volatile unsigned long __iomem *addr) 352 363 { 353 364 unsigned long tmp, ret; 354 365 ··· 368 379 return ret; 369 380 } 370 381 371 - static inline unsigned long in_be64(const volatile unsigned long __iomem *addr) 382 + static inline unsigned long __in_be64(const volatile unsigned long __iomem *addr) 372 383 { 373 384 unsigned long ret; 374 385 ··· 377 388 return ret; 378 389 } 379 390 380 - static inline void out_le64(volatile unsigned long __iomem *addr, unsigned long val) 391 + static inline void __out_le64(volatile unsigned long __iomem *addr, unsigned long val) 381 392 { 382 393 unsigned long tmp; 383 394 ··· 395 406 get_paca()->io_sync = 1; 396 407 } 397 408 398 - static inline void out_be64(volatile unsigned long __iomem *addr, unsigned long val) 409 + static inline void __out_be64(volatile unsigned long __iomem *addr, unsigned long val) 399 410 { 400 411 __asm__ __volatile__("sync; std%U0%X0 %1,%0" : "=m" (*addr) : "r" (val)); 401 412 get_paca()->io_sync = 1; 402 413 } 403 414 404 - #ifndef CONFIG_PPC_ISERIES 405 415 #include <asm/eeh.h> 406 - #endif 407 416 408 417 /** 409 418 * check_signature - find BIOS signatures ··· 417 430 const unsigned char *signature, int length) 418 431 { 419 432 int retval = 0; 420 - #ifndef CONFIG_PPC_ISERIES 421 433 do { 422 434 if (readb(io_addr) != *signature) 423 435 goto out; ··· 426 440 } while (length); 427 441 retval = 1; 428 442 out: 429 - #endif 430 443 return retval; 431 444 } 432 445
+12 -12
include/asm-powerpc/irq.h
··· 137 137 extern struct irq_map_entry irq_map[NR_IRQS]; 138 138 139 139 140 - /*** 140 + /** 141 141 * irq_alloc_host - Allocate a new irq_host data structure 142 142 * @node: device-tree node of the interrupt controller 143 143 * @revmap_type: type of reverse mapping to use ··· 159 159 irq_hw_number_t inval_irq); 160 160 161 161 162 - /*** 162 + /** 163 163 * irq_find_host - Locates a host for a given device node 164 164 * @node: device-tree node of the interrupt controller 165 165 */ 166 166 extern struct irq_host *irq_find_host(struct device_node *node); 167 167 168 168 169 - /*** 169 + /** 170 170 * irq_set_default_host - Set a "default" host 171 171 * @host: default host pointer 172 172 * ··· 178 178 extern void irq_set_default_host(struct irq_host *host); 179 179 180 180 181 - /*** 181 + /** 182 182 * irq_set_virq_count - Set the maximum number of virt irqs 183 183 * @count: number of linux virtual irqs, capped with NR_IRQS 184 184 * ··· 188 188 extern void irq_set_virq_count(unsigned int count); 189 189 190 190 191 - /*** 191 + /** 192 192 * irq_create_mapping - Map a hardware interrupt into linux virq space 193 193 * @host: host owning this hardware interrupt or NULL for default host 194 194 * @hwirq: hardware irq number in that host space ··· 202 202 irq_hw_number_t hwirq); 203 203 204 204 205 - /*** 205 + /** 206 206 * irq_dispose_mapping - Unmap an interrupt 207 207 * @virq: linux virq number of the interrupt to unmap 208 208 */ 209 209 extern void irq_dispose_mapping(unsigned int virq); 210 210 211 - /*** 211 + /** 212 212 * irq_find_mapping - Find a linux virq from an hw irq number. 213 213 * @host: host owning this hardware interrupt 214 214 * @hwirq: hardware irq number in that host space ··· 221 221 irq_hw_number_t hwirq); 222 222 223 223 224 - /*** 224 + /** 225 225 * irq_radix_revmap - Find a linux virq from a hw irq number. 226 226 * @host: host owning this hardware interrupt 227 227 * @hwirq: hardware irq number in that host space ··· 232 232 extern unsigned int irq_radix_revmap(struct irq_host *host, 233 233 irq_hw_number_t hwirq); 234 234 235 - /*** 235 + /** 236 236 * irq_linear_revmap - Find a linux virq from a hw irq number. 237 237 * @host: host owning this hardware interrupt 238 238 * @hwirq: hardware irq number in that host space ··· 247 247 248 248 249 249 250 - /*** 250 + /** 251 251 * irq_alloc_virt - Allocate virtual irq numbers 252 252 * @host: host owning these new virtual irqs 253 253 * @count: number of consecutive numbers to allocate ··· 261 261 unsigned int count, 262 262 unsigned int hint); 263 263 264 - /*** 264 + /** 265 265 * irq_free_virt - Free virtual irq numbers 266 266 * @virq: virtual irq number of the first interrupt to free 267 267 * @count: number of interrupts to free ··· 300 300 301 301 /* -- End OF helpers -- */ 302 302 303 - /*** 303 + /** 304 304 * irq_early_init - Init irq remapping subsystem 305 305 */ 306 306 extern void irq_early_init(void);
-17
include/asm-powerpc/iseries/hv_call_xm.h
··· 16 16 #define HvCallXmSetTce HvCallXm + 11 17 17 #define HvCallXmSetTces HvCallXm + 13 18 18 19 - /* 20 - * Structure passed to HvCallXm_getTceTableParms 21 - */ 22 - struct iommu_table_cb { 23 - unsigned long itc_busno; /* Bus number for this tce table */ 24 - unsigned long itc_start; /* Will be NULL for secondary */ 25 - unsigned long itc_totalsize; /* Size (in pages) of whole table */ 26 - unsigned long itc_offset; /* Index into real tce table of the 27 - start of our section */ 28 - unsigned long itc_size; /* Size (in pages) of our section */ 29 - unsigned long itc_index; /* Index of this tce table */ 30 - unsigned short itc_maxtables; /* Max num of tables for partition */ 31 - unsigned char itc_virtbus; /* Flag to indicate virtual bus */ 32 - unsigned char itc_slotno; /* IOA Tce Slot Index */ 33 - unsigned char itc_rsvd[4]; 34 - }; 35 - 36 19 static inline void HvCallXm_getTceTableParms(u64 cb) 37 20 { 38 21 HvCall1(HvCallXmGetTceTableParms, cb);
+2 -11
include/asm-powerpc/iseries/hv_lp_config.h
··· 25 25 26 26 #include <asm/iseries/hv_call_sc.h> 27 27 #include <asm/iseries/hv_types.h> 28 - #include <asm/iseries/it_lp_naca.h> 29 28 30 29 enum { 31 30 HvCallCfg_Cur = 0, ··· 43 44 #define HvCallCfgGetHostingLpIndex HvCallCfg + 32 44 45 45 46 extern HvLpIndex HvLpConfig_getLpIndex_outline(void); 46 - 47 - static inline HvLpIndex HvLpConfig_getLpIndex(void) 48 - { 49 - return itLpNaca.xLpIndex; 50 - } 51 - 52 - static inline HvLpIndex HvLpConfig_getPrimaryLpIndex(void) 53 - { 54 - return itLpNaca.xPrimaryLpIndex; 55 - } 47 + extern HvLpIndex HvLpConfig_getLpIndex(void); 48 + extern HvLpIndex HvLpConfig_getPrimaryLpIndex(void); 56 49 57 50 static inline u64 HvLpConfig_getMsChunks(void) 58 51 {
-60
include/asm-powerpc/iseries/iseries_io.h
··· 1 - #ifndef _ASM_POWERPC_ISERIES_ISERIES_IO_H 2 - #define _ASM_POWERPC_ISERIES_ISERIES_IO_H 3 - 4 - 5 - #ifdef CONFIG_PPC_ISERIES 6 - #include <linux/types.h> 7 - /* 8 - * Created by Allan Trautman on Thu Dec 28 2000. 9 - * 10 - * Remaps the io.h for the iSeries Io 11 - * Copyright (C) 2000 Allan H Trautman, IBM Corporation 12 - * 13 - * This program is free software; you can redistribute it and/or modify 14 - * it under the terms of the GNU General Public License as published by 15 - * the Free Software Foundation; either version 2 of the License, or 16 - * (at your option) any later version. 17 - * 18 - * This program is distributed in the hope that it will be useful, 19 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 20 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 - * GNU General Public License for more details. 22 - * 23 - * You should have received a copy of the GNU General Public License 24 - * along with this program; if not, write to the: 25 - * Free Software Foundation, Inc., 26 - * 59 Temple Place, Suite 330, 27 - * Boston, MA 02111-1307 USA 28 - * 29 - * Change Activity: 30 - * Created December 28, 2000 31 - * End Change Activity 32 - */ 33 - 34 - #ifdef CONFIG_PCI 35 - extern u8 iSeries_Read_Byte(const volatile void __iomem * IoAddress); 36 - extern u16 iSeries_Read_Word(const volatile void __iomem * IoAddress); 37 - extern u32 iSeries_Read_Long(const volatile void __iomem * IoAddress); 38 - extern void iSeries_Write_Byte(u8 IoData, volatile void __iomem * IoAddress); 39 - extern void iSeries_Write_Word(u16 IoData, volatile void __iomem * IoAddress); 40 - extern void iSeries_Write_Long(u32 IoData, volatile void __iomem * IoAddress); 41 - 42 - extern void iSeries_memset_io(volatile void __iomem *dest, char x, size_t n); 43 - extern void iSeries_memcpy_toio(volatile void __iomem *dest, void *source, 44 - size_t n); 45 - extern void iSeries_memcpy_fromio(void *dest, 46 - const volatile void __iomem *source, size_t n); 47 - #else 48 - static inline u8 iSeries_Read_Byte(const volatile void __iomem *IoAddress) 49 - { 50 - return 0xff; 51 - } 52 - 53 - static inline void iSeries_Write_Byte(u8 IoData, 54 - volatile void __iomem *IoAddress) 55 - { 56 - } 57 - #endif /* CONFIG_PCI */ 58 - 59 - #endif /* CONFIG_PPC_ISERIES */ 60 - #endif /* _ASM_POWERPC_ISERIES_ISERIES_IO_H */
+3 -3
include/asm-powerpc/iseries/it_exp_vpd_panel.h arch/powerpc/platforms/iseries/it_exp_vpd_panel.h
··· 15 15 * along with this program; if not, write to the Free Software 16 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 */ 18 - #ifndef _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H 19 - #define _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H 18 + #ifndef _PLATFORMS_ISERIES_IT_EXT_VPD_PANEL_H 19 + #define _PLATFORMS_ISERIES_IT_EXT_VPD_PANEL_H 20 20 21 21 /* 22 22 * This struct maps the panel information ··· 48 48 49 49 extern struct ItExtVpdPanel xItExtVpdPanel; 50 50 51 - #endif /* _ASM_POWERPC_ISERIES_IT_EXT_VPD_PANEL_H */ 51 + #endif /* _PLATFORMS_ISERIES_IT_EXT_VPD_PANEL_H */
+3 -3
include/asm-powerpc/iseries/it_lp_naca.h arch/powerpc/platforms/iseries/it_lp_naca.h
··· 15 15 * along with this program; if not, write to the Free Software 16 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 17 */ 18 - #ifndef _ASM_POWERPC_ISERIES_IT_LP_NACA_H 19 - #define _ASM_POWERPC_ISERIES_IT_LP_NACA_H 18 + #ifndef _PLATFORMS_ISERIES_IT_LP_NACA_H 19 + #define _PLATFORMS_ISERIES_IT_LP_NACA_H 20 20 21 21 #include <linux/types.h> 22 22 ··· 77 77 #define ITLPNACA_HWSYNCEDTBS 0x20 /* Hardware synced TBs */ 78 78 #define ITLPNACA_HMTINT 0x10 /* Utilize MHT for interrupts */ 79 79 80 - #endif /* _ASM_POWERPC_ISERIES_IT_LP_NACA_H */ 80 + #endif /* _PLATFORMS_ISERIES_IT_LP_NACA_H */
-2
include/asm-powerpc/iseries/it_lp_queue.h
··· 27 27 #include <asm/types.h> 28 28 #include <asm/ptrace.h> 29 29 30 - struct HvLpEvent; 31 - 32 30 #define IT_LP_MAX_QUEUES 8 33 31 34 32 #define IT_LP_NOT_USED 0 /* Queue will not be used by PLIC */
+28
include/asm-powerpc/iseries/vio.h
··· 122 122 viorc_openRejected = 0x0301 123 123 }; 124 124 125 + /* 126 + * The structure of the events that flow between us and OS/400 for chario 127 + * events. You can't mess with this unless the OS/400 side changes too. 128 + */ 129 + struct viocharlpevent { 130 + struct HvLpEvent event; 131 + u32 reserved; 132 + u16 version; 133 + u16 subtype_result_code; 134 + u8 virtual_device; 135 + u8 len; 136 + u8 data[VIOCHAR_MAX_DATA]; 137 + }; 138 + 139 + #define VIOCHAR_WINDOW 10 140 + 141 + enum viocharsubtype { 142 + viocharopen = 0x0001, 143 + viocharclose = 0x0002, 144 + viochardata = 0x0003, 145 + viocharack = 0x0004, 146 + viocharconfig = 0x0005 147 + }; 148 + 149 + enum viochar_rc { 150 + viochar_rc_ebusy = 1 151 + }; 152 + 125 153 struct device; 126 154 127 155 extern struct device *iSeries_vio_dev;
+21 -2
include/asm-powerpc/lppaca.h
··· 27 27 // 28 28 // 29 29 //---------------------------------------------------------------------------- 30 + #include <linux/cache.h> 30 31 #include <asm/types.h> 32 + #include <asm/mmu.h> 31 33 32 34 /* The Hypervisor barfs if the lppaca crosses a page boundary. A 1k 33 35 * alignment is sufficient to prevent this */ ··· 116 114 117 115 118 116 //============================================================================= 119 - // CACHE_LINE_3 0x0100 - 0x007F: This line is shared with other processors 117 + // CACHE_LINE_3 0x0100 - 0x017F: This line is shared with other processors 120 118 //============================================================================= 121 119 // This is the yield_count. An "odd" value (low bit on) means that 122 120 // the processor is yielded (either because of an OS yield or a PLIC ··· 128 126 u8 reserved6[124]; // Reserved x04-x7F 129 127 130 128 //============================================================================= 131 - // CACHE_LINE_4-5 0x0100 - 0x01FF Contains PMC interrupt data 129 + // CACHE_LINE_4-5 0x0180 - 0x027F Contains PMC interrupt data 132 130 //============================================================================= 133 131 u8 pmc_save_area[256]; // PMC interrupt Area x00-xFF 134 132 } __attribute__((__aligned__(0x400))); 135 133 136 134 extern struct lppaca lppaca[]; 135 + 136 + /* 137 + * SLB shadow buffer structure as defined in the PAPR. The save_area 138 + * contains adjacent ESID and VSID pairs for each shadowed SLB. The 139 + * ESID is stored in the lower 64bits, then the VSID. 140 + */ 141 + struct slb_shadow { 142 + u32 persistent; // Number of persistent SLBs x00-x03 143 + u32 buffer_length; // Total shadow buffer length x04-x07 144 + u64 reserved; // Alignment x08-x0f 145 + struct { 146 + u64 esid; 147 + u64 vsid; 148 + } save_area[SLB_NUM_BOLTED]; // x10-x40 149 + } ____cacheline_aligned; 150 + 151 + extern struct slb_shadow slb_shadow[]; 137 152 138 153 #endif /* __KERNEL__ */ 139 154 #endif /* _ASM_POWERPC_LPPACA_H */
+3
include/asm-powerpc/paca.h
··· 23 23 register struct paca_struct *local_paca asm("r13"); 24 24 #define get_paca() local_paca 25 25 #define get_lppaca() (get_paca()->lppaca_ptr) 26 + #define get_slb_shadow() (get_paca()->slb_shadow_ptr) 26 27 27 28 struct task_struct; 28 29 ··· 100 99 u64 user_time; /* accumulated usermode TB ticks */ 101 100 u64 system_time; /* accumulated system TB ticks */ 102 101 u64 startpurr; /* PURR/TB value snapshot */ 102 + 103 + struct slb_shadow *slb_shadow_ptr; 103 104 }; 104 105 105 106 extern struct paca_struct paca[];
-6
include/asm-powerpc/page.h
··· 55 55 #define PAGE_OFFSET ASM_CONST(CONFIG_KERNEL_START) 56 56 #define KERNELBASE (PAGE_OFFSET + PHYSICAL_START) 57 57 58 - #ifdef CONFIG_DISCONTIGMEM 59 - #define page_to_pfn(page) discontigmem_page_to_pfn(page) 60 - #define pfn_to_page(pfn) discontigmem_pfn_to_page(pfn) 61 - #define pfn_valid(pfn) discontigmem_pfn_valid(pfn) 62 - #endif 63 - 64 58 #ifdef CONFIG_FLATMEM 65 59 #define pfn_valid(pfn) ((pfn) < max_mapnr) 66 60 #endif
+11
include/asm-powerpc/ppc-pci.h
··· 69 69 void eeh_slot_error_detail (struct pci_dn *pdn, int severity); 70 70 71 71 /** 72 + * rtas_pci_enableo - enable IO transfers for this slot 73 + * @pdn: pci device node 74 + * @function: either EEH_THAW_MMIO or EEH_THAW_DMA 75 + * 76 + * Enable I/O transfers to this slot 77 + */ 78 + #define EEH_THAW_MMIO 2 79 + #define EEH_THAW_DMA 3 80 + int rtas_pci_enable(struct pci_dn *pdn, int function); 81 + 82 + /** 72 83 * rtas_set_slot_reset -- unfreeze a frozen slot 73 84 * 74 85 * Clear the EEH-frozen condition on a slot. This routine
+1
include/asm-powerpc/processor.h
··· 32 32 #define _CHRP_Motorola 0x04 /* motorola chrp, the cobra */ 33 33 #define _CHRP_IBM 0x05 /* IBM chrp, the longtrail and longtrail 2 */ 34 34 #define _CHRP_Pegasos 0x06 /* Genesi/bplan's Pegasos and Pegasos2 */ 35 + #define _CHRP_briq 0x07 /* TotalImpact's briQ */ 35 36 36 37 #if defined(__KERNEL__) && defined(CONFIG_PPC32) 37 38
+25 -15
include/asm-powerpc/prom.h
··· 72 72 }; 73 73 74 74 struct device_node { 75 - char *name; 76 - char *type; 75 + const char *name; 76 + const char *type; 77 77 phandle node; 78 78 phandle linux_phandle; 79 79 char *full_name; ··· 160 160 extern void early_init_devtree(void *); 161 161 extern int device_is_compatible(struct device_node *device, const char *); 162 162 extern int machine_is_compatible(const char *compat); 163 - extern void *get_property(struct device_node *node, const char *name, 163 + extern const void *get_property(struct device_node *node, const char *name, 164 164 int *lenp); 165 165 extern void print_properties(struct device_node *node); 166 166 extern int prom_n_addr_cells(struct device_node* np); ··· 197 197 */ 198 198 199 199 200 - /* Helper to read a big number */ 201 - static inline u64 of_read_number(u32 *cell, int size) 200 + /* Helper to read a big number; size is in cells (not bytes) */ 201 + static inline u64 of_read_number(const u32 *cell, int size) 202 202 { 203 203 u64 r = 0; 204 204 while (size--) ··· 206 206 return r; 207 207 } 208 208 209 + /* Like of_read_number, but we want an unsigned long result */ 210 + #ifdef CONFIG_PPC32 211 + static inline unsigned long of_read_ulong(const u32 *cell, int size) 212 + { 213 + return cell[size-1]; 214 + } 215 + #else 216 + #define of_read_ulong(cell, size) of_read_number(cell, size) 217 + #endif 218 + 209 219 /* Translate an OF address block into a CPU physical address 210 220 */ 211 221 #define OF_BAD_ADDR ((u64)-1) 212 - extern u64 of_translate_address(struct device_node *np, u32 *addr); 222 + extern u64 of_translate_address(struct device_node *np, const u32 *addr); 213 223 214 224 /* Extract an address from a device, returns the region size and 215 225 * the address space flags too. The PCI version uses a BAR number 216 226 * instead of an absolute index 217 227 */ 218 - extern u32 *of_get_address(struct device_node *dev, int index, 228 + extern const u32 *of_get_address(struct device_node *dev, int index, 219 229 u64 *size, unsigned int *flags); 220 - extern u32 *of_get_pci_address(struct device_node *dev, int bar_no, 230 + extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no, 221 231 u64 *size, unsigned int *flags); 222 232 223 233 /* Get an address as a resource. Note that if your address is ··· 244 234 /* Parse the ibm,dma-window property of an OF node into the busno, phys and 245 235 * size parameters. 246 236 */ 247 - void of_parse_dma_window(struct device_node *dn, unsigned char *dma_window_prop, 237 + void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, 248 238 unsigned long *busno, unsigned long *phys, unsigned long *size); 249 239 250 240 extern void kdump_move_device_tree(void); ··· 269 259 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */ 270 260 }; 271 261 272 - /*** 262 + /** 273 263 * of_irq_map_init - Initialize the irq remapper 274 264 * @flags: flags defining workarounds to enable 275 265 * ··· 282 272 283 273 extern void of_irq_map_init(unsigned int flags); 284 274 285 - /*** 275 + /** 286 276 * of_irq_map_raw - Low level interrupt tree parsing 287 277 * @parent: the device interrupt parent 288 278 * @intspec: interrupt specifier ("interrupts" property of the device) ··· 299 289 * 300 290 */ 301 291 302 - extern int of_irq_map_raw(struct device_node *parent, u32 *intspec, 303 - u32 ointsize, u32 *addr, 292 + extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec, 293 + u32 ointsize, const u32 *addr, 304 294 struct of_irq *out_irq); 305 295 306 296 307 - /*** 297 + /** 308 298 * of_irq_map_one - Resolve an interrupt for a device 309 299 * @device: the device whose interrupt is to be resolved 310 300 * @index: index of the interrupt to resolve ··· 317 307 extern int of_irq_map_one(struct device_node *device, int index, 318 308 struct of_irq *out_irq); 319 309 320 - /*** 310 + /** 321 311 * of_irq_map_pci - Resolve the interrupt for a PCI device 322 312 * @pdev: the device whose interrupt is to be resolved 323 313 * @out_irq: structure of_irq filled by this function
-4
include/asm-powerpc/ptrace.h
··· 215 215 #define PTRACE_GETVRREGS 18 216 216 #define PTRACE_SETVRREGS 19 217 217 218 - #ifndef __powerpc64__ 219 218 /* Get/set all the upper 32-bits of the SPE registers, accumulator, and 220 219 * spefscr, in one go */ 221 220 #define PTRACE_GETEVRREGS 20 222 221 #define PTRACE_SETEVRREGS 21 223 - #endif /* __powerpc64__ */ 224 222 225 223 /* 226 224 * Get or set a debug register. The first 16 are DABR registers and the ··· 233 235 #define PPC_PTRACE_GETFPREGS 0x97 /* Get FPRs 0 - 31 */ 234 236 #define PPC_PTRACE_SETFPREGS 0x96 /* Set FPRs 0 - 31 */ 235 237 236 - #ifdef __powerpc64__ 237 238 /* Calls to trace a 64bit program from a 32bit program */ 238 239 #define PPC_PTRACE_PEEKTEXT_3264 0x95 239 240 #define PPC_PTRACE_PEEKDATA_3264 0x94 ··· 240 243 #define PPC_PTRACE_POKEDATA_3264 0x92 241 244 #define PPC_PTRACE_PEEKUSR_3264 0x91 242 245 #define PPC_PTRACE_POKEUSR_3264 0x90 243 - #endif /* __powerpc64__ */ 244 246 245 247 #endif /* _ASM_POWERPC_PTRACE_H */
+1
include/asm-powerpc/reg.h
··· 592 592 #define PV_630p 0x0041 593 593 #define PV_970MP 0x0044 594 594 #define PV_BE 0x0070 595 + #define PV_PA6T 0x0090 595 596 596 597 /* 597 598 * Number of entries in the SLB. If this ever changes we should handle
+16
include/asm-powerpc/rtas.h
··· 230 230 231 231 #define GLOBAL_INTERRUPT_QUEUE 9005 232 232 233 + /** 234 + * rtas_config_addr - Format a busno, devfn and reg for RTAS. 235 + * @busno: The bus number. 236 + * @devfn: The device and function number as encoded by PCI_DEVFN(). 237 + * @reg: The register number. 238 + * 239 + * This function encodes the given busno, devfn and register number as 240 + * required for RTAS calls that take a "config_addr" parameter. 241 + * See PAPR requirement 7.3.4-1 for more info. 242 + */ 243 + static inline u32 rtas_config_addr(int busno, int devfn, int reg) 244 + { 245 + return ((reg & 0xf00) << 20) | ((busno & 0xff) << 16) | 246 + (devfn << 8) | (reg & 0xff); 247 + } 248 + 233 249 #endif /* __KERNEL__ */ 234 250 #endif /* _POWERPC_RTAS_H */
+1 -1
include/asm-powerpc/smu.h
··· 517 517 * This returns the pointer to an SMU "sdb" partition data or NULL 518 518 * if not found. The data format is described below 519 519 */ 520 - extern struct smu_sdbp_header *smu_get_sdb_partition(int id, 520 + extern const struct smu_sdbp_header *smu_get_sdb_partition(int id, 521 521 unsigned int *size); 522 522 523 523 /* Get "sdb" partition data from an SMU satellite */
+1 -1
include/asm-powerpc/spu.h
··· 106 106 struct spu_runqueue; 107 107 108 108 struct spu { 109 - char *name; 109 + const char *name; 110 110 unsigned long local_store_phys; 111 111 u8 *local_store; 112 112 unsigned long problem_phys;
-5
include/asm-powerpc/system.h
··· 177 177 extern u32 booke_wdt_period; 178 178 #endif /* CONFIG_BOOKE_WDT */ 179 179 180 - /* EBCDIC -> ASCII conversion for [0-9A-Z] on iSeries */ 181 - extern unsigned char e2a(unsigned char); 182 - extern unsigned char* strne2a(unsigned char *dest, 183 - const unsigned char *src, size_t n); 184 - 185 180 struct device_node; 186 181 extern void note_scsi_host(struct device_node *, void *); 187 182
+2 -2
include/asm-powerpc/vio.h
··· 46 46 */ 47 47 struct vio_dev { 48 48 struct iommu_table *iommu_table; /* vio_map_* uses this */ 49 - char *name; 50 - char *type; 49 + const char *name; 50 + const char *type; 51 51 uint32_t unit_address; 52 52 unsigned int irq; 53 53 struct device dev;
+6 -20
include/asm-ppc/io.h
··· 327 327 #define inl_p(port) inl((port)) 328 328 #define outl_p(val, port) outl((val), (port)) 329 329 330 - extern void _insb(volatile u8 __iomem *port, void *buf, int ns); 331 - extern void _outsb(volatile u8 __iomem *port, const void *buf, int ns); 332 - extern void _insw(volatile u16 __iomem *port, void *buf, int ns); 333 - extern void _outsw(volatile u16 __iomem *port, const void *buf, int ns); 334 - extern void _insl(volatile u32 __iomem *port, void *buf, int nl); 335 - extern void _outsl(volatile u32 __iomem *port, const void *buf, int nl); 336 - extern void _insw_ns(volatile u16 __iomem *port, void *buf, int ns); 337 - extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, int ns); 338 - extern void _insl_ns(volatile u32 __iomem *port, void *buf, int nl); 339 - extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, int nl); 340 - 341 - /* 342 - * The *_ns versions below don't do byte-swapping. 343 - * Neither do the standard versions now, these are just here 344 - * for older code. 345 - */ 346 - #define insw_ns(port, buf, ns) _insw_ns((port)+___IO_BASE, (buf), (ns)) 347 - #define outsw_ns(port, buf, ns) _outsw_ns((port)+___IO_BASE, (buf), (ns)) 348 - #define insl_ns(port, buf, nl) _insl_ns((port)+___IO_BASE, (buf), (nl)) 349 - #define outsl_ns(port, buf, nl) _outsl_ns((port)+___IO_BASE, (buf), (nl)) 330 + extern void _insb(volatile u8 __iomem *port, void *buf, long count); 331 + extern void _outsb(volatile u8 __iomem *port, const void *buf, long count); 332 + extern void _insw_ns(volatile u16 __iomem *port, void *buf, long count); 333 + extern void _outsw_ns(volatile u16 __iomem *port, const void *buf, long count); 334 + extern void _insl_ns(volatile u32 __iomem *port, void *buf, long count); 335 + extern void _outsl_ns(volatile u32 __iomem *port, const void *buf, long count); 350 336 351 337 352 338 #define IO_SPACE_LIMIT ~0
-4
include/asm-ppc/mpc8260_pci9.h
··· 30 30 #undef inb 31 31 #undef inw 32 32 #undef inl 33 - #undef insw_ns 34 - #undef insl_ns 35 33 #undef memcpy_fromio 36 34 37 35 extern int readb(volatile unsigned char *addr); ··· 41 43 extern int inb(unsigned port); 42 44 extern int inw(unsigned port); 43 45 extern unsigned inl(unsigned port); 44 - extern void insw_ns(unsigned port, void *buf, int ns); 45 - extern void insl_ns(unsigned port, void *buf, int nl); 46 46 extern void *memcpy_fromio(void *dest, unsigned long src, size_t count); 47 47 48 48 #endif /* !__CONFIG_8260_PCI9_DEFS */
+8 -8
include/asm-ppc/reg_booke.h
··· 300 300 #define DBSR_IC 0x80000000 /* Instruction Completion */ 301 301 #define DBSR_BT 0x40000000 /* Branch taken */ 302 302 #define DBSR_TIE 0x10000000 /* Trap Instruction debug Event */ 303 - #define DBSR_IAC1 0x00800000 /* Instruction Address Compare 1 Event */ 304 - #define DBSR_IAC2 0x00400000 /* Instruction Address Compare 2 Event */ 305 - #define DBSR_IAC3 0x00200000 /* Instruction Address Compare 3 Event */ 306 - #define DBSR_IAC4 0x00100000 /* Instruction Address Compare 4 Event */ 307 - #define DBSR_DAC1R 0x00080000 /* Data Address Compare 1 Read Event */ 308 - #define DBSR_DAC1W 0x00040000 /* Data Address Compare 1 Write Event */ 309 - #define DBSR_DAC2R 0x00020000 /* Data Address Compare 2 Read Event */ 310 - #define DBSR_DAC2W 0x00010000 /* Data Address Compare 2 Write Event */ 303 + #define DBSR_IAC1 0x04000000 /* Instruction Address Compare 1 Event */ 304 + #define DBSR_IAC2 0x02000000 /* Instruction Address Compare 2 Event */ 305 + #define DBSR_IAC3 0x00080000 /* Instruction Address Compare 3 Event */ 306 + #define DBSR_IAC4 0x00040000 /* Instruction Address Compare 4 Event */ 307 + #define DBSR_DAC1R 0x01000000 /* Data Address Compare 1 Read Event */ 308 + #define DBSR_DAC1W 0x00800000 /* Data Address Compare 1 Write Event */ 309 + #define DBSR_DAC2R 0x00400000 /* Data Address Compare 2 Read Event */ 310 + #define DBSR_DAC2W 0x00200000 /* Data Address Compare 2 Write Event */ 311 311 #endif 312 312 313 313 /* Bit definitions related to the ESR. */
+2
scripts/checkstack.pl
··· 62 62 } elsif ($arch eq 'ppc64') { 63 63 #XXX 64 64 $re = qr/.*stdu.*r1,-($x{1,8})\(r1\)/o; 65 + } elsif ($arch eq 'powerpc') { 66 + $re = qr/.*st[dw]u.*r1,-($x{1,8})\(r1\)/o; 65 67 } elsif ($arch =~ /^s390x?$/) { 66 68 # 11160: a7 fb ff 60 aghi %r15,-160 67 69 $re = qr/.*ag?hi.*\%r15,-(([0-9]{2}|[3-9])[0-9]{2})/o;
+1 -1
sound/aoa/core/snd-aoa-gpio-feature.c
··· 56 56 { 57 57 struct device_node *np, *gpio; 58 58 u32 *reg; 59 - char *audio_gpio; 59 + const char *audio_gpio; 60 60 61 61 *gpioptr = -1; 62 62
+6 -5
sound/oss/dmasound/dmasound_awacs.c
··· 347 347 setup_audio_gpio(const char *name, const char* compatible, int *gpio_addr, int* gpio_pol) 348 348 { 349 349 struct device_node *np; 350 - u32* pp; 351 - 350 + const u32* pp; 351 + 352 352 np = find_devices("gpio"); 353 353 if (!np) 354 354 return -ENODEV; ··· 356 356 np = np->child; 357 357 while(np != 0) { 358 358 if (name) { 359 - char *property = get_property(np,"audio-gpio",NULL); 359 + const char *property = 360 + get_property(np,"audio-gpio",NULL); 360 361 if (property != 0 && strcmp(property,name) == 0) 361 362 break; 362 363 } else if (compatible && device_is_compatible(np, compatible)) ··· 366 365 } 367 366 if (!np) 368 367 return -ENODEV; 369 - pp = (u32 *)get_property(np, "AAPL,address", NULL); 368 + pp = get_property(np, "AAPL,address", NULL); 370 369 if (!pp) 371 370 return -ENODEV; 372 371 *gpio_addr = (*pp) & 0x0000ffff; 373 - pp = (u32 *)get_property(np, "audio-gpio-active-state", NULL); 372 + pp = get_property(np, "audio-gpio-active-state", NULL); 374 373 if (pp) 375 374 *gpio_pol = *pp; 376 375 else
+8 -7
sound/ppc/tumbler.c
··· 1035 1035 return NULL; 1036 1036 1037 1037 for (np = np->child; np; np = np->sibling) { 1038 - char *property = get_property(np, "audio-gpio", NULL); 1038 + const char *property = get_property(np, "audio-gpio", NULL); 1039 1039 if (property && strcmp(property, name) == 0) 1040 1040 return np; 1041 1041 } ··· 1062 1062 struct pmac_gpio *gp, int is_compatible) 1063 1063 { 1064 1064 struct device_node *node; 1065 - u32 *base, addr; 1065 + const u32 *base; 1066 + u32 addr; 1066 1067 1067 1068 if (is_compatible) 1068 1069 node = find_compatible_audio_device(device); ··· 1075 1074 return -ENODEV; 1076 1075 } 1077 1076 1078 - base = (u32 *)get_property(node, "AAPL,address", NULL); 1077 + base = get_property(node, "AAPL,address", NULL); 1079 1078 if (! base) { 1080 - base = (u32 *)get_property(node, "reg", NULL); 1079 + base = get_property(node, "reg", NULL); 1081 1080 if (!base) { 1082 1081 DBG("(E) cannot find address for device %s !\n", device); 1083 1082 snd_printd("cannot find address for device %s\n", device); ··· 1091 1090 1092 1091 gp->addr = addr & 0x0000ffff; 1093 1092 /* Try to find the active state, default to 0 ! */ 1094 - base = (u32 *)get_property(node, "audio-gpio-active-state", NULL); 1093 + base = get_property(node, "audio-gpio-active-state", NULL); 1095 1094 if (base) { 1096 1095 gp->active_state = *base; 1097 1096 gp->active_val = (*base) ? 0x5 : 0x4; 1098 1097 gp->inactive_val = (*base) ? 0x4 : 0x5; 1099 1098 } else { 1100 - u32 *prop = NULL; 1099 + const u32 *prop = NULL; 1101 1100 gp->active_state = 0; 1102 1101 gp->active_val = 0x4; 1103 1102 gp->inactive_val = 0x5; ··· 1106 1105 * as we don't yet have an interpreter for these things 1107 1106 */ 1108 1107 if (platform) 1109 - prop = (u32 *)get_property(node, platform, NULL); 1108 + prop = get_property(node, platform, NULL); 1110 1109 if (prop) { 1111 1110 if (prop[3] == 0x9 && prop[4] == 0x9) { 1112 1111 gp->active_val = 0xd;