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/davem/sparc-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6:
sparc: Write to prom console using indirect buffer.
sparc: Delete prom_*getchar().
sparc: Pass buffer pointer all the way down to prom_{get,put}char().
sparc: Do not export prom_nb{get,put}char().
sparc64: Delete prom_setcallback().
sparc64: Unexport prom_service_exists().
sparc: Kill prom devops_{32,64}.c
sparc: Remove prom_pathtoinode()
sparc64: Delete prom_puts() unused.
SPARC/LEON: removed constant timer initialization as if HZ=100, now it reflects the value of HZ

+64 -409
+1 -1
arch/sparc/include/asm/openprom.h
··· 39 39 int (*v2_dev_open)(char *devpath); 40 40 void (*v2_dev_close)(int d); 41 41 int (*v2_dev_read)(int d, char *buf, int nbytes); 42 - int (*v2_dev_write)(int d, char *buf, int nbytes); 42 + int (*v2_dev_write)(int d, const char *buf, int nbytes); 43 43 int (*v2_dev_seek)(int d, int hi, int lo); 44 44 45 45 /* Never issued (multistage load support) */
+2 -33
arch/sparc/include/asm/oplib_32.h
··· 60 60 extern char *prom_mapio(char *virt_hint, int io_space, unsigned int phys_addr, unsigned int num_bytes); 61 61 extern void prom_unmapio(char *virt_addr, unsigned int num_bytes); 62 62 63 - /* Device operations. */ 64 - 65 - /* Open the device described by the passed string. Note, that the format 66 - * of the string is different on V0 vs. V2->higher proms. The caller must 67 - * know what he/she is doing! Returns the device descriptor, an int. 68 - */ 69 - extern int prom_devopen(char *device_string); 70 - 71 - /* Close a previously opened device described by the passed integer 72 - * descriptor. 73 - */ 74 - extern int prom_devclose(int device_handle); 75 - 76 - /* Do a seek operation on the device described by the passed integer 77 - * descriptor. 78 - */ 79 - extern void prom_seek(int device_handle, unsigned int seek_hival, 80 - unsigned int seek_lowval); 81 - 82 63 /* Miscellaneous routines, don't really fit in any category per se. */ 83 64 84 65 /* Reboot the machine with the command line passed. */ ··· 102 121 /* Get the prom firmware revision. */ 103 122 extern int prom_getprev(void); 104 123 105 - /* Character operations to/from the console.... */ 106 - 107 - /* Non-blocking get character from console. */ 108 - extern int prom_nbgetchar(void); 109 - 110 - /* Non-blocking put character to console. */ 111 - extern int prom_nbputchar(char character); 112 - 113 - /* Blocking get character from console. */ 114 - extern char prom_getchar(void); 115 - 116 - /* Blocking put character to console. */ 117 - extern void prom_putchar(char character); 124 + /* Write a buffer of characters to the console. */ 125 + extern void prom_console_write_buf(const char *buf, int len); 118 126 119 127 /* Prom's internal routines, don't use in kernel/boot code. */ 120 128 extern void prom_printf(const char *fmt, ...); ··· 208 238 extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, 209 239 int value_size); 210 240 211 - extern phandle prom_pathtoinode(char *path); 212 241 extern phandle prom_inst2pkg(int); 213 242 214 243 /* Dorking with Bus ranges... */
+2 -44
arch/sparc/include/asm/oplib_64.h
··· 67 67 /* Boot argument acquisition, returns the boot command line string. */ 68 68 extern char *prom_getbootargs(void); 69 69 70 - /* Device utilities. */ 71 - 72 - /* Device operations. */ 73 - 74 - /* Open the device described by the passed string. Note, that the format 75 - * of the string is different on V0 vs. V2->higher proms. The caller must 76 - * know what he/she is doing! Returns the device descriptor, an int. 77 - */ 78 - extern int prom_devopen(const char *device_string); 79 - 80 - /* Close a previously opened device described by the passed integer 81 - * descriptor. 82 - */ 83 - extern int prom_devclose(int device_handle); 84 - 85 - /* Do a seek operation on the device described by the passed integer 86 - * descriptor. 87 - */ 88 - extern void prom_seek(int device_handle, unsigned int seek_hival, 89 - unsigned int seek_lowval); 90 - 91 70 /* Miscellaneous routines, don't really fit in any category per se. */ 92 71 93 72 /* Reboot the machine with the command line passed. */ ··· 88 109 /* Halt and power-off the machine. */ 89 110 extern void prom_halt_power_off(void) __attribute__ ((noreturn)); 90 111 91 - /* Set the PROM 'sync' callback function to the passed function pointer. 92 - * When the user gives the 'sync' command at the prom prompt while the 93 - * kernel is still active, the prom will call this routine. 94 - * 95 - */ 96 - typedef int (*callback_func_t)(long *cmd); 97 - extern void prom_setcallback(callback_func_t func_ptr); 98 - 99 112 /* Acquire the IDPROM of the root node in the prom device tree. This 100 113 * gets passed a buffer where you would like it stuffed. The return value 101 114 * is the format type of this idprom or 0xff on error. 102 115 */ 103 116 extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size); 104 117 105 - /* Character operations to/from the console.... */ 106 - 107 - /* Non-blocking get character from console. */ 108 - extern int prom_nbgetchar(void); 109 - 110 - /* Non-blocking put character to console. */ 111 - extern int prom_nbputchar(char character); 112 - 113 - /* Blocking get character from console. */ 114 - extern char prom_getchar(void); 115 - 116 - /* Blocking put character to console. */ 117 - extern void prom_putchar(char character); 118 + /* Write a buffer of characters to the console. */ 119 + extern void prom_console_write_buf(const char *buf, int len); 118 120 119 121 /* Prom's internal routines, don't use in kernel/boot code. */ 120 122 extern void prom_printf(const char *fmt, ...); ··· 239 279 extern int prom_setprop(phandle node, const char *prop_name, char *prop_value, 240 280 int value_size); 241 281 242 - extern phandle prom_pathtoinode(const char *path); 243 282 extern phandle prom_inst2pkg(int); 244 - extern int prom_service_exists(const char *service_name); 245 283 extern void prom_sun4v_guest_soft_state(void); 246 284 247 285 extern int prom_ihandle2path(int handle, char *buffer, int bufsize);
+2 -2
arch/sparc/kernel/leon_kernel.c
··· 114 114 if (leon3_gptimer_regs && leon3_irqctrl_regs) { 115 115 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].val, 0); 116 116 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].rld, 117 - (((1000000 / 100) - 1))); 117 + (((1000000 / HZ) - 1))); 118 118 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl, 0); 119 119 120 120 #ifdef CONFIG_SMP ··· 128 128 } 129 129 130 130 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].val, 0); 131 - LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].rld, (((1000000/100) - 1))); 131 + LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].rld, (((1000000/HZ) - 1))); 132 132 LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].ctrl, 0); 133 133 # endif 134 134
-1
arch/sparc/prom/Makefile
··· 6 6 7 7 lib-y := bootstr_$(BITS).o 8 8 lib-$(CONFIG_SPARC32) += devmap.o 9 - lib-y += devops_$(BITS).o 10 9 lib-y += init_$(BITS).o 11 10 lib-$(CONFIG_SPARC32) += memory.o 12 11 lib-y += misc_$(BITS).o
+12 -53
arch/sparc/prom/console_32.c
··· 16 16 17 17 extern void restore_current(void); 18 18 19 - /* Non blocking get character from console input device, returns -1 20 - * if no input was taken. This can be used for polling. 21 - */ 22 - int 23 - prom_nbgetchar(void) 24 - { 25 - static char inc; 26 - int i = -1; 27 - unsigned long flags; 28 - 29 - spin_lock_irqsave(&prom_lock, flags); 30 - switch(prom_vers) { 31 - case PROM_V0: 32 - i = (*(romvec->pv_nbgetchar))(); 33 - break; 34 - case PROM_V2: 35 - case PROM_V3: 36 - if( (*(romvec->pv_v2devops).v2_dev_read)(*romvec->pv_v2bootargs.fd_stdin , &inc, 0x1) == 1) { 37 - i = inc; 38 - } else { 39 - i = -1; 40 - } 41 - break; 42 - default: 43 - i = -1; 44 - break; 45 - }; 46 - restore_current(); 47 - spin_unlock_irqrestore(&prom_lock, flags); 48 - return i; /* Ugh, we could spin forever on unsupported proms ;( */ 49 - } 50 - 51 19 /* Non blocking put character to console device, returns -1 if 52 20 * unsuccessful. 53 21 */ 54 - int 55 - prom_nbputchar(char c) 22 + static int prom_nbputchar(const char *buf) 56 23 { 57 - static char outc; 58 24 unsigned long flags; 59 25 int i = -1; 60 26 61 27 spin_lock_irqsave(&prom_lock, flags); 62 28 switch(prom_vers) { 63 29 case PROM_V0: 64 - i = (*(romvec->pv_nbputchar))(c); 30 + i = (*(romvec->pv_nbputchar))(*buf); 65 31 break; 66 32 case PROM_V2: 67 33 case PROM_V3: 68 - outc = c; 69 - if( (*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout, &outc, 0x1) == 1) 34 + if ((*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout, 35 + buf, 0x1) == 1) 70 36 i = 0; 71 - else 72 - i = -1; 73 37 break; 74 38 default: 75 - i = -1; 76 39 break; 77 40 }; 78 41 restore_current(); ··· 43 80 return i; /* Ugh, we could spin forever on unsupported proms ;( */ 44 81 } 45 82 46 - /* Blocking version of get character routine above. */ 47 - char 48 - prom_getchar(void) 83 + void prom_console_write_buf(const char *buf, int len) 49 84 { 50 - int character; 51 - while((character = prom_nbgetchar()) == -1) ; 52 - return (char) character; 85 + while (len) { 86 + int n = prom_nbputchar(buf); 87 + if (n) 88 + continue; 89 + len--; 90 + buf++; 91 + } 53 92 } 54 93 55 - /* Blocking version of put character routine above. */ 56 - void 57 - prom_putchar(char c) 58 - { 59 - while(prom_nbputchar(c) == -1) ; 60 - }
+15 -66
arch/sparc/prom/console_64.c
··· 15 15 16 16 extern int prom_stdin, prom_stdout; 17 17 18 - /* Non blocking get character from console input device, returns -1 19 - * if no input was taken. This can be used for polling. 20 - */ 21 - inline int 22 - prom_nbgetchar(void) 18 + static int __prom_console_write_buf(const char *buf, int len) 23 19 { 24 20 unsigned long args[7]; 25 - char inc; 26 - 27 - args[0] = (unsigned long) "read"; 28 - args[1] = 3; 29 - args[2] = 1; 30 - args[3] = (unsigned int) prom_stdin; 31 - args[4] = (unsigned long) &inc; 32 - args[5] = 1; 33 - args[6] = (unsigned long) -1; 34 - 35 - p1275_cmd_direct(args); 36 - 37 - if (args[6] == 1) 38 - return inc; 39 - return -1; 40 - } 41 - 42 - /* Non blocking put character to console device, returns -1 if 43 - * unsuccessful. 44 - */ 45 - inline int 46 - prom_nbputchar(char c) 47 - { 48 - unsigned long args[7]; 49 - char outc; 50 - 51 - outc = c; 21 + int ret; 52 22 53 23 args[0] = (unsigned long) "write"; 54 24 args[1] = 3; 55 25 args[2] = 1; 56 26 args[3] = (unsigned int) prom_stdout; 57 - args[4] = (unsigned long) &outc; 58 - args[5] = 1; 27 + args[4] = (unsigned long) buf; 28 + args[5] = (unsigned int) len; 59 29 args[6] = (unsigned long) -1; 60 30 61 31 p1275_cmd_direct(args); 62 32 63 - if (args[6] == 1) 64 - return 0; 65 - else 33 + ret = (int) args[6]; 34 + if (ret < 0) 66 35 return -1; 36 + return ret; 67 37 } 68 38 69 - /* Blocking version of get character routine above. */ 70 - char 71 - prom_getchar(void) 39 + void prom_console_write_buf(const char *buf, int len) 72 40 { 73 - int character; 74 - while((character = prom_nbgetchar()) == -1) ; 75 - return (char) character; 76 - } 77 - 78 - /* Blocking version of put character routine above. */ 79 - void 80 - prom_putchar(char c) 81 - { 82 - prom_nbputchar(c); 83 - } 84 - 85 - void 86 - prom_puts(const char *s, int len) 87 - { 88 - unsigned long args[7]; 89 - 90 - args[0] = (unsigned long) "write"; 91 - args[1] = 3; 92 - args[2] = 1; 93 - args[3] = (unsigned int) prom_stdout; 94 - args[4] = (unsigned long) s; 95 - args[5] = len; 96 - args[6] = (unsigned long) -1; 97 - 98 - p1275_cmd_direct(args); 41 + while (len) { 42 + int n = __prom_console_write_buf(buf, len); 43 + if (n < 0) 44 + continue; 45 + len -= n; 46 + buf += len; 47 + } 99 48 }
-87
arch/sparc/prom/devops_32.c
··· 1 - /* 2 - * devops.c: Device operations using the PROM. 3 - * 4 - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 5 - */ 6 - #include <linux/types.h> 7 - #include <linux/kernel.h> 8 - #include <linux/sched.h> 9 - 10 - #include <asm/openprom.h> 11 - #include <asm/oplib.h> 12 - 13 - extern void restore_current(void); 14 - 15 - /* Open the device described by the string 'dstr'. Returns the handle 16 - * to that device used for subsequent operations on that device. 17 - * Returns -1 on failure. 18 - */ 19 - int 20 - prom_devopen(char *dstr) 21 - { 22 - int handle; 23 - unsigned long flags; 24 - spin_lock_irqsave(&prom_lock, flags); 25 - switch(prom_vers) { 26 - case PROM_V0: 27 - handle = (*(romvec->pv_v0devops.v0_devopen))(dstr); 28 - if(handle == 0) handle = -1; 29 - break; 30 - case PROM_V2: 31 - case PROM_V3: 32 - handle = (*(romvec->pv_v2devops.v2_dev_open))(dstr); 33 - break; 34 - default: 35 - handle = -1; 36 - break; 37 - }; 38 - restore_current(); 39 - spin_unlock_irqrestore(&prom_lock, flags); 40 - 41 - return handle; 42 - } 43 - 44 - /* Close the device described by device handle 'dhandle'. */ 45 - int 46 - prom_devclose(int dhandle) 47 - { 48 - unsigned long flags; 49 - spin_lock_irqsave(&prom_lock, flags); 50 - switch(prom_vers) { 51 - case PROM_V0: 52 - (*(romvec->pv_v0devops.v0_devclose))(dhandle); 53 - break; 54 - case PROM_V2: 55 - case PROM_V3: 56 - (*(romvec->pv_v2devops.v2_dev_close))(dhandle); 57 - break; 58 - default: 59 - break; 60 - }; 61 - restore_current(); 62 - spin_unlock_irqrestore(&prom_lock, flags); 63 - return 0; 64 - } 65 - 66 - /* Seek to specified location described by 'seekhi' and 'seeklo' 67 - * for device 'dhandle'. 68 - */ 69 - void 70 - prom_seek(int dhandle, unsigned int seekhi, unsigned int seeklo) 71 - { 72 - unsigned long flags; 73 - spin_lock_irqsave(&prom_lock, flags); 74 - switch(prom_vers) { 75 - case PROM_V0: 76 - (*(romvec->pv_v0devops.v0_seekdev))(dhandle, seekhi, seeklo); 77 - break; 78 - case PROM_V2: 79 - case PROM_V3: 80 - (*(romvec->pv_v2devops.v2_dev_seek))(dhandle, seekhi, seeklo); 81 - break; 82 - default: 83 - break; 84 - }; 85 - restore_current(); 86 - spin_unlock_irqrestore(&prom_lock, flags); 87 - }
-67
arch/sparc/prom/devops_64.c
··· 1 - /* 2 - * devops.c: Device operations using the PROM. 3 - * 4 - * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) 5 - * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) 6 - */ 7 - #include <linux/types.h> 8 - #include <linux/kernel.h> 9 - #include <linux/sched.h> 10 - 11 - #include <asm/openprom.h> 12 - #include <asm/oplib.h> 13 - 14 - /* Open the device described by the string 'dstr'. Returns the handle 15 - * to that device used for subsequent operations on that device. 16 - * Returns 0 on failure. 17 - */ 18 - int 19 - prom_devopen(const char *dstr) 20 - { 21 - unsigned long args[5]; 22 - 23 - args[0] = (unsigned long) "open"; 24 - args[1] = 1; 25 - args[2] = 1; 26 - args[3] = (unsigned long) dstr; 27 - args[4] = (unsigned long) -1; 28 - 29 - p1275_cmd_direct(args); 30 - 31 - return (int) args[4]; 32 - } 33 - 34 - /* Close the device described by device handle 'dhandle'. */ 35 - int 36 - prom_devclose(int dhandle) 37 - { 38 - unsigned long args[4]; 39 - 40 - args[0] = (unsigned long) "close"; 41 - args[1] = 1; 42 - args[2] = 0; 43 - args[3] = (unsigned int) dhandle; 44 - 45 - p1275_cmd_direct(args); 46 - 47 - return 0; 48 - } 49 - 50 - /* Seek to specified location described by 'seekhi' and 'seeklo' 51 - * for device 'dhandle'. 52 - */ 53 - void 54 - prom_seek(int dhandle, unsigned int seekhi, unsigned int seeklo) 55 - { 56 - unsigned long args[7]; 57 - 58 - args[0] = (unsigned long) "seek"; 59 - args[1] = 3; 60 - args[2] = 1; 61 - args[3] = (unsigned int) dhandle; 62 - args[4] = seekhi; 63 - args[5] = seeklo; 64 - args[6] = (unsigned long) -1; 65 - 66 - p1275_cmd_direct(args); 67 - }
+1 -15
arch/sparc/prom/misc_64.c
··· 18 18 #include <asm/system.h> 19 19 #include <asm/ldc.h> 20 20 21 - int prom_service_exists(const char *service_name) 21 + static int prom_service_exists(const char *service_name) 22 22 { 23 23 unsigned long args[5]; 24 24 ··· 148 148 149 149 /* if nothing else helps, we just halt */ 150 150 prom_halt(); 151 - } 152 - 153 - /* Set prom sync handler to call function 'funcp'. */ 154 - void prom_setcallback(callback_func_t funcp) 155 - { 156 - unsigned long args[5]; 157 - if (!funcp) 158 - return; 159 - args[0] = (unsigned long) "set-callback"; 160 - args[1] = 1; 161 - args[2] = 1; 162 - args[3] = (unsigned long) funcp; 163 - args[4] = (unsigned long) -1; 164 - p1275_cmd_direct(args); 165 151 } 166 152 167 153 /* Get the idprom and stuff it into buffer 'idbuf'. Returns the
+29 -6
arch/sparc/prom/printf.c
··· 15 15 16 16 #include <linux/kernel.h> 17 17 #include <linux/compiler.h> 18 + #include <linux/spinlock.h> 18 19 19 20 #include <asm/openprom.h> 20 21 #include <asm/oplib.h> 21 22 23 + #define CONSOLE_WRITE_BUF_SIZE 1024 24 + 22 25 static char ppbuf[1024]; 26 + static char console_write_buf[CONSOLE_WRITE_BUF_SIZE]; 27 + static DEFINE_RAW_SPINLOCK(console_write_lock); 23 28 24 29 void notrace prom_write(const char *buf, unsigned int n) 25 30 { 26 - char ch; 31 + unsigned int dest_len; 32 + unsigned long flags; 33 + char *dest; 27 34 28 - while (n != 0) { 29 - --n; 30 - if ((ch = *buf++) == '\n') 31 - prom_putchar('\r'); 32 - prom_putchar(ch); 35 + dest = console_write_buf; 36 + raw_spin_lock_irqsave(&console_write_lock, flags); 37 + 38 + dest_len = 0; 39 + while (n-- != 0) { 40 + char ch = *buf++; 41 + if (ch == '\n') { 42 + *dest++ = '\r'; 43 + dest_len++; 44 + } 45 + *dest++ = ch; 46 + dest_len++; 47 + if (dest_len >= CONSOLE_WRITE_BUF_SIZE - 1) { 48 + prom_console_write_buf(console_write_buf, dest_len); 49 + dest = console_write_buf; 50 + dest_len = 0; 51 + } 33 52 } 53 + if (dest_len) 54 + prom_console_write_buf(console_write_buf, dest_len); 55 + 56 + raw_spin_unlock_irqrestore(&console_write_lock, flags); 34 57 } 35 58 36 59 void notrace prom_printf(const char *fmt, ...)
-16
arch/sparc/prom/tree_32.c
··· 342 342 if (node == -1) return 0; 343 343 return node; 344 344 } 345 - 346 - /* Return 'node' assigned to a particular prom 'path' 347 - * FIXME: Should work for v0 as well 348 - */ 349 - phandle prom_pathtoinode(char *path) 350 - { 351 - phandle node; 352 - int inst; 353 - 354 - inst = prom_devopen (path); 355 - if (inst == -1) return 0; 356 - node = prom_inst2pkg (inst); 357 - prom_devclose (inst); 358 - if (node == -1) return 0; 359 - return node; 360 - }
-18
arch/sparc/prom/tree_64.c
··· 374 374 return node; 375 375 } 376 376 377 - /* Return 'node' assigned to a particular prom 'path' 378 - * FIXME: Should work for v0 as well 379 - */ 380 - phandle prom_pathtoinode(const char *path) 381 - { 382 - phandle node; 383 - int inst; 384 - 385 - inst = prom_devopen (path); 386 - if (inst == 0) 387 - return 0; 388 - node = prom_inst2pkg(inst); 389 - prom_devclose(inst); 390 - if (node == -1) 391 - return 0; 392 - return node; 393 - } 394 - 395 377 int prom_ihandle2path(int handle, char *buffer, int bufsize) 396 378 { 397 379 unsigned long args[7];