Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 2994
b: refs/heads/master
c: 6566c6f
h: refs/heads/master
v: v3
  • Loading branch information
Arnd Bergmann authored and Paul Mackerras committed Jun 22, 2005
1 parent 06ab7b8 commit 9723313
Show file tree
Hide file tree
Showing 5 changed files with 109 additions and 107 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c5a3c2e52af1bcb118022ffac9a0fd1d42d43bd3
refs/heads/master: 6566c6f1f18d42affe73ccdd403e290b64d10473
103 changes: 1 addition & 102 deletions trunk/arch/ppc64/kernel/pSeries_setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,107 +375,6 @@ static void __init pSeries_init_early(void)
}


static void pSeries_progress(char *s, unsigned short hex)
{
struct device_node *root;
int width, *p;
char *os;
static int display_character, set_indicator;
static int max_width;
static DEFINE_SPINLOCK(progress_lock);
static int pending_newline = 0; /* did last write end with unprinted newline? */

if (!rtas.base)
return;

if (max_width == 0) {
if ((root = find_path_device("/rtas")) &&
(p = (unsigned int *)get_property(root,
"ibm,display-line-length",
NULL)))
max_width = *p;
else
max_width = 0x10;
display_character = rtas_token("display-character");
set_indicator = rtas_token("set-indicator");
}

if (display_character == RTAS_UNKNOWN_SERVICE) {
/* use hex display if available */
if (set_indicator != RTAS_UNKNOWN_SERVICE)
rtas_call(set_indicator, 3, 1, NULL, 6, 0, hex);
return;
}

spin_lock(&progress_lock);

/*
* Last write ended with newline, but we didn't print it since
* it would just clear the bottom line of output. Print it now
* instead.
*
* If no newline is pending, print a CR to start output at the
* beginning of the line.
*/
if (pending_newline) {
rtas_call(display_character, 1, 1, NULL, '\r');
rtas_call(display_character, 1, 1, NULL, '\n');
pending_newline = 0;
} else {
rtas_call(display_character, 1, 1, NULL, '\r');
}

width = max_width;
os = s;
while (*os) {
if (*os == '\n' || *os == '\r') {
/* Blank to end of line. */
while (width-- > 0)
rtas_call(display_character, 1, 1, NULL, ' ');

/* If newline is the last character, save it
* until next call to avoid bumping up the
* display output.
*/
if (*os == '\n' && !os[1]) {
pending_newline = 1;
spin_unlock(&progress_lock);
return;
}

/* RTAS wants CR-LF, not just LF */

if (*os == '\n') {
rtas_call(display_character, 1, 1, NULL, '\r');
rtas_call(display_character, 1, 1, NULL, '\n');
} else {
/* CR might be used to re-draw a line, so we'll
* leave it alone and not add LF.
*/
rtas_call(display_character, 1, 1, NULL, *os);
}

width = max_width;
} else {
width--;
rtas_call(display_character, 1, 1, NULL, *os);
}

os++;

/* if we overwrite the screen length */
if (width <= 0)
while ((*os != 0) && (*os != '\n') && (*os != '\r'))
os++;
}

/* Blank to end of line. */
while (width-- > 0)
rtas_call(display_character, 1, 1, NULL, ' ');

spin_unlock(&progress_lock);
}

static int pSeries_check_legacy_ioport(unsigned int baseport)
{
struct device_node *np;
Expand Down Expand Up @@ -535,7 +434,7 @@ struct machdep_calls __initdata pSeries_md = {
.get_rtc_time = rtas_get_rtc_time,
.set_rtc_time = rtas_set_rtc_time,
.calibrate_decr = generic_calibrate_decr,
.progress = pSeries_progress,
.progress = rtas_progress,
.check_legacy_ioport = pSeries_check_legacy_ioport,
.system_reset_exception = pSeries_system_reset_exception,
.machine_check_exception = pSeries_machine_check_exception,
Expand Down
4 changes: 2 additions & 2 deletions trunk/arch/ppc64/kernel/rtas-proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,11 @@ static ssize_t ppc_rtas_progress_write(struct file *file,
/* Lets see if the user passed hexdigits */
hex = simple_strtoul(progress_led, NULL, 10);

ppc_md.progress ((char *)progress_led, hex);
rtas_progress ((char *)progress_led, hex);
return count;

/* clear the line */
/* ppc_md.progress(" ", 0xffff);*/
/* rtas_progress(" ", 0xffff);*/
}
/* ****************************************************************** */
static int ppc_rtas_progress_show(struct seq_file *m, void *v)
Expand Down
106 changes: 104 additions & 2 deletions trunk/arch/ppc64/kernel/rtas.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,108 @@ call_rtas_display_status_delay(unsigned char c)
}
}

void
rtas_progress(char *s, unsigned short hex)
{
struct device_node *root;
int width, *p;
char *os;
static int display_character, set_indicator;
static int max_width;
static DEFINE_SPINLOCK(progress_lock);
static int pending_newline = 0; /* did last write end with unprinted newline? */

if (!rtas.base)
return;

if (max_width == 0) {
if ((root = find_path_device("/rtas")) &&
(p = (unsigned int *)get_property(root,
"ibm,display-line-length",
NULL)))
max_width = *p;
else
max_width = 0x10;
display_character = rtas_token("display-character");
set_indicator = rtas_token("set-indicator");
}

if (display_character == RTAS_UNKNOWN_SERVICE) {
/* use hex display if available */
if (set_indicator != RTAS_UNKNOWN_SERVICE)
rtas_call(set_indicator, 3, 1, NULL, 6, 0, hex);
return;
}

spin_lock(&progress_lock);

/*
* Last write ended with newline, but we didn't print it since
* it would just clear the bottom line of output. Print it now
* instead.
*
* If no newline is pending, print a CR to start output at the
* beginning of the line.
*/
if (pending_newline) {
rtas_call(display_character, 1, 1, NULL, '\r');
rtas_call(display_character, 1, 1, NULL, '\n');
pending_newline = 0;
} else {
rtas_call(display_character, 1, 1, NULL, '\r');
}

width = max_width;
os = s;
while (*os) {
if (*os == '\n' || *os == '\r') {
/* Blank to end of line. */
while (width-- > 0)
rtas_call(display_character, 1, 1, NULL, ' ');

/* If newline is the last character, save it
* until next call to avoid bumping up the
* display output.
*/
if (*os == '\n' && !os[1]) {
pending_newline = 1;
spin_unlock(&progress_lock);
return;
}

/* RTAS wants CR-LF, not just LF */

if (*os == '\n') {
rtas_call(display_character, 1, 1, NULL, '\r');
rtas_call(display_character, 1, 1, NULL, '\n');
} else {
/* CR might be used to re-draw a line, so we'll
* leave it alone and not add LF.
*/
rtas_call(display_character, 1, 1, NULL, *os);
}

width = max_width;
} else {
width--;
rtas_call(display_character, 1, 1, NULL, *os);
}

os++;

/* if we overwrite the screen length */
if (width <= 0)
while ((*os != 0) && (*os != '\n') && (*os != '\r'))
os++;
}

/* Blank to end of line. */
while (width-- > 0)
rtas_call(display_character, 1, 1, NULL, ' ');

spin_unlock(&progress_lock);
}

int
rtas_token(const char *service)
{
Expand Down Expand Up @@ -425,8 +527,8 @@ rtas_flash_firmware(void)

printk(KERN_ALERT "FLASH: flash image is %ld bytes\n", image_size);
printk(KERN_ALERT "FLASH: performing flash and reboot\n");
ppc_md.progress("Flashing \n", 0x0);
ppc_md.progress("Please Wait... ", 0x0);
rtas_progress("Flashing \n", 0x0);
rtas_progress("Please Wait... ", 0x0);
printk(KERN_ALERT "FLASH: this will take several minutes. Do not power off!\n");
status = rtas_call(update_token, 1, 1, NULL, rtas_block_list);
switch (status) { /* should only get "bad" status */
Expand Down
1 change: 1 addition & 0 deletions trunk/include/asm-ppc64/rtas.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ extern int rtas_get_sensor(int sensor, int index, int *state);
extern int rtas_get_power_level(int powerdomain, int *level);
extern int rtas_set_power_level(int powerdomain, int level, int *setlevel);
extern int rtas_set_indicator(int indicator, int index, int new_value);
extern void rtas_progress(char *s, unsigned short hex);
extern void rtas_initialize(void);

struct rtc_time;
Expand Down

0 comments on commit 9723313

Please sign in to comment.