@@ -23,12 +23,42 @@ void setup_8250_early_printk_port(unsigned long base, unsigned int reg_shift,
static inline u8 serial_in(int offset)
{
- return readb(serial8250_base + (offset << serial8250_reg_shift));
+ u8 ret = 0xFF;
+
+ offset <<= serial8250_reg_shift;
+ switch (serial8250_reg_shift) {
+ case 0:
+ ret = readb(serial8250_base + offset);
+ break;
+ case 1:
+ ret = readw(serial8250_base + offset);
+ break;
+ case 2:
+ ret = readl(serial8250_base + offset);
+ break;
+ default:
+ break;
+ }
+
+ return ret;
}
static inline void serial_out(int offset, char value)
{
- writeb(value, serial8250_base + (offset << serial8250_reg_shift));
+ offset <<= serial8250_reg_shift;
+ switch (serial8250_reg_shift) {
+ case 0:
+ writeb(value, serial8250_base + offset);
+ break;
+ case 1:
+ writew(value, serial8250_base + offset);
+ break;
+ case 2:
+ writel(value, serial8250_base + offset);
+ break;
+ default:
+ break;
+ }
}
void prom_putchar(char c)