Modifying X.Org Xserver DDX to allow to run X with ordinary user
permissions when no access to HW registers is required. For API changes which mostly involve the modifications to make the RRFunc (introduced with 6.8) more flexible please check Bugzilla #2407. NOTE: This patch applies changes to OS specific files for other OSes which I cannot test.
This commit is contained in:
parent
1562ec5cc3
commit
d23c46dd3e
|
@ -3030,7 +3030,7 @@ void
|
||||||
xf86FindPrimaryDevice()
|
xf86FindPrimaryDevice()
|
||||||
{
|
{
|
||||||
/* if no VGA device is found check for primary PCI device */
|
/* if no VGA device is found check for primary PCI device */
|
||||||
if (primaryBus.type == BUS_NONE)
|
if (primaryBus.type == BUS_NONE && xorgHWAccess)
|
||||||
CheckGenericGA();
|
CheckGenericGA();
|
||||||
if (primaryBus.type != BUS_NONE) {
|
if (primaryBus.type != BUS_NONE) {
|
||||||
char *bus;
|
char *bus;
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#endif
|
#endif
|
||||||
#include "xf86.h"
|
#include "xf86.h"
|
||||||
#include "xf86Config.h"
|
#include "xf86Config.h"
|
||||||
|
#include "xf86_OSlib.h"
|
||||||
#include "xf86Priv.h"
|
#include "xf86Priv.h"
|
||||||
#include "xf86PciData.h"
|
#include "xf86PciData.h"
|
||||||
#define IN_XSERVER
|
#define IN_XSERVER
|
||||||
|
@ -789,6 +790,24 @@ DoConfigure()
|
||||||
|
|
||||||
xfree(vlist);
|
xfree(vlist);
|
||||||
|
|
||||||
|
for (i = 0; i < xf86NumDrivers; i++) {
|
||||||
|
xorgHWFlags flags;
|
||||||
|
if (!xf86DriverList[i]->driverFunc
|
||||||
|
|| !xf86DriverList[i]->driverFunc(NULL,
|
||||||
|
GET_REQUIRED_HW_INTERFACES,
|
||||||
|
&flags)
|
||||||
|
|| NEED_IO_ENABLED(flags)) {
|
||||||
|
xorgHWAccess = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Enable full I/O access */
|
||||||
|
if (xorgHWAccess) {
|
||||||
|
if(!xf86EnableIO())
|
||||||
|
/* oops, we have failed */
|
||||||
|
xorgHWAccess = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Disable PCI devices */
|
/* Disable PCI devices */
|
||||||
xf86ResourceBrokerInit();
|
xf86ResourceBrokerInit();
|
||||||
xf86AccessInit();
|
xf86AccessInit();
|
||||||
|
@ -803,6 +822,16 @@ DoConfigure()
|
||||||
|
|
||||||
/* Call all of the probe functions, reporting the results. */
|
/* Call all of the probe functions, reporting the results. */
|
||||||
for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
|
for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
|
||||||
|
xorgHWFlags flags;
|
||||||
|
|
||||||
|
if (!xorgHWAccess) {
|
||||||
|
if (!xf86DriverList[CurrentDriver]->driverFunc
|
||||||
|
|| !xf86DriverList[CurrentDriver]->driverFunc(NULL,
|
||||||
|
GET_REQUIRED_HW_INTERFACES,
|
||||||
|
&flags)
|
||||||
|
|| NEED_IO_ENABLED(flags))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (xf86DriverList[CurrentDriver]->Probe == NULL) continue;
|
if (xf86DriverList[CurrentDriver]->Probe == NULL) continue;
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "loaderProcs.h"
|
#include "loaderProcs.h"
|
||||||
#include "xf86Config.h"
|
#include "xf86Config.h"
|
||||||
#endif /* XFree86LOADER */
|
#endif /* XFree86LOADER */
|
||||||
|
#include "xf86_OSlib.h"
|
||||||
#include "xf86.h"
|
#include "xf86.h"
|
||||||
#include "xf86Priv.h"
|
#include "xf86Priv.h"
|
||||||
|
|
||||||
|
@ -53,7 +54,8 @@ DoProbe()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Bool probeResult;
|
Bool probeResult;
|
||||||
|
Bool ioEnableFailed = FALSE;
|
||||||
|
|
||||||
#ifdef XFree86LOADER
|
#ifdef XFree86LOADER
|
||||||
/* Find the list of video driver modules. */
|
/* Find the list of video driver modules. */
|
||||||
char **list = xf86DriverlistFromCompile();
|
char **list = xf86DriverlistFromCompile();
|
||||||
|
@ -76,6 +78,24 @@ DoProbe()
|
||||||
|
|
||||||
/* Call all of the probe functions, reporting the results. */
|
/* Call all of the probe functions, reporting the results. */
|
||||||
for (i = 0; i < xf86NumDrivers; i++) {
|
for (i = 0; i < xf86NumDrivers; i++) {
|
||||||
|
|
||||||
|
if (!xorgHWAccess) {
|
||||||
|
xorgHWFlags flags;
|
||||||
|
if (!xf86DriverList[i]->driverFunc
|
||||||
|
|| !xf86DriverList[i]->driverFunc(NULL,
|
||||||
|
GET_REQUIRED_HW_INTERFACES,
|
||||||
|
&flags)
|
||||||
|
|| NEED_IO_ENABLED(flags)) {
|
||||||
|
if (ioEnableFailed)
|
||||||
|
continue;
|
||||||
|
if (!xf86EnableIO()) {
|
||||||
|
ioEnableFailed = TRUE;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
xorgHWAccess = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (xf86DriverList[i]->Probe == NULL) continue;
|
if (xf86DriverList[i]->Probe == NULL) continue;
|
||||||
|
|
||||||
xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n",
|
xf86MsgVerb(X_INFO, 3, "Probing in driver %s\n",
|
||||||
|
|
|
@ -1431,7 +1431,8 @@ xf86VTSwitch()
|
||||||
xf86Screens[i]->access = NULL;
|
xf86Screens[i]->access = NULL;
|
||||||
xf86Screens[i]->busAccess = NULL;
|
xf86Screens[i]->busAccess = NULL;
|
||||||
}
|
}
|
||||||
xf86DisableIO();
|
if (xorgHWAccess)
|
||||||
|
xf86DisableIO();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -1443,7 +1444,8 @@ xf86VTSwitch()
|
||||||
prevSIGIO = xf86BlockSIGIO();
|
prevSIGIO = xf86BlockSIGIO();
|
||||||
xf86OSPMClose = xf86OSPMOpen();
|
xf86OSPMClose = xf86OSPMOpen();
|
||||||
|
|
||||||
xf86EnableIO();
|
if (xorgHWAccess)
|
||||||
|
xf86EnableIO();
|
||||||
xf86AccessEnter();
|
xf86AccessEnter();
|
||||||
xf86EnterServerState(SETUP);
|
xf86EnterServerState(SETUP);
|
||||||
for (i = 0; i < xf86NumScreens; i++) {
|
for (i = 0; i < xf86NumScreens; i++) {
|
||||||
|
|
|
@ -238,6 +238,7 @@ Bool xf86MiscModInDevAllowNonLocal = FALSE;
|
||||||
#endif
|
#endif
|
||||||
RootWinPropPtr *xf86RegisteredPropertiesTable = NULL;
|
RootWinPropPtr *xf86RegisteredPropertiesTable = NULL;
|
||||||
Bool xf86inSuspend = FALSE;
|
Bool xf86inSuspend = FALSE;
|
||||||
|
Bool xorgHWAccess = FALSE;
|
||||||
|
|
||||||
#ifdef DLOPEN_HACK
|
#ifdef DLOPEN_HACK
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -83,7 +83,12 @@ xf86AddDriver(DriverPtr driver, pointer module, int flags)
|
||||||
xf86DriverList = xnfrealloc(xf86DriverList,
|
xf86DriverList = xnfrealloc(xf86DriverList,
|
||||||
xf86NumDrivers * sizeof(DriverPtr));
|
xf86NumDrivers * sizeof(DriverPtr));
|
||||||
xf86DriverList[xf86NumDrivers - 1] = xnfalloc(sizeof(DriverRec));
|
xf86DriverList[xf86NumDrivers - 1] = xnfalloc(sizeof(DriverRec));
|
||||||
*xf86DriverList[xf86NumDrivers - 1] = *driver;
|
if (flags & HaveDriverFuncs)
|
||||||
|
*xf86DriverList[xf86NumDrivers - 1] = *driver;
|
||||||
|
else {
|
||||||
|
memcpy(xf86DriverList[xf86NumDrivers - 1], driver, sizeof(DriverRec1));
|
||||||
|
xf86DriverList[xf86NumDrivers - 1]->driverFunc = NULL;
|
||||||
|
}
|
||||||
xf86DriverList[xf86NumDrivers - 1]->module = module;
|
xf86DriverList[xf86NumDrivers - 1]->module = module;
|
||||||
xf86DriverList[xf86NumDrivers - 1]->refCount = 0;
|
xf86DriverList[xf86NumDrivers - 1]->refCount = 0;
|
||||||
}
|
}
|
||||||
|
@ -209,6 +214,8 @@ xf86AllocateScreen(DriverPtr drv, int flags)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
xf86Screens[i]->DriverFunc = drv->driverFunc;
|
||||||
|
|
||||||
return xf86Screens[i];
|
return xf86Screens[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,9 +378,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
|
|
||||||
xf86OpenConsole();
|
xf86OpenConsole();
|
||||||
|
|
||||||
/* Enable full I/O access */
|
|
||||||
xf86EnableIO();
|
|
||||||
|
|
||||||
/* Do a general bus probe. This will be a PCI probe for x86 platforms */
|
/* Do a general bus probe. This will be a PCI probe for x86 platforms */
|
||||||
xf86BusProbe();
|
xf86BusProbe();
|
||||||
|
|
||||||
|
@ -446,20 +443,37 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Call each of the Identify functions. The Identify functions print
|
* Call each of the Identify functions and call the driverFunc to check
|
||||||
* out some identifying information, and anything else that might be
|
* if HW access is required. The Identify functions print out some
|
||||||
|
* identifying information, and anything else that might be
|
||||||
* needed at this early stage.
|
* needed at this early stage.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < xf86NumDrivers; i++)
|
for (i = 0; i < xf86NumDrivers; i++) {
|
||||||
|
xorgHWFlags flags;
|
||||||
/* The Identify function is mandatory, but if it isn't there continue */
|
/* The Identify function is mandatory, but if it isn't there continue */
|
||||||
if (xf86DriverList[i]->Identify != NULL)
|
if (xf86DriverList[i]->Identify != NULL)
|
||||||
xf86DriverList[i]->Identify(0);
|
xf86DriverList[i]->Identify(0);
|
||||||
else {
|
else {
|
||||||
xf86Msg(X_WARNING, "Driver `%s' has no Identify function\n",
|
xf86Msg(X_WARNING, "Driver `%s' has no Identify function\n",
|
||||||
xf86DriverList[i]->driverName ? xf86DriverList[i]->driverName
|
xf86DriverList[i]->driverName ? xf86DriverList[i]->driverName
|
||||||
: "noname");
|
: "noname");
|
||||||
}
|
}
|
||||||
|
if (!xorgHWAccess
|
||||||
|
&& (!xf86DriverList[i]->driverFunc
|
||||||
|
|| !xf86DriverList[i]->driverFunc(NULL,
|
||||||
|
GET_REQUIRED_HW_INTERFACES,
|
||||||
|
&flags)
|
||||||
|
|| NEED_IO_ENABLED(flags)))
|
||||||
|
xorgHWAccess = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Enable full I/O access */
|
||||||
|
if (xorgHWAccess) {
|
||||||
|
if(!xf86EnableIO())
|
||||||
|
/* oops, we have failed */
|
||||||
|
xorgHWAccess = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Locate bus slot that had register IO enabled at server startup
|
* Locate bus slot that had register IO enabled at server startup
|
||||||
|
@ -475,15 +489,25 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < xf86NumDrivers; i++) {
|
for (i = 0; i < xf86NumDrivers; i++) {
|
||||||
if (xf86DriverList[i]->Probe != NULL)
|
xorgHWFlags flags;
|
||||||
xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DEFAULT);
|
if (!xorgHWAccess) {
|
||||||
else {
|
if (!xf86DriverList[i]->driverFunc
|
||||||
xf86MsgVerb(X_WARNING, 0,
|
|| !xf86DriverList[i]->driverFunc(NULL,
|
||||||
"Driver `%s' has no Probe function (ignoring)\n",
|
GET_REQUIRED_HW_INTERFACES,
|
||||||
xf86DriverList[i]->driverName ? xf86DriverList[i]->driverName
|
&flags)
|
||||||
: "noname");
|
|| NEED_IO_ENABLED(flags))
|
||||||
}
|
continue;
|
||||||
xf86SetPciVideo(NULL,NONE);
|
}
|
||||||
|
|
||||||
|
if (xf86DriverList[i]->Probe != NULL)
|
||||||
|
xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DEFAULT);
|
||||||
|
else {
|
||||||
|
xf86MsgVerb(X_WARNING, 0,
|
||||||
|
"Driver `%s' has no Probe function (ignoring)\n",
|
||||||
|
xf86DriverList[i]->driverName
|
||||||
|
? xf86DriverList[i]->driverName : "noname");
|
||||||
|
}
|
||||||
|
xf86SetPciVideo(NULL,NONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -814,7 +838,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
xf86MsgVerb(X_INFO, 3, "APM registered successfully\n");
|
xf86MsgVerb(X_INFO, 3, "APM registered successfully\n");
|
||||||
|
|
||||||
/* Make sure full I/O access is enabled */
|
/* Make sure full I/O access is enabled */
|
||||||
xf86EnableIO();
|
if (xorgHWAccess)
|
||||||
|
xf86EnableIO();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -896,7 +921,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
|
||||||
xf86Screens[i]->DPMSSet = NULL;
|
xf86Screens[i]->DPMSSet = NULL;
|
||||||
xf86Screens[i]->LoadPalette = NULL;
|
xf86Screens[i]->LoadPalette = NULL;
|
||||||
xf86Screens[i]->SetOverscan = NULL;
|
xf86Screens[i]->SetOverscan = NULL;
|
||||||
xf86Screens[i]->RRFunc = NULL;
|
xf86Screens[i]->DriverFunc = NULL;
|
||||||
xf86Screens[i]->pScreen = NULL;
|
xf86Screens[i]->pScreen = NULL;
|
||||||
scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
|
scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
|
||||||
if (scr_index == i) {
|
if (scr_index == i) {
|
||||||
|
@ -1330,7 +1355,7 @@ ddxProcessArgument(int argc, char **argv, int i)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* First the options that are only allowed for root */
|
/* First the options that are only allowed for root */
|
||||||
if (getuid() == 0)
|
if (getuid() == 0 || geteuid != 0)
|
||||||
{
|
{
|
||||||
if (!strcmp(argv[i], "-modulepath"))
|
if (!strcmp(argv[i], "-modulepath"))
|
||||||
{
|
{
|
||||||
|
@ -1636,7 +1661,7 @@ ddxProcessArgument(int argc, char **argv, int i)
|
||||||
}
|
}
|
||||||
if (!strcmp(argv[i], "-configure"))
|
if (!strcmp(argv[i], "-configure"))
|
||||||
{
|
{
|
||||||
if (getuid() != 0) {
|
if (getuid() != 0 && geteuid == 0) {
|
||||||
ErrorF("The '-configure' option can only be used by root.\n");
|
ErrorF("The '-configure' option can only be used by root.\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
@ -1665,7 +1690,7 @@ ddxUseMsg()
|
||||||
ErrorF("\n");
|
ErrorF("\n");
|
||||||
ErrorF("\n");
|
ErrorF("\n");
|
||||||
ErrorF("Device Dependent Usage\n");
|
ErrorF("Device Dependent Usage\n");
|
||||||
if (getuid() == 0)
|
if (getuid() == 0 || geteuid() != 0)
|
||||||
{
|
{
|
||||||
ErrorF("-modulepath paths specify the module search path\n");
|
ErrorF("-modulepath paths specify the module search path\n");
|
||||||
ErrorF("-logfile file specify a log file name\n");
|
ErrorF("-logfile file specify a log file name\n");
|
||||||
|
|
|
@ -112,6 +112,7 @@ extern int xf86Verbose; /* verbosity level */
|
||||||
extern int xf86LogVerbose; /* log file verbosity level */
|
extern int xf86LogVerbose; /* log file verbosity level */
|
||||||
extern Bool xf86ProbeOnly;
|
extern Bool xf86ProbeOnly;
|
||||||
extern Bool xf86DoProbe;
|
extern Bool xf86DoProbe;
|
||||||
|
extern Bool xorgHWAccess;
|
||||||
|
|
||||||
extern RootWinPropPtr *xf86RegisteredPropertiesTable;
|
extern RootWinPropPtr *xf86RegisteredPropertiesTable;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.5 2004/08/13 18:24:07 sandmann Exp $ */
|
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.6 2004/12/04 00:42:52 kuhn Exp $ */
|
||||||
/*
|
/*
|
||||||
* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.7tsi Exp $
|
* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86RandR.c,v 1.7tsi Exp $
|
||||||
*
|
*
|
||||||
|
@ -104,11 +104,11 @@ xf86RandRGetInfo (ScreenPtr pScreen, Rotation *rotations)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there is driver support for randr, let it set our supported rotations */
|
/* If there is driver support for randr, let it set our supported rotations */
|
||||||
if(scrp->RRFunc) {
|
if(scrp->DriverFunc) {
|
||||||
xorgRRRotation RRRotation;
|
xorgRRRotation RRRotation;
|
||||||
|
|
||||||
RRRotation.RRRotations = *rotations;
|
RRRotation.RRRotations = *rotations;
|
||||||
if (!(*scrp->RRFunc)(scrp, RR_GET_INFO, &RRRotation))
|
if (!(*scrp->DriverFunc)(scrp, RR_GET_INFO, &RRRotation))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
*rotations = RRRotation.RRRotations;
|
*rotations = RRRotation.RRRotations;
|
||||||
}
|
}
|
||||||
|
@ -216,14 +216,14 @@ xf86RandRSetConfig (ScreenPtr pScreen,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Have the driver do its thing. */
|
/* Have the driver do its thing. */
|
||||||
if (scrp->RRFunc) {
|
if (scrp->DriverFunc) {
|
||||||
xorgRRRotation RRRotation;
|
xorgRRRotation RRRotation;
|
||||||
RRRotation.RRConfig.rotation = rotation;
|
RRRotation.RRConfig.rotation = rotation;
|
||||||
RRRotation.RRConfig.rate = rate;
|
RRRotation.RRConfig.rate = rate;
|
||||||
RRRotation.RRConfig.width = pSize->width;
|
RRRotation.RRConfig.width = pSize->width;
|
||||||
RRRotation.RRConfig.height = pSize->height;
|
RRRotation.RRConfig.height = pSize->height;
|
||||||
|
|
||||||
if (!(*scrp->RRFunc)(scrp, RR_SET_CONFIG, &RRRotation))
|
if (!(*scrp->DriverFunc)(scrp, RR_SET_CONFIG, &RRRotation))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -235,10 +235,60 @@ typedef struct x_ClockRanges {
|
||||||
int strategy;
|
int strategy;
|
||||||
} ClockRanges, *ClockRangesPtr;
|
} ClockRanges, *ClockRangesPtr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The driverFunc. xorgDriverFuncOp specifies the action driver should
|
||||||
|
* perform. If requested option is not supported function should return
|
||||||
|
* FALSE. pointer can be used to pass arguments to the function or
|
||||||
|
* to return data to the caller.
|
||||||
|
*/
|
||||||
|
typedef struct _ScrnInfoRec *ScrnInfoPtr;
|
||||||
|
|
||||||
|
/* do not change order */
|
||||||
|
typedef enum {
|
||||||
|
RR_GET_INFO,
|
||||||
|
RR_SET_CONFIG,
|
||||||
|
GET_REQUIRED_HW_INTERFACES = 10
|
||||||
|
} xorgDriverFuncOp;
|
||||||
|
|
||||||
|
typedef Bool xorgDriverFuncProc (ScrnInfoPtr, xorgDriverFuncOp,
|
||||||
|
pointer);
|
||||||
|
|
||||||
|
/* RR_GET_INFO, RR_SET_CONFIG */
|
||||||
|
typedef struct {
|
||||||
|
int rotation;
|
||||||
|
int rate;
|
||||||
|
int width;
|
||||||
|
int height;
|
||||||
|
} xorgRRConfig;
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
short RRRotations;
|
||||||
|
xorgRRConfig RRConfig;
|
||||||
|
} xorgRRRotation, *xorgRRRotationPtr;
|
||||||
|
|
||||||
|
/* GET_REQUIRED_HW_INTERFACES */
|
||||||
|
#define HW_IO 1
|
||||||
|
#define HW_MMIO 2
|
||||||
|
#define NEED_IO_ENABLED(x) (x & HW_IO)
|
||||||
|
|
||||||
|
typedef CARD32 xorgHWFlags;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The driver list struct. This contains the information required for each
|
* The driver list struct. This contains the information required for each
|
||||||
* driver before a ScrnInfoRec has been allocated.
|
* driver before a ScrnInfoRec has been allocated.
|
||||||
*/
|
*/
|
||||||
|
struct _DriverRec;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
int driverVersion;
|
||||||
|
char * driverName;
|
||||||
|
void (*Identify)(int flags);
|
||||||
|
Bool (*Probe)(struct _DriverRec *drv, int flags);
|
||||||
|
const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
|
||||||
|
pointer module;
|
||||||
|
int refCount;
|
||||||
|
} DriverRec1;
|
||||||
|
|
||||||
typedef struct _DriverRec {
|
typedef struct _DriverRec {
|
||||||
int driverVersion;
|
int driverVersion;
|
||||||
char * driverName;
|
char * driverName;
|
||||||
|
@ -247,8 +297,15 @@ typedef struct _DriverRec {
|
||||||
const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
|
const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
|
||||||
pointer module;
|
pointer module;
|
||||||
int refCount;
|
int refCount;
|
||||||
|
xorgDriverFuncProc *driverFunc;
|
||||||
} DriverRec, *DriverPtr;
|
} DriverRec, *DriverPtr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* AddDriver flags
|
||||||
|
*/
|
||||||
|
#define HaveDriverFuncs 1
|
||||||
|
|
||||||
|
|
||||||
#ifdef XFree86LOADER
|
#ifdef XFree86LOADER
|
||||||
/*
|
/*
|
||||||
* The optional module list struct. This allows modules exporting helping
|
* The optional module list struct. This allows modules exporting helping
|
||||||
|
@ -737,24 +794,6 @@ typedef struct {
|
||||||
PixmapPtr pPix;
|
PixmapPtr pPix;
|
||||||
} DGADeviceRec, *DGADevicePtr;
|
} DGADeviceRec, *DGADevicePtr;
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
RR_GET_INFO,
|
|
||||||
RR_SET_CONFIG
|
|
||||||
} xorgRRFuncFlags;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int rotation;
|
|
||||||
int rate;
|
|
||||||
int width;
|
|
||||||
int height;
|
|
||||||
} xorgRRConfig;
|
|
||||||
|
|
||||||
typedef union {
|
|
||||||
short RRRotations;
|
|
||||||
xorgRRConfig RRConfig;
|
|
||||||
} xorgRRRotation, *xorgRRRotationPtr;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flags for driver Probe() functions.
|
* Flags for driver Probe() functions.
|
||||||
*/
|
*/
|
||||||
|
@ -765,7 +804,6 @@ typedef union {
|
||||||
/*
|
/*
|
||||||
* Driver entry point types
|
* Driver entry point types
|
||||||
*/
|
*/
|
||||||
typedef struct _ScrnInfoRec *ScrnInfoPtr;
|
|
||||||
|
|
||||||
typedef Bool xf86ProbeProc (DriverPtr, int);
|
typedef Bool xf86ProbeProc (DriverPtr, int);
|
||||||
typedef Bool xf86PreInitProc (ScrnInfoPtr, int);
|
typedef Bool xf86PreInitProc (ScrnInfoPtr, int);
|
||||||
|
@ -785,8 +823,6 @@ typedef int xf86HandleMessageProc (int, const char*, const char*, char**);
|
||||||
typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int);
|
typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int);
|
||||||
typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
|
typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
|
||||||
typedef void xf86SetOverscanProc (ScrnInfoPtr, int);
|
typedef void xf86SetOverscanProc (ScrnInfoPtr, int);
|
||||||
typedef Bool xorgRRFuncProc (ScrnInfoPtr, xorgRRFuncFlags,
|
|
||||||
xorgRRRotationPtr);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -942,7 +978,7 @@ typedef struct _ScrnInfoRec {
|
||||||
xf86DPMSSetProc *DPMSSet;
|
xf86DPMSSetProc *DPMSSet;
|
||||||
xf86LoadPaletteProc *LoadPalette;
|
xf86LoadPaletteProc *LoadPalette;
|
||||||
xf86SetOverscanProc *SetOverscan;
|
xf86SetOverscanProc *SetOverscan;
|
||||||
xorgRRFuncProc *RRFunc;
|
xorgDriverFuncProc *DriverFunc;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This can be used when the minor ABI version is incremented.
|
* This can be used when the minor ABI version is incremented.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c,v 1.5 2003/04/03 16:50:04 dawes Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/alpha_video.c,v 1.6 2003/12/30 15:18:30 herrb Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
|
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
|
||||||
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
|
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
|
||||||
|
@ -117,11 +117,13 @@ has_bwx(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#else /* __NetBSD__ */
|
#else /* __NetBSD__ */
|
||||||
|
static unsigned long hae_thresh = (1UL << 24);
|
||||||
|
static unsigned long hae_mask = 0xf8000000UL; /* XXX - should use xf86AXP.c */
|
||||||
static struct alpha_bus_window *abw;
|
static struct alpha_bus_window *abw;
|
||||||
static int abw_count = -1;
|
static int abw_count = -1;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_abw()
|
init_abw(void)
|
||||||
{
|
{
|
||||||
if (abw_count < 0) {
|
if (abw_count < 0) {
|
||||||
abw_count = alpha_bus_getwindows(ALPHA_BUS_TYPE_PCI_MEM, &abw);
|
abw_count = alpha_bus_getwindows(ALPHA_BUS_TYPE_PCI_MEM, &abw);
|
||||||
|
@ -142,7 +144,7 @@ has_bwx(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long
|
static unsigned long
|
||||||
dense_base()
|
dense_base(void)
|
||||||
{
|
{
|
||||||
if (abw_count < 0)
|
if (abw_count < 0)
|
||||||
init_abw();
|
init_abw();
|
||||||
|
@ -154,7 +156,7 @@ dense_base()
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long
|
static unsigned long
|
||||||
memory_base()
|
memory_base(void)
|
||||||
{
|
{
|
||||||
if (abw_count < 0)
|
if (abw_count < 0)
|
||||||
init_abw();
|
init_abw();
|
||||||
|
@ -284,11 +286,13 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
|
||||||
xf86Msg(X_PROBED,"Machine needs sparse mapping\n");
|
xf86Msg(X_PROBED,"Machine needs sparse mapping\n");
|
||||||
pVidMem->mapMem = mapVidMemSparse;
|
pVidMem->mapMem = mapVidMemSparse;
|
||||||
pVidMem->unmapMem = unmapVidMemSparse;
|
pVidMem->unmapMem = unmapVidMemSparse;
|
||||||
|
#ifndef __NetBSD__
|
||||||
if (axpSystem == -1)
|
if (axpSystem == -1)
|
||||||
axpSystem = bsdGetAXP();
|
axpSystem = bsdGetAXP();
|
||||||
hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
|
hae_thresh = xf86AXPParams[axpSystem].hae_thresh;
|
||||||
hae_mask = xf86AXPParams[axpSystem].hae_mask;
|
hae_mask = xf86AXPParams[axpSystem].hae_mask;
|
||||||
sparse_size = xf86AXPParams[axpSystem].size;
|
sparse_size = xf86AXPParams[axpSystem].size;
|
||||||
|
#endif /* __NetBSD__ */
|
||||||
}
|
}
|
||||||
pVidMem->initialised = TRUE;
|
pVidMem->initialised = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -314,7 +318,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
|
||||||
MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX);
|
MAP_FLAGS, devMemFd, (off_t)Base + BUS_BASE_BWX);
|
||||||
if (base == MAP_FAILED)
|
if (base == MAP_FAILED)
|
||||||
{
|
{
|
||||||
FatalError("%s: could not mmap %s [s=%x,a=%x] (%s)\n",
|
FatalError("%s: could not mmap %s [s=%lx,a=%lx] (%s)\n",
|
||||||
"xf86MapVidMem", DEV_MEM, Size, Base,
|
"xf86MapVidMem", DEV_MEM, Size, Base,
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
@ -324,7 +328,7 @@ mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
|
||||||
/* else, mmap /dev/vga */
|
/* else, mmap /dev/vga */
|
||||||
if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000)
|
if ((unsigned long)Base < 0xA0000 || (unsigned long)Base >= 0xC0000)
|
||||||
{
|
{
|
||||||
FatalError("%s: Address 0x%x outside allowable range\n",
|
FatalError("%s: Address 0x%lx outside allowable range\n",
|
||||||
"xf86MapVidMem", Base);
|
"xf86MapVidMem", Base);
|
||||||
}
|
}
|
||||||
base = mmap(0, Size,
|
base = mmap(0, Size,
|
||||||
|
@ -372,7 +376,7 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
|
||||||
if ((long)ptr == -1)
|
if ((long)ptr == -1)
|
||||||
{
|
{
|
||||||
xf86Msg(X_WARNING,
|
xf86Msg(X_WARNING,
|
||||||
"xf86ReadBIOS: %s mmap[s=%x,a=%x,o=%x] failed (%s)\n",
|
"xf86ReadBIOS: %s mmap[s=%x,a=%lx,o=%lx] failed (%s)\n",
|
||||||
DEV_MEM, Len, Base, Offset, strerror(errno));
|
DEV_MEM, Len, Base, Offset, strerror(errno));
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
@ -395,11 +399,12 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
|
||||||
|
|
||||||
extern int ioperm(unsigned long from, unsigned long num, int on);
|
extern int ioperm(unsigned long from, unsigned long num, int on);
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIO()
|
xf86EnableIO()
|
||||||
{
|
{
|
||||||
ioperm(0, 65536, TRUE);
|
if (!ioperm(0, 65536, TRUE))
|
||||||
return;
|
return TRUE;
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -412,10 +417,11 @@ xf86DisableIO()
|
||||||
|
|
||||||
#ifdef USE_ALPHA_PIO
|
#ifdef USE_ALPHA_PIO
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIO()
|
xf86EnableIO()
|
||||||
{
|
{
|
||||||
alpha_pci_io_enable(1);
|
alpha_pci_io_enable(1);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -490,6 +496,7 @@ struct parms {
|
||||||
u_int64_t hae;
|
u_int64_t hae;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef __NetBSD__
|
||||||
static int
|
static int
|
||||||
sethae(u_int64_t hae)
|
sethae(u_int64_t hae)
|
||||||
{
|
{
|
||||||
|
@ -505,6 +512,7 @@ sethae(u_int64_t hae)
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* __NetBSD__ */
|
||||||
|
|
||||||
static pointer
|
static pointer
|
||||||
mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
|
mapVidMemSparse(int ScreenNum, unsigned long Base, unsigned long Size, int flags)
|
||||||
|
@ -553,7 +561,6 @@ readSparse8(pointer Base, register unsigned long Offset)
|
||||||
{
|
{
|
||||||
register unsigned long result, shift;
|
register unsigned long result, shift;
|
||||||
register unsigned long msb;
|
register unsigned long msb;
|
||||||
|
|
||||||
mem_barrier();
|
mem_barrier();
|
||||||
Offset += (unsigned long)Base - (unsigned long)memBase;
|
Offset += (unsigned long)Base - (unsigned long)memBase;
|
||||||
shift = (Offset & 0x3) << 3;
|
shift = (Offset & 0x3) << 3;
|
||||||
|
@ -561,11 +568,12 @@ readSparse8(pointer Base, register unsigned long Offset)
|
||||||
msb = Offset & hae_mask;
|
msb = Offset & hae_mask;
|
||||||
Offset -= msb;
|
Offset -= msb;
|
||||||
if (msb_set != msb) {
|
if (msb_set != msb) {
|
||||||
|
#ifndef __NetBSD__
|
||||||
sethae(msb);
|
sethae(msb);
|
||||||
|
#endif
|
||||||
msb_set = msb;
|
msb_set = msb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result = *(vuip) ((unsigned long)memSBase + (Offset << 5));
|
result = *(vuip) ((unsigned long)memSBase + (Offset << 5));
|
||||||
result >>= shift;
|
result >>= shift;
|
||||||
return 0xffUL & result;
|
return 0xffUL & result;
|
||||||
|
@ -584,7 +592,9 @@ readSparse16(pointer Base, register unsigned long Offset)
|
||||||
msb = Offset & hae_mask;
|
msb = Offset & hae_mask;
|
||||||
Offset -= msb;
|
Offset -= msb;
|
||||||
if (msb_set != msb) {
|
if (msb_set != msb) {
|
||||||
|
#ifndef __NetBSD__
|
||||||
sethae(msb);
|
sethae(msb);
|
||||||
|
#endif
|
||||||
msb_set = msb;
|
msb_set = msb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -612,7 +622,9 @@ writeSparse8(int Value, pointer Base, register unsigned long Offset)
|
||||||
msb = Offset & hae_mask;
|
msb = Offset & hae_mask;
|
||||||
Offset -= msb;
|
Offset -= msb;
|
||||||
if (msb_set != msb) {
|
if (msb_set != msb) {
|
||||||
|
#ifndef __NetBSD__
|
||||||
sethae(msb);
|
sethae(msb);
|
||||||
|
#endif
|
||||||
msb_set = msb;
|
msb_set = msb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -631,7 +643,9 @@ writeSparse16(int Value, pointer Base, register unsigned long Offset)
|
||||||
msb = Offset & hae_mask;
|
msb = Offset & hae_mask;
|
||||||
Offset -= msb;
|
Offset -= msb;
|
||||||
if (msb_set != msb) {
|
if (msb_set != msb) {
|
||||||
|
#ifndef __NetBSD__
|
||||||
sethae(msb);
|
sethae(msb);
|
||||||
|
#endif
|
||||||
msb_set = msb;
|
msb_set = msb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -659,7 +673,9 @@ writeSparseNB8(int Value, pointer Base, register unsigned long Offset)
|
||||||
msb = Offset & hae_mask;
|
msb = Offset & hae_mask;
|
||||||
Offset -= msb;
|
Offset -= msb;
|
||||||
if (msb_set != msb) {
|
if (msb_set != msb) {
|
||||||
|
#ifndef __NetBSD__
|
||||||
sethae(msb);
|
sethae(msb);
|
||||||
|
#endif
|
||||||
msb_set = msb;
|
msb_set = msb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -677,7 +693,9 @@ writeSparseNB16(int Value, pointer Base, register unsigned long Offset)
|
||||||
msb = Offset & hae_mask ;
|
msb = Offset & hae_mask ;
|
||||||
Offset -= msb;
|
Offset -= msb;
|
||||||
if (msb_set != msb) {
|
if (msb_set != msb) {
|
||||||
|
#ifndef __NetBSD__
|
||||||
sethae(msb);
|
sethae(msb);
|
||||||
|
#endif
|
||||||
msb_set = msb;
|
msb_set = msb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c,v 1.2 2003/03/14 13:46:03 tsi Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/arm_video.c,v 1.1tsi Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
|
* Copyright 1992 by Rich Murphey <Rich@Rice.edu>
|
||||||
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
|
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
|
||||||
|
@ -449,18 +449,19 @@ armUnmapVidMem(int ScreenNum, pointer Base, unsigned long Size)
|
||||||
#ifdef USE_DEV_IO
|
#ifdef USE_DEV_IO
|
||||||
static int IoFd = -1;
|
static int IoFd = -1;
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIO()
|
xf86EnableIO()
|
||||||
{
|
{
|
||||||
if (IoFd >= 0)
|
if (IoFd >= 0)
|
||||||
return;
|
return TRUE;
|
||||||
|
|
||||||
if ((IoFd = open("/dev/io", O_RDWR)) == -1)
|
if ((IoFd = open("/dev/io", O_RDWR)) == -1)
|
||||||
{
|
{
|
||||||
FatalError("xf86EnableIO: "
|
xf86Msg(X_WARNING,"xf86EnableIO: "
|
||||||
"Failed to open /dev/io for extended I/O\n");
|
"Failed to open /dev/io for extended I/O\n");
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -478,14 +479,14 @@ xf86DisableIO()
|
||||||
|
|
||||||
#if defined(USE_ARC_MMAP) || defined(__arm32__)
|
#if defined(USE_ARC_MMAP) || defined(__arm32__)
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIO()
|
xf86EnableIO()
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
pointer base;
|
pointer base;
|
||||||
|
|
||||||
if (ExtendedEnabled)
|
if (ExtendedEnabled)
|
||||||
return;
|
return TRUE;
|
||||||
|
|
||||||
if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
|
if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
|
||||||
/* Try to map a page at the pccons I/O space */
|
/* Try to map a page at the pccons I/O space */
|
||||||
|
@ -496,18 +497,20 @@ xf86EnableIO()
|
||||||
IOPortBase = base;
|
IOPortBase = base;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FatalError("EnableIO: failed to mmap %s (%s)\n",
|
xf86Msg(X_WARNING,"EnableIO: failed to mmap %s (%s)\n",
|
||||||
"/dev/ttyC0", strerror(errno));
|
"/dev/ttyC0", strerror(errno));
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FatalError("EnableIO: failed to open %s (%s)\n",
|
xf86Msg("EnableIO: failed to open %s (%s)\n",
|
||||||
"/dev/ttyC0", strerror(errno));
|
"/dev/ttyC0", strerror(errno));
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtendedEnabled = TRUE;
|
ExtendedEnabled = TRUE;
|
||||||
|
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -554,7 +557,7 @@ static Bool ScreenEnabled[MAXSCREENS];
|
||||||
static Bool ExtendedEnabled = FALSE;
|
static Bool ExtendedEnabled = FALSE;
|
||||||
static Bool InitDone = FALSE;
|
static Bool InitDone = FALSE;
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIOPorts(ScreenNum)
|
xf86EnableIOPorts(ScreenNum)
|
||||||
int ScreenNum;
|
int ScreenNum;
|
||||||
{
|
{
|
||||||
|
@ -570,7 +573,7 @@ int ScreenNum;
|
||||||
ScreenEnabled[ScreenNum] = TRUE;
|
ScreenEnabled[ScreenNum] = TRUE;
|
||||||
|
|
||||||
if (ExtendedEnabled)
|
if (ExtendedEnabled)
|
||||||
return;
|
return TRUE;
|
||||||
|
|
||||||
#ifdef USE_ARC_MMAP
|
#ifdef USE_ARC_MMAP
|
||||||
if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
|
if ((fd = open("/dev/ttyC0", O_RDWR)) >= 0) {
|
||||||
|
@ -610,7 +613,7 @@ int ScreenNum;
|
||||||
(caddr_t)0x0, 0L)
|
(caddr_t)0x0, 0L)
|
||||||
- memInfoP->memInfo.u.map_info_mmap.internal_offset;
|
- memInfoP->memInfo.u.map_info_mmap.internal_offset;
|
||||||
ExtendedEnabled = TRUE;
|
ExtendedEnabled = TRUE;
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#ifdef USE_ARM32_MMAP
|
#ifdef USE_ARM32_MMAP
|
||||||
checkDevMem(TRUE);
|
checkDevMem(TRUE);
|
||||||
|
@ -626,19 +629,21 @@ int ScreenNum;
|
||||||
|
|
||||||
if (IOPortBase == (unsigned int)-1)
|
if (IOPortBase == (unsigned int)-1)
|
||||||
{
|
{
|
||||||
FatalError("xf86EnableIOPorts: failed to open mem device or map IO base. \n\
|
xf86Msg(X_WARNING,"xf86EnableIOPorts: failed to open mem device or map IO base. \n\
|
||||||
Make sure you have the Aperture Driver installed, or a kernel built with the INSECURE option\n");
|
Make sure you have the Aperture Driver installed, or a kernel built with the INSECURE option\n");
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
/* We don't have the IOBASE, so we can't map the address */
|
/* We don't have the IOBASE, so we can't map the address */
|
||||||
FatalError("xf86EnableIOPorts: failed to open mem device or map IO base. \n\
|
xf86Msg(X_WARNING,"xf86EnableIOPorts: failed to open mem device or map IO base. \n\
|
||||||
Try building the server with USE_ARM32_MMAP defined\n");
|
Try building the server with USE_ARM32_MMAP defined\n");
|
||||||
|
return FALSE;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ExtendedEnabled = TRUE;
|
ExtendedEnabled = TRUE;
|
||||||
|
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -331,25 +331,26 @@ xf86ReadBIOS(unsigned long Base, unsigned long Offset, unsigned char *Buf,
|
||||||
|
|
||||||
static Bool ExtendedEnabled = FALSE;
|
static Bool ExtendedEnabled = FALSE;
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIO()
|
xf86EnableIO()
|
||||||
{
|
{
|
||||||
if (ExtendedEnabled)
|
if (ExtendedEnabled)
|
||||||
return;
|
return TRUE;
|
||||||
|
|
||||||
if (i386_iopl(TRUE) < 0)
|
if (i386_iopl(TRUE) < 0)
|
||||||
{
|
{
|
||||||
#ifndef __OpenBSD__
|
#ifndef __OpenBSD__
|
||||||
FatalError("%s: Failed to set IOPL for extended I/O",
|
xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O",
|
||||||
"xf86EnableIO");
|
"xf86EnableIO");
|
||||||
#else
|
#else
|
||||||
FatalError("%s: Failed to set IOPL for extended I/O\n%s",
|
xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n%s",
|
||||||
"xf86EnableIO", SYSCTL_MSG);
|
"xf86EnableIO", SYSCTL_MSG);
|
||||||
#endif
|
#endif
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
ExtendedEnabled = TRUE;
|
ExtendedEnabled = TRUE;
|
||||||
|
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -373,25 +374,26 @@ xf86DisableIO()
|
||||||
|
|
||||||
static Bool ExtendedEnabled = FALSE;
|
static Bool ExtendedEnabled = FALSE;
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIO()
|
xf86EnableIO()
|
||||||
{
|
{
|
||||||
if (ExtendedEnabled)
|
if (ExtendedEnabled)
|
||||||
return;
|
return TRUE;
|
||||||
|
|
||||||
if (amd64_iopl(TRUE) < 0)
|
if (amd64_iopl(TRUE) < 0)
|
||||||
{
|
{
|
||||||
#ifndef __OpenBSD__
|
#ifndef __OpenBSD__
|
||||||
FatalError("%s: Failed to set IOPL for extended I/O",
|
xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O",
|
||||||
"xf86EnableIO");
|
"xf86EnableIO");
|
||||||
#else
|
#else
|
||||||
FatalError("%s: Failed to set IOPL for extended I/O\n%s",
|
xf86Msg(X_WARNING,"%s: Failed to set IOPL for extended I/O\n%s",
|
||||||
"xf86EnableIO", SYSCTL_MSG);
|
"xf86EnableIO", SYSCTL_MSG);
|
||||||
#endif
|
#endif
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
ExtendedEnabled = TRUE;
|
ExtendedEnabled = TRUE;
|
||||||
|
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -414,18 +416,19 @@ xf86DisableIO()
|
||||||
#ifdef USE_DEV_IO
|
#ifdef USE_DEV_IO
|
||||||
static int IoFd = -1;
|
static int IoFd = -1;
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIO()
|
xf86EnableIO()
|
||||||
{
|
{
|
||||||
if (IoFd >= 0)
|
if (IoFd >= 0)
|
||||||
return;
|
return TRUE;
|
||||||
|
|
||||||
if ((IoFd = open("/dev/io", O_RDWR)) == -1)
|
if ((IoFd = open("/dev/io", O_RDWR)) == -1)
|
||||||
{
|
{
|
||||||
FatalError("xf86EnableIO: "
|
xf86Msg(X_WARNING,"xf86EnableIO: "
|
||||||
"Failed to open /dev/io for extended I/O");
|
"Failed to open /dev/io for extended I/O");
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -208,13 +208,6 @@
|
||||||
#define PCI_MFDEV_SUPPORT 1 /* Include PCI multifunction device support */
|
#define PCI_MFDEV_SUPPORT 1 /* Include PCI multifunction device support */
|
||||||
#define PCI_BRIDGE_SUPPORT 1 /* Include support for PCI-to-PCI bridges */
|
#define PCI_BRIDGE_SUPPORT 1 /* Include support for PCI-to-PCI bridges */
|
||||||
|
|
||||||
#ifdef PC98
|
|
||||||
#define outb(port,data) _outb(port,data)
|
|
||||||
#define outl(port,data) _outl(port,data)
|
|
||||||
#define inb(port) _inb(port)
|
|
||||||
#define inl(port) _inl(port)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global data
|
* Global data
|
||||||
*/
|
*/
|
||||||
|
@ -833,90 +826,6 @@ pciGenFindFirst(void)
|
||||||
return pciGenFindNext();
|
return pciGenFindNext();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined (__powerpc__)
|
|
||||||
static int buserr_detected;
|
|
||||||
|
|
||||||
static
|
|
||||||
void buserr(int sig)
|
|
||||||
{
|
|
||||||
buserr_detected = 1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CARD32
|
|
||||||
pciCfgMech1Read(PCITAG tag, int offset)
|
|
||||||
{
|
|
||||||
unsigned long rv = 0xffffffff;
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
ErrorF("pciCfgMech1Read(tag=%08x,offset=%08x)\n", tag, offset);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__powerpc__)
|
|
||||||
signal(SIGBUS, buserr);
|
|
||||||
buserr_detected = 0;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
outl(0xCF8, PCI_EN | tag | (offset & 0xfc));
|
|
||||||
rv = inl(0xCFC);
|
|
||||||
|
|
||||||
#if defined(__powerpc__)
|
|
||||||
signal(SIGBUS, SIG_DFL);
|
|
||||||
if (buserr_detected)
|
|
||||||
{
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
ErrorF("pciCfgMech1Read() BUS ERROR\n");
|
|
||||||
#endif
|
|
||||||
return(0xffffffff);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
return(rv);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
pciCfgMech1Write(PCITAG tag, int offset, CARD32 val)
|
|
||||||
{
|
|
||||||
#ifdef DEBUGPCI
|
|
||||||
ErrorF("pciCfgMech1Write(tag=%08x,offset=%08x,val=%08x)\n",
|
|
||||||
tag, offset,val);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__powerpc__)
|
|
||||||
signal(SIGBUS, SIG_IGN);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
outl(0xCF8, PCI_EN | tag | (offset & 0xfc));
|
|
||||||
#if defined(Lynx) && defined(__powerpc__)
|
|
||||||
outb(0x80, 0x00); /* without this the next access fails
|
|
||||||
* on my Powerstack system when we use
|
|
||||||
* assembler inlines for outl */
|
|
||||||
#endif
|
|
||||||
outl(0xCFC, val);
|
|
||||||
|
|
||||||
#if defined(__powerpc__)
|
|
||||||
signal(SIGBUS, SIG_DFL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask, CARD32 val)
|
|
||||||
{
|
|
||||||
unsigned long rv = 0xffffffff;
|
|
||||||
|
|
||||||
#if defined(__powerpc__)
|
|
||||||
signal(SIGBUS, buserr);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
outl(0xCF8, PCI_EN | tag | (offset & 0xfc));
|
|
||||||
rv = inl(0xCFC);
|
|
||||||
rv = (rv & ~mask) | val;
|
|
||||||
outl(0xCFC, rv);
|
|
||||||
|
|
||||||
#if defined(__powerpc__)
|
|
||||||
signal(SIGBUS, SIG_DFL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
CARD32
|
CARD32
|
||||||
pciByteSwap(CARD32 u)
|
pciByteSwap(CARD32 u)
|
||||||
{
|
{
|
||||||
|
|
|
@ -140,6 +140,7 @@
|
||||||
#include "compiler.h"
|
#include "compiler.h"
|
||||||
#include "xf86.h"
|
#include "xf86.h"
|
||||||
#include "xf86Priv.h"
|
#include "xf86Priv.h"
|
||||||
|
#include "xf86_OSlib.h"
|
||||||
#include "Pci.h"
|
#include "Pci.h"
|
||||||
|
|
||||||
#ifdef PC98
|
#ifdef PC98
|
||||||
|
@ -278,6 +279,8 @@ void ix86PciSelectCfgmech(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case PCIProbe1:
|
case PCIProbe1:
|
||||||
|
if (!xf86EnableIO())
|
||||||
|
return;
|
||||||
|
|
||||||
xf86MsgVerb(X_INFO, 2,
|
xf86MsgVerb(X_INFO, 2,
|
||||||
"PCI: Probing config type using method 1\n");
|
"PCI: Probing config type using method 1\n");
|
||||||
|
@ -449,6 +452,8 @@ void ix86PciSelectCfgmech(void)
|
||||||
break; /* } */
|
break; /* } */
|
||||||
|
|
||||||
case PCIProbe2: /* { */
|
case PCIProbe2: /* { */
|
||||||
|
if (!xf86EnableIO())
|
||||||
|
return;
|
||||||
|
|
||||||
/* The scanpci-style detection method */
|
/* The scanpci-style detection method */
|
||||||
|
|
||||||
|
@ -481,6 +486,8 @@ void ix86PciSelectCfgmech(void)
|
||||||
break; /* } */
|
break; /* } */
|
||||||
|
|
||||||
case PCIForceConfig1:
|
case PCIForceConfig1:
|
||||||
|
if (!xf86EnableIO())
|
||||||
|
return;
|
||||||
|
|
||||||
xf86MsgVerb(X_INFO, 2, "PCI: Forcing config type 1\n");
|
xf86MsgVerb(X_INFO, 2, "PCI: Forcing config type 1\n");
|
||||||
|
|
||||||
|
@ -490,6 +497,8 @@ void ix86PciSelectCfgmech(void)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case PCIForceConfig2:
|
case PCIForceConfig2:
|
||||||
|
if (!xf86EnableIO())
|
||||||
|
return;
|
||||||
|
|
||||||
xf86MsgVerb(X_INFO, 2, "PCI: Forcing config type 2\n");
|
xf86MsgVerb(X_INFO, 2, "PCI: Forcing config type 2\n");
|
||||||
|
|
||||||
|
|
|
@ -99,9 +99,9 @@ linuxPciInit()
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
linuxPciOpenFile(PCITAG tag)
|
linuxPciOpenFile(PCITAG tag, Bool write)
|
||||||
{
|
{
|
||||||
static int lbus,ldev,lfunc,fd = -1;
|
static int lbus,ldev,lfunc,fd = -1,is_write = 0;
|
||||||
int bus, dev, func;
|
int bus, dev, func;
|
||||||
char file[32];
|
char file[32];
|
||||||
struct stat ignored;
|
struct stat ignored;
|
||||||
|
@ -109,7 +109,8 @@ linuxPciOpenFile(PCITAG tag)
|
||||||
bus = PCI_BUS_FROM_TAG(tag);
|
bus = PCI_BUS_FROM_TAG(tag);
|
||||||
dev = PCI_DEV_FROM_TAG(tag);
|
dev = PCI_DEV_FROM_TAG(tag);
|
||||||
func = PCI_FUNC_FROM_TAG(tag);
|
func = PCI_FUNC_FROM_TAG(tag);
|
||||||
if (fd == -1 || bus != lbus || dev != ldev || func != lfunc) {
|
if (fd == -1 || (write && (!is_write))
|
||||||
|
|| bus != lbus || dev != ldev || func != lfunc) {
|
||||||
if (fd != -1)
|
if (fd != -1)
|
||||||
close(fd);
|
close(fd);
|
||||||
if (bus < 256) {
|
if (bus < 256) {
|
||||||
|
@ -129,7 +130,19 @@ linuxPciOpenFile(PCITAG tag)
|
||||||
sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
|
sprintf(file, "/proc/bus/pci/%04x/%02x.%1x",
|
||||||
bus, dev, func);
|
bus, dev, func);
|
||||||
}
|
}
|
||||||
fd = open(file,O_RDWR);
|
if (write) {
|
||||||
|
fd = open(file,O_RDWR);
|
||||||
|
if (fd != -1) is_write = TRUE;
|
||||||
|
} else switch (is_write) {
|
||||||
|
case TRUE:
|
||||||
|
fd = open(file,O_RDWR);
|
||||||
|
if (fd > -1)
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fd = open(file,O_RDONLY);
|
||||||
|
is_write = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
lbus = bus;
|
lbus = bus;
|
||||||
ldev = dev;
|
ldev = dev;
|
||||||
lfunc = func;
|
lfunc = func;
|
||||||
|
@ -143,7 +156,7 @@ linuxPciCfgRead(PCITAG tag, int off)
|
||||||
int fd;
|
int fd;
|
||||||
CARD32 val = 0xffffffff;
|
CARD32 val = 0xffffffff;
|
||||||
|
|
||||||
if (-1 != (fd = linuxPciOpenFile(tag))) {
|
if (-1 != (fd = linuxPciOpenFile(tag,FALSE))) {
|
||||||
lseek(fd,off,SEEK_SET);
|
lseek(fd,off,SEEK_SET);
|
||||||
read(fd,&val,4);
|
read(fd,&val,4);
|
||||||
}
|
}
|
||||||
|
@ -155,7 +168,7 @@ linuxPciCfgWrite(PCITAG tag, int off, CARD32 val)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
if (-1 != (fd = linuxPciOpenFile(tag))) {
|
if (-1 != (fd = linuxPciOpenFile(tag,TRUE))) {
|
||||||
lseek(fd,off,SEEK_SET);
|
lseek(fd,off,SEEK_SET);
|
||||||
val = PCI_CPU(val);
|
val = PCI_CPU(val);
|
||||||
write(fd,&val,4);
|
write(fd,&val,4);
|
||||||
|
@ -168,7 +181,7 @@ linuxPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits)
|
||||||
int fd;
|
int fd;
|
||||||
CARD32 val = 0xffffffff;
|
CARD32 val = 0xffffffff;
|
||||||
|
|
||||||
if (-1 != (fd = linuxPciOpenFile(tag))) {
|
if (-1 != (fd = linuxPciOpenFile(tag,TRUE))) {
|
||||||
lseek(fd,off,SEEK_SET);
|
lseek(fd,off,SEEK_SET);
|
||||||
read(fd,&val,4);
|
read(fd,&val,4);
|
||||||
val = PCI_CPU(val);
|
val = PCI_CPU(val);
|
||||||
|
@ -336,7 +349,7 @@ xf86GetPciDomain(PCITAG Tag)
|
||||||
if (pPCI && (result = PCI_DOM_FROM_BUS(pPCI->busnum)))
|
if (pPCI && (result = PCI_DOM_FROM_BUS(pPCI->busnum)))
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
if ((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0)) < 0)
|
if ((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0,FALSE)) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((result = ioctl(fd, PCIIOC_CONTROLLER, 0)) < 0)
|
if ((result = ioctl(fd, PCIIOC_CONTROLLER, 0)) < 0)
|
||||||
|
@ -359,7 +372,7 @@ linuxMapPci(int ScreenNum, int Flags, PCITAG Tag,
|
||||||
|
|
||||||
pPCI = xf86GetPciHostConfigFromTag(Tag);
|
pPCI = xf86GetPciHostConfigFromTag(Tag);
|
||||||
|
|
||||||
if (((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0)) < 0) ||
|
if (((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0,FALSE)) < 0) ||
|
||||||
(ioctl(fd, mmap_ioctl, 0) < 0))
|
(ioctl(fd, mmap_ioctl, 0) < 0))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c,v 1.9 2002/08/27 22:07:07 tsi Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c,v 1.8 2002/07/24 19:06:52 tsi Exp $ */
|
||||||
/*
|
/*
|
||||||
* ppcPci.c - PowerPC PCI access functions
|
* ppcPci.c - PowerPC PCI access functions
|
||||||
*
|
*
|
||||||
|
@ -78,14 +78,15 @@ ppcPciInit()
|
||||||
pmaxPciInit();
|
pmaxPciInit();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
extern void motoppcPciInit(void);
|
static void motoppcPciInit(void);
|
||||||
|
|
||||||
motoppcPciInit();
|
motoppcPciInit();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PowerMAX_OS)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Motorola PowerPC platform support
|
* Motorola PowerPC platform support
|
||||||
*
|
*
|
||||||
|
@ -101,6 +102,11 @@ ppcPciInit()
|
||||||
*/
|
*/
|
||||||
static ADDRESS motoppcBusAddrToHostAddr(PCITAG, PciAddrType, ADDRESS);
|
static ADDRESS motoppcBusAddrToHostAddr(PCITAG, PciAddrType, ADDRESS);
|
||||||
static ADDRESS motoppcHostAddrToBusAddr(PCITAG, PciAddrType, ADDRESS);
|
static ADDRESS motoppcHostAddrToBusAddr(PCITAG, PciAddrType, ADDRESS);
|
||||||
|
static CARD32 pciCfgMech1Read(PCITAG tag, int offset);
|
||||||
|
static void pciCfgMech1Write(PCITAG tag, int offset, CARD32 val);
|
||||||
|
static void pciCfgMech1SetBits(PCITAG tag, int offset,
|
||||||
|
CARD32 mask, CARD32 val);
|
||||||
|
|
||||||
|
|
||||||
static pciBusFuncs_t motoppcFuncs0 = {
|
static pciBusFuncs_t motoppcFuncs0 = {
|
||||||
/* pciReadLong */ pciCfgMech1Read,
|
/* pciReadLong */ pciCfgMech1Read,
|
||||||
|
@ -126,7 +132,7 @@ static pciBusInfo_t motoppcPci0 = {
|
||||||
|
|
||||||
extern volatile unsigned char *ioBase;
|
extern volatile unsigned char *ioBase;
|
||||||
|
|
||||||
void
|
static void
|
||||||
motoppcPciInit()
|
motoppcPciInit()
|
||||||
{
|
{
|
||||||
pciNumBuses = 1;
|
pciNumBuses = 1;
|
||||||
|
@ -134,6 +140,9 @@ motoppcPciInit()
|
||||||
pciFindFirstFP = pciGenFindFirst;
|
pciFindFirstFP = pciGenFindFirst;
|
||||||
pciFindNextFP = pciGenFindNext;
|
pciFindNextFP = pciGenFindNext;
|
||||||
|
|
||||||
|
if (!xf86EnableIO())
|
||||||
|
FatalError("motoppcPciInit: EnableIO failed\n");
|
||||||
|
|
||||||
if (ioBase == MAP_FAILED) {
|
if (ioBase == MAP_FAILED) {
|
||||||
ppcPciIoMap(0); /* Make inb/outb et al work for pci0 and its secondaries */
|
ppcPciIoMap(0); /* Make inb/outb et al work for pci0 and its secondaries */
|
||||||
|
|
||||||
|
@ -210,3 +219,89 @@ motoppcHostAddrToBusAddr(PCITAG tag, PciAddrType type, ADDRESS addr)
|
||||||
|
|
||||||
/*NOTREACHED*/
|
/*NOTREACHED*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined (__powerpc__)
|
||||||
|
static int buserr_detected;
|
||||||
|
|
||||||
|
static
|
||||||
|
void buserr(int sig)
|
||||||
|
{
|
||||||
|
buserr_detected = 1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
static CARD32
|
||||||
|
pciCfgMech1Read(PCITAG tag, int offset)
|
||||||
|
{
|
||||||
|
unsigned long rv = 0xffffffff;
|
||||||
|
#ifdef DEBUGPCI
|
||||||
|
ErrorF("pciCfgMech1Read(tag=%08x,offset=%08x)\n", tag, offset);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__powerpc__)
|
||||||
|
signal(SIGBUS, buserr);
|
||||||
|
buserr_detected = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
outl(0xCF8, PCI_EN | tag | (offset & 0xfc));
|
||||||
|
rv = inl(0xCFC);
|
||||||
|
|
||||||
|
#if defined(__powerpc__)
|
||||||
|
signal(SIGBUS, SIG_DFL);
|
||||||
|
if (buserr_detected)
|
||||||
|
{
|
||||||
|
#ifdef DEBUGPCI
|
||||||
|
ErrorF("pciCfgMech1Read() BUS ERROR\n");
|
||||||
|
#endif
|
||||||
|
return(0xffffffff);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return(rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pciCfgMech1Write(PCITAG tag, int offset, CARD32 val)
|
||||||
|
{
|
||||||
|
#ifdef DEBUGPCI
|
||||||
|
ErrorF("pciCfgMech1Write(tag=%08x,offset=%08x,val=%08x)\n",
|
||||||
|
tag, offset,val);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__powerpc__)
|
||||||
|
signal(SIGBUS, SIG_IGN);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
outl(0xCF8, PCI_EN | tag | (offset & 0xfc));
|
||||||
|
#if defined(Lynx) && defined(__powerpc__)
|
||||||
|
outb(0x80, 0x00); /* without this the next access fails
|
||||||
|
* on my Powerstack system when we use
|
||||||
|
* assembler inlines for outl */
|
||||||
|
#endif
|
||||||
|
outl(0xCFC, val);
|
||||||
|
|
||||||
|
#if defined(__powerpc__)
|
||||||
|
signal(SIGBUS, SIG_DFL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask, CARD32 val)
|
||||||
|
{
|
||||||
|
unsigned long rv = 0xffffffff;
|
||||||
|
|
||||||
|
#if defined(__powerpc__)
|
||||||
|
signal(SIGBUS, buserr);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
outl(0xCF8, PCI_EN | tag | (offset & 0xfc));
|
||||||
|
rv = inl(0xCFC);
|
||||||
|
rv = (rv & ~mask) | val;
|
||||||
|
outl(0xCFC, rv);
|
||||||
|
|
||||||
|
#if defined(__powerpc__)
|
||||||
|
signal(SIGBUS, SIG_DFL);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* PowerMAX_OS */
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 1.2 2004/04/23 19:54:08 eich Exp $ */
|
/* $XdotOrg: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 1.3 2005/01/14 18:42:26 eich Exp $ */
|
||||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 3.14 2001/10/31 22:50:30 tsi Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c,v 3.14 2001/10/31 22:50:30 tsi Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
|
* Copyright 1992 by Orest Zborowski <obz@Kodak.com>
|
||||||
|
@ -84,7 +84,6 @@ void
|
||||||
xf86OpenConsole(void)
|
xf86OpenConsole(void)
|
||||||
{
|
{
|
||||||
int i, fd = -1;
|
int i, fd = -1;
|
||||||
int result;
|
|
||||||
struct vt_mode VT;
|
struct vt_mode VT;
|
||||||
struct vt_stat vts;
|
struct vt_stat vts;
|
||||||
MessageType from = X_PROBED;
|
MessageType from = X_PROBED;
|
||||||
|
@ -95,13 +94,12 @@ xf86OpenConsole(void)
|
||||||
char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
|
char *tty0[] = { "/dev/tty0", "/dev/vc/0", NULL };
|
||||||
char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
|
char *vcs[] = { "/dev/vc/%d", "/dev/tty%d", NULL };
|
||||||
|
|
||||||
if (serverGeneration == 1)
|
if (serverGeneration == 1) {
|
||||||
{
|
|
||||||
/* check if we're run with euid==0 */
|
/* when KeepTty check if we're run with euid==0 */
|
||||||
if (geteuid() != 0)
|
if (KeepTty && geteuid() != 0)
|
||||||
{
|
FatalError("xf86OpenConsole:"
|
||||||
FatalError("xf86OpenConsole: Server must be suid root\n");
|
" Server must be suid root for option \"KeepTTY\"\n");
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* setup the virtual terminal manager
|
* setup the virtual terminal manager
|
||||||
|
@ -110,20 +108,23 @@ xf86OpenConsole(void)
|
||||||
xf86Info.vtno = VTnum;
|
xf86Info.vtno = VTnum;
|
||||||
from = X_CMDLINE;
|
from = X_CMDLINE;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
i=0;
|
i=0;
|
||||||
while (tty0[i] != NULL)
|
while (tty0[i] != NULL) {
|
||||||
{
|
|
||||||
if ((fd = open(tty0[i],O_WRONLY,0)) >= 0)
|
if ((fd = open(tty0[i],O_WRONLY,0)) >= 0)
|
||||||
break;
|
break;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
FatalError(
|
FatalError(
|
||||||
"xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
|
"xf86OpenConsole: Cannot open /dev/tty0 (%s)\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
|
||||||
if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
|
if ((ioctl(fd, VT_OPENQRY, &xf86Info.vtno) < 0) ||
|
||||||
(xf86Info.vtno == -1)) {
|
(xf86Info.vtno == -1)) {
|
||||||
FatalError("xf86OpenConsole: Cannot find a free VT\n");
|
FatalError("xf86OpenConsole: Cannot find a free VT: %s\n",
|
||||||
|
strerror(errno));
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
@ -132,43 +133,61 @@ xf86OpenConsole(void)
|
||||||
fb_dev_name=getenv("FRAMEBUFFER");
|
fb_dev_name=getenv("FRAMEBUFFER");
|
||||||
if (!fb_dev_name)
|
if (!fb_dev_name)
|
||||||
fb_dev_name="/dev/fb0current";
|
fb_dev_name="/dev/fb0current";
|
||||||
|
|
||||||
if ((fbfd = open(fb_dev_name, O_RDONLY)) < 0)
|
if ((fbfd = open(fb_dev_name, O_RDONLY)) < 0)
|
||||||
FatalError("xf86OpenConsole: Cannot open %s (%s)\n",
|
FatalError("xf86OpenConsole: Cannot open %s (%s)\n",
|
||||||
fb_dev_name, strerror(errno));
|
fb_dev_name, strerror(errno));
|
||||||
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &var))
|
|
||||||
FatalError("xf86OpenConsole: Unable to get screen info\n");
|
if (ioctl(fbfd, FBIOGET_VSCREENINFO, &var) < 0)
|
||||||
|
FatalError("xf86OpenConsole: Unable to get screen info %s\n",
|
||||||
|
strerror(errno));
|
||||||
#endif
|
#endif
|
||||||
xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
|
xf86Msg(from, "using VT number %d\n\n", xf86Info.vtno);
|
||||||
|
|
||||||
if (!KeepTty) {
|
if (!KeepTty) {
|
||||||
setpgrp();
|
pid_t ppid = getppid();
|
||||||
|
pid_t ppgid;
|
||||||
|
ppgid = getpgid(ppid);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* change to parent process group that pgid != pid so
|
||||||
|
* that setsid() doesn't fail and we become process
|
||||||
|
* group leader
|
||||||
|
*/
|
||||||
|
if (setpgid(0,ppgid) < 0)
|
||||||
|
xf86Msg(X_WARNING, "xf86OpenConsole: setpgid failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
|
||||||
|
/* become process group leader */
|
||||||
|
if ((setsid() < 0))
|
||||||
|
xf86Msg(X_WARNING, "xf86OpenConsole: setsid failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
i=0;
|
i=0;
|
||||||
while (vcs[i] != NULL)
|
while (vcs[i] != NULL) {
|
||||||
{
|
|
||||||
sprintf(vtname, vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
|
sprintf(vtname, vcs[i], xf86Info.vtno); /* /dev/tty1-64 */
|
||||||
if ((xf86Info.consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) >= 0)
|
if ((xf86Info.consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) >= 0)
|
||||||
break;
|
break;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xf86Info.consoleFd < 0) {
|
if (xf86Info.consoleFd < 0)
|
||||||
FatalError("xf86OpenConsole: Cannot open virtual console %d (%s)\n",
|
FatalError("xf86OpenConsole: Cannot open virtual console"
|
||||||
xf86Info.vtno, strerror(errno));
|
" %d (%s)\n", xf86Info.vtno, strerror(errno));
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Grab the vt ownership before we overwrite it.
|
* Grab the vt ownership before we overwrite it.
|
||||||
* Hard coded /dev/tty0 into this function as well for below.
|
* Hard coded /dev/tty0 into this function as well for below.
|
||||||
*/
|
*/
|
||||||
if (!saveVtPerms()){
|
if (!saveVtPerms())
|
||||||
xf86Msg(X_WARNING,
|
xf86Msg(X_WARNING,
|
||||||
"xf86OpenConsole: Could not save ownership of VT\n");
|
"xf86OpenConsole: Could not save ownership of VT\n");
|
||||||
}
|
|
||||||
|
|
||||||
/* change ownership of the vt */
|
/* change ownership of the vt */
|
||||||
chown(vtname, getuid(), getgid());
|
if (chown(vtname, getuid(), getgid()) < 0)
|
||||||
|
xf86Msg(X_WARNING,"xf86OpenConsole: chown %s failed: %s\n",
|
||||||
|
vtname, strerror(errno));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the current VT device we're running on is not "console", we want
|
* the current VT device we're running on is not "console", we want
|
||||||
|
@ -176,65 +195,63 @@ xf86OpenConsole(void)
|
||||||
*
|
*
|
||||||
* Why is this needed??
|
* Why is this needed??
|
||||||
*/
|
*/
|
||||||
chown("/dev/tty0", getuid(), getgid());
|
if (chown("/dev/tty0", getuid(), getgid()) < 0)
|
||||||
|
xf86Msg(X_WARNING,"xf86OpenConsole: chown /dev/tty0 failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Linux doesn't switch to an active vt after the last close of a vt,
|
* Linux doesn't switch to an active vt after the last close of a vt,
|
||||||
* so we do this ourselves by remembering which is active now.
|
* so we do this ourselves by remembering which is active now.
|
||||||
*/
|
*/
|
||||||
if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) == 0)
|
if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) < 0)
|
||||||
{
|
xf86Msg(X_WARNING,"xf86OpenConsole: VT_GETSTATE failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
else
|
||||||
activeVT = vts.v_active;
|
activeVT = vts.v_active;
|
||||||
}
|
|
||||||
|
|
||||||
if (!KeepTty)
|
#if 0
|
||||||
{
|
if (!KeepTty) {
|
||||||
/*
|
/*
|
||||||
* Detach from the controlling tty to avoid char loss
|
* Detach from the controlling tty to avoid char loss
|
||||||
*/
|
*/
|
||||||
if ((i = open("/dev/tty",O_RDWR)) >= 0)
|
if ((i = open("/dev/tty",O_RDWR)) >= 0) {
|
||||||
{
|
|
||||||
ioctl(i, TIOCNOTTY, 0);
|
ioctl(i, TIOCNOTTY, 0);
|
||||||
close(i);
|
close(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(DO_OS_FONTRESTORE)
|
||||||
|
lnx_savefont();
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* now get the VT
|
* now get the VT
|
||||||
*/
|
*/
|
||||||
SYSCALL(result = ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno));
|
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
|
||||||
if (result != 0)
|
xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed: %s\n",
|
||||||
{
|
strerror(errno));
|
||||||
xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
|
|
||||||
}
|
if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0)
|
||||||
SYSCALL(result =
|
xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed: %s\n",
|
||||||
ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno));
|
strerror(errno));
|
||||||
if (result != 0)
|
|
||||||
{
|
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
|
||||||
xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
|
FatalError("xf86OpenConsole: VT_GETMODE failed %s\n",
|
||||||
}
|
strerror(errno));
|
||||||
#if defined(DO_OS_FONTRESTORE)
|
|
||||||
lnx_savefont();
|
|
||||||
#endif
|
|
||||||
SYSCALL(result = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
|
|
||||||
if (result < 0)
|
|
||||||
{
|
|
||||||
FatalError("xf86OpenConsole: VT_GETMODE failed\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
signal(SIGUSR1, xf86VTRequest);
|
signal(SIGUSR1, xf86VTRequest);
|
||||||
|
|
||||||
VT.mode = VT_PROCESS;
|
VT.mode = VT_PROCESS;
|
||||||
VT.relsig = SIGUSR1;
|
VT.relsig = SIGUSR1;
|
||||||
VT.acqsig = SIGUSR1;
|
VT.acqsig = SIGUSR1;
|
||||||
|
|
||||||
if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
|
if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
|
||||||
{
|
FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed: %s\n",
|
||||||
FatalError("xf86OpenConsole: VT_SETMODE VT_PROCESS failed\n");
|
strerror(errno));
|
||||||
}
|
|
||||||
if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
|
if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0)
|
||||||
{
|
FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed %s\n",
|
||||||
FatalError("xf86OpenConsole: KDSETMODE KD_GRAPHICS failed\n");
|
strerror(errno));
|
||||||
}
|
|
||||||
|
|
||||||
/* we really should have a InitOSInputDevices() function instead
|
/* we really should have a InitOSInputDevices() function instead
|
||||||
* of Init?$#*&Device(). So I just place it here */
|
* of Init?$#*&Device(). So I just place it here */
|
||||||
|
@ -247,24 +264,17 @@ xf86OpenConsole(void)
|
||||||
FatalError("Unable to set screen info\n");
|
FatalError("Unable to set screen info\n");
|
||||||
close(fbfd);
|
close(fbfd);
|
||||||
#endif
|
#endif
|
||||||
}
|
} else { /* serverGeneration != 1 */
|
||||||
else
|
|
||||||
{
|
|
||||||
/* serverGeneration != 1 */
|
|
||||||
/*
|
/*
|
||||||
* now get the VT
|
* now get the VT
|
||||||
*/
|
*/
|
||||||
SYSCALL(result = ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno));
|
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) < 0)
|
||||||
if (result != 0)
|
xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed %s\n",
|
||||||
{
|
strerror(errno));
|
||||||
xf86Msg(X_WARNING, "xf86OpenConsole: VT_ACTIVATE failed\n");
|
|
||||||
}
|
if (ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno) < 0)
|
||||||
SYSCALL(result =
|
xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed %s\n",
|
||||||
ioctl(xf86Info.consoleFd, VT_WAITACTIVE, xf86Info.vtno));
|
strerror(errno));
|
||||||
if (result != 0)
|
|
||||||
{
|
|
||||||
xf86Msg(X_WARNING, "xf86OpenConsole: VT_WAITACTIVE failed\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -277,35 +287,45 @@ xf86CloseConsole()
|
||||||
struct vt_stat vts;
|
struct vt_stat vts;
|
||||||
int vtno = -1;
|
int vtno = -1;
|
||||||
|
|
||||||
if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) == 0)
|
if (ioctl(xf86Info.consoleFd, VT_GETSTATE, &vts) < 0)
|
||||||
|
xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETSTATE failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
else
|
||||||
vtno = vts.v_active;
|
vtno = vts.v_active;
|
||||||
#endif
|
#endif
|
||||||
#if 0
|
|
||||||
ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno);
|
|
||||||
ioctl(xf86Info.consoleFd, VT_WAITACTIVE, 0);
|
|
||||||
#endif
|
|
||||||
ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT); /* Back to text mode ... */
|
|
||||||
|
|
||||||
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) != -1)
|
/* Back to text mode ... */
|
||||||
{
|
if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT) < 0)
|
||||||
|
xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
|
||||||
|
if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0)
|
||||||
|
xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
else {
|
||||||
|
/* set dflt vt handling */
|
||||||
VT.mode = VT_AUTO;
|
VT.mode = VT_AUTO;
|
||||||
ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* set dflt vt handling */
|
if (ioctl(xf86Info.consoleFd, VT_SETMODE, &VT) < 0)
|
||||||
|
xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Perform a switch back to the active VT when we were started
|
* Perform a switch back to the active VT when we were started
|
||||||
*/
|
*/
|
||||||
if (activeVT >= 0)
|
if (activeVT >= 0) {
|
||||||
{
|
if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, activeVT) < 0)
|
||||||
ioctl(xf86Info.consoleFd, VT_ACTIVATE, activeVT);
|
xf86Msg(X_WARNING, "xf86CloseConsole: VT_ACTIVATE failed: %s\n",
|
||||||
|
strerror(errno));
|
||||||
activeVT = -1;
|
activeVT = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(DO_OS_FONTRESTORE)
|
#if defined(DO_OS_FONTRESTORE)
|
||||||
if (xf86Info.vtno == vtno)
|
if (xf86Info.vtno == vtno) /* check if we are active */
|
||||||
lnx_restorefont();
|
lnx_restorefont();
|
||||||
lnx_freefontdata();
|
lnx_freefontdata();
|
||||||
#endif
|
#endif
|
||||||
close(xf86Info.consoleFd); /* make the vt-manager happy */
|
close(xf86Info.consoleFd); /* make the vt-manager happy */
|
||||||
|
|
||||||
restoreVtPerms(); /* restore the permissions */
|
restoreVtPerms(); /* restore the permissions */
|
||||||
|
|
||||||
|
|
|
@ -215,6 +215,13 @@ SetKbdRepeat(InputInfoPtr pInfo, char rad)
|
||||||
|
|
||||||
#if defined(__alpha__) || defined (__i386__) || defined(__ia64__)
|
#if defined(__alpha__) || defined (__i386__) || defined(__ia64__)
|
||||||
|
|
||||||
|
if (!xorgHWAccess) {
|
||||||
|
if (xf86EnableIO())
|
||||||
|
xorgHWAccess = TRUE;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* The ioport way */
|
/* The ioport way */
|
||||||
|
|
||||||
for (i = 0; i < RATE_COUNT; i++)
|
for (i = 0; i < RATE_COUNT; i++)
|
||||||
|
|
|
@ -490,7 +490,7 @@ volatile unsigned char *ioBase = NULL;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIO(void)
|
xf86EnableIO(void)
|
||||||
{
|
{
|
||||||
#if defined(__powerpc__)
|
#if defined(__powerpc__)
|
||||||
|
@ -499,7 +499,7 @@ xf86EnableIO(void)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (ExtendedEnabled)
|
if (ExtendedEnabled)
|
||||||
return;
|
return TRUE;
|
||||||
|
|
||||||
#if defined(__powerpc__)
|
#if defined(__powerpc__)
|
||||||
ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
|
ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0);
|
||||||
|
@ -512,16 +512,20 @@ xf86EnableIO(void)
|
||||||
/* Should this be fatal or just a warning? */
|
/* Should this be fatal or just a warning? */
|
||||||
#if 0
|
#if 0
|
||||||
if (ioBase == MAP_FAILED) {
|
if (ioBase == MAP_FAILED) {
|
||||||
FatalError(
|
xf86Msg(X_WARNING,
|
||||||
"xf86EnableIOPorts: Failed to map iobase (%s)\n",
|
"xf86EnableIOPorts: Failed to map iobase (%s)\n",
|
||||||
strerror(errno));
|
strerror(errno));
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
close(fd);
|
close(fd);
|
||||||
#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__)
|
#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) && !defined(__sh__) && !defined(__hppa__)
|
||||||
if (ioperm(0, 1024, 1) || iopl(3))
|
if (ioperm(0, 1024, 1) || iopl(3)) {
|
||||||
FatalError("xf86EnableIOPorts: Failed to set IOPL for I/O\n");
|
xf86Msg(X_WARNING,
|
||||||
|
"xf86EnableIOPorts: Failed to set IOPL for I/O\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
# if !defined(__alpha__)
|
# if !defined(__alpha__)
|
||||||
ioperm(0x40,4,0); /* trap access to the timer chip */
|
ioperm(0x40,4,0); /* trap access to the timer chip */
|
||||||
ioperm(0x60,4,0); /* trap access to the keyboard controller */
|
ioperm(0x60,4,0); /* trap access to the keyboard controller */
|
||||||
|
@ -529,7 +533,7 @@ xf86EnableIO(void)
|
||||||
#endif
|
#endif
|
||||||
ExtendedEnabled = TRUE;
|
ExtendedEnabled = TRUE;
|
||||||
|
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c,v 3.18 2002/12/14 04:41:14 dawes Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/lynxos/lynx_video.c,v 3.17 2000/10/28 01:42:27 mvojkovi Exp $ */
|
||||||
|
|
||||||
#include "X.h"
|
#include "X.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
|
@ -297,7 +297,7 @@ removeIOSmem(void)
|
||||||
ioBase = MAP_FAILED;
|
ioBase = MAP_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIO()
|
xf86EnableIO()
|
||||||
{
|
{
|
||||||
if (IOEnabled++ == 0) {
|
if (IOEnabled++ == 0) {
|
||||||
|
@ -305,7 +305,8 @@ xf86EnableIO()
|
||||||
(char *)PHYS_ISA_IO_SPACE, 64*1024, SM_READ|SM_WRITE);
|
(char *)PHYS_ISA_IO_SPACE, 64*1024, SM_READ|SM_WRITE);
|
||||||
if (ioBase == MAP_FAILED) {
|
if (ioBase == MAP_FAILED) {
|
||||||
--IOEnabled;
|
--IOEnabled;
|
||||||
FatalError("xf86EnableIO: Failed to map I/O\n");
|
xf86Msg(X_WARNING,"xf86EnableIO: Failed to map I/O\n");
|
||||||
|
return FALSE;
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
ErrorF("xf86EnableIO: mapped I/O at vaddr 0x%08x\n",
|
ErrorF("xf86EnableIO: mapped I/O at vaddr 0x%08x\n",
|
||||||
|
@ -314,7 +315,7 @@ xf86EnableIO()
|
||||||
atexit(removeIOSmem);
|
atexit(removeIOSmem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sco/sco_iop.c,v 1.1 2002/06/03 21:22:10 dawes Exp $ */
|
/* $XFree86$ */
|
||||||
/*
|
/*
|
||||||
* Copyright 2001 by J. Kean Johnston <jkj@caldera.com>
|
* Copyright 2001 by J. Kean Johnston <jkj@caldera.com>
|
||||||
*
|
*
|
||||||
|
@ -62,14 +62,18 @@ extern long sysi86 (int cmd, ...);
|
||||||
|
|
||||||
static Bool IOEnabled = FALSE;
|
static Bool IOEnabled = FALSE;
|
||||||
|
|
||||||
void xf86EnableIO(void)
|
Bool xf86EnableIO(void)
|
||||||
{
|
{
|
||||||
if (IOEnabled)
|
if (IOEnabled)
|
||||||
return;
|
return TRUE;
|
||||||
|
|
||||||
if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)
|
if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) {
|
||||||
FatalError("Failed to set IOPL for extended I/O\n");
|
xf86Msg(X_WARNING,"Failed to set IOPL for extended I/O\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
IOEnabled = TRUE;
|
IOEnabled = TRUE;
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void xf86DisableIO(void)
|
void xf86DisableIO(void)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c,v 3.4 2001/07/23 13:15:48 dawes Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/ioperm_noop.c,v 3.3 1998/07/25 16:57:00 dawes Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright 1993 by David Wexelblat <dwex@XFree86.org>
|
* Copyright 1993 by David Wexelblat <dwex@XFree86.org>
|
||||||
*
|
*
|
||||||
|
@ -33,10 +33,10 @@
|
||||||
#include "xf86Priv.h"
|
#include "xf86Priv.h"
|
||||||
#include "xf86_OSlib.h"
|
#include "xf86_OSlib.h"
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIO()
|
xf86EnableIO()
|
||||||
{
|
{
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c,v 1.3 2002/10/03 02:04:19 tsi Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sunos/sun_vid.c,v 1.2 2001/10/28 03:34:03 tsi Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
|
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
|
||||||
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
|
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
|
||||||
|
@ -147,18 +147,20 @@ xf86UnMapVidMem(int ScreenNum, pointer Base, unsigned long Size)
|
||||||
static Bool ExtendedEnabled = FALSE;
|
static Bool ExtendedEnabled = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIO(void)
|
xf86EnableIO(void)
|
||||||
{
|
{
|
||||||
#ifdef i386
|
#ifdef i386
|
||||||
if (ExtendedEnabled)
|
if (ExtendedEnabled)
|
||||||
return;
|
return TRUE;
|
||||||
|
|
||||||
if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0)
|
|
||||||
FatalError("xf86EnableIOPorts: Failed to set IOPL for I/O\n");
|
|
||||||
|
|
||||||
|
if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) {
|
||||||
|
xf86Msg(X_WARNING,"xf86EnableIOPorts: Failed to set IOPL for I/O\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
ExtendedEnabled = TRUE;
|
ExtendedEnabled = TRUE;
|
||||||
#endif /* i386 */
|
#endif /* i386 */
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c,v 3.21 2003/03/14 13:46:08 tsi Exp $ */
|
/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/sysv_video.c,v 3.20tsi Exp $ */
|
||||||
/*
|
/*
|
||||||
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
|
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany
|
||||||
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
|
* Copyright 1993 by David Wexelblat <dwex@goblin.org>
|
||||||
|
@ -281,22 +281,23 @@ xf86OSInitVidMem(VidMemInfoPtr pVidMem)
|
||||||
static Bool ExtendedEnabled = FALSE;
|
static Bool ExtendedEnabled = FALSE;
|
||||||
static Bool InitDone = FALSE;
|
static Bool InitDone = FALSE;
|
||||||
|
|
||||||
void
|
Bool
|
||||||
xf86EnableIO()
|
xf86EnableIO()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (ExtendedEnabled)
|
if (ExtendedEnabled)
|
||||||
return;
|
return TRUE;
|
||||||
|
|
||||||
if (SET_IOPL() < 0)
|
if (SET_IOPL() < 0)
|
||||||
{
|
{
|
||||||
FatalError(
|
xf86Msg(X_WARNING,
|
||||||
"xf86EnableIO: Failed to set IOPL for extended I/O\n");
|
"xf86EnableIO: Failed to set IOPL for extended I/O\n");
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
ExtendedEnabled = TRUE;
|
ExtendedEnabled = TRUE;
|
||||||
|
|
||||||
return;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -125,6 +125,7 @@ extern void xf86WrapperInit(void);
|
||||||
#define xf86FatalError(a, b) \
|
#define xf86FatalError(a, b) \
|
||||||
if (dispatchException & DE_TERMINATE) { \
|
if (dispatchException & DE_TERMINATE) { \
|
||||||
ErrorF(a, b); \
|
ErrorF(a, b); \
|
||||||
|
ErrorF("\n"); \
|
||||||
return; \
|
return; \
|
||||||
} else FatalError(a, b)
|
} else FatalError(a, b)
|
||||||
|
|
||||||
|
@ -144,7 +145,7 @@ extern pointer xf86MapVidMem(int, int, unsigned long, unsigned long);
|
||||||
extern void xf86UnMapVidMem(int, pointer, unsigned long);
|
extern void xf86UnMapVidMem(int, pointer, unsigned long);
|
||||||
extern void xf86MapReadSideEffects(int, int, pointer, unsigned long);
|
extern void xf86MapReadSideEffects(int, int, pointer, unsigned long);
|
||||||
extern int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *, int);
|
extern int xf86ReadBIOS(unsigned long, unsigned long, unsigned char *, int);
|
||||||
extern void xf86EnableIO(void);
|
extern Bool xf86EnableIO(void);
|
||||||
extern void xf86DisableIO(void);
|
extern void xf86DisableIO(void);
|
||||||
extern Bool xf86DisableInterrupts(void);
|
extern Bool xf86DisableInterrupts(void);
|
||||||
extern void xf86EnableInterrupts(void);
|
extern void xf86EnableInterrupts(void);
|
||||||
|
|
|
@ -195,7 +195,6 @@ main(int argc, char *argv[])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
xf86EnableIO();
|
|
||||||
pcrpp = xf86scanpci(0);
|
pcrpp = xf86scanpci(0);
|
||||||
|
|
||||||
if (!pcrpp) {
|
if (!pcrpp) {
|
||||||
|
|
Loading…
Reference in New Issue