/** * pdc_iodc_putc - Console character print using IODC. * @c: the character to output. * * 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) { /* 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; unsigned int 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; } 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); }
static void pdc_console_write(struct console *co, const char *s, unsigned count) { while(count--) pdc_iodc_putc(*s++); }