mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-18 12:16:49 +07:00
[PARISC] print more than one character at a time for pdc console
There's really no reason not to print more than one character at a time to the PDC console... Booting is measurably speedier, and now I don't have to watch individual characters get drawn. Signed-off-by: Kyle McMartin <kyle@mcmartin.ca>
This commit is contained in:
parent
ac6aecbf05
commit
721fdf3416
@ -1082,76 +1082,56 @@ void pdc_io_reset_devices(void)
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pdc_iodc_putc - Console character print using IODC.
|
* pdc_iodc_print - Console print using IODC.
|
||||||
* @c: the character to output.
|
* @str: the string to output.
|
||||||
|
* @count: length of str
|
||||||
*
|
*
|
||||||
* Note that only these special chars are architected for console IODC io:
|
* Note that only these special chars are architected for console IODC io:
|
||||||
* BEL, BS, CR, and LF. Others are passed through.
|
* BEL, BS, CR, and LF. Others are passed through.
|
||||||
* Since the HP console requires CR+LF to perform a 'newline', we translate
|
* Since the HP console requires CR+LF to perform a 'newline', we translate
|
||||||
* "\n" to "\r\n".
|
* "\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 */
|
/* XXX Should we spinlock posx usage */
|
||||||
static int posx; /* for simple TAB-Simulation... */
|
static int posx; /* for simple TAB-Simulation... */
|
||||||
static int __attribute__((aligned(8))) iodc_retbuf[32];
|
int __attribute__((aligned(8))) iodc_retbuf[32];
|
||||||
static char __attribute__((aligned(64))) iodc_dbuf[4096];
|
char __attribute__((aligned(64))) iodc_dbuf[4096];
|
||||||
unsigned int n;
|
unsigned int i;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
switch (c) {
|
memset(iodc_dbuf, 0, 4096);
|
||||||
case '\n':
|
for (i = 0; i < count && i < 2048;) {
|
||||||
iodc_dbuf[0] = '\r';
|
switch(str[i]) {
|
||||||
iodc_dbuf[1] = '\n';
|
case '\n':
|
||||||
n = 2;
|
iodc_dbuf[i+0] = '\r';
|
||||||
posx = 0;
|
iodc_dbuf[i+1] = '\n';
|
||||||
break;
|
i += 2;
|
||||||
case '\t':
|
posx = 0;
|
||||||
pdc_iodc_putc(' ');
|
break;
|
||||||
while (posx & 7) /* expand TAB */
|
case '\t':
|
||||||
pdc_iodc_putc(' ');
|
while (posx & 7) {
|
||||||
return; /* return since IODC can't handle this */
|
iodc_dbuf[i] = ' ';
|
||||||
case '\b':
|
i++, posx++;
|
||||||
posx-=2; /* BS */
|
}
|
||||||
default:
|
break;
|
||||||
iodc_dbuf[0] = c;
|
case '\b': /* BS */
|
||||||
n = 1;
|
posx -= 2;
|
||||||
posx++;
|
default:
|
||||||
break;
|
iodc_dbuf[i] = str[i];
|
||||||
}
|
i++, posx++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
spin_lock_irqsave(&pdc_lock, flags);
|
spin_lock_irqsave(&pdc_lock, flags);
|
||||||
real32_call(PAGE0->mem_cons.iodc_io,
|
real32_call(PAGE0->mem_cons.iodc_io,
|
||||||
(unsigned long)PAGE0->mem_cons.hpa, ENTRY_IO_COUT,
|
(unsigned long)PAGE0->mem_cons.hpa, ENTRY_IO_COUT,
|
||||||
PAGE0->mem_cons.spa, __pa(PAGE0->mem_cons.dp.layers),
|
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);
|
spin_unlock_irqrestore(&pdc_lock, flags);
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
return i;
|
||||||
* 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,13 +55,7 @@
|
|||||||
|
|
||||||
static void pdc_console_write(struct console *co, const char *s, unsigned count)
|
static void pdc_console_write(struct console *co, const char *s, unsigned count)
|
||||||
{
|
{
|
||||||
while(count--)
|
pdc_iodc_print(s, count);
|
||||||
pdc_iodc_putc(*s++);
|
|
||||||
}
|
|
||||||
|
|
||||||
void pdc_outc(unsigned char c)
|
|
||||||
{
|
|
||||||
pdc_iodc_outc(c);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pdc_printf(const char *fmt, ...)
|
void pdc_printf(const char *fmt, ...)
|
||||||
@ -74,8 +68,7 @@ void pdc_printf(const char *fmt, ...)
|
|||||||
len = vscnprintf(buf, sizeof(buf), fmt, args);
|
len = vscnprintf(buf, sizeof(buf), fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
pdc_iodc_print(buf, len);
|
||||||
pdc_iodc_outc(buf[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int pdc_console_poll_key(struct console *co)
|
int pdc_console_poll_key(struct console *co)
|
||||||
|
@ -645,8 +645,7 @@ int pdc_soft_power_button(int sw_control);
|
|||||||
void pdc_io_reset(void);
|
void pdc_io_reset(void);
|
||||||
void pdc_io_reset_devices(void);
|
void pdc_io_reset_devices(void);
|
||||||
int pdc_iodc_getc(void);
|
int pdc_iodc_getc(void);
|
||||||
void pdc_iodc_putc(unsigned char c);
|
int pdc_iodc_print(unsigned char *str, unsigned count);
|
||||||
void pdc_iodc_outc(unsigned char c);
|
|
||||||
void pdc_printf(const char *fmt, ...);
|
void pdc_printf(const char *fmt, ...);
|
||||||
|
|
||||||
void pdc_emergency_unlock(void);
|
void pdc_emergency_unlock(void);
|
||||||
|
Loading…
Reference in New Issue
Block a user