component(developer/golang-123): Add Component
[oi-userland.git] / components / x11 / xorg-server / patches / 11-sparc-probe.patch
blobb2bd6972532d81c85e6c3a711cf6c4484a26ae39
1 # Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
3 # Permission is hereby granted, free of charge, to any person obtaining a
4 # copy of this software and associated documentation files (the "Software"),
5 # to deal in the Software without restriction, including without limitation
6 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 # and/or sell copies of the Software, and to permit persons to whom the
8 # Software is furnished to do so, subject to the following conditions:
10 # The above copyright notice and this permission notice (including the next
11 # paragraph) shall be included in all copies or substantial portions of the
12 # Software.
14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 # DEALINGS IN THE SOFTWARE.
23 Allow probing for /dev/fb cards other than the traditional sbus devices.
25 diff --git a/hw/xfree86/common/xf86sbusBus.c b/hw/xfree86/common/xf86sbusBus.c
26 index c993b60..05c4def 100644
27 --- a/hw/xfree86/common/xf86sbusBus.c
28 +++ b/hw/xfree86/common/xf86sbusBus.c
29 @@ -40,6 +40,10 @@
30 #include "xf86sbusBus.h"
31 #include "xf86Sbus.h"
33 +#ifdef sun
34 +# include <sys/visual_io.h>
35 +#endif
37 Bool sbusSlotClaimed = FALSE;
39 static int xf86nSbusInfo;
40 @@ -231,8 +235,25 @@ xf86SbusProbe(void)
41 free(promPath);
44 - else
45 + else {
46 +#ifdef sun
47 + if (psdp->devId == SBUS_DEVICE_UNK) {
48 + int fbfd;
50 + fbfd = open(psdp->device, O_RDONLY, 0);
51 + if (fbfd >= 0) {
52 + struct vis_identifier visid;
53 + if (ioctl(fbfd, VIS_GETIDENTIFIER, &visid) >= 0) {
54 + psdp->descr = strdup(visid.name);
55 + }
56 + close(fbfd);
57 + }
58 + }
59 + xf86Msg(X_PROBED, "%s: %s", psdp->device, psdp->descr);
60 +#else
61 xf86Msg(X_PROBED, "SBUS: %s", psdp->descr);
62 +#endif
63 + }
64 xf86ErrorF("\n");
66 if (useProm)
67 diff --git a/hw/xfree86/common/xf86sbusBus.h b/hw/xfree86/common/xf86sbusBus.h
68 index a4d9c6c..cd8d4a7 100644
69 --- a/hw/xfree86/common/xf86sbusBus.h
70 +++ b/hw/xfree86/common/xf86sbusBus.h
71 @@ -39,6 +39,7 @@
72 #define SBUS_DEVICE_FFB 0x000b
73 #define SBUS_DEVICE_GT 0x000c
74 #define SBUS_DEVICE_MGX 0x000d
75 +#define SBUS_DEVICE_UNK 0x000e
77 typedef struct sbus_prom_node {
78 int node;
79 diff --git a/hw/xfree86/os-support/bus/Sbus.c b/hw/xfree86/os-support/bus/Sbus.c
80 index b75308a..2bf7e1b 100644
81 --- a/hw/xfree86/os-support/bus/Sbus.c
82 +++ b/hw/xfree86/os-support/bus/Sbus.c
83 @@ -71,6 +71,7 @@ struct sbus_devtable sbusDeviceTable[] = {
84 {SBUS_DEVICE_TCX, FBTYPE_TCXCOLOR, "tcx", "suntcx", "Sun TCX"},
85 {SBUS_DEVICE_FFB, FBTYPE_CREATOR, "ffb", "sunffb", "Sun FFB"},
86 {SBUS_DEVICE_FFB, FBTYPE_CREATOR, "afb", "sunffb", "Sun Elite3D"},
87 + {SBUS_DEVICE_UNK, FBTYPE_LASTPLUSONE + 1, "unknown", "unknown", "Unknown FB"},
88 {0, 0, NULL}