From abe914b63dae26f7168fdddf2491af9e67474117 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Tue, 13 Jun 2000 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2000-06-13 --- pc/ns16552.h | 35 ++++++++++++++++++++++++++--------- pc/sdata.c | 5 ++--- pc/vgamach64xx.c | 2 +- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/pc/ns16552.h b/pc/ns16552.h index 335e7eeb800bd743d01abaca26a247f5da709f9d..407067d37cf8aa82fd375e098b0066ad0adda0df 100644 --- a/pc/ns16552.h +++ b/pc/ns16552.h @@ -76,6 +76,28 @@ mp008intr(Ureg* ureg, void* arg) } } +/* + * install a default serial port on a PC unless + * name=disabled is set in plan9.ini + */ +void +ns16552default(char *name, int port, int irq) +{ + char *p; + + if((p = getconf(name)) && strncmp(p, "disabled", 8) == 0) + return; + + if(ioalloc(port, 8, 0, name) < 0) { + print("%s: port %x in use\n", name, port); + return; + } + + ns16552setup(port, UartFREQ, name, Ns550); + intrenable(irq, ns16552intrx, (void*)(nuart-1), BUSUNKNOWN, name); +} + + /* * install the uarts (called by reset) */ @@ -92,15 +114,10 @@ ns16552install(void) return; already = 1; - /* first two ports are always there and always the normal frequency */ - if(ioalloc(0x3f8, 8, 0, "eia0") < 0) - print("eia0: port %d in use\n", 0x3f8); - ns16552setup(0x3F8, UartFREQ, "eia0", Ns550); - intrenable(IrqUART0, ns16552intrx, (void*)0, BUSUNKNOWN, "eia0"); - if(ioalloc(0x2F8, 8, 0, "eia1") < 0) - print("eia1: port %d in use\n", 0x2F8); - ns16552setup(0x2F8, UartFREQ, "eia1", Ns550); - intrenable(IrqUART1, ns16552intrx, (void*)1, BUSUNKNOWN, "eia1"); + /* first two ports are usually there and always the normal frequency */ + ns16552default("eia0", 0x3F8, IrqUART0); + ns16552default("eia1", 0x2F8, IrqUART1); + addclock0link(uartclock); /* set up a serial console */ diff --git a/pc/sdata.c b/pc/sdata.c index ba26c96d54208cf9eb1826d15268162a082362f1..04df00a4d3faf936897529fb7e4c8c8d7857e26b 100644 --- a/pc/sdata.c +++ b/pc/sdata.c @@ -606,11 +606,10 @@ retry: if(DEBUG & DbgCONFIG){ print("dev %2.2uX config %4.4uX capabilities %4.4uX", dev, drive->info[Iconfig], drive->info[Icapabilities]); - print(" mwdma %4.4uX dma %8.8uX", - drive->info[Imwdma], drive->dma); + print(" mwdma %4.4uX", drive->info[Imwdma]); if(drive->info[Ivalid] & 0x04) print(" udma %4.4uX", drive->info[Iudma]); - print(" rwm %ud\n", drive->rwm); + print(" dma %8.8uX rwm %ud\n", drive->dma, drive->rwm); } return drive; diff --git a/pc/vgamach64xx.c b/pc/vgamach64xx.c index a17bb7c8eb01505b1ad4eced9978a407025b7570..9b278accc9731ec4085511c6e45f8d175035274c 100644 --- a/pc/vgamach64xx.c +++ b/pc/vgamach64xx.c @@ -122,7 +122,7 @@ mach64xxlinear(VGAscr* scr, int* size, int* align) else scr->isupamem = 1; - scr->mmio = (ulong*)(aperture+osize-0x400); + scr->mmio = KADDR(aperture+osize-0x400); if(oaperture) print("warning (BUG): redefinition of aperture does not change mach64mmio segment\n"); memset(&seg, 0, sizeof(seg));