Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74662
b: refs/heads/master
c: 721fdf3
h: refs/heads/master
v: v3
  • Loading branch information
Kyle McMartin committed Dec 6, 2007
1 parent 5b01d51 commit 6caa15d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 66 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: ac6aecbf0541ca277e6492fdf7c91e46e1fc4171
refs/heads/master: 721fdf34167580ff98263c74cead8871d76936e6
88 changes: 34 additions & 54 deletions trunk/arch/parisc/kernel/firmware.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,76 +1082,56 @@ void pdc_io_reset_devices(void)


/**
* pdc_iodc_putc - Console character print using IODC.
* @c: the character to output.
* pdc_iodc_print - Console print using IODC.
* @str: the string to output.
* @count: length of str
*
* Note that only these special chars are architected for console IODC io:
* BEL, BS, CR, and LF. Others are passed through.
* Since the HP console requires CR+LF to perform a 'newline', we translate
* "\n" to "\r\n".
*/
void pdc_iodc_putc(unsigned char c)
int pdc_iodc_print(unsigned char *str, unsigned count)
{
/* XXX Should we spinlock posx usage */
static int posx; /* for simple TAB-Simulation... */
static int __attribute__((aligned(8))) iodc_retbuf[32];
static char __attribute__((aligned(64))) iodc_dbuf[4096];
unsigned int n;
/* XXX Should we spinlock posx usage */
static int posx; /* for simple TAB-Simulation... */
int __attribute__((aligned(8))) iodc_retbuf[32];
char __attribute__((aligned(64))) iodc_dbuf[4096];
unsigned int i;
unsigned long flags;

switch (c) {
case '\n':
iodc_dbuf[0] = '\r';
iodc_dbuf[1] = '\n';
n = 2;
posx = 0;
break;
case '\t':
pdc_iodc_putc(' ');
while (posx & 7) /* expand TAB */
pdc_iodc_putc(' ');
return; /* return since IODC can't handle this */
case '\b':
posx-=2; /* BS */
default:
iodc_dbuf[0] = c;
n = 1;
posx++;
break;
}
memset(iodc_dbuf, 0, 4096);
for (i = 0; i < count && i < 2048;) {
switch(str[i]) {
case '\n':
iodc_dbuf[i+0] = '\r';
iodc_dbuf[i+1] = '\n';
i += 2;
posx = 0;
break;
case '\t':
while (posx & 7) {
iodc_dbuf[i] = ' ';
i++, posx++;
}
break;
case '\b': /* BS */
posx -= 2;
default:
iodc_dbuf[i] = str[i];
i++, posx++;
break;
}
}

spin_lock_irqsave(&pdc_lock, flags);
real32_call(PAGE0->mem_cons.iodc_io,
(unsigned long)PAGE0->mem_cons.hpa, ENTRY_IO_COUT,
PAGE0->mem_cons.spa, __pa(PAGE0->mem_cons.dp.layers),
__pa(iodc_retbuf), 0, __pa(iodc_dbuf), n, 0);
__pa(iodc_retbuf), 0, __pa(iodc_dbuf), i, 0);
spin_unlock_irqrestore(&pdc_lock, flags);
}

/**
* pdc_iodc_outc - Console character print using IODC (without conversions).
* @c: the character to output.
*
* Write the character directly to the IODC console.
*/
void pdc_iodc_outc(unsigned char c)
{
unsigned int n;
unsigned long flags;

/* fill buffer with one caracter and print it */
static int __attribute__((aligned(8))) iodc_retbuf[32];
static char __attribute__((aligned(64))) iodc_dbuf[4096];

n = 1;
iodc_dbuf[0] = c;

spin_lock_irqsave(&pdc_lock, flags);
real32_call(PAGE0->mem_cons.iodc_io,
(unsigned long)PAGE0->mem_cons.hpa, ENTRY_IO_COUT,
PAGE0->mem_cons.spa, __pa(PAGE0->mem_cons.dp.layers),
__pa(iodc_retbuf), 0, __pa(iodc_dbuf), n, 0);
spin_unlock_irqrestore(&pdc_lock, flags);
return i;
}

/**
Expand Down
11 changes: 2 additions & 9 deletions trunk/arch/parisc/kernel/pdc_cons.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,7 @@

static void pdc_console_write(struct console *co, const char *s, unsigned count)
{
while(count--)
pdc_iodc_putc(*s++);
}

void pdc_outc(unsigned char c)
{
pdc_iodc_outc(c);
pdc_iodc_print(s, count);
}

void pdc_printf(const char *fmt, ...)
Expand All @@ -74,8 +68,7 @@ void pdc_printf(const char *fmt, ...)
len = vscnprintf(buf, sizeof(buf), fmt, args);
va_end(args);

for (i = 0; i < len; i++)
pdc_iodc_outc(buf[i]);
pdc_iodc_print(buf, len);
}

int pdc_console_poll_key(struct console *co)
Expand Down
3 changes: 1 addition & 2 deletions trunk/include/asm-parisc/pdc.h
Original file line number Diff line number Diff line change
Expand Up @@ -645,8 +645,7 @@ int pdc_soft_power_button(int sw_control);
void pdc_io_reset(void);
void pdc_io_reset_devices(void);
int pdc_iodc_getc(void);
void pdc_iodc_putc(unsigned char c);
void pdc_iodc_outc(unsigned char c);
int pdc_iodc_print(unsigned char *str, unsigned count);
void pdc_printf(const char *fmt, ...);

void pdc_emergency_unlock(void);
Expand Down

0 comments on commit 6caa15d

Please sign in to comment.