Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
torvalds committed Dec 15, 2010
2 parents b4fe2a0 + 595a251 commit 478b2a3
Show file tree
Hide file tree
Showing 13 changed files with 64 additions and 409 deletions.
2 changes: 1 addition & 1 deletion arch/sparc/include/asm/openprom.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct linux_dev_v2_funcs {
int (*v2_dev_open)(char *devpath);
void (*v2_dev_close)(int d);
int (*v2_dev_read)(int d, char *buf, int nbytes);
int (*v2_dev_write)(int d, char *buf, int nbytes);
int (*v2_dev_write)(int d, const char *buf, int nbytes);
int (*v2_dev_seek)(int d, int hi, int lo);

/* Never issued (multistage load support) */
Expand Down
35 changes: 2 additions & 33 deletions arch/sparc/include/asm/oplib_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,6 @@ extern char *prom_getbootargs(void);
extern char *prom_mapio(char *virt_hint, int io_space, unsigned int phys_addr, unsigned int num_bytes);
extern void prom_unmapio(char *virt_addr, unsigned int num_bytes);

/* Device operations. */

/* Open the device described by the passed string. Note, that the format
* of the string is different on V0 vs. V2->higher proms. The caller must
* know what he/she is doing! Returns the device descriptor, an int.
*/
extern int prom_devopen(char *device_string);

/* Close a previously opened device described by the passed integer
* descriptor.
*/
extern int prom_devclose(int device_handle);

/* Do a seek operation on the device described by the passed integer
* descriptor.
*/
extern void prom_seek(int device_handle, unsigned int seek_hival,
unsigned int seek_lowval);

/* Miscellaneous routines, don't really fit in any category per se. */

/* Reboot the machine with the command line passed. */
Expand Down Expand Up @@ -121,19 +102,8 @@ extern int prom_getrev(void);
/* Get the prom firmware revision. */
extern int prom_getprev(void);

/* Character operations to/from the console.... */

/* Non-blocking get character from console. */
extern int prom_nbgetchar(void);

/* Non-blocking put character to console. */
extern int prom_nbputchar(char character);

/* Blocking get character from console. */
extern char prom_getchar(void);

/* Blocking put character to console. */
extern void prom_putchar(char character);
/* Write a buffer of characters to the console. */
extern void prom_console_write_buf(const char *buf, int len);

/* Prom's internal routines, don't use in kernel/boot code. */
extern void prom_printf(const char *fmt, ...);
Expand Down Expand Up @@ -238,7 +208,6 @@ extern int prom_node_has_property(phandle node, char *property);
extern int prom_setprop(phandle node, const char *prop_name, char *prop_value,
int value_size);

extern phandle prom_pathtoinode(char *path);
extern phandle prom_inst2pkg(int);

/* Dorking with Bus ranges... */
Expand Down
46 changes: 2 additions & 44 deletions arch/sparc/include/asm/oplib_64.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,6 @@ extern void prom_init(void *cif_handler, void *cif_stack);
/* Boot argument acquisition, returns the boot command line string. */
extern char *prom_getbootargs(void);

/* Device utilities. */

/* Device operations. */

/* Open the device described by the passed string. Note, that the format
* of the string is different on V0 vs. V2->higher proms. The caller must
* know what he/she is doing! Returns the device descriptor, an int.
*/
extern int prom_devopen(const char *device_string);

/* Close a previously opened device described by the passed integer
* descriptor.
*/
extern int prom_devclose(int device_handle);

/* Do a seek operation on the device described by the passed integer
* descriptor.
*/
extern void prom_seek(int device_handle, unsigned int seek_hival,
unsigned int seek_lowval);

/* Miscellaneous routines, don't really fit in any category per se. */

/* Reboot the machine with the command line passed. */
Expand All @@ -109,33 +88,14 @@ extern void prom_halt(void) __attribute__ ((noreturn));
/* Halt and power-off the machine. */
extern void prom_halt_power_off(void) __attribute__ ((noreturn));

/* Set the PROM 'sync' callback function to the passed function pointer.
* When the user gives the 'sync' command at the prom prompt while the
* kernel is still active, the prom will call this routine.
*
*/
typedef int (*callback_func_t)(long *cmd);
extern void prom_setcallback(callback_func_t func_ptr);

/* Acquire the IDPROM of the root node in the prom device tree. This
* gets passed a buffer where you would like it stuffed. The return value
* is the format type of this idprom or 0xff on error.
*/
extern unsigned char prom_get_idprom(char *idp_buffer, int idpbuf_size);

/* Character operations to/from the console.... */

/* Non-blocking get character from console. */
extern int prom_nbgetchar(void);

/* Non-blocking put character to console. */
extern int prom_nbputchar(char character);

/* Blocking get character from console. */
extern char prom_getchar(void);

/* Blocking put character to console. */
extern void prom_putchar(char character);
/* Write a buffer of characters to the console. */
extern void prom_console_write_buf(const char *buf, int len);

/* Prom's internal routines, don't use in kernel/boot code. */
extern void prom_printf(const char *fmt, ...);
Expand Down Expand Up @@ -279,9 +239,7 @@ extern phandle prom_finddevice(const char *name);
extern int prom_setprop(phandle node, const char *prop_name, char *prop_value,
int value_size);

extern phandle prom_pathtoinode(const char *path);
extern phandle prom_inst2pkg(int);
extern int prom_service_exists(const char *service_name);
extern void prom_sun4v_guest_soft_state(void);

extern int prom_ihandle2path(int handle, char *buffer, int bufsize);
Expand Down
4 changes: 2 additions & 2 deletions arch/sparc/kernel/leon_kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void __init leon_init_timers(irq_handler_t counter_fn)
if (leon3_gptimer_regs && leon3_irqctrl_regs) {
LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].val, 0);
LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].rld,
(((1000000 / 100) - 1)));
(((1000000 / HZ) - 1)));
LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[0].ctrl, 0);

#ifdef CONFIG_SMP
Expand All @@ -128,7 +128,7 @@ void __init leon_init_timers(irq_handler_t counter_fn)
}

LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].val, 0);
LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].rld, (((1000000/100) - 1)));
LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].rld, (((1000000/HZ) - 1)));
LEON3_BYPASS_STORE_PA(&leon3_gptimer_regs->e[1].ctrl, 0);
# endif

Expand Down
1 change: 0 additions & 1 deletion arch/sparc/prom/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ ccflags := -Werror

lib-y := bootstr_$(BITS).o
lib-$(CONFIG_SPARC32) += devmap.o
lib-y += devops_$(BITS).o
lib-y += init_$(BITS).o
lib-$(CONFIG_SPARC32) += memory.o
lib-y += misc_$(BITS).o
Expand Down
65 changes: 12 additions & 53 deletions arch/sparc/prom/console_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,82 +16,41 @@

extern void restore_current(void);

/* Non blocking get character from console input device, returns -1
* if no input was taken. This can be used for polling.
*/
int
prom_nbgetchar(void)
{
static char inc;
int i = -1;
unsigned long flags;

spin_lock_irqsave(&prom_lock, flags);
switch(prom_vers) {
case PROM_V0:
i = (*(romvec->pv_nbgetchar))();
break;
case PROM_V2:
case PROM_V3:
if( (*(romvec->pv_v2devops).v2_dev_read)(*romvec->pv_v2bootargs.fd_stdin , &inc, 0x1) == 1) {
i = inc;
} else {
i = -1;
}
break;
default:
i = -1;
break;
};
restore_current();
spin_unlock_irqrestore(&prom_lock, flags);
return i; /* Ugh, we could spin forever on unsupported proms ;( */
}

/* Non blocking put character to console device, returns -1 if
* unsuccessful.
*/
int
prom_nbputchar(char c)
static int prom_nbputchar(const char *buf)
{
static char outc;
unsigned long flags;
int i = -1;

spin_lock_irqsave(&prom_lock, flags);
switch(prom_vers) {
case PROM_V0:
i = (*(romvec->pv_nbputchar))(c);
i = (*(romvec->pv_nbputchar))(*buf);
break;
case PROM_V2:
case PROM_V3:
outc = c;
if( (*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout, &outc, 0x1) == 1)
if ((*(romvec->pv_v2devops).v2_dev_write)(*romvec->pv_v2bootargs.fd_stdout,
buf, 0x1) == 1)
i = 0;
else
i = -1;
break;
default:
i = -1;
break;
};
restore_current();
spin_unlock_irqrestore(&prom_lock, flags);
return i; /* Ugh, we could spin forever on unsupported proms ;( */
}

/* Blocking version of get character routine above. */
char
prom_getchar(void)
void prom_console_write_buf(const char *buf, int len)
{
int character;
while((character = prom_nbgetchar()) == -1) ;
return (char) character;
while (len) {
int n = prom_nbputchar(buf);
if (n)
continue;
len--;
buf++;
}
}

/* Blocking version of put character routine above. */
void
prom_putchar(char c)
{
while(prom_nbputchar(c) == -1) ;
}
81 changes: 15 additions & 66 deletions arch/sparc/prom/console_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,85 +15,34 @@

extern int prom_stdin, prom_stdout;

/* Non blocking get character from console input device, returns -1
* if no input was taken. This can be used for polling.
*/
inline int
prom_nbgetchar(void)
{
unsigned long args[7];
char inc;

args[0] = (unsigned long) "read";
args[1] = 3;
args[2] = 1;
args[3] = (unsigned int) prom_stdin;
args[4] = (unsigned long) &inc;
args[5] = 1;
args[6] = (unsigned long) -1;

p1275_cmd_direct(args);

if (args[6] == 1)
return inc;
return -1;
}

/* Non blocking put character to console device, returns -1 if
* unsuccessful.
*/
inline int
prom_nbputchar(char c)
static int __prom_console_write_buf(const char *buf, int len)
{
unsigned long args[7];
char outc;

outc = c;
int ret;

args[0] = (unsigned long) "write";
args[1] = 3;
args[2] = 1;
args[3] = (unsigned int) prom_stdout;
args[4] = (unsigned long) &outc;
args[5] = 1;
args[4] = (unsigned long) buf;
args[5] = (unsigned int) len;
args[6] = (unsigned long) -1;

p1275_cmd_direct(args);

if (args[6] == 1)
return 0;
else
ret = (int) args[6];
if (ret < 0)
return -1;
return ret;
}

/* Blocking version of get character routine above. */
char
prom_getchar(void)
{
int character;
while((character = prom_nbgetchar()) == -1) ;
return (char) character;
}

/* Blocking version of put character routine above. */
void
prom_putchar(char c)
void prom_console_write_buf(const char *buf, int len)
{
prom_nbputchar(c);
}

void
prom_puts(const char *s, int len)
{
unsigned long args[7];

args[0] = (unsigned long) "write";
args[1] = 3;
args[2] = 1;
args[3] = (unsigned int) prom_stdout;
args[4] = (unsigned long) s;
args[5] = len;
args[6] = (unsigned long) -1;

p1275_cmd_direct(args);
while (len) {
int n = __prom_console_write_buf(buf, len);
if (n < 0)
continue;
len -= n;
buf += len;
}
}
Loading

0 comments on commit 478b2a3

Please sign in to comment.