2 #include "../port/lib.h"
7 #include "../port/error.h"
9 extern PhysUart i8250physuart;
10 extern PhysUart isaphysuart;
11 extern void* i8250alloc(int, int, int);
14 uartisa(int ctlrno, ISAConf* isa)
22 snprint(buf, sizeof(buf), "%s%d", isaphysuart.name, ctlrno);
23 if(ioalloc(io, 8, 0, buf) < 0){
24 print("uartisa: I/O 0x%uX in use\n", io);
28 uart = malloc(sizeof(Uart));
29 ctlr = i8250alloc(io, isa->irq, BUSUNKNOWN);
30 if(uart == nil || ctlr == nil){
37 snprint(buf, sizeof(buf), "COM%d", ctlrno+1);
38 kstrdup(&uart->name, buf);
39 uart->freq = isa->freq;
40 uart->phys = &i8250physuart;
50 Uart *head, *tail, *uart;
53 * Look for up to 4 discrete UARTs on the ISA bus.
54 * All suitable devices are configured to simply point
55 * to the generic i8250 driver.
58 for(ctlrno = 2; ctlrno < 6; ctlrno++){
59 memset(&isa, 0, sizeof(isa));
60 if(!isaconfig("uart", ctlrno, &isa))
62 if(strcmp(isa.type, "isa") != 0)
64 if(isa.port == 0 || isa.irq == 0)
68 uart = uartisa(ctlrno, &isa);
81 PhysUart isaphysuart = {