diff options
author | Alan Hourihane <alanh@tungstengraphics.com> | 2008-08-20 10:54:07 +0100 |
---|---|---|
committer | Alan Hourihane <alanh@tungstengraphics.com> | 2008-08-20 10:54:07 +0100 |
commit | 9e7b29987fb6370333f4da2d4b91912fd8a29fb9 (patch) | |
tree | f0ea188ff394fe7f0f7ebdf571594e3e9174d166 /hw | |
parent | 2846c3868a71d079c98cf05a9bb750791981f1bf (diff) | |
parent | bc4cef1d0ae7cbb8f5fe16d576db45abd4330370 (diff) |
Merge branch 'master' of git+ssh://git.freedesktop.org/git/xorg/xserver into glucose-2glucose-2
Conflicts:
configure.ac
glx/glxcmds.c
hw/xfree86/Makefile.am
hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib
hw/xquartz/bundle/Resources/English.lproj/main.nib/keyedobjects.nib
Diffstat (limited to 'hw')
45 files changed, 226 insertions, 4303 deletions
diff --git a/hw/kdrive/src/kdrive.c b/hw/kdrive/src/kdrive.c index 754b94291..9e27840b7 100644 --- a/hw/kdrive/src/kdrive.c +++ b/hw/kdrive/src/kdrive.c @@ -102,9 +102,6 @@ KdSetRootClip (ScreenPtr pScreen, BOOL enable) Bool WasViewable; Bool anyMarked = FALSE; RegionPtr pOldClip = 0; -#ifdef DO_SAVE_UNDERS - Bool dosave = FALSE; -#endif WindowPtr pLayerWin; BoxRec box; @@ -171,12 +168,6 @@ KdSetRootClip (ScreenPtr pScreen, BOOL enable) anyMarked = TRUE; } -#ifdef DO_SAVE_UNDERS - if (DO_SAVE_UNDERS(pWin)) - { - dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); - } -#endif /* DO_SAVE_UNDERS */ if (anyMarked) (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); @@ -186,10 +177,6 @@ KdSetRootClip (ScreenPtr pScreen, BOOL enable) { if (anyMarked) (*pScreen->HandleExposures)(pWin); -#ifdef DO_SAVE_UNDERS - if (dosave) - (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin); -#endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther); } diff --git a/hw/xfree86/common/Makefile.am b/hw/xfree86/common/Makefile.am index 15b56fa79..de14dbb1c 100644 --- a/hw/xfree86/common/Makefile.am +++ b/hw/xfree86/common/Makefile.am @@ -47,7 +47,7 @@ INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \ xf86PciInfo.h xf86Priv.h xf86Privstr.h xf86Resources.h \ xf86cmap.h xf86fbman.h xf86str.h xf86RAC.h xf86Xinput.h xisb.h \ - $(XVSDKINCS) xf86Version.h xorgVersion.h \ + $(XVSDKINCS) xorgVersion.h \ xf86sbusBus.h xf86xv.h xf86xvmc.h xf86xvpriv.h DISTCLEANFILES = xf86Build.h diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index cd6da59f0..6c3c09522 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -277,7 +277,6 @@ Bool xf86GetModInDevEnabled(void); Bool xf86GetAllowMouseOpenFail(void); Bool xf86IsPc98(void); void xf86DisableRandR(void); -CARD32 xf86GetVersion(void); CARD32 xorgGetVersion(void); CARD32 xf86GetModuleVersion(pointer module); pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name); diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c index 4b5615258..7cf4040fb 100644 --- a/hw/xfree86/common/xf86Config.c +++ b/hw/xfree86/common/xf86Config.c @@ -738,23 +738,14 @@ typedef enum { FLAG_ALLOWMOUSEOPENFAIL, FLAG_VTSYSREQ, FLAG_XKBDISABLE, - FLAG_PCIPROBE1, - FLAG_PCIPROBE2, - FLAG_PCIFORCECONFIG1, - FLAG_PCIFORCECONFIG2, - FLAG_PCIFORCENONE, - FLAG_PCIOSCONFIG, FLAG_SAVER_BLANKTIME, FLAG_DPMS_STANDBYTIME, FLAG_DPMS_SUSPENDTIME, FLAG_DPMS_OFFTIME, FLAG_PIXMAP, FLAG_PC98, - FLAG_ESTIMATE_SIZES_AGGRESSIVELY, FLAG_NOPM, FLAG_XINERAMA, - FLAG_ALLOW_DEACTIVATE_GRABS, - FLAG_ALLOW_CLOSEDOWN_GRABS, FLAG_LOG, FLAG_RENDER_COLORMAP_MODE, FLAG_HANDLE_SPECIAL_KEYS, @@ -792,18 +783,6 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_XKBDISABLE, "XkbDisable", OPTV_BOOLEAN, {0}, FALSE }, - { FLAG_PCIPROBE1, "PciProbe1" , OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_PCIPROBE2, "PciProbe2", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_PCIFORCECONFIG1, "PciForceConfig1", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_PCIFORCECONFIG2, "PciForceConfig2", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_PCIFORCENONE, "PciForceNone", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_PCIOSCONFIG, "PciOsConfig", OPTV_BOOLEAN, - {0}, FALSE }, { FLAG_SAVER_BLANKTIME, "BlankTime" , OPTV_INTEGER, {0}, FALSE }, { FLAG_DPMS_STANDBYTIME, "StandbyTime", OPTV_INTEGER, @@ -816,16 +795,10 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_PC98, "PC98", OPTV_BOOLEAN, {0}, FALSE }, - { FLAG_ESTIMATE_SIZES_AGGRESSIVELY,"EstimateSizesAggressively",OPTV_INTEGER, - {0}, FALSE }, { FLAG_NOPM, "NoPM", OPTV_BOOLEAN, {0}, FALSE }, { FLAG_XINERAMA, "Xinerama", OPTV_BOOLEAN, {0}, FALSE }, - { FLAG_ALLOW_DEACTIVATE_GRABS,"AllowDeactivateGrabs", OPTV_BOOLEAN, - {0}, FALSE }, - { FLAG_ALLOW_CLOSEDOWN_GRABS, "AllowClosedownGrabs", OPTV_BOOLEAN, - {0}, FALSE }, { FLAG_LOG, "Log", OPTV_STRING, {0}, FALSE }, { FLAG_RENDER_COLORMAP_MODE, "RenderColormapMode", OPTV_STRING, @@ -905,10 +878,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86GetOptValBool(FlagOptions, FLAG_DONTZAP, &xf86Info.dontZap); xf86GetOptValBool(FlagOptions, FLAG_DONTZOOM, &xf86Info.dontZoom); - xf86GetOptValBool(FlagOptions, FLAG_ALLOW_DEACTIVATE_GRABS, - &(xf86Info.grabInfo.allowDeactivate)); - xf86GetOptValBool(FlagOptions, FLAG_ALLOW_CLOSEDOWN_GRABS, - &(xf86Info.grabInfo.allowClosedown)); xf86GetOptValBool(FlagOptions, FLAG_IGNORE_ABI, &xf86Info.ignoreABI); if (xf86Info.ignoreABI) { xf86Msg(X_CONFIG, "Ignoring ABI Version\n"); @@ -973,19 +942,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) #endif } - if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE1)) - xf86Info.pciFlags = PCIProbe1; - if (xf86IsOptionSet(FlagOptions, FLAG_PCIPROBE2)) - xf86Info.pciFlags = PCIProbe2; - if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCECONFIG1)) - xf86Info.pciFlags = PCIForceConfig1; - if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCECONFIG2)) - xf86Info.pciFlags = PCIForceConfig2; - if (xf86IsOptionSet(FlagOptions, FLAG_PCIOSCONFIG)) - xf86Info.pciFlags = PCIOsConfig; - if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCENONE)) - xf86Info.pciFlags = PCIForceNone; - xf86Info.pmFlag = TRUE; if (xf86GetOptValBool(FlagOptions, FLAG_NOPM, &value)) xf86Info.pmFlag = !value; @@ -1044,12 +1000,6 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86Info.randRFrom = X_CONFIG; } #endif - i = -1; - xf86GetOptValInteger(FlagOptions, FLAG_ESTIMATE_SIZES_AGGRESSIVELY, &i); - if (i >= 0) - xf86Info.estimateSizesAggressively = i; - else - xf86Info.estimateSizesAggressively = 0; xf86Info.aiglx = TRUE; xf86Info.aiglxFrom = X_DEFAULT; diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index ff75a7d3d..15dce9f9c 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -204,15 +204,6 @@ ProcessInputEvents () xf86SetViewport(xf86Info.currentScreen, x, y); } -void -xf86GrabServerCallback(CallbackListPtr *callbacks, pointer data, pointer args) -{ - ServerGrabInfoRec *grab = (ServerGrabInfoRec*)args; - - xf86Info.grabInfo.server.client = grab->client; - xf86Info.grabInfo.server.grabstate = grab->grabstate; -} - /* * Handle keyboard events that cause some kind of "action" * (i.e., server termination, video mode changes, VT switches, etc.) @@ -240,43 +231,6 @@ xf86ProcessActionEvent(ActionEvent action, void *arg) if (!xf86Info.dontZoom) xf86ZoomViewport(xf86Info.currentScreen, -1); break; - case ACTION_DISABLEGRAB: - if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowDeactivate) { - if (inputInfo.pointer && inputInfo.pointer->deviceGrab.grab != NULL && - inputInfo.pointer->deviceGrab.DeactivateGrab) - inputInfo.pointer->deviceGrab.DeactivateGrab(inputInfo.pointer); - if (inputInfo.keyboard && - inputInfo.keyboard->deviceGrab.grab != NULL && - inputInfo.keyboard->deviceGrab.DeactivateGrab) - inputInfo.keyboard->deviceGrab.DeactivateGrab(inputInfo.keyboard); - } - break; - case ACTION_CLOSECLIENT: - if (!xf86Info.grabInfo.disabled && xf86Info.grabInfo.allowClosedown) { - ClientPtr pointer, keyboard, server; - - pointer = keyboard = server = NULL; - if (inputInfo.pointer && inputInfo.pointer->deviceGrab.grab != NULL) - pointer = clients[CLIENT_ID(inputInfo.pointer->deviceGrab.grab->resource)]; - if (inputInfo.keyboard && inputInfo.keyboard->deviceGrab.grab != NULL) - { - keyboard = clients[CLIENT_ID(inputInfo.keyboard->deviceGrab.grab->resource)]; - if (keyboard == pointer) - keyboard = NULL; - } - if ((xf86Info.grabInfo.server.grabstate == SERVER_GRABBED) && - (((server = xf86Info.grabInfo.server.client) == pointer) || - (server == keyboard))) - server = NULL; - - if (pointer) - CloseDownClient(pointer); - if (keyboard) - CloseDownClient(keyboard); - if (server) - CloseDownClient(server); - } - break; #if !defined(__SOL8__) && \ (!defined(sun) || defined(__i386__)) && defined(VT_ACTIVATE) case ACTION_SWITCHSCREEN: diff --git a/hw/xfree86/common/xf86Globals.c b/hw/xfree86/common/xf86Globals.c index c00089190..23626296a 100644 --- a/hw/xfree86/common/xf86Globals.c +++ b/hw/xfree86/common/xf86Globals.c @@ -99,8 +99,6 @@ xf86InfoRec xf86Info = { -1, /* vtno */ FALSE, /* vtSysreq */ SKWhenNeeded, /* ddxSpecialKeys */ - NULL, /* pMouse */ - NULL, /* mouseLocal */ -1, /* lastEventTime */ FALSE, /* vtRequestsPending */ FALSE, /* dontVTSwitch */ @@ -108,7 +106,6 @@ xf86InfoRec xf86Info = { FALSE, /* dontZoom */ FALSE, /* notrapSignals */ FALSE, /* caughtSignal */ - FALSE, /* sharedMonitor */ NULL, /* currentScreen */ #ifdef CSRG_BASED -1, /* screenFd */ @@ -119,7 +116,6 @@ xf86InfoRec xf86Info = { FALSE, /* vidModeAllowNonLocal */ TRUE, /* miscModInDevEnabled */ FALSE, /* miscModInDevAllowNonLocal */ - PCIOsConfig, /* pciFlags */ Pix24DontCare, /* pixmap24 */ X_DEFAULT, /* pix24From */ #ifdef __i386__ @@ -127,7 +123,6 @@ xf86InfoRec xf86Info = { #endif TRUE, /* pmFlag */ LogNone, /* syncLog */ - 0, /* estimateSizesAggressively */ FALSE, /* kbdCustomKeycodes */ FALSE, /* disableRandR */ X_DEFAULT /* randRFrom */ @@ -164,7 +159,6 @@ const char *xf86VisualNames[] = { /* Parameters set only from the command line */ char *xf86ServerName = "no-name"; Bool xf86fpFlag = FALSE; -Bool xf86coFlag = FALSE; Bool xf86sFlag = FALSE; Bool xf86bsEnableFlag = FALSE; Bool xf86bsDisableFlag = FALSE; @@ -185,8 +179,6 @@ int xf86Depth = -1; rgb xf86Weight = {0, 0, 0}; Bool xf86FlipPixels = FALSE; Gamma xf86Gamma = {0.0, 0.0, 0.0}; -Bool xf86ShowUnresolved = DEFAULT_UNRESOLVED; -Bool xf86BestRefresh = DEFAULT_BEST_REFRESH; Bool xf86AllowMouseOpenFail = FALSE; #ifdef XF86VIDMODE Bool xf86VidModeDisabled = FALSE; diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c index d358da0bc..f10fb1ce8 100644 --- a/hw/xfree86/common/xf86Helper.c +++ b/hw/xfree86/common/xf86Helper.c @@ -60,7 +60,6 @@ #include "mivalidate.h" #include "xf86RAC.h" #include "xf86Bus.h" -#include "xf86Version.h" /* For xf86GetClocks */ #if defined(CSRG_BASED) || defined(__GNU__) @@ -1097,9 +1096,6 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable) WindowPtr pChild; Bool WasViewable = (Bool)(pWin->viewable); Bool anyMarked = FALSE; -#ifdef DO_SAVE_UNDERS - Bool dosave = FALSE; -#endif WindowPtr pLayerWin; BoxRec box; @@ -1169,12 +1165,6 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable) anyMarked = TRUE; } -#ifdef DO_SAVE_UNDERS - if (DO_SAVE_UNDERS(pWin)) - { - dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); - } -#endif /* DO_SAVE_UNDERS */ if (anyMarked) (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); @@ -1184,10 +1174,6 @@ xf86SetRootClip (ScreenPtr pScreen, Bool enable) { if (anyMarked) (*pScreen->HandleExposures)(pWin); -#ifdef DO_SAVE_UNDERS - if (dosave) - (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin); -#endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther); } @@ -2352,12 +2338,6 @@ xf86DisableRandR() } _X_EXPORT CARD32 -xf86GetVersion() -{ - return XF86_VERSION_CURRENT; -} - -_X_EXPORT CARD32 xf86GetModuleVersion(pointer module) { return (CARD32)LoaderGetModuleVersion(module); diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index 34970e05e..01f239565 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -716,14 +716,10 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) for (i = 0; i < xf86NumDrivers; i++) { xorgHWFlags flags; - /* The Identify function is mandatory, but if it isn't there continue */ + if (xf86DriverList[i]->Identify != NULL) xf86DriverList[i]->Identify(0); - else { - xf86Msg(X_WARNING, "Driver `%s' has no Identify function\n", - xf86DriverList[i]->driverName ? xf86DriverList[i]->driverName - : "noname"); - } + if (!xorgHWAccess && (!xf86DriverList[i]->driverFunc || !xf86DriverList[i]->driverFunc(NULL, @@ -734,11 +730,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) } /* Enable full I/O access */ - if (xorgHWAccess) { - if(!xf86EnableIO()) - /* oops, we have failed */ - xorgHWAccess = FALSE; - } + if (xorgHWAccess) + xorgHWAccess = xf86EnableIO(); /* * Locate bus slot that had register IO enabled at server startup @@ -875,46 +868,14 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) return; } - /* This could be moved into a separate function */ - - /* - * Check that all screens have initialised the mandatory function - * entry points. Delete those which have not. - */ - -#define WARN_SCREEN(func) \ - xf86Msg(X_ERROR, "Driver `%s' has no %s function, deleting.\n", \ - xf86Screens[i]->name, (warned++, func)) - for (i = 0; i < xf86NumScreens; i++) { - int warned = 0; if (xf86Screens[i]->name == NULL) { - xf86Screens[i]->name = xnfalloc(strlen("screen") + 1 + 1); - if (i < 10) - sprintf(xf86Screens[i]->name, "screen%c", i + '0'); - else - sprintf(xf86Screens[i]->name, "screen%c", i - 10 + 'A'); + xf86Screens[i]->name = xnfalloc(strlen("screen") + 10 + 1); + sprintf(xf86Screens[i]->name, "screen%d", i); xf86MsgVerb(X_WARNING, 0, "Screen driver %d has no name set, using `%s'.\n", i, xf86Screens[i]->name); } - if (xf86Screens[i]->ScreenInit == NULL) - WARN_SCREEN("ScreenInit"); - if (xf86Screens[i]->EnterVT == NULL) - WARN_SCREEN("EnterVT"); - if (xf86Screens[i]->LeaveVT == NULL) - WARN_SCREEN("LeaveVT"); - if (warned) - xf86DeleteScreen(i--, 0); - } - - /* - * If no screens left, return now. - */ - - if (xf86NumScreens == 0) { - xf86Msg(X_ERROR, "Screen(s) found, but drivers were unusable.\n"); - return; } /* XXX Should this be before or after loading dependent modules? */ @@ -1050,8 +1011,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) /* set up the proper access funcs */ xf86PostPreInit(); - AddCallback(&ServerGrabCallback, xf86GrabServerCallback, NULL); - } else { /* * serverGeneration != 1; some OSs have to do things here, too. @@ -1491,11 +1450,6 @@ ddxProcessArgument(int argc, char **argv, int i) xf86ConfigFile = argv[i + 1]; return 2; } - if (!strcmp(argv[i],"-showunresolved")) - { - xf86ShowUnresolved = TRUE; - return 1; - } if (!strcmp(argv[i],"-probeonly")) { xf86ProbeOnly = TRUE; @@ -1523,11 +1477,6 @@ ddxProcessArgument(int argc, char **argv, int i) xf86AllowMouseOpenFail = TRUE; return 1; } - if (!strcmp(argv[i],"-bestRefresh")) - { - xf86BestRefresh = TRUE; - return 1; - } if (!strcmp(argv[i],"-ignoreABI")) { LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL); @@ -1591,12 +1540,6 @@ ddxProcessArgument(int argc, char **argv, int i) xf86fpFlag = TRUE; return 0; } - /* Notice the -co flag, but allow it to pass to the dix layer */ - if (!strcmp(argv[i], "-co")) - { - xf86coFlag = TRUE; - return 0; - } /* Notice the -bs flag, but allow it to pass to the dix layer */ if (!strcmp(argv[i], "-bs")) { @@ -1807,7 +1750,6 @@ ddxUseMsg() ErrorF("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n"); #endif ErrorF("-allowMouseOpenFail start server even if the mouse can't be initialized\n"); - ErrorF("-bestRefresh choose modes with the best refresh rate\n"); ErrorF("-ignoreABI make module ABI mismatches non-fatal\n"); ErrorF("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n"); ErrorF("-version show the server version\n"); diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index 3c75df0ab..415d09528 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -42,7 +42,6 @@ #define _XF86MODULE_H #include "misc.h" -#include "xf86Version.h" #ifndef NULL #define NULL ((void *)0) #endif diff --git a/hw/xfree86/common/xf86Priv.h b/hw/xfree86/common/xf86Priv.h index cb4bae7cd..159dfb26b 100644 --- a/hw/xfree86/common/xf86Priv.h +++ b/hw/xfree86/common/xf86Priv.h @@ -52,7 +52,6 @@ extern Bool xf86VidModeDisabled; extern Bool xf86VidModeAllowNonLocal; #endif extern Bool xf86fpFlag; -extern Bool xf86coFlag; extern Bool xf86sFlag; extern Bool xf86bsEnableFlag; extern Bool xf86bsDisableFlag; @@ -70,10 +69,8 @@ extern int xf86Depth; extern Pix24Flags xf86Pix24; extern rgb xf86Weight; extern Bool xf86FlipPixels; -extern Bool xf86BestRefresh; extern Gamma xf86Gamma; extern char *xf86ServerName; -extern Bool xf86ShowUnresolved; extern struct pci_slot_match xf86IsolateDevice; /* Other parameters */ @@ -164,7 +161,6 @@ void xf86SigHandler(int signo); void xf86HandlePMEvents(int fd, pointer data); extern int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num); extern pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event); -void xf86GrabServerCallback(CallbackListPtr *, pointer, pointer); /* xf86Helper.c */ void xf86LogInit(void); diff --git a/hw/xfree86/common/xf86Privstr.h b/hw/xfree86/common/xf86Privstr.h index 0601c0d8f..6a7a6dc86 100644 --- a/hw/xfree86/common/xf86Privstr.h +++ b/hw/xfree86/common/xf86Privstr.h @@ -37,17 +37,6 @@ #include "xf86Pci.h" #include "xf86str.h" -/* PCI probe flags */ - -typedef enum { - PCIProbe1 = 0, - PCIProbe2, - PCIForceConfig1, - PCIForceConfig2, - PCIForceNone, - PCIOsConfig -} PciProbeType; - typedef enum { LogNone, LogFlush, @@ -78,10 +67,6 @@ typedef struct { Bool vtSysreq; SpecialKeysInDDX ddxSpecialKeys; - /* mouse part */ - DeviceIntPtr pMouse; - pointer mouseLocal; - /* event handler part */ int lastEventTime; Bool vtRequestsPending; @@ -92,7 +77,6 @@ typedef struct { Bool caughtSignal; /* graphics part */ - Bool sharedMonitor; ScreenPtr currentScreen; #if defined(CSRG_BASED) || defined(__FreeBSD_kernel__) int screenFd; /* fd for memory mapped access to @@ -108,7 +92,6 @@ typedef struct { Bool miscModInDevEnabled; /* Allow input devices to be * changed */ Bool miscModInDevAllowNonLocal; - PciProbeType pciFlags; Pix24Flags pixmap24; MessageType pix24From; #ifdef __i386__ @@ -116,7 +99,6 @@ typedef struct { #endif Bool pmFlag; Log log; - int estimateSizesAggressively; Bool kbdCustomKeycodes; Bool disableRandR; MessageType randRFrom; @@ -128,18 +110,6 @@ typedef struct { Bool useDefaultFontPath; MessageType useDefaultFontPathFrom; Bool ignoreABI; - struct { - Bool disabled; /* enable/disable deactivating - * grabs or closing the - * connection to the grabbing - * client */ - ClientPtr override; /* client that disabled - * grab deactivation. - */ - Bool allowDeactivate; - Bool allowClosedown; - ServerGrabInfoRec server; - } grabInfo; Bool allowEmptyInput; /* Allow the server to start with no input * devices. */ diff --git a/hw/xfree86/common/xf86Version.h b/hw/xfree86/common/xf86Version.h deleted file mode 100644 index b93ac7d23..000000000 --- a/hw/xfree86/common/xf86Version.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 1994-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifndef XF86_VERSION_CURRENT - -#define XF86_VERSION_MAJOR 4 -#define XF86_VERSION_MINOR 3 -#define XF86_VERSION_PATCH 99 -#define XF86_VERSION_SNAP 902 - -/* This has five arguments for compatibilty reasons */ -#define XF86_VERSION_NUMERIC(major,minor,patch,snap,dummy) \ - (((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap) - -#define XF86_GET_MAJOR_VERSION(vers) ((vers) / 10000000) -#define XF86_GET_MINOR_VERSION(vers) (((vers) % 10000000) / 100000) -#define XF86_GET_PATCH_VERSION(vers) (((vers) % 100000) / 1000) -#define XF86_GET_SNAP_VERSION(vers) ((vers) % 1000) - -/* Define these for compatibility. They'll be removed at some point. */ -#define XF86_VERSION_SUBMINOR XF86_VERSION_PATCH -#define XF86_VERSION_BETA 0 -#define XF86_VERSION_ALPHA XF86_VERSION_SNAP - -#define XF86_VERSION_CURRENT \ - XF86_VERSION_NUMERIC(XF86_VERSION_MAJOR, \ - XF86_VERSION_MINOR, \ - XF86_VERSION_PATCH, \ - XF86_VERSION_SNAP, \ - 0) - -#endif diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index 0156d18bd..8c211234b 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h @@ -1110,8 +1110,6 @@ typedef enum { ACTION_TERMINATE = 0, /* Terminate Server */ ACTION_NEXT_MODE = 10, /* Switch to next video mode */ ACTION_PREV_MODE, - ACTION_DISABLEGRAB = 20, /* Cancel server/pointer/kbd grabs */ - ACTION_CLOSECLIENT, /* Kill client holding grab */ ACTION_SWITCHSCREEN = 100, /* VT switch */ ACTION_SWITCHSCREEN_NEXT, ACTION_SWITCHSCREEN_PREV, diff --git a/hw/xfree86/common/xisb.c b/hw/xfree86/common/xisb.c index d021ec15b..6314094a0 100644 --- a/hw/xfree86/common/xisb.c +++ b/hw/xfree86/common/xisb.c @@ -41,7 +41,6 @@ #include <misc.h> #include <xf86.h> -#include <xf86Version.h> #include <xf86_OSproc.h> #include <xf86_OSlib.h> #include <xf86Xinput.h> diff --git a/hw/xfree86/dixmods/xkbPrivate.c b/hw/xfree86/dixmods/xkbPrivate.c index 40c931156..db21a4e17 100644 --- a/hw/xfree86/dixmods/xkbPrivate.c +++ b/hw/xfree86/dixmods/xkbPrivate.c @@ -30,10 +30,6 @@ XkbDDXPrivate(DeviceIntPtr dev,KeyCode key,XkbAction *act) xf86ProcessActionEvent(ACTION_PREV_MODE, NULL); else if (strcasecmp(msgbuf, "+vmode")==0) xf86ProcessActionEvent(ACTION_NEXT_MODE, NULL); - else if (strcasecmp(msgbuf, "ungrab")==0) - xf86ProcessActionEvent(ACTION_DISABLEGRAB, NULL); - else if (strcasecmp(msgbuf, "clsgrb")==0) - xf86ProcessActionEvent(ACTION_CLOSECLIENT, NULL); } return 0; diff --git a/hw/xfree86/int10/xf86int10.c b/hw/xfree86/int10/xf86int10.c index f50607cfc..51eb91fbb 100644 --- a/hw/xfree86/int10/xf86int10.c +++ b/hw/xfree86/int10/xf86int10.c @@ -655,6 +655,32 @@ find_pci_class(CARD8 intf, CARD8 subClass, CARD16 _class, } #endif +/* + * Return the last bus number in the same domain as dev. Only look at the + * one domain since this is going into %cl, and VGA I/O is per-domain anyway. + */ +static int +int1A_last_bus_number(struct pci_device *dev) +{ + struct pci_device *d; + struct pci_slot_match m = { dev->domain, + PCI_MATCH_ANY, + PCI_MATCH_ANY, + PCI_MATCH_ANY }; + struct pci_device_iterator *iter; + int i = 0; + + iter = pci_slot_match_iterator_create(&m); + + while ((d = pci_device_next(iter))) + if (d->bus > i) + i = d->bus; + + pci_iterator_destroy(iter); + + return i; +} + static int int1A_handler(xf86Int10InfoPtr pInt) { @@ -674,7 +700,7 @@ int1A_handler(xf86Int10InfoPtr pInt) X86_EDX = 0x20494350; /* " ICP" */ X86_EBX = 0x0210; /* Version 2.10 */ X86_ECX &= 0xFF00; - X86_ECX |= (pciNumBuses & 0xFF); /* Max bus number in system */ + X86_ECX |= int1A_last_bus_number(pvp); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ #ifdef PRINT_INT ErrorF("ax=0x%x dx=0x%x bx=0x%x cx=0x%x flags=0x%x\n", diff --git a/hw/xfree86/loader/dixsym.c b/hw/xfree86/loader/dixsym.c index 220d25c37..e9de050f9 100644 --- a/hw/xfree86/loader/dixsym.c +++ b/hw/xfree86/loader/dixsym.c @@ -323,8 +323,6 @@ _X_HIDDEN void *dixLookupTab[] = { SYMFUNC(TraverseTree) SYMFUNC(UnmapWindow) SYMFUNC(WalkTree) - SYMVAR(deltaSaveUndersViewable) - SYMVAR(numSaveUndersViewable) SYMVAR(savedScreenInfo) SYMVAR(screenIsSaved) diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 7ff17ef40..3d6ca7bd8 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -445,7 +445,6 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86IsPc98) SYMFUNC(xf86DisableRandR) SYMFUNC(xf86GetRotation) - SYMFUNC(xf86GetVersion) SYMFUNC(xf86GetModuleVersion) SYMFUNC(xf86GetClocks) SYMFUNC(xf86SetPriority) diff --git a/hw/xfree86/os-support/Makefile.am b/hw/xfree86/os-support/Makefile.am index b521efe82..04997a6cb 100644 --- a/hw/xfree86/os-support/Makefile.am +++ b/hw/xfree86/os-support/Makefile.am @@ -1,7 +1,7 @@ SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS) DIST_SUBDIRS = bsd bus misc linux solaris sysv sco hurd -sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h assyntax.h +sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h EXTRA_DIST = int10Defines.h xf86OSpriv.h @@ -23,5 +23,4 @@ DISTCLEANFILES = xorgos.c # FIXME: These don't seem to be used anywhere EXTRA_DIST += \ - shared/bios_devmem.c \ - shared/inout.S + shared/bios_devmem.c diff --git a/hw/xfree86/os-support/assyntax.h b/hw/xfree86/os-support/assyntax.h deleted file mode 100644 index 4f8bbbfba..000000000 --- a/hw/xfree86/os-support/assyntax.h +++ /dev/null @@ -1,749 +0,0 @@ -#ifndef __ASSYNTAX_H__ -#define __ASSYNTAX_H__ - -/* - * Copyright 1992 Vrije Universiteit, The Netherlands - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, provided - * that the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of the Vrije Universiteit not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The Vrije Universiteit makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * The Vrije Universiteit DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL The Vrije Universiteit BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ -/* - * Copyright (c) 1993-1999 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - - /* - * assyntax.h - * - * Select the syntax appropriate to the 386 assembler being used - * To add support for more assemblers add more columns to the CHOICE - * macro. Note that register names must also have uppercase names - * to avoid macro recursion. e.g., #define ah %ah recurses! - * - * NB 1. Some of the macros for certain assemblers imply that the code is to - * run in protected mode!! Caveat emptor. - * - * NB 2. 486 specific instructions are not included. This is to discourage - * their accidental use in code that is intended to run on 386 and 486 - * systems. - * - * Supported assemblers: - * - * (a) AT&T SysVr4 as(1): default - * (b) GNU Assembler gas: define USE_GAS or GNU_ASSEMBLER - * (c) Amsterdam Compiler kit: define ACK_ASSEMBLER - * - * The following naming conventions have been used to identify the various - * data types: - * _SR = segment register version - * Integer: - * _Q = quadword = 64 bits - * _L = long = 32 bits - * _W = short = 16 bits - * _B = byte = 8 bits - * Floating-point: - * _X = m80real = 80 bits - * _D = double = 64 bits - * _S = single = 32 bits - * - * Author: Gregory J. Sharp, Sept 1992 - * Vrije Universiteit, Amsterdam, The Netherlands - */ - -#if defined(USE_GAS) && !defined(GNU_ASSEMBLER) -#define GNU_ASSEMBLER -#endif - -#if (defined(__STDC__) && !defined(UNIXCPP)) || (defined (sun) && defined (__i386__) && defined (SVR4) && defined (__STDC__) && !defined (__GNUC__)) -#define CONCAT(x, y) x ## y -#else -#define CONCAT(x, y) x/**/y -#endif - -#ifdef ACK_ASSEMBLER - -/* Assume we write code for 32-bit protected mode! */ - -/* Redefine register names for GAS & AT&T assemblers */ -#define AL al -#define AH ah -#define AX ax -#define EAX ax -#define BL bl -#define BH bh -#define BX bx -#define EBX bx -#define CL cl -#define CH ch -#define CX cx -#define ECX cx -#define DL dl -#define DH dh -#define DX dx -#define EDX dx -#define BP bp -#define EBP bp -#define SI si -#define ESI si -#define DI di -#define EDI di -#define SP sp -#define ESP sp -#define CS cs -#define SS ss -#define DS ds -#define ES es -#define FS fs -#define GS gs -/* Control Registers */ -#define CR0 cr0 -#define CR1 cr1 -#define CR2 cr2 -#define CR3 cr3 -/* Debug Registers */ -#define DR0 dr0 -#define DR1 dr1 -#define DR2 dr2 -#define DR3 dr3 -#define DR4 dr4 -#define DR5 dr5 -#define DR6 dr6 -#define DR7 dr7 -/* Floating-point Stack */ -#define ST st - -#define AS_BEGIN .sect .text; .sect .rom; .sect .data; .sect .bss; .sect .text - - -#define _WTOG o16 /* word toggle for _W instructions */ -#define _LTOG /* long toggle for _L instructions */ -#define ADDR_TOGGLE a16 -#define OPSZ_TOGGLE o16 -#define USE16 .use16 -#define USE32 .use32 - -#define CHOICE(a,b,c) c - -#else /* AT&T or GAS */ - -/* Redefine register names for GAS & AT&T assemblers */ -#define AL %al -#define AH %ah -#define AX %ax -#define EAX %eax -#define BL %bl -#define BH %bh -#define BX %bx -#define EBX %ebx -#define CL %cl -#define CH %ch -#define CX %cx -#define ECX %ecx -#define DL %dl -#define DH %dh -#define DX %dx -#define EDX %edx -#define BP %bp -#define EBP %ebp -#define SI %si -#define ESI %esi -#define DI %di -#define EDI %edi -#define SP %sp -#define ESP %esp -#define CS %cs -#define SS %ss -#define DS %ds -#define ES %es -#define FS %fs -#define GS %gs -/* Control Registers */ -#define CR0 %cr0 -#define CR1 %cr1 -#define CR2 %cr2 -#define CR3 %cr3 -/* Debug Registers */ -#define DR0 %db0 -#define DR1 %db1 -#define DR2 %db2 -#define DR3 %db3 -#define DR4 %db4 -#define DR5 %db5 -#define DR6 %db6 -#define DR7 %db7 -/* Floating-point Stack */ -#define ST %st - -#define AS_BEGIN -#define USE16 -#define USE32 - -#ifdef GNU_ASSEMBLER - -#define ADDR_TOGGLE aword -#define OPSZ_TOGGLE word - -#define CHOICE(a,b,c) b - -#else -/* - * AT&T ASSEMBLER SYNTAX - * ********************* - */ -#define CHOICE(a,b,c) a - -#define ADDR_TOGGLE addr16 -#define OPSZ_TOGGLE data16 - -#endif /* GNU_ASSEMBLER */ -#endif /* ACK_ASSEMBLER */ - - -#if (defined(SYSV) || defined(SVR4)) && !defined(ACK_ASSEMBLER) || defined(__ELF__) || defined(__GNU__) -#define GLNAME(a) a -#else -#define GLNAME(a) CONCAT(_,a) -#endif - - - /****************************************/ - /* */ - /* Select the various choices */ - /* */ - /****************************************/ - - -/* Redefine assembler directives */ -/*********************************/ -#define GLOBL CHOICE(.globl, .globl, .extern) -#define ALIGNTEXT4 CHOICE(.align 4, .align ARG2(2,0x90), .align 4) -#define ALIGNTEXT2 CHOICE(.align 2, .align ARG2(1,0x90), .align 2) -/* ALIGNTEXT4ifNOP is the same as ALIGNTEXT4, but only if the space is - * guaranteed to be filled with NOPs. Otherwise it does nothing. - */ -#define ALIGNTEXT4ifNOP CHOICE(.align 4, .align ARG2(2,0x90), /*can't do it*/) -#define ALIGNDATA4 CHOICE(.align 4, .align ARG2(2,0x0), .align 4) -#define ALIGNDATA2 CHOICE(.align 2, .align ARG2(1,0x0), .align 2) -#define FILE(s) CHOICE(.file s, .file s, .file s) -#define STRING(s) CHOICE(.string s, .asciz s, .asciz s) -#define D_LONG CHOICE(.long, .long, .data4) -#define D_WORD CHOICE(.value, .short, .data2) -#define D_BYTE CHOICE(.byte, .byte, .data1) -#define SPACE CHOICE(.comm, .space, .space) -#define COMM CHOICE(.comm, .comm, .comm) -#define SEG_DATA CHOICE(.data, .data, .sect .data) -#define SEG_TEXT CHOICE(.text, .text, .sect .text) -#define SEG_BSS CHOICE(.bss, .bss, .sect .bss) - -#ifdef GNU_ASSEMBLER -#define D_SPACE(n) . = . + n -#else -#define D_SPACE(n) .space n -#endif - -/* Addressing Modes */ -/* Immediate Mode */ -#define ADDR(a) CHOICE(CONCAT($,a), CONCAT($,a), a) -#define CONST(a) CHOICE(CONCAT($,a), CONCAT($,a), a) - -/* Indirect Mode */ -#define CONTENT(a) CHOICE(a, a, (a)) /* take contents of variable */ -#define REGIND(a) CHOICE((a), (a), (a)) /* Register a indirect */ -/* Register b indirect plus displacement a */ -#define REGOFF(a, b) CHOICE(a(b), a(b), a(b)) -/* Reg indirect Base + Index + Displacement - this is mainly for 16-bit mode - * which has no scaling - */ -#define REGBID(b,i,d) CHOICE(d(b,i), d(b,i), d(b)(i)) -/* Reg indirect Base + (Index * Scale) + Displacement */ -#define REGBISD(b,i,s,d) CHOICE(d(b,i,s), d(b,i,s), d(b)(i*s)) -/* Displaced Scaled Index: */ -#define REGDIS(d,i,s) CHOICE(d(,i,s), d(,i,s), d(i * s)) -/* Indexed Base: */ -#define REGBI(b,i) CHOICE((b,i), (b,i), (b)(i)) -/* Displaced Base: */ -#define REGDB(d,b) CHOICE(d(b), d(b), d(b)) -/* Variable indirect: */ -#define VARINDIRECT(var) CHOICE(*var, *var, (var)) -/* Use register contents as jump/call target: */ -#define CODEPTR(reg) CHOICE(*reg, *reg, reg) - -/* For expressions requiring bracketing - * eg. (CRT0_PM | CRT_EM) - */ - -#define EXPR(a) CHOICE([a], (a), [a]) -#define ENOT(a) CHOICE(0!a, ~a, ~a) -#define EMUL(a,b) CHOICE(a\*b, a*b, a*b) -#define EDIV(a,b) CHOICE(a\/b, a/b, a/b) - -/* - * We have to beat the problem of commas within arguments to choice. - * eg. choice (add a,b, add b,a) will get argument mismatch. Luckily ANSI - * and other known cpp definitions evaluate arguments before substitution - * so the following works. - */ -#define ARG2(a, b) a,b -#define ARG3(a,b,c) a,b,c - -/* Redefine assembler commands */ -#define AAA CHOICE(aaa, aaa, aaa) -#define AAD CHOICE(aad, aad, aad) -#define AAM CHOICE(aam, aam, aam) -#define AAS CHOICE(aas, aas, aas) -#define ADC_L(a, b) CHOICE(adcl ARG2(a,b), adcl ARG2(a,b), _LTOG adc ARG2(b,a)) -#define ADC_W(a, b) CHOICE(adcw ARG2(a,b), adcw ARG2(a,b), _WTOG adc ARG2(b,a)) -#define ADC_B(a, b) CHOICE(adcb ARG2(a,b), adcb ARG2(a,b), adcb ARG2(b,a)) -#define ADD_L(a, b) CHOICE(addl ARG2(a,b), addl ARG2(a,b), _LTOG add ARG2(b,a)) -#define ADD_W(a, b) CHOICE(addw ARG2(a,b), addw ARG2(a,b), _WTOG add ARG2(b,a)) -#define ADD_B(a, b) CHOICE(addb ARG2(a,b), addb ARG2(a,b), addb ARG2(b,a)) -#define AND_L(a, b) CHOICE(andl ARG2(a,b), andl ARG2(a,b), _LTOG and ARG2(b,a)) -#define AND_W(a, b) CHOICE(andw ARG2(a,b), andw ARG2(a,b), _WTOG and ARG2(b,a)) -#define AND_B(a, b) CHOICE(andb ARG2(a,b), andb ARG2(a,b), andb ARG2(b,a)) -#define ARPL(a,b) CHOICE(arpl ARG2(a,b), arpl ARG2(a,b), arpl ARG2(b,a)) -#define BOUND_L(a, b) CHOICE(boundl ARG2(a,b), boundl ARG2(b,a), _LTOG bound ARG2(b,a)) -#define BOUND_W(a, b) CHOICE(boundw ARG2(a,b), boundw ARG2(b,a), _WTOG bound ARG2(b,a)) -#define BSF_L(a, b) CHOICE(bsfl ARG2(a,b), bsfl ARG2(a,b), _LTOG bsf ARG2(b,a)) -#define BSF_W(a, b) CHOICE(bsfw ARG2(a,b), bsfw ARG2(a,b), _WTOG bsf ARG2(b,a)) -#define BSR_L(a, b) CHOICE(bsrl ARG2(a,b), bsrl ARG2(a,b), _LTOG bsr ARG2(b,a)) -#define BSR_W(a, b) CHOICE(bsrw ARG2(a,b), bsrw ARG2(a,b), _WTOG bsr ARG2(b,a)) -#define BT_L(a, b) CHOICE(btl ARG2(a,b), btl ARG2(a,b), _LTOG bt ARG2(b,a)) -#define BT_W(a, b) CHOICE(btw ARG2(a,b), btw ARG2(a,b), _WTOG bt ARG2(b,a)) -#define BTC_L(a, b) CHOICE(btcl ARG2(a,b), btcl ARG2(a,b), _LTOG btc ARG2(b,a)) -#define BTC_W(a, b) CHOICE(btcw ARG2(a,b), btcw ARG2(a,b), _WTOG btc ARG2(b,a)) -#define BTR_L(a, b) CHOICE(btrl ARG2(a,b), btrl ARG2(a,b), _LTOG btr ARG2(b,a)) -#define BTR_W(a, b) CHOICE(btrw ARG2(a,b), btrw ARG2(a,b), _WTOG btr ARG2(b,a)) -#define BTS_L(a, b) CHOICE(btsl ARG2(a,b), btsl ARG2(a,b), _LTOG bts ARG2(b,a)) -#define BTS_W(a, b) CHOICE(btsw ARG2(a,b), btsw ARG2(a,b), _WTOG bts ARG2(b,a)) -#define CALL(a) CHOICE(call a, call a, call a) -#define CALLF(s,a) CHOICE(lcall ARG2(s,a), lcall ARG2(s,a), callf s:a) -#define CBW CHOICE(cbtw, cbw, cbw) -#define CWDE CHOICE(cwtd, cwde, cwde) -#define CLC CHOICE(clc, clc, clc) -#define CLD CHOICE(cld, cld, cld) -#define CLI CHOICE(cli, cli, cli) -#define CLTS CHOICE(clts, clts, clts) -#define CMC CHOICE(cmc, cmc, cmc) -#define CMP_L(a, b) CHOICE(cmpl ARG2(a,b), cmpl ARG2(a,b), _LTOG cmp ARG2(b,a)) -#define CMP_W(a, b) CHOICE(cmpw ARG2(a,b), cmpw ARG2(a,b), _WTOG cmp ARG2(b,a)) -#define CMP_B(a, b) CHOICE(cmpb ARG2(a,b), cmpb ARG2(a,b), cmpb ARG2(b,a)) -#define CMPS_L CHOICE(cmpsl, cmpsl, _LTOG cmps) -#define CMPS_W CHOICE(cmpsw, cmpsw, _WTOG cmps) -#define CMPS_B CHOICE(cmpsb, cmpsb, cmpsb) -#define CWD CHOICE(cwtl, cwd, cwd) -#define CDQ CHOICE(cltd, cdq, cdq) -#define DAA CHOICE(daa, daa, daa) -#define DAS CHOICE(das, das, das) -#define DEC_L(a) CHOICE(decl a, decl a, _LTOG dec a) -#define DEC_W(a) CHOICE(decw a, decw a, _WTOG dec a) -#define DEC_B(a) CHOICE(decb a, decb a, decb a) -#define DIV_L(a) CHOICE(divl a, divl a, div a) -#define DIV_W(a) CHOICE(divw a, divw a, div a) -#define DIV_B(a) CHOICE(divb a, divb a, divb a) -#define ENTER(a,b) CHOICE(enter ARG2(a,b), enter ARG2(a,b), enter ARG2(b,a)) -#define HLT CHOICE(hlt, hlt, hlt) -#define IDIV_L(a) CHOICE(idivl a, idivl a, _LTOG idiv a) -#define IDIV_W(a) CHOICE(idivw a, idivw a, _WTOG idiv a) -#define IDIV_B(a) CHOICE(idivb a, idivb a, idivb a) -/* More forms than this for imul!! */ -#define IMUL_L(a, b) CHOICE(imull ARG2(a,b), imull ARG2(a,b), _LTOG imul ARG2(b,a)) -#define IMUL_W(a, b) CHOICE(imulw ARG2(a,b), imulw ARG2(a,b), _WTOG imul ARG2(b,a)) -#define IMUL_B(a) CHOICE(imulb a, imulb a, imulb a) -#define IN_L CHOICE(inl (DX), inl ARG2(DX,EAX), _LTOG in DX) -#define IN_W CHOICE(inw (DX), inw ARG2(DX,AX), _WTOG in DX) -#define IN_B CHOICE(inb (DX), inb ARG2(DX,AL), inb DX) -/* Please AS code writer: use the following ONLY, if you refer to ports<256 - * directly, but not in IN1_W(DX), for instance, even if IN1_ looks nicer - */ -#if defined (sun) -#define IN1_L(a) CHOICE(inl (a), inl ARG2(a,EAX), _LTOG in a) -#define IN1_W(a) CHOICE(inw (a), inw ARG2(a,AX), _WTOG in a) -#define IN1_B(a) CHOICE(inb (a), inb ARG2(a,AL), inb a) -#else -#define IN1_L(a) CHOICE(inl a, inl ARG2(a,EAX), _LTOG in a) -#define IN1_W(a) CHOICE(inw a, inw ARG2(a,AX), _WTOG in a) -#define IN1_B(a) CHOICE(inb a, inb ARG2(a,AL), inb a) -#endif -#define INC_L(a) CHOICE(incl a, incl a, _LTOG inc a) -#define INC_W(a) CHOICE(incw a, incw a, _WTOG inc a) -#define INC_B(a) CHOICE(incb a, incb a, incb a) -#define INS_L CHOICE(insl, insl, _LTOG ins) -#define INS_W CHOICE(insw, insw, _WTOG ins) -#define INS_B CHOICE(insb, insb, insb) -#define INT(a) CHOICE(int a, int a, int a) -#define INT3 CHOICE(int CONST(3), int3, int CONST(3)) -#define INTO CHOICE(into, into, into) -#define IRET CHOICE(iret, iret, iret) -#define IRETD CHOICE(iret, iret, iretd) -#define JA(a) CHOICE(ja a, ja a, ja a) -#define JAE(a) CHOICE(jae a, jae a, jae a) -#define JB(a) CHOICE(jb a, jb a, jb a) -#define JBE(a) CHOICE(jbe a, jbe a, jbe a) -#define JC(a) CHOICE(jc a, jc a, jc a) -#define JE(a) CHOICE(je a, je a, je a) -#define JG(a) CHOICE(jg a, jg a, jg a) -#define JGE(a) CHOICE(jge a, jge a, jge a) -#define JL(a) CHOICE(jl a, jl a, jl a) -#define JLE(a) CHOICE(jle a, jle a, jle a) -#define JNA(a) CHOICE(jna a, jna a, jna a) -#define JNAE(a) CHOICE(jnae a, jnae a, jnae a) -#define JNB(a) CHOICE(jnb a, jnb a, jnb a) -#define JNBE(a) CHOICE(jnbe a, jnbe a, jnbe a) -#define JNC(a) CHOICE(jnc a, jnc a, jnc a) -#define JNE(a) CHOICE(jne a, jne a, jne a) -#define JNG(a) CHOICE(jng a, jng a, jng a) -#define JNGE(a) CHOICE(jnge a, jnge a, jnge a) -#define JNL(a) CHOICE(jnl a, jnl a, jnl a) -#define JNLE(a) CHOICE(jnle a, jnle a, jnle a) -#define JNO(a) CHOICE(jno a, jno a, jno a) -#define JNP(a) CHOICE(jnp a, jnp a, jnp a) -#define JNS(a) CHOICE(jns a, jns a, jns a) -#define JNZ(a) CHOICE(jnz a, jnz a, jnz a) -#define JO(a) CHOICE(jo a, jo a, jo a) -#define JP(a) CHOICE(jp a, jp a, jp a) -#define JPE(a) CHOICE(jpe a, jpe a, jpe a) -#define JPO(a) CHOICE(jpo a, jpo a, jpo a) -#define JS(a) CHOICE(js a, js a, js a) -#define JZ(a) CHOICE(jz a, jz a, jz a) -#define JMP(a) CHOICE(jmp a, jmp a, jmp a) -#define JMPF(s,a) CHOICE(ljmp ARG2(s,a), ljmp ARG2(s,a), jmpf s:a) -#define LAHF CHOICE(lahf, lahf, lahf) -#if !defined(_REAL_MODE) && !defined(_V86_MODE) -#define LAR(a, b) CHOICE(lar ARG2(a, b), lar ARG2(a, b), lar ARG2(b, a)) -#endif -#define LEA_L(a, b) CHOICE(leal ARG2(a,b), leal ARG2(a,b), _LTOG lea ARG2(b,a)) -#define LEA_W(a, b) CHOICE(leaw ARG2(a,b), leaw ARG2(a,b), _WTOG lea ARG2(b,a)) -#define LEAVE CHOICE(leave, leave, leave) -#define LGDT(a) CHOICE(lgdt a, lgdt a, lgdt a) -#define LIDT(a) CHOICE(lidt a, lidt a, lidt a) -#define LDS(a, b) CHOICE(ldsl ARG2(a,b), lds ARG2(a,b), lds ARG2(b,a)) -#define LES(a, b) CHOICE(lesl ARG2(a,b), les ARG2(a,b), les ARG2(b,a)) -#define LFS(a, b) CHOICE(lfsl ARG2(a,b), lfs ARG2(a,b), lfs ARG2(b,a)) -#define LGS(a, b) CHOICE(lgsl ARG2(a,b), lgs ARG2(a,b), lgs ARG2(b,a)) -#define LSS(a, b) CHOICE(lssl ARG2(a,b), lss ARG2(a,b), lss ARG2(b,a)) -#define LLDT(a) CHOICE(lldt a, lldt a, lldt a) -#define LMSW(a) CHOICE(lmsw a, lmsw a, lmsw a) -#define LOCK CHOICE(lock, lock, lock) -#define LODS_L CHOICE(lodsl, lodsl, _LTOG lods) -#define LODS_W CHOICE(lodsw, lodsw, _WTOG lods) -#define LODS_B CHOICE(lodsb, lodsb, lodsb) -#define LOOP(a) CHOICE(loop a, loop a, loop a) -#define LOOPE(a) CHOICE(loope a, loope a, loope a) -#define LOOPZ(a) CHOICE(loopz a, loopz a, loopz a) -#define LOOPNE(a) CHOICE(loopne a, loopne a, loopne a) -#define LOOPNZ(a) CHOICE(loopnz a, loopnz a, loopnz a) -#if !defined(_REAL_MODE) && !defined(_V86_MODE) -#define LSL(a, b) CHOICE(lsl ARG2(a,b), lsl ARG2(a,b), lsl ARG2(b,a)) -#endif -#define LTR(a) CHOICE(ltr a, ltr a, ltr a) -#define MOV_SR(a, b) CHOICE(movw ARG2(a,b), mov ARG2(a,b), mov ARG2(b,a)) -#define MOV_L(a, b) CHOICE(movl ARG2(a,b), movl ARG2(a,b), _LTOG mov ARG2(b,a)) -#define MOV_W(a, b) CHOICE(movw ARG2(a,b), movw ARG2(a,b), _WTOG mov ARG2(b,a)) -#define MOV_B(a, b) CHOICE(movb ARG2(a,b), movb ARG2(a,b), movb ARG2(b,a)) -#define MOVS_L CHOICE(movsl, movsl, _LTOG movs) -#define MOVS_W CHOICE(movsw, movsw, _WTOG movs) -#define MOVS_B CHOICE(movsb, movsb, movsb) -#define MOVSX_BL(a, b) CHOICE(movsbl ARG2(a,b), movsbl ARG2(a,b), movsx ARG2(b,a)) -#define MOVSX_BW(a, b) CHOICE(movsbw ARG2(a,b), movsbw ARG2(a,b), movsx ARG2(b,a)) -#define MOVSX_WL(a, b) CHOICE(movswl ARG2(a,b), movswl ARG2(a,b), movsx ARG2(b,a)) -#define MOVZX_BL(a, b) CHOICE(movzbl ARG2(a,b), movzbl ARG2(a,b), movzx ARG2(b,a)) -#define MOVZX_BW(a, b) CHOICE(movzbw ARG2(a,b), movzbw ARG2(a,b), movzx ARG2(b,a)) -#define MOVZX_WL(a, b) CHOICE(movzwl ARG2(a,b), movzwl ARG2(a,b), movzx ARG2(b,a)) -#define MUL_L(a) CHOICE(mull a, mull a, _LTOG mul a) -#define MUL_W(a) CHOICE(mulw a, mulw a, _WTOG mul a) -#define MUL_B(a) CHOICE(mulb a, mulb a, mulb a) -#define NEG_L(a) CHOICE(negl a, negl a, _LTOG neg a) -#define NEG_W(a) CHOICE(negw a, negw a, _WTOG neg a) -#define NEG_B(a) CHOICE(negb a, negb a, negb a) -#define NOP CHOICE(nop, nop, nop) -#define NOT_L(a) CHOICE(notl a, notl a, _LTOG not a) -#define NOT_W(a) CHOICE(notw a, notw a, _WTOG not a) -#define NOT_B(a) CHOICE(notb a, notb a, notb a) -#define OR_L(a,b) CHOICE(orl ARG2(a,b), orl ARG2(a,b), _LTOG or ARG2(b,a)) -#define OR_W(a,b) CHOICE(orw ARG2(a,b), orw ARG2(a,b), _WTOG or ARG2(b,a)) -#define OR_B(a,b) CHOICE(orb ARG2(a,b), orb ARG2(a,b), orb ARG2(b,a)) -#define OUT_L CHOICE(outl (DX), outl ARG2(EAX,DX), _LTOG out DX) -#define OUT_W CHOICE(outw (DX), outw ARG2(AX,DX), _WTOG out DX) -#define OUT_B CHOICE(outb (DX), outb ARG2(AL,DX), outb DX) -/* Please AS code writer: use the following ONLY, if you refer to ports<256 - * directly, but not in OUT1_W(DX), for instance, even if OUT1_ looks nicer - */ -#define OUT1_L(a) CHOICE(outl (a), outl ARG2(EAX,a), _LTOG out a) -#define OUT1_W(a) CHOICE(outw (a), outw ARG2(AX,a), _WTOG out a) -#define OUT1_B(a) CHOICE(outb (a), outb ARG2(AL,a), outb a) -#define OUTS_L CHOICE(outsl, outsl, _LTOG outs) -#define OUTS_W CHOICE(outsw, outsw, _WTOG outs) -#define OUTS_B CHOICE(outsb, outsb, outsb) -#define POP_SR(a) CHOICE(pop a, pop a, pop a) -#define POP_L(a) CHOICE(popl a, popl a, _LTOG pop a) -#define POP_W(a) CHOICE(popw a, popw a, _WTOG pop a) -#define POPA_L CHOICE(popal, popal, _LTOG popa) -#define POPA_W CHOICE(popaw, popaw, _WTOG popa) -#define POPF_L CHOICE(popfl, popfl, _LTOG popf) -#define POPF_W CHOICE(popfw, popfw, _WTOG popf) -#define PUSH_SR(a) CHOICE(push a, push a, push a) -#define PUSH_L(a) CHOICE(pushl a, pushl a, _LTOG push a) -#define PUSH_W(a) CHOICE(pushw a, pushw a, _WTOG push a) -#define PUSH_B(a) CHOICE(push a, pushb a, push a) -#define PUSHA_L CHOICE(pushal, pushal, _LTOG pusha) -#define PUSHA_W CHOICE(pushaw, pushaw, _WTOG pusha) -#define PUSHF_L CHOICE(pushfl, pushfl, _LTOG pushf) -#define PUSHF_W CHOICE(pushfw, pushfw, _WTOG pushf) -#define RCL_L(a, b) CHOICE(rcll ARG2(a,b), rcll ARG2(a,b), _LTOG rcl ARG2(b,a)) -#define RCL_W(a, b) CHOICE(rclw ARG2(a,b), rclw ARG2(a,b), _WTOG rcl ARG2(b,a)) -#define RCL_B(a, b) CHOICE(rclb ARG2(a,b), rclb ARG2(a,b), rclb ARG2(b,a)) -#define RCR_L(a, b) CHOICE(rcrl ARG2(a,b), rcrl ARG2(a,b), _LTOG rcr ARG2(b,a)) -#define RCR_W(a, b) CHOICE(rcrw ARG2(a,b), rcrw ARG2(a,b), _WTOG rcr ARG2(b,a)) -#define RCR_B(a, b) CHOICE(rcrb ARG2(a,b), rcrb ARG2(a,b), rcrb ARG2(b,a)) -#define ROL_L(a, b) CHOICE(roll ARG2(a,b), roll ARG2(a,b), _LTOG rol ARG2(b,a)) -#define ROL_W(a, b) CHOICE(rolw ARG2(a,b), rolw ARG2(a,b), _WTOG rol ARG2(b,a)) -#define ROL_B(a, b) CHOICE(rolb ARG2(a,b), rolb ARG2(a,b), rolb ARG2(b,a)) -#define ROR_L(a, b) CHOICE(rorl ARG2(a,b), rorl ARG2(a,b), _LTOG ror ARG2(b,a)) -#define ROR_W(a, b) CHOICE(rorw ARG2(a,b), rorw ARG2(a,b), _WTOG ror ARG2(b,a)) -#define ROR_B(a, b) CHOICE(rorb ARG2(a,b), rorb ARG2(a,b), rorb ARG2(b,a)) -#define REP CHOICE(rep ;, rep ;, repe) -#define REPE CHOICE(repz ;, repe ;, repe) -#define REPNE CHOICE(repnz ;, repne ;, repne) -#define REPNZ REPNE -#define REPZ REPE -#define RET CHOICE(ret, ret, ret) -#define SAHF CHOICE(sahf, sahf, sahf) -#define SAL_L(a, b) CHOICE(sall ARG2(a,b), sall ARG2(a,b), _LTOG sal ARG2(b,a)) -#define SAL_W(a, b) CHOICE(salw ARG2(a,b), salw ARG2(a,b), _WTOG sal ARG2(b,a)) -#define SAL_B(a, b) CHOICE(salb ARG2(a,b), salb ARG2(a,b), salb ARG2(b,a)) -#define SAR_L(a, b) CHOICE(sarl ARG2(a,b), sarl ARG2(a,b), _LTOG sar ARG2(b,a)) -#define SAR_W(a, b) CHOICE(sarw ARG2(a,b), sarw ARG2(a,b), _WTOG sar ARG2(b,a)) -#define SAR_B(a, b) CHOICE(sarb ARG2(a,b), sarb ARG2(a,b), sarb ARG2(b,a)) -#define SBB_L(a, b) CHOICE(sbbl ARG2(a,b), sbbl ARG2(a,b), _LTOG sbb ARG2(b,a)) -#define SBB_W(a, b) CHOICE(sbbw ARG2(a,b), sbbw ARG2(a,b), _WTOG sbb ARG2(b,a)) -#define SBB_B(a, b) CHOICE(sbbb ARG2(a,b), sbbb ARG2(a,b), sbbb ARG2(b,a)) -#define SCAS_L CHOICE(scasl, scasl, _LTOG scas) -#define SCAS_W CHOICE(scasw, scasw, _WTOG scas) -#define SCAS_B CHOICE(scasb, scasb, scasb) -#define SETA(a) CHOICE(seta a, seta a, seta a) -#define SETAE(a) CHOICE(setae a, setae a, setae a) -#define SETB(a) CHOICE(setb a, setb a, setb a) -#define SETBE(a) CHOICE(setbe a, setbe a, setbe a) -#define SETC(a) CHOICE(setc a, setb a, setb a) -#define SETE(a) CHOICE(sete a, sete a, sete a) -#define SETG(a) CHOICE(setg a, setg a, setg a) -#define SETGE(a) CHOICE(setge a, setge a, setge a) -#define SETL(a) CHOICE(setl a, setl a, setl a) -#define SETLE(a) CHOICE(setle a, setle a, setle a) -#define SETNA(a) CHOICE(setna a, setna a, setna a) -#define SETNAE(a) CHOICE(setnae a, setnae a, setnae a) -#define SETNB(a) CHOICE(setnb a, setnb a, setnb a) -#define SETNBE(a) CHOICE(setnbe a, setnbe a, setnbe a) -#define SETNC(a) CHOICE(setnc a, setnb a, setnb a) -#define SETNE(a) CHOICE(setne a, setne a, setne a) -#define SETNG(a) CHOICE(setng a, setng a, setng a) -#define SETNGE(a) CHOICE(setnge a, setnge a, setnge a) -#define SETNL(a) CHOICE(setnl a, setnl a, setnl a) -#define SETNLE(a) CHOICE(setnle a, setnle a, setnle a) -#define SETNO(a) CHOICE(setno a, setno a, setno a) -#define SETNP(a) CHOICE(setnp a, setnp a, setnp a) -#define SETNS(a) CHOICE(setns a, setns a, setna a) -#define SETNZ(a) CHOICE(setnz a, setnz a, setnz a) -#define SETO(a) CHOICE(seto a, seto a, seto a) -#define SETP(a) CHOICE(setp a, setp a, setp a) -#define SETPE(a) CHOICE(setpe a, setpe a, setpe a) -#define SETPO(a) CHOICE(setpo a, setpo a, setpo a) -#define SETS(a) CHOICE(sets a, sets a, seta a) -#define SETZ(a) CHOICE(setz a, setz a, setz a) -#define SGDT(a) CHOICE(sgdt a, sgdt a, sgdt a) -#define SIDT(a) CHOICE(sidt a, sidt a, sidt a) -#define SHL_L(a, b) CHOICE(shll ARG2(a,b), shll ARG2(a,b), _LTOG shl ARG2(b,a)) -#define SHL_W(a, b) CHOICE(shlw ARG2(a,b), shlw ARG2(a,b), _WTOG shl ARG2(b,a)) -#define SHL_B(a, b) CHOICE(shlb ARG2(a,b), shlb ARG2(a,b), shlb ARG2(b,a)) -#define SHLD_L(a,b,c) CHOICE(shldl ARG3(a,b,c), shldl ARG3(a,b,c), _LTOG shld ARG3(c,b,a)) -#define SHLD2_L(a,b) CHOICE(shldl ARG2(a,b), shldl ARG3(CL,a,b), _LTOG shld ARG3(b,a,CL)) -#define SHLD_W(a,b,c) CHOICE(shldw ARG3(a,b,c), shldw ARG3(a,b,c), _WTOG shld ARG3(c,b,a)) -#define SHLD2_W(a,b) CHOICE(shldw ARG2(a,b), shldw ARG3(CL,a,b), _WTOG shld ARG3(b,a,CL)) -#define SHR_L(a, b) CHOICE(shrl ARG2(a,b), shrl ARG2(a,b), _LTOG shr ARG2(b,a)) -#define SHR_W(a, b) CHOICE(shrw ARG2(a,b), shrw ARG2(a,b), _WTOG shr ARG2(b,a)) -#define SHR_B(a, b) CHOICE(shrb ARG2(a,b), shrb ARG2(a,b), shrb ARG2(b,a)) -#define SHRD_L(a,b,c) CHOICE(shrdl ARG3(a,b,c), shrdl ARG3(a,b,c), _LTOG shrd ARG3(c,b,a)) -#define SHRD2_L(a,b) CHOICE(shrdl ARG2(a,b), shrdl ARG3(CL,a,b), _LTOG shrd ARG3(b,a,CL)) -#define SHRD_W(a,b,c) CHOICE(shrdw ARG3(a,b,c), shrdw ARG3(a,b,c), _WTOG shrd ARG3(c,b,a)) -#define SHRD2_W(a,b) CHOICE(shrdw ARG2(a,b), shrdw ARG3(CL,a,b), _WTOG shrd ARG3(b,a,CL)) -#define SLDT(a) CHOICE(sldt a, sldt a, sldt a) -#define SMSW(a) CHOICE(smsw a, smsw a, smsw a) -#define STC CHOICE(stc, stc, stc) -#define STD CHOICE(std, std, std) -#define STI CHOICE(sti, sti, sti) -#define STOS_L CHOICE(stosl, stosl, _LTOG stos) -#define STOS_W CHOICE(stosw, stosw, _WTOG stos) -#define STOS_B CHOICE(stosb, stosb, stosb) -#define STR(a) CHOICE(str a, str a, str a) -#define SUB_L(a, b) CHOICE(subl ARG2(a,b), subl ARG2(a,b), _LTOG sub ARG2(b,a)) -#define SUB_W(a, b) CHOICE(subw ARG2(a,b), subw ARG2(a,b), _WTOG sub ARG2(b,a)) -#define SUB_B(a, b) CHOICE(subb ARG2(a,b), subb ARG2(a,b), subb ARG2(b,a)) -#define TEST_L(a, b) CHOICE(testl ARG2(a,b), testl ARG2(a,b), _LTOG test ARG2(b,a)) -#define TEST_W(a, b) CHOICE(testw ARG2(a,b), testw ARG2(a,b), _WTOG test ARG2(b,a)) -#define TEST_B(a, b) CHOICE(testb ARG2(a,b), testb ARG2(a,b), testb ARG2(b,a)) -#define VERR(a) CHOICE(verr a, verr a, verr a) -#define VERW(a) CHOICE(verw a, verw a, verw a) -#define WAIT CHOICE(wait, wait, wait) -#define XCHG_L(a, b) CHOICE(xchgl ARG2(a,b), xchgl ARG2(a,b), _LTOG xchg ARG2(b,a)) -#define XCHG_W(a, b) CHOICE(xchgw ARG2(a,b), xchgw ARG2(a,b), _WTOG xchg ARG2(b,a)) -#define XCHG_B(a, b) CHOICE(xchgb ARG2(a,b), xchgb ARG2(a,b), xchgb ARG2(b,a)) -#define XLAT CHOICE(xlat, xlat, xlat) -#define XOR_L(a, b) CHOICE(xorl ARG2(a,b), xorl ARG2(a,b), _LTOG xor ARG2(b,a)) -#define XOR_W(a, b) CHOICE(xorw ARG2(a,b), xorw ARG2(a,b), _WTOG xor ARG2(b,a)) -#define XOR_B(a, b) CHOICE(xorb ARG2(a,b), xorb ARG2(a,b), xorb ARG2(b,a)) - - -/* Floating Point Instructions */ -#define F2XM1 CHOICE(f2xm1, f2xm1, f2xm1) -#define FABS CHOICE(fabs, fabs, fabs) -#define FADD_D(a) CHOICE(faddl a, faddl a, faddd a) -#define FADD_S(a) CHOICE(fadds a, fadds a, fadds a) -#define FADD2(a, b) CHOICE(fadd ARG2(a,b), fadd ARG2(a,b), fadd ARG2(b,a)) -#define FADDP(a, b) CHOICE(faddp ARG2(a,b), faddp ARG2(a,b), faddp ARG2(b,a)) -#define FIADD_L(a) CHOICE(fiaddl a, fiaddl a, fiaddl a) -#define FIADD_W(a) CHOICE(fiadd a, fiadds a, fiadds a) -#define FBLD(a) CHOICE(fbld a, fbld a, fbld a) -#define FBSTP(a) CHOICE(fbstp a, fbstp a, fbstp a) -#define FCHS CHOICE(fchs, fchs, fchs) -#define FCLEX CHOICE(fclex, wait; fnclex, wait; fclex) -#define FNCLEX CHOICE(fnclex, fnclex, fclex) -#define FCOM(a) CHOICE(fcom a, fcom a, fcom a) -#define FCOM_D(a) CHOICE(fcoml a, fcoml a, fcomd a) -#define FCOM_S(a) CHOICE(fcoms a, fcoms a, fcoms a) -#define FCOMP(a) CHOICE(fcomp a, fcomp a, fcomp a) -#define FCOMP_D(a) CHOICE(fcompl a, fcompl a, fcompd a) -#define FCOMP_S(a) CHOICE(fcomps a, fcomps a, fcomps a) -#define FCOMPP CHOICE(fcompp, fcompp, fcompp) -#define FCOS CHOICE(fcos, fcos, fcos) -#define FDECSTP CHOICE(fdecstp, fdecstp, fdecstp) -#define FDIV_D(a) CHOICE(fdivl a, fdivl a, fdivd a) -#define FDIV_S(a) CHOICE(fdivs a, fdivs a, fdivs a) -#define FDIV2(a, b) CHOICE(fdiv ARG2(a,b), fdiv ARG2(a,b), fdiv ARG2(b,a)) -#define FDIVP(a, b) CHOICE(fdivp ARG2(a,b), fdivp ARG2(a,b), fdivp ARG2(b,a)) -#define FIDIV_L(a) CHOICE(fidivl a, fidivl a, fidivl a) -#define FIDIV_W(a) CHOICE(fidiv a, fidivs a, fidivs a) -#define FDIVR_D(a) CHOICE(fdivrl a, fdivrl a, fdivrd a) -#define FDIVR_S(a) CHOICE(fdivrs a, fdivrs a, fdivrs a) -#define FDIVR2(a, b) CHOICE(fdivr ARG2(a,b), fdivr ARG2(a,b), fdivr ARG2(b,a)) -#define FDIVRP(a, b) CHOICE(fdivrp ARG2(a,b), fdivrp ARG2(a,b), fdivrp ARG2(b,a)) -#define FIDIVR_L(a) CHOICE(fidivrl a, fidivrl a, fidivrl a) -#define FIDIVR_W(a) CHOICE(fidivr a, fidivrs a, fidivrs a) -#define FFREE(a) CHOICE(ffree a, ffree a, ffree a) -#define FICOM_L(a) CHOICE(ficoml a, ficoml a, ficoml a) -#define FICOM_W(a) CHOICE(ficom a, ficoms a, ficoms a) -#define FICOMP_L(a) CHOICE(ficompl a, ficompl a, ficompl a) -#define FICOMP_W(a) CHOICE(ficomp a, ficomps a, ficomps a) -#define FILD_Q(a) CHOICE(fildll a, fildq a, fildq a) -#define FILD_L(a) CHOICE(fildl a, fildl a, fildl a) -#define FILD_W(a) CHOICE(fild a, filds a, filds a) -#define FINCSTP CHOICE(fincstp, fincstp, fincstp) -#define FINIT CHOICE(finit, wait; fninit, wait; finit) -#define FNINIT CHOICE(fninit, fninit, finit) -#define FIST_L(a) CHOICE(fistl a, fistl a, fistl a) -#define FIST_W(a) CHOICE(fist a, fists a, fists a) -#define FISTP_Q(a) CHOICE(fistpll a, fistpq a, fistpq a) -#define FISTP_L(a) CHOICE(fistpl a, fistpl a, fistpl a) -#define FISTP_W(a) CHOICE(fistp a, fistps a, fistps a) -#define FLD_X(a) CHOICE(fldt a, fldt a, fldx a) /* 80 bit data type! */ -#define FLD_D(a) CHOICE(fldl a, fldl a, fldd a) -#define FLD_S(a) CHOICE(flds a, flds a, flds a) -#define FLD1 CHOICE(fld1, fld1, fld1) -#define FLDL2T CHOICE(fldl2t, fldl2t, fldl2t) -#define FLDL2E CHOICE(fldl2e, fldl2e, fldl2e) -#define FLDPI CHOICE(fldpi, fldpi, fldpi) -#define FLDLG2 CHOICE(fldlg2, fldlg2, fldlg2) -#define FLDLN2 CHOICE(fldln2, fldln2, fldln2) -#define FLDZ CHOICE(fldz, fldz, fldz) -#define FLDCW(a) CHOICE(fldcw a, fldcw a, fldcw a) -#define FLDENV(a) CHOICE(fldenv a, fldenv a, fldenv a) -#define FMUL_S(a) CHOICE(fmuls a, fmuls a, fmuls a) -#define FMUL_D(a) CHOICE(fmull a, fmull a, fmuld a) -#define FMUL2(a, b) CHOICE(fmul ARG2(a,b), fmul ARG2(a,b), fmul ARG2(b,a)) -#define FMULP(a, b) CHOICE(fmulp ARG2(a,b), fmulp ARG2(a,b), fmulp ARG2(b,a)) -#define FIMUL_L(a) CHOICE(fimull a, fimull a, fimull a) -#define FIMUL_W(a) CHOICE(fimul a, fimuls a, fimuls a) -#define FNOP CHOICE(fnop, fnop, fnop) -#define FPATAN CHOICE(fpatan, fpatan, fpatan) -#define FPREM CHOICE(fprem, fprem, fprem) -#define FPREM1 CHOICE(fprem1, fprem1, fprem1) -#define FPTAN CHOICE(fptan, fptan, fptan) -#define FRNDINT CHOICE(frndint, frndint, frndint) -#define FRSTOR(a) CHOICE(frstor a, frstor a, frstor a) -#define FSAVE(a) CHOICE(fsave a, wait; fnsave a, wait; fsave a) -#define FNSAVE(a) CHOICE(fnsave a, fnsave a, fsave a) -#define FSCALE CHOICE(fscale, fscale, fscale) -#define FSIN CHOICE(fsin, fsin, fsin) -#define FSINCOS CHOICE(fsincos, fsincos, fsincos) -#define FSQRT CHOICE(fsqrt, fsqrt, fsqrt) -#define FST_D(a) CHOICE(fstl a, fstl a, fstd a) -#define FST_S(a) CHOICE(fsts a, fsts a, fsts a) -#define FSTP_X(a) CHOICE(fstpt a, fstpt a, fstpx a) -#define FSTP_D(a) CHOICE(fstpl a, fstpl a, fstpd a) -#define FSTP_S(a) CHOICE(fstps a, fstps a, fstps a) -#define FSTCW(a) CHOICE(fstcw a, wait; fnstcw a, wait; fstcw a) -#define FNSTCW(a) CHOICE(fnstcw a, fnstcw a, fstcw a) -#define FSTENV(a) CHOICE(fstenv a, wait; fnstenv a, fstenv a) -#define FNSTENV(a) CHOICE(fnstenv a, fnstenv a, fstenv a) -#define FSTSW(a) CHOICE(fstsw a, wait; fnstsw a, wait; fstsw a) -#define FNSTSW(a) CHOICE(fnstsw a, fnstsw a, fstsw a) -#define FSUB_S(a) CHOICE(fsubs a, fsubs a, fsubs a) -#define FSUB_D(a) CHOICE(fsubl a, fsubl a, fsubd a) -#define FSUB2(a, b) CHOICE(fsub ARG2(a,b), fsub ARG2(a,b), fsub ARG2(b,a)) -#define FSUBP(a, b) CHOICE(fsubp ARG2(a,b), fsubp ARG2(a,b), fsubp ARG2(b,a)) -#define FISUB_L(a) CHOICE(fisubl a, fisubl a, fisubl a) -#define FISUB_W(a) CHOICE(fisub a, fisubs a, fisubs a) -#define FSUBR_S(a) CHOICE(fsubrs a, fsubrs a, fsubrs a) -#define FSUBR_D(a) CHOICE(fsubrl a, fsubrl a, fsubrd a) -#define FSUBR2(a, b) CHOICE(fsubr ARG2(a,b), fsubr ARG2(a,b), fsubr ARG2(b,a)) -#define FSUBRP(a, b) CHOICE(fsubrp ARG2(a,b), fsubrp ARG2(a,b), fsubrp ARG2(b,a)) -#define FISUBR_L(a) CHOICE(fisubrl a, fisubrl a, fisubrl a) -#define FISUBR_W(a) CHOICE(fisubr a, fisubrs a, fisubrs a) -#define FTST CHOICE(ftst, ftst, ftst) -#define FUCOM(a) CHOICE(fucom a, fucom a, fucom a) -#define FUCOMP(a) CHOICE(fucomp a, fucomp a, fucomp a) -#define FUCOMPP CHOICE(fucompp, fucompp, fucompp) -#define FWAIT CHOICE(wait, wait, wait) -#define FXAM CHOICE(fxam, fxam, fxam) -#define FXCH(a) CHOICE(fxch a, fxch a, fxch a) -#define FXTRACT CHOICE(fxtract, fxtract, fxtract) -#define FYL2X CHOICE(fyl2x, fyl2x, fyl2x) -#define FYL2XP1 CHOICE(fyl2xp1, fyl2xp1, fyl2xp1) - -#endif /* __ASSYNTAX_H__ */ diff --git a/hw/xfree86/os-support/bsd/Makefile.am b/hw/xfree86/os-support/bsd/Makefile.am index fa233242c..60a18d36f 100644 --- a/hw/xfree86/os-support/bsd/Makefile.am +++ b/hw/xfree86/os-support/bsd/Makefile.am @@ -72,7 +72,6 @@ libbsd_la_SOURCES = \ EXTRA_DIST = \ bsd_apm.c \ bsd_kqueue_apm.c \ - bsdResource.c \ memrange.h \ libusb/data.c \ libusb/descr.c \ diff --git a/hw/xfree86/os-support/bsd/bsdResource.c b/hw/xfree86/os-support/bsd/bsdResource.c deleted file mode 100644 index fe166c845..000000000 --- a/hw/xfree86/os-support/bsd/bsdResource.c +++ /dev/null @@ -1,92 +0,0 @@ - -/* Resource information code */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <X11/X.h> -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Privstr.h" -#include "xf86Pci.h" -#include "xf86Resources.h" -#define NEED_OS_RAC_PROTOS -#include "xf86_OSlib.h" - -/* Avoid Imakefile changes */ -#include "bus/Pci.h" - -#ifdef INCLUDE_XF86_NO_DOMAIN - -#if defined(__alpha__) || defined(__sparc64__) || defined(__amd64__) - -resPtr -xf86AccResFromOS(resPtr ret) -{ - resRange range; - - /* - * Fallback is to claim the following areas: - * - * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS - */ - - RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - /* - * Fallback would be to claim well known ports in the 0x0 - 0x3ff range - * along with their sparse I/O aliases, but that's too imprecise. Instead - * claim a bare minimum here. - */ - RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */ - ret = xf86AddResToList(ret, &range, -1); - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ - RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); -/* RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); */ - RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - - /* XXX add others */ - return ret; -} - -#elif defined(__powerpc__) - -resPtr -xf86AccResFromOS(resPtr ret) -{ - resRange range; - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ - RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - - return ret; -} - -#else - -#error : Put your platform dependent code here!! - -#endif - -#endif /* INCLUDE_XF86_NO_DOMAIN */ diff --git a/hw/xfree86/os-support/bus/Makefile.am b/hw/xfree86/os-support/bus/Makefile.am index d48fcb67d..5199340fc 100644 --- a/hw/xfree86/os-support/bus/Makefile.am +++ b/hw/xfree86/os-support/bus/Makefile.am @@ -15,14 +15,6 @@ if XORG_BUS_IX86PCI PCI_SOURCES += ix86Pci.c endif -if XORG_BUS_PPCPCI -PCI_SOURCES += ppcPci.c -endif - -if XORG_BUS_SPARCPCI -PCI_SOURCES += sparcPci.c -endif - if XORG_BUS_SPARC PLATFORM_SOURCES = Sbus.c sdk_HEADERS += xf86Sbus.h diff --git a/hw/xfree86/os-support/bus/Pci.c b/hw/xfree86/os-support/bus/Pci.c index 064533c77..734e7090c 100644 --- a/hw/xfree86/os-support/bus/Pci.c +++ b/hw/xfree86/os-support/bus/Pci.c @@ -136,28 +136,18 @@ #include <pciaccess.h> -#define PCI_MFDEV_SUPPORT 1 /* Include PCI multifunction device support */ -#define PCI_BRIDGE_SUPPORT 1 /* Include support for PCI-to-PCI bridges */ - -/* - * Global data - */ - -pciBusInfo_t *pciBusInfo[MAX_PCI_BUSES] = { NULL, }; -_X_EXPORT int pciNumBuses = 0; /* Actual number of PCI buses */ -int pciMaxBusNum = MAX_PCI_BUSES; +/* Global data */ +pciBusInfo_t *pciBusInfo = NULL; +_X_EXPORT int pciNumBuses = 0; /* Actual number of PCI buses */ _X_EXPORT ADDRESS pciBusAddrToHostAddr(PCITAG tag, PciAddrType type, ADDRESS addr) { - int bus = PCI_BUS_FROM_TAG(tag); - - if ((bus >= 0) && (bus < pciNumBuses) && pciBusInfo[bus] && - pciBusInfo[bus]->funcs->pciAddrBusToHost) - return (*pciBusInfo[bus]->funcs->pciAddrBusToHost)(tag, type, addr); - else - return(addr); + if (pciBusInfo->funcs->pciAddrBusToHost) + return pciBusInfo->funcs->pciAddrBusToHost(tag, type, addr); + else + return addr; } _X_EXPORT PCITAG diff --git a/hw/xfree86/os-support/bus/Pci.h b/hw/xfree86/os-support/bus/Pci.h index a1390c073..31a7fbf46 100644 --- a/hw/xfree86/os-support/bus/Pci.h +++ b/hw/xfree86/os-support/bus/Pci.h @@ -115,16 +115,10 @@ /* * Global Definitions */ -#define MAX_PCI_DEVICES 128 /* Max number of devices accomodated */ - /* by xf86scanpci */ -#if defined(sun) && defined(SVR4) && defined(sparc) -# define MAX_PCI_BUSES 4096 /* Max number of PCI buses */ -#elif (defined(__alpha__) || defined(__ia64__)) && defined (linux) -# define MAX_PCI_DOMAINS 512 -# define PCI_DOM_MASK 0x01fful -# define MAX_PCI_BUSES (MAX_PCI_DOMAINS*256) /* 256 per domain */ +#if (defined(__alpha__) || defined(__ia64__)) && defined (linux) +#define PCI_DOM_MASK 0x01fful #else -# define MAX_PCI_BUSES 256 /* Max number of PCI buses */ +#define PCI_DOM_MASK 0x0ffu #endif #define DEVID(vendor, device) \ @@ -199,17 +193,10 @@ #if !defined(ARCH_PCI_INIT) -/* - * Select architecture specific PCI init function - */ +#warning You really need to port to libpciaccess. #if defined(__i386__) || defined(__i386) || defined(__amd64__) || defined(__amd64) -# define ARCH_PCI_INIT ix86PciInit -#elif defined(__powerpc__) || defined(__powerpc64__) -# define ARCH_PCI_INIT ppcPciInit -#elif defined(__sparc__) || defined(sparc) -# define ARCH_PCI_INIT sparcPciInit -# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge -#endif +#define ARCH_PCI_INIT ix86PciInit +#endif /* i386/amd64 */ #endif /* !defined(ARCH_PCI_INIT) */ #ifndef ARCH_PCI_INIT @@ -218,14 +205,6 @@ extern void ARCH_PCI_INIT(void); -#if defined(XF86SCANPCI_WRAPPER) -typedef enum { - SCANPCI_INIT, - SCANPCI_TERM -} scanpciWrapperOpt; -extern void XF86SCANPCI_WRAPPER(scanpciWrapperOpt flags); -#endif - /* * Table of functions used to access a specific PCI bus domain * (e.g. a primary PCI bus and all of its secondaries) @@ -262,8 +241,6 @@ void pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask, CARD32 val); ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS); -extern int pciMaxBusNum; - -extern pciBusInfo_t *pciBusInfo[]; +extern pciBusInfo_t *pciBusInfo; #endif /* _PCI_H */ diff --git a/hw/xfree86/os-support/bus/bsd_pci.c b/hw/xfree86/os-support/bus/bsd_pci.c index 57ad09b6a..3bd9d1565 100644 --- a/hw/xfree86/os-support/bus/bsd_pci.c +++ b/hw/xfree86/os-support/bus/bsd_pci.c @@ -80,7 +80,7 @@ void bsdPciInit(void) { pciNumBuses = 1; - pciBusInfo[0] = &bsd_pci; + pciBusInfo = &bsd_pci; xf86InitVidMem(); } diff --git a/hw/xfree86/os-support/bus/ix86Pci.c b/hw/xfree86/os-support/bus/ix86Pci.c index e54246355..80bac32bc 100644 --- a/hw/xfree86/os-support/bus/ix86Pci.c +++ b/hw/xfree86/os-support/bus/ix86Pci.c @@ -277,8 +277,8 @@ ix86PciBusCheck(void) return FALSE; } -static -void ix86PciSelectCfgmech(void) +static void +ix86PciSelectCfgmech(void) { static Bool beenhere = FALSE; CARD32 mode1Res1 = 0, mode1Res2 = 0, oldVal1 = 0; @@ -290,429 +290,197 @@ void ix86PciSelectCfgmech(void) beenhere = TRUE; - /* - * Determine if motherboard chipset supports PCI Config Mech 1 or 2 - * We rely on xf86Info.pciFlags to tell which mechanisms to try.... - */ - switch (xf86Info.pciFlags) { - case PCIOsConfig: - case PCIProbe1: - if (!xf86EnableIO()) - return; + /* Determine if motherboard chipset supports PCI Config Mech 1 or 2 */ + do { + if (!xf86EnableIO()) + return; - xf86MsgVerb(X_INFO, 2, - "PCI: Probing config type using method 1\n"); - oldVal1 = inl(PCI_CFGMECH1_ADDRESS_REG); + xf86MsgVerb(X_INFO, 2, + "PCI: Probing config type using method 1\n"); + oldVal1 = inl(PCI_CFGMECH1_ADDRESS_REG); #ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("Checking config type 1:\n" - "\tinitial value of MODE1_ADDR_REG is 0x%08x\n", oldVal1); - ErrorF("\tChecking that all bits in mask 0x7f000000 are clear\n"); - } + if (xf86Verbose > 2) { + ErrorF("Checking config type 1:\n" + "\tinitial value of MODE1_ADDR_REG is 0x%08x\n", oldVal1); + ErrorF("\tChecking that all bits in mask 0x7f000000 are clear\n"); + } #endif - /* Assuming config type 1 to start with */ - if ((oldVal1 & 0x7f000000) == 0) { + /* Assuming config type 1 to start with */ + if ((oldVal1 & 0x7f000000) == 0) { - stages |= 0x01; + stages |= 0x01; #ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue indicates possibly config type 1\n"); - ErrorF("\tWriting 32-bit value 0x%08x to MODE1_ADDR_REG\n", PCI_EN); + if (xf86Verbose > 2) { + ErrorF("\tValue indicates possibly config type 1\n"); + ErrorF("\tWriting 32-bit value 0x%08x to MODE1_ADDR_REG\n", PCI_EN); #if 0 - ErrorF("\tWriting 8-bit value 0x00 to MODE1_ADDR_REG + 3\n"); + ErrorF("\tWriting 8-bit value 0x00 to MODE1_ADDR_REG + 3\n"); #endif - } + } #endif - ix86Pci0.configMech = PCI_CFG_MECH_1; - ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV; - ix86Pci0.funcs = &ix86Funcs1; + ix86Pci0.configMech = PCI_CFG_MECH_1; + ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV; + ix86Pci0.funcs = &ix86Funcs1; - outl(PCI_CFGMECH1_ADDRESS_REG, PCI_EN); + outl(PCI_CFGMECH1_ADDRESS_REG, PCI_EN); #if 0 - /* - * This seems to cause some Neptune-based PCI machines to switch - * from config type 1 to config type 2 - */ - outb(PCI_CFGMECH1_ADDRESS_REG + 3, 0); + /* + * This seems to cause some Neptune-based PCI machines to switch + * from config type 1 to config type 2 + */ + outb(PCI_CFGMECH1_ADDRESS_REG + 3, 0); #endif - mode1Res1 = inl(PCI_CFGMECH1_ADDRESS_REG); + mode1Res1 = inl(PCI_CFGMECH1_ADDRESS_REG); #ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n", + if (xf86Verbose > 2) { + ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n", mode1Res1); - ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n"); - } + ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n"); + } #endif - outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1); + outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1); - if (mode1Res1) { + if (mode1Res1) { - stages |= 0x02; + stages |= 0x02; #ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back is non-zero, and indicates possible" - " config type 1\n"); - } + if (xf86Verbose > 2) { + ErrorF("\tValue read back is non-zero, and indicates possible" + " config type 1\n"); + } #endif - if (ix86PciBusCheck()) { + if (ix86PciBusCheck()) { #ifdef DEBUGPCI - if (xf86Verbose > 2) - ErrorF("\tBus check Confirms this: "); + if (xf86Verbose > 2) + ErrorF("\tBus check Confirms this: "); #endif - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); - xf86MsgVerb(X_INFO, 3, - "PCI: stages = 0x%02x, oldVal1 = 0x%08lx, mode1Res1" - " = 0x%08lx\n", stages, (unsigned long)oldVal1, - (unsigned long)mode1Res1); - return; - } + xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); + xf86MsgVerb(X_INFO, 3, + "PCI: stages = 0x%02x, oldVal1 = 0x%08lx, mode1Res1" + " = 0x%08lx\n", stages, (unsigned long)oldVal1, + (unsigned long)mode1Res1); + return; + } #ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tBus check fails to confirm this, continuing type 1" - " check ...\n"); - } + if (xf86Verbose > 2) { + ErrorF("\tBus check fails to confirm this, continuing type 1" + " check ...\n"); + } #endif - } + } - stages |= 0x04; + stages |= 0x04; #ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tWriting 0xff000001 to MODE1_ADDR_REG\n"); - } + if (xf86Verbose > 2) { + ErrorF("\tWriting 0xff000001 to MODE1_ADDR_REG\n"); + } #endif - outl(PCI_CFGMECH1_ADDRESS_REG, 0xff000001); - mode1Res2 = inl(PCI_CFGMECH1_ADDRESS_REG); + outl(PCI_CFGMECH1_ADDRESS_REG, 0xff000001); + mode1Res2 = inl(PCI_CFGMECH1_ADDRESS_REG); #ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n", + if (xf86Verbose > 2) { + ErrorF("\tValue read back from MODE1_ADDR_REG is 0x%08x\n", mode1Res2); - ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n"); - } + ErrorF("\tRestoring original contents of MODE1_ADDR_REG\n"); + } #endif - outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1); + outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1); - if ((mode1Res2 & 0x80000001) == 0x80000000) { + if ((mode1Res2 & 0x80000001) == 0x80000000) { - stages |= 0x08; + stages |= 0x08; #ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tValue read back has only the msb set\n" - "\tThis indicates possible config type 1\n"); - } + if (xf86Verbose > 2) { + ErrorF("\tValue read back has only the msb set\n" + "\tThis indicates possible config type 1\n"); + } #endif - if (ix86PciBusCheck()) { + if (ix86PciBusCheck()) { #ifdef DEBUGPCI - if (xf86Verbose > 2) - ErrorF("\tBus check Confirms this: "); + if (xf86Verbose > 2) + ErrorF("\tBus check Confirms this: "); #endif - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); - xf86MsgVerb(X_INFO, 3, - "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n" - "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n", - stages, (unsigned long)oldVal1, - (unsigned long)mode1Res1, (unsigned long)mode1Res2); - return; - } + xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); + xf86MsgVerb(X_INFO, 3, + "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n" + "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n", + stages, (unsigned long)oldVal1, + (unsigned long)mode1Res1, (unsigned long)mode1Res2); + return; + } #ifdef DEBUGPCI - if (xf86Verbose > 2) { - ErrorF("\tBus check fails to confirm this.\n"); - } + if (xf86Verbose > 2) { + ErrorF("\tBus check fails to confirm this.\n"); + } #endif - } - } - - xf86MsgVerb(X_INFO, 3, "PCI: Standard check for type 1 failed.\n"); - xf86MsgVerb(X_INFO, 3, "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n" - "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n", - stages, (unsigned long)oldVal1, (unsigned long)mode1Res1, - (unsigned long)mode1Res2); - - /* Try config type 2 */ - oldVal2 = inb(PCI_CFGMECH2_ENABLE_REG); - if ((oldVal2 & 0xf0) == 0) { - ix86Pci0.configMech = PCI_CFG_MECH_2; - ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV; - ix86Pci0.funcs = &ix86Funcs2; - - outb(PCI_CFGMECH2_ENABLE_REG, 0x0e); - mode2Res1 = inb(PCI_CFGMECH2_ENABLE_REG); - outb(PCI_CFGMECH2_ENABLE_REG, oldVal2); - - if (mode2Res1 == 0x0e) { - if (ix86PciBusCheck()) { - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 2\n"); - return; } } - } - break; /* } */ - - case PCIProbe2: /* { */ - if (!xf86EnableIO()) - return; - - /* The scanpci-style detection method */ - - xf86MsgVerb(X_INFO, 2, "PCI: Probing config type using method 2\n"); - - outb(PCI_CFGMECH2_ENABLE_REG, 0x00); - outb(PCI_CFGMECH2_FORWARD_REG, 0x00); - mode2Res1 = inb(PCI_CFGMECH2_ENABLE_REG); - mode2Res2 = inb(PCI_CFGMECH2_FORWARD_REG); - - if (mode2Res1 == 0 && mode2Res2 == 0) { - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 2\n"); - ix86Pci0.configMech = PCI_CFG_MECH_2; - ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV; - ix86Pci0.funcs = &ix86Funcs2; - return; - } - - oldVal1 = inl(PCI_CFGMECH1_ADDRESS_REG); - outl(PCI_CFGMECH1_ADDRESS_REG, PCI_EN); - mode1Res1 = inl(PCI_CFGMECH1_ADDRESS_REG); - outl(PCI_CFGMECH1_ADDRESS_REG, oldVal1); - if (mode1Res1 == PCI_EN) { - xf86MsgVerb(X_INFO, 2, "PCI: Config type is 1\n"); - ix86Pci0.configMech = PCI_CFG_MECH_1; - ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV; - ix86Pci0.funcs = &ix86Funcs1; - return; - } - break; /* } */ - - case PCIForceConfig1: - if (!xf86EnableIO()) - return; - xf86MsgVerb(X_INFO, 2, "PCI: Forcing config type 1\n"); - - ix86Pci0.configMech = PCI_CFG_MECH_1; - ix86Pci0.numDevices = PCI_CFGMECH1_MAXDEV; - ix86Pci0.funcs = &ix86Funcs1; - return; - - case PCIForceConfig2: - if (!xf86EnableIO()) - return; - - xf86MsgVerb(X_INFO, 2, "PCI: Forcing config type 2\n"); - - ix86Pci0.configMech = PCI_CFG_MECH_2; - ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV; - ix86Pci0.funcs = &ix86Funcs2; - return; - - case PCIForceNone: + xf86MsgVerb(X_INFO, 3, "PCI: Standard check for type 1 failed.\n"); + xf86MsgVerb(X_INFO, 3, "PCI: stages = 0x%02x, oldVal1 = 0x%08lx,\n" + "\tmode1Res1 = 0x%08lx, mode1Res2 = 0x%08lx\n", + stages, (unsigned long)oldVal1, (unsigned long)mode1Res1, + (unsigned long)mode1Res2); + + /* Try config type 2 */ + oldVal2 = inb(PCI_CFGMECH2_ENABLE_REG); + if ((oldVal2 & 0xf0) == 0) { + ix86Pci0.configMech = PCI_CFG_MECH_2; + ix86Pci0.numDevices = PCI_CFGMECH2_MAXDEV; + ix86Pci0.funcs = &ix86Funcs2; + + outb(PCI_CFGMECH2_ENABLE_REG, 0x0e); + mode2Res1 = inb(PCI_CFGMECH2_ENABLE_REG); + outb(PCI_CFGMECH2_ENABLE_REG, oldVal2); + + if (mode2Res1 == 0x0e) { + if (ix86PciBusCheck()) { + xf86MsgVerb(X_INFO, 2, "PCI: Config type is 2\n"); + return; + } + } + } break; - } + } while (0); /* No PCI found */ ix86Pci0.configMech = PCI_CFG_MECH_UNKNOWN; - xf86MsgVerb(X_INFO, 2, "PCI: No PCI bus found or probed for\n"); -} - -#if 0 -static pciTagRec -ix86PcibusTag(CARD8 bus, CARD8 cardnum, CARD8 func) -{ - pciTagRec tag; - - tag.cfg1 = 0; - - if (func > 7 || cardnum >= pciBusInfo[bus]->numDevices) - return tag; - - switch (ix86Pci0.configMech) { - case PCI_CFG_MECH_1: - tag.cfg1 = PCI_EN | ((CARD32)bus << 16) | - ((CARD32)cardnum << 11) | - ((CARD32)func << 8); - break; - - case PCI_CFG_MECH_2: - tag.cfg2.port = 0xc000 | ((CARD16)cardnum << 8); - tag.cfg2.enable = 0xf0 | (func << 1); - tag.cfg2.forward = bus; - break; - } - - return tag; + xf86MsgVerb(X_INFO, 2, "PCI: No PCI bus found\n"); } -#endif - -#if 0 -static CARD32 -ix86PciReadLongSetup(PCITAG Tag, int reg) -{ - ix86PciSelectCfgmech(); - return (*ix86Pci0.funcs->pciReadLong)(Tag,reg); -} - -static CARD32 -ix86PciReadLongCFG1(PCITAG Tag, int reg) -{ - CARD32 addr, data = 0; - -#ifdef DEBUGPCI - ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg); -#endif - - addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); - outl(PCI_CFGMECH1_ADDRESS_REG, addr); - data = inl(PCI_CFGMECH1_DATA_REG); - outl(PCI_CFGMECH1_ADDRESS_REG, 0); - -#ifdef DEBUGPCI - ErrorF("ix86PciReadLong 0x%lx\n", data); -#endif - - return data; -} - -static CARD32 -ix86PciReadLongCFG2(PCITAG Tag, int reg) -{ - CARD32 addr, data = 0; - CARD8 forward, enable; - -#ifdef DEBUGPCI - ErrorF("ix86PciReadLong 0x%lx, %d\n", Tag, reg); -#endif - - forward = PCI_FORWARD_FROM_TAG(Tag); - enable = PCI_ENABLE_FROM_TAG(Tag); - addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg); - - outb(PCI_CFGMECH2_ENABLE_REG, enable); - outb(PCI_CFGMECH2_FORWARD_REG, forward); - data = inl((CARD16)addr); - outb(PCI_CFGMECH2_ENABLE_REG, 0); - outb(PCI_CFGMECH2_FORWARD_REG, 0); - -#ifdef DEBUGPCI - ErrorF("ix86PciReadLong 0x%lx\n", data); -#endif - - return data; -} - -static void -ix86PciWriteLongSetup(PCITAG Tag, int reg, CARD32 data) -{ - ix86PciSelectCfgmech(); - (*ix86Pci0.funcs->pciWriteLong)(Tag,reg,data); -} - -static void -ix86PciWriteLongCFG1(PCITAG Tag, int reg, CARD32 data) -{ - CARD32 addr; - - addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); - outl(PCI_CFGMECH1_ADDRESS_REG, addr); - outl(PCI_CFGMECH1_DATA_REG, data); - outl(PCI_CFGMECH1_ADDRESS_REG, 0); -} - -static void -ix86PciWriteLongCFG2(PCITAG Tag, int reg, CARD32 data) -{ - CARD32 addr; - CARD8 forward, enable; - - forward = PCI_FORWARD_FROM_TAG(Tag); - enable = PCI_ENABLE_FROM_TAG(Tag); - addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg); - - outb(PCI_CFGMECH2_ENABLE_REG, enable); - outb(PCI_CFGMECH2_FORWARD_REG, forward); - outl((CARD16)addr, data); - outb(PCI_CFGMECH2_ENABLE_REG, 0); - outb(PCI_CFGMECH2_FORWARD_REG, 0); -} - -static void -ix86PciSetBitsLongSetup(PCITAG Tag, int reg, CARD32 mask, CARD32 val) -{ - ix86PciSelectCfgmech(); - (*ix86Pci0.funcs->pciSetBitsLong)(Tag,reg,mask,val); -} - -static void -ix86PciSetBitsLongCFG1(PCITAG Tag, int reg, CARD32 mask, CARD32 val) -{ - CARD32 addr, data = 0; - -#ifdef DEBUGPCI - ErrorF("ix86PciSetBitsLong 0x%lx, %d\n", Tag, reg); -#endif - - addr = PCI_ADDR_FROM_TAG_CFG1(Tag,reg); - outl(PCI_CFGMECH1_ADDRESS_REG, addr); - data = inl(PCI_CFGMECH1_DATA_REG); - data = (data & ~mask) | (val & mask); - outl(PCI_CFGMECH1_DATA_REG, data); - outl(PCI_CFGMECH1_ADDRESS_REG, 0); -} - -static void -ix86PciSetBitsLongCFG2(PCITAG Tag, int reg, CARD32 mask, CARD32 val) -{ - CARD32 addr, data = 0; - CARD8 enable, forward; - -#ifdef DEBUGPCI - ErrorF("ix86PciSetBitsLong 0x%lx, %d\n", Tag, reg); -#endif - - forward = PCI_FORWARD_FROM_TAG(Tag); - enable = PCI_ENABLE_FROM_TAG(Tag); - addr = PCI_ADDR_FROM_TAG_CFG2(Tag,reg); - - outb(PCI_CFGMECH2_ENABLE_REG, enable); - outb(PCI_CFGMECH2_FORWARD_REG, forward); - data = inl((CARD16)addr); - data = (data & ~mask) | (val & mask); - outl((CARD16)addr, data); - outb(PCI_CFGMECH2_ENABLE_REG, 0); - outb(PCI_CFGMECH2_FORWARD_REG, 0); -} -#endif void ix86PciInit() { - /* Initialize pciBusInfo[] array and function pointers */ + /* Initialize pciBusInfo */ pciNumBuses = 1; - pciBusInfo[0] = &ix86Pci0; + pciBusInfo = &ix86Pci0; /* Make sure that there is a PCI bus present. */ ix86PciSelectCfgmech(); if (ix86Pci0.configMech == PCI_CFG_MECH_UNKNOWN) { pciNumBuses = 0; - pciBusInfo[0] = NULL; + pciBusInfo = NULL; } } diff --git a/hw/xfree86/os-support/bus/linuxPci.c b/hw/xfree86/os-support/bus/linuxPci.c index 11eb4f9e8..bbc591798 100644 --- a/hw/xfree86/os-support/bus/linuxPci.c +++ b/hw/xfree86/os-support/bus/linuxPci.c @@ -103,20 +103,19 @@ static pointer DomainMmappedIO[MAX_DOMAINS]; void linuxPciInit(void) { - struct stat st; + struct stat st; #ifndef INCLUDE_XF86_NO_DOMAIN (void) memset(DomainMmappedIO, 0, sizeof(DomainMmappedIO)); #endif - if ((xf86Info.pciFlags == PCIForceNone) || - (-1 == stat("/proc/bus/pci", &st))) { - /* when using this as default for all linux architectures, - we'll need a fallback for 2.0 kernels here */ - return; - } - pciNumBuses = 1; - pciBusInfo[0] = &linuxPci0; + if (-1 == stat("/proc/bus/pci", &st)) { + /* when using this as default for all linux architectures, + we'll need a fallback for 2.0 kernels here */ + return; + } + pciNumBuses = 1; + pciBusInfo = &linuxPci0; } /** diff --git a/hw/xfree86/os-support/bus/ppcPci.c b/hw/xfree86/os-support/bus/ppcPci.c deleted file mode 100644 index 49c1a2a39..000000000 --- a/hw/xfree86/os-support/bus/ppcPci.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * ppcPci.c - PowerPC PCI access functions - * - * PCI driver functions supporting Motorola PowerPC platforms - * including Powerstack(RiscPC/RiscPC+), PowerStackII, MTX, and - * MVME 160x/260x/360x/460x VME boards - * - * Gary Barton - * Concurrent Computer Corporation - * garyb@gate.net - * - */ - -/* - * Copyright 1998 by Concurrent Computer Corporation - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Concurrent Computer - * Corporation not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Concurrent Computer Corporation makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - * - * Copyright 1998 by Metro Link Incorporated - * - * Permission to use, copy, modify, distribute, and sell this software - * and its documentation for any purpose is hereby granted without fee, - * provided that the above copyright notice appear in all copies and that - * both that copyright notice and this permission notice appear in - * supporting documentation, and that the name of Metro Link - * Incorporated not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. Metro Link Incorporated makes no representations - * about the suitability of this software for any purpose. It is - * provided "as is" without express or implied warranty. - * - * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, - * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, - * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <stdio.h> -#include "compiler.h" -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "Pci.h" - -#ifndef MAP_FAILED -#define MAP_FAILED (pointer)(-1) -#endif - -void -ppcPciInit() -{ - - static void motoppcPciInit(void); - motoppcPciInit(); - -} diff --git a/hw/xfree86/os-support/bus/sparcPci.c b/hw/xfree86/os-support/bus/sparcPci.c deleted file mode 100644 index 2d8039c29..000000000 --- a/hw/xfree86/os-support/bus/sparcPci.c +++ /dev/null @@ -1,979 +0,0 @@ -/* - * Copyright (C) 2001-2003 The XFree86 Project, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the XFree86 Project shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from the - * XFree86 Project. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "Pci.h" -#include "xf86sbusBus.h" - -#if defined(sun) - -extern char *apertureDevName; -static int apertureFd = -1; - -/* - * A version of xf86MapVidMem() that allows for 64-bit displacements (but not - * sizes). Areas thus mapped can be unmapped by xf86UnMapVidMem(). - */ -static pointer -sparcMapAperture(int iScreen, int Flags, - unsigned long long Base, unsigned long Size) -{ - pointer result; - static int lastFlags = 0; - - /* Assume both Base & Size are multiples of the page size */ - - if ((apertureFd < 0) || (Flags != lastFlags)) { - if (apertureFd >= 0) - close(apertureFd); - lastFlags = Flags; - apertureFd = open(apertureDevName, - (Flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR); - if (apertureFd < 0) - FatalError("sparcMapAperture: open failure: %s\n", - strerror(errno)); - } - - result = mmap(NULL, Size, - (Flags & VIDMEM_READONLY) ? - PROT_READ : (PROT_READ | PROT_WRITE), - MAP_SHARED, apertureFd, (off_t)Base); - - if (result == MAP_FAILED) - FatalError("sparcMapAperture: mmap failure: %s\n", strerror(errno)); - - return result; -} - -/* - * Platform-specific bus privates. - */ -typedef struct _sparcDomainRec { - unsigned long long io_addr, io_size; - unsigned long long mem_addr, mem_size; - pointer pci, io; - int bus_min, bus_max; - unsigned char dfn_mask[256 / 8]; -} sparcDomainRec, *sparcDomainPtr; - -#define SetBitInMap(bit, map) \ - do { \ - int _bit = (bit); \ - (map)[_bit >> 3] |= 1 << (_bit & 7); \ - } while (0) - -#define IsBitSetInMap(bit, map) \ - ((map)[(bit) >> 3] & (1 << ((bit) & 7))) - -/* - * Domain 0 is reserved for the one that represents the system as a whole, i.e. - * the one without any resource relocations. - */ -#define MAX_DOMAINS (MAX_PCI_BUSES / 256) -static sparcDomainPtr xf86DomainInfo[MAX_DOMAINS]; -static int pciNumDomains = 1; - -/* Variables that are assigned this must be declared volatile */ -#define PciReg(base, tag, off, type) \ - *(volatile type *)(pointer)((char *)(base) + \ - (PCI_TAG_NO_DOMAIN(tag) | (off))) - -/* Generic SPARC PCI access functions */ -static CARD32 -sparcPciCfgRead32(PCITAG tag, int off) -{ - pciBusInfo_t *pBusInfo; - sparcDomainPtr pDomain; - volatile CARD32 result = (CARD32)(-1); /* Must be volatile */ - int bus; - - if ((off >= 0) && (off <= 252) && !(off & 3) && - ((bus = PCI_BUS_FROM_TAG(tag)) < pciNumBuses) && - (pBusInfo = pciBusInfo[bus]) && (pDomain = pBusInfo->pciBusPriv) && - (bus >= pDomain->bus_min) && (bus < pDomain->bus_max) && - ((bus > pDomain->bus_min) || - IsBitSetInMap(PCI_DFN_FROM_TAG(tag), pDomain->dfn_mask))) { - result = PciReg(pDomain->pci, tag, off, CARD32); - - result = PCI_CPU(result); - } - - return result; -} - -static void -sparcPciCfgWrite32(PCITAG tag, int off, CARD32 val) -{ - pciBusInfo_t *pBusInfo; - sparcDomainPtr pDomain; - int bus; - - if ((off < 0) || (off > 252) || (off & 3) || - ((bus = PCI_BUS_FROM_TAG(tag)) >= pciNumBuses) || - !(pBusInfo = pciBusInfo[bus]) || !(pDomain = pBusInfo->pciBusPriv) || - (bus < pDomain->bus_min) || (bus >= pDomain->bus_max) || - ((bus == pDomain->bus_min) && - !IsBitSetInMap(PCI_DFN_FROM_TAG(tag), pDomain->dfn_mask))) - return; - - val = PCI_CPU(val); - PciReg(pDomain->pci, tag, off, CARD32) = val; -} - -static void -sparcPciCfgSetBits32(PCITAG tag, int off, CARD32 mask, CARD32 bits) -{ - CARD32 PciVal; - - PciVal = sparcPciCfgRead32(tag, off); - PciVal &= ~mask; - PciVal |= bits; - sparcPciCfgWrite32(tag, off, PciVal); -} - -static pciBusFuncs_t sparcPCIFunctions = -{ - sparcPciCfgRead32, - sparcPciCfgWrite32, - sparcPciCfgSetBits32, - pciAddrNOOP, - pciAddrNOOP -}; - -/* - * Sabre-specific versions of the above because of its peculiar access size - * requirements. - */ -static CARD32 -sabrePciCfgRead32(PCITAG tag, int off) -{ - pciBusInfo_t *pBusInfo; - sparcDomainPtr pDomain; - volatile CARD32 result; /* Must be volatile */ - int bus; - - if (PCI_BDEV_FROM_TAG(tag)) - return sparcPciCfgRead32(tag, off); - - if (PCI_FUNC_FROM_TAG(tag) || (off < 0) || (off > 252) || (off & 3) || - ((bus = PCI_BUS_FROM_TAG(tag)) >= pciNumBuses) || - !(pBusInfo = pciBusInfo[bus]) || !(pDomain = pBusInfo->pciBusPriv) || - (bus != pDomain->bus_min)) - return (CARD32)(-1); - - if (off < 8) { - result = (PciReg(pDomain->pci, tag, off, CARD16) << 16) | - PciReg(pDomain->pci, tag, off + 2, CARD16); - return PCI_CPU(result); - } - - result = (PciReg(pDomain->pci, tag, off + 3, CARD8) << 24) | - (PciReg(pDomain->pci, tag, off + 2, CARD8) << 16) | - (PciReg(pDomain->pci, tag, off + 1, CARD8) << 8) | - (PciReg(pDomain->pci, tag, off , CARD8) ); - return result; -} - -static void -sabrePciCfgWrite32(PCITAG tag, int off, CARD32 val) -{ - pciBusInfo_t *pBusInfo; - sparcDomainPtr pDomain; - int bus; - - if (PCI_BDEV_FROM_TAG(tag)) - sparcPciCfgWrite32(tag, off, val); - else if (!PCI_FUNC_FROM_TAG(tag) && - (off >= 0) && (off <= 252) && !(off & 3) && - ((bus = PCI_BUS_FROM_TAG(tag)) < pciNumBuses) && - (pBusInfo = pciBusInfo[bus]) && - (pDomain = pBusInfo->pciBusPriv) && - (bus == pDomain->bus_min)) { - if (off < 8) { - val = PCI_CPU(val); - PciReg(pDomain->pci, tag, off , CARD16) = val >> 16; - PciReg(pDomain->pci, tag, off + 2, CARD16) = val; - } else { - PciReg(pDomain->pci, tag, off , CARD8) = val; - PciReg(pDomain->pci, tag, off + 1, CARD8) = val >> 8; - PciReg(pDomain->pci, tag, off + 2, CARD8) = val >> 16; - PciReg(pDomain->pci, tag, off + 3, CARD8) = val >> 24; - } - } -} - -static void -sabrePciCfgSetBits32(PCITAG tag, int off, CARD32 mask, CARD32 bits) -{ - CARD32 PciVal; - - PciVal = sabrePciCfgRead32(tag, off); - PciVal &= ~mask; - PciVal |= bits; - sabrePciCfgWrite32(tag, off, PciVal); -} - -static pciBusFuncs_t sabrePCIFunctions = -{ - sabrePciCfgRead32, - sabrePciCfgWrite32, - sabrePciCfgSetBits32, - pciAddrNOOP, - pciAddrNOOP -}; - -static int pagemask; - -/* Scan PROM for all PCI host bridges in the system */ -void -sparcPciInit(void) -{ - int node, node2; - - if (!xf86LinearVidMem()) - return; - - apertureFd = open(apertureDevName, O_RDWR); - if (apertureFd < 0) { - xf86Msg(X_ERROR, - "sparcPciInit: open failure: %s\n", strerror(errno)); - return; - } - - sparcPromInit(); - pagemask = getpagesize() - 1; - - for (node = promGetChild(promRootNode); - node; - node = promGetSibling(node)) { - unsigned long long pci_addr; - sparcDomainRec domain; - sparcDomainPtr pDomain; - pciBusFuncs_p pFunctions; - char *prop_val; - int prop_len, bus; - - prop_val = promGetProperty("name", &prop_len); - /* Some PROMs include the trailing null; some don't */ - if (!prop_val || (prop_len < 3) || (prop_len > 4) || - strcmp(prop_val, "pci")) - continue; - - prop_val = promGetProperty("model", &prop_len); - if (!prop_val || (prop_len <= 0)) { - prop_val = promGetProperty("compatible", &prop_len); - if (!prop_val || (prop_len <= 0)) - continue; - } - - pFunctions = &sparcPCIFunctions; - (void)memset(&domain, 0, sizeof(domain)); - - if (!strncmp("SUNW,sabre", prop_val, prop_len) || - !strncmp("pci108e,a000", prop_val, prop_len) || - !strncmp("pci108e,a001", prop_val, prop_len)) { - /* - * There can only be one "Sabre" bridge in a system. It provides - * PCI configuration space, a 24-bit I/O space and a 32-bit memory - * space, all three of which are at fixed physical CPU addresses. - */ - static Bool sabre_seen = FALSE; - - xf86Msg(X_INFO, - "Sabre or Hummingbird PCI host bridge found (\"%s\")\n", - prop_val); - - /* There can only be one Sabre */ - if (sabre_seen) - continue; - sabre_seen = TRUE; - - /* Get "bus-range" property */ - prop_val = promGetProperty("bus-range", &prop_len); - if (!prop_val || (prop_len != 8) || - (((unsigned int *)prop_val)[0]) || - (((unsigned int *)prop_val)[1] >= 256)) - continue; - - pci_addr = 0x01fe01000000ull; - domain.io_addr = 0x01fe02000000ull; - domain.io_size = 0x000001000000ull; - domain.mem_addr = 0x01ff00000000ull; - domain.mem_size = 0x000100000000ull; - domain.bus_min = 0; /* Always */ - domain.bus_max = ((int *)prop_val)[1]; - - pFunctions = &sabrePCIFunctions; - } else - if (!strncmp("SUNW,psycho", prop_val, prop_len) || - !strncmp("pci108e,8000", prop_val, prop_len)) { - /* - * A "Psycho" host bridge provides two PCI interfaces, each with - * its own 16-bit I/O and 31-bit memory spaces. Both share the - * same PCI configuration space. Here, they are assigned separate - * domain numbers to prevent unintentional I/O and/or memory - * resource conflicts. - */ - xf86Msg(X_INFO, - "Psycho PCI host bridge found (\"%s\")\n", prop_val); - - /* Get "bus-range" property */ - prop_val = promGetProperty("bus-range", &prop_len); - if (!prop_val || (prop_len != 8) || - (((unsigned int *)prop_val)[1] >= 256) || - (((unsigned int *)prop_val)[0] > ((unsigned int *)prop_val)[1])) - continue; - - domain.bus_min = ((int *)prop_val)[0]; - domain.bus_max = ((int *)prop_val)[1]; - - /* Get "ranges" property */ - prop_val = promGetProperty("ranges", &prop_len); - if (!prop_val || (prop_len != 112) || - prop_val[0] || (prop_val[28] != 0x01u) || - (prop_val[56] != 0x02u) || (prop_val[84] != 0x03u) || - (((unsigned int *)prop_val)[4] != 0x01000000u) || - ((unsigned int *)prop_val)[5] || - ((unsigned int *)prop_val)[12] || - (((unsigned int *)prop_val)[13] != 0x00010000u) || - ((unsigned int *)prop_val)[19] || - (((unsigned int *)prop_val)[20] != 0x80000000u) || - ((((unsigned int *)prop_val)[11] & ~0x00010000u) != - 0x02000000u) || - (((unsigned int *)prop_val)[18] & ~0x80000000u) || - (((unsigned int *)prop_val)[3] != - ((unsigned int *)prop_val)[10]) || - (((unsigned int *)prop_val)[17] != - ((unsigned int *)prop_val)[24]) || - (((unsigned int *)prop_val)[18] != - ((unsigned int *)prop_val)[25]) || - (((unsigned int *)prop_val)[19] != - ((unsigned int *)prop_val)[26]) || - (((unsigned int *)prop_val)[20] != - ((unsigned int *)prop_val)[27])) - continue; - - /* Use memcpy() to avoid alignment issues */ - (void)memcpy(&pci_addr, prop_val + 12, - sizeof(pci_addr)); - (void)memcpy(&domain.io_addr, prop_val + 40, - sizeof(domain.io_addr)); - (void)memcpy(&domain.mem_addr, prop_val + 68, - sizeof(domain.mem_addr)); - - domain.io_size = 0x000000010000ull; - domain.mem_size = 0x000080000000ull; - } else - if (!strncmp("SUNW,schizo", prop_val, prop_len) || - !strncmp("pci108e,8001", prop_val, prop_len)) { - /* - * I have no docs on the "Schizo", but judging from the Linux - * kernel, it also provides two PCI domains. Each PCI - * configuration space is the usual 16M in size, followed by a - * variable-length I/O space. Each domain also provides a - * variable-length memory space. The kernel seems to think the I/O - * spaces are 16M long, and the memory spaces, 2G, but these - * assumptions are actually only present in source code comments. - * Sun has, however, confirmed to me the validity of these - * assumptions. - */ - volatile unsigned long long mem_match, mem_mask, io_match, io_mask; - unsigned long Offset; - pointer pSchizo; - - xf86Msg(X_INFO, - "Schizo PCI host bridge found (\"%s\")\n", prop_val); - - /* Get "bus-range" property */ - prop_val = promGetProperty("bus-range", &prop_len); - if (!prop_val || (prop_len != 8) || - (((unsigned int *)prop_val)[1] >= 256) || - (((unsigned int *)prop_val)[0] > ((unsigned int *)prop_val)[1])) - continue; - - domain.bus_min = ((int *)prop_val)[0]; - domain.bus_max = ((int *)prop_val)[1]; - - /* Get "reg" property */ - prop_val = promGetProperty("reg", &prop_len); - if (!prop_val || (prop_len != 48)) - continue; - - /* Temporarily map some of Schizo's registers */ - pSchizo = sparcMapAperture(-1, VIDMEM_MMIO, - ((unsigned long long *)prop_val)[2] - 0x000000010000ull, - 0x00010000ul); - - /* Determine where PCI config, I/O and memory spaces reside */ - if ((((unsigned long long *)prop_val)[0] & 0x000000700000ull) == - 0x000000600000ull) - Offset = 0x0040; - else - Offset = 0x0060; - - mem_match = PciReg(pSchizo, 0, Offset, unsigned long long); - mem_mask = PciReg(pSchizo, 0, Offset + 8, unsigned long long); - io_match = PciReg(pSchizo, 0, Offset + 16, unsigned long long); - io_mask = PciReg(pSchizo, 0, Offset + 24, unsigned long long); - - /* Unmap Schizo registers */ - xf86UnMapVidMem(-1, pSchizo, 0x00010000ul); - - /* Calculate sizes */ - mem_mask = (((mem_mask - 1) ^ mem_mask) >> 1) + 1; - io_mask = (((io_mask - 1) ^ io_mask ) >> 1) + 1; - - if (io_mask <= 0x000001000000ull) /* Nothing left for I/O */ - continue; - - domain.mem_addr = mem_match & ~0x8000000000000000ull; - domain.mem_size = mem_mask; - pci_addr = io_match & ~0x8000000000000000ull; - domain.io_addr = pci_addr + 0x0000000001000000ull; - domain.io_size = io_mask - 0x0000000001000000ull; - } else { - xf86Msg(X_WARNING, "Unknown PCI host bridge: \"%s\"\n", prop_val); - continue; - } - - /* Only map as much PCI configuration as we need */ - domain.pci = (char *)sparcMapAperture(-1, VIDMEM_MMIO, - pci_addr + PCI_MAKE_TAG(domain.bus_min, 0, 0), - PCI_MAKE_TAG(domain.bus_max - domain.bus_min + 1, 0, 0)) - - PCI_MAKE_TAG(domain.bus_min, 0, 0); - - /* Allocate a domain record */ - pDomain = xnfalloc(sizeof(sparcDomainRec)); - *pDomain = domain; - - /* - * Allocate and prime pciBusInfo records. These are allocated one at a - * time because those for empty buses are eventually released. - */ - bus = pDomain->bus_min = - PCI_MAKE_BUS(pciNumDomains, domain.bus_min); - pciNumBuses = pDomain->bus_max = - PCI_MAKE_BUS(pciNumDomains, domain.bus_max) + 1; - - pciBusInfo[bus] = xnfcalloc(1, sizeof(pciBusInfo_t)); - pciBusInfo[bus]->configMech = PCI_CFG_MECH_OTHER; - pciBusInfo[bus]->numDevices = 32; - pciBusInfo[bus]->funcs = pFunctions; - pciBusInfo[bus]->pciBusPriv = pDomain; - while (++bus < pciNumBuses) { - pciBusInfo[bus] = xnfalloc(sizeof(pciBusInfo_t)); - *(pciBusInfo[bus]) = *(pciBusInfo[bus - 1]); - pciBusInfo[bus]->funcs = &sparcPCIFunctions; - } - - /* Next domain, please... */ - xf86DomainInfo[pciNumDomains++] = pDomain; - - /* - * OK, enough of the straight-forward stuff. Time to deal with some - * brokenness... - * - * The PCI specs require that when a bus transaction remains unclaimed - * for too long, the master entity on that bus is to cancel the - * transaction it issued or passed on with a master abort. Two - * outcomes are possible: - * - * - the master abort can be treated as an error that is propogated - * back through the bus tree to the entity that ultimately originated - * the transaction; or - * - the transaction can be allowed to complete normally, which means - * that writes are ignored and reads return all ones. - * - * In the first case, if the CPU happens to be at the tail end of the - * tree path through one of its host bridges, it will be told there is - * a hardware mal-function, despite being generated by software. - * - * For a software function (be it firmware, OS or userland application) - * to determine how a PCI bus tree is populated, it must be able to - * detect when master aborts occur. Obviously, PCI discovery is much - * simpler when master aborts are allowed to complete normally. - * - * Unfortunately, a number of non-Intel PCI implementations have chosen - * to treat master aborts as severe errors. The net effect is to - * cripple PCI discovery algorithms in userland. - * - * On SPARCs, master aborts cause a number of different behaviours, - * including delivering a signal to the userland application, rebooting - * the system, "dropping down" to firmware, or, worst of all, bus - * lockouts. Even in the first case, the SIGBUS signal that is - * eventually generated isn't delivered in a timely enough fashion to - * allow an application to reliably detect the master abort that - * ultimately caused it. - * - * This can be somewhat mitigated. On all architectures, master aborts - * that occur on secondary buses can be forced to complete normally - * because the PCI-to-PCI bridges that serve them are governed by an - * industry-wide specification. (This is just another way of saying - * that whatever justification there might be for erroring out master - * aborts is deemed by the industry as insufficient to generate more - * PCI non-compliance than there already is...) - * - * This leaves us with master aborts that occur on primary buses. - * There is no specification for host-to-PCI bridges. Bridges used in - * SPARCs can be told to ignore all PCI errors, but not specifically - * master aborts. Not only is this too coarse-grained, but - * master-aborted read transactions on the primary bus end up returning - * garbage rather than all ones. - * - * I have elected to work around this the only way I can think of doing - * so right now. The following scans an additional PROM level and - * builds a device/function map for the primary bus. I can only hope - * this PROM information represents all devices on the primary bus, - * rather than only a subset of them. - * - * Master aborts are useful in other ways too, that are not addressed - * here. These include determining whether or not a domain provides - * VGA, or if a PCI device actually implements PCI disablement. - * - * --- TSI @ UQV 2001.09.19 - */ - for (node2 = promGetChild(node); - node2; - node2 = promGetSibling(node2)) { - /* Get "reg" property */ - prop_val = promGetProperty("reg", &prop_len); - if (!prop_val || (prop_len % 20)) - continue; - - /* - * It's unnecessary to scan the entire "reg" property, but I'll do - * so anyway. - */ - prop_len /= 20; - for (; prop_len--; prop_val += 20) - SetBitInMap(PCI_DFN_FROM_TAG(*(PCITAG *)prop_val), - pDomain->dfn_mask); - } - - /* Assume the host bridge is device 0, function 0 on its bus */ - SetBitInMap(0, pDomain->dfn_mask); - } - - sparcPromClose(); - - close(apertureFd); - apertureFd = -1; -} - -#ifndef INCLUDE_XF86_NO_DOMAIN - -_X_EXPORT int -xf86GetPciDomain(PCITAG Tag) -{ - return PCI_DOM_FROM_TAG(Tag); -} - -_X_EXPORT pointer -xf86MapDomainMemory(int ScreenNum, int Flags, PCITAG Tag, - ADDRESS Base, unsigned long Size) -{ - sparcDomainPtr pDomain; - pointer result; - int domain = PCI_DOM_FROM_TAG(Tag); - - if ((domain <= 0) || (domain >= pciNumDomains) || - !(pDomain = xf86DomainInfo[domain]) || - (((unsigned long long)Base + (unsigned long long)Size) > - pDomain->mem_size)) - FatalError("xf86MapDomainMemory() called with invalid parameters.\n"); - - result = sparcMapAperture(ScreenNum, Flags, pDomain->mem_addr + Base, Size); - - if (apertureFd >= 0) { - close(apertureFd); - apertureFd = -1; - } - - return result; -} - -_X_EXPORT IOADDRESS -xf86MapLegacyIO(int ScreenNum, int Flags, PCITAG Tag, - IOADDRESS Base, unsigned long Size) -{ - sparcDomainPtr pDomain; - int domain = PCI_DOM_FROM_TAG(Tag); - - if ((domain <= 0) || (domain >= pciNumDomains) || - !(pDomain = xf86DomainInfo[domain]) || - (((unsigned long long)Base + (unsigned long long)Size) > - pDomain->io_size)) - FatalError("xf86MapLegacyIO() called with invalid parameters.\n"); - - /* Permanently map all of I/O space */ - if (!pDomain->io) { - pDomain->io = sparcMapAperture(ScreenNum, Flags, - pDomain->io_addr, pDomain->io_size); - - if (apertureFd >= 0) { - close(apertureFd); - apertureFd = -1; - } - } - - return (IOADDRESS)pDomain->io + Base; -} - -resPtr -xf86AccResFromOS(resPtr pRes) -{ - sparcDomainPtr pDomain; - resRange range; - int domain; - - for (domain = 1; domain < pciNumDomains; domain++) { - if (!(pDomain = xf86DomainInfo[domain])) - continue; - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ - RANGE(range, 0x00000000u, 0x0009ffffu, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - RANGE(range, 0x000c0000u, 0x000effffu, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - RANGE(range, 0x000f0000u, 0x000fffffu, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - RANGE(range, pDomain->mem_size - 1, pDomain->mem_size - 1, - RANGE_TYPE(ResExcMemBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - - RANGE(range, 0x00000000u, 0x00000000u, - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - RANGE(range, pDomain->io_size - 1, pDomain->io_size - 1, - RANGE_TYPE(ResExcIoBlock, domain)); - pRes = xf86AddResToList(pRes, &range, -1); - } - - return pRes; -} - -#endif /* !INCLUDE_XF86_NO_DOMAIN */ - -#endif /* defined(sun) */ - -#if defined(ARCH_PCI_PCI_BRIDGE) - -/* Definitions specific to Sun's APB P2P bridge (a.k.a. Simba) */ -#define APB_IO_ADDRESS_MAP 0xDE -#define APB_MEM_ADDRESS_MAP 0xDF - -/* - * Simba's can only occur on bus 0. Furthermore, Simba's must have a non-zero - * device/function number because the Sabre interface they must connect to - * occupies the 0:0:0 slot. Also, there can be only one Sabre interface in the - * system, and therefore, only one Simba function can route any particular - * resource. Thus, it is appropriate to use a single set of static variables - * to hold the tag of the Simba function routing a VGA resource range at any - * one time, and to test these variables for non-zero to determine whether or - * not the Sabre would master-abort a VGA access (and kill the system). - * - * The trick is to determine when it is safe to re-route VGA, because doing so - * re-routes much more. - */ -static PCITAG simbavgaIOTag = 0, simbavgaMemTag = 0; -static Bool simbavgaRoutingAllow = TRUE; - -/* - * Scan the bus subtree rooted at 'bus' for a non-display device that might be - * decoding the bottom 2 MB of I/O space and/or the bottom 512 MB of memory - * space. Reset simbavgaRoutingAllow if such a device is found. - * - * XXX For now, this is very conservative and should be made less so as the - * need arises. - */ -static void -simbaCheckBus(CARD16 pcicommand, int bus) -{ - pciConfigPtr pPCI, *ppPCI = xf86scanpci(0); - - while ((pPCI = *ppPCI++)) { - if (pPCI->busnum < bus) - continue; - if (pPCI->busnum > bus) - break; - - /* XXX Assume all devices respect PCI disablement */ - if (!(pcicommand & pPCI->pci_command)) - continue; - - /* XXX This doesn't deal with mis-advertised classes */ - switch (pPCI->pci_base_class) { - case PCI_CLASS_PREHISTORIC: - if (pPCI->pci_sub_class == PCI_SUBCLASS_PREHISTORIC_VGA) - continue; /* Ignore VGA */ - break; - - case PCI_CLASS_DISPLAY: - continue; - - case PCI_CLASS_BRIDGE: - switch (pPCI->pci_sub_class) { - case PCI_SUBCLASS_BRIDGE_PCI: - case PCI_SUBCLASS_BRIDGE_CARDBUS: - /* Scan secondary bus */ - /* XXX First check bridge routing? */ - simbaCheckBus(pcicommand & pPCI->pci_command, - PCI_SECONDARY_BUS_EXTRACT(pPCI->pci_pp_bus_register, - pPCI->tag)); - if (!simbavgaRoutingAllow) - return; - - default: - break; - } - - default: - break; - } - - /* - * XXX We could check the device's bases here, but PCI doesn't limit - * the device's decoding to them. - */ - - simbavgaRoutingAllow = FALSE; - break; - } -} - -static pciConfigPtr -simbaVerifyBus(int bus) -{ - pciConfigPtr pPCI; - if ((bus < 0) || (bus >= pciNumBuses) || - !pciBusInfo[bus] || !(pPCI = pciBusInfo[bus]->bridge) || - (pPCI->pci_device_vendor != DEVID(VENDOR_SUN, CHIP_SIMBA))) - return NULL; - - return pPCI; -} - -static CARD16 -simbaControlBridge(int bus, CARD16 mask, CARD16 value) -{ - pciConfigPtr pPCI; - CARD16 current = 0, tmp; - CARD8 iomap, memmap; - - if ((pPCI = simbaVerifyBus(bus))) { - /* - * The Simba does not implement VGA enablement as described in the P2P - * spec. It does however route I/O and memory in large enough chunks - * so that we can determine were VGA resources would be routed - * (including ISA VGA I/O aliases). We can allow changes to that - * routing only under certain circumstances. - */ - iomap = pciReadByte(pPCI->tag, APB_IO_ADDRESS_MAP); - memmap = pciReadByte(pPCI->tag, APB_MEM_ADDRESS_MAP); - if (iomap & memmap & 0x01) { - current |= PCI_PCI_BRIDGE_VGA_EN; - if ((mask & PCI_PCI_BRIDGE_VGA_EN) && - !(value & PCI_PCI_BRIDGE_VGA_EN)) { - if (!simbavgaRoutingAllow) { - xf86MsgVerb(X_WARNING, 3, "Attempt to disable VGA routing" - " through Simba at %x:%x:%x disallowed.\n", - pPCI->busnum, pPCI->devnum, pPCI->funcnum); - value |= PCI_PCI_BRIDGE_VGA_EN; - } else { - pciWriteByte(pPCI->tag, APB_IO_ADDRESS_MAP, - iomap & ~0x01); - pciWriteByte(pPCI->tag, APB_MEM_ADDRESS_MAP, - memmap & ~0x01); - simbavgaIOTag = simbavgaMemTag = 0; - } - } - } else { - if (mask & value & PCI_PCI_BRIDGE_VGA_EN) { - if (!simbavgaRoutingAllow) { - xf86MsgVerb(X_WARNING, 3, "Attempt to enable VGA routing" - " through Simba at %x:%x:%x disallowed.\n", - pPCI->busnum, pPCI->devnum, pPCI->funcnum); - value &= ~PCI_PCI_BRIDGE_VGA_EN; - } else { - if (pPCI->tag != simbavgaIOTag) { - if (simbavgaIOTag) { - tmp = pciReadByte(simbavgaIOTag, - APB_IO_ADDRESS_MAP); - pciWriteByte(simbavgaIOTag, APB_IO_ADDRESS_MAP, - tmp & ~0x01); - } - - pciWriteByte(pPCI->tag, APB_IO_ADDRESS_MAP, - iomap | 0x01); - simbavgaIOTag = pPCI->tag; - } - - if (pPCI->tag != simbavgaMemTag) { - if (simbavgaMemTag) { - tmp = pciReadByte(simbavgaMemTag, - APB_MEM_ADDRESS_MAP); - pciWriteByte(simbavgaMemTag, APB_MEM_ADDRESS_MAP, - tmp & ~0x01); - } - - pciWriteByte(pPCI->tag, APB_MEM_ADDRESS_MAP, - memmap | 0x01); - simbavgaMemTag = pPCI->tag; - } - } - } - } - - /* Move on to master abort failure enablement (as per P2P spec) */ - tmp = pciReadWord(pPCI->tag, PCI_PCI_BRIDGE_CONTROL_REG); - current |= tmp; - if (tmp & PCI_PCI_BRIDGE_MASTER_ABORT_EN) { - if ((mask & PCI_PCI_BRIDGE_MASTER_ABORT_EN) && - !(value & PCI_PCI_BRIDGE_MASTER_ABORT_EN)) - pciWriteWord(pPCI->tag, PCI_PCI_BRIDGE_CONTROL_REG, - tmp & ~PCI_PCI_BRIDGE_MASTER_ABORT_EN); - } else { - if (mask & value & PCI_PCI_BRIDGE_MASTER_ABORT_EN) - pciWriteWord(pPCI->tag, PCI_PCI_BRIDGE_CONTROL_REG, - tmp | PCI_PCI_BRIDGE_MASTER_ABORT_EN); - } - - /* Insert emulation of other P2P controls here */ - } - - return (current & ~mask) | (value & mask); -} - -static void -simbaGetBridgeResources(int bus, - pointer *ppIoRes, - pointer *ppMemRes, - pointer *ppPmemRes) -{ - pciConfigPtr pPCI = simbaVerifyBus(bus); - resRange range; - int i; - - if (!pPCI) - return; - - if (ppIoRes) { - xf86FreeResList(*ppIoRes); - *ppIoRes = NULL; - - if (pPCI->pci_command & PCI_CMD_IO_ENABLE) { - unsigned char iomap = pciReadByte(pPCI->tag, APB_IO_ADDRESS_MAP); - if (simbavgaRoutingAllow) - iomap |= 0x01; - for (i = 0; i < 8; i++) { - if (iomap & (1 << i)) { - RANGE(range, i << 21, ((i + 1) << 21) - 1, - RANGE_TYPE(ResExcIoBlock, - xf86GetPciDomain(pPCI->tag))); - *ppIoRes = xf86AddResToList(*ppIoRes, &range, -1); - } - } - } - } - - if (ppMemRes) { - xf86FreeResList(*ppMemRes); - *ppMemRes = NULL; - - if (pPCI->pci_command & PCI_CMD_MEM_ENABLE) { - unsigned char memmap = pciReadByte(pPCI->tag, APB_MEM_ADDRESS_MAP); - if (simbavgaRoutingAllow) - memmap |= 0x01; - for (i = 0; i < 8; i++) { - if (memmap & (1 << i)) { - RANGE(range, i << 29, ((i + 1) << 29) - 1, - RANGE_TYPE(ResExcMemBlock, - xf86GetPciDomain(pPCI->tag))); - *ppMemRes = xf86AddResToList(*ppMemRes, &range, -1); - } - } - } - } - - if (ppPmemRes) { - xf86FreeResList(*ppPmemRes); - *ppPmemRes = NULL; - } -} - -void ARCH_PCI_PCI_BRIDGE(pciConfigPtr pPCI) -{ - static pciBusFuncs_t simbaBusFuncs; - pciBusInfo_t *pBusInfo; - CARD16 pcicommand; - - if (pPCI->pci_device_vendor != DEVID(VENDOR_SUN, CHIP_SIMBA)) - return; - - pBusInfo = pPCI->businfo; - - simbaBusFuncs = *(pBusInfo->funcs); - simbaBusFuncs.pciControlBridge = simbaControlBridge; - simbaBusFuncs.pciGetBridgeResources = simbaGetBridgeResources; - - pBusInfo->funcs = &simbaBusFuncs; - - if (!simbavgaRoutingAllow) - return; - - pcicommand = 0; - - if (pciReadByte(pPCI->tag, APB_IO_ADDRESS_MAP) & 0x01) { - pcicommand |= PCI_CMD_IO_ENABLE; - simbavgaIOTag = pPCI->tag; - } - - if (pciReadByte(pPCI->tag, APB_MEM_ADDRESS_MAP) & 0x01) { - pcicommand |= PCI_CMD_MEM_ENABLE; - simbavgaMemTag = pPCI->tag; - } - - if (!pcicommand) - return; - - simbaCheckBus(pcicommand, - PCI_SECONDARY_BUS_EXTRACT(pPCI->pci_pp_bus_register, pPCI->tag)); -} - -#endif /* defined(ARCH_PCI_PCI_BRIDGE) */ diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am index 02a4e0c4a..f12dfb05c 100644 --- a/hw/xfree86/os-support/linux/Makefile.am +++ b/hw/xfree86/os-support/linux/Makefile.am @@ -44,8 +44,7 @@ INCLUDES = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS) # FIXME: These need to be added to the build LNX_EXTRA_SRCS = \ - lnx_font.c \ - lnxResource.c + lnx_font.c EXTRA_DIST = \ $(LNX_EXTRA_SRCS) \ diff --git a/hw/xfree86/os-support/linux/lnxResource.c b/hw/xfree86/os-support/linux/lnxResource.c deleted file mode 100644 index 734f4d674..000000000 --- a/hw/xfree86/os-support/linux/lnxResource.c +++ /dev/null @@ -1,105 +0,0 @@ - -/* Resource information code */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <X11/X.h> -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86Privstr.h" -#include "xf86Pci.h" -#include "xf86Resources.h" -#define NEED_OS_RAC_PROTOS -#include "xf86_OSlib.h" -#include "lnx.h" - -/* Avoid Imakefile changes */ -#include "bus/Pci.h" - -#ifdef INCLUDE_XF86_NO_DOMAIN - -#ifdef __alpha__ - -resPtr -xf86AccResFromOS(resPtr ret) -{ - resRange range; - - /* - * Fallback is to claim the following areas: - * - * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS - */ - - RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - - /* - * Fallback would be to claim well known ports in the 0x0 - 0x3ff range - * along with their sparse I/O aliases, but that's too imprecise. Instead - * claim a bare minimum here. - */ - RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */ - ret = xf86AddResToList(ret, &range, -1); - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ - RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); -/* RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); */ - RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); - - /* XXX add others */ - return ret; -} - -#elif defined(__powerpc__) || \ - defined(__sparc__) || \ - defined(__mips__) || \ - defined(__sh__) || \ - defined(__m32r__) || \ - defined(__mc68000__) || \ - defined(__arm__) || \ - defined(__s390__) || \ - defined(__hppa__) - -resPtr -xf86AccResFromOS(resPtr ret) -{ - resRange range; - - /* - * At minimum, the top and bottom resources must be claimed, so that - * resources that are (or appear to be) unallocated can be relocated. - */ - RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); - ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); - ret = xf86AddResToList(ret, &range, -1); -#if defined(__sparc__) || defined(__powerpc__) - RANGE(range, 0x00ffffff, 0x00ffffff, ResExcIoBlock); -#else - RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock); -#endif - ret = xf86AddResToList(ret, &range, -1); - - return ret; -} - -#else - -#error : Put your platform dependent code here!! - -#endif - -#endif /* INCLUDE_XF86_NO_DOMAIN */ diff --git a/hw/xfree86/os-support/misc/BUSmemcpy.S b/hw/xfree86/os-support/misc/BUSmemcpy.S deleted file mode 100644 index 373723c7d..000000000 --- a/hw/xfree86/os-support/misc/BUSmemcpy.S +++ /dev/null @@ -1,153 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/BUSmemcpy.s,v 1.2 1998/07/25 16:56:49 dawes Exp $ */ -/****************************************************************************** - Copyright 1993 by Glenn G. Lai - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -(glenn@cs.utexas.edu) -8/9/93 -******************************************************************************/ -/* $XConsortium: BUSmemcpy.s /main/4 1996/02/21 17:39:34 kaleb $ */ - -/* - * Modified to use long-alignment of video memory rather than word-alignment - * to improve performance for LocalBus video cards. Function names changed - * from ISAToMem and MemToISA to BusToMem and MemToBus. - * - * David Dawes <dawes@XFree86.org>, 25 August 1993. - */ - - -#include "assyntax.h" - - FILE("BUSmemcpy.s") - - AS_BEGIN - -/* BusToMem copies from video memory to main memory - MemToBus copies from main memory to video memory - - void xf86BusToMem(unsigned char *dst, unsigned char *src, int len); - void xf86MemToBus(unsigned char *dst, unsigned char *src, int len); -*/ - -#define dst REGOFF(4,ESP) -#define src REGOFF(8,ESP) -#define len REGOFF(12,ESP) - - GLOBL GLNAME(xf86BusToMem) - GLOBL GLNAME(xf86MemToBus) - - SEG_DATA -copyright: - STRING("Copyright 8/9/1993 by Glenn G. Lai") - - SEG_TEXT - ALIGNTEXT4 -GLNAME(xf86BusToMem): - CLD - PUSH_L (ESI) - MOV_L (EDI, EDX) - - MOV_L (src, ESI) - MOV_L (dst, EDI) - MOV_L (len, ECX) - - CMP_L (CONST(7), ECX) - JC (quickBM) - - TEST_L (CONST(1), ESI) - JZ (BwM) - - MOVS_B - DEC_L (ECX) - -BwM: - TEST_L (CONST(2), ESI) - JZ (BlM) - - MOVS_W - DEC_L (ECX) - DEC_L (ECX) - -BlM: - MOV_L (ECX, EAX) - AND_L (CONST(3), EAX) - SHR_L (CONST(2), ECX) - REP - MOVS_L - MOV_L (EAX, ECX) -quickBM: - OR_L (ECX, ECX) - JZ (return) - REP - MOVS_B -return: - POP_L (ESI) - MOV_L (EDX, EDI) - RET -/************************/ - - ALIGNTEXT4 -GLNAME(xf86MemToBus): - CLD - PUSH_L (ESI) - MOV_L (EDI, EDX) - - MOV_L (src, ESI) - MOV_L (dst, EDI) - MOV_L (len, ECX) - - CMP_L (CONST(7), ECX) - JC (quickMB) - - TEST_L (CONST(1), EDI) - JZ (MwB) - - MOVS_B - DEC_L (ECX) - -MwB: - TEST_L (CONST(2), EDI) - JZ (MlB) - - MOVS_W - DEC_L (ECX) - DEC_L (ECX) - -MlB: - MOV_L (ECX, EAX) - AND_L (CONST(3), EAX) - SHR_L (CONST(2), ECX) - REP - MOVS_L - MOV_L (EAX, ECX) -quickMB: - OR_L (ECX, ECX) - JZ (return) - REP - MOVS_B - - POP_L (ESI) - MOV_L (EDX, EDI) - RET - diff --git a/hw/xfree86/os-support/misc/IODelay.S b/hw/xfree86/os-support/misc/IODelay.S deleted file mode 100644 index 4c6e32f3f..000000000 --- a/hw/xfree86/os-support/misc/IODelay.S +++ /dev/null @@ -1,53 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/IODelay.S,v 1.1 1999/07/10 07:24:50 dawes Exp $ */ -/******************************************************************************* - Copyright 1994 by Glenn G. Lai - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyr notice appear in all copies and that -both that copyr notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -glenn@cs.utexas.edu) -7/21/94 -*******************************************************************************/ -/* $XConsortium: IODelay.s /main/4 1996/02/21 17:40:21 kaleb $ */ - -/* - * All we really need is a delay of about 40ns for I/O recovery for just - * about any occasion, but we'll be more conservative here: On a - * 100-MHz CPU, produce at least a delay of 1,000ns. - */ - -#include "assyntax.h" - - FILE("DACDelay.s") - - AS_BEGIN - - GLOBL GLNAME(xf86IODelay) - - SEG_TEXT - ALIGNTEXT4 -GLNAME(xf86IODelay): - MOV_L (CONST(100), EAX) -delay_it: - DEC_L (EAX) - JNE (delay_it) - RET - diff --git a/hw/xfree86/os-support/misc/Makefile.am b/hw/xfree86/os-support/misc/Makefile.am index ad27cfc2b..39066ecb0 100644 --- a/hw/xfree86/os-support/misc/Makefile.am +++ b/hw/xfree86/os-support/misc/Makefile.am @@ -1,18 +1,7 @@ -# FIXME: Add the *.S files to build when applicable -I386_SRCS = BUSmemcpy.S IODelay.S SlowBcopy.S -OTHER_SRCS = BUSmemcpy.c IODelay.c SlowBcopy.c - -ARCH_SRCS = $(OTHER_SRCS) - -# FIXME: Add to the build (NeedPortIO) -PORTIO_SRCS = PortIO.S - -# FIXME: Add to the build (if HasGcc || HasGcc2) -ILHACK_SRCS = xf86_IlHack.c noinst_LTLIBRARIES = libmisc.la -libmisc_la_SOURCES = Delay.c $(ARCH_SRCS) +libmisc_la_SOURCES = Delay.c BUSmemcpy.c IODelay.c SlowBcopy.c #AM_LDFLAGS = -r @@ -20,4 +9,4 @@ INCLUDES = $(XORG_INCS) AM_CFLAGS = $(XORG_CFLAGS) $(DIX_CFLAGS) -EXTRA_DIST = $(I386_SRCS) $(PORTIO_SRCS) $(ILHACK_SRCS) +EXTRA_DIST = $(I386_SRCS) $(PORTIO_SRCS) diff --git a/hw/xfree86/os-support/misc/PortIO.S b/hw/xfree86/os-support/misc/PortIO.S deleted file mode 100644 index 75db31156..000000000 --- a/hw/xfree86/os-support/misc/PortIO.S +++ /dev/null @@ -1,57 +0,0 @@ -/* $XFree86$ */ - -/* Port I/O functions for platforms with no inlining. */ - -#include "assyntax.h" - - FILE("PortIO.s") - - AS_BEGIN - - GLOBL GLNAME(outb) - GLOBL GLNAME(outw) - GLOBL GLNAME(outl) - GLOBL GLNAME(inb) - GLOBL GLNAME(inw) - GLOBL GLNAME(inl) - - SEG_TEXT - ALIGNTEXT4 -GLNAME(outb): - MOV_L (REGOFF(4,ESP), EDX) - MOV_L (REGOFF(8,ESP), EAX) - OUT_B - RET - - ALIGNTEXT4 -GLNAME(outw): - MOV_L (REGOFF(4,ESP), EDX) - MOV_L (REGOFF(8,ESP), EAX) - OUT_W - RET - - ALIGNTEXT4 -GLNAME(outl): - MOV_L (REGOFF(4,ESP), EDX) - MOV_L (REGOFF(8,ESP), EAX) - OUT_L - RET - - ALIGNTEXT4 -GLNAME(inb): - MOV_L (REGOFF(4,ESP), EDX) - IN_B - RET - - ALIGNTEXT4 -GLNAME(inw): - MOV_L (REGOFF(4,ESP), EDX) - IN_L - RET - - ALIGNTEXT4 -GLNAME(inl): - MOV_L (REGOFF(4,ESP), EDX) - IN_L - RET - diff --git a/hw/xfree86/os-support/misc/SlowBcopy.S b/hw/xfree86/os-support/misc/SlowBcopy.S deleted file mode 100644 index 9b6af1d69..000000000 --- a/hw/xfree86/os-support/misc/SlowBcopy.S +++ /dev/null @@ -1,108 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/misc/SlowBcopy.S,v 1.1 1999/07/10 07:24:51 dawes Exp $ */ -/******************************************************************************* - Copyright 1994 by Glenn G. Lai - - All Rights Reserved - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyr notice appear in all copies and that -both that copyr notice and this permission notice appear in -supporting documentation, and that the name of Glenn G. Lai not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -Glenn G. Lai DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, -ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS -SOFTWARE. - -Glenn G. Lai -P.O. Box 4314 -Austin, Tx 78765 -glenn@cs.utexas.edu) -7/21/94 -*******************************************************************************/ -/* $XConsortium: SlowBcopy.s /main/4 1996/02/21 17:40:52 kaleb $ */ - -/* - * Modified from the output generated by GCC - * - * Create a dependency that should be immune from the effect of register - * renaming as is commonly seen in superscalar processors. This should - * insert a minimum of 100-ns delays between reads/writes at clock rates - * up to 100 MHz---GGL - * - * Slowbcopy(char *src, char *dst, int count) - * - */ - -#include "assyntax.h" - - FILE("SlowBcopy.s") - - AS_BEGIN - -gcc2_compiled.: -___gnu_compiled_c: - - GLOBL GLNAME(xf86SlowBcopy) - - SEG_TEXT - ALIGNTEXT4 -GLNAME(xf86SlowBcopy): - PUSH_L (EBP) - MOV_L (ESP,EBP) - PUSH_L (ESI) - PUSH_L (EBX) - MOV_L (REGOFF(8,EBP),ECX) - MOV_L (REGOFF(12,EBP),EDX) - MOV_L (REGOFF(16,EBP),ESI) - XOR_L (EAX,EAX) - CMP_L (ESI,EAX) - JGE (L3) - - ALIGNTEXT4 -L5: - MOV_B (REGIND(ECX),BL) - - MOV_B (BL, BH) - MOV_B (BH, BL) - MOV_B (BL, BH) - MOV_B (BH, BL) - MOV_B (BL, BH) - MOV_B (BH, BL) - MOV_B (BL, BH) - MOV_B (BH, BL) - MOV_B (BL, BH) - MOV_B (BH, BL) - - MOV_B (BL,REGIND(EDX)) - - INC_L (ECX) - DEC_L (ECX) - INC_L (ECX) - DEC_L (ECX) - INC_L (ECX) - DEC_L (ECX) - INC_L (ECX) - DEC_L (ECX) - INC_L (ECX) - DEC_L (ECX) - - INC_L (ECX) - INC_L (EDX) - INC_L (EAX) - CMP_L (ESI,EAX) - JL (L5) -L3: - LEA_L (REGOFF(-8,EBP),ESP) - POP_L (EBX) - POP_L (ESI) - MOV_L (EBP,ESP) - POP_L (EBP) - RET - diff --git a/hw/xfree86/os-support/misc/xf86_IlHack.c b/hw/xfree86/os-support/misc/xf86_IlHack.c deleted file mode 100644 index 6c9871d93..000000000 --- a/hw/xfree86/os-support/misc/xf86_IlHack.c +++ /dev/null @@ -1,16 +0,0 @@ -/* - * This file is an incredible crock to get the normally-inline functions - * built into the server so that things can be debugged properly. - * - * Note: this doesn't work when using a compiler other than GCC. - */ - -#define static /**/ -#define __inline__ /**/ -#undef NO_INLINE -#define DO_PROTOTYPES -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include "compiler.h" diff --git a/hw/xfree86/os-support/shared/inout.S b/hw/xfree86/os-support/shared/inout.S deleted file mode 100644 index 80c47c419..000000000 --- a/hw/xfree86/os-support/shared/inout.S +++ /dev/null @@ -1,111 +0,0 @@ -/* $XConsortium: inout.s /main/6 1996/02/21 17:53:35 kaleb $ */ - - - - - -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/inout.S,v 1.1 1999/07/10 07:24:52 dawes Exp $ */ - -#include "assyntax.h" - -/* - * Make i80386 io primitives available at C-level. - */ - - FILE("inout.s") - AS_BEGIN - SEG_TEXT - -/* - *----------------------------------------------------------------------- - * inb --- - * Input one byte. - * - * Results: - * Byte in al. - *----------------------------------------------------------------------- - */ - GLOBL GLNAME(inb) -GLNAME(inb): - MOV_L (REGOFF(4,ESP),EDX) - SUB_L (EAX,EAX) - IN_B - RET - -/* - *----------------------------------------------------------------------- - * outb --- - * Output one byte. - * - * Results: - * None. - *----------------------------------------------------------------------- - */ - GLOBL GLNAME(outb) -GLNAME(outb): - MOV_L (REGOFF(4,sp),EDX) - MOV_L (REGOFF(8,sp),EAX) - OUT_B - RET -/* - *----------------------------------------------------------------------- - * inw --- - * Input one 16-bit word. - * - * Results: - * Word in ax. - *----------------------------------------------------------------------- - */ - GLOBL GLNAME(inw) -GLNAME(inw): - MOV_L (REGOFF(4,ESP),EDX) - IN_W - RET - -/* - *----------------------------------------------------------------------- - * outw --- - * Output one 16-bit word. - * - * Results: - * None. - *----------------------------------------------------------------------- - */ - GLOBL GLNAME(outw) -GLNAME(outw): - MOV_L (REGOFF(4,ESP),EDX) - MOV_L (REGOFF(8,ESP),EAX) - OUT_W - RET - -/* - *----------------------------------------------------------------------- - * inl --- - * Input one 32-bit longword. - * - * Results: - * Word in eax. - *----------------------------------------------------------------------- - */ - GLOBL GLNAME(inl) -GLNAME(inl): - MOV_L (REGOFF(4,ESP),EDX) - IN_L - RET - -/* - *----------------------------------------------------------------------- - * outl --- - * Output one 32-bit longword. - * - * Results: - * None. - *----------------------------------------------------------------------- - */ - GLOBL GLNAME(outl) -GLNAME(outl): - MOV_L (REGOFF(4,ESP),EDX) - MOV_L (REGOFF(8,ESP),EAX) - OUT_L - RET - diff --git a/hw/xfree86/xaa/Makefile.am b/hw/xfree86/xaa/Makefile.am index bd8267ad8..c409eb7e5 100644 --- a/hw/xfree86/xaa/Makefile.am +++ b/hw/xfree86/xaa/Makefile.am @@ -67,7 +67,7 @@ DISTCLEANFILES = $(POLYSEG) \ sdk_HEADERS = xaa.h xaalocal.h xaarop.h xaaWrapper.h EXTRA_DIST = xaacexp.h xaawrap.h xaaLine.c xaaDashLine.c \ xaaStipple.c xaaTEGlyph.c xaaNonTEGlyph.c xaaBitmap.c \ - xaaTEGlyphBlt.S XAA.HOWTO + XAA.HOWTO INCLUDES = $(XORG_INCS) diff --git a/hw/xfree86/xaa/xaaTEGlyphBlt.S b/hw/xfree86/xaa/xaaTEGlyphBlt.S deleted file mode 100644 index 5f3137f45..000000000 --- a/hw/xfree86/xaa/xaaTEGlyphBlt.S +++ /dev/null @@ -1,964 +0,0 @@ -/* - * Copyright 1996 The XFree86 Project - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * HARM HANEMAAYER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net). - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaTEGlyphBlt.S,v 1.1 1999/07/10 07:24:54 dawes Exp $ */ - - -/* - * Intel Pentium-optimized versions of "terminal emulator font" text - * bitmap transfer routines. - * - * SCANLINE_PAD_DWORD. - * - * Only for glyphs with a fixed width of 6 pixels or 8 pixels. - */ - -#include "assyntax.h" - -#ifndef QNX4 - FILE("xaaTEGlyphBlt.s") -#else - FILE( __FILE__ ) -#endif - - AS_BEGIN - -/* - * Definition of stack frame function arguments. - * All functions have the same arguments (some don't have glyphwidth, - * but that's OK, since it comes last and doesn't affect the offset - * of the other arguments). - */ - -#define base_arg REGOFF(20,ESP) -#define glyphp_arg REGOFF(24,ESP) -#define line_arg REGOFF(28,ESP) -#define width_arg REGOFF(32,ESP) -#define glyphwidth_arg REGOFF(36,ESP) - -#define BYTE_REVERSED GLNAME(byte_reversed) - -/* I assume %eax and %edx can be trashed. */ - - SEG_TEXT - - ALIGNTEXT4 - -#ifdef FIXEDBASE -# ifdef MSBFIRST - GLOBL GLNAME(DrawTETextScanlineWidth6PMSBFirstFixedBase) -GLNAME(DrawTETextScanlineWidth6PMSBFirstFixedBase): -# else - GLOBL GLNAME(DrawTETextScanlineWidth6PLSBFirstFixedBase) -GLNAME(DrawTETextScanlineWidth6PLSBFirstFixedBase): -# endif -#else -# ifdef MSBFIRST - GLOBL GLNAME(DrawTETextScanlineWidth6PMSBFirst) -GLNAME(DrawTETextScanlineWidth6PMSBFirst): -# else - GLOBL GLNAME(DrawTETextScanlineWidth6PLSBFirst) -GLNAME(DrawTETextScanlineWidth6PLSBFirst): -# endif -#endif - -/* Definition of stack frame function arguments. */ - -#define base_arg REGOFF(20,ESP) -#define glyphp_arg REGOFF(24,ESP) -#define line_arg REGOFF(28,ESP) -#define width_arg REGOFF(32,ESP) - - SUB_L (CONST(16),ESP) - MOV_L (EBP,REGOFF(12,ESP)) /* PUSH EBP */ - MOV_L (EBX,REGOFF(8,ESP)) /* PUSH EBX */ - MOV_L (ESI,REGOFF(4,ESP)) /* PUSH ESI */ - MOV_L (EDI,REGOFF(0,ESP)) /* PUSH EDI */ - - MOV_L (line_arg,EBP) - MOV_L (base_arg,EDI) - MOV_L (glyphp_arg,ESI) - - ALIGNTEXT4 - -.L6_1: - /* Pentium-optimized instruction pairing. */ - /* EBX = bits = glyph[0][line] */ - MOV_L (REGOFF(4,ESI),EDX) /* glyphp[1] */ - MOV_L (REGIND(ESI),EBX) /* glyphp[0] */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[1][line] */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[0][line] */ - SAL_L (CONST(6),EDX) /* glyphp[1][line] << 6 */ - MOV_L (REGOFF(8,ESI),ECX) /* glyphp[2] */ - MOV_L (REGOFF(12,ESI),EAX) /* glyphp[3] */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[2][line] */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[3][line] */ - SAL_L (CONST(12),ECX) /* glyphp[2][line] << 12 */ - OR_L (EDX,EBX) /* bits |= ..[1].. << 6 */ - SAL_L (CONST(18),EAX) /* glyphp[3][line] << 18 */ - OR_L (ECX,EBX) /* bits |= ..[2].. << 12 */ - - MOV_L (REGOFF(16,ESI),EDX) /* glyphp[4] */ - MOV_L (REGOFF(20,ESI),ECX) /* glyphp[5] */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[4][line] */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[5][line] */ - SAL_L (CONST(24),EDX) /* glyphp[4][line] << 24 */ - OR_L (EAX,EBX) /* bits |= ..[3].. << 18 */ - SAL_L (CONST(30),ECX) /* glyphp[5][line] << 30 */ - OR_L (EDX,EBX) /* bits |= ..[4].. << 24 */ - -#ifndef MSBFIRST - MOV_L (REGOFF(20,ESI),EAX) /* glyphp[5] */ - OR_L (ECX,EBX) /* bits |= ..[5].. << 30 */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[5][line] */ - MOV_L (EBX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (CONST(0),EAX) - OR_L (ECX,EBX) /* bits |= ..[5].. << 30 */ - MOV_L (CONST(0),EDX) - MOV_B (BL,AL) - MOV_B (BH,DL) - MOV_B (REGOFF(BYTE_REVERSED,EAX),BL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),BH) - ROL_L (CONST(16),EBX) - MOV_B (BL,AL) - MOV_B (BH,DL) - MOV_B (REGOFF(BYTE_REVERSED,EAX),BL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),BH) - ROL_L (CONST(16),EBX) - MOV_L (REGOFF(20,ESI),EAX) /* glyphp[5] */ - MOV_L (EBX,REGIND(EDI)) - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[5][line] */ -#endif - - CMP_L (CONST(32),width_arg) - JG (.L6_2) -#ifndef FIXEDBASE - ADD_L (CONST(4),EDI) /* base++ */ -#endif - JMP (.L6_4) -.L6_2: - /* Note that glyphp[5][line] is already read again. */ - /* EAX = bits = glyphp[5][line] >> 2 */ - MOV_L (REGOFF(24,ESI),EDX) /* glyphp[6] */ - MOV_L (REGOFF(28,ESI),EBX) /* glyphp[7] */ - SHR_L (CONST(2),EAX) /* glyphp[5][line] >> 2 */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[6][line] */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[7][line] */ - MOV_L (REGOFF(32,ESI),ECX) /* glyphp[8] */ - SAL_L (CONST(4),EDX) /* glyphp[6][line] << 4 */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[8][line] */ - SAL_L (CONST(10),EBX) /* glyphp[7][line] << 10 */ - OR_L (EDX,EAX) /* bits |= ..[6].. << 4 */ - SAL_L (CONST(16),ECX) /* glyphp[8][line] << 16 */ - MOV_L (REGOFF(36,ESI),EDX) /* glyphp[9] */ - OR_L (EBX,EAX) /* bits |= ..[7].. << 10 */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[9][line] */ - OR_L (ECX,EAX) /* bits |= ..[8].. << 16 */ - MOV_L (REGOFF(40,ESI),EBX) /* glyphp[10] */ - SAL_L (CONST(22),EDX) /* glyphp[9][line] << 22 */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[10][line] */ - OR_L (EDX,EAX) /* bits |= ..[9].. << 22 */ - -#ifndef MSBFIRST - MOV_L (REGOFF(40,ESI),ECX) /* glyphp[10] */ - SAL_L (CONST(28),EBX) /* glyphp[10][line] << 28 */ - MOV_L (REGOFF(44,ESI),EDX) /* glyphp[11] */ - OR_L (EBX,EAX) /* bits |= ..[10].. << 28 */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[10][line] */ -#ifndef FIXEDBASE - MOV_L (EAX,REGOFF(4,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[11][line] */ -#else - MOV_L (CONST(0),ECX) - SAL_L (CONST(28),EBX) /* glyphp[10][line] << 28 */ - MOV_L (CONST(0),EDX) - OR_L (EBX,EAX) /* bits |= ..[10].. << 28 */ - MOV_B (AL,CL) - MOV_B (AH,DL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),AL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),AH) - ROL_L (CONST(16),EAX) - MOV_B (AL,CL) - MOV_B (AH,DL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),AL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),AH) - MOV_L (REGOFF(40,ESI),ECX) /* glyphp[10] */ - ROL_L (CONST(16),EAX) - MOV_L (REGOFF(44,ESI),EDX) /* glyphp[11] */ -#ifndef FIXEDBASE - MOV_L (EAX,REGOFF(4,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[10][line] */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[11][line] */ -#endif - - CMP_L (CONST(64),width_arg) - JG (.L6_3) -#ifndef FIXEDBASE - ADD_L (CONST(8),EDI) /* base+=2 */ -#endif - JMP (.L6_4) -.L6_3: - /* Note that glyphp[10][line] is read again. */ - /* EAX = bits = glyphp[10][line] >> 4 */ - SHR_L (CONST(4),ECX) /* glyphp[10][line] >> 4 */ - MOV_L (REGOFF(48,ESI),EBX) /* glyphp[12] */ - SAL_L (CONST(2),EDX) /* glyphp[11][line] << 2 */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[12][line] */ - OR_L (EDX,ECX) /* bits |= ..[11].. << 2 */ - MOV_L (REGOFF(52,ESI),EAX) /* glyphp[13] */ - SAL_L (CONST(8),EBX) /* glyphp[12][line] << 8 */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[13][line] */ - OR_L (EBX,ECX) /* bits |= ..[12].. << 8 */ - MOV_L (REGOFF(56,ESI),EDX) /* glyphp[14] */ - SAL_L (CONST(14),EAX) /* glyphp[13][line] << 14 */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[14][line] */ - OR_L (EAX,ECX) /* bits |= ..[13].. << 14 */ - MOV_L (REGOFF(60,ESI),EBX) /* glyphp[15] */ - SAL_L (CONST(20),EDX) /* glyphp[14][line] << 20 */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[15][line] */ - OR_L (EDX,ECX) /* bits |= ..[14].. << 20 */ - -#ifndef MSBFIRST - SAL_L (CONST(26),EBX) /* glyphp[15][line] << 26 */ - OR_L (EBX,ECX) /* bits |= ..[15].. << 26 */ -#ifndef FIXEDBASE - MOV_L (ECX,REGOFF(8,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (ECX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#else - MOV_L (CONST(0),EAX) - SAL_L (CONST(26),EBX) /* glyphp[15][line] << 26 */ - MOV_L (CONST(0),EDX) - OR_L (EBX,ECX) /* bits |= ..[15].. << 26 */ - MOV_B (CL,AL) - MOV_B (CH,DL) - MOV_B (REGOFF(BYTE_REVERSED,EAX),CL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),CH) - ROL_L (CONST(16),ECX) - MOV_B (CL,AL) - MOV_B (CH,DL) - MOV_B (REGOFF(BYTE_REVERSED,EAX),CL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),CH) - ROL_L (CONST(16),ECX) -#ifndef FIXEDBASE - MOV_L (ECX,REGOFF(8,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (ECX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#endif - -#ifndef FIXEDBASE - ADD_L (CONST(12),EDI) /* base += 3*/ -#endif - CMP_L (CONST(96),width_arg) - JLE (.L6_4) - ADD_L (CONST(64),ESI) /* glyphp += 16 */ - SUB_L (CONST(96),width_arg) - JMP (.L6_1) - -.L6_4: - -#ifndef FIXEDBASE - MOV_L (EDI,EAX) /* return base */ -#else - MOV_L (base_arg,EAX) /* return base */ -#endif - MOV_L (REGOFF(0,ESP),EDI) /* POPL EDI */ - MOV_L (REGOFF(4,ESP),ESI) /* POPL ESI */ - MOV_L (REGOFF(8,ESP),EBX) /* POPL EBX */ - MOV_L (REGOFF(12,ESP),EBP) /* POPL EBP */ - ADD_L (CONST(16),ESP) - RET - - - ALIGNTEXT4 - -#ifdef FIXEDBASE -# ifdef MSBFIRST - GLOBL GLNAME(DrawTETextScanlineWidth8PMSBFirstFixedBase) -GLNAME(DrawTETextScanlineWidth8PMSBFirstFixedBase): -# else - GLOBL GLNAME(DrawTETextScanlineWidth8PLSBFirstFixedBase) -GLNAME(DrawTETextScanlineWidth8PLSBFirstFixedBase): -# endif -#else -# ifdef MSBFIRST - GLOBL GLNAME(DrawTETextScanlineWidth8PMSBFirst) -GLNAME(DrawTETextScanlineWidth8PMSBFirst): -# else - GLOBL GLNAME(DrawTETextScanlineWidth8PLSBFirst) -GLNAME(DrawTETextScanlineWidth8PLSBFirst): -# endif -#endif - - SUB_L (CONST(16),ESP) - MOV_L (EBP,REGOFF(12,ESP)) /* PUSH EBP */ - MOV_L (EBX,REGOFF(8,ESP)) /* PUSH EBX */ - MOV_L (ESI,REGOFF(4,ESP)) /* PUSH ESI */ - MOV_L (EDI,REGOFF(0,ESP)) /* PUSH EDI */ - - MOV_L (line_arg,EBP) - MOV_L (base_arg,EDI) - MOV_L (glyphp_arg,ESI) - - ALIGNTEXT4 - -.L8_1: - /* Pentium-optimized instruction pairing. */ - /* EBX = bits */ - MOV_L (REGIND(ESI),EAX) /* glyphp[0] */ - MOV_L (REGOFF(4,ESI),EDX) /* glyphp[1] */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[0][line] */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[1][line] */ -#ifdef MSBFIRST - MOV_B (REGOFF(BYTE_REVERSED,EAX),BL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),BH) -#else - MOV_L (EAX,EBX) /* bits = glyph[0][line] */ - MOV_B (DL,BH) /* bits |= ..[1].. << 8 */ -#endif - - ROL_L (CONST(16),EBX) - MOV_L (REGOFF(8,ESI),EAX) /* glyphp[2] */ - MOV_L (REGOFF(12,ESI),ECX) /* glyphp[3] */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[2][line] */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[3][line] */ -#ifdef MSBFIRST - MOV_B (REGOFF(BYTE_REVERSED,EAX),BL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),BH) -#else - MOV_B (AL,BL) /* bits |= ..[2].. << 16 */ - MOV_B (CL,BH) /* bits |= ..[3].. << 24 */ -#endif - ROL_L (CONST(16),EBX) - MOV_L (EBX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ - CMP_L (CONST(32),width_arg) -#ifndef FIXEDBASE - JLE (.L8_2) -#else - JLE (.L8_3) -#endif - - MOV_L (REGOFF(16,ESI),EAX) /* glyphp[4] */ - MOV_L (REGOFF(20,ESI),EDX) /* glyphp[5] */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[4][line] */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[5][line] */ -#ifdef MSBFIRST - MOV_B (REGOFF(BYTE_REVERSED,EAX),BL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),BH) -#else - MOV_L (EAX,EBX) /* bits = glyph[4][line] */ - MOV_B (DL,BH) /* nits |= ..[5].. << 8 */ -#endif - - ROL_L (CONST(16),EBX) - MOV_L (REGOFF(24,ESI),EAX) /* glyphp[6] */ - MOV_L (REGOFF(28,ESI),ECX) /* glyphp[7] */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[6][line] */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[7][line] */ -#ifdef MSBFIRST - MOV_B (REGOFF(BYTE_REVERSED,EAX),BL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),BH) -#else - MOV_B (AL,BL) /* bits |= ..[6].. << 16 */ - MOV_B (CL,BH) /* bits |= ..[7].. << 24 */ -#endif - ROL_L (CONST(16),EBX) -#ifndef FIXEDBASE - MOV_L (EAX,REGOFF(4,EDI)) /* WRITE_IN_BIT_ORDER(base+1, bits) */ - ADD_L (CONST(8),EDI) /* base += 2 */ -#else - MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif - CMP_L (CONST(64),width_arg) - JLE (.L8_3) - ADD_L (CONST(32),ESI) /* glyphp += 8 */ - SUB_L (CONST(64),width_arg) - JMP (.L8_1) - -#ifndef FIXEDBASE -.L8_2: - ADD_L (CONST(4),EDI) /* base++ */ -.L8_3: - MOV_L (EDI,EAX) /* return base */ -#else -.L8_3: - MOV_L (base_arg,EAX) /* return base */ -#endif - MOV_L (REGOFF(0,ESP),EDI) /* POPL EDI */ - MOV_L (REGOFF(4,ESP),ESI) /* POPL ESI */ - MOV_L (REGOFF(8,ESP),EBX) /* POPL EBX */ - MOV_L (REGOFF(12,ESP),EBP) /* POPL EBP */ - ADD_L (CONST(16),ESP) - RET - - ALIGNTEXT4 - -#ifdef FIXEDBASE -# ifdef MSBFIRST - GLOBL GLNAME(DrawTETextScanlineWidth9PMSBFirstFixedBase) -GLNAME(DrawTETextScanlineWidth9PMSBFirstFixedBase): -# else - GLOBL GLNAME(DrawTETextScanlineWidth9PLSBFirstFixedBase) -GLNAME(DrawTETextScanlineWidth9PLSBFirstFixedBase): -# endif -#else -# ifdef MSBFIRST - GLOBL GLNAME(DrawTETextScanlineWidth9PMSBFirst) -GLNAME(DrawTETextScanlineWidth9PMSBFirst): -# else - GLOBL GLNAME(DrawTETextScanlineWidth9PLSBFirst) -GLNAME(DrawTETextScanlineWidth9PLSBFirst): -# endif -#endif - - SUB_L (CONST(16),ESP) - MOV_L (EBP,REGOFF(12,ESP)) /* PUSH EBP */ - MOV_L (EBX,REGOFF(8,ESP)) /* PUSH EBX */ - MOV_L (ESI,REGOFF(4,ESP)) /* PUSH ESI */ - MOV_L (EDI,REGOFF(0,ESP)) /* PUSH EDI */ - - MOV_L (line_arg,EBP) - MOV_L (base_arg,EDI) - MOV_L (glyphp_arg,ESI) - - ALIGNTEXT4 - -.L9_1: - /* Pentium-optimized instruction pairing. */ - /* EAX = bits */ - MOV_L (REGOFF(4,ESI),EBX) /* glyphp[1] */ - MOV_L (REGIND(ESI),EAX) /* glyphp[0] */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[1][line] */ - MOV_L (REGOFF(8,ESI),ECX) /* glyphp[2] */ - SAL_L (CONST(9),EBX) /* glyphp[1][line] << 9 */ - MOV_L (REGOFF(12,ESI),EDX) /* glyphp[3] */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[0][line] */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[3][line] */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[2][line] */ - OR_L (EBX,EAX) /* bits |= ..[1].. << 9 */ - SAL_L (CONST(18),ECX) /* glyphp[2][line] << 18 */ - OR_L (ECX,EAX) /* bits |= ..[2].. << 18 */ - SAL_L (CONST(27),EDX) /* glyphp[3][line << 27 */ - -#ifndef MSBFIRST - MOV_L (REGOFF(12,ESI),EBX) /* glyphp[3] */ - OR_L (EDX,EAX) /* bits |= ..[3].. << 27 */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[3][line] */ - MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (CONST(0),EBX) - OR_L (EDX,EAX) /* bits |= ..[3].. << 27 */ - MOV_L (CONST(0),ECX) - MOV_B (AL,BL) - MOV_B (AH,CL) - MOV_B (REGOFF(BYTE_REVERSED,EBX),AL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),AH) - ROL_L (CONST(16),EAX) - MOV_B (AL,BL) - MOV_B (AH,CL) - MOV_B (REGOFF(BYTE_REVERSED,EBX),AL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),AH) - MOV_L (REGOFF(12,ESI),EBX) /* glyphp[3] */ - ROL_L (CONST(16),EAX) - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[3][line] */ - MOV_L (EAX,REGIND(EDI)) -#endif - - CMP_L (CONST(32),width_arg) - JG (.L9_2) -#ifndef FIXEDBASE - ADD_L (CONST(4),EDI) /* base++ */ -#endif - JMP (.L9_11) -.L9_2: - /* Note that glyphp[3][line] is read again. */ - /* EAX = bits, EBX = glyphp[3][line] >> 5 */ - SHR_L (CONST(5),EBX) /* glyphp[3][line] >> 5 */ - MOV_L (REGOFF(16,ESI),EAX) /* glyphp[4] */ - MOV_L (REGOFF(20,ESI),ECX) /* glyphp[5] */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[4][line] */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[5][line] */ - MOV_L (REGOFF(24,ESI),EDX) /* glyphp[6] */ - SAL_L (CONST(4),EAX) /* glyphp[4][line] << 4 */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[6][line] */ - SAL_L (CONST(13),ECX) /* glyphp[5][line] << 13 */ - OR_L (EBX,EAX) /* bits |= ..[4].. << 4 */ - SAL_L (CONST(22),EDX) /* glyphp[6][line] << 22 */ - MOV_L (REGOFF(28,ESI),EBX) /* glyphp[7] */ - OR_L (ECX,EAX) /* bits |= ..[5].. << 13 */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[7][line] */ - OR_L (EDX,EAX) /* bits |= ..[6].. << 22 */ - -#ifndef MSBFIRST - MOV_L (REGOFF(28,ESI),ECX) /* glyphp[7] */ - SAL_L (CONST(31),EBX) /* glyphp[7][line] << 31 */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[7][line] */ - OR_L (EBX,EAX) /* bits |= ..[7].. << 31 */ - MOV_L (REGOFF(32,ESI),EDX) /* glyphp[8] */ -#ifndef FIXEDBASE - MOV_L (EAX,REGOFF(4,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#else - MOV_L (CONST(0),ECX) - SAL_L (CONST(31),EBX) /* glyphp[7][line] << 31 */ - MOV_L (CONST(0),EDX) - OR_L (EBX,EAX) /* bits |= ..[7].. << 31 */ - MOV_B (AL,CL) - MOV_B (AH,DL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),AL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),AH) - ROL_L (CONST(16),EAX) - MOV_B (AL,CL) - MOV_B (AH,DL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),AL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),AH) - MOV_L (REGOFF(28,ESI),ECX) /* glyphp[7] */ - ROL_L (CONST(16),EAX) - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[7][line] */ -#ifndef FIXEDBASE - MOV_L (EAX,REGOFF(4,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif - MOV_L (REGOFF(32,ESI),EDX) /* glyphp[8] */ -#endif - - CMP_L (CONST(64),width_arg) - JG (.L9_3) -#ifndef FIXEDBASE - ADD_L (CONST(8),EDI) /* base+=2 */ -#endif - JMP (.L9_11) -.L9_3: - - /* Note that glyphp[7][line] is read again. */ - /* ECX = bits = glyphp[7][line] >> 1 */ - SHR_L (CONST(1),ECX) /* glyphp[7][line] >> 1 */ - MOV_L (REGOFF(36,ESI),EBX) /* glyphp[9] */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[8][line] */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[9][line] */ - SAL_L (CONST(8),EDX) /* glyphp[8][line] << 8 */ - MOV_L (REGOFF(40,ESI),EAX) /* glyphp[10] */ - SAL_L (CONST(17),EBX) /* glyphp[9][line] << 17 */ - OR_L (EDX,ECX) /* bits |= ..[8].. << 8 */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[10][line] */ - OR_L (EBX,ECX) /* bits |= ..[9].. << 17 */ - SAL_L (CONST(26),EAX) /* glyphp[10][line] << 26 */ - -#ifndef MSBFIRST - MOV_L (REGOFF(40,ESI),EDX) /* glyphp[10] */ - OR_L (EAX,ECX) /* bits |= ..[10].. << 26 */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[10][line] */ -#ifndef FIXEDBASE - MOV_L (ECX,REGOFF(8,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (ECX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#else - MOV_L (CONST(0),EDX) - OR_L (EAX,ECX) /* bits |= ..[10].. << 26 */ - MOV_L (CONST(0),EBX) - MOV_B (CL,DL) - MOV_B (CH,BL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),CL) - MOV_B (REGOFF(BYTE_REVERSED,EBX),CH) - ROL_L (CONST(16),ECX) - MOV_B (CL,DL) - MOV_B (CH,BL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),CL) - MOV_B (REGOFF(BYTE_REVERSED,EBX),CH) - MOV_L (REGOFF(40,ESI),EDX) /* glyphp[10] */ - ROL_L (CONST(16),ECX) - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[10][line] */ -#ifndef FIXEDBASE - MOV_L (ECX,REGOFF(8,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (ECX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#endif - - CMP_L (CONST(96),width_arg) - JG (.L9_4) -#ifndef FIXEDBASE - ADD_L (CONST(12),EDI) /* base+=3 */ -#endif - JMP (.L9_11) -.L9_4: - /* Note that glyphp[10][line] is read again. */ - /* EDX = bits = glyphp[10][line] >> 6 */ - SHR_L (CONST(6),EDX) /* glyphp[10][line] >> 6 */ - MOV_L (REGOFF(44,ESI),EBX) /* glyphp[11] */ - MOV_L (REGOFF(48,ESI),EAX) /* glyphp[12] */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[11][line] */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[12][line] */ - MOV_L (REGOFF(52,ESI),ECX) /* glyphp[13] */ - SAL_L (CONST(3),EBX) /* glyphp[11][line] << 3 */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[13][line] */ - SAL_L (CONST(12),EAX) /* glyphp[12][line] << 12 */ - OR_L (EBX,EDX) /* bits |= ..[11].. << 3 */ - SAL_L (CONST(21),ECX) /* glyphp[13][line] << 21 */ - MOV_L (REGOFF(56,ESI),EBX) /* glyphp[14] */ - OR_L (EAX,EDX) /* bits |= ..[12].. << 17 */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[14][line] */ - SAL_L (CONST(30),EBX) /* glyphp[14][line] << 30 */ - OR_L (ECX,EDX) /* bits |= ..[13].. << 21 */ - -#ifndef MSBFIRST - MOV_L (REGOFF(56,ESI),EAX) /* glyphp[14] */ - OR_L (EBX,EDX) /* bits |= ..[14].. << 30 */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[14][line] */ -#ifndef FIXEDBASE - MOV_L (EDX,REGOFF(12,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EDX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#else - MOV_L (CONST(0),EAX) - OR_L (EBX,EDX) /* bits |= ..[14].. << 30 */ - MOV_L (CONST(0),ECX) - MOV_B (DL,AL) - MOV_B (DH,CL) - MOV_B (REGOFF(BYTE_REVERSED,EAX),DL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),DH) - ROL_L (CONST(16),EDX) - MOV_B (DL,AL) - MOV_B (DH,CL) - MOV_B (REGOFF(BYTE_REVERSED,EAX),DL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),DH) - MOV_L (REGOFF(56,ESI),EAX) /* glyphp[14] */ - ROL_L (CONST(16),EDX) - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[14][line] */ -#ifndef FIXEDBASE - MOV_L (EDX,REGOFF(12,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EDX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#endif - - CMP_L (CONST(128),width_arg) - JG (.L9_5) -#ifndef FIXEDBASE - ADD_L (CONST(16),EDI) /* base+=4 */ -#endif - JMP (.L9_11) -.L9_5: - /* Note that glyphp[14][line] is read again. */ - /* EAX = bits = glyphp[14][line] >> 2 */ - SHR_L (CONST(2),EAX) /* glyphp[14][line] >> 2 */ - MOV_L (REGOFF(60,ESI),ECX) /* glyphp[15] */ - MOV_L (REGOFF(64,ESI),EBX) /* glyphp[16] */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[15][line] */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[16][line] */ - MOV_L (REGOFF(68,ESI),EDX) /* glyphp[17] */ - SAL_L (CONST(7),ECX) /* glyphp[15][line] << 7 */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[17][line] */ - SAL_L (CONST(16),EBX) /* glyphp[16][line] << 16 */ - OR_L (ECX,EAX) /* bits |= ..[15].. << 7 */ - SAL_L (CONST(25),EDX) /* glyphp[17][line] << 25 */ - OR_L (EBX,EAX) /* bits |= ..[16].. << 16 */ - -#ifndef MSBFIRST - MOV_L (REGOFF(68,ESI),ECX) /* glyphp[17] */ - OR_L (EDX,EAX) /* bits |= ..[17].. << 25 */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[17][line] */ -#ifndef FIXEDBASE - MOV_L (EAX,REGOFF(16,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#else - MOV_L (CONST(0),ECX) - OR_L (EDX,EAX) /* bits |= ..[17].. << 25 */ - MOV_L (CONST(0),EBX) - MOV_B (AL,CL) - MOV_B (AH,BL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),AL) - MOV_B (REGOFF(BYTE_REVERSED,EBX),AH) - ROL_L (CONST(16),EAX) - MOV_B (AL,CL) - MOV_B (AH,BL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),AL) - MOV_B (REGOFF(BYTE_REVERSED,EBX),AH) - MOV_L (REGOFF(68,ESI),ECX) /* glyphp[17] */ - ROL_L (CONST(16),EAX) - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[17][line] */ -#ifndef FIXEDBASE - MOV_L (EAX,REGOFF(16,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#endif - - CMP_L (CONST(160),width_arg) - JG (.L9_6) -#ifndef FIXEDBASE - ADD_L (CONST(20),EDI) /* base+=5 */ -#endif - JMP (.L9_11) -.L9_6: - /* Note that glyphp[17][line] is read again. */ - /* ECX = bits = glyphp[17][line] >> 7 */ - SHR_L (CONST(7),ECX) /* glyphp[17][line] >> 7 */ - MOV_L (REGOFF(72,ESI),EBX) /* glyphp[18] */ - MOV_L (REGOFF(76,ESI),EAX) /* glyphp[19] */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[18][line] */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[19][line] */ - MOV_L (REGOFF(80,ESI),EDX) /* glyphp[20] */ - SAL_L (CONST(2),EBX) /* glyphp[18][line] << 2 */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[20][line] */ - SAL_L (CONST(11),EAX) /* glyphp[19][line] << 11 */ - OR_L (EBX,ECX) /* bits |= ..[18].. << 2 */ - SAL_L (CONST(20),EDX) /* glyphp[20][line] << 20 */ - MOV_L (REGOFF(84,ESI),EBX) /* glyphp[21] */ - OR_L (EAX,ECX) /* bits |= ..[19].. << 11 */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[21][line] */ - OR_L (EDX,ECX) /* bits |= ..[20].. << 20 */ - -#ifndef MSBFIRST - MOV_L (REGOFF(84,ESI),EAX) /* glyphp[21] */ - SAL_L (CONST(29),EBX) /* glyphp[21][line] << 29 */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[21][line] */ - OR_L (EBX,ECX) /* bits |= ..[14].. << 30 */ - MOV_L (REGOFF(88,ESI),EDX) /* glyphp[22] */ -#ifndef FIXEDBASE - MOV_L (ECX,REGOFF(20,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (ECX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#else - MOV_L (CONST(0),EAX) - SAL_L (CONST(29),EBX) /* glyphp[21][line] << 29 */ - MOV_L (CONST(0),EDX) - OR_L (EBX,ECX) /* bits |= ..[14].. << 30 */ - MOV_B (CL,AL) - MOV_B (CH,DL) - MOV_B (REGOFF(BYTE_REVERSED,EAX),CL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),CH) - ROL_L (CONST(16),ECX) - MOV_B (CL,AL) - MOV_B (CH,DL) - MOV_B (REGOFF(BYTE_REVERSED,EAX),CL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),CH) - MOV_L (REGOFF(84,ESI),EAX) /* glyphp[21] */ - ROL_L (CONST(16),ECX) - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[21][line] */ -#ifndef FIXEDBASE - MOV_L (ECX,REGOFF(20,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (ECX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif - MOV_L (REGOFF(88,ESI),EDX) /* glyphp[22] */ -#endif - - CMP_L (CONST(192),width_arg) - JG (.L9_7) -#ifndef FIXEDBASE - ADD_L (CONST(24),EDI) /* base+=6 */ -#endif - JMP (.L9_11) -.L9_7: - /* Note that glyphp[21][line] is read again. */ - /* EAX = bits = glyphp[21][line] >> 3 */ - SHR_L (CONST(3),EAX) /* glyphp[21][line] >> 3 */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[22][line] */ - MOV_L (REGOFF(92,ESI),EBX) /* glyphp[23] */ - MOV_L (REGOFF(96,ESI),ECX) /* glyphp[24] */ - SAL_L (CONST(6),EDX) /* glyphp[22][line] << 6 */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[23][line] */ - OR_L (EDX,EAX) /* bits |= ..[22].. << 6 */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[24][line] */ - SAL_L (CONST(15),EBX) /* glyphp[23][line] << 15 */ - OR_L (EBX,EAX) /* bits |= ..[23].. << 15 */ - SAL_L (CONST(24),ECX) /* glyphp[24][line] << 24 */ - -#ifndef MSBFIRST - MOV_L (REGOFF(96,ESI),EDX) /* glyphp[24] */ - OR_L (ECX,EAX) /* bits |= ..[24].. << 24 */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[24][line] */ -#ifndef FIXEDBASE - MOV_L (EAX,REGOFF(24,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#else - MOV_L (CONST(0),EDX) - OR_L (ECX,EAX) /* bits |= ..[24].. << 24 */ - MOV_L (CONST(0),EBX) - MOV_B (AL,DL) - MOV_B (AH,BL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),AL) - MOV_B (REGOFF(BYTE_REVERSED,EBX),AH) - ROL_L (CONST(16),EAX) - MOV_B (AL,DL) - MOV_B (AH,BL) - MOV_B (REGOFF(BYTE_REVERSED,EDX),AL) - MOV_B (REGOFF(BYTE_REVERSED,EBX),AH) - MOV_L (REGOFF(96,ESI),EDX) /* glyphp[24] */ - ROL_L (CONST(16),EAX) - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[24][line] */ -#ifndef FIXEDBASE - MOV_L (EAX,REGOFF(24,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EAX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#endif - - CMP_L (CONST(224),width_arg) - JG (.L9_8) -#ifndef FIXEDBASE - ADD_L (CONST(28),EDI) /* base+=7 */ -#endif - JMP (.L9_11) -.L9_8: - /* Note that glyphp[24][line] is read again. */ - /* EDX = bits = glyphp[24][line] >> 8 */ - - SHR_L (CONST(8),EDX) /* glyphp[24][line] >> 8 */ - MOV_L (REGOFF(100,ESI),EAX) /* glyphp[25] */ - MOV_L (REGOFF(104,ESI),EBX) /* glyphp[26] */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[25][line] */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[26][line] */ - MOV_L (REGOFF(108,ESI),ECX) /* glyphp[27] */ - SAL_L (CONST(1),EAX) /* glyphp[25][line] << 1 */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[27][line] */ - SAL_L (CONST(10),EBX) /* glyphp[26][line] << 10 */ - OR_L (EAX,EDX) /* bits |= ..[25].. << 1 */ - SAL_L (CONST(19),ECX) /* glyphp[27][line] << 19 */ - OR_L (EBX,EDX) /* bits |= ..[26].. << 10 */ - MOV_L (REGOFF(112,ESI),EAX) /* glyphp[28] */ - OR_L (ECX,EDX) /* bits |= ..[27].. << 19 */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[28][line] */ - -#ifndef MSBFIRST - MOV_L (REGOFF(112,ESI),EBX) /* glyphp[28] */ - SAL_L (CONST(28),EAX) /* glyphp[28][line] << 28 */ - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[28][line] */ - OR_L (EAX,EDX) /* bits |= ..[28].. << 28 */ - MOV_L (REGOFF(116,ESI),ECX) /* glyphp[29] */ -#ifndef FIXEDBASE - MOV_L (EDX,REGOFF(28,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EDX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#else - MOV_L (CONST(0),EBX) - SAL_L (CONST(28),EAX) /* glyphp[28][line] << 28 */ - MOV_L (CONST(0),ECX) - OR_L (EAX,EDX) /* bits |= ..[28].. << 28 */ - MOV_B (DL,BL) - MOV_B (DH,CL) - MOV_B (REGOFF(BYTE_REVERSED,EBX),DL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),DH) - ROL_L (CONST(16),EDX) - MOV_B (DL,BL) - MOV_B (DH,CL) - MOV_B (REGOFF(BYTE_REVERSED,EBX),DL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),DH) - MOV_L (REGOFF(112,ESI),EBX) /* glyphp[28] */ - ROL_L (CONST(16),EDX) - MOV_L (REGOFF(116,ESI),ECX) /* glyphp[29] */ -#ifndef FIXEDBASE - MOV_L (EDX,REGOFF(28,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EDX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif - MOV_L (REGBISD(EBX,EBP,4,0),EBX) /* glyphp[28][line] */ -#endif - - CMP_L (CONST(256),width_arg) - JG (.L9_9) -#ifndef FIXEDBASE - ADD_L (CONST(32),EDI) /* base+=8 */ -#endif - JMP (.L9_11) -.L9_9: - /* Note that glyphp[28][line] is read again. */ - /* EBX = bits = glyphp[28][line] >> 4 */ - SHR_L (CONST(4),EBX) /* glyphp[28][line] >> 4 */ - MOV_L (REGBISD(ECX,EBP,4,0),ECX) /* glyphp[29][line] */ - MOV_L (REGOFF(120,ESI),EAX) /* glyphp[30] */ - MOV_L (REGOFF(124,ESI),EDX) /* glyphp[31] */ - SAL_L (CONST(5),ECX) /* glyphp[29][line] << 5 */ - MOV_L (REGBISD(EAX,EBP,4,0),EAX) /* glyphp[30][line] */ - OR_L (ECX,EBX) /* bits |= ..[29].. << 5 */ - MOV_L (REGBISD(EDX,EBP,4,0),EDX) /* glyphp[31][line] */ - SAL_L (CONST(14),EAX) /* glyphp[30][line] << 14 */ - ADD_L (CONST(128),ESI) /* glyphp+=32 */ - SAL_L (CONST(23),EDX) /* glyphp[31][line] << 23 */ - OR_L (EAX,EBX) /* bits |= ..[30].. << 14 */ - SUB_L (CONST(288),width_arg) /* width-=288 */ - OR_L (EDX,EBX) /* bits |= ..[31].. << 23 */ - -#ifndef MSBFIRST -#ifndef FIXEDBASE - MOV_L (EBX,REGOFF(32,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EBX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#else - MOV_L (CONST(0),ECX) - MOV_L (CONST(0),EAX) - MOV_B (BL,CL) - MOV_B (BH,AL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),BL) - MOV_B (REGOFF(BYTE_REVERSED,EAX),BH) - ROL_L (CONST(16),EBX) - MOV_B (BL,CL) - MOV_B (BH,AL) - MOV_B (REGOFF(BYTE_REVERSED,ECX),BL) - MOV_B (REGOFF(BYTE_REVERSED,EAX),BH) - ROL_L (CONST(16),EBX) -#ifndef FIXEDBASE - MOV_L (EBX,REGOFF(32,EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#else - MOV_L (EBX,REGIND(EDI)) /* WRITE_IN_BIT_ORDER(base, bits) */ -#endif -#endif - - ADD_L (CONST(36),EDI) /* base+=9 */ - CMP_L (CONST(0),width_arg) - JG (.L9_1) - -.L9_11: -#ifndef FIXEDBASE - MOV_L (EDI,EAX) /* return base */ -#else - MOV_L (base_arg,EAX) /* return base */ -#endif - MOV_L (REGOFF(0,ESP),EDI) /* POPL EDI */ - MOV_L (REGOFF(4,ESP),ESI) /* POPL ESI */ - MOV_L (REGOFF(8,ESP),EBX) /* POPL EBX */ - MOV_L (REGOFF(12,ESP),EBP) /* POPL EBP */ - ADD_L (CONST(16),ESP) - RET diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index fb3fd544a..5a1f0e835 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -898,7 +898,7 @@ handle_mouse: break; case NSKeyDown: case NSKeyUp: - DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]); + DarwinSendKeyboardEvents((type == NSKeyDown)?KeyPress:KeyRelease, [e keyCode]); break; case NSFlagsChanged: diff --git a/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib b/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib index 8357655fe..e148055df 100644 --- a/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib +++ b/hw/xquartz/bundle/Resources/English.lproj/main.nib/designable.nib @@ -2,12 +2,13 @@ <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.02"> <data> <int key="IBDocument.SystemTarget">1050</int> - <string key="IBDocument.SystemVersion">9E17</string> + <string key="IBDocument.SystemVersion">9F10</string> <string key="IBDocument.InterfaceBuilderVersion">670</string> - <string key="IBDocument.AppKitVersion">949.33</string> + <string key="IBDocument.AppKitVersion">949.34</string> <string key="IBDocument.HIToolboxVersion">352.00</string> <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> <bool key="EncodedWithXMLCoder">YES</bool> + <integer value="351"/> </object> <object class="NSArray" key="IBDocument.PluginDependencies"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -456,7 +457,7 @@ <string key="NSWindowContentMaxSize">{3.40282e+38, 3.40282e+38}</string> <string key="NSWindowContentMinSize">{320, 240}</string> <object class="NSView" key="NSWindowView" id="941366957"> - <nil key="NSNextResponder"/> + <reference key="NSNextResponder"/> <int key="NSvFlags">256</int> <object class="NSMutableArray" key="NSSubviews"> <bool key="EncodedWithXMLCoder">YES</bool> @@ -548,7 +549,7 @@ <object class="NSTextFieldCell" key="NSCell" id="649334366"> <int key="NSCellFlags">67239424</int> <int key="NSCellFlags2">4194304</int> - <string type="base64-UTF8" key="NSContents">SG9sZCBPcHRpb24gb3IgQ29udHJvbCB3aGlsZSBjbGlja2luZyB0byBhY3RpdmF0ZSB0aGUgbWlkZGxl + <string type="base64-UTF8" key="NSContents">SG9sZCBPcHRpb24gb3IgQ29tbWFuZCB3aGlsZSBjbGlja2luZyB0byBhY3RpdmF0ZSB0aGUgbWlkZGxl IG9yIHJpZ2h0IG1vdXNlIGJ1dHRvbnMuCg</string> <reference key="NSSupport" ref="26"/> <reference key="NSControlView" ref="282885445"/> @@ -1080,6 +1081,7 @@ d2hpY2ggbWF5IHByZXZlbnQgWDExIGFwcGxpY2F0aW9ucyBmcm9tIGxhdW5jaGluZy4</string> </object> </object> <string key="NSFrameSize">{484, 280}</string> + <reference key="NSSuperview"/> </object> <string key="NSScreenRect">{{0, 0}, {1280, 938}}</string> <string key="NSMinSize">{213, 129}</string> diff --git a/hw/xquartz/darwin.c b/hw/xquartz/darwin.c index 3df1e7b57..50dcbbff6 100644 --- a/hw/xquartz/darwin.c +++ b/hw/xquartz/darwin.c @@ -900,9 +900,6 @@ xf86SetRootClip (ScreenPtr pScreen, int enable) Bool WasViewable = (Bool)(pWin->viewable); Bool anyMarked = TRUE; RegionPtr pOldClip = NULL, bsExposed; -#ifdef DO_SAVE_UNDERS - Bool dosave = FALSE; -#endif WindowPtr pLayerWin; BoxRec box; @@ -973,12 +970,6 @@ xf86SetRootClip (ScreenPtr pScreen, int enable) anyMarked = TRUE; } -#ifdef DO_SAVE_UNDERS - if (DO_SAVE_UNDERS(pWin)) - { - dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); - } -#endif /* DO_SAVE_UNDERS */ if (anyMarked) (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); @@ -1010,10 +1001,6 @@ xf86SetRootClip (ScreenPtr pScreen, int enable) { if (anyMarked) (*pScreen->HandleExposures)(pWin); -#ifdef DO_SAVE_UNDERS - if (dosave) - (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin); -#endif /* DO_SAVE_UNDERS */ if (anyMarked && pScreen->PostValidateTree) (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther); } diff --git a/hw/xquartz/darwinEvents.c b/hw/xquartz/darwinEvents.c index b731c72c3..2b8e8de1b 100644 --- a/hw/xquartz/darwinEvents.c +++ b/hw/xquartz/darwinEvents.c @@ -77,7 +77,7 @@ in this Software without prior written authorization from The Open Group. /* FIXME: Abstract this better */ void QuartzModeEQInit(void); -static int old_flags = 0; // last known modifier state +static int modifier_flags = 0; // last known modifier state #define FD_ADD_MAX 128 static int fd_add[FD_ADD_MAX]; @@ -140,43 +140,49 @@ static inline void darwinEvents_unlock(void) { /* * DarwinPressModifierMask - * Press or release the given modifier key, specified by its mask. + * Press or release the given modifier key, specified by its mask (one of NX_*MASK constants) */ -static void DarwinPressModifierMask( - int pressed, - int mask) // one of NX_*MASK constants -{ +static void DarwinPressModifierMask(int pressed, int mask) { + int keycode; int key = DarwinModifierNXMaskToNXKey(mask); if (key != -1) { - int keycode = DarwinModifierNXKeyToNXKeycode(key, 0); + keycode = DarwinModifierNXKeyToNXKeycode(key, 0); if (keycode != 0) - DarwinSendKeyboardEvents(pressed, keycode); + DarwinSendKeyboardEvents(pressed, keycode); } } #ifdef NX_DEVICELCTLKEYMASK #define CONTROL_MASK(flags) (flags & (NX_DEVICELCTLKEYMASK|NX_DEVICERCTLKEYMASK)) +#define NX_CONTROLMASK_FULL (NX_CONTROLMASK | NX_DEVICELCTLKEYMASK | NX_DEVICERCTLKEYMASK) #else #define CONTROL_MASK(flags) (NX_CONTROLMASK) +#define NX_CONTROLMASK_FULL NX_CONTROLMASK #endif /* NX_DEVICELCTLKEYMASK */ #ifdef NX_DEVICELSHIFTKEYMASK #define SHIFT_MASK(flags) (flags & (NX_DEVICELSHIFTKEYMASK|NX_DEVICERSHIFTKEYMASK)) +#define NX_SHIFTMASK_FULL (NX_SHIFTMASK | NX_DEVICELSHIFTKEYMASK | NX_DEVICERSHIFTKEYMASK) #else #define SHIFT_MASK(flags) (NX_SHIFTMASK) +#define NX_SHIFTMASK_FULL NX_SHIFTMASK #endif /* NX_DEVICELSHIFTKEYMASK */ #ifdef NX_DEVICELCMDKEYMASK #define COMMAND_MASK(flags) (flags & (NX_DEVICELCMDKEYMASK|NX_DEVICERCMDKEYMASK)) +#define NX_COMMANDMASK_FULL (NX_COMMANDMASK | NX_DEVICELCMDKEYMASK | NX_DEVICERCMDKEYMASK) #else #define COMMAND_MASK(flags) (NX_COMMANDMASK) +#define NX_COMMANDMASK_FULL NX_COMMANDMASK #endif /* NX_DEVICELCMDKEYMASK */ #ifdef NX_DEVICELALTKEYMASK #define ALTERNATE_MASK(flags) (flags & (NX_DEVICELALTKEYMASK|NX_DEVICERALTKEYMASK)) +#define NX_ALTERNATEMASK_FULL (NX_ALTERNATEMASK | NX_DEVICELALTKEYMASK | NX_DEVICERALTKEYMASK) #else #define ALTERNATE_MASK(flags) (NX_ALTERNATEMASK) +#define NX_ALTERNATEMASK_FULL NX_ALTERNATEMASK #endif /* NX_DEVICELALTKEYMASK */ /* @@ -190,16 +196,16 @@ static void DarwinUpdateModifiers( if (flags & NX_ALPHASHIFTMASK) { DarwinPressModifierMask(pressed, NX_ALPHASHIFTMASK); } - if (flags & NX_COMMANDMASK) { + if (flags & NX_COMMANDMASK_FULL) { DarwinPressModifierMask(pressed, COMMAND_MASK(flags)); } - if (flags & NX_CONTROLMASK) { + if (flags & NX_CONTROLMASK_FULL) { DarwinPressModifierMask(pressed, CONTROL_MASK(flags)); } - if (flags & NX_ALTERNATEMASK) { + if (flags & NX_ALTERNATEMASK_FULL) { DarwinPressModifierMask(pressed, ALTERNATE_MASK(flags)); } - if (flags & NX_SHIFTMASK) { + if (flags & NX_SHIFTMASK_FULL) { DarwinPressModifierMask(pressed, SHIFT_MASK(flags)); } if (flags & NX_SECONDARYFNMASK) { @@ -214,45 +220,10 @@ static void DarwinUpdateModifiers( * are held down during a "context" switch -- otherwise, we would miss the KeyUp. */ static void DarwinReleaseModifiers(void) { + ErrorF("DarwinReleaseModifiers\n"); DarwinUpdateModifiers(KeyRelease, COMMAND_MASK(-1) | CONTROL_MASK(-1) | ALTERNATE_MASK(-1) | SHIFT_MASK(-1)); } -/* - * DarwinSimulateMouseClick - * Send a mouse click to X when multiple mouse buttons are simulated - * with modifier-clicks, such as command-click for button 2. The dix - * layer is told that the previously pressed modifier key(s) are - * released, the simulated click event is sent. After the mouse button - * is released, the modifier keys are reverted to their actual state, - * which may or may not be pressed at that point. This is usually - * closest to what the user wants. Ie. the user typically wants to - * simulate a button 2 press instead of Command-button 2. - */ -static void DarwinSimulateMouseClick( - int pointer_x, - int pointer_y, - float pressure, - float tilt_x, - float tilt_y, - int whichButton, // mouse button to be pressed - int modifierMask) // modifiers used for the fake click -{ - // first fool X into forgetting about the keys - // for some reason, it's not enough to tell X we released the Command key -- - // it has to be the *left* Command key. - if (modifierMask & NX_COMMANDMASK) modifierMask |=NX_DEVICELCMDKEYMASK ; - DarwinUpdateModifiers(KeyRelease, modifierMask); - - // push the mouse button - DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y, - pressure, tilt_x, tilt_y); - DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y, - pressure, tilt_x, tilt_y); - - // restore old modifiers - DarwinUpdateModifiers(KeyPress, modifierMask); -} - /* Generic handler for Xquartz-specifc events. When possible, these should be moved into their own individual functions and set as handlers using mieqSetHandler. */ @@ -475,7 +446,6 @@ static void DarwinPrepareValuators(int *valuators, ScreenPtr screen, void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y, float pressure, float tilt_x, float tilt_y) { static int darwinFakeMouseButtonDown = 0; - static int darwinFakeMouseButtonMask = 0; int i, num_events; DeviceIntPtr dev; ScreenPtr screen; @@ -499,35 +469,27 @@ void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int poin return; } + /* Handle fake click */ if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) { - // Mimic multi-button mouse with modifier-clicks - // If both sets of modifiers are pressed, - // button 2 is clicked. - if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) { - DarwinSimulateMouseClick(pointer_x, pointer_y, pressure, - tilt_x, tilt_y, 2, darwinFakeMouse2Mask); + if(darwinFakeMouseButtonDown != 0) { + /* We're currently "down" with another button, so release it first */ + DarwinSendPointerEvents(ButtonRelease, darwinFakeMouseButtonDown, pointer_x, pointer_y, pressure, tilt_x, tilt_y); + darwinFakeMouseButtonDown=0; + } + if ((modifier_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) { + ev_button = 2; darwinFakeMouseButtonDown = 2; - darwinFakeMouseButtonMask = darwinFakeMouse2Mask; - return; - } else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) { - DarwinSimulateMouseClick(pointer_x, pointer_y, pressure, - tilt_x, tilt_y, 3, darwinFakeMouse3Mask); + } else if ((modifier_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) { + ev_button = 3; darwinFakeMouseButtonDown = 3; - darwinFakeMouseButtonMask = darwinFakeMouse3Mask; - return; } } - if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) { - // If last mousedown was a fake click, don't check for - // mouse modifiers here. The user may have released the - // modifiers before the mouse button. - ev_button = darwinFakeMouseButtonDown; - darwinFakeMouseButtonDown = 0; - // Bring modifiers back up to date - DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags); - darwinFakeMouseButtonMask = 0; - return; + if (ev_type == ButtonRelease && ev_button == 1) { + if(darwinFakeMouseButtonDown) { + ev_button = darwinFakeMouseButtonDown; + darwinFakeMouseButtonDown = 0; + } } DarwinPrepareValuators(valuators, screen, pointer_x, pointer_y, pressure, tilt_x, tilt_y); @@ -547,7 +509,7 @@ void DarwinSendKeyboardEvents(int ev_type, int keycode) { return; } - if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) { + if (modifier_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) { /* See if keymap has changed. */ static unsigned int last_seed; @@ -627,9 +589,9 @@ void DarwinSendScrollEvents(float count_x, float count_y, /* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to reflect changing modifier flags (alt, control, meta, etc) */ void DarwinUpdateModKeys(int flags) { - DarwinUpdateModifiers(KeyRelease, old_flags & ~flags); - DarwinUpdateModifiers(KeyPress, ~old_flags & flags); - old_flags = flags; + DarwinUpdateModifiers(KeyRelease, modifier_flags & ~flags); + DarwinUpdateModifiers(KeyPress, ~modifier_flags & flags); + modifier_flags = flags; } /* |