1 --- a/hw/xfree86/os-support/solaris/sun_init.c Fri Jun 5 12:41:14 2015
2 +++ b/hw/xfree86/os-support/solaris/sun_init.c Fri Jun 5 12:48:06 2015
4 * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
5 * Copyright 1993 by David Wexelblat <dwex@goblin.org>
6 * Copyright 1999 by David Holland <davidh@iquest.net>
7 + * Copyright (c) 2013 Oracle and/or its affiliates. All Rights Reserved.
9 * Permission to use, copy, modify, distribute, and sell this software and its
10 * documentation for any purpose is hereby granted without fee, provided that
12 Used by hw/xfree86/common/xf86AutoConfig.c for VIS_GETIDENTIFIER */
13 _X_HIDDEN char xf86SolarisFbDev[PATH_MAX] = "/dev/fb";
15 +#if (defined(__sparc__) || defined(__sparc))
16 +static void GetFbDevFromProbe(void);
17 +static Bool xf86SolarisFbDevIsSet = FALSE;
21 switch_to(int vt, const char *from)
25 FatalError("xf86OpenConsole: Server must be suid root\n");
27 +#if (defined(__sparc__) || defined(__sparc))
31 + if (!xf86SolarisFbDevIsSet && (stat("/dev/fb", &buf) != 0) &&
32 + (xf86NumDrivers == 1))
33 + GetFbDevFromProbe();
42 if (!strcmp(argv[i], "-dev")) {
43 strlcpy(xf86SolarisFbDev, argv[i + 1], sizeof(xf86SolarisFbDev));
44 +#if (defined(__sparc__) || defined(__sparc))
45 + xf86SolarisFbDevIsSet = TRUE;
54 +#if (defined(__sparc__) || defined(__sparc))
56 +GetFbDevFromProbe(void) {
60 + numDevs = xf86MatchDevice(xf86DriverList[0]->driverName, &devList);
65 + struct pci_device_iterator *iter;
67 + const struct pci_id_match *const devices =
68 + xf86DriverList[0]->supported_devices;
71 + struct pci_device *pPci;
72 + struct sol_device_private {
73 + struct pci_device base;
74 + const char * device_string;
76 +#define DEV_PATH(dev) (((struct sol_device_private *) dev)->device_string)
77 +#define END_OF_MATCHES(m) \
78 + (((m).vendor_id == 0) && ((m).device_id == 0) && ((m).subvendor_id == 0))
80 + /* Find the pciVideoRec associated with this device section.
82 + iter = pci_id_match_iterator_create(NULL);
83 + while ((pPci = pci_device_next(iter)) != NULL) {
84 + if (devList[0]->busID && *devList[0]->busID) {
85 + if (xf86ComparePciBusString(devList[0]->busID,
86 + ((pPci->domain << 8)
88 + pPci->dev, pPci->func)) {
92 + else if (xf86IsPrimaryPci(pPci)) {
97 + pci_iterator_destroy(iter);
102 + /* If driver provides supported_devices, then check if this
103 + device is on the list. Otherwise skip check.
108 + device_id = (devList[0]->chipID > 0)
109 + ? devList[0]->chipID : pPci->device_id;
111 + /* Once the pciVideoRec is found, determine if the device is supported
114 + for (i = 0; !END_OF_MATCHES(devices[i]); i++) {
115 + if (PCI_ID_COMPARE(devices[i].vendor_id, pPci->vendor_id)
116 + && PCI_ID_COMPARE(devices[i].device_id, device_id)
117 + && ((devices[i].device_class_mask & pPci->device_class)
118 + == devices[i].device_class)) {
126 + strcpy(xf86SolarisFbDev, "/devices");
127 + strcat(xf86SolarisFbDev, DEV_PATH(pPci));
128 + xf86Msg(X_INFO, "Got xf86SolarisFbDev From Probe: %s\n", xf86SolarisFbDev);