| 1 | int __init probe_base_port(int base) |
| 2 | { |
| 3 | int b = 0x300, e = 0x370; /* this is the range of start addresses */ |
| 4 | volatile int fool, i; |
| 5 | |
| 6 | if (base) |
| 7 | b = e = base; |
| 8 | for (base = b; base <= e; base += 0x10) { |
| 9 | if (check_region(base, 0x10)) |
| 10 | continue; |
| 11 | for (i = 0; i < 3; i++) |
| 12 | fool = inw(base + 2); /* empty possibly uart_receive_buffer */ |
| 13 | if ((inw(base + 6) & 0xffef) != 0x0001 || /* line_status */ |
| 14 | (inw(base) & 0xad00) != 0) /* data status */ |
| 15 | continue; |
| 16 | return (base); |
| 17 | } |
| 18 | return 0; |
| 19 | } |
| 20 | |