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)
21 uart = malloc(sizeof(Uart));
23 print("uartisa: no memory for Uart\n");
28 snprint(buf, sizeof(buf), "%s%d", isaphysuart.name, ctlrno);
29 if(ioalloc(io, 8, 0, buf) < 0){
30 print("uartisa: I/O 0x%uX in use\n", io);
35 ctlr = i8250alloc(io, isa->irq, BUSUNKNOWN);
43 snprint(buf, sizeof(buf), "COM%d", ctlrno+1);
44 kstrdup(&uart->name, buf);
45 uart->freq = isa->freq;
46 uart->phys = &i8250physuart;
56 Uart *head, *tail, *uart;
59 * Look for up to 4 discrete UARTs on the ISA bus.
60 * All suitable devices are configured to simply point
61 * to the generic i8250 driver.
64 for(ctlrno = 2; ctlrno < 6; ctlrno++){
65 memset(&isa, 0, sizeof(isa));
66 if(!isaconfig("uart", ctlrno, &isa))
68 if(strcmp(isa.type, "isa") != 0)
70 if(isa.port == 0 || isa.irq == 0)
74 uart = uartisa(ctlrno, &isa);
87 PhysUart isaphysuart = {