aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/kernel/firmware.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/parisc/kernel/firmware.c')
-rw-r--r--arch/parisc/kernel/firmware.c88
1 files changed, 34 insertions, 54 deletions
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index fd6552c4c08c..4ab83d56974d 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -1082,76 +1082,56 @@ void pdc_io_reset_devices(void)
1082 1082
1083 1083
1084/** 1084/**
1085 * pdc_iodc_putc - Console character print using IODC. 1085 * pdc_iodc_print - Console print using IODC.
1086 * @c: the character to output. 1086 * @str: the string to output.
1087 * @count: length of str
1087 * 1088 *
1088 * Note that only these special chars are architected for console IODC io: 1089 * Note that only these special chars are architected for console IODC io:
1089 * BEL, BS, CR, and LF. Others are passed through. 1090 * BEL, BS, CR, and LF. Others are passed through.
1090 * Since the HP console requires CR+LF to perform a 'newline', we translate 1091 * Since the HP console requires CR+LF to perform a 'newline', we translate
1091 * "\n" to "\r\n". 1092 * "\n" to "\r\n".
1092 */ 1093 */
1093void pdc_iodc_putc(unsigned char c) 1094int pdc_iodc_print(unsigned char *str, unsigned count)
1094{ 1095{
1095 /* XXX Should we spinlock posx usage */ 1096 /* XXX Should we spinlock posx usage */
1096 static int posx; /* for simple TAB-Simulation... */ 1097 static int posx; /* for simple TAB-Simulation... */
1097 static int __attribute__((aligned(8))) iodc_retbuf[32]; 1098 int __attribute__((aligned(8))) iodc_retbuf[32];
1098 static char __attribute__((aligned(64))) iodc_dbuf[4096]; 1099 char __attribute__((aligned(64))) iodc_dbuf[4096];
1099 unsigned int n; 1100 unsigned int i;
1100 unsigned long flags; 1101 unsigned long flags;
1101 1102
1102 switch (c) { 1103 memset(iodc_dbuf, 0, 4096);
1103 case '\n': 1104 for (i = 0; i < count && i < 2048;) {
1104 iodc_dbuf[0] = '\r'; 1105 switch(str[i]) {
1105 iodc_dbuf[1] = '\n'; 1106 case '\n':
1106 n = 2; 1107 iodc_dbuf[i+0] = '\r';
1107 posx = 0; 1108 iodc_dbuf[i+1] = '\n';
1108 break; 1109 i += 2;
1109 case '\t': 1110 posx = 0;
1110 pdc_iodc_putc(' '); 1111 break;
1111 while (posx & 7) /* expand TAB */ 1112 case '\t':
1112 pdc_iodc_putc(' '); 1113 while (posx & 7) {
1113 return; /* return since IODC can't handle this */ 1114 iodc_dbuf[i] = ' ';
1114 case '\b': 1115 i++, posx++;
1115 posx-=2; /* BS */ 1116 }
1116 default: 1117 break;
1117 iodc_dbuf[0] = c; 1118 case '\b': /* BS */
1118 n = 1; 1119 posx -= 2;
1119 posx++; 1120 default:
1120 break; 1121 iodc_dbuf[i] = str[i];
1121 } 1122 i++, posx++;
1123 break;
1124 }
1125 }
1122 1126
1123 spin_lock_irqsave(&pdc_lock, flags); 1127 spin_lock_irqsave(&pdc_lock, flags);
1124 real32_call(PAGE0->mem_cons.iodc_io, 1128 real32_call(PAGE0->mem_cons.iodc_io,
1125 (unsigned long)PAGE0->mem_cons.hpa, ENTRY_IO_COUT, 1129 (unsigned long)PAGE0->mem_cons.hpa, ENTRY_IO_COUT,
1126 PAGE0->mem_cons.spa, __pa(PAGE0->mem_cons.dp.layers), 1130 PAGE0->mem_cons.spa, __pa(PAGE0->mem_cons.dp.layers),
1127 __pa(iodc_retbuf), 0, __pa(iodc_dbuf), n, 0); 1131 __pa(iodc_retbuf), 0, __pa(iodc_dbuf), i, 0);
1128 spin_unlock_irqrestore(&pdc_lock, flags); 1132 spin_unlock_irqrestore(&pdc_lock, flags);
1129}
1130 1133
1131/** 1134 return i;
1132 * pdc_iodc_outc - Console character print using IODC (without conversions).
1133 * @c: the character to output.
1134 *
1135 * Write the character directly to the IODC console.
1136 */
1137void pdc_iodc_outc(unsigned char c)
1138{
1139 unsigned int n;
1140 unsigned long flags;
1141
1142 /* fill buffer with one caracter and print it */
1143 static int __attribute__((aligned(8))) iodc_retbuf[32];
1144 static char __attribute__((aligned(64))) iodc_dbuf[4096];
1145
1146 n = 1;
1147 iodc_dbuf[0] = c;
1148
1149 spin_lock_irqsave(&pdc_lock, flags);
1150 real32_call(PAGE0->mem_cons.iodc_io,
1151 (unsigned long)PAGE0->mem_cons.hpa, ENTRY_IO_COUT,
1152 PAGE0->mem_cons.spa, __pa(PAGE0->mem_cons.dp.layers),
1153 __pa(iodc_retbuf), 0, __pa(iodc_dbuf), n, 0);
1154 spin_unlock_irqrestore(&pdc_lock, flags);
1155} 1135}
1156 1136
1157/** 1137/**