From 20e2cd35cbe6ee16ff636fba5635b7c5f96b7744 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Imre=20Vad=C3=A1sz?= Date: Sun, 28 Jan 2018 16:11:10 +0100 Subject: [PATCH] syscons - Untangle device attachement from isa?, attach to nexus? instead. * The syscons device was still attaching via the isa? bus for mostly historical reasons. Instead directly attach to nexus? and use a custom _identify method to create the sc%d child devices. --- sys/config/LINT64 | 2 +- sys/config/X86_64_GENERIC | 2 +- .../misc/syscons/syscons_nexus.c} | 37 +++++++++++++++------- sys/platform/pc64/conf/files | 2 +- 4 files changed, 29 insertions(+), 14 deletions(-) rename sys/{bus/isa/syscons_isa.c => dev/misc/syscons/syscons_nexus.c} (86%) diff --git a/sys/config/LINT64 b/sys/config/LINT64 index a1c46a147d..a7200a6e8e 100644 --- a/sys/config/LINT64 +++ b/sys/config/LINT64 @@ -855,7 +855,7 @@ options VGA_WIDTH90 # support 90 column modes pseudo-device splash # The syscons console driver (sco color console compatible). -device sc0 at isa? +device sc0 at nexus? options MAXCONS=16 # number of virtual consoles options SC_ALT_MOUSE_IMAGE # simplified mouse cursor in text mode options SC_DEBUG_LEVEL=5 # enable debug output diff --git a/sys/config/X86_64_GENERIC b/sys/config/X86_64_GENERIC index ddefdc30ab..3d3e3d6d6e 100644 --- a/sys/config/X86_64_GENERIC +++ b/sys/config/X86_64_GENERIC @@ -160,7 +160,7 @@ pseudo-device splash # syscons is the default console driver, resembling an SCO console # only one syscons with efi framebuffer flag (0x400) allowed -device sc0 at isa? flags 0x500 +device sc0 at nexus? flags 0x500 options SC_PIXEL_MODE # add support for the raster text mode options SC_DFLT_FONT makeoptions SC_DFLT_FONT=cp437 diff --git a/sys/bus/isa/syscons_isa.c b/sys/dev/misc/syscons/syscons_nexus.c similarity index 86% rename from sys/bus/isa/syscons_isa.c rename to sys/dev/misc/syscons/syscons_nexus.c index 751326d839..7a93d83571 100644 --- a/sys/bus/isa/syscons_isa.c +++ b/sys/dev/misc/syscons/syscons_nexus.c @@ -41,15 +41,14 @@ #include -#include "isareg.h" -#include "isavar.h" - static devclass_t sc_devclass; +static void scidentify(driver_t *driver, device_t parent); static int scprobe(device_t dev); static int scattach(device_t dev); static device_method_t sc_methods[] = { + DEVMETHOD(device_identify, scidentify), DEVMETHOD(device_probe, scprobe), DEVMETHOD(device_attach, scattach), DEVMETHOD_END @@ -63,13 +62,31 @@ static driver_t sc_driver = { static sc_softc_t main_softc; +static void +scidentify(driver_t *driver, device_t parent) +{ + device_t child; + int i, u; + int f; + + for (i = -1; (i = resource_locate(i, SC_DRIVER_NAME)) >= 0;) { + u = resource_query_unit(i); + if (u < 0) + continue; + if (resource_disabled(SC_DRIVER_NAME, u)) + continue; + if (resource_int_value(SC_DRIVER_NAME, u, "flags", &f) != 0) + f = 0; + child = BUS_ADD_CHILD(parent, parent, 0, "sc", u); + if (child == NULL) + panic("%s", __func__); + device_set_flags(child, f); + } +} + static int scprobe(device_t dev) { - /* No pnp support */ - if (isa_get_vendorid(dev)) - return (ENXIO); - device_set_desc(dev, "System console"); return sc_probe_unit(device_get_unit(dev), device_get_flags(dev)); } @@ -137,7 +154,6 @@ sc_find_softc(struct video_adapter *adp, struct keyboard *kbd) int sc_get_cons_priority(int *unit, int *flags) { - int disabled; int u, f; int i; int have_efi_fb = (probe_efi_fb(1) == 0); @@ -145,8 +161,7 @@ sc_get_cons_priority(int *unit, int *flags) *unit = -1; for (i = -1; (i = resource_locate(i, SC_DRIVER_NAME)) >= 0;) { u = resource_query_unit(i); - if ((resource_int_value(SC_DRIVER_NAME, u, "disabled", - &disabled) == 0) && disabled) + if (resource_disabled(SC_DRIVER_NAME, u)) continue; if (resource_int_value(SC_DRIVER_NAME, u, "flags", &f) != 0) f = 0; @@ -194,4 +209,4 @@ sc_tone(int hertz) #endif } -DRIVER_MODULE(sc, isa, sc_driver, sc_devclass, NULL, NULL); +DRIVER_MODULE(sc, nexus, sc_driver, sc_devclass, NULL, NULL); diff --git a/sys/platform/pc64/conf/files b/sys/platform/pc64/conf/files index efc42480eb..b53f576ed5 100644 --- a/sys/platform/pc64/conf/files +++ b/sys/platform/pc64/conf/files @@ -211,7 +211,7 @@ dev/misc/ppc/ppc.c optional ppc dev/misc/psm/psm.c optional psm dev/serial/sio/sio.c optional sio dev/serial/sio/sio_pccard.c optional sio pccard -bus/isa/syscons_isa.c optional sc +dev/misc/syscons/syscons_nexus.c optional sc bus/isa/vga_isa.c optional vga platform/pc64/isa/clock.c standard platform/pc64/isa/isa_intr.c optional isa -- 2.11.4.GIT