From owner-p4-projects Sun Nov 24 22: 0:58 2002 Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0437B37B404; Sun, 24 Nov 2002 22:00:52 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8F13B37B401 for ; Sun, 24 Nov 2002 22:00:51 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3401F43E3B for ; Sun, 24 Nov 2002 22:00:51 -0800 (PST) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.6/8.12.6) with ESMTP id gAP5vOmV044807 for ; Sun, 24 Nov 2002 21:57:24 -0800 (PST) (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.6/8.12.6/Submit) id gAP5vNuP044802 for perforce@freebsd.org; Sun, 24 Nov 2002 21:57:23 -0800 (PST) Date: Sun, 24 Nov 2002 21:57:23 -0800 (PST) Message-Id: <200211250557.gAP5vNuP044802@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar Subject: PERFORCE change 21478 for review To: Perforce Change Reviews Sender: owner-p4-projects@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG http://perforce.freebsd.org/chv.cgi?CH=21478 Change 21478 by marcel@marcel_nfs on 2002/11/24 21:57:08 Some more hacking to make this usable as console. Either standalone (vga_cons.c) or as adapter for syscons (vga_vid.c) It's not there yet (both cases). Is this just a waste of time or is this actually useful enough to proceed. For now it allows us to boot the HP box all the way up to init(8), where it hangs due to lack of console... Affected files ... .. //depot/projects/ia64/sys/dev/vga/vga.c#3 edit .. //depot/projects/ia64/sys/dev/vga/vga.h#2 edit .. //depot/projects/ia64/sys/dev/vga/vga_cons.c#2 edit .. //depot/projects/ia64/sys/dev/vga/vga_pci.c#2 edit .. //depot/projects/ia64/sys/dev/vga/vga_vid.c#2 edit Differences ... ==== //depot/projects/ia64/sys/dev/vga/vga.c#3 (text+ko) ==== @@ -131,6 +131,11 @@ sc = device_get_softc(dev); + sc->vga_enable = 1; + + if (sc->vga_console) + return (vga_cnattach(dev)); + for (y = 0; y < 24; y++) for (x = 0; x < 80; x++) vga_write(sc, x, y, ' ', 7); @@ -140,6 +145,5 @@ vga_write(sc, 0, 24, '/', 7); vga_write(sc, 79, 24, '\\', 7); - sc->vga_enable = 1; return (0); } ==== //depot/projects/ia64/sys/dev/vga/vga.h#2 (text+ko) ==== @@ -38,6 +38,7 @@ struct vga_softc { device_t vga_dev; + dev_t vga_node; /* Device flags and state. */ u_int32_t vga_bustype:2; @@ -65,3 +66,4 @@ extern char vga_device_name[]; int vga_attach(device_t); +int vga_cnattach(device_t); ==== //depot/projects/ia64/sys/dev/vga/vga_cons.c#2 (text+ko) ==== @@ -34,18 +34,44 @@ #include #include #include +#include #include #include +#include #include extern void vga_putc(struct vga_softc *, int); +static d_open_t vga_open; +static d_close_t vga_close; +static d_read_t vga_read; +static d_write_t vga_write; +static d_ioctl_t vga_ioctl; + +#define CDEV_MAJOR 20 +static struct cdevsw vga_cdevsw = { + /* open */ vga_open, + /* close */ vga_close, + /* read */ vga_read, + /* write */ vga_write, + /* ioctl */ vga_ioctl, + /* poll */ ttypoll, + /* mmap */ nommap, + /* strategy */ nostrategy, + /* name */ vga_device_name, + /* maj */ CDEV_MAJOR, + /* dump */ nodump, + /* psize */ nopsize, + /* flags */ D_TTY | D_KQFILTER, + /* kqfilter */ ttykqfilter, +}; + static cn_checkc_t vga_cncheckc; static cn_getc_t vga_cngetc; static cn_init_t vga_cninit; -cn_probe_t vga_cnprobe; -cn_putc_t vga_cnputc; +static cn_probe_t vga_cnprobe; +static cn_putc_t vga_cnputc; static cn_term_t vga_cnterm; CONS_DRIVER(vga, vga_cnprobe, vga_cninit, vga_cnterm, vga_cngetc, vga_cncheckc, @@ -63,6 +89,9 @@ struct vga_softc *sc = &vga_console; u_int8_t x; + if (sc->vga_enable) + goto consdev; + /* * XXX we actually need to test here of course. */ @@ -84,10 +113,23 @@ sc->vga_console = 1; sc->vga_enable = 1; - if (cp != NULL) { - cp->cn_dev = 0; - cp->cn_pri = CN_NORMAL; - } + consdev: + cp->cn_dev = makedev(CDEV_MAJOR, 0); + cp->cn_pri = CN_REMOTE; +} + +int vga_cnattach(device_t dev) +{ + struct vga_softc *sc; + int unit; + + sc = device_get_softc(dev); + unit = device_get_unit(dev); + + sc->vga_node = make_dev(&vga_cdevsw, unit, UID_ROOT, GID_WHEEL, 0600, + "vga%r", unit); + + return (0); } static int @@ -120,3 +162,33 @@ vga_cnterm(struct consdev *cp __unused) { } + +static int +vga_open(dev_t dev, int flag, int mode, struct thread *td) +{ + return (ENXIO); +} + +static int +vga_close(dev_t dev, int flag, int mode, struct thread *td) +{ + return (ENXIO); +} + +static int +vga_read(dev_t dev, struct uio *uio, int flag) +{ + return (ENXIO); +} + +static int +vga_write(dev_t dev, struct uio *uio, int flag) +{ + return (ENXIO); +} + +static int +vga_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) +{ + return (ENXIO); +} ==== //depot/projects/ia64/sys/dev/vga/vga_pci.c#2 (text+ko) ==== @@ -112,7 +112,7 @@ /* The softc is already initialized if VGA is the console. */ if (sc->vga_console) - return (0); + return (vga_attach(dev)); bus_set_resource(dev, SYS_RES_MEMORY, VGA_RES_FB, 0xA0000, 0x20000); error = vga_pci_alloc(dev, sc, SYS_RES_MEMORY, VGA_RES_FB); ==== //depot/projects/ia64/sys/dev/vga/vga_vid.c#2 (text+ko) ==== @@ -122,15 +122,22 @@ struct vga_softc *sc = &vga_console; u_int8_t x; - /* We actually get called more than once (twice to be exact). */ + if (flags) + return (0); + + /* + * We actually get called more than once (twice to be exact). The + * first time it's as part of console probing. The second time + * it's as part of the regular syscons initialization. + */ if (sc->vga_enable == 1) - return (1); + goto adapter; /* * XXX we actually need to test here of course. */ sc->vga_fb.tag = IA64_BUS_SPACE_MEM; - sc->vga_fb.handle = 0xA0000; + sc->vga_fb.handle = (6ULL << 61) + 0xA0000; sc->vga_reg.tag = IA64_BUS_SPACE_IO; sc->vga_reg.handle = 0x3c0; @@ -147,13 +154,19 @@ sc->vga_console = 1; sc->vga_enable = 1; + adapter: + if (vga_adapter.va_flags & V_ADP_PROBED) + return (1); + bzero(&vga_adapter, sizeof(vga_adapter)); vga_adapter.va_flags |= V_ADP_PROBED; vga_adapter.va_flags |= (sc->vga_mono) ? 0 : V_ADP_COLOR; vga_adapter.va_name = vga_device_name; vga_adapter.va_type = KD_VGA; - vga_adapter.va_window = (6ULL << 61) + sc->vga_fb.handle + + vga_adapter.va_window = sc->vga_fb.handle + (sc->vga_mono) ? 0x10000 : 0x18000; + vga_adapter.va_window_size = 80*25*2; + vga_adapter.va_crtc_addr = sc->vga_crtc.handle; vid_register(&vga_adapter); return (1); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe p4-projects" in the body of the message