syscons - Untangle device attachement from isa?, attach to nexus? instead.
authorImre Vadász <imre@vdsz.com>
Sun, 28 Jan 2018 15:11:10 +0000 (16:11 +0100)
committerImre Vadász <imre@vdsz.com>
Sun, 28 Jan 2018 15:45:53 +0000 (16:45 +0100)
* 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
sys/config/X86_64_GENERIC
sys/dev/misc/syscons/syscons_nexus.c [moved from sys/bus/isa/syscons_isa.c with 86% similarity]
sys/platform/pc64/conf/files

index a1c46a1..a7200a6 100644 (file)
@@ -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
index ddefdc3..3d3e3d6 100644 (file)
@@ -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
similarity index 86%
rename from sys/bus/isa/syscons_isa.c
rename to sys/dev/misc/syscons/syscons_nexus.c
index 751326d..7a93d83 100644 (file)
 
 #include <dev/misc/syscons/syscons.h>
 
-#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);
index efc4248..b53f576 100644 (file)
@@ -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