diff options
author | kem <kem> | 2000-02-22 15:37:57 +0000 |
---|---|---|
committer | kem <kem> | 2000-02-22 15:37:57 +0000 |
commit | 3033c9bfc1f7d29d3c87214d33cb9c5a5bbd22f9 (patch) | |
tree | a0726451c24e98fda169a2528118b7b2315d3ca7 /xc/programs/Xserver/hw/xfree86/common | |
parent | aaf0250c05ea51b0b850b2b4675d611faccb0fe7 (diff) |
Import of XFree86 3.9.18X_3_9_18
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/common')
28 files changed, 3618 insertions, 1268 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/common/Imakefile b/xc/programs/Xserver/hw/xfree86/common/Imakefile index c126bb805..c6fc95405 100644 --- a/xc/programs/Xserver/hw/xfree86/common/Imakefile +++ b/xc/programs/Xserver/hw/xfree86/common/Imakefile @@ -4,7 +4,7 @@ XCOMM $XConsortium: Imakefile /main/34 1996/10/27 11:05:08 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.109 1999/12/03 19:17:21 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.112 2000/02/12 20:45:17 dawes Exp $ @@ -17,7 +17,7 @@ XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.109 1999/12/ KBD = xf86KbdMach #endif /* GNUMachArchitecture */ #else -# ifdef i386BsdArchitecture +# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) KBD = xf86KbdBSD # else # ifdef LinuxArchitecture @@ -75,6 +75,7 @@ EXP_FORCE_DEFINES = -DSHOW_BETA_MESSAGE -DEXPIRE_SERVER #endif SRCS = \ + xf86Configure.c \ xf86Bus.c \ xf86isaBus.c \ xf86pciBus.c \ @@ -98,6 +99,7 @@ SRCS = \ xf86fbman.c \ xf86xv.c \ xf86cmap.c\ + xf86PM.c \ $(KBD).c \ $(XF86_XINPUT_SRC) \ $(XINPUT_DEV_SRCS) \ @@ -106,6 +108,7 @@ SRCS = \ $(SERVERSRCS) OBJS = \ + xf86Configure.o \ xf86Bus.o \ xf86isaBus.o \ xf86pciBus.o \ @@ -127,6 +130,7 @@ OBJS = \ xf86fbman.o \ xf86xv.o \ xf86cmap.o\ + xf86PM.o \ $(XF86_XINPUT_OBJ) \ $(XKBDDXOBJ) \ $(BETAOBJ) \ @@ -143,7 +147,8 @@ OFILES = \ -I$(XINCLUDESRC) -I$(SERVERSRC)/Xext -I$(EXTINCSRC) \ -I$(SERVERSRC)/Xi -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ -I$(FONTLIBSRC)/include -I$(XF86SRC) -I$(XF86PARSERSRC) \ - -I$(XF86SRC)/loader $(VGAINCLUDES) -I$(XF86SRC)/rac + -I$(XF86SRC)/loader $(VGAINCLUDES) -I$(XF86SRC)/rac \ + -I$(XF86SRC)/scanpci diff --git a/xc/programs/Xserver/hw/xfree86/common/atKeynames.h b/xc/programs/Xserver/hw/xfree86/common/atKeynames.h index 745481e85..747fb5b57 100644 --- a/xc/programs/Xserver/hw/xfree86/common/atKeynames.h +++ b/xc/programs/Xserver/hw/xfree86/common/atKeynames.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.11 1999/04/29 05:12:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.13 2000/02/09 22:00:05 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -29,9 +29,10 @@ #define XK_TECHNICAL #define XK_KATAKANA #include "keysym.h" +#include "XF86keysym.h" #define GLYPHS_PER_KEY 4 -#define NUM_KEYCODES 127 +#define NUM_KEYCODES 248 #define MIN_KEYCODE 8 #define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) @@ -44,8 +45,6 @@ #define KeyPressed(k) (keyc->down[k >> 3] & (1 << (k & 7))) #define ModifierDown(k) ((keyc->state & (k)) == (k)) -#define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */ - /* * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three) * sets of scancodes. Set3 can only be generated by a MF keyboard. diff --git a/xc/programs/Xserver/hw/xfree86/common/compiler.h b/xc/programs/Xserver/hw/xfree86/common/compiler.h index e6b6678c1..b130d7c11 100644 --- a/xc/programs/Xserver/hw/xfree86/common/compiler.h +++ b/xc/programs/Xserver/hw/xfree86/common/compiler.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.47 1999/12/27 00:39:41 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.55 2000/02/21 18:05:44 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -135,7 +135,9 @@ extern int testinx(unsigned short, unsigned char); #ifdef __GNUC__ -#if defined(linux) && defined(__alpha__) +#if (defined(linux) || defined(__FreeBSD__)) && defined(__alpha__) + +#ifdef linux /* for Linux on Alpha, we use the LIBC _inx/_outx routines */ /* note that the appropriate setup via "ioperm" needs to be done */ /* *before* any inx/outx is done. */ @@ -182,6 +184,22 @@ inl(unsigned short port) return _inl(port); } +#endif /* linux */ + +#if defined(__FreeBSD__) && !defined(DO_PROTOTYPES) + +/* for FreeBSD on Alpha, we use the libio inx/outx routines */ +/* note that the appropriate setup via "ioperm" needs to be done */ +/* *before* any inx/outx is done. */ + +extern void outb(unsigned int port, unsigned char val); +extern void outw(unsigned int port, unsigned short val); +extern void outl(unsigned int port, unsigned int val); +extern unsigned char inb(unsigned int port); +extern unsigned short inw(unsigned int port); +extern unsigned int inl(unsigned int port); + +#endif /* __FreeBSD__ && !DO_PROTOTYPES */ /* * inline functions to do unaligned accesses @@ -554,7 +572,7 @@ outw(unsigned short port, unsigned short value) "sthbrx %0,%1,%2\n\t" "eieio" : - : "r" (value), "r" (ioBase), "r" (port) + : "r" (value), "b" (ioBase), "r" (port) : "memory" ); } @@ -566,7 +584,7 @@ outl(unsigned short port, unsigned int value) "stwbrx %0,%1,%2\n\t" "eieio" : - : "r" (value), "r" (ioBase), "r" (port) + : "r" (value), "b" (ioBase), "r" (port) : "memory" ); } @@ -589,7 +607,7 @@ inw(unsigned short port) __asm__ ("lhbrx %0,%1,%2\n\t" "eieio" : "=r" (val) - : "r" (ioBase), "r" (port) + : "b" (ioBase), "r" (port) ); return(val); } @@ -602,7 +620,7 @@ inl(unsigned short port) __asm__ ("lwbrx %0,%1,%2\n\t" "eieio" : "=r" (val) - : "r" (ioBase), "r" (port) + : "b" (ioBase), "r" (port) ); return(val); } @@ -1124,6 +1142,19 @@ extern void outl(unsigned int a, unsigned char l); # endif # ifndef PC98 # ifndef SCO325 +# if defined(USL) +# if defined(IN_MODULE) +# /* avoid including <sys/types.h> for <sys/inline.h> on UnixWare */ +# define ushort unsigned short +# define ushort_t unsigned short +# define ulong unsigned long +# define ulong_t unsigned long +# define uint_t unsigned int +# define uchar_t unsigned char +# else +# include <sys/types.h> +# endif /* IN_MODULE */ +# endif /* USL */ # include <sys/inline.h> # else # include "scoasm.h" @@ -1430,8 +1461,11 @@ extern void outl(unsigned port, unsigned val); #define ldq_u(p) (*((unsigned long *)(p))) #define ldl_u(p) (*((unsigned int *)(p))) #define ldw_u(p) (*((unsigned short *)(p))) +#undef stq_u #define stq_u(v,p) ((unsigned long *)(p)) = (v) +#undef stl_u #define stl_u(v,p) ((unsigned int *)(p)) = (v) +#undef stw_u #define stw_u(v,p) ((unsigned short *)(p)) = (v) #define mem_barrier() /* NOP */ #define write_mem_barrier() /* NOP */ @@ -1563,12 +1597,36 @@ testinx(unsigned short port, unsigned char ind) /* Some macros to hide the system dependencies for MMIO accesses */ #ifdef __alpha__ -#define MMIO_IN8(base, offset) xf86ReadSparse8(base, offset) -#define MMIO_IN16(base, offset) xf86ReadSparse16(base, offset) -#define MMIO_IN32(base, offset) xf86ReadSparse32(base, offset) -#define MMIO_OUT8(base, offset, val) xf86WriteSparse8(val, base, offset) -#define MMIO_OUT16(base, offset, val) xf86WriteSparse16(val, base, offset) -#define MMIO_OUT32(base, offset, val) xf86WriteSparse32(val, base, offset) +extern void (*xf86WriteMmio8)(int Value, void *Base, unsigned long Offset); +extern void (*xf86WriteMmio16)(int Value, void *Base, unsigned long Offset); +extern void (*xf86WriteMmio32)(int Value, void *Base, unsigned long Offset); +extern void (*xf86WriteMmioNB8)(int Value, void *Base, unsigned long Offset); +extern void (*xf86WriteMmioNB16)(int Value, void *Base, unsigned long Offset); +extern void (*xf86WriteMmioNB32)(int Value, void *Base, unsigned long Offset); +extern int (*xf86ReadMmio8)(void *Base, unsigned long Offset); +extern int (*xf86ReadMmio16)(void *Base, unsigned long Offset); +extern int (*xf86ReadMmio32)(void *Base, unsigned long Offset); + +#define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset) +#define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset) +# if defined (JENSEN_SUPPORT) +#define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset) +#define MMIO_OUT32(base, offset, val) (*xf86WriteMmio32)(val, base, offset) +#define MMIO_ONB32(base, offset, val) (*xf86WriteMmioNB32)(val, base, offset) +# else +#define MMIO_IN32(base, offset) \ + *(volatile CARD32 *)(((CARD8*)(base)) + (offset)) +#define MMIO_OUT32(base, offset, val) do { \ + *(volatile CARD32 *)(((CARD8*)(base)) + (offset)) = (val);\ + write_mem_barrier();\ + } while (0) +#define MMIO_ONB32(base, offset, val) \ + *(volatile CARD32 *)(((CARD8*)(base)) + (offset)) = (val) +# endif +#define MMIO_OUT8(base, offset, val) (*xf86WriteMmio8)(val, base, offset) +#define MMIO_OUT16(base, offset, val) (*xf86WriteMmio16)(val, base, offset) +#define MMIO_ONB8(base, offset, val) (*xf86WriteMmioNB8)(val, base, offset) +#define MMIO_ONB16(base, offset, val) (*xf86WriteMmioNB16)(val, base, offset) #else /* !__alpha__ */ #define MMIO_IN8(base, offset) *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) #define MMIO_IN16(base, offset) *(volatile CARD16 *)(((CARD8*)(base)) + (offset)) @@ -1576,6 +1634,9 @@ testinx(unsigned short port, unsigned char ind) #define MMIO_OUT8(base, offset, val) *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) = (val) #define MMIO_OUT16(base, offset, val) *(volatile CARD16 *)(((CARD8*)(base)) + (offset)) = (val) #define MMIO_OUT32(base, offset, val) *(volatile CARD32 *)(((CARD8*)(base)) + (offset)) = (val) +#define MMIO_ONB8(base, offset, val) MMIO_OUT8(base, offset, val) +#define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val) +#define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val) #endif /* __alpha__ */ /* diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86.h b/xc/programs/Xserver/hw/xfree86/common/xf86.h index 212d3a2fd..5cea1c84b 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.120 1999/12/03 19:17:21 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.128 2000/02/21 19:22:51 dawes Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -22,6 +22,10 @@ #include "propertyst.h" /* General parameters */ +extern int xf86DoConfigure; +extern int FoundPciCards; +extern pciVideoPtr ConfiguredPciCard; +extern int ConfiguredIsaCard; extern int xf86ScreenIndex; /* Index into pScreen.devPrivates */ extern int xf86CreateRootWindowIndex; /* Index into pScreen.devPrivates */ extern int xf86PixmapIndex; @@ -29,6 +33,7 @@ extern Bool xf86ResAccessEnter; extern ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */ extern const unsigned char byte_reversed[256]; extern PropertyPtr *xf86RegisteredPropertiesTable; +extern ScrnInfoPtr xf86CurrentScreen; #define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr)) @@ -82,6 +87,7 @@ void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex); void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex); EntityInfoPtr xf86GetEntityInfo(int entityIndex); pciVideoPtr xf86GetPciInfoForEntity(int entityIndex); +int xf86GetEntityForPciInfo(pciVideoPtr pvp); Bool xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter, EntityProc leave, pointer); void xf86DeallocateResourcesForEntity(int entityIndex, long type); @@ -107,6 +113,16 @@ Bool xf86IsPciDevPresent(int bus, int dev, int func); ScrnInfoPtr xf86FindScreenForEntity(int entityIndex); Bool xf86NoSharedMem(int screenIndex); resPtr xf86FindIntersectOfLists(resPtr l1, resPtr l2); +pciVideoPtr xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID, + char n, pciVideoPtr pvp_exclude); +pciVideoPtr xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class, + char n, pciVideoPtr pvp_exclude); +void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg); +Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func); +#ifdef async +Bool xf86QueueAsyncEvent(void (*func)(pointer),pointer arg); +#endif + /* xf86Cursor.c */ @@ -131,7 +147,7 @@ Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, void SetTimeSinceLastInputEvent(void); pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data); -void xf86RemoveInputHandler(pointer handler); +int xf86RemoveInputHandler(pointer handler); void xf86DisableInputHandler(pointer handler); void xf86EnableInputHandler(pointer handler); @@ -151,7 +167,7 @@ Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual); Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma gamma); void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y); void xf86SetBlackWhitePixels(ScreenPtr pScreen); -Bool xf86SaveRestoreImage(int scrnIndex, SaveRestoreFlags what); +void xf86EnableDisableFBAccess(int scrnIndex, Bool enable); void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, const char *format, va_list args); void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, @@ -200,11 +216,26 @@ Bool xf86GetModInDevEnabled(void); Bool xf86GetAllowMouseOpenFail(void); Bool xf86IsPc98(void); pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name); +Bool xf86LoaderCheckSymbol(const char *name); void xf86LoaderReqSymLists(const char **, ...); void xf86LoaderReqSymbols(const char *, ...); -void xf86Break1(void); +/* debugging */ + void xf86Break1(void); void xf86Break2(void); void xf86Break3(void); +CARD8 xf86PeekFb8(CARD8 *p); +CARD16 xf86PeekFb16(CARD16 *p); +CARD32 xf86PeekFb32(CARD32 *p); +void xf86PokeFb8(CARD8 *p, CARD8 v); +void xf86PokeFb16(CARD16 *p, CARD16 v); +void xf86PokeFb32(CARD16 *p, CARD32 v); +CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset); +CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset); +CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset); +void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v); +void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v); +void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v); + void xf86SetBackingStore(ScreenPtr pScreen); void xf86SetSilkenMouse(ScreenPtr pScreen); int xf86NewSerialNumber(WindowPtr p, pointer unused); @@ -228,9 +259,10 @@ void xf86ConfigIsaEntityInactive(EntityInfoPtr pEnt, IsaChipsets *i_chip, EntityProc enter, EntityProc leave, pointer private); Bool xf86IsScreenPrimary(int scrnIndex); -extern int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, +int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, int format, unsigned long len, pointer value); +Bool xf86IsUnblank(int mode); /* xf86Init.c */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c index 88d88916f..e80fc27f9 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.41 1999/12/03 19:17:21 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.43 2000/02/12 23:59:09 eich Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. */ @@ -39,8 +39,6 @@ BusRec primaryBus = { BUS_NONE, {{0}}}; Bool xf86ResAccessEnter = FALSE; -int xf86EstimateSizesAggressively = 0; - #ifdef REDUCER /* Resources that temporarily conflict with estimated resources */ static resPtr AccReducers = NULL; @@ -67,6 +65,10 @@ resRange res8514Shared[] = {_8514_SHARED, _END}; /* Flag: do we need RAC ? */ static Bool needRAC = FALSE; +/* state change notification callback list */ +static StateChangeNotificationPtr StateChangeNotificationList; +static void notifyStateChange(xf86NotifyState state); + #undef MIN #define MIN(x,y) ((x<y)?x:y) @@ -414,6 +416,21 @@ disableAccess(void) } } +static void +clearAccess(void) +{ + int i; + + /* call disable funcs and reset current access pointer */ + /* the entity specific access funcs are in an enabled */ + /* state - driver must restore their state explicitely */ + for (i = 0; i < xf86NumScreens; i++) { + xf86Screens[i]->CurrentAccess->pIoAccess = NULL; + xf86Screens[i]->CurrentAccess->pMemAccess = NULL; + } + +} + /* * Generic interface to bus specific code - add other buses here */ @@ -452,6 +469,7 @@ xf86AccessEnter(void) PciStateEnter(); disableAccess(); EntityEnter(); + notifyStateChange(NOTIFY_ENTER); xf86EnterServerState(SETUP); xf86ResAccessEnter = TRUE; } @@ -470,6 +488,7 @@ xf86AccessLeave(void) { if (!xf86ResAccessEnter) return; + notifyStateChange(NOTIFY_LEAVE); disableAccess(); DisablePciBusAccess(); EntityLeave(); @@ -499,6 +518,33 @@ xf86AccessLeaveState(void) * Otherwise resources needed for access control might be shadowed * by other resources! */ +#ifdef async + +static AsyncQPtr *AsyncQ = NULL; +ScrnInfoPtr xf86CurrentScreen = NULL; + +#define SETUP_Q org = AsyncQ; \ + AsyncQ = &new; + +#define PROCESS_Q xf86CurrentScreen = pScrn; + if (!new) AsyncQ = org; \ + else { \ + AsyncQPtr tmp_Q; \ + while (1) {\ + new->func(new->arg);\ + if (!(new->next)) {\ + AsyncQ = org; xfree(new); break; \ + } \ + tmp_Q = new->next; \ + xfree(new); \ + new = tmp_Q; \ + } \ + } +#else +#define SETUP_Q +#define PROCESS_Q +#endif + void xf86EnableAccess(ScrnInfoPtr pScrn) { @@ -506,14 +552,21 @@ xf86EnableAccess(ScrnInfoPtr pScrn) register EntityAccessPtr pceAcc; register xf86AccessPtr pAcc; EntityAccessPtr tmp; +#ifdef async + AsyncQPtr *org, new = NULL; +#endif + #ifdef DEBUG ErrorF("Enable access %i\n",pScrn->scrnIndex); #endif /* Entity is not under access control or currently enabled */ if (!pScrn->access) { - if (pScrn->busAccess) + if (pScrn->busAccess) { + SETUP_Q; ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess); + PROCESS_Q; + } return; } @@ -523,6 +576,7 @@ xf86EnableAccess(ScrnInfoPtr pScrn) if (peAcc == pceAcc) { return; } + SETUP_Q; if (pScrn->CurrentAccess->pMemAccess == pceAcc) pScrn->CurrentAccess->pMemAccess = NULL; while (pceAcc) { @@ -540,11 +594,13 @@ xf86EnableAccess(ScrnInfoPtr pScrn) peAcc = peAcc->next; } pScrn->CurrentAccess->pIoAccess = (EntityAccessPtr) pScrn->access; + PROCESS_Q; return; case MEM_IO: pceAcc = pScrn->CurrentAccess->pIoAccess; if (peAcc != pceAcc) { /* current Io != pAccess */ + SETUP_Q; tmp = pceAcc; while (pceAcc) { pAcc = pceAcc->pAccess; @@ -567,6 +623,7 @@ xf86EnableAccess(ScrnInfoPtr pScrn) if (pceAcc == peAcc) { /* current Mem == pAccess */ return; } + SETUP_Q; while (pceAcc) { /* current Mem != pAccess */ pAcc = pceAcc->pAccess; if (pAcc && pAcc->AccessDisable) @@ -584,6 +641,7 @@ xf86EnableAccess(ScrnInfoPtr pScrn) } pScrn->CurrentAccess->pMemAccess = pScrn->CurrentAccess->pIoAccess = (EntityAccessPtr) pScrn->access; + PROCESS_Q; return; case MEM: @@ -591,6 +649,7 @@ xf86EnableAccess(ScrnInfoPtr pScrn) if (peAcc == pceAcc) { return; } + SETUP_Q; if (pScrn->CurrentAccess->pIoAccess == pceAcc) pScrn->CurrentAccess->pIoAccess = NULL; while (pceAcc) { @@ -608,11 +667,15 @@ xf86EnableAccess(ScrnInfoPtr pScrn) peAcc = peAcc->next; } pScrn->CurrentAccess->pMemAccess = (EntityAccessPtr) pScrn->access; + PROCESS_Q; return; case NONE: - if (pScrn->busAccess) + if (pScrn->busAccess) { + SETUP_Q; ((BusAccPtr)pScrn->busAccess)->set_f(pScrn->busAccess); + PROCESS_Q; + } return; } } @@ -1150,12 +1213,12 @@ xf86ResourceBrokerInit(void) resPtr osRes = NULL; /* Get the addressable ranges */ - ResRange = xf86AccWindowsFromOS(); - xf86MsgVerb(X_INFO, 3, "Addressable resource ranges are\n"); + ResRange = xf86BusAccWindowsFromOS(); + xf86MsgVerb(X_INFO, 3, "Addressable bus resource ranges are\n"); xf86PrintResList(3, ResRange); /* Get the ranges used exclusively by the system */ - osRes = xf86AccResFromOS(osRes); + osRes = xf86AccResFromOS(osRes); /*these need to be in host address space*/ xf86MsgVerb(X_INFO, 3, "OS-reported resource ranges:\n"); xf86PrintResList(3, osRes); @@ -1461,6 +1524,25 @@ xf86GetResourcesImplicitly(int entityIndex) return NULL; } +static void +convertRange2Host(int entityIndex, resRange *pRange) +{ + if (pRange->type & ResBus) { + pRange->type &= ~ResBus; + + switch (xf86Entities[entityIndex]->busType) { + case BUS_PCI: + pciConvertRange2Host(entityIndex,pRange); + break; + case BUS_ISA: + isaConvertRange2Host(pRange); + break; + default: + break; + } + } +} + /* * xf86RegisterResources() -- attempts to register listed resources. * If list is NULL it tries to obtain resources implicitly. Function @@ -1474,10 +1556,16 @@ xf86RegisterResources(int entityIndex, resList list, int access) if (!list) { list = xf86GetResourcesImplicitly(entityIndex); + /* these resources have to be in host address space already */ if (!list) return NULL; } + while(list->type != ResEnd) { range = *list; + + if (range.type & ResBus) + convertRange2Host(entityIndex,&range); + if ((access != ResNone) && (access & ResAccMask)) { range.type = (range.type & ~ResAccMask) | (access & ResAccMask); } @@ -1504,7 +1592,7 @@ xf86RegisterResources(int entityIndex, resList list, int access) /* * Server State */ - +#ifdef notanymore1 static xf86AccessPtr busTypeSpecific(EntityPtr pEnt, xf86State state) { @@ -1657,10 +1745,176 @@ setAccess(EntityPtr pEnt, xf86State state) /* unless they are handeled locally and disabled otherwise */ } } +#endif + +static void +busTypeSpecific(EntityPtr pEnt, xf86State state, xf86AccessPtr *acc_mem, + xf86AccessPtr *acc_io, xf86AccessPtr *acc_mem_io) +{ + pciAccPtr *ppaccp; + + switch (pEnt->bus.type) { + case BUS_ISA: + *acc_mem = *acc_io = *acc_mem_io = &AccessNULL; + break; + break; + case BUS_PCI: + ppaccp = xf86PciAccInfo; + while (*ppaccp) { + if ((*ppaccp)->busnum == pEnt->pciBusId.bus + && (*ppaccp)->devnum == pEnt->pciBusId.device + && (*ppaccp)->funcnum == pEnt->pciBusId.func) { + *acc_io = &(*ppaccp)->ioAccess; + *acc_mem = &(*ppaccp)->memAccess; + *acc_mem_io = &(*ppaccp)->io_memAccess; + break; + } + ppaccp++; + } + break; + default: + *acc_mem = *acc_io = *acc_mem_io = NULL; + break; + } + return; +} + +static void +setAccess(EntityPtr pEnt, xf86State state) +{ + + xf86AccessPtr acc_mem, acc_io, acc_mem_io; + xf86AccessPtr org_mem = NULL, org_io = NULL, org_mem_io = NULL; + int prop; + + busTypeSpecific(pEnt,state,&acc_mem,&acc_io,&acc_mem_io); + + /* The replacement function needs to handle _all_ shared resources */ + /* unless they are handeled locally and disabled otherwise */ + if (pEnt->rac) { + if (pEnt->rac->io_new) { + org_io = acc_io; + acc_io = pEnt->rac->io_new; + } + if (pEnt->rac->mem_new) { + org_mem = acc_mem; + acc_mem = pEnt->rac->mem_new; + } + if (pEnt->rac->io_mem_new) { + org_mem_io = acc_mem_io; + acc_mem_io = pEnt->rac->io_mem_new; + } + } + + if (state == OPERATING) { + prop = pEnt->entityProp; + switch(pEnt->entityProp & NEED_SHARED) { + case NEED_SHARED: + pEnt->access->rt = MEM_IO; + break; + case NEED_IO_SHARED: + pEnt->access->rt = IO; + break; + case NEED_MEM_SHARED: + pEnt->access->rt = MEM; + break; + default: + pEnt->access->rt = NONE; + } + } else { + prop = NEED_SHARED | NEED_MEM | NEED_IO; + pEnt->access->rt = MEM_IO; + } + + + switch(pEnt->access->rt) { + case IO: + pEnt->access->pAccess = acc_io; + if (org_io) { + /* does the driver want the old access func? */ + if (pEnt->rac->old) { + /* give it to the driver, leave state disabled */ + (*pEnt->rac->old) = org_io; + } else if (org_io->AccessEnable) { + /* driver doesn't want it - enable generic access */ + org_io->AccessEnable(org_io->arg); + } + } + break; + case MEM: + pEnt->access->pAccess = acc_mem; + if (org_mem) { + /* does the driver want the old access func? */ + if (pEnt->rac->old) { + /* give it to the driver, leave state disabled */ + (*pEnt->rac->old) = org_mem; + } else if (org_mem->AccessEnable) { + /* driver doesn't want it - enable generic access */ + org_mem->AccessEnable(org_mem->arg); + } + } + break; + case MEM_IO: + pEnt->access->pAccess = acc_mem_io; + if (org_mem_io) { + /* does the driver want the old access func? */ + if (pEnt->rac->old) { + /* give it to the driver, leave state disabled */ + (*pEnt->rac->old) = org_mem_io; + } else if (org_mem_io->AccessEnable) { + /* driver doesn't want it - enable generic access */ + org_mem_io->AccessEnable(org_mem_io->arg); + } + } + break; + default: /* no conflicts at all */ + pEnt->access->pAccess = NULL; /* remove from RAC */ + if (pEnt->rac && pEnt->rac->old) + (*pEnt->rac->old) = NULL; + break; + } + + if (!(prop & NEED_MEM_SHARED)){ + if (prop & NEED_MEM) { + if (acc_mem->AccessEnable) + acc_mem->AccessEnable(acc_mem->arg); + } else { + if (acc_mem->AccessDisable) + acc_mem->AccessDisable(acc_mem->arg); + } + } + if (!(prop & NEED_IO_SHARED)) { + if (prop & NEED_IO) { + if (acc_io->AccessEnable) + acc_io->AccessEnable(acc_io->arg); + } else { + if (acc_io->AccessDisable) + acc_io->AccessDisable(acc_io->arg); + } + } + + /* disable shared resources */ + if (pEnt->access->pAccess + && pEnt->access->pAccess->AccessDisable) + pEnt->access->pAccess->AccessDisable(pEnt->access->pAccess->arg); + /* + * If device is not under access control it is enabled. + * If it needs bus routing do it here as it isn't bus + * type specific. Any conflicts should be checked at this + * stage + */ + if (!pEnt->access->pAccess + && (pEnt->entityProp & (state == SETUP ? NEED_VGA_ROUTED_SETUP : + NEED_VGA_ROUTED))) + ((BusAccPtr)pEnt->busAcc)->set_f(pEnt->busAcc); +} + + /* * xf86EnterServerState() -- set state the server is in. */ + void xf86EnterServerState(xf86State state) { @@ -1675,7 +1929,6 @@ xf86EnterServerState(xf86State state) else ErrorF("Entering OPERATING state\n"); #endif - for (i=0; i<xf86NumScreens; i++) { pScrn = xf86Screens[i]; j = pScrn->entityList[pScrn->numEntities - 1]; @@ -1695,11 +1948,20 @@ xf86EnterServerState(xf86State state) */ if (!needRAC) { xf86EnableAccess(xf86Screens[0]); + notifyStateChange(NOTIFY_ENABLE); return; } - disableAccess(); + if (state == SETUP) + notifyStateChange(NOTIFY_SETUP_TRANSITION); + else + notifyStateChange(NOTIFY_OPERATING_TRANSITION); +#ifdef notanymore1 + disableAccess(); +#else + clearAccess(); +#endif for (i=0; i<xf86NumScreens;i++) { rt = NONE; @@ -1741,6 +2003,10 @@ xf86EnterServerState(xf86State state) break; } } + if (state == SETUP) + notifyStateChange(NOTIFY_SETUP); + else + notifyStateChange(NOTIFY_OPERATING); } /* @@ -1751,14 +2017,19 @@ xf86SetOperatingState(resList list, int entityIndex, int mask) { resPtr acc; resPtr r_fail = NULL; - + resRange range; + while (list->type != ResEnd) { + range = *list; + if (range.type & ResBus) + convertRange2Host(entityIndex,&range); + acc = Acc; while (acc) { #define MASK (ResPhysMask | ResExtMask) if ((acc->entityIndex == entityIndex) - && (acc->val.a == list->a) && (acc->val.b == list->b) - && ((acc->val.type & MASK) == (list->type & MASK))) + && (acc->val.a == range.a) && (acc->val.b == range.b) + && ((acc->val.type & MASK) == (range.type & MASK))) break; #undef MASK acc = acc->next; @@ -1767,12 +2038,12 @@ xf86SetOperatingState(resList list, int entityIndex, int mask) acc->val.type = (acc->val.type & ~ResOprMask) | (mask & ResOprMask); else { - r_fail = xf86AddResToList(r_fail,list,entityIndex); + r_fail = xf86AddResToList(r_fail,&range,entityIndex); } list ++; } - return r_fail; + return r_fail; } /* @@ -1831,6 +2102,10 @@ xf86ClaimFixedResources(resList list, int entityIndex) while (list->type !=ResEnd) { range = *list; + + if (range.type & ResBus) + convertRange2Host(entityIndex,&range); + range.type &= ~ResEstimated; /* Not allowed for drivers */ switch (range.type & ResAccMask) { case ResExclusive: @@ -1886,6 +2161,7 @@ checkRoutingForScreens(xf86State state) { resList list = resVgaUnusedExclusive; resPtr pResVGA = NULL; + resPtr pResVGAHost; pointer vga = NULL; int i,j; int entityIndex; @@ -1911,6 +2187,8 @@ checkRoutingForScreens(xf86State state) pEnt = xf86Entities[entityIndex]; pAcc = Acc; vga = NULL; + pResVGAHost = xf86DupResList(pResVGA); + xf86ConvertListToHost(entityIndex,pResVGAHost); while (pAcc) { if (pAcc->entityIndex == entityIndex) if (checkConflict(&pAcc->val,pResVGA, @@ -1929,6 +2207,7 @@ checkRoutingForScreens(xf86State state) } if (vga) xf86MsgVerb(X_INFO, 3,"Setting vga for screen %i.\n",i); + xf86FreeResList(pResVGAHost); } } xf86FreeResList(pResVGA); @@ -2081,10 +2360,9 @@ xf86PostPreInit() ErrorF("do I need RAC?\n"); if (needRAC) { - char *list[] = { "rac",NULL }; ErrorF(" Yes, I do.\n"); - if (!xf86LoadModules(list, NULL)) + if (!xf86LoadOneModule("rac",NULL)) FatalError("Cannot load RAC module\n"); } else ErrorF(" No, I don't.\n"); @@ -2184,35 +2462,202 @@ xf86PostScreenInit(void) * Sets */ - /* not yet used. FIXME: add support for sparse */ -Bool -isSubsetOf(resRange range, resPtr list) +static resPtr +decomposeSparse(resRange range) { - while (list) { + resRange new; + resPtr ret = NULL; + memType val = range.rBegin; + int i = 0; + + new.type = (range.type & ~ResExtMask) | ResSparse; + + while (1) { + if (val & 0x01) { + new.rBase = (val << i); + new.rMask = ~((1 << i) - 1); + ret = xf86AddResToList(ret,&new,-1); + val ++; + } + i++; + val >>= 1; + if ((((val + 1) << i) - 1) > range.rEnd) + break; + } + i--; + val <<= 1; + + while (1) { + if((((val + 1) << i) - 1)> range.rEnd) { + if (--i < 0) break; + val <<= 1; + } else { + new.rBase = (val << i); + new.rMask = ~((1 << i) - 1); + val++; + ret = xf86AddResToList(ret,&new,-1); + } + } + return ret; +} + +static Bool +x_isSubsetOf(resRange range, resPtr list1, resPtr list2) +{ + resRange range1, range2; + memType m1_A_m2; + Bool ret; + resPtr list; + + if (list1) { + list = list1; if (range.type & list->res_type & ResPhysMask) { switch (range.type & ResExtMask) { case ResBlock: - switch (list->res_type & ResExtMask) { - case ResBlock: + if ((list->res_type & ResExtMask) == ResBlock) { if (range.rBegin >= list->block_begin && range.rEnd <= list->block_end) return TRUE; + else if (range.rBegin < list->block_begin + && range.rEnd > list->block_end) { + RANGE(range1, range.rBegin, list->block_begin - 1, + range.type); + RANGE(range2, list->block_end + 1, range.rEnd, + range.type); + return (x_isSubsetOf(range1,list->next,list2) && + x_isSubsetOf(range2,list->next,list2)); + } + else if (range.rBegin >= list->block_begin + && range.rBegin <= list->block_end) { + RANGE(range1, list->block_end + 1, range.rEnd, + range.type); + return (x_isSubsetOf(range1,list->next,list2)); + } else if (range.rEnd >= list->block_begin + && range.rEnd <= list->block_end) { + RANGE(range1,range.rBegin, list->block_begin - 1, + range.type); + return (x_isSubsetOf(range1,list->next,list2)); + } + } + break; + case ResSparse: + if ((list->res_type & ResExtMask) == ResSparse) { + memType test; + int i; + + m1_A_m2 = range.rMask & list->sparse_mask; + if ((range.rBase ^ list->sparse_base) & m1_A_m2) break; + /* + * We use the following system: + * let 0 ^= mask:1 base:0, 1 ^= mask:1 base:1, + * X mask:0 ; S: set TSS: test set for subset + * NTSS: new test set after test + * S: 1 0 1 0 X X 0 1 X + * TSS: 1 0 0 1 1 0 X X X + * T: 0 0 1 1 0 0 0 0 0 + * NTSS: 1 0 0/X 1/X 1 0 1 0 X + * R: 0 0 0 0 0 0 1 1 0 + * If R != 0 TSS and S are disjunct + * If R == 0 TSS is subset of S + * If R != 0 NTSS contains elements from TSS + * which are not also members of S. + * If a T is set one of the correspondig bits + * in NTSS must be set to the specified value + * all other are X + */ + test = list->sparse_mask & ~range.rMask; + if (test == 0) + return TRUE; + for (i = 0; i < sizeof(memType); i++) { + if ((test >> i) & 0x1) { + RANGE(range1, ((range.rBase & list->sparse_base) + | (range.rBase & ~list->sparse_mask) + | ((~list->sparse_base & list->sparse_mask) + & ~range.rMask)) & range1.rMask, + ((range.rMask | list->sparse_mask) & ~test) + | (1 << i), range.type); + return (x_isSubsetOf(range1,list->next,list2)); + } + } } break; } } - list = list->next; - } + return (x_isSubsetOf(range,list->next,list2)); + } else if (list2) { + resPtr tmpList = NULL; + switch (range.type & ResExtMask) { + case ResBlock: + tmpList = decomposeSparse(range); + while (tmpList) { + if (!x_isSubsetOf(tmpList->val,list2,NULL)) { + xf86FreeResList(tmpList); + return FALSE; + } + tmpList = tmpList->next; + } + xf86FreeResList(tmpList); + return TRUE; + break; + case ResSparse: + while (list2) { + tmpList = xf86JoinResLists(tmpList,decomposeSparse(list2->val)); + list2 = list2->next; + } + ret = x_isSubsetOf(range,tmpList,NULL); + xf86FreeResList(tmpList); + return ret; + break; + } + } else + return FALSE; + return FALSE; } Bool -isListSubsetOf(resPtr list, resPtr BaseList) +xf86IsSubsetOf(resRange range, resPtr list) +{ + resPtr dup = xf86DupResList(list); + resPtr r_sp = NULL, r = NULL, tmp = NULL; + Bool ret = FALSE; + + while (dup) { + tmp = dup; + dup = dup->next; + switch (tmp->res_type & ResExtMask) { + case ResBlock: + tmp->next = r; + r = tmp; + break; + case ResSparse: + tmp->next = r_sp; + r_sp = tmp; + break; + } + } + + switch (range.type & ResExtMask) { + case ResBlock: + ret = x_isSubsetOf(range,r,r_sp); + break; + case ResSparse: + ret = x_isSubsetOf(range,r_sp,r); + break; + } + xf86FreeResList(r); + xf86FreeResList(r_sp); + + return ret; +} + +Bool +xf86IsListSubsetOf(resPtr list, resPtr BaseList) { while (list) { - if (! isSubsetOf(list->val,BaseList)) + if (! xf86IsSubsetOf(list->val,BaseList)) return FALSE; list = list->next; } @@ -2244,8 +2689,29 @@ findIntersect(resRange Range, resPtr list) new = xf86AddResToList(new,&range,-1); } break; + case ResSparse: + new = xf86JoinResLists(new,xf86FindIntersectOfLists(new,decomposeSparse(list->val))); + break; } break; + case ResSparse: + switch (list->res_type & ResExtMask) { + case ResSparse: + if (!((~(range.rBase ^ list->sparse_base) + & (range.rMask & list->sparse_mask)))) { + RANGE(range, (range.rBase & list->sparse_base) + | (~range.rMask & list->sparse_base) + | (~list->sparse_mask & range.rBase), + range.rMask | list->sparse_mask, + Range.type); + new = xf86AddResToList(new,&range,-1); + } + break; + case ResBlock: + new = xf86JoinResLists(new,xf86FindIntersectOfLists( + decomposeSparse(range),list)); + break; + } } } list = list->next; @@ -2265,6 +2731,52 @@ xf86FindIntersectOfLists(resPtr l1, resPtr l2) return ret; } +static resPtr +xf86FindComplement(resRange Range) +{ + resRange range; + memType tmp; + resPtr new = NULL; + int i; + + switch (Range.type & ResExtMask) { + case ResBlock: + if (Range.rBegin > 0) { + RANGE(range, 0, Range.rBegin - 1, Range.type); + new = xf86AddResToList(new,&range,-1); + } + if (Range.rEnd < (memType)~0) { + RANGE(range,Range.rEnd + 1, (memType)~0, Range.type); + new = xf86AddResToList(new,&range,-1); + } + break; + case ResSparse: + tmp = Range.rMask; + for (i = 0; i < sizeof(memType); i++) { + if (tmp & 0x1) { + RANGE(range,(~Range.rMask & range.rMask),(1 << i), Range.type); + new = xf86AddResToList(new,&range,-1); + } + } + break; + default: + break; + } + return new; +} + +resPtr +xf86ExtractTypeFromList(resPtr list, unsigned long type) +{ + resPtr ret = NULL; + + while (list) { + if ((list->res_type & type) == type) + ret = xf86AddResToList(ret,&(list->val),list->entityIndex); + list = list->next; + } + return ret; +} /*------------------------------------------------------------*/ static void CheckGenericGA(void); @@ -2327,3 +2839,68 @@ xf86NoSharedMem(int screenIndex) return TRUE; } +void +xf86ConvertListToHost(int entityIndex, resPtr list) +{ + while (list) { + convertRange2Host(entityIndex, &list->val); + list = list->next; + } +} + +void +xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg) +{ + StateChangeNotificationPtr ptr = + (StateChangeNotificationPtr)xnfalloc(sizeof(StateChangeNotificationRec)); + + ptr->func = func; + ptr->arg = arg; + ptr->next = StateChangeNotificationList; + StateChangeNotificationList = ptr; +} + +Bool +xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func) +{ + StateChangeNotificationPtr *ptr = &StateChangeNotificationList; + StateChangeNotificationPtr tmp; + + while (*ptr) { + if ((*ptr)->func == func) { + tmp = (*ptr); + (*ptr) = (*ptr)->next; + xfree(tmp); + return TRUE; + } + ptr = &((*ptr)->next); + } + return FALSE; +} + +static void +notifyStateChange(xf86NotifyState state) +{ + StateChangeNotificationPtr ptr = StateChangeNotificationList; + while (ptr) { + ptr->func(state,ptr->arg); + ptr = ptr->next; + } +} + +#ifdef async +Bool +xf86QueueAsyncEvent(void (*func)(pointer),pointer arg) +{ + AsyncQPtr new; + + if (!AsyncQ) return FALSE; + + new = (AsyncQPtr)xfnalloc(sizeof(AsyncQRec)); + new->func = func; + new->arg = arg; + (*AsyncQPtr)->next = new; + AsyncQPtr = &new; + return TRUE; +} +#endif diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h index f47ba47e6..1c25e7d87 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Bus.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.10 1999/12/03 19:17:22 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.12 2000/02/12 23:59:09 eich Exp $ */ #define DEBUG /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -41,6 +41,15 @@ typedef struct { pointer busAcc; } EntityRec, *EntityPtr; +/* asynchronous event handling */ +#ifdef async +typedef struct _AsyncQRec { + void (*func)(pointer); + pointer arg; + struct _AsyncQRec *next; +} AsyncQRec, *AsyncQPtr; +#endif + #define NO_SEPARATE_IO_FROM_MEM 0x0001 #define NO_SEPARATE_MEM_FROM_IO 0x0002 #define NEED_VGA_ROUTED 0x0004 @@ -82,6 +91,14 @@ typedef struct x_BusAccRec { } busdep; } BusAccRec, *BusAccPtr; +/* state change notification callback */ +typedef struct _stateChange { + xf86StateChangeNotificationCallbackFunc func; + pointer arg; + struct _stateChange *next; +} StateChangeNotificationRec, *StateChangeNotificationPtr; + + extern EntityPtr *xf86Entities; extern int xf86NumEntities; extern xf86AccessRec AccessNULL; @@ -93,9 +110,12 @@ extern BusAccPtr xf86BusAccInfo; int xf86AllocateEntity(void); BusType StringToBusType(const char* busID, const char **retID); memType ChkConflict(resRange *rgp, resPtr res, xf86State state); -Bool isSubsetOf(resRange range, resPtr list); -Bool isListSubsetOf(resPtr list, resPtr BaseList); +Bool xf86IsSubsetOf(resRange range, resPtr list); +Bool xf86IsListSubsetOf(resPtr list, resPtr BaseList); +resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type); resPtr findIntersect(resRange Range, resPtr list); +resPtr xf86FindIntersect(resRange Range, resPtr list); void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment); +void xf86ConvertListToHost(int entityIndex, resPtr list); #endif /* _XF86_BUS_H */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c index e5950a72f..22d22dc37 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Config.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Config.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.197 1999/12/13 23:52:56 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.209 2000/02/18 00:47:35 dawes Exp $ */ /* @@ -36,7 +36,7 @@ extern DeviceAssocRec mouse_assoc; #if (defined(i386) || defined(__i386__)) && \ (defined(__FreeBSD__) || defined(__NetBSD__) || defined(linux) || \ - defined(SVR4)) + (defined(SVR4) && !defined(sun))) #define SUPPORT_PC98 #endif @@ -270,9 +270,11 @@ xf86DriverlistFromConfig() * XXX The set of inactive "Device" sections needs to be handled too, * when the rest of the supporting code is done. */ - slp = xf86ConfigLayout.screens; - while ((slp++)->screen) { - count++; + if (xf86ConfigLayout.screens) { + slp = xf86ConfigLayout.screens; + while ((slp++)->screen) { + count++; + } } if (count == 0) @@ -308,7 +310,7 @@ xf86DriverlistFromConfig() Bool xf86BuiltinInputDriver(const char *name) { - if (xf86NameCmp(name, "keyboard") == 0 || xf86NameCmp(name, "mouse") == 0) + if (xf86NameCmp(name, "keyboard") == 0) return TRUE; else return FALSE; @@ -336,11 +338,13 @@ xf86InputDriverlistFromConfig() * Walk the list of driver lines in active "InputDevice" sections to * determine now many implicitly loaded modules there are. */ - idp = xf86ConfigLayout.inputs; - while (idp->identifier) { - if (!xf86BuiltinInputDriver(idp->driver)) - count++; - idp++; + if (xf86ConfigLayout.inputs) { + idp = xf86ConfigLayout.inputs; + while (idp->identifier) { + if (!xf86BuiltinInputDriver(idp->driver)) + count++; + idp++; + } } if (count == 0) @@ -402,6 +406,7 @@ configFiles(XF86ConfFilesPtr fileconf) /* Try XF86Config FontPath first */ if (!xf86fpFlag) { + if (fileconf) { if (fileconf->file_fontpath) { char *f = xf86ValidateFontPath(fileconf->file_fontpath); pathFrom = X_CONFIG; @@ -413,11 +418,12 @@ configFiles(XF86ConfFilesPtr fileconf) fontPath = NULL; pathFrom = X_DEFAULT; } - } else { + } + } else { xf86Msg(X_WARNING, "No FontPath specified. Using compiled-in default.\n"); pathFrom = X_DEFAULT; - } + } } else { /* Use fontpath specified with '-fp' */ if (fontPath) @@ -426,14 +432,26 @@ configFiles(XF86ConfFilesPtr fileconf) } pathFrom = X_CMDLINE; } - if (!fileconf->file_fontpath) { - /* xf86ValidateFontPath will write into it's arg, but defaultFontPath + if (!fileconf) { + /* xf86ValidateFontPath will write into it's arg, but defaultFontPath could be static, so we make a copy. */ char *f = xnfalloc(strlen(defaultFontPath) + 1); f[0] = '\0'; strcpy (f, defaultFontPath); defaultFontPath = xf86ValidateFontPath(f); xfree(f); + } else { + if (fileconf) { + if (!fileconf->file_fontpath) { + /* xf86ValidateFontPath will write into it's arg, but defaultFontPath + could be static, so we make a copy. */ + char *f = xnfalloc(strlen(defaultFontPath) + 1); + f[0] = '\0'; + strcpy (f, defaultFontPath); + defaultFontPath = xf86ValidateFontPath(f); + xfree(f); + } + } } /* If defaultFontPath is still empty, exit here */ @@ -449,9 +467,11 @@ configFiles(XF86ConfFilesPtr fileconf) if (xf86coFlag) pathFrom = X_CMDLINE; - else if (fileconf->file_rgbpath) { - rgbPath = fileconf->file_rgbpath; - pathFrom = X_CONFIG; + else if (fileconf) { + if (fileconf->file_rgbpath) { + rgbPath = fileconf->file_rgbpath; + pathFrom = X_CONFIG; + } } xf86Msg(pathFrom, "RgbPath set to \"%s\"\n", rgbPath); @@ -459,9 +479,11 @@ configFiles(XF86ConfFilesPtr fileconf) #ifdef XFree86LOADER /* ModulePath */ - if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) { - xf86ModulePath = fileconf->file_modulepath; - xf86ModPathFrom = X_CONFIG; + if (fileconf) { + if (xf86ModPathFrom != X_CMDLINE && fileconf->file_modulepath) { + xf86ModulePath = fileconf->file_modulepath; + xf86ModPathFrom = X_CONFIG; + } } xf86Msg(xf86ModPathFrom, "ModulePath set to \"%s\"\n", xf86ModulePath); @@ -508,7 +530,8 @@ typedef enum { FLAG_DPMS_OFFTIME, FLAG_PIXMAP, FLAG_PC98, - FLAG_ESTIMATE_SIZES_AGGRESSIVELY + FLAG_ESTIMATE_SIZES_AGGRESSIVELY, + FLAG_NOPM } FlagValues; static OptionInfoRec FlagOptions[] = { @@ -552,7 +575,7 @@ static OptionInfoRec FlagOptions[] = { {0}, FALSE }, { FLAG_ESTIMATE_SIZES_AGGRESSIVELY,"EstimateSizesAggressively",OPTV_INTEGER, {0}, FALSE }, - { FLAG_PC98, "PC98", OPTV_BOOLEAN, + { FLAG_NOPM, "NoPM", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } @@ -595,7 +618,7 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) if (layoutopts) { tmp = OptionListDup(layoutopts); if (optp) - OptionListMerge(optp, tmp); + optp = OptionListMerge(optp, tmp); else optp = tmp; } @@ -648,12 +671,18 @@ configServerFlags(XF86ConfFlagsPtr flagsconf, XF86OptionPtr layoutopts) xf86Info.pciFlags = PCIForceConfig1; if (xf86IsOptionSet(FlagOptions, FLAG_PCIFORCECONFIG2)) xf86Info.pciFlags = PCIForceConfig2; - + if (xf86IsOptionSet(FlagOptions, FLAG_NOPM)) + xf86Info.pmFlag = FALSE; + else + xf86Info.pmFlag = TRUE; + i = -1; xf86GetOptValInteger(FlagOptions, FLAG_ESTIMATE_SIZES_AGGRESSIVELY, &i); if (i >= 0) - xf86EstimateSizesAggressively = i; - + xf86Info.estimateSizesAggressively = i; + else + xf86Info.estimateSizesAggressively = 0; + i = -1; xf86GetOptValInteger(FlagOptions, FLAG_SAVER_BLANKTIME, &i); if (i >= 0) @@ -731,6 +760,7 @@ configInputKbd(IDevPtr inputp) xf86Info.xleds = 0L; xf86Info.kbdDelay = 500; xf86Info.kbdRate = 30; + xf86Info.kbdProc = NULL; xf86Info.vtinit = NULL; xf86Info.vtSysreq = VT_SYSREQ_DEFAULT; @@ -791,7 +821,6 @@ configInputKbd(IDevPtr inputp) return FALSE; } } - s = xf86SetStrOption(inputp->commonOptions, "XLeds", NULL); if (s) { char *l, *end; @@ -916,15 +945,15 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) /* Check if a core pointer or core keyboard is needed. */ for (indp = servlayoutp->inputs; indp->identifier; indp++) { if ((indp->commonOptions && - xf86FindOption(indp->extraOptions, "CorePointer")) || + xf86FindOption(indp->commonOptions, "CorePointer")) || (indp->extraOptions && - xf86FindOption(indp->commonOptions, "CorePointer"))) { + xf86FindOption(indp->extraOptions, "CorePointer"))) { havePointer = TRUE; } if ((indp->commonOptions && - xf86FindOption(indp->extraOptions, "CoreKeyboard")) || + xf86FindOption(indp->commonOptions, "CoreKeyboard")) || (indp->extraOptions && - xf86FindOption(indp->commonOptions, "CoreKeyboard"))) { + xf86FindOption(indp->extraOptions, "CoreKeyboard"))) { haveKeyboard = TRUE; } count++; @@ -1065,7 +1094,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, ErrorF("Found %d screens in the layout section %s", count, conf_layout->lay_identifier); #endif - slp = xnfalloc((count + 1) * sizeof(screenLayoutRec)); + slp = xnfcalloc(1, (count + 1) * sizeof(screenLayoutRec)); slp[count].screen = NULL; /* * now that we have storage, loop over the list again and fill in our @@ -1075,7 +1104,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, adjp = conf_layout->lay_adjacency_lst; count = 0; while (adjp) { - slp[count].screen = xnfalloc(sizeof(confScreenRec)); + slp[count].screen = xnfcalloc(1, sizeof(confScreenRec)); if (adjp->adj_scrnum < 0) scrnum = count; else @@ -1238,6 +1267,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, servlayoutp->inputs = indp; servlayoutp->options = conf_layout->lay_option_lst; from = X_DEFAULT; +#ifdef PANORAMIX if (!noPanoramiXExtension) from = X_CMDLINE; else if (xf86FindOption(conf_layout->lay_option_lst, "Xinerama")) { @@ -1247,6 +1277,7 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, } if (!noPanoramiXExtension) xf86Msg(from, "Xinerama: enabled\n"); +#endif if (!checkCoreInputDevices(servlayoutp, FALSE)) return FALSE; @@ -1293,8 +1324,8 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen) /* We have exactly one screen */ - slp = xnfalloc(2 * sizeof(screenLayoutRec)); - slp[0].screen = xnfalloc(sizeof(confScreenRec)); + slp = xnfcalloc(1, 2 * sizeof(screenLayoutRec)); + slp[0].screen = xnfcalloc(1, sizeof(confScreenRec)); slp[1].screen = NULL; if (!configScreen(slp[0].screen, conf_screen, 0, from)) return FALSE; @@ -1367,10 +1398,10 @@ configScreen(confScreenPtr screenp, XF86ConfScreenPtr conf_screen, int scrnum, screenp->defaultdepth = conf_screen->scrn_defaultdepth; screenp->defaultbpp = conf_screen->scrn_defaultbpp; screenp->defaultfbbpp = conf_screen->scrn_defaultfbbpp; - screenp->monitor = xnfalloc(sizeof(MonRec)); + screenp->monitor = xnfcalloc(1, sizeof(MonRec)); if (!configMonitor(screenp->monitor,conf_screen->scrn_monitor)) return FALSE; - screenp->device = xnfalloc(sizeof(GDevRec)); + screenp->device = xnfcalloc(1, sizeof(GDevRec)); configDevice(screenp->device,conf_screen->scrn_device, TRUE); screenp->device->myScreenSection = screenp; screenp->options = conf_screen->scrn_option_lst; @@ -1846,15 +1877,23 @@ xf86HandleConfigFile(void) return FALSE; } } else { - char *dfltlayout = NULL; - pointer optlist = xf86configptr->conf_flags->flg_option_lst; - - if (optlist && xf86FindOption(optlist, "defaultserverlayout")) + if (xf86configptr->conf_flags != NULL) { + char *dfltlayout = NULL; + pointer optlist = xf86configptr->conf_flags->flg_option_lst; + + if (optlist && xf86FindOption(optlist, "defaultserverlayout")) dfltlayout = xf86SetStrOption(optlist, "defaultserverlayout", NULL); - if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst, + if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst, dfltlayout)) { xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); return FALSE; + } + } else { + if (!configLayout(&xf86ConfigLayout, xf86configptr->conf_layout_lst, + NULL)) { + xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); + return FALSE; + } } } diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c b/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c new file mode 100644 index 000000000..83f2c827c --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Configure.c @@ -0,0 +1,695 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.15 2000/02/18 00:47:36 dawes Exp $ */ +/* + * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales. + * + * 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 Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE 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. + * + * Author: Alan Hourihane, alanh@fairlite.demon.co.uk + * + */ + +#include <ctype.h> +#include <stdlib.h> +#include "X.h" +#include "Xmd.h" +#include "os.h" +#ifdef XFree86LOADER +#include "loaderProcs.h" +#endif +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86PciInfo.h" +#include "xf86Parser.h" +#include "xf86tokens.h" +#include "Configint.h" + +pciVideoPtr ConfiguredPciCard; +int ConfiguredIsaCard; +int FoundPciCards = 0; +static int haveVGA = -1; +Bool havePrimary = FALSE; + +static void +GetPciCard(int id, int *vendor1, int *vendor2, int *card) +{ + int k, j; + k = 0; + while (xf86PCIVendorNameInfo[k].token) { + if (xf86PCIVendorNameInfo[k].token == ConfiguredPciCard[id].vendor) + *vendor1 = k; + k++; + } + k = 0; + while(xf86PCIVendorInfo[k].VendorID) { + if (xf86PCIVendorInfo[k].VendorID == ConfiguredPciCard[id].vendor) { + j = 0; + while (xf86PCIVendorInfo[k].Device[j].DeviceName) { + if (xf86PCIVendorInfo[k].Device[j].DeviceID == + ConfiguredPciCard[id].chipType) { + *vendor2 = k; + *card = j; + break; + } + j++; + } + break; + } + k++; + } +} + +XF86ConfInputPtr +configureInputSection (void) +{ + XF86ConfInputPtr mouse = NULL; + Bool foundMouse = FALSE; + parsePrologue (XF86ConfInputPtr, XF86ConfInputRec) + + ptr->inp_identifier = "Keyboard1"; + ptr->inp_driver = "keyboard"; + ptr->list.next = NULL; + +/* +ErrorF("Supported Mice are : 0x%x\n",SupportedInterfaces()); +*/ + /* Crude mechanism to auto-detect mouse (os dependent) */ + { + int fd; + fd = open("/dev/mouse", 0); + if (fd != -1) { + foundMouse = TRUE; + close(fd); + } + } + + if (foundMouse) { + mouse = xf86confmalloc(sizeof(XF86ConfInputRec)); + memset((XF86ConfInputPtr)mouse,0,sizeof(XF86ConfInputRec)); + mouse->inp_identifier = "Mouse1"; + mouse->inp_driver = "mouse"; + mouse->list.next = NULL; + mouse->inp_option_lst = + addNewOption(mouse->inp_option_lst, "Protocol", "auto"); + mouse->inp_option_lst = + addNewOption(mouse->inp_option_lst, "Device", "/dev/mouse"); + ptr = (XF86ConfInputPtr)addListItem((glp)ptr, (glp)mouse); + } + + return ptr; +} + +XF86ConfDRIPtr +configureDRISection (void) +{ + parsePrologue (XF86ConfDRIPtr, XF86ConfDRIRec) + + return ptr; +} + +XF86ConfVendorPtr +configureVendorSection (void) +{ + parsePrologue (XF86ConfVendorPtr, XF86ConfVendorRec) + + ptr->vnd_identifier = "Vendor1"; + + return ptr; +} + +XF86ConfScreenPtr +configureScreenSection (char *driver) +{ + pciVideoPtr xf86PciCard; + int i = 0; + int vendor1, vendor2, card; + parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec) + + ptr->scrn_identifier = "Screen1"; + ptr->scrn_monitor_str = "Monitor1"; + + xf86PciCard = ConfiguredPciCard; + for (i = 0; i < FoundPciCards; i++) { + if (xf86IsPrimaryPci(xf86PciCard)) { + havePrimary = TRUE; + GetPciCard(i, &vendor1, &vendor2, &card); + ptr->scrn_device_str = xalloc( + strlen(xf86PCIVendorNameInfo[vendor1].name) + + strlen(xf86PCIVendorInfo[vendor2].Device[card].DeviceName) + 2); + sprintf(ptr->scrn_device_str, "%s %s", + xf86PCIVendorNameInfo[vendor1].name, + xf86PCIVendorInfo[vendor2].Device[card].DeviceName); + } + xf86PciCard++; + } + if (xf86IsPrimaryIsa()) { + havePrimary = TRUE; + ptr->scrn_device_str = "ISA Card"; + } + + /* Make sure we use depth 4 for vga driver and depth 8 for direct */ + /* Just to get a usable 640x480 display */ + if ((driver == NULL) && (haveVGA != -1)) + ptr->scrn_defaultdepth = 4; + else + ptr->scrn_defaultdepth = 8; + + { + XF86ConfDisplayPtr display; + display = xf86confmalloc(sizeof(XF86ConfDisplayRec)); + memset((XF86ConfDisplayPtr)display,0,sizeof(XF86ConfDisplayRec)); + /* Make sure we use depth 4 for vga driver and depth 8 for direct */ + /* Just to get a usable 640x480 display */ + if ((driver == NULL) && (haveVGA != -1)) + display->disp_depth = 4; + else + display->disp_depth = 8; + display->disp_mode_lst = + display->list.next = NULL; + ptr->scrn_display_lst = (XF86ConfDisplayPtr)addListItem( + (glp)ptr->scrn_display_lst, (glp)display); + { + XF86ModePtr mode; + mode = xf86confmalloc(sizeof(XF86ModeRec)); + memset((XF86ModePtr)mode,0,sizeof(XF86ModeRec)); + mode->mode_name = "640x480"; + mode->list.next = NULL; + display->disp_mode_lst = (XF86ModePtr)addListItem( + (glp)display->disp_mode_lst, (glp)mode); + } + } + + { + XF86ConfDisplayPtr display; + display = xf86confmalloc(sizeof(XF86ConfDisplayRec)); + memset((XF86ConfDisplayPtr)display,0,sizeof(XF86ConfDisplayRec)); + display->disp_depth = 15; + display->disp_mode_lst = + display->list.next = NULL; + ptr->scrn_display_lst = (XF86ConfDisplayPtr)addListItem( + (glp)ptr->scrn_display_lst, (glp)display); + { + XF86ModePtr mode; + mode = xf86confmalloc(sizeof(XF86ModeRec)); + memset((XF86ModePtr)mode,0,sizeof(XF86ModeRec)); + mode->mode_name = "640x480"; + mode->list.next = NULL; + display->disp_mode_lst = (XF86ModePtr)addListItem( + (glp)display->disp_mode_lst, (glp)mode); + } + } + + { + XF86ConfDisplayPtr display; + display = xf86confmalloc(sizeof(XF86ConfDisplayRec)); + memset((XF86ConfDisplayPtr)display,0,sizeof(XF86ConfDisplayRec)); + display->disp_depth = 16; + display->disp_mode_lst = + display->list.next = NULL; + ptr->scrn_display_lst = (XF86ConfDisplayPtr)addListItem( + (glp)ptr->scrn_display_lst, (glp)display); + { + XF86ModePtr mode; + mode = xf86confmalloc(sizeof(XF86ModeRec)); + memset((XF86ModePtr)mode,0,sizeof(XF86ModeRec)); + mode->mode_name = "640x480"; + mode->list.next = NULL; + display->disp_mode_lst = (XF86ModePtr)addListItem( + (glp)display->disp_mode_lst, (glp)mode); + } + } + + { + XF86ConfDisplayPtr display; + display = xf86confmalloc(sizeof(XF86ConfDisplayRec)); + memset((XF86ConfDisplayPtr)display,0,sizeof(XF86ConfDisplayRec)); + display->disp_depth = 24; + display->disp_mode_lst = + display->list.next = NULL; + ptr->scrn_display_lst = (XF86ConfDisplayPtr)addListItem( + (glp)ptr->scrn_display_lst, (glp)display); + { + XF86ModePtr mode; + mode = xf86confmalloc(sizeof(XF86ModeRec)); + memset((XF86ModePtr)mode,0,sizeof(XF86ModeRec)); + mode->mode_name = "640x480"; + mode->list.next = NULL; + display->disp_mode_lst = (XF86ModePtr)addListItem( + (glp)display->disp_mode_lst, (glp)mode); + } + } + + return ptr; +} + +XF86ConfDevicePtr +configureDeviceSection (char *driver, OptionInfoPtr devoptions) +{ + OptionInfoPtr p; + pciVideoPtr xf86PciCard; + int i = 0; + int vendor1, vendor2, card; + Bool foundFBDEV = FALSE; + parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec) + + ptr->dev_driver = driver; + ptr->dev_chipid = -1; + ptr->dev_chiprev = -1; + ptr->dev_irq = -1; + + /* Make sure older drivers don't segv */ + if (devoptions != NULL) { + /* Fill in the available driver options for people to use */ + ptr->dev_comment = xalloc(32 + 1); + strcpy(ptr->dev_comment, "Available Driver options are:-\n"); + for (p = devoptions; p->name != NULL; p++) { + ptr->dev_comment = xrealloc(ptr->dev_comment, + strlen(ptr->dev_comment) + strlen(p->name) + 24 + 1); + strcat(ptr->dev_comment, " #Option \""); + strcat(ptr->dev_comment, p->name); + strcat(ptr->dev_comment, "\"\n"); + } + } + + xf86PciCard = ConfiguredPciCard; + for (i = 0; i < FoundPciCards; i++) { + ErrorF("Card Found vendor = 0x%x, card = 0x%x, %s\n", + xf86PciCard->vendor, + xf86PciCard->chipType,(xf86IsPrimaryPci(xf86PciCard) ? + "Primary! - Configuring this one." : "Secondary.")); + if (xf86IsPrimaryPci(xf86PciCard)) { + havePrimary = TRUE; + GetPciCard(i, &vendor1, &vendor2, &card); + ptr->dev_identifier = xalloc( + strlen(xf86PCIVendorNameInfo[vendor1].name) + + strlen(xf86PCIVendorInfo[vendor2].Device[card].DeviceName) + 2); + sprintf(ptr->dev_identifier, "%s %s", + xf86PCIVendorNameInfo[vendor1].name, + xf86PCIVendorInfo[vendor2].Device[card].DeviceName); + ptr->dev_busid = xalloc(9 + 1); + sprintf(ptr->dev_busid, "PCI:%d:%d:%d", xf86PciCard->bus, + xf86PciCard->device, xf86PciCard->func); + } + xf86PciCard++; + } + if (xf86IsPrimaryIsa()) { + havePrimary = TRUE; + ptr->dev_identifier = "ISA Card"; + ptr->dev_busid = "ISA"; + } + + /* Crude mechanism to auto-detect fbdev (os dependent) */ + /* Skip it for now. Options list it anyway, and we can't + * determine which screen/driver this belongs too anyway. + { + int fd; + fd = open("/dev/fb0", 0); + if (fd != -1) { + foundFBDEV = TRUE; + close(fd); + } + } + + if (foundFBDEV) { + XF86OptionPtr fbdev; + fbdev = xf86confmalloc(sizeof(XF86OptionRec)); + memset((XF86OptionPtr)fbdev,0,sizeof(XF86OptionRec)); + fbdev->opt_name = "UseFBDev"; + fbdev->opt_val = "ON"; + ptr->dev_option_lst = (XF86OptionPtr)addListItem( + (glp)ptr->dev_option_lst, (glp)fbdev); + } + */ + + return ptr; +} + +XF86ConfLayoutPtr +configureLayoutSection (void) +{ + pciVideoPtr xf86PciCard; + int i = 0; + int vendor1, vendor2, card; + parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec) + + xf86PciCard = ConfiguredPciCard; + for (i = 0; i < FoundPciCards; i++) { + if (xf86IsPrimaryPci(xf86PciCard)) { + havePrimary = TRUE; + GetPciCard(i, &vendor1, &vendor2, &card); + ptr->lay_identifier = xalloc( + strlen(xf86PCIVendorNameInfo[vendor1].name) + + strlen(xf86PCIVendorInfo[vendor2].Device[card].DeviceName) + 2); + sprintf(ptr->lay_identifier, "%s %s", + xf86PCIVendorNameInfo[vendor1].name, + xf86PCIVendorInfo[vendor2].Device[card].DeviceName); + } + xf86PciCard++; + } + if (xf86IsPrimaryIsa()) { + havePrimary = TRUE; + ptr->lay_identifier = "ISA Card"; + } + + { + XF86ConfAdjacencyPtr aptr; + + aptr = xf86confmalloc (sizeof (XF86ConfAdjacencyRec)); + aptr->list.next = NULL; + aptr->adj_x = 0; + aptr->adj_y = 0; + aptr->adj_refscreen = NULL; + aptr->adj_scrnum = 1; + aptr->adj_screen_str = "Screen1"; + aptr->adj_where = CONF_ADJ_ABSOLUTE; + ptr->lay_adjacency_lst = (XF86ConfAdjacencyPtr) + addListItem ((glp) ptr->lay_adjacency_lst, (glp) aptr); + } + + { + XF86ConfInputrefPtr iptr; + + iptr = xf86confmalloc (sizeof (XF86ConfInputrefRec)); + iptr->list.next = NULL; + iptr->iref_option_lst = NULL; + iptr->iref_inputdev_str = "Mouse1"; + iptr->iref_option_lst = + addNewOption (iptr->iref_option_lst, "CorePointer", NULL); + ptr->lay_input_lst = (XF86ConfInputrefPtr) + addListItem ((glp) ptr->lay_input_lst, (glp) iptr); + } + + { + XF86ConfInputrefPtr iptr; + + iptr = xf86confmalloc (sizeof (XF86ConfInputrefRec)); + iptr->list.next = NULL; + iptr->iref_option_lst = NULL; + iptr->iref_inputdev_str = "Keyboard1"; + iptr->iref_option_lst = + addNewOption (iptr->iref_option_lst, "CoreKeyboard", NULL); + ptr->lay_input_lst = (XF86ConfInputrefPtr) + addListItem ((glp) ptr->lay_input_lst, (glp) iptr); + } + + return ptr; +} + +XF86ConfModesPtr +configureModesSection (void) +{ + parsePrologue (XF86ConfModesPtr, XF86ConfModesRec) + + return ptr; +} + +XF86ConfVideoAdaptorPtr +configureVideoAdaptorSection (void) +{ + parsePrologue (XF86ConfVideoAdaptorPtr, XF86ConfVideoAdaptorRec) + + return NULL; +#if 0 + return ptr; +#endif +} + +XF86ConfFlagsPtr +configureFlagsSection (void) +{ + parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec) + + return ptr; +} + +XF86ConfModulePtr +configureModuleSection (void) +{ + char **elist, **el; +#ifdef XFree86LOADER + /* Find the list of extension modules. */ + const char *esubdirs[] = { + "extensions", + NULL + }; +#endif + parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec) + +#ifdef XFree86LOADER + elist = LoaderListDirs(esubdirs, NULL); + if (elist) { + for (el = elist; *el; el++) { + XF86LoadPtr module; + module = xf86confmalloc(sizeof(XF86LoadRec)); + memset((XF86LoadPtr)module,0,sizeof(XF86LoadRec)); + module->load_name = *el; + ptr->mod_load_lst = (XF86LoadPtr)addListItem( + (glp)ptr->mod_load_lst, (glp)module); + } + } +#endif + + return ptr; +} + +XF86ConfFilesPtr +configureFilesSection (void) +{ + parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec) + + return ptr; +} + +XF86ConfMonitorPtr +configureMonitorSection (void) +{ + parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec) + + ptr->mon_identifier = "Monitor1"; + ptr->mon_vendor = "Monitor Vendor"; + ptr->mon_modelname = "Monitor Model"; + + /* Set monitor for allowable 640x480@25MHz */ + ptr->mon_n_hsync = 1; + ptr->mon_hsync[0].lo = 28; + ptr->mon_hsync[0].hi = 33; + ptr->mon_n_vrefresh = 1; + ptr->mon_vrefresh[0].lo = 43; + ptr->mon_vrefresh[0].hi = 72; + + return ptr; +} + +void +DoConfigure() +{ + int i; + Bool probeResultPci = FALSE; + Bool probeResultIsa = FALSE; + char *foundDriver = NULL; + char *home = NULL; + char *filename = NULL; + OptionInfoPtr options = NULL; + XF86ConfigPtr xf86config = NULL; + char **vlist, **ilist, **vl, **il; + +#ifdef XFree86LOADER + /* Find the list of video driver modules. */ + const char *vsubdirs[] = { + "drivers", + NULL + }; + const char *isubdirs[] = { + "input", + NULL + }; + + vlist = LoaderListDirs(vsubdirs, NULL); + ilist = LoaderListDirs(isubdirs, NULL); + if (vlist) { + ErrorF("List of video driver modules:\n"); + for (vl = vlist; *vl; vl++) + ErrorF("\t%s\n", *vl); + } else { + ErrorF("No video driver modules found\n"); + } + if (ilist) { + ErrorF("List of input modules:\n"); + for (il = ilist; *il; il++) + ErrorF("\t%s\n", *il); + } else { + ErrorF("No input modules found\n"); + } + + /* Load all the drivers that were found. */ + xf86LoadModules(vlist, NULL); + xf86LoadModules(ilist, NULL); +#endif + + /* Disable PCI devices */ + xf86AccessInit(); + xf86FindPrimaryDevice(); + + vl = vlist; + /* Call all of the probe functions, reporting the results. */ + for (i = 0; i < xf86NumDrivers; i++) { + probeResultPci = FALSE; + probeResultIsa = FALSE; + + /* We don't allow vga as we want direct support */ + /* Then fallback later if no driver found */ + if (strcmp(*vl,"vga")) { + if (xf86DriverList[i]->Probe != NULL) + probeResultPci = xf86DriverList[i]->Probe(xf86DriverList[i], + PROBE_DETECTPCI); + if (!probeResultPci) + probeResultIsa = xf86DriverList[i]->Probe(xf86DriverList[i], + PROBE_DETECTISA); + + } else { + haveVGA = i; + } + + /* Bail when we find the primary card ! */ + if (probeResultPci) { + ErrorF("We have found a PCI %s driver\n",*vl); + if (foundDriver == NULL) { + foundDriver = *vl; + if (xf86DriverList[i]->Identify != NULL) + xf86DriverList[i]->Identify(0); + if (xf86DriverList[i]->AvailableOptions != NULL) + options = xf86DriverList[i]->AvailableOptions( + (ConfiguredPciCard->vendor << 16) | + ConfiguredPciCard->chipType, BUS_PCI); + } + } else + if (probeResultIsa) { + ErrorF("We have found an ISA %s driver\n",*vl); + if (foundDriver == NULL) { + foundDriver = *vl; + if (xf86DriverList[i]->Identify != NULL) + xf86DriverList[i]->Identify(0); + if (xf86DriverList[i]->AvailableOptions != NULL) + options = xf86DriverList[i]->AvailableOptions( + ConfiguredIsaCard, BUS_ISA); + } + } + + vl++; + } + + /* Try vga driver if we haven't found any direct modules */ + if ((haveVGA != -1) && (foundDriver == NULL)) { + probeResultPci = FALSE; + probeResultIsa = FALSE; + + if (xf86DriverList[haveVGA]->Probe != NULL) { + probeResultPci = + xf86DriverList[haveVGA]->Probe(xf86DriverList[haveVGA], + PROBE_DETECTPCI); + if (!probeResultPci) + xf86DriverList[haveVGA]->Probe(xf86DriverList[haveVGA], + PROBE_DETECTISA); + } + + /* Bail when we find the primary card ! */ + if (probeResultPci) { + ErrorF("Failed to find a direct driver but....\n"); + ErrorF("We have found a PCI vga driver\n"); + foundDriver = "vga"; + if (xf86DriverList[haveVGA]->Identify != NULL) + xf86DriverList[haveVGA]->Identify(0); + if (xf86DriverList[haveVGA]->AvailableOptions != NULL) + options = xf86DriverList[i]->AvailableOptions(( + ConfiguredPciCard->vendor << 16) | + ConfiguredPciCard->chipType, BUS_PCI); + } + if (probeResultIsa) { + ErrorF("Failed to find a direct driver but....\n"); + ErrorF("We have found an ISA vga driver\n"); + foundDriver = "vga"; + if (xf86DriverList[haveVGA]->Identify != NULL) + xf86DriverList[haveVGA]->Identify(0); + if (xf86DriverList[haveVGA]->AvailableOptions != NULL) + options = xf86DriverList[i]->AvailableOptions( + ConfiguredIsaCard, BUS_ISA); + } + } + + if ((haveVGA == -1) && (foundDriver == NULL)) { + ErrorF("Unable to configure XFree86 - no able drivers found.\n"); + goto bail; + } + + /* Let's write the config file now ! */ + xf86config = malloc(sizeof(XF86ConfigRec)); + memset ((XF86ConfigPtr)xf86config, 0, sizeof(XF86ConfigRec)); + xf86config->conf_monitor_lst = configureMonitorSection(); + xf86config->conf_files = configureFilesSection(); + xf86config->conf_modules = configureModuleSection(); + xf86config->conf_flags = configureFlagsSection(); + xf86config->conf_videoadaptor_lst = configureVideoAdaptorSection(); + xf86config->conf_modes_lst = configureModesSection(); + xf86config->conf_layout_lst = configureLayoutSection(); + xf86config->conf_device_lst = configureDeviceSection(foundDriver, options); + xf86config->conf_screen_lst = configureScreenSection(foundDriver); + xf86config->conf_vendor_lst = configureVendorSection(); + xf86config->conf_dri = configureDRISection(); + xf86config->conf_input_lst = configureInputSection(); + + if (!havePrimary) { + ErrorF("Unable to configure XFree86 - Primary card driver not found.\n"); + goto bail; + } + + if (!(home = getenv("HOME"))) + home = "/"; + { + char homebuf[PATH_MAX]; + /* getenv might return R/O memory, as with OS/2 */ + strncpy(homebuf,home,PATH_MAX-1); + homebuf[PATH_MAX-1] = '\0'; + home = homebuf; + + if (!(filename = + (char *)ALLOCATE_LOCAL(strlen(home) + + strlen("XF86Config.new") + 3))) + + if (home[0] == '/' && home[1] == '\0') + home[0] = '\0'; + sprintf(filename, "%s/XF86Config.new", home); + } + + xf86WriteConfigFile(filename, xf86config); + + ErrorF("\nXFree86 has configured your server for your primary card\n"); + ErrorF("\nYour XF86Config file is located in %s\n",home); + ErrorF("\nTo test the server, type 'cd <return>' to take you back to\n"); + ErrorF("Your home directory. Then type 'XFree86 -xf86config XF86Config.new'\n"); + +bail: +#ifdef XFree86LOADER + LoaderFreeDirList(vlist); + LoaderFreeDirList(ilist); +#endif /* XFree86LOADER */ + + OsCleanup(); + AbortDDX(); + fflush(stderr); + exit(0); +} diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c b/xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c index 31683f90f..8609bdfdc 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.23 1999/11/26 02:26:09 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.26 2000/02/14 02:54:03 mvojkovi Exp $ */ /* $XConsortium: xf86Cursor.c /main/10 1996/10/19 17:58:23 kaleb $ */ #define NEED_EVENTS @@ -184,6 +184,7 @@ xf86ZoomViewport (ScreenPtr pScreen, int zoom) { ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); Bool tmp; + int px, py; if (pScr->zoomLocked) return; @@ -231,6 +232,9 @@ xf86ZoomViewport (ScreenPtr pScreen, int zoom) if (pScr->AdjustFrame != NULL) (pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); + + miPointerPosition(&px, &py); + xf86WarpCursor(pScreen, px, py); } diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c b/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c index 944e02500..58e78cf04 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86DGA.c @@ -3,7 +3,7 @@ Written by Mark Vojkovich */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.31 1999/12/31 15:14:48 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.32 2000/01/21 01:12:11 dawes Exp $ */ #include "xf86.h" #include "xf86str.h" @@ -267,7 +267,7 @@ DGASetDGAMode( } pScreenPriv->dgaColormap = NULL; (*pScreenPriv->funcs->SetMode)(pScrn, NULL); - (*pScrn->SaveRestoreImage)(index, RestoreImage); + (*pScrn->EnableDisableFBAccess)(index, TRUE); FreeMarkedVisuals(pScreen); } @@ -287,22 +287,14 @@ DGASetDGAMode( if(!pScreenPriv->current) { Bool oldVTSema = pScrn->vtSema; - Bool result; pScrn->vtSema = FALSE; /* kludge until we rewrite VT switching */ - result = (*pScrn->SaveRestoreImage)(index, SaveImage); + (*pScrn->EnableDisableFBAccess)(index, FALSE); pScrn->vtSema = oldVTSema; - - if(!result) { - xfree(device); - return BadAlloc; - } } if(!(*pScreenPriv->funcs->SetMode)(pScrn, pMode)) { xfree(device); - if(!pScreenPriv->current) - (*pScrn->SaveRestoreImage)(index, FreeImage); return BadAlloc; } diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c b/xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c index d3297f499..81d79ddd0 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c,v 1.4 1999/10/26 15:58:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoProbe.c,v 1.7 2000/02/18 17:16:25 tsi Exp $ */ /* * finish setting up the server * Load the driver modules and call their probe functions. @@ -28,7 +28,7 @@ void DoProbe() { int i; - Bool probeResult; + Bool probeResultISA, probeResultPCI, probeResultFBDEV; #ifdef XFree86LOADER /* Find the list of video driver modules. */ @@ -61,12 +61,32 @@ DoProbe() /* Call all of the probe functions, reporting the results. */ for (i = 0; i < xf86NumDrivers; i++) { - probeResult = FALSE; - if (xf86DriverList[i]->Probe != NULL) - probeResult = xf86DriverList[i]->Probe(xf86DriverList[i], - PROBE_DETECT); - ErrorF("Probe in driver `%s' returns %s\n", - xf86DriverList[i]->driverName, BOOLTOSTRING(probeResult)); + probeResultISA = probeResultPCI = probeResultFBDEV = FALSE; + if (xf86DriverList[i]->Probe != NULL) { + probeResultISA = + xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DETECTISA); + ErrorF("Probe ISA capabilities in driver `%s' returns %s\n", + xf86DriverList[i]->driverName, BOOLTOSTRING(probeResultISA)); + } + if (xf86DriverList[i]->Probe != NULL) { + probeResultPCI = + xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DETECTPCI); + ErrorF("Probe PCI capabilities in driver `%s' returns %s\n", + xf86DriverList[i]->driverName, BOOLTOSTRING(probeResultPCI)); + } + if (xf86DriverList[i]->Probe != NULL) { + probeResultFBDEV = + xf86DriverList[i]->Probe(xf86DriverList[i], PROBE_DETECTFBDEV); + ErrorF("Probe FBDEV capabilities in driver `%s' returns %s\n", + xf86DriverList[i]->driverName, BOOLTOSTRING(probeResultFBDEV)); + } + + /* If we have a result, then call driver's Identify function */ + if (probeResultISA || probeResultPCI || probeResultFBDEV) { + if (xf86DriverList[i]->Identify != NULL) { + xf86DriverList[i]->Identify(0); + } + } } #ifdef XFree86LOADER diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c b/xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c index f42cba25b..13e2ff0ee 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c,v 1.6 1999/06/20 05:23:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DoScanPci.c,v 1.10 2000/02/21 20:34:30 dawes Exp $ */ /* * finish setting up the server * call the functions from the scanpci module @@ -19,19 +19,19 @@ #include "xf86.h" #include "xf86Priv.h" #include "xf86Pci.h" -#define DECLARE_CARD_DATASTRUCTURES TRUE +#define DECLARE_CARD_DATASTRUCTURES #include "xf86PciInfo.h" +#include "xf86ScanPci.h" -static void (*xf86ScanPciFunc)(int); - -void xf86DisplayPCICardInfo(int); void DoScanPci(int argc, char **argv, int i) { int j,skip,globalVerbose,scanpciVerbose; + void (*xf86ScanPciFunc)(int); + void (*DataSetupFunc)(SymTabPtr *, pciVendorDeviceInfo **, + pciVendorCardInfo **); #ifdef XFree86LOADER int errmaj, errmin; - char *name; #endif /* @@ -71,36 +71,24 @@ void DoScanPci(int argc, char **argv, int i) /* Tell the loader the default module search path */ LoaderSetPath(xf86ModulePath); - - /* Normalise the module name */ - name = xf86NormalizeName("scanpci"); - - if (!LoadModule(name, NULL, NULL, NULL, NULL, NULL, + if (!LoadModule("scanpci", NULL, NULL, NULL, NULL, NULL, &errmaj, &errmin)) { - LoaderErrorMsg(NULL, name, errmaj, errmin); + LoaderErrorMsg(NULL, "scanpci", errmaj, errmin); exit(1); } if (LoaderCheckUnresolved(LD_RESOLV_IFDONE)) { /* For now, just a warning */ xf86Msg(X_WARNING, "Some symbols could not be resolved!\n"); } - xf86ScanPciFunc = (void (*)(int))LoaderSymbol("xf86DisplayPCICardInfo"); - /* - * we need to get the pointer to the pci data structures initialized - */ - xf86PCIVendorInfo = - (pciVendorDeviceInfo*)LoaderSymbol("xf86PCIVendorInfoData"); - xf86PCIVendorNameInfo = - (SymTabPtr)LoaderSymbol("xf86PCIVendorNameInfoData"); - xf86PCICardInfo = - (pciVendorCardInfo*)LoaderSymbol("xf86PCICardInfoData"); + xf86ScanPciFunc = LoaderSymbol("xf86DisplayPCICardInfo"); + DataSetupFunc = LoaderSymbol("xf86SetupScanPci"); #else xf86ScanPciFunc = xf86DisplayPCICardInfo; - xf86PCIVendorNameInfo = xf86PCIVendorNameInfoData; - xf86PCIVendorInfo = xf86PCIVendorInfoData; - xf86PCICardInfo = xf86PCICardInfoData; + DataSetupFunc = xf86SetupScanPci; #endif + (*DataSetupFunc)(&xf86PCIVendorNameInfo, &xf86PCIVendorInfo, + &xf86PCICardInfo); (*xf86ScanPciFunc)(scanpciVerbose); /* diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c index 3f234554a..a9e9432f1 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Events.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Events.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.83 1999/12/27 00:39:42 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.92 2000/02/13 03:36:03 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -122,6 +122,7 @@ extern fd_set EnabledDevices; #if defined(XQUEUE) extern void xf86XqueRequest(void); #endif +extern void (*xf86OSPMClose)(void); static void xf86VTSwitch(void); @@ -429,8 +430,18 @@ xf86PostKbdEvent(unsigned key) /* * Ignore virtual shifts (E0 2A, E0 AA, E0 36, E0 B6) */ + case 0x2A: + case 0x36: + return; default: - return; /* skip illegal */ + xf86MsgVerb(X_INFO, 2, "Unreported Prefix0 scancode: 0x%02x\n", + scanCode); + /* + * "Internet" keyboards are generating lots of new codes. Let them + * pass. There is little consistency between them, so don't bother + * with symbolic names at this level. + */ + scanCode += 0x78; } } @@ -955,14 +966,31 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) } #else /* __EMX__ and __QNX__ */ + InputInfoPtr pInfo; + (xf86Info.kbdEvents)(); /* Under OS/2 and QNX, always call */ - (xf86Info.mouseDev->mseEvents)(xf86Info.mouseDev); -#endif /* __EMX__ and __QNX__ */ + pInfo = xf86InputDevs; + while (pInfo) { + if (pInfo->read_input && pInfo->fd >= 0) { + int sigstate = xf86BlockSIGIO(); + + pInfo->read_input(pInfo); + xf86UnblockSIGIO(sigstate); + /* + * Must break here because more than one device may share + * the same file descriptor. + */ + break; + } + pInfo = pInfo->next; + } - { - IHPtr ih; +#endif /* __EMX__ and __QNX__ */ + if (err >= 0) { /* we don't want the handlers called if select() */ + IHPtr ih; /* returned with an error condition, do we? */ + for (ih = InputHandlers; ih; ih = ih->next) { if (ih->enabled && ih->fd >= 0 && ih->ihproc && (FD_ISSET(ih->fd, ((fd_set *)pReadmask)) != 0)) { @@ -970,7 +998,7 @@ xf86Wakeup(pointer blockData, int err, pointer pReadmask) } } } - + if (xf86VTSwitchPending()) xf86VTSwitch(); if (xf86Info.inputPending) ProcessInputEvents(); @@ -1027,6 +1055,9 @@ xf86SigHandler(int signo) { signal(signo,SIG_IGN); xf86Info.caughtSignal = TRUE; +#ifdef XF86BIGFONT + XF86BigfontCleanup(); +#endif #if defined(DEBUG) && defined(XFree86LOADER) if (signo == SIGSEGV) LoaderDumpSymbols(); @@ -1066,8 +1097,8 @@ xf86VTSwitch() #endif for (i = 0; i < xf86NumScreens; i++) { if (!(dispatchException & DE_TERMINATE)) - if (xf86Screens[i]->SaveRestoreImage) - xf86Screens[i]->SaveRestoreImage(i, SaveImage); + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); } xf86EnterServerState(SETUP); for (i = 0; i < xf86NumScreens; i++) { @@ -1083,8 +1114,8 @@ xf86VTSwitch() #endif /* !__EMX__ */ for (ih = InputHandlers; ih; ih = ih->next) xf86DisableInputHandler(ih); - xf86AccessLeaveState(); /* We need this here, otherwise */ - xf86AccessLeave(); /* console won't be restored */ + xf86AccessLeave(); /* We need this here, otherwise */ + xf86AccessLeaveState(); /* console won't be restored */ if (!xf86VTSwitchAway()) { /* @@ -1103,8 +1134,8 @@ xf86VTSwitch() xf86EnterServerState(OPERATING); if (!(dispatchException & DE_TERMINATE)) { for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->SaveRestoreImage) - xf86Screens[i]->SaveRestoreImage(i, RestoreImage); + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); } } SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); @@ -1121,6 +1152,9 @@ xf86VTSwitch() xf86EnableInputHandler(ih); } else { + if (xf86OSPMClose) + xf86OSPMClose(); + for (i = 0; i < xf86NumScreens; i++) { /* * zero all access functions to @@ -1137,7 +1171,8 @@ xf86VTSwitch() ErrorF("xf86VTSwitch: Entering\n"); #endif if (!xf86VTSwitchTo()) return; - + xf86OSPMClose = xf86OSPMOpen(); + xf86EnableIO(); xf86AccessEnter(); xf86EnterServerState(SETUP); @@ -1148,8 +1183,8 @@ xf86VTSwitch() } xf86EnterServerState(OPERATING); for (i = 0; i < xf86NumScreens; i++) { - if (xf86Screens[i]->SaveRestoreImage) - xf86Screens[i]->SaveRestoreImage(i, RestoreImage); + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess)(i, TRUE); } /* Turn screen saver off when switching back */ @@ -1196,15 +1231,18 @@ xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data) return ih; } -void +int xf86RemoveInputHandler(pointer handler) { IHPtr ih, p; - + int fd; + if (!handler) - return; + return -1; ih = handler; + fd = ih->fd; + if (ih->fd >= 0) RemoveEnabledDevice(ih->fd); @@ -1218,6 +1256,7 @@ xf86RemoveInputHandler(pointer handler) p->next = ih->next; } xfree(ih); + return fd; } void @@ -1268,8 +1307,6 @@ XTestJumpPointer(int jx, int jy, int dev_type) miPointerAbsoluteCursor(jx, jy, GetTimeInMillis() ); } - - void XTestGenerateEvent(int dev_type, int keycode, int keystate, int mousex, int mousey) diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c b/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c index 86b12f77e..de3c11b88 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Globals.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.26 1999/11/02 16:16:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.27 2000/01/25 00:18:28 alanh Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -150,6 +150,7 @@ Bool xf86Resetting = FALSE; Bool xf86Initialising = FALSE; Bool xf86ProbeFailed = FALSE; Bool xf86DoProbe = FALSE; +Bool xf86DoConfigure = FALSE; #ifdef XFree86LOADER DriverPtr *xf86DriverList = NULL; int xf86NumDrivers = 0; diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c b/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c index 7bb5f5a42..25168e670 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Helper.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.64 1999/12/03 19:17:23 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.76 2000/02/21 19:22:52 dawes Exp $ */ /* * Copyright (c) 1997-1998 by The XFree86 Project, Inc. @@ -26,6 +26,7 @@ #include "xf86DDC.h" #include "xf86Xinput.h" #include "xf86InPriv.h" +#include "mivalidate.h" /* For xf86GetClocks */ #if defined(CSRG_BASED) || defined(MACH386) @@ -120,7 +121,7 @@ xf86AllocateScreen(DriverPtr drv, int flags) * Almost everything uses this default, and many of those that don't * will wrap it. */ - xf86Screens[i]->SaveRestoreImage = xf86SaveRestoreImage; + xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess; xf86Screens[i]->drv = drv; drv->refCount++; @@ -926,71 +927,151 @@ xf86SetBlackWhitePixels(ScreenPtr pScreen) } /* - * Create a new serial number for the window. Used in xf86SaveRestoreImage() - * to force revalidation of all the GC in the window tree of each screen. + * xf86SetRootClip -- + * Enable or disable rendering to the screen by + * setting the root clip list and revalidating + * all of the windows */ -/*ARGSUSED*/ -int -xf86NewSerialNumber(WindowPtr pWin, pointer unused) -{ - pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER; - return WT_WALKCHILDREN; -} -/* - * A second utility function for xf86SaveRestoreImage(). This one finds the - * pixmaps whose private data is to be exchanged and creates a region that - * covers the virtual screen. - */ static void -xf86GetPixmapsAndRegion(ScrnInfoPtr pScrnInfo, ScreenPtr pScreen, - PixmapPtr *pspix, PixmapPtr *ppix, RegionPtr pRegion) -{ - BoxRec pixBox; +xf86SetRootClip (ScreenPtr pScreen, BOOL enable) +{ + WindowPtr pWin = WindowTable[pScreen->myNum]; + WindowPtr pChild; + Bool WasViewable = (Bool)(pWin->viewable); + Bool anyMarked; + RegionPtr pOldClip, bsExposed; +#ifdef DO_SAVE_UNDERS + Bool dosave = FALSE; +#endif + WindowPtr pLayerWin; + BoxRec box; - *pspix = (*pScreen->GetScreenPixmap)(pScreen); - *ppix = pScrnInfo->ppix; + if (WasViewable) + { + for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) + { + (void) (*pScreen->MarkOverlappedWindows)(pChild, + pChild, + &pLayerWin); + } + (*pScreen->MarkWindow) (pWin); + anyMarked = TRUE; + if (pWin->valdata) + { + if (HasBorder (pWin)) + { + RegionPtr borderVisible; - pixBox.x1 = pixBox.y1 = 0; - pixBox.x2 = pScreen->width; - pixBox.y2 = pScreen->height; - REGION_INIT(pScreen, pRegion, &pixBox, 1); -} + borderVisible = REGION_CREATE(pScreen, NullBox, 1); + REGION_SUBTRACT(pScreen, borderVisible, + &pWin->borderClip, &pWin->winSize); + pWin->valdata->before.borderVisible = borderVisible; + } + pWin->valdata->before.resized = TRUE; + } + } + + /* + * Use REGION_BREAK to avoid optimizations in ValidateTree + * that assume the root borderClip can't change well, normally + * it doesn't...) + */ + if (enable) + { + box.x1 = 0; + box.y1 = 0; + box.x2 = pScreen->width; + box.y2 = pScreen->height; + REGION_RESET(pScreen, &pWin->borderClip, &box); + REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + } + else + { + REGION_EMPTY(pScreen, &pWin->borderClip); + REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + } + + ResizeChildrenWinSize (pWin, 0, 0, 0, 0); + + if (WasViewable) + { + if (pWin->backStorage) + { + pOldClip = REGION_CREATE(pScreen, NullBox, 1); + REGION_COPY(pScreen, pOldClip, &pWin->clipList); + } -/* - * A third utility function for xf86SaveRestoreImage(). This one exchanges the - * private data of two pixmaps. - */ -static void -xf86ExchangePixmapData(PixmapPtr pspix, PixmapPtr ppix) -{ -#ifdef PIXPRIV - DevUnion *devPrivates = pspix->devPrivates; -#endif - DevUnion devPrivate = pspix->devPrivate; - int devKind = pspix->devKind; + if (pWin->firstChild) + { + anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild, + pWin->firstChild, + (WindowPtr *)NULL); + } + else + { + (*pScreen->MarkWindow) (pWin); + anyMarked = TRUE; + } -#ifdef PIXPRIV - pspix->devPrivates = ppix->devPrivates; - ppix->devPrivates = devPrivates; -#endif +#ifdef DO_SAVE_UNDERS + if (DO_SAVE_UNDERS(pWin)) + { + dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin); + } +#endif /* DO_SAVE_UNDERS */ - pspix->devPrivate = ppix->devPrivate; - ppix->devPrivate = devPrivate; + if (anyMarked) + (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); + } - pspix->devKind = ppix->devKind; - ppix->devKind = devKind; + if (pWin->backStorage && + ((pWin->backingStore == Always) || WasViewable)) + { + if (!WasViewable) + pOldClip = &pWin->clipList; /* a convenient empty region */ + bsExposed = (*pScreen->TranslateBackingStore) + (pWin, 0, 0, pOldClip, + pWin->drawable.x, pWin->drawable.y); + if (WasViewable) + REGION_DESTROY(pScreen, pOldClip); + if (bsExposed) + { + RegionPtr valExposed = NullRegion; + + if (pWin->valdata) + valExposed = &pWin->valdata->after.exposed; + (*pScreen->WindowExposures) (pWin, valExposed, bsExposed); + if (valExposed) + REGION_EMPTY(pScreen, valExposed); + REGION_DESTROY(pScreen, bsExposed); + } + } + if (WasViewable) + { + 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); + } + if (pWin->realized) + WindowsRestructured (); + FlushAllOutput (); } /* - * Function to save/restore the video image and replace the root drawable - * with a pixmap. + * Function to enable/disable access to the frame buffer * * This is used when VT switching and when entering/leaving DGA direct mode. * - * This has been rewritten compared with the older code, with the intention - * of making it more general. It relies on some new functions added to - * the ScreenRec. + * This has been rewritten again to eliminate the saved pixmap. The + * devPrivate field in the screen pixmap is set to NULL to catch code + * accidentally referencing the frame buffer while the X server is not + * supposed to touch it. * * Here, we exchange the pixmap private data, rather than the pixmaps * themselves to avoid having to find and change any references to the screen @@ -1001,85 +1082,43 @@ xf86ExchangePixmapData(PixmapPtr pspix, PixmapPtr ppix) * whether they are switched in or out by keeping track of the root pixmap's * private data, and therefore don't need to access pScrnInfo->vtSema. */ -Bool -xf86SaveRestoreImage(int scrnIndex, SaveRestoreFlags what) +void +xf86EnableDisableFBAccess(int scrnIndex, Bool enable) { ScrnInfoPtr pScrnInfo = xf86Screens[scrnIndex]; ScreenPtr pScreen = pScrnInfo->pScreen; - PixmapPtr pspix, ppix; - RegionRec pixReg; + PixmapPtr pspix; - switch (what) { - case SaveImage: + pspix = (*pScreen->GetScreenPixmap) (pScreen); + if (enable) + { /* - * Create a dummy pixmap to write to while VT is switched out, and - * copy the screen to that pixmap. + * Restore the screen pixmap devPrivate field */ - if (!pScrnInfo->ppix) { - pScrnInfo->ppix = (*pScreen->CreatePixmap)(pScreen, - pScrnInfo->displayWidth, pScreen->height, pScreen->rootDepth); - if (!pScrnInfo->ppix) - return FALSE; - } - - /* Determine pixmaps to swap and virtual screen region */ - xf86GetPixmapsAndRegion(pScrnInfo, pScreen, &pspix, &ppix, &pixReg); - - /* Copy screen to temporary pixmap */ - (*pScreen->BackingStoreFuncs.SaveAreas)(ppix, &pixReg, 0, 0, - WindowTable[scrnIndex]); - - /* Swap pixmap data */ - xf86ExchangePixmapData(pspix, ppix); - - /* Cause revalidation of all GC's */ - WalkTree(pScreen, xf86NewSerialNumber, 0); - - /* Turf region */ - REGION_UNINIT(pScreen, &pixReg); - break; - - case RestoreImage: + pspix->devPrivate = pScrnInfo->pixmapPrivate; /* - * Reinstate the screen pixmap and copy the dummy pixmap back - * to the screen. + * Restore all of the clip lists on the screen */ - if (!xf86Resetting) { - if (!pScrnInfo->ppix) - return FALSE; - - /* Determine pixmaps to swap and virtual screen region */ - xf86GetPixmapsAndRegion(pScrnInfo, pScreen, - &pspix, &ppix, &pixReg); - - /* Swap pixmap data */ - xf86ExchangePixmapData(pspix, ppix); + if (!xf86Resetting) + xf86SetRootClip (pScreen, TRUE); - /* Restore screen from temporary pixmap */ - (*pScreen->BackingStoreFuncs.RestoreAreas)(ppix, &pixReg, 0, 0, - WindowTable[scrnIndex]); - - /* Cause revalidation of all GC's */ - WalkTree(pScreen, xf86NewSerialNumber, 0); - - /* Turf region */ - REGION_UNINIT(pScreen, &pixReg); - } - /* Fall through */ - - case FreeImage: - if (pScrnInfo->ppix) { - (*pScreen->DestroyPixmap)(pScrnInfo->ppix); - pScrnInfo->ppix = NULL; - } - break; - - default: - ErrorF("xf86SaveRestoreImage: Invalid flag (%d)\n", what); - return FALSE; } - return TRUE; + else + { + /* + * Empty all of the clip lists on the screen + */ + xf86SetRootClip (pScreen, FALSE); + /* + * save the screen pixmap devPrivate field and + * replace it with NULL so accidental references + * to the frame buffer are caught + */ + pScrnInfo->pixmapPrivate = pspix->devPrivate; + pspix->devPrivate.ptr = NULL; + } } + /* Buffer to hold log data written before the log file is opened */ static char *saveBuffer = NULL; static int size = 0, unused = 0, pos = 0; @@ -1410,7 +1449,7 @@ xf86MatchDevice(const char *drivername, GDevPtr **driversectlist) confScreenPtr screensecptr; int i,j; -if (xf86DoProbe) return 1; +if (xf86DoProbe || xf86DoConfigure) return 1; /* * This is a very important function that matches the device sections @@ -1549,6 +1588,8 @@ xf86MatchPciInstances(const char *driverName, int vendorID, GDevPtr dev = NULL; int *retEntities = NULL; + *foundEntities = NULL; + if (vendorID == 0) { for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) { for (id = PCIchipsets; id->PCIid != -1; id++) { @@ -1581,8 +1622,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID, } } } else { - /* Find PCI devices that match the given vendor ID */ - + /* Find PCI devices that match the given vendor ID */ for (ppPci = xf86PciVideoInfo; *ppPci != NULL; ppPci++) { if ((*ppPci)->vendor == vendorID) { ++allocatedInstances; @@ -1615,6 +1655,30 @@ xf86MatchPciInstances(const char *driverName, int vendorID, return 0; } if (xf86DoProbe) return 1; + + if (xf86DoConfigure) { + pciVideoPtr ConfCard; + int actualcards = 0; + ConfiguredPciCard = xnfrealloc((pciVideoPtr)ConfiguredPciCard, sizeof(pciVideoRec) * (allocatedInstances + FoundPciCards)); + ConfCard = ConfiguredPciCard; + for (i = 0; i < FoundPciCards; i++) + ConfCard++; + for (i = 0; i < allocatedInstances; i++) { + if (instances[i].foundHW) { + actualcards++; + pPci = instances[i].pci; + ConfCard->vendor = pPci->vendor; + ConfCard->chipType = pPci->chipType; + ConfCard->device = pPci->device; + ConfCard->bus = pPci->bus; + ConfCard->func = pPci->func; + ConfCard++; + } + } + FoundPciCards += actualcards; + return actualcards; + } + #ifdef DEBUG ErrorF("%s instances found: %d\n", driverName, allocatedInstances); #endif @@ -1778,6 +1842,7 @@ xf86MatchPciInstances(const char *driverName, int vendorID, if (numFound > 0) { *foundEntities = retEntities; } + return numFound; } @@ -1793,10 +1858,18 @@ xf86MatchIsaInstances(const char *driverName, SymTabPtr chipsets, int numFound = 0; int *retEntities = NULL; + *foundEntities = NULL; + /* For now, bail here when xf86DoProbe is set. */ if (xf86DoProbe) return 0; + if (xf86DoConfigure) { + if (FindIsaDevice) ConfiguredIsaCard = (*FindIsaDevice)(NULL); + if (ConfiguredIsaCard != -1) return 1; + else return 0; + } + for (i = 0; i < numDevs; i++) { MessageType from = X_CONFIG; GDevPtr dev = NULL; @@ -2144,6 +2217,16 @@ xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name) #endif } +Bool +xf86LoaderCheckSymbol(const char *name) +{ +#ifdef XFree86LOADER + return LoaderSymbol(name) != NULL; +#else + return TRUE; +#endif +} + void xf86LoaderReqSymLists(const char **list0, ...) { @@ -2184,6 +2267,44 @@ CARD32 xf86DummyVar1; CARD32 xf86DummyVar2; CARD32 xf86DummyVar3; +CARD8 xf86PeekFb8(CARD8 *p) { return *p; } +CARD16 xf86PeekFb16(CARD16 *p) { return *p; } +CARD32 xf86PeekFb32(CARD32 *p) { return *p; } +void xf86PokeFb8(CARD8 *p, CARD8 v) { *p = v; } +void xf86PokeFb16(CARD16 *p, CARD16 v) { *p = v; } +void xf86PokeFb32(CARD16 *p, CARD32 v) { *p = v; } + +CARD8 xf86PeekMmio8(pointer Base, unsigned long Offset) +{ + return MMIO_IN8(Base,Offset); +} + +CARD16 xf86PeekMmio16(pointer Base, unsigned long Offset) +{ + return MMIO_IN16(Base,Offset); +} + +CARD32 xf86PeekMmio32(pointer Base, unsigned long Offset) +{ + return MMIO_IN32(Base,Offset); +} + +void xf86PokeMmio8(pointer Base, unsigned long Offset, CARD8 v) +{ + MMIO_OUT8(Base,Offset,v); +} + +void xf86PokeMmio16(pointer Base, unsigned long Offset, CARD16 v) +{ + MMIO_OUT16(Base,Offset,v); +} + +void xf86PokeMmio32(pointer Base, unsigned long Offset, CARD32 v) +{ + MMIO_OUT32(Base,Offset,v); +} + + typedef enum { OPTION_BACKING_STORE } BSOpts; @@ -2477,3 +2598,20 @@ ErrorF("xf86RegisterRootWindowProperty succeeded\n"); return(Success); } +Bool +xf86IsUnblank(int mode) +{ + switch(mode) { + case SCREEN_SAVER_OFF: + case SCREEN_SAVER_FORCER: + return TRUE; + case SCREEN_SAVER_ON: + case SCREEN_SAVER_CYCLE: + return FALSE; + default: + xf86MsgVerb(X_WARNING, 0, "Unexpected save screen mode: %d\n", mode); + return TRUE; + } +} + + diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Init.c b/xc/programs/Xserver/hw/xfree86/common/xf86Init.c index 4d4331a71..d1c3f2252 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Init.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Init.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.142 1999/11/19 13:54:21 hohndel Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.152 2000/02/21 19:22:52 dawes Exp $ */ /* * Copyright 1991-1999 by The XFree86 Project, Inc. @@ -30,7 +30,6 @@ extern int atoi(); #ifdef XFree86LOADER #include "loaderProcs.h" #endif - #ifdef XFreeXDGA #include "dgaproc.h" #endif @@ -42,7 +41,6 @@ extern int atoi(); #include "xf86_OSlib.h" #include "xf86Version.h" #include "mipointer.h" - #ifdef XINPUT #include "XI.h" #include "XIproto.h" @@ -74,6 +72,8 @@ static char *expKey = NULL; extern void os2ServerVideoAccess(); #endif +void (*xf86OSPMClose)(void) = NULL; + #ifdef XFree86LOADER static char *baseModules[] = { "bitmap", @@ -104,9 +104,6 @@ InputDriverRec xf86KEYBOARD = { NULL, 0 }; -#undef MOUSE -extern InputDriverRec MOUSE; - static Bool xf86CreateRootWindow(WindowPtr pWin) @@ -206,7 +203,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) Pix24Flags screenpix24, pix24; MessageType pix24From = X_DEFAULT; Bool pix24Fail = FALSE; - + #ifdef __EMX__ os2ServerVideoAccess(); /* See if we have access to the screen before doing anything */ #endif @@ -247,7 +244,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) } /* Read and parse the config file */ - if (!xf86DoProbe) { + if (!xf86DoProbe && !xf86DoConfigure) { if (!xf86HandleConfigFile()) { xf86Msg(X_ERROR, "Error from xf86HandleConfigFile()\n"); return; @@ -280,7 +277,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) } xf86OpenConsole(); - + xf86OSPMClose = xf86OSPMOpen(); + /* Run an external VT Init program if specified in the config file */ xf86RunVtInit(); @@ -342,6 +340,9 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) if (xf86DoProbe) DoProbe(); + if (xf86DoConfigure) + DoConfigure(); + /* Initialise the resource broker */ xf86ResourceBrokerInit(); @@ -356,7 +357,6 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) /* Setup the builtin input drivers */ xf86AddInputDriver(&xf86KEYBOARD, NULL, 0); - xf86AddInputDriver(&MOUSE, NULL, 0); /* Load all input driver modules specified in the config file. */ if ((modulelist = xf86InputDriverlistFromConfig())) xf86LoadModules(modulelist, NULL); @@ -508,7 +508,7 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) * Call the driver's PreInit()'s to complete initialisation for the first * generation. */ - + for (i = 0; i < xf86NumScreens; i++) { xf86EnableAccess(xf86Screens[i]); if (xf86Screens[i]->PreInit && @@ -716,6 +716,8 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) * serverGeneration != 1; some OSs have to do things here, too. */ xf86OpenConsole(); + xf86OSPMClose = xf86OSPMOpen(); + /* Make sure full I/O access is enabled */ xf86EnableIO(); } @@ -764,12 +766,14 @@ InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) if (serverGeneration != 1) { xf86Resetting = TRUE; -#ifdef HAS_USL_VTS /* All screens are in the same state, so just check the first */ if (!xf86Screens[0]->vtSema) { +#ifdef HAS_USL_VTS ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ); - } #endif + xf86AccessEnter(); + xf86EnterServerState(SETUP); + } } #ifdef SCO else { @@ -1018,7 +1022,9 @@ ddxGiveUp() #endif xf86CloseConsole(); - + if (xf86OSPMClose) + xf86OSPMClose(); + xf86CloseLog(); /* If an unexpected signal was caught, dump a core for debugging */ @@ -1092,8 +1098,11 @@ OsVendorFatalError() * Process device-dependent command line args. Returns 0 if argument is * not device dependent, otherwise Count of number of elements of argv * that are part of a device dependent commandline option. + * */ + + /* ARGSUSED */ int ddxProcessArgument(int argc, char **argv, int i) @@ -1149,10 +1158,10 @@ ddxProcessArgument(int argc, char **argv, int i) if (!argv[i + 1]) return 0; if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) { - ErrorF("\nInvalid argument for -xf86config\n" + FatalError("\nInvalid argument for -xf86config\n" "\tFor non-root users, the file specified with -xf86config must be\n" - "\ta relative path and must not contain any \"..\" elements.\n\n"); - return 0; + "\ta relative path and must not contain any \"..\" elements.\n" + "\tUsing default XF86Config search path.\n\n"); } xf86ConfigFile = argv[i + 1]; return 2; @@ -1420,6 +1429,11 @@ ddxProcessArgument(int argc, char **argv, int i) #endif return 1; } + if (!strcmp(argv[i], "-configure")) + { + xf86DoConfigure = TRUE; + return 1; + } /* OS-specific processing */ return xf86ProcessArgument(argc, argv, i); } @@ -1445,7 +1459,8 @@ ddxUseMsg() } else { - ErrorF("-xf86config file specify a configuration file (must be relative)\n"); + ErrorF("-xf86config file specify a configuration file, relative to the\n"); + ErrorF(" XF86Config search path, only root can use absolute\n"); } ErrorF("-probeonly probe for devices, then exit\n"); ErrorF("-verbose [n] verbose startup messages\n"); @@ -1561,8 +1576,12 @@ xf86LoadModules(char **list, pointer *optlist) for (i = 0; list[i] != NULL; i++) { +#ifndef NORMALISE_MODULE_NAME + name = xstrdup(list[i]); +#else /* Normalise the module name */ name = xf86NormalizeName(list[i]); +#endif /* Skip empty names */ if (name == NULL || *name == '\0') @@ -1582,6 +1601,40 @@ xf86LoadModules(char **list, pointer *optlist) } return TRUE; } + +/* + * xf86LoadModules iterates over a list that is being passed in. + */ +pointer +xf86LoadOneModule(char *name, pointer opt) +{ + int errmaj, errmin; + char *Name; + pointer mod; + + if (!name) + return NULL; + +#ifndef NORMALISE_MODULE_NAME + Name = xstrdup(name); +#else + /* Normalise the module name */ + Name = xf86NormalizeName(name); +#endif + + /* Skip empty names */ + if (Name == NULL || *Name == '\0') + return NULL; + + if (!(mod = LoadModule(Name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin))){ + LoaderErrorMsg(NULL, Name, errmaj, errmin); + xfree(Name); + return FALSE; + } + xfree(Name); + return mod; +} + #endif /* Pixmap format stuff */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Module.h b/xc/programs/Xserver/hw/xfree86/common/xf86Module.h index 51c50f411..9917cb21f 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Module.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Module.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.17 1999/07/06 11:38:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.20 2000/02/08 13:13:05 eich Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -149,12 +149,13 @@ typedef void (*InitExtension)(INITARGS); typedef struct { InitExtension initFunc; - char * name; + const char * name; Bool *disablePtr; InitExtension setupFunc; + const char ** initDependencies; } ExtensionModule; -extern ExtensionModule extension[]; +extern ExtensionModule *ExtensionModuleList; /* Prototypes for Loader functions that are exported to modules */ #ifndef IN_LOADER @@ -164,12 +165,13 @@ pointer LoadSubModule(pointer, const char *, const char **, int *, int *); void UnloadSubModule(pointer); void LoadFont(pointer); +void UnloadModule (pointer); #endif pointer LoaderSymbol(const char *); char **LoaderListDirs(const char **, const char **); void LoaderFreeDirList(char **); void LoaderErrorMsg(const char *, const char *, int, int); -void LoadExtension(ExtensionModule *); +void LoadExtension(ExtensionModule *, Bool); void LoaderRefSymLists(const char **, ...); void LoaderRefSymbols(const char *, ...); void LoaderReqSymLists(const char **, ...); diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86PM.c b/xc/programs/Xserver/hw/xfree86/common/xf86PM.c new file mode 100644 index 000000000..f260270e9 --- /dev/null +++ b/xc/programs/Xserver/hw/xfree86/common/xf86PM.c @@ -0,0 +1,146 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PM.c,v 3.2 2000/02/12 23:59:10 eich Exp $ */ + +#define NOT_YET + +#include "X.h" +#include "xf86.h" +#include "xf86Priv.h" + +int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num) = NULL; +pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event) = NULL; + +static char * +eventName(pmEvent event) +{ + switch(event) { + case XF86_APM_SYS_STANDBY: return ("System Standby Request"); + case XF86_APM_SYS_SUSPEND: return ("System Suspend Request"); + case XF86_APM_CRITICAL_SUSPEND: return ("Critical Suspend"); + case XF86_APM_USER_STANDBY: return ("User System Standby Request"); + case XF86_APM_USER_SUSPEND: return ("User System Suspend Request"); + case XF86_APM_STANDBY_RESUME: return ("System Standby Resume"); + case XF86_APM_NORMAL_RESUME: return ("Normal Resume System"); + case XF86_APM_CRITICAL_RESUME: return ("Critical Resume System"); + case XF86_APM_LOW_BATTERY: return ("Battery Low"); + case XF86_APM_POWER_STATUS_CHANGE: return ("Power Status Change"); + case XF86_APM_UPDATE_TIME: return ("Update Time"); + case XF86_APM_CAPABILITY_CHANGED: return ("Capability Changed"); + case XF86_APM_STANDBY_FAILED: return ("Standby Request Failed"); + case XF86_APM_SUSPEND_FAILED: return ("Suspend Request Failed"); + default: return ("Unknown Event"); + } +} + +static void +DoApmEvent(pmEvent event) +{ + /* we leave that as a global for now. I don't know if this might + * cause problems in the future. It is a global server variable + * therefore it needs to be in a server info structure + */ + static Bool suspended; + int i; + + switch(event) { + case XF86_APM_SYS_STANDBY: + case XF86_APM_SYS_SUSPEND: + case XF86_APM_CRITICAL_SUSPEND: /*do we want to delay a critical suspend?*/ + case XF86_APM_USER_STANDBY: + case XF86_APM_USER_SUSPEND: + /* should we do this ? */ + if (!suspended) { +#ifdef NOT_YET + for (i = 0; i < xf86NumScreens; i++) { + xf86EnableAccess(xf86Screens[i]); + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); + } + xf86EnterServerState(SETUP); + for (i = 0; i < xf86NumScreens; i++) { + xf86EnableAccess(xf86Screens[i]); + if (xf86Screens[i]->PMEvent) + xf86Screens[i]->PMEvent(i,event); + else + xf86Screens[i]->LeaveVT(i, 0); + } + xf86AccessLeave(); + xf86AccessLeaveState(); +#endif + suspended = TRUE; + } + break; + case XF86_APM_STANDBY_RESUME: + case XF86_APM_NORMAL_RESUME: + case XF86_APM_CRITICAL_RESUME: + case XF86_APM_STANDBY_FAILED: + case XF86_APM_SUSPEND_FAILED: + if (suspended) { +#ifdef NOT_YET + xf86AccessEnter(); + xf86EnterServerState(SETUP); + for (i = 0; i < xf86NumScreens; i++) { + xf86EnableAccess(xf86Screens[i]); + if (xf86Screens[i]->PMEvent) + xf86Screens[i]->PMEvent(i,event); + else + xf86Screens[i]->EnterVT(i, 0); + } + xf86EnterServerState(OPERATING); + for (i = 0; i < xf86NumScreens; i++) { + xf86EnableAccess(xf86Screens[i]); + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); + } + SaveScreens(SCREEN_SAVER_FORCER, ScreenSaverReset); +#endif + suspended = FALSE; + } + break; + default: + xf86EnterServerState(SETUP); + for (i = 0; i < xf86NumScreens; i++) { + xf86EnableAccess(xf86Screens[i]); + if (xf86Screens[i]->PMEvent) + xf86Screens[i]->PMEvent(i,event); + } + xf86EnterServerState(OPERATING); + break; + } +} + +#define MAX_NO_EVENTS 8 + +void +xf86HandlePMEvents(int fd, pointer data) +{ + pmEvent events[MAX_NO_EVENTS]; + int i,n; + Bool wait = FALSE; + + if (!xf86PMGetEventFromOs) + return; + + if ((n = xf86PMGetEventFromOs(fd,events,MAX_NO_EVENTS))) { + do { + for (i = 0; i < n; i++) { + xf86MsgVerb(3,X_INFO,"PM Event received: %s\n", + eventName(events[i])); + DoApmEvent(events[i]); + switch (xf86PMConfirmEventToOs(fd,events[i])) { + case PM_WAIT: + wait = TRUE; + break; + case PM_CONTINUE: + wait = FALSE; + break; + default: + break; + } + } + if (wait) + n = xf86PMGetEventFromOs(fd,events,MAX_NO_EVENTS); + else + break; + } while (1); + } +} diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h index f30bac9a9..78a381356 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.46 1999/12/27 00:16:07 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.50 2000/02/12 20:45:18 dawes Exp $ */ /* * PCI Probe * @@ -285,6 +285,7 @@ #define PCI_CHIP_9440 0x9440 #define PCI_CHIP_9520 0x9520 #define PCI_CHIP_9525 0x9525 +#define PCI_CHIP_9540 0x9540 #define PCI_CHIP_9660 0x9660 #define PCI_CHIP_9750 0x9750 #define PCI_CHIP_9850 0x9850 @@ -350,6 +351,9 @@ #define PCI_CHIP_SIS530 0x6306 #define PCI_CHIP_SIS6326 0x6326 #define PCI_CHIP_SIS7001 0x7001 +#define PCI_CHIP_SIS300 0x0300 +#define PCI_CHIP_SIS630 0x6300 +#define PCI_CHIP_SIS540 0x5300 /* HP */ #define PCI_CHIP_J2585A 0x1030 @@ -506,10 +510,9 @@ * first the VendorId - VendorName mapping */ extern SymTabPtr xf86PCIVendorNameInfo; -extern SymTabRec xf86PCIVendorNameInfoData[]; #ifdef INIT_PCI_VENDOR_NAME_INFO -SymTabRec xf86PCIVendorNameInfoData[] = { +static SymTabRec xf86PCIVendorNameInfoData[] = { {PCI_VENDOR_REAL3D, "Real 3D"}, {PCI_VENDOR_COMPAQ, "Compaq"}, {PCI_VENDOR_NCR_1, "NCR"}, @@ -624,712 +627,717 @@ typedef struct { struct pciDevice { unsigned short DeviceID; char *DeviceName; + CARD16 class; } Device[MAX_DEV_PER_VENDOR]; } pciVendorDeviceInfo; extern pciVendorDeviceInfo* xf86PCIVendorInfo; -extern pciVendorDeviceInfo xf86PCIVendorInfoData[]; #ifdef INIT_PCI_VENDOR_INFO -pciVendorDeviceInfo xf86PCIVendorInfoData[] = { +static pciVendorDeviceInfo xf86PCIVendorInfoData[] = { {PCI_VENDOR_REAL3D, { - {PCI_CHIP_I740_PCI, "i740 (PCI)" }, - {0x0000, NULL}}}, + {PCI_CHIP_I740_PCI, "i740 (PCI)",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_COMPAQ, { - {0x3033, "QVision 1280/p" }, - {0xae10, "Smart-2/P RAID Controller" }, - {0xae32, "Netellignet 10/100" }, - {0xae34, "Netellignet 10" }, - {0xae35, "NetFlex 3" }, - {0xae40, "Netellignet 10/100 Dual" }, - {0xae43, "Netellignet 10/100 ProLiant" }, - {0xb011, "Netellignet 10/100 Integrated" }, - {0xf130, "ThunderLAN" }, - {0xf150, "NetFlex 3 BNC" }, - {0x0000, NULL}}}, + {0x3033, "QVision 1280/p",0 }, + {0xae10, "Smart-2/P RAID Controller",0}, + {0xae32, "Netellignet 10/100",0 }, + {0xae34, "Netellignet 10",0 }, + {0xae35, "NetFlex 3",0 }, + {0xae40, "Netellignet 10/100 Dual",0 }, + {0xae43, "Netellignet 10/100 ProLiant",0 }, + {0xb011, "Netellignet 10/100 Integrated",0 }, + {0xf130, "ThunderLAN",0 }, + {0xf150, "NetFlex 3 BNC",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_NCR_1, { - {PCI_CHIP_53C810, "53c810"}, - {PCI_CHIP_53C820, "53c820"}, - {PCI_CHIP_53C825, "53c825"}, - {PCI_CHIP_53C815, "53c815"}, - {PCI_CHIP_53C810AP, "53c810AP"}, - {PCI_CHIP_53C860, "53c860"}, - {PCI_CHIP_53C896, "53c896"}, - {PCI_CHIP_53C895, "53c895"}, - {PCI_CHIP_53C885, "53c885"}, - {PCI_CHIP_53C875, "53c875"}, - {PCI_CHIP_53C875J, "53c875J"}, - {0x0000, NULL}}}, + {PCI_CHIP_53C810, "53c810",0}, + {PCI_CHIP_53C820, "53c820",0}, + {PCI_CHIP_53C825, "53c825",0}, + {PCI_CHIP_53C815, "53c815",0}, + {PCI_CHIP_53C810AP, "53c810AP",0}, + {PCI_CHIP_53C860, "53c860",0}, + {PCI_CHIP_53C896, "53c896",0}, + {PCI_CHIP_53C895, "53c895",0}, + {PCI_CHIP_53C885, "53c885",0}, + {PCI_CHIP_53C875, "53c875",0}, + {PCI_CHIP_53C875J, "53c875J",0}, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_ATI, { - {PCI_CHIP_MACH32, "Mach32"}, - {PCI_CHIP_MACH64CT, "Mach64 CT"}, - {PCI_CHIP_MACH64CX, "Mach64 CX"}, - {PCI_CHIP_MACH64ET, "Mach64 ET"}, - {PCI_CHIP_MACH64GB, "Mach64 GB"}, - {PCI_CHIP_MACH64GD, "Mach64 GD"}, - {PCI_CHIP_MACH64GI, "Mach64 GI"}, - {PCI_CHIP_MACH64GL, "Mach64 GL"}, - {PCI_CHIP_MACH64GM, "Mach64 GM"}, - {PCI_CHIP_MACH64GN, "Mach64 GN"}, - {PCI_CHIP_MACH64GO, "Mach64 GO"}, - {PCI_CHIP_MACH64GP, "Mach64 GP"}, - {PCI_CHIP_MACH64GQ, "Mach64 GQ"}, - {PCI_CHIP_MACH64GR, "Mach64 GR"}, - {PCI_CHIP_MACH64GS, "Mach64 GS"}, - {PCI_CHIP_MACH64GT, "Mach64 GT"}, - {PCI_CHIP_MACH64GU, "Mach64 GU"}, - {PCI_CHIP_MACH64GV, "Mach64 GV"}, - {PCI_CHIP_MACH64GW, "Mach64 GW"}, - {PCI_CHIP_MACH64GX, "Mach64 GX"}, - {PCI_CHIP_MACH64GZ, "Mach64 GZ"}, - {PCI_CHIP_MACH64LB, "Mach64 LB"}, - {PCI_CHIP_MACH64LD, "Mach64 LD"}, - {PCI_CHIP_MACH64LG, "Mach64 LG"}, - {PCI_CHIP_MACH64LI, "Mach64 LI"}, - {PCI_CHIP_MACH64LM, "Mach64 LM"}, - {PCI_CHIP_MACH64LN, "Mach64 LN"}, - {PCI_CHIP_MACH64LP, "Mach64 LP"}, - {PCI_CHIP_MACH64LR, "Mach64 LR"}, - {PCI_CHIP_MACH64LS, "Mach64 LS"}, - {PCI_CHIP_RAGE128RE, "Rage 128 RE"}, - {PCI_CHIP_RAGE128RF, "Rage 128 RF"}, - {PCI_CHIP_RAGE128RK, "Rage 128 RK"}, - {PCI_CHIP_RAGE128RL, "Rage 128 RL"}, - {PCI_CHIP_RAGE128PF, "Rage 128 Pro PF"}, - {PCI_CHIP_MACH64VT, "Mach64 VT"}, - {PCI_CHIP_MACH64VU, "Mach64 VU"}, - {PCI_CHIP_MACH64VV, "Mach64 VV"}, - {0x0000, NULL}}}, + {PCI_CHIP_MACH32, "Mach32",0}, + {PCI_CHIP_MACH64CT, "Mach64 CT",0}, + {PCI_CHIP_MACH64CX, "Mach64 CX",0}, + {PCI_CHIP_MACH64ET, "Mach64 ET",0}, + {PCI_CHIP_MACH64GB, "Mach64 GB",0}, + {PCI_CHIP_MACH64GD, "Mach64 GD",0}, + {PCI_CHIP_MACH64GI, "Mach64 GI",0}, + {PCI_CHIP_MACH64GL, "Mach64 GL",0}, + {PCI_CHIP_MACH64GM, "Mach64 GM",0}, + {PCI_CHIP_MACH64GN, "Mach64 GN",0}, + {PCI_CHIP_MACH64GO, "Mach64 GO",0}, + {PCI_CHIP_MACH64GP, "Mach64 GP",0}, + {PCI_CHIP_MACH64GQ, "Mach64 GQ",0}, + {PCI_CHIP_MACH64GR, "Mach64 GR",0}, + {PCI_CHIP_MACH64GS, "Mach64 GS",0}, + {PCI_CHIP_MACH64GT, "Mach64 GT",0}, + {PCI_CHIP_MACH64GU, "Mach64 GU",0}, + {PCI_CHIP_MACH64GV, "Mach64 GV",0}, + {PCI_CHIP_MACH64GW, "Mach64 GW",0}, + {PCI_CHIP_MACH64GX, "Mach64 GX",0}, + {PCI_CHIP_MACH64GZ, "Mach64 GZ",0}, + {PCI_CHIP_MACH64LB, "Mach64 LB",0}, + {PCI_CHIP_MACH64LD, "Mach64 LD",0}, + {PCI_CHIP_MACH64LG, "Mach64 LG",0}, + {PCI_CHIP_MACH64LI, "Mach64 LI",0}, + {PCI_CHIP_MACH64LM, "Mach64 LM",0}, + {PCI_CHIP_MACH64LN, "Mach64 LN",0}, + {PCI_CHIP_MACH64LP, "Mach64 LP",0}, + {PCI_CHIP_MACH64LR, "Mach64 LR",0}, + {PCI_CHIP_MACH64LS, "Mach64 LS",0}, + {PCI_CHIP_RAGE128RE, "Rage 128 RE",0}, + {PCI_CHIP_RAGE128RF, "Rage 128 RF",0}, + {PCI_CHIP_RAGE128RK, "Rage 128 RK",0}, + {PCI_CHIP_RAGE128RL, "Rage 128 RL",0}, + {PCI_CHIP_RAGE128PF, "Rage 128 Pro PF",0}, + {PCI_CHIP_MACH64VT, "Mach64 VT",0}, + {PCI_CHIP_MACH64VU, "Mach64 VU",0}, + {PCI_CHIP_MACH64VV, "Mach64 VV",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_VLSI, { - {0x0005, "82C592-FC1" }, - {0x0006, "82C593-FC1" }, - {0x0007, "82C594-AFC2" }, - {0x0009, "82C597-AFC2" }, - {0x000C, "82C541 Lynx" }, - {0x000D, "82C543 Lynx ISA" }, - {0x0702, "VAS96011" }, - {0x0000, NULL}}}, + {0x0005, "82C592-FC1",0 }, + {0x0006, "82C593-FC1",0 }, + {0x0007, "82C594-AFC2",0 }, + {0x0009, "82C597-AFC2",0 }, + {0x000C, "82C541 Lynx",0 }, + {0x000D, "82C543 Lynx ISA",0 }, + {0x0702, "VAS96011",0 }, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_AVANCE, { - {PCI_CHIP_ALG2301, "ALG2301"}, - {0x0000, NULL}}}, + {PCI_CHIP_ALG2301, "ALG2301",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_NS, { - {0x0002, "87415" }, - {0xD001, "87410" }, - {0x0000, NULL}}}, + {0x0002, "87415",0 }, + {0xD001, "87410",0 }, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_TSENG, { - {PCI_CHIP_ET4000_W32P_A, "ET4000W32P revA"}, - {PCI_CHIP_ET4000_W32P_B, "ET4000W32P revB"}, - {PCI_CHIP_ET4000_W32P_C, "ET4000W32P revC"}, - {PCI_CHIP_ET4000_W32P_D, "ET4000W32P revD"}, - {PCI_CHIP_ET6000, "ET6000/6100"}, - {PCI_CHIP_ET6300, "ET6300"}, - {0x0000, NULL}}}, + {PCI_CHIP_ET4000_W32P_A, "ET4000W32P revA",0}, + {PCI_CHIP_ET4000_W32P_B, "ET4000W32P revB",0}, + {PCI_CHIP_ET4000_W32P_C, "ET4000W32P revC",0}, + {PCI_CHIP_ET4000_W32P_D, "ET4000W32P revD",0}, + {PCI_CHIP_ET6000, "ET6000/6100",0}, + {PCI_CHIP_ET6300, "ET6300",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_WEITEK, { - {PCI_CHIP_P9000, "P9000"}, - {PCI_CHIP_P9100, "P9100"}, - {0x0000, NULL}}}, + {PCI_CHIP_P9000, "P9000",0}, + {PCI_CHIP_P9100, "P9100",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_DIGITAL, { - {PCI_CHIP_DEC21030, "21030/TGA"}, - {0x0001, "DC21050 PCI-PCI Bridge", - /* print_pcibridge} */ }, - {0x0002, "DC21040 10Mb/s Ethernet" }, - {0x0009, "DC21140 10/100 Mb/s Ethernet" }, - {0x000D, "TGA2" }, - {0x000F, "DEFPA (FDDI PCI)" }, - {0x0014, "DC21041 10Mb/s Ethernet Plus" }, - {0x0019, "DC21142 10/100 Mb/s Ethernet" }, - {0x0021, "DC21052" }, - {0x0024, "DC21152" }, - {0x0000, NULL}}}, + {PCI_CHIP_DEC21030, "21030/TGA",0}, + {0x0001, "DC21050 PCI-PCI Bridge" + /* print_pcibridge} */,0 }, + {0x0002, "DC21040 10Mb/s Ethernet",0 }, + {0x0009, "DC21140 10/100 Mb/s Ethernet",0 }, + {0x000D, "TGA2",0 }, + {0x000F, "DEFPA (FDDI PCI)",0 }, + {0x0014, "DC21041 10Mb/s Ethernet Plus",0 }, + {0x0019, "DC21142 10/100 Mb/s Ethernet",0 }, + {0x0021, "DC21052",0 }, + {0x0024, "DC21152",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_CIRRUS, { - {PCI_CHIP_GD5430, "GD5430"}, - {PCI_CHIP_GD5434_4, "GD5434"}, - {PCI_CHIP_GD5434_8, "GD5434"}, - {PCI_CHIP_GD5436, "GD5436"}, - {PCI_CHIP_GD5446, "GD5446"}, - {PCI_CHIP_GD5480, "GD5480"}, - {PCI_CHIP_GD5462, "GD5462"}, - {PCI_CHIP_GD5464, "GD5464"}, - {PCI_CHIP_GD5464BD, "GD5464BD"}, - {PCI_CHIP_GD5465, "GD5465"}, - {PCI_CHIP_GD7541, "GD7541"}, - {PCI_CHIP_GD7542, "GD7542"}, - {PCI_CHIP_GD7543, "GD7543"}, - {PCI_CHIP_GD7548, "GD7548"}, - {PCI_CHIP_GD7555, "GD7555"}, + {PCI_CHIP_GD5430, "GD5430",0}, + {PCI_CHIP_GD5434_4, "GD5434",0}, + {PCI_CHIP_GD5434_8, "GD5434",0}, + {PCI_CHIP_GD5436, "GD5436",0}, + {PCI_CHIP_GD5446, "GD5446",0}, + {PCI_CHIP_GD5480, "GD5480",0}, + {PCI_CHIP_GD5462, "GD5462",0}, + {PCI_CHIP_GD5464, "GD5464",0}, + {PCI_CHIP_GD5464BD, "GD5464BD",0}, + {PCI_CHIP_GD5465, "GD5465",0}, + {PCI_CHIP_GD7541, "GD7541",0}, + {PCI_CHIP_GD7542, "GD7542",0}, + {PCI_CHIP_GD7543, "GD7543",0}, + {PCI_CHIP_GD7548, "GD7548",0}, + {PCI_CHIP_GD7555, "GD7555",0}, #ifdef VENDOR_INCLUDE_NONVIDEO - {0x6001, "CS4236B/CS4611 Audio" }, + {0x6001, "CS4236B/CS4611 Audio" ,0}, #endif - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_IBM, { - {0x000A, "Fire Coral" }, - {0x0018, "Token Ring" }, - {0x001D, "82G2675" }, - {0x0022, "82351 pci-pci bridge" }, - {0x0000, NULL}}}, + {0x000A, "Fire Coral",0 }, + {0x0018, "Token Ring",0 }, + {0x001D, "82G2675",0 }, + {0x0022, "82351 pci-pci bridge",0 }, + {0x0000, NULL,0}}}, #endif #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_NCR_2, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, #endif #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_WD, { - {0x3296, "WD 7197" }, - {0x0000, NULL}}}, + {0x3296, "WD 7197",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_AMD, { - {0x2000, "79C970 Lance" }, - {0x2020, "53C974 SCSI" }, - {0x0000, NULL}}}, + {0x2000, "79C970 Lance",0 }, + {0x2020, "53C974 SCSI",0 }, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_TRIDENT, { - {PCI_CHIP_9320, "TGUI 9320"}, - {PCI_CHIP_9420, "TGUI 9420"}, - {PCI_CHIP_9440, "TGUI 9440"}, - {PCI_CHIP_9660, "TGUI 96xx"}, - {PCI_CHIP_9388, "Cyber 9388"}, - {PCI_CHIP_9397, "Cyber 9397"}, - {PCI_CHIP_939A, "Cyber 939A/DVD"}, - {PCI_CHIP_9520, "Cyber 9520"}, - {PCI_CHIP_9525, "Cyber 9525/DVD"}, - {PCI_CHIP_9750, "3DImage975"}, - {PCI_CHIP_9850, "3DImage985"}, - {PCI_CHIP_9880, "Blade3D"}, - {PCI_CHIP_8400, "CyberBlade/i7"}, - {PCI_CHIP_8420, "CyberBlade/DSTN/i7"}, - {PCI_CHIP_8500, "CyberBlade/i1"}, - {0x0000, NULL}}}, + {PCI_CHIP_9320, "TGUI 9320",0}, + {PCI_CHIP_9420, "TGUI 9420",0}, + {PCI_CHIP_9440, "TGUI 9440",0}, + {PCI_CHIP_9660, "TGUI 96xx",0}, + {PCI_CHIP_9388, "Cyber 9388",0}, + {PCI_CHIP_9397, "Cyber 9397",0}, + {PCI_CHIP_939A, "Cyber 939A/DVD",0}, + {PCI_CHIP_9520, "Cyber 9520",0}, + {PCI_CHIP_9525, "Cyber 9525/DVD",0}, + {PCI_CHIP_9540, "Cyber 9540",0}, + {PCI_CHIP_9750, "3DImage975",0}, + {PCI_CHIP_9850, "3DImage985",0}, + {PCI_CHIP_9880, "Blade3D",0}, + {PCI_CHIP_8400, "CyberBlade/i7",0}, + {PCI_CHIP_8420, "CyberBlade/DSTN/i7",0}, + {PCI_CHIP_8500, "CyberBlade/i1",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_ALI, { - {0x1435, "M1435"}, - {0x0000, NULL}}}, + {0x1435, "M1435",0}, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_MATROX, { - {PCI_CHIP_MGA2085, "MGA 2085PX"}, - {PCI_CHIP_MGA2064, "MGA 2064W"}, - {PCI_CHIP_MGA1064, "MGA 1064SG"}, - {PCI_CHIP_MGA2164, "MGA 2164W"}, - {PCI_CHIP_MGA2164_AGP, "MGA 2164W AGP"}, - {PCI_CHIP_MGAG200_PCI, "MGA G200 PCI"}, - {PCI_CHIP_MGAG200, "MGA G200 AGP"}, - {PCI_CHIP_MGAG400, "MGA G400 AGP"}, - {PCI_CHIP_MGAG100_PCI, "MGA G100 PCI"}, - {PCI_CHIP_MGAG100, "MGA G100 AGP"}, - {0x0000, NULL}}}, + {PCI_CHIP_MGA2085, "MGA 2085PX",0}, + {PCI_CHIP_MGA2064, "MGA 2064W",0}, + {PCI_CHIP_MGA1064, "MGA 1064SG",0}, + {PCI_CHIP_MGA2164, "MGA 2164W",0}, + {PCI_CHIP_MGA2164_AGP, "MGA 2164W AGP",0}, + {PCI_CHIP_MGAG200_PCI, "MGA G200 PCI",0}, + {PCI_CHIP_MGAG200, "MGA G200 AGP",0}, + {PCI_CHIP_MGAG400, "MGA G400 AGP",0}, + {PCI_CHIP_MGAG100_PCI, "MGA G100 PCI",0}, + {PCI_CHIP_MGAG100, "MGA G100 AGP",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_CHIPSTECH, { - {PCI_CHIP_65545, "65545"}, - {PCI_CHIP_65548, "65548"}, - {PCI_CHIP_65550, "65550"}, - {PCI_CHIP_65554, "65554"}, - {PCI_CHIP_65555, "65555"}, - {PCI_CHIP_68554, "68554"}, - {PCI_CHIP_69000, "69000"}, - {PCI_CHIP_69030, "69030"}, - {0x0000, NULL}}}, + {PCI_CHIP_65545, "65545",0}, + {PCI_CHIP_65548, "65548",0}, + {PCI_CHIP_65550, "65550",0}, + {PCI_CHIP_65554, "65554",0}, + {PCI_CHIP_65555, "65555",0}, + {PCI_CHIP_68554, "68554",0}, + {PCI_CHIP_69000, "69000",0}, + {PCI_CHIP_69030, "69030",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_MIRO, { - {0x5601, "ZR36050" }, - {0x0000, NULL}}}, + {0x5601, "ZR36050",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_NEC, { - {0x0046, "PowerVR PCX2" }, - {0x0000, NULL}}}, + {0x0046, "PowerVR PCX2",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_FD, { - {0x0000, "TMC-18C30 (36C70)" }, - {0x0000, NULL}}}, + {0x0000, "TMC-18C30 (36C70)",0 }, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_SIS, { - {PCI_CHIP_SG86C201, "SG86C201"}, - {PCI_CHIP_SG86C202, "SG86C202"}, - {PCI_CHIP_SG86C205, "SG86C205"}, - {PCI_CHIP_SG86C215, "SG86C215"}, - {PCI_CHIP_SG86C225, "SG86C225"}, - {PCI_CHIP_SIS5597, "5597"}, - {PCI_CHIP_SIS530, "530"}, - {PCI_CHIP_SIS6326, "6326"}, - {0x0000, NULL}}}, + {PCI_CHIP_SG86C201, "SG86C201",0}, + {PCI_CHIP_SG86C202, "SG86C202",0}, + {PCI_CHIP_SG86C205, "SG86C205",0}, + {PCI_CHIP_SG86C215, "SG86C215",0}, + {PCI_CHIP_SG86C225, "SG86C225",0}, + {PCI_CHIP_SIS5597, "5597",0}, + {PCI_CHIP_SIS530, "530",0}, + {PCI_CHIP_SIS6326, "6326",0}, + {PCI_CHIP_SIS300, "300",0}, + {PCI_CHIP_SIS630, "630",0}, + {PCI_CHIP_SIS540, "540",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_HP, { - {0x1030, "J2585A" }, - {0x1031, "J2585B" }, - {0x0000, NULL}}}, + {0x1030, "J2585A",0 }, + {0x1031, "J2585B",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_SMC_PCTECH, { - {0x1000, "FDC 37C665/RZ1000" }, - {0x1001, "FDC /RZ1001" }, - {0x0000, NULL}}}, + {0x1000, "FDC 37C665/RZ1000",0 }, + {0x1001, "FDC /RZ1001",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_DPT, { - {0xA400, "SmartCache/Raid" }, - {0x0000, NULL}}}, + {0xA400, "SmartCache/Raid",0 }, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_SGS, { - {PCI_CHIP_STG2000, "STG2000"}, - {PCI_CHIP_STG1764, "STG1764"}, - {0x0000, NULL}}}, + {PCI_CHIP_STG2000, "STG2000",0}, + {PCI_CHIP_STG1764, "STG1764",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_BUSLOGIC, { - {PCI_CHIP_946C_01, "946C 01"}, - {PCI_CHIP_946C_10, "946C 10"}, - {PCI_CHIP_FLASH_POINT, "FlashPoint"}, - {0x0000, NULL}}}, + {PCI_CHIP_946C_01, "946C 01",0}, + {PCI_CHIP_946C_10, "946C 10",0}, + {PCI_CHIP_FLASH_POINT, "FlashPoint",0}, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_TI, { - {PCI_CHIP_TI_PERMEDIA, "Permedia"}, - {PCI_CHIP_TI_PERMEDIA2, "Permedia 2"}, - {PCI_CHIP_PCI_1130, "PCI 1130"}, - {PCI_CHIP_PCI_1131, "PCI 1131"}, - {0x0000, NULL}}}, + {PCI_CHIP_TI_PERMEDIA, "Permedia",0}, + {PCI_CHIP_TI_PERMEDIA2, "Permedia 2",0}, + {PCI_CHIP_PCI_1130, "PCI 1130",0}, + {PCI_CHIP_PCI_1131, "PCI 1131",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_OAK, { - {PCI_CHIP_OTI107, "OTI107"}, - {0x0000, NULL}}}, + {PCI_CHIP_OTI107, "OTI107",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_WINBOND, { - {PCI_CHIP_89C940, "89C940 NE2000-PCI"}, - {0x0000, NULL}}}, + {PCI_CHIP_89C940, "89C940 NE2000-PCI",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_MOTOROLA, { - {PCI_CHIP_MPC105_EAGLE, "MPC105 Eagle"}, - {PCI_CHIP_MPC105_GRACKLE,"MPC105 Grackle"}, - {PCI_CHIP_RAVEN, "Raven"}, - {0x0000, NULL}}}, + {PCI_CHIP_MPC105_EAGLE, "MPC105 Eagle",0}, + {PCI_CHIP_MPC105_GRACKLE,"MPC105 Grackle",0}, + {PCI_CHIP_RAVEN, "Raven",0}, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_OAK, { - {PCI_CHIP_ULTRA_DMA, "IDE UltraDMA/33"}, - {PCI_CHIP_DC5030, "DC5030"}, - {0x0000, NULL}}}, + {PCI_CHIP_ULTRA_DMA, "IDE UltraDMA/33",0}, + {PCI_CHIP_DC5030, "DC5030",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_NUMNINE, { - {PCI_CHIP_I128, "Imagine 128"}, - {PCI_CHIP_I128_2, "Imagine 128 II"}, - {PCI_CHIP_I128_T2R, "Imagine 128 T2R"}, - {PCI_CHIP_I128_T2R4, "Imagine 128 T2R4"}, - {0x0000, NULL}}}, + {PCI_CHIP_I128, "Imagine 128",0}, + {PCI_CHIP_I128_2, "Imagine 128 II",0}, + {PCI_CHIP_I128_T2R, "Imagine 128 T2R",0}, + {PCI_CHIP_I128_T2R4, "Imagine 128 T2R4",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_UMC, { - {0x0101, "UM8673F"}, - {0x673A, "UM8886BF"}, - {0x886A, "UM8886A"}, - {0x8881, "UM8881F"}, - {0x8886, "UM8886F"}, - {0x8891, "UM8891A"}, - {0x9017, "UM9017F"}, - {0xE886, "UM8886N"}, - {0xE891, "UM8891N"}, - {0x0000, NULL}}}, + {0x0101, "UM8673F",0}, + {0x673A, "UM8886BF",0}, + {0x886A, "UM8886A",0}, + {0x8881, "UM8881F",0}, + {0x8886, "UM8886F",0}, + {0x8891, "UM8891A",0}, + {0x9017, "UM9017F",0}, + {0xE886, "UM8886N",0}, + {0xE891, "UM8891N",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_X, { - {0x0001, "ITT AGX016"}, - {0x0000, NULL}}}, + {0x0001, "ITT AGX016",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_PICOP, { - {0x0001, "PT86C52x Vesuvius" }, - {0x0000, NULL}}}, + {0x0001, "PT86C52x Vesuvius",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_MYLEX, { - {0x0010, "AccelRAID 250" }, - {0x0000, NULL}}}, + {0x0010, "AccelRAID 250",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_APPLE, { - {0x0001, "Bandit" }, - {0x0002, "Grand Central" }, - {0x000E, "Hydra" }, - {0x0000, NULL}}}, + {0x0001, "Bandit",0 }, + {0x0002, "Grand Central",0 }, + {0x000E, "Hydra",0 }, + {0x0000, NULL,0}}}, #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_NEXGEN, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_QLOGIC, { - {0x1020, "ISP1020" }, - {0x1022, "ISP1022" }, - {0x0000, NULL}}}, + {0x1020, "ISP1020",0 }, + {0x1022, "ISP1022",0 }, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_CYRIX, { - {0x0000, "5510" }, - {0x0001, "PCI Master" }, - {0x0002, "5520" }, - {0x0100, "5530 Kahlua Legacy" }, - {0x0101, "5530 Kahlua SMI" }, - {0x0102, "5530 Kahlua IDE" }, - {0x0103, "5530 Kahlua Audio" }, - {0x0104, "5530 Kahlua Video" }, - {0x0000, NULL}}}, + {0x0000, "5510",0 }, + {0x0001, "PCI Master",0 }, + {0x0002, "5520",0 }, + {0x0100, "5530 Kahlua Legacy",0 }, + {0x0101, "5530 Kahlua SMI",0 }, + {0x0102, "5530 Kahlua IDE",0 }, + {0x0103, "5530 Kahlua Audio",0 }, + {0x0104, "5530 Kahlua Video",0 }, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_LEADTEK, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_CONTAQ, { - {0x0600, "82C599" }, - {0xc693, "82C693" }, - {0x0000, NULL}}}, + {0x0600, "82C599",0 }, + {0xc693, "82C693",0 }, + {0x0000, NULL,0}}}, #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_FOREX, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_OLICOM, { - {0x0001, "OC-3136" }, - {0x0011, "OC-2315" }, - {0x0012, "OC-2325" }, - {0x0013, "OC-2183" }, - {0x0014, "OC-2326" }, - {0x0021, "OC-6151" }, - {0x0000, NULL}}}, + {0x0001, "OC-3136",0 }, + {0x0011, "OC-2315",0 }, + {0x0012, "OC-2325",0 }, + {0x0013, "OC-2183",0 }, + {0x0014, "OC-2326",0 }, + {0x0021, "OC-6151",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_SUN, { - {0x1000, "EBUS" }, - {0x1001, "Happy Meal" }, - {0x8000, "PCI Bus Module" }, - {0x0000, NULL}}}, + {0x1000, "EBUS",0 }, + {0x1001, "Happy Meal",0 }, + {0x8000, "PCI Bus Module",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_CMD, { - {0x0640, "640A" }, - {0x0643, "643" }, - {0x0646, "646" }, - {0x0670, "670" }, - {0x0000, NULL}}}, + {0x0640, "640A",0 }, + {0x0643, "643",0 }, + {0x0646, "646",0 }, + {0x0670, "670",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_VISION, { - {0x0001, "QD 8500" }, - {0x0002, "QD 8580" }, - {0x0000, NULL}}}, + {0x0001, "QD 8500",0 }, + {0x0002, "QD 8580",0 }, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_BROOKTREE, { - {PCI_CHIP_BT848, "848"}, - {PCI_CHIP_BT849, "849"}, - {0x0000, NULL}}}, + {PCI_CHIP_BT848, "848",0}, + {PCI_CHIP_BT849, "849",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_SIERRA, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, {PCI_VENDOR_ACC, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_WINBOND_2, { - {0x0001, "W83769F" }, - {0x0105, "SL82C105" }, - {0x0565, "W83C553" }, - {0x0000, NULL}}}, + {0x0001, "W83769F",0 }, + {0x0105, "SL82C105",0 }, + {0x0565, "W83C553",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_DATABOOK, { - {0xB106, "DB87144" }, - {0x0000, NULL}}}, + {0xB106, "DB87144",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_3COM, { - {0x5900, "3C590 10bT" }, - {0x5950, "3C595 100bTX" }, - {0x5951, "3C595 100bT4" }, - {0x5952, "3C595 10b-MII" }, - {0x9000, "3C900 10bTPO" }, - {0x9001, "3C900 10b Combo" }, + {0x5900, "3C590 10bT",0 }, + {0x5950, "3C595 100bTX",0 }, + {0x5951, "3C595 100bT4",0 }, + {0x5952, "3C595 10b-MII",0 }, + {0x9000, "3C900 10bTPO",0 }, + {0x9001, "3C900 10b Combo",0 }, /* Is it OK for 2 devices to have the same name ? */ - {0x9005, "3C900 10b Combo" }, - {0x9050, "3C905 100bTX" }, - {0x0000, NULL}}}, + {0x9005, "3C900 10b Combo",0 }, + {0x9050, "3C905 100bTX",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_SMC, { - {0x0005, "9432 TX" }, - {0x0000, NULL}}}, + {0x0005, "9432 TX",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_ALI_2, { - {0x1445, "M1445" }, - {0x1449, "M1449" }, - {0x1451, "M1451" }, - {0x1461, "M1461" }, - {0x1489, "M1489" }, - {0x1511, "M1511" }, - {0x1513, "M1513" }, - {0x1521, "M1521" }, - {0x1523, "M1523" }, - {0x1531, "M1531 Aladdin IV" }, - {0x1533, "M1533 Aladdin IV" }, - {0x5215, "M4803" }, - {0x5219, "M5219" }, - {0x5229, "M5229 TXpro" }, - {0x0000, NULL}}}, + {0x1445, "M1445",0 }, + {0x1449, "M1449",0 }, + {0x1451, "M1451",0 }, + {0x1461, "M1461",0 }, + {0x1489, "M1489",0 }, + {0x1511, "M1511",0 }, + {0x1513, "M1513",0 }, + {0x1521, "M1521",0 }, + {0x1523, "M1523",0 }, + {0x1531, "M1531 Aladdin IV",0 }, + {0x1533, "M1533 Aladdin IV",0 }, + {0x5215, "M4803",0 }, + {0x5219, "M5219",0 }, + {0x5229, "M5229 TXpro",0 }, + {0x0000, NULL,0}}}, #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_MITSUBISHI, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_SURECOM, { - {0x0E34, "NE-34PCI Lan" }, - {0x0000, NULL}}}, + {0x0E34, "NE-34PCI Lan",0 }, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_NEOMAGIC, { - {PCI_CHIP_NM2070, "NM2070"}, - {PCI_CHIP_NM2090, "NM2090"}, - {PCI_CHIP_NM2093, "NM2093"}, - {PCI_CHIP_NM2160, "NM2160"}, - {PCI_CHIP_NM2200, "NM2200"}, - {0x0000, NULL}}}, + {PCI_CHIP_NM2070, "NM2070",0}, + {PCI_CHIP_NM2090, "NM2090",0}, + {PCI_CHIP_NM2093, "NM2093",0}, + {PCI_CHIP_NM2160, "NM2160",0}, + {PCI_CHIP_NM2200, "NM2200",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_ASP, { - { 0x1200, "ABP940" }, - { 0x1300, "ABP940U" }, - {0x0000, NULL}}}, + { 0x1200, "ABP940",0 }, + { 0x1300, "ABP940U",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_CERN, { - { 0x0001, "STAR/RD24 SCI-PCI (PMC)" }, - { 0x0002, "STAR/RD24 SCI-PCI (PMC)" }, - {0x0000, NULL}}}, + { 0x0001, "STAR/RD24 SCI-PCI (PMC)",0 }, + { 0x0002, "STAR/RD24 SCI-PCI (PMC)",0 }, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_NVIDIA, { - {PCI_CHIP_NV1, "NV1"}, - {PCI_CHIP_DAC64, "DAC64"}, - {PCI_CHIP_TNT, "Riva TNT"}, - {PCI_CHIP_TNT2, "Riva TNT2"}, - {PCI_CHIP_UTNT2, "Riva Ultra TNT2"}, - {PCI_CHIP_VTNT2, "Riva Vanta"}, - {PCI_CHIP_UVTNT2, "Riva Ultra 64"}, - {PCI_CHIP_ITNT2, "Riva Integrated"}, - {PCI_CHIP_GEFORCE256, "GeForce 256"}, - {PCI_CHIP_GEFORCEDDR, "GeForce DDR"}, - {PCI_CHIP_QUADRO, "Quadro"}, - {0x0000, NULL}}}, + {PCI_CHIP_NV1, "NV1",0}, + {PCI_CHIP_DAC64, "DAC64",0}, + {PCI_CHIP_TNT, "Riva TNT",0}, + {PCI_CHIP_TNT2, "Riva TNT2",0}, + {PCI_CHIP_UTNT2, "Riva Ultra TNT2",0}, + {PCI_CHIP_VTNT2, "Riva Vanta",0}, + {PCI_CHIP_UVTNT2, "Riva Ultra 64",0}, + {PCI_CHIP_ITNT2, "Riva Integrated",0}, + {PCI_CHIP_GEFORCE256, "GeForce 256",0}, + {PCI_CHIP_GEFORCEDDR, "GeForce DDR",0}, + {PCI_CHIP_QUADRO, "Quadro",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_IMS, { - {0x8849, "8849" }, - {0x0000, NULL}}}, + {0x8849, "8849",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_TEKRAM, { - {0x690C, "DC690C" }, - {0x0000, NULL}}}, + {0x690C, "DC690C",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_TUNDRA, { - {0x0000, "CA91C042 Universe" }, - {0x0000, NULL}}}, + {0x0000, "CA91C042 Universe",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_AMCC, { - {0x8043, "Myrinet PCI (M2-PCI-32)" }, - {0x807D, "S5933 PCI44" }, - {0x809C, "S5933 Traquair HEPC3" }, - {0x0000, NULL}}}, + {0x8043, "Myrinet PCI (M2-PCI-32)",0 }, + {0x807D, "S5933 PCI44",0 }, + {0x809C, "S5933 Traquair HEPC3",0 }, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_INTEGRAPHICS, { - {0x1680, "IGA-1680" }, - {0x1682, "IGA-1682" }, - {0x0000, NULL}}}, + {0x1680, "IGA-1680",0 }, + {0x1682, "IGA-1682",0 }, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_REALTEC, { - {0x8029, "8029" }, - {0x8129, "8129" }, - {0x8139, "RTL8139 Ethernet Controller" }, - {0x0000, NULL}}}, + {0x8029, "8029",0 }, + {0x8129, "8129",0 }, + {0x8139, "RTL8139 Ethernet Controller",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_TRUEVISION, { - {0x000C, "Targa 1000" }, - {0x0000, NULL}}}, + {0x000C, "Targa 1000",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_INITIO, { - {0x9100, "320 P" }, - {0x0000, NULL}}}, + {0x9100, "320 P",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_VIA, { - {0x0501, "VT 8501 MVP4 Host Bridge" }, - {0x0505, "VT 82C505" }, - {0x0561, "VT 82C505" }, - {0x0571, "VT 82C586 MVP3 IDE Bridge" }, - {0x0576, "VT 82C576 3V" }, - {0x0586, "VT 82C586 MVP3 ISA Bridge" }, - {0x0686, "VT 82C686 MVP4 ISA Bridge" }, - {0x0597, "VT 82C598 MVP3 Host Bridge" }, - {0x3038, "VT 82C586 MVP3 USB Controller" }, - {0x3040, "VT 82C586B MVP3 ACPI Bridge" }, - {0x3057, "VT 8501 MVP4 ACPI Bridge" }, - {0x3058, "VT 8501 MVP4 MultiMedia" }, - {0x3068, "VT 8501 MVP4 Modem" }, - {0x8501, "VT 8501 MVP4 PCI/AGP Bridge" }, - {0x8598, "VT 82C598 MVP3 PCI/AGP Bridge" }, - {0x0000, NULL}}}, + {0x0501, "VT 8501 MVP4 Host Bridge",0 }, + {0x0505, "VT 82C505",0 }, + {0x0561, "VT 82C505",0 }, + {0x0571, "VT 82C586 MVP3 IDE Bridge",0 }, + {0x0576, "VT 82C576 3V",0 }, + {0x0586, "VT 82C586 MVP3 ISA Bridge",0 }, + {0x0686, "VT 82C686 MVP4 ISA Bridge",0 }, + {0x0597, "VT 82C598 MVP3 Host Bridge",0 }, + {0x3038, "VT 82C586 MVP3 USB Controller",0 }, + {0x3040, "VT 82C586B MVP3 ACPI Bridge",0 }, + {0x3057, "VT 8501 MVP4 ACPI Bridge",0 }, + {0x3058, "VT 8501 MVP4 MultiMedia",0 }, + {0x3068, "VT 8501 MVP4 Modem",0 }, + {0x8501, "VT 8501 MVP4 PCI/AGP Bridge",0 }, + {0x8598, "VT 82C598 MVP3 PCI/AGP Bridge",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_VORTEX, { - {0x0001, "GDT 6000b" }, - {0x0000, NULL}}}, + {0x0001, "GDT 6000b",0 }, + {0x0000, NULL,0}}}, #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_EF, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, {PCI_VENDOR_FORE, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, {PCI_VENDOR_IMAGTEC, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, {PCI_VENDOR_PLX, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, #endif #endif {PCI_VENDOR_NVIDIA_SGS, { - {PCI_CHIP_RIVA128, "Riva128"}, - {0x0000, NULL}}}, + {PCI_CHIP_RIVA128, "Riva128",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_ALLIANCE, { - {PCI_CHIP_AP6410, "ProMotion 6410"}, - {PCI_CHIP_AP6422, "ProMotion 6422"}, - {PCI_CHIP_AT24, "ProMotion AT24"}, - {0x0000, NULL}}}, + {PCI_CHIP_AP6410, "ProMotion 6410",0}, + {PCI_CHIP_AP6422, "ProMotion 6422",0}, + {PCI_CHIP_AT24, "ProMotion AT24",0}, + {PCI_CHIP_AT3D, "ProMotion AT3D",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_VMIC, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, {PCI_VENDOR_DIGI, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_MUTECH, { - {0x0001, "MV1000" }, - {0x0000, NULL}}}, + {0x0001, "MV1000",0 }, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_RENDITION, { - {PCI_CHIP_V1000, "Verite 1000"}, - {PCI_CHIP_V2x00, "Verite 2100/2200"}, - {0x0000, NULL}}}, + {PCI_CHIP_V1000, "Verite 1000",0}, + {PCI_CHIP_V2x00, "Verite 2100/2200",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_TOSHIBA, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, {PCI_VENDOR_ZEINET, { - {0x0001, "1221" }, - {0x0000, NULL}}}, + {0x0001, "1221",0 }, + {0x0000, NULL,0}}}, #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_SPECIALIX, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, {PCI_VENDOR_CONTROL, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, {PCI_VENDOR_CYCLADES, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, #endif #endif {PCI_VENDOR_3DFX, { - {PCI_CHIP_VOODOO_GRAPHICS, "Voodoo Graphics"}, - {PCI_CHIP_VOODOO2, "Voodoo2"}, - {PCI_CHIP_BANSHEE, "Banshee"}, - {PCI_CHIP_VOODOO3, "Voodoo3"}, - {0x0000, NULL}}}, + {PCI_CHIP_VOODOO_GRAPHICS, "Voodoo Graphics",0}, + {PCI_CHIP_VOODOO2, "Voodoo2",0}, + {PCI_CHIP_BANSHEE, "Banshee",0}, + {PCI_CHIP_VOODOO3, "Voodoo3",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_SIGMADESIGNS, { - {0x6401, "REALmagic64/GX (SD 6425)" }, - {0x0000, NULL}}}, + {0x6401, "REALmagic64/GX (SD 6425)",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_ENSONIQ, { - {0x5000, "es1370 (AudioPCI)" }, - {0x1371, "es1371" }, - {0x0000, NULL}}}, + {0x5000, "es1370 (AudioPCI)",0 }, + {0x1371, "es1371",0 }, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO #ifdef INCLUDE_EMPTY_LISTS {PCI_VENDOR_YOKOGAWA, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, #endif #endif {PCI_VENDOR_TRITECH, { - {PCI_CHIP_TR25202, "Pyramid3D TR25202"}, - {0x0000, NULL}}}, + {PCI_CHIP_TR25202, "Pyramid3D TR25202",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_NVIDIA_SGS, { - {0x0018, "Riva128" }, - {0x0000, NULL}}}, + {0x0018, "Riva128",0 }, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_SYMPHONY, { - {0x0001, "82C101" }, - {0x0000, NULL}}}, + {0x0001, "82C101",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_TEKRAM_2, { - {0xDC29, "DC290" }, - {0x0000, NULL}}}, + {0xDC29, "DC290",0 }, + {0x0000, NULL,0}}}, #endif {PCI_VENDOR_3DLABS, { - {PCI_CHIP_300SX, "GLINT 300SX"}, - {PCI_CHIP_500TX, "GLINT 500TX"}, - {PCI_CHIP_DELTA, "GLINT Delta"}, - {PCI_CHIP_PERMEDIA, "GLINT Permedia"}, - {PCI_CHIP_MX, "GLINT MX"}, - {PCI_CHIP_PERMEDIA2, "GLINT Permedia 2"}, - {PCI_CHIP_GAMMA, "GLINT Gamma"}, - {PCI_CHIP_PERMEDIA2V, "GLINT Permedia 2v"}, - {0x0000, NULL}}}, + {PCI_CHIP_300SX, "GLINT 300SX",0}, + {PCI_CHIP_500TX, "GLINT 500TX",0}, + {PCI_CHIP_DELTA, "GLINT Delta",0}, + {PCI_CHIP_PERMEDIA, "GLINT Permedia",0}, + {PCI_CHIP_MX, "GLINT MX",0}, + {PCI_CHIP_PERMEDIA2, "GLINT Permedia 2",0}, + {PCI_CHIP_GAMMA, "GLINT Gamma",0}, + {PCI_CHIP_PERMEDIA2V, "GLINT Permedia 2v",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_AVANCE_2, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, {PCI_VENDOR_S3, { - {PCI_CHIP_PLATO, "PLATO/PX"}, - {PCI_CHIP_VIRGE, "ViRGE"}, - {PCI_CHIP_TRIO, "Trio32/64"}, - {PCI_CHIP_AURORA64VP, "Aurora64V+"}, - {PCI_CHIP_TRIO64UVP, "Trio64UV+"}, - {PCI_CHIP_TRIO64V2_DXGX,"Trio64V2/DX or /GX"}, - {PCI_CHIP_PLATO_PX, "PLATO/PX"}, - {PCI_CHIP_Trio3D, "Trio3D"}, - {PCI_CHIP_Trio3D_2X, "Trio3D/2X"}, - {PCI_CHIP_VIRGE_VX, "ViRGE/VX"}, - {PCI_CHIP_VIRGE_DXGX, "ViRGE/DX or /GX"}, - {PCI_CHIP_VIRGE_GX2, "ViRGE/GX2"}, - {PCI_CHIP_Savage3D, "Savage3D (86E391)"}, - {PCI_CHIP_Savage3D_MV, "Savage3D+MacroVision (86E390)"}, - {PCI_CHIP_Savage4, "Savage4"}, - {PCI_CHIP_Savage2000, "Savage2000"}, - {PCI_CHIP_VIRGE_MX, "ViRGE/MX"}, - {PCI_CHIP_VIRGE_MXPLUS, "ViRGE/MX+"}, - {PCI_CHIP_VIRGE_MXP, "ViRGE/MX+MV"}, - {PCI_CHIP_868, "868"}, - {PCI_CHIP_928, "928"}, - {PCI_CHIP_864_0, "864"}, - {PCI_CHIP_864_1, "864"}, - {PCI_CHIP_964_0, "964"}, - {PCI_CHIP_964_1, "964"}, - {PCI_CHIP_968, "968"}, - {0x0000, NULL}}}, + {PCI_CHIP_PLATO, "PLATO/PX",0}, + {PCI_CHIP_VIRGE, "ViRGE",0}, + {PCI_CHIP_TRIO, "Trio32/64",0}, + {PCI_CHIP_AURORA64VP, "Aurora64V+",0}, + {PCI_CHIP_TRIO64UVP, "Trio64UV+",0}, + {PCI_CHIP_TRIO64V2_DXGX,"Trio64V2/DX or /GX",0}, + {PCI_CHIP_PLATO_PX, "PLATO/PX",0}, + {PCI_CHIP_Trio3D, "Trio3D",0}, + {PCI_CHIP_Trio3D_2X, "Trio3D/2X",0}, + {PCI_CHIP_VIRGE_VX, "ViRGE/VX",0}, + {PCI_CHIP_VIRGE_DXGX, "ViRGE/DX or /GX",0}, + {PCI_CHIP_VIRGE_GX2, "ViRGE/GX2",0}, + {PCI_CHIP_Savage3D, "Savage3D (86E391)",0}, + {PCI_CHIP_Savage3D_MV, "Savage3D+MacroVision (86E390)",0}, + {PCI_CHIP_Savage4, "Savage4",0}, + {PCI_CHIP_Savage2000, "Savage2000",0}, + {PCI_CHIP_VIRGE_MX, "ViRGE/MX",0}, + {PCI_CHIP_VIRGE_MXPLUS, "ViRGE/MX+",0}, + {PCI_CHIP_VIRGE_MXP, "ViRGE/MX+MV",0}, + {PCI_CHIP_868, "868",0}, + {PCI_CHIP_928, "928",0}, + {PCI_CHIP_864_0, "864",0}, + {PCI_CHIP_864_1, "864",0}, + {PCI_CHIP_964_0, "964",0}, + {PCI_CHIP_964_1, "964",0}, + {PCI_CHIP_968, "968",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_INTEL,{ - {0x0482, "82375EB pci-eisa bridge"}, - {0x0483, "82424ZX cache dram controller"}, - {0x0484, "82378IB/ZB pci-isa bridge"}, - {0x0486, "82430ZX Aries"}, - {0x04A3, "82434LX/NX pci cache mem controller"}, - {0x0960, "960RD processor/bridge"}, - {0x1221, "82092AA"}, - {0x1222, "82092AA"}, - {0x1223, "SAA7116"}, - {0x1226, "82596"}, - {0x1227, "82865"}, - {0x1229, "82557/8 10/100MBit network controller"}, - {0x122D, "82437 Triton"}, - {0x122E, "82471 Triton"}, - {0x1230, "82371 bus-master IDE controller"}, - {0x1234, "82371MX bus-master IDE controller"}, - {0x1235, "82437MX"}, - {0x1237, "82441FX Natoma"}, - {0x124B, "82380FB"}, - {0x1250, "82439"}, - {0x7000, "82371 pci-isa bridge"}, - {0x7010, "82371 bus-master IDE controller"}, - {0x7020, "82371 bus-master IDE controller"}, - {0x7030, "82437VX"}, - {0x7100, "82439TX"}, - {0x7110, "82371AB PIIX4 ISA"}, - {0x7111, "82371AB PIIX4 IDE"}, - {0x7112, "82371AB PIIX4 USB"}, - {0x7113, "82371AB PIIX4 ACPI"}, - {0x7180, "82443LX PAC Host"}, - {0x7181, "82443LX PAC AGP"}, - {0x7190, "82443BX Host"}, - {0x7191, "82443BX AGP"}, - {0x7192, "82443BX Host (no AGP)"}, - {0x71a0, "82443GX Host"}, - {0x71a1, "82443GX AGP"}, - {0x71a2, "82443GX Host (no AGP)"}, - {0x84C4, "P6"}, - {0x84C5, "82450GX20"}, - {PCI_CHIP_I740_AGP, "i740 (AGP)"}, - {0x0000, NULL}}}, + {0x0482, "82375EB pci-eisa bridge",0}, + {0x0483, "82424ZX cache dram controller",0}, + {0x0484, "82378IB/ZB pci-isa bridge",0x0601}, + {0x0486, "82430ZX Aries",0}, + {0x04A3, "82434LX/NX pci cache mem controller",0}, + {0x0960, "960RD processor/bridge",0}, + {0x1221, "82092AA",0}, + {0x1222, "82092AA",0}, + {0x1223, "SAA7116",0}, + {0x1226, "82596",0}, + {0x1227, "82865",0}, + {0x1229, "82557/8 10/100MBit network controller",0 }, + {0x122D, "82437 Triton",0}, + {0x122E, "82471 Triton",0}, + {0x1230, "82371 bus-master IDE controller",0}, + {0x1234, "82371MX bus-master IDE controller",0}, + {0x1235, "82437MX",0}, + {0x1237, "82441FX Natoma",0}, + {0x124B, "82380FB",0}, + {0x1250, "82439",0}, + {0x7000, "82371 pci-isa bridge",0}, + {0x7010, "82371 bus-master IDE controller",0}, + {0x7020, "82371 bus-master IDE controller",0}, + {0x7030, "82437VX",0}, + {0x7100, "82439TX",0}, + {0x7110, "82371AB PIIX4 ISA",0}, + {0x7111, "82371AB PIIX4 IDE",0}, + {0x7112, "82371AB PIIX4 USB",0}, + {0x7113, "82371AB PIIX4 ACPI",0}, + {0x7180, "82443LX PAC Host",0}, + {0x7181, "82443LX PAC AGP",0}, + {0x7190, "82443BX Host",0}, + {0x7191, "82443BX AGP",0}, + {0x7192, "82443BX Host (no AGP)",0}, + {0x71a0, "82443GX Host",0}, + {0x71a1, "82443GX AGP",0}, + {0x71a2, "82443GX Host (no AGP)",0}, + {0x84C4, "P6",0}, + {0x84C5, "82450GX20",0}, + {PCI_CHIP_I740_AGP, "i740 (AGP)",0}, + {0x0000, NULL,0}}}, {PCI_VENDOR_ADAPTEC, { - {0x0010, "2940U2" }, - {0x1078, "7810" }, - {0x5078, "7850" }, - {0x5578, "7855" }, - {0x6078, "7860" }, - {0x6178, "2940AU" }, - {0x7078, "7870" }, - {0x7178, "2940" }, - {0x7278, "7872" }, - {0x7378, "398X" }, - {0x7478, "2944" }, - {0x7895, "7895" }, - {0x8078, "7880" }, - {0x8178, "2940U/UW" }, - {0x8278, "3940U/UW" }, - {0x8378, "389XU" }, - {0x8478, "2944U" }, - {0x0000, NULL}}}, + {0x0010, "2940U2",0 }, + {0x1078, "7810",0 }, + {0x5078, "7850",0 }, + {0x5578, "7855",0 }, + {0x6078, "7860",0 }, + {0x6178, "2940AU",0 }, + {0x7078, "7870",0 }, + {0x7178, "2940",0 }, + {0x7278, "7872",0 }, + {0x7378, "398X",0 }, + {0x7478, "2944",0 }, + {0x7895, "7895",0 }, + {0x8078, "7880",0 }, + {0x8178, "2940U/UW",0 }, + {0x8278, "3940U/UW",0 }, + {0x8378, "389XU",0 }, + {0x8478, "2944U",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_ADAPTEC_2, { - {0x001F, "7890/7891" }, - {0x0000, NULL}}}, + {0x001F, "7890/7891",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_ATRONICS, { - {0x2015, "IDE-2015PL" }, - {0x0000, NULL}}}, + {0x2015, "IDE-2015PL",0 }, + {0x0000, NULL,0}}}, {PCI_VENDOR_ARK, { - {PCI_CHIP_1000PV, "1000PV"}, - {PCI_CHIP_2000PV, "2000PV"}, - {PCI_CHIP_2000MT, "2000MT"}, - {PCI_CHIP_2000MI, "2000MI"}, - {0x0000, NULL}}}, + {PCI_CHIP_1000PV, "1000PV",0}, + {PCI_CHIP_2000PV, "2000PV",0}, + {PCI_CHIP_2000MT, "2000MT",0}, + {PCI_CHIP_2000MI, "2000MI",0}, + {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_YAMAHA, { - {0x000a, "YMF740-V Audio"}, - {0x0000, NULL}}}, + {0x000a, "YMF740-V Audio",0}, + {0x0000, NULL,0}}}, #endif {0x0000, { - {0x0000, NULL}}}, + {0x0000, NULL,0}}}, }; #endif @@ -1344,177 +1352,178 @@ typedef struct { struct pciCard { unsigned short SubsystemID; char *CardName; + CARD16 class; pciPrintProcPtr printFunc; } Device[MAX_CARD_PER_VENDOR]; } pciVendorCardInfo; -extern pciVendorCardInfo *xf86PCICardInfo; -extern pciVendorCardInfo xf86PCICardInfoData[]; +extern pciVendorCardInfo* xf86PCICardInfo; + #ifdef INIT_PCI_CARD_INFO #define NF (pciPrintProcPtr)NULL -pciVendorCardInfo xf86PCICardInfoData[] = { +static pciVendorCardInfo xf86PCICardInfoData[] = { #ifdef VENDOR_INCLUDE_NONVIDEO { PCI_VENDOR_3COM, { - { 0x9005, "PCI Combo ethernet card" }, - { 0x0000, (char *)NULL, NF } } }, + { 0x9005, "PCI Combo ethernet card",0,NF }, + { 0x0000, (char *)NULL,0, NF } } }, #endif #ifdef VENDOR_INCLUDE_NONVIDEO { PCI_VENDOR_ADAPTEC, { - { 0x7881, "AHA-2940U/UW SCSI", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x7881, "AHA-2940U/UW SCSI",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, #endif /* ATI card info deleted; unmaintainable */ #ifdef VENDOR_INCLUDE_NONVIDEO #ifdef INCLUDE_EMPTY_LISTS { PCI_VENDOR_COMPAQ, { - { 0x0000, (char *)NULL, NF } } }, + { 0x0000, (char *)NULL,0, NF } } }, #endif #ifdef VENDOR_INCLUDE_NONVIDEO { PCI_VENDOR_NCR_1, { - { 0x1000, "SCSI HBA", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x1000, "SCSI HBA",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_REALTEC, { - { 0x8139, "Generic", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x8139, "Generic",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, #endif { PCI_VENDOR_CREATIVE_2, { - { 0x1017, "3D Blaster Banshee", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x1017, "3D Blaster Banshee",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, {PCI_VENDOR_DIGITAL, { - { 0x500A, "EtherWORKS 10/100", NF}, - { 0x0000, (char *)NULL, NF } } }, + { 0x500A, "EtherWORKS 10/100",0, NF}, + { 0x0000, (char *)NULL,0, NF } } }, #endif { PCI_VENDOR_DIAMOND, { - { 0x8000, "C&T 69000", NF }, - { 0x1103, "Fire GL 1000", NF }, - { 0x0154, "Fire GL 1000 PRO", NF }, - { 0x0003, "Monster Fusion", NF }, - { 0x8a10, "Stealth 3D 4000", NF }, - { 0x0100, "Stealth II G460", NF }, - { 0x2000, "Stealth II S220", NF }, - { 0x1092, "Viper 330", NF }, - { 0x0550, "Viper 550", NF }, - { 0x8760, "Fireport 40 Dual", NF }, - { 0x2110, "Sonic Impact S70", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x8000, "C&T 69000",0, NF }, + { 0x1103, "Fire GL 1000",0, NF }, + { 0x0154, "Fire GL 1000 PRO",0, NF }, + { 0x0003, "Monster Fusion",0, NF }, + { 0x8a10, "Stealth 3D 4000",0, NF }, + { 0x0100, "Stealth II G460",0, NF }, + { 0x2000, "Stealth II S220",0, NF }, + { 0x1092, "Viper 330",0, NF }, + { 0x0550, "Viper 550",0, NF }, + { 0x8760, "Fireport 40 Dual",0, NF }, + { 0x2110, "Sonic Impact S70",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_ELSA, { - { 0x0914, "Winner 1000", NF }, - { 0x0930, "Winner 1000PRO 864", NF }, - { 0x0931, "Winner 1000PRO Trio32", NF }, - { 0x0932, "Winner 1000Trio Trio64", NF }, - { 0x0933, "Winner 1000TrioV Trio64V+", NF }, - { 0x0934, "Victory 3D", NF }, - { 0x0935, "Winner 1000 T2D", NF }, - { 0x0936, "Winner 1000PRO 868", NF }, - { 0x0937, "Winner 1000PRO/X 868", NF }, - { 0x0938, "Winner 1000ViRGE", NF }, - { 0x0939, "Winner 1000ViRGE/DX", NF }, - { 0x093a, "Winner 1000/T2DX", NF }, - { 0x093b, "Winner DUO M5", NF }, - { 0x093c, "Victory 1000", NF }, - { 0x0940, "Winner 2000PRO 964/TVP3020", NF }, - { 0x0941, "Winner 2000PRO/X 968/TVP3020", NF }, - { 0x0942, "Winner 2000PRO/X 968/TVP3026", NF }, - { 0x0943, "Winner 2000AVI 968/TVP3026", NF }, - { 0x0948, "Winner 2000PRO-8 964/RGB528", NF }, - { 0x094a, "Winner 2000PRO-8 968/RGB528", NF }, - { 0x094b, "Winner 2000PRO-8 968/TVP3030", NF }, - { 0x0950, "ViRGE/VX", NF }, - { 0x0951, "Winner 2000AVI 3D", NF }, - { 0x0952, "Winner 2000AVI 220", NF }, - { 0x0960, "Winner 3000M", NF }, - { 0x0962, "Winner 3000L", NF }, - { 0x0964, "Winner 3000XL", NF }, - { 0x096a, "Winner 3000Twin", NF }, - { 0x096c, "Winner 3000LT", NF }, - { 0x0980, "GLoria 4 TVP3026", NF }, - { 0x0982, "GLoria 4 TVP3030", NF }, - { 0x0981, "GLoria 8", NF }, - { 0x0a10, "GLoria M", NF }, - { 0x0a14, "GLoria S", NF }, - { 0x0a31, "Winner 2000 Office", NF }, - { 0x0a32, "GLoria Synergy P2C", NF }, - { 0x0a33, "GLoria Synergy P2C", NF }, - { 0x0a34, "GLoria Synergy P2V", NF }, - { 0x0a35, "GLoria Synergy P2A", NF }, - { 0x0a36, "Quad GLoria Synergy P2A", NF }, - { 0x0a40, "GLoria MX", NF }, - { 0x0a41, "GLoria XL", NF }, - { 0x0a42, "GLoria XXL", NF }, - { 0x0a43, "Winner 2000 Office P2V", NF }, - { 0x0a44, "Winner 2000 Office P2A", NF }, - { 0x0a80, "GLoria S MAC", NF }, - { 0x0c10, "Victory Erazor 4", NF }, - { 0x0c11, "Victory Erazor 8", NF }, - { 0x0c12, "Winner 1000 R3D", NF }, - { 0x0c13, "Winner 1000 ZX4", NF }, - { 0x0c14, "Victory Erazor/LT SGRAM", NF }, - { 0x0c15, "Victory Erazor/LT SDRAM", NF }, - { 0x0c18, "Erazor II SGRAM", NF }, - { 0x0c19, "Erazor II SDRAM video", NF }, - { 0x0c1a, "Synergy Pro", NF }, - { 0x0c1c, "Erazor II SDRAM", NF }, - { 0x0c20, "Synergy II 32", NF }, - { 0x0c21, "Synergy II 16", NF }, - { 0x0c22, "Erazor III", NF }, - { 0x0c23, "Erazor III video", NF }, - { 0x0d10, "Victory II SGRAM", NF }, - { 0x0d11, "Victory II SDRAM", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x0914, "Winner 1000",0, NF }, + { 0x0930, "Winner 1000PRO 864",0, NF }, + { 0x0931, "Winner 1000PRO Trio32",0, NF }, + { 0x0932, "Winner 1000Trio Trio64",0, NF }, + { 0x0933, "Winner 1000TrioV Trio64V+",0, NF }, + { 0x0934, "Victory 3D",0, NF }, + { 0x0935, "Winner 1000 T2D",0, NF }, + { 0x0936, "Winner 1000PRO 868",0, NF }, + { 0x0937, "Winner 1000PRO/X 868",0, NF }, + { 0x0938, "Winner 1000ViRGE",0, NF }, + { 0x0939, "Winner 1000ViRGE/DX",0, NF }, + { 0x093a, "Winner 1000/T2DX",0, NF }, + { 0x093b, "Winner DUO M5",0, NF }, + { 0x093c, "Victory 1000",0, NF }, + { 0x0940, "Winner 2000PRO 964/TVP3020",0, NF }, + { 0x0941, "Winner 2000PRO/X 968/TVP3020",0, NF }, + { 0x0942, "Winner 2000PRO/X 968/TVP3026",0, NF }, + { 0x0943, "Winner 2000AVI 968/TVP3026",0, NF }, + { 0x0948, "Winner 2000PRO-8 964/RGB528",0, NF }, + { 0x094a, "Winner 2000PRO-8 968/RGB528",0, NF }, + { 0x094b, "Winner 2000PRO-8 968/TVP3030",0, NF }, + { 0x0950, "ViRGE/VX",0, NF }, + { 0x0951, "Winner 2000AVI 3D",0, NF }, + { 0x0952, "Winner 2000AVI 220",0, NF }, + { 0x0960, "Winner 3000M",0, NF }, + { 0x0962, "Winner 3000L",0, NF }, + { 0x0964, "Winner 3000XL",0, NF }, + { 0x096a, "Winner 3000Twin",0, NF }, + { 0x096c, "Winner 3000LT",0, NF }, + { 0x0980, "GLoria 4 TVP3026",0, NF }, + { 0x0982, "GLoria 4 TVP3030",0, NF }, + { 0x0981, "GLoria 8",0, NF }, + { 0x0a10, "GLoria M",0, NF }, + { 0x0a14, "GLoria S",0, NF }, + { 0x0a31, "Winner 2000 Office",0, NF }, + { 0x0a32, "GLoria Synergy P2C",0, NF }, + { 0x0a33, "GLoria Synergy P2C",0, NF }, + { 0x0a34, "GLoria Synergy P2V",0, NF }, + { 0x0a35, "GLoria Synergy P2A",0, NF }, + { 0x0a36, "Quad GLoria Synergy P2A",0, NF }, + { 0x0a40, "GLoria MX",0, NF }, + { 0x0a41, "GLoria XL",0, NF }, + { 0x0a42, "GLoria XXL",0, NF }, + { 0x0a43, "Winner 2000 Office P2V",0, NF }, + { 0x0a44, "Winner 2000 Office P2A",0, NF }, + { 0x0a80, "GLoria S MAC",0, NF }, + { 0x0c10, "Victory Erazor 4",0, NF }, + { 0x0c11, "Victory Erazor 8",0, NF }, + { 0x0c12, "Winner 1000 R3D",0, NF }, + { 0x0c13, "Winner 1000 ZX4",0, NF }, + { 0x0c14, "Victory Erazor/LT SGRAM",0, NF }, + { 0x0c15, "Victory Erazor/LT SDRAM",0, NF }, + { 0x0c18, "Erazor II SGRAM",0, NF }, + { 0x0c19, "Erazor II SDRAM video",0, NF }, + { 0x0c1a, "Synergy Pro",0, NF }, + { 0x0c1c, "Erazor II SDRAM",0, NF }, + { 0x0c20, "Synergy II 32",0, NF }, + { 0x0c21, "Synergy II 16",0, NF }, + { 0x0c22, "Erazor III",0, NF }, + { 0x0c23, "Erazor III video",0, NF }, + { 0x0d10, "Victory II SGRAM",0, NF }, + { 0x0d11, "Victory II SDRAM",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_HERCULES, { - { 0x0001, "Thriller3D", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x0001, "Thriller3D",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_IBM, { - { 0x00ba, "Thinkpad 600 NeoMagic NM2160", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x00ba, "Thinkpad 600 NeoMagic NM2160",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, {PCI_VENDOR_INTEL, { #ifdef VENDOR_INCLUDE_NONVIDEO - { 0x0009, "PCI 10/100Mb/s ethernet card", NF }, + { 0x0009, "PCI 10/100Mb/s ethernet card",0, NF }, /* Seattle AL440BX is 0x8080, is anything else ? */ - { 0x8080, "motherboard", NF }, - { 0x4d55, "Maui (MU) motherboard", NF }, + { 0x8080, "motherboard",0, NF }, + { 0x4d55, "Maui (MU) motherboard",0, NF }, #endif - { 0x0000, (char *)NULL, NF } } }, + { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_MATROX, { - { 0x1100, "Mystique", NF }, - { 0x1000, "Millennium II", NF }, - { 0x0100, "Millennium II", NF }, - { 0x1200, "Millennium II", NF }, - { PCI_CARD_MILL_G200_SD, "Millennium G200 SD", NF }, - { PCI_CARD_PROD_G100_SD, "Produktiva G100 SD", NF }, - { PCI_CARD_MYST_G200_SD, "Mystique G200 SD", NF }, - { PCI_CARD_MILL_G200_SG, "Millennium G200 SG", NF }, - { PCI_CARD_MARV_G200_SD, "Marvel G200 SD", NF }, - { 0x1001, "Productiva G100 SG", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x1100, "Mystique",0, NF }, + { 0x1000, "Millennium II",0, NF }, + { 0x0100, "Millennium II",0, NF }, + { 0x1200, "Millennium II",0, NF }, + { PCI_CARD_MILL_G200_SD, "Millennium G200 SD",0, NF }, + { PCI_CARD_PROD_G100_SD, "Produktiva G100 SD",0, NF }, + { PCI_CARD_MYST_G200_SD, "Mystique G200 SD",0, NF }, + { PCI_CARD_MILL_G200_SG, "Millennium G200 SG",0, NF }, + { PCI_CARD_MARV_G200_SD, "Marvel G200 SD",0, NF }, + { 0x1001, "Productiva G100 SG",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_SIS, { - { 0x6306, "530 based motherboard", NF }, - { 0x6326, "6326 based card", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x6306, "530 based motherboard",0, NF }, + { 0x6326, "6326 based card",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, #ifdef VENDOR_INCLUDE_NONVIDEO { PCI_VENDOR_CREATIVE, { - { 0x4c4c, "Sound Blaster PCI128", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x4c4c, "Sound Blaster PCI128",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, #endif { PCI_VENDOR_S3, { - { 0x8904, "Trio3D", NF }, - { 0x8a10, "ViRGE/GX2", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x8904, "Trio3D",0, NF }, + { 0x8a10, "ViRGE/GX2",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_NUMNINE, { - { 0x8a10, "Reality 334", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x8a10, "Reality 334",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_TOSHIBA, { - { 0x0001, "4010CDT CT65555", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x0001, "4010CDT CT65555",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, #ifdef VENDOR_INCLUDE_NONVIDEO { PCI_VENDOR_BUSLOGIC, { - { 0x1040, "BT958", NF }, - { 0x0000, (char *)NULL, NF } } }, + { 0x1040, "BT958",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, #endif {0x0000, { - {0x0000, NULL, NF } } }, + {0x0000, NULL,0, NF } } }, }; #endif #endif diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h b/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h index 0002312ac..fbca1e5a5 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.61 1999/12/03 19:17:23 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.64 2000/02/08 13:13:06 eich Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -131,6 +131,7 @@ void xf86ClearEntityListForScreen(int scrnIndex); extern void xf86PostPreInit(void); extern void xf86PostScreenInit(void); extern memType getValidBIOSBase(PCITAG tag, int num); +extern int pciTestMultiDeviceCard(int bus, int dev, int func, PCITAG** pTag); /* xf86Config.c */ @@ -148,6 +149,7 @@ void DoScanPci(int argc, char **argv, int i); /* xf86DoProbe.c */ void DoProbeArgs(int argc, char **argv, int i); void DoProbe(void); +void DoConfigure(void); /* xf86Events.c */ @@ -155,6 +157,10 @@ void xf86PostKbdEvent(unsigned key); void xf86PostMseEvent(DeviceIntPtr device, int buttons, int dx, int dy); void xf86Wakeup(pointer blockData, int err, pointer pReadmask); 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); + /* xf86Helper.c */ void xf86LogInit(void); @@ -163,6 +169,7 @@ void OsVendorVErrorF(const char *f, va_list args); /* xf86Init.c */ Bool xf86LoadModules(char **list, pointer *optlist); +pointer xf86LoadOneModule(char *name, pointer optlist); /* xf86Io.c */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h b/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h index 99b5b6eb4..4502f8e66 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.17 1999/09/04 13:04:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.18 2000/02/08 13:13:06 eich Exp $ */ /* * Copyright (c) 1997,1998 by The XFree86 Project, Inc. @@ -121,6 +121,8 @@ typedef struct { #if defined(i386) || defined(__i386__) Bool pc98; #endif + Bool pmFlag; + int estimateSizesAggressively; } xf86InfoRec, *xf86InfoPtr; #ifdef DPMSExtension diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h b/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h index 76b3fd614..826aad632 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86Resources.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.7 1999/12/03 19:17:23 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.8 2000/02/08 13:13:06 eich Exp $ */ #ifndef _XF86_RESOURCES_H @@ -9,75 +9,75 @@ #define _END {ResEnd,0,0} #define _VGA_EXCLUSIVE \ - {ResExcMemBlock | ResBios, 0x000A0000, 0x000AFFFF},\ - {ResExcMemBlock | ResBios, 0x000B0000, 0x000B7FFF},\ - {ResExcMemBlock | ResBios, 0x000B8000, 0x000BFFFF},\ - {ResExcIoBlock | ResBios, 0x03B0, 0x03BB},\ - {ResExcIoBlock | ResBios, 0x03C0, 0x03DF} + {ResExcMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ + {ResExcMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ + {ResExcMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\ + {ResExcIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\ + {ResExcIoBlock | ResBios | ResBus, 0x03C0, 0x03DF} #define _VGA_SHARED \ - {ResShrMemBlock | ResBios, 0x000A0000, 0x000AFFFF},\ - {ResShrMemBlock | ResBios, 0x000B0000, 0x000B7FFF},\ - {ResShrMemBlock | ResBios, 0x000B8000, 0x000BFFFF},\ - {ResShrIoBlock | ResBios, 0x03B0, 0x03BB},\ - {ResShrIoBlock | ResBios, 0x03C0, 0x03DF} + {ResShrMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ + {ResShrMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ + {ResShrMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\ + {ResShrIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\ + {ResShrIoBlock | ResBios | ResBus, 0x03C0, 0x03DF} #define _VGA_SHARED_MEM \ - {ResShrMemBlock | ResBios, 0xA0000, 0xAFFFF},\ - {ResShrMemBlock | ResBios, 0xB0000, 0xB7FFF},\ - {ResShrMemBlock | ResBios, 0xB8000, 0xBFFFF} + {ResShrMemBlock | ResBios | ResBus, 0xA0000, 0xAFFFF},\ + {ResShrMemBlock | ResBios | ResBus, 0xB0000, 0xB7FFF},\ + {ResShrMemBlock | ResBios | ResBus, 0xB8000, 0xBFFFF} #define _VGA_SHARED_IO \ - {ResShrIoBlock | ResBios, 0x03B0, 0x03BB},\ - {ResShrIoBlock | ResBios, 0x03C0, 0x03DF} + {ResShrIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\ + {ResShrIoBlock | ResBios | ResBus, 0x03C0, 0x03DF} /* * Exclusive unused VGA: resources unneeded but cannot be disabled. * Like old Millennium. */ #define _VGA_EXCLUSIVE_UNUSED \ - {ResExcUusdMemBlock | ResBios, 0x000A0000, 0x000AFFFF},\ - {ResExcUusdMemBlock | ResBios, 0x000B0000, 0x000B7FFF},\ - {ResExcUusdMemBlock | ResBios, 0x000B8000, 0x000BFFFF},\ - {ResExcUusdIoBlock | ResBios, 0x03B0, 0x03BB},\ - {ResExcUusdIoBlock | ResBios, 0x3C0, 0x3DF} + {ResExcUusdMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ + {ResExcUusdMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ + {ResExcUusdMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\ + {ResExcUusdIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\ + {ResExcUusdIoBlock | ResBios | ResBus, 0x3C0, 0x3DF} /* * Shared unused VGA: resources unneeded but cannot be disabled * independently. This is used to determine if a device needs RAC. */ #define _VGA_SHARED_UNUSED \ - {ResShrUusdMemBlock | ResBios, 0x000A0000, 0x000AFFFF},\ - {ResShrUusdMemBlock | ResBios, 0x000B0000, 0x000B7FFF},\ - {ResShrUusdMemBlock | ResBios, 0x000B8000, 0x000BFFFF},\ - {ResShrUusdIoBlock | ResBios, 0x03B0, 0x03BB},\ - {ResShrUusdIoBlock | ResBios, 0x03C0, 0x03DF} + {ResShrUusdMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ + {ResShrUusdMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ + {ResShrUusdMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\ + {ResShrUusdIoBlock | ResBios | ResBus, 0x03B0, 0x03BB},\ + {ResShrUusdIoBlock | ResBios | ResBus, 0x03C0, 0x03DF} /* * Sparse versions of the above for those adapters that respond to all ISA * aliases of VGA ports. */ #define _VGA_EXCLUSIVE_SPARSE \ - {ResExcMemBlock | ResBios, 0x000A0000, 0x000AFFFF},\ - {ResExcMemBlock | ResBios, 0x000B0000, 0x000B7FFF},\ - {ResExcMemBlock | ResBios, 0x000B8000, 0x000BFFFF},\ - {ResExcIoSparse | ResBios, 0x03B0, 0x03F8},\ - {ResExcIoSparse | ResBios, 0x03B8, 0x03FC},\ - {ResExcIoSparse | ResBios, 0x03C0, 0x03E0} + {ResExcMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ + {ResExcMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ + {ResExcMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\ + {ResExcIoSparse | ResBios | ResBus, 0x03B0, 0x03F8},\ + {ResExcIoSparse | ResBios | ResBus, 0x03B8, 0x03FC},\ + {ResExcIoSparse | ResBios | ResBus, 0x03C0, 0x03E0} #define _VGA_SHARED_SPARSE \ - {ResShrMemBlock | ResBios, 0x000A0000, 0x000AFFFF},\ - {ResShrMemBlock | ResBios, 0x000B0000, 0x000B7FFF},\ - {ResShrMemBlock | ResBios, 0x000B8000, 0x000BFFFF},\ - {ResShrIoSparse | ResBios, 0x03B0, 0x03F8},\ - {ResShrIoSparse | ResBios, 0x03B8, 0x03FC},\ - {ResShrIoSparse | ResBios, 0x03C0, 0x03E0} + {ResShrMemBlock | ResBios | ResBus, 0x000A0000, 0x000AFFFF},\ + {ResShrMemBlock | ResBios | ResBus, 0x000B0000, 0x000B7FFF},\ + {ResShrMemBlock | ResBios | ResBus, 0x000B8000, 0x000BFFFF},\ + {ResShrIoSparse | ResBios | ResBus, 0x03B0, 0x03F8},\ + {ResShrIoSparse | ResBios | ResBus, 0x03B8, 0x03FC},\ + {ResShrIoSparse | ResBios | ResBus, 0x03C0, 0x03E0} #define _8514_EXCLUSIVE \ - {ResExcIoSparse | ResBios, 0x02E8, 0x03F8} + {ResExcIoSparse | ResBios | ResBus, 0x02E8, 0x03F8} #define _8514_SHARED \ - {ResShrIoSparse | ResBios, 0x02E8, 0x03F8} + {ResShrIoSparse | ResBios | ResBus, 0x02E8, 0x03F8} /* predefined resources */ extern resRange resVgaExclusive[]; @@ -97,13 +97,14 @@ extern resRange res8514Shared[]; #define RES_EXCLUSIVE_8514 res8514Exclusive #define RES_SHARED_8514 res8514Shared -#define _PCI_AVOID \ - {ResExcIoSparse, 0x0100, 0x0300},\ - {ResExcIoSparse, 0x0200, 0x0200},\ - {ResExcMemBlock, 0xA0000,0xFFFFF} +#define _PCI_AVOID_PC_STYLE \ + {ResExcIoSparse | ResBus, 0x0100, 0x0300},\ + {ResExcIoSparse | ResBus, 0x0200, 0x0200},\ + {ResExcMemBlock | ResBus, 0xA0000,0xFFFFF} extern resRange PciAvoid[]; #define RES_UNDEFINED NULL #endif + diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c index ad71fafb0..74c76701b 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c,v 3.2 1999/12/06 03:52:40 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86isaBus.c,v 3.3 2000/02/08 13:13:06 eich Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -105,3 +105,9 @@ xf86IsPrimaryIsa(void) { return ( primaryBus.type == BUS_ISA ); } + +void +isaConvertRange2Host(resRange *pRange) +{ + return; +} diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c index 5f6a7fe14..4e583bf9c 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.2 1999/12/06 03:52:40 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.10 2000/02/21 18:09:59 dawes Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -17,10 +17,13 @@ #include "xf86.h" #include "xf86Priv.h" #include "xf86Resources.h" +#include "xf86ScanPci.h" /* Bus-specific headers */ +#undef DECLARE_CARD_DATASTRUCTURES #define DECLARE_CARD_DATASTRUCTURES TRUE #include "xf86PciInfo.h" +#include "xf86ScanPci.h" #include "xf86Bus.h" @@ -30,8 +33,6 @@ #include "xf86RAC.h" -resRange PciAvoid[] = {_PCI_AVOID, _END}; - /* Bus-specific globals */ pciConfigPtr *xf86PciInfo = NULL; /* Full PCI probe info */ pciVideoPtr *xf86PciVideoInfo = NULL; /* PCI probe for video hw */ @@ -76,11 +77,46 @@ static PciBusPtr xf86PciBus = NULL; #undef MIN #define MIN(x,y) ((x<y)?x:y) +#define B2M(tag,base) pciBusAddrToHostAddr(tag,PCI_MEM,base) +#define B2I(tag,base) (base) +#define B2H(tag,base,type) ((type & ResMem) ? (B2M(tag,base)) : (B2I(tag,base))) +#define M2B(tag,base) pciHostAddrToBusAddr(tag,PCI_IO,base) +#define I2B(tag,base) (base) +#define H2B(tag,base,type) (type & ResMem) ? M2B(tag,base) : I2B(tag,base) +#define TAG(pvp) (pciTag(pvp->bus,pvp->device,pvp->func)) +#define SIZE(size) ((1 << size) - 1) +#define PCI_SIZE(type,tag,size) ((type & ResMem) \ + ? pciBusAddrToHostAddr(tag,PCI_MEM_SIZE,size) \ + : pciBusAddrToHostAddr(tag,PCI_IO_SIZE,size)) +#define PCI_M_RANGE(range,tag,begin,end,type) \ + { RANGE(range,B2M(tag,begin),B2M(tag,end),type); } +#define PCI_I_RANGE(range,tag,begin,end,type) \ + { RANGE(range,B2I(tag,begin),B2I(tag,end),type); } +#define PCI_X_RANGE(range,tag,begin,end,type) \ +{ if (type & ResMem) PCI_M_RANGE(range,tag,begin,end,type); \ + else PCI_I_RANGE(range,tag,begin,end,type); } +#define P_M_RANGE(range,tag,begin,size,type) \ + PCI_M_RANGE(range,tag,begin,(begin + SIZE(size)),type) +#define P_I_RANGE(range,tag,begin,size,type) \ + PCI_I_RANGE(range,tag,begin,(begin + SIZE(size)),type) +#define P_X_RANGE(range,tag,begin,size,type) \ +{ if (type & ResMem) P_M_RANGE(range,tag,begin,size,type); \ + else P_I_RANGE(range,tag,begin,size,type); } +#define PV_M_RANGE(range,pvp,i,type) \ + P_M_RANGE(range,TAG(pvp),pvp->memBase[i],pvp->size[i],type) +#define PV_B_RANGE(range,pvp,type) \ + P_M_RANGE(range,TAG(pvp),pvp->biosBase,pvp->biosSize,type) +#define PV_I_RANGE(range,pvp,i,type) \ + P_I_RANGE(range,TAG(pvp),pvp->ioBase[i],pvp->size[i],type) + SymTabPtr xf86PCIVendorNameInfo; pciVendorCardInfo *xf86PCICardInfo; pciVendorDeviceInfo * xf86PCIVendorInfo; static void +getPciClassFlags(pciConfigPtr *pcrpp); + +static void FindPCIVideoInfo(void) { pciConfigPtr pcrp, *pcrpp; @@ -90,7 +126,8 @@ FindPCIVideoInfo(void) Bool mem64 = FALSE; pcrpp = xf86PciInfo = xf86scanpci(0); - + getPciClassFlags(pcrpp); + if (pcrpp == NULL) { xf86PciVideoInfo = NULL; return; @@ -98,7 +135,18 @@ FindPCIVideoInfo(void) xf86PciBus = xf86GetPciBridgeInfo(xf86PciInfo); while ((pcrp = pcrpp[i])) { - if (PCIINFOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class)) { + int baseclass; + int subclass; + + if (pcrp->listed_class & 0xffff) { + baseclass = (pcrp->listed_class >> 8) & 0xff; + subclass = pcrp->listed_class & 0xff; + } else { + baseclass = pcrp->pci_base_class; + subclass = pcrp->pci_sub_class; + } + + if (PCIINFOCLASSES(baseclass, subclass)) { num++; xf86PciVideoInfo = xnfrealloc(xf86PciVideoInfo, sizeof(pciVideoPtr) * (num + 1)); @@ -113,14 +161,14 @@ FindPCIVideoInfo(void) info->bus = pcrp->busnum; info->device = pcrp->devnum; info->func = pcrp->funcnum; - info->class = pcrp->pci_base_class; + info->class = baseclass; info->subclass = pcrp->pci_sub_class; info->interface = pcrp->pci_prog_if; info->biosBase = PCIGETROM(pcrp->pci_baserom); info->biosSize = pciGetBaseSize(pcrp->tag, 6, TRUE, NULL); info->thisCard = pcrp; info->validate = FALSE; - if ((PCISHAREDIOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class)) + if ((PCISHAREDIOCLASSES(baseclass, subclass)) && (pcrp->pci_command & PCI_CMD_IO_ENABLE) && (pcrp->pci_prog_if == 0)) { /* assumption: primary bus is always VGA */ @@ -257,6 +305,7 @@ FindPCIVideoInfo(void) info->memBase[5] = (memType)PCIGETMEMORY(pcrp->pci_base5); } } + info->listed_class = pcrp->listed_class; } i++; } @@ -294,7 +343,11 @@ FindPCIVideoInfo(void) if ((!vendorname || !chipname) && !PCIALWAYSPRINTCLASSES(info->class, info->subclass)) continue; - xf86Msg(X_PROBED, "PCI: (%d:%d:%d) ", info->bus, info->device, + if (xf86IsPrimaryPci(info)) + xf86Msg(X_PROBED, "PCI:*(%d:%d:%d) ", info->bus, info->device, + info->func); + else + xf86Msg(X_PROBED, "PCI: (%d:%d:%d) ", info->bus, info->device, info->func); if (vendorname) ErrorF("%s ", vendorname); @@ -367,22 +420,24 @@ fixPciSizeInfo(int entityIndex) while (pAcc) { if (((pAcc->res_type & (ResMem | ResBlock)) == (ResMem | ResBlock)) - && (pAcc->block_begin == pvp->memBase[j]) /*@@@*/ - && (pAcc->block_end == pvp->memBase[j] /*@@@*/ - + (1 << (pvp->size[j])) - 1)) break; + && (pAcc->block_begin == B2M(TAG(pvp),pvp->memBase[j])) + && (pAcc->block_end == B2M(TAG(pvp),pvp->memBase[j] + + SIZE(pvp->size[j])))) break; pAcc = pAcc->next; } else if (pvp->ioBase[j]) while (pAcc) { if (((pAcc->res_type & (ResIo | ResBlock)) == (ResIo | ResBlock)) - && (pAcc->block_begin == pvp->ioBase[j]) /*@@@*/ - && (pAcc->block_end == pvp->ioBase[j] /*@@@*/ - + (1 << (pvp->size[j])) - 1)) break; + && (pAcc->block_begin == B2I(TAG(pvp),pvp->ioBase[j])) + && (pAcc->block_end == B2I(TAG(pvp),pvp->ioBase[j] + + SIZE(pvp->size[j])))) break; pAcc = pAcc->next; } else continue; pvp->size[j] = pciGetBaseSize(tag, j, TRUE, &pvp->validSize); if (pAcc) { - pAcc->block_end = pAcc->block_begin + (1 << (pvp->size[j])) - 1; + pAcc->block_end = pvp->memBase[j] ? + B2M(TAG(pvp),pvp->memBase[j] + SIZE(pvp->size[j])) + : B2I(TAG(pvp),pvp->ioBase[j] + SIZE(pvp->size[j])); pAcc->res_type &= ~ResEstimated; pAcc->res_type |= ResBios; } @@ -391,14 +446,14 @@ fixPciSizeInfo(int entityIndex) pAcc = Acc; while (pAcc) { if (((pAcc->res_type & (ResMem | ResBlock)) == (ResMem | ResBlock)) - && (pAcc->block_begin == pvp->biosBase)/*@@@*/ - && (pAcc->block_end == pvp->biosBase/*@@@*/ - + (1 << (pvp->biosSize)) - 1)) break; + && (pAcc->block_begin == B2M(TAG(pvp),pvp->biosBase)) + && (pAcc->block_end == B2M(TAG(pvp),pvp->biosBase + + SIZE(pvp->biosSize)))) break; pAcc = pAcc->next; } pvp->biosSize = pciGetBaseSize(tag, 6, TRUE, &pvp->validSize); if (pAcc) { - pAcc->block_end = pAcc->block_begin + (1 << (pvp->biosSize))- 1; + pAcc->block_end = B2M(TAG(pvp),pvp->biosBase+SIZE(pvp->biosSize)); pAcc->res_type &= ~ResEstimated; pAcc->res_type |= ResBios; } @@ -415,8 +470,13 @@ pciIoAccessEnable(void* arg) #ifdef DEBUG ErrorF("pciIoAccessEnable: 0x%05lx\n", *(PCITAG *)arg); #endif + ((pciArg*)arg)->ctrl |= SETBITS; +#ifdef notanymore ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, SETBITS, SETBITS); +#endif + ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, + ((pciArg*)arg)->ctrl); } static void @@ -425,7 +485,12 @@ pciIoAccessDisable(void* arg) #ifdef DEBUG ErrorF("pciIoAccessDisable: 0x%05lx\n", *(PCITAG *)arg); #endif + ((pciArg*)arg)->ctrl &= ~SETBITS; +#ifdef notanymore ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, SETBITS, 0); +#endif + ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, + ((pciArg*)arg)->ctrl); } #undef SETBITS @@ -436,8 +501,13 @@ pciIo_MemAccessEnable(void* arg) #ifdef DEBUG ErrorF("pciIo_MemAccessEnable: 0x%05lx\n", *(PCITAG *)arg); #endif + ((pciArg*)arg)->ctrl |= SETBITS; +#ifdef notanymore ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, SETBITS, SETBITS); +#endif + ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, + ((pciArg*)arg)->ctrl); } static void @@ -446,7 +516,12 @@ pciIo_MemAccessDisable(void* arg) #ifdef DEBUG ErrorF("pciIo_MemAccessDisable: 0x%05lx\n", *(PCITAG *)arg); #endif + ((pciArg*)arg)->ctrl &= ~SETBITS; +#ifdef notanymore ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, SETBITS, 0); +#endif + ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, + ((pciArg*)arg)->ctrl); } #undef SETBITS @@ -457,8 +532,13 @@ pciMemAccessEnable(void* arg) #ifdef DEBUG ErrorF("pciMemAccessEnable: 0x%05lx\n", *(PCITAG *)arg); #endif + ((pciArg*)arg)->ctrl |= SETBITS; +#ifdef notanymore ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, SETBITS, SETBITS); +#endif + ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, + ((pciArg*)arg)->ctrl); } static void @@ -467,7 +547,12 @@ pciMemAccessDisable(void* arg) #ifdef DEBUG ErrorF("pciMemAccessDisable: 0x%05lx\n", *(PCITAG *)arg); #endif + ((pciArg*)arg)->ctrl &= ~SETBITS; +#ifdef notanymore ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG,SETBITS, 0); +#endif + ((pciArg*)arg)->func(((pciArg*)arg)->tag, PCI_CMD_STAT_REG, + ((pciArg*)arg)->ctrl); } #undef SETBITS @@ -602,14 +687,13 @@ correctPciSize(memType base, int oldsize, int newsize, long type) int j = i; if (basep[i] && (pcrp->basesize[i] == old_bits)) if (((type & ResIo) && PCI_MAP_IS_IO(basep[i]) - && (PCIGETIO(basep[i]) == base)) + && (B2I(pcrp->tag,PCIGETIO(basep[i])) == base)) || ((type & ResMem) && PCI_MAP_IS_MEM(basep[i]) && (((!PCI_MAP_IS64BITMEM(basep[i])) - && (PCIGETMEMORY(basep[i]) == base)) + && (B2M(pcrp->tag,PCIGETMEMORY(basep[i])) == base)) #if defined LONG64 || defined WORD64 - || (((PCIGETMEMORY(basep[i]) - | ((memType)basep[++i] << 32)) == base)) -#endif + || (B2M(pcrp->tag,PCIGETMEMORY64(basep[i])) == base) +#endif ))) { pcrp->basesize[j] = new_bits; return; @@ -623,9 +707,9 @@ correctPciSize(memType base, int oldsize, int newsize, long type) for (i = 0; i < 6; i++) { if (pvp->size[i] == old_bits) { if (((type & ResIo) && pvp->ioBase[i] - && (pvp->ioBase[i] == base)) || - ((type & ResMem) && pvp->memBase[i] - && (pvp->memBase[i] == base))) { + && (B2I(TAG(pvp),pvp->ioBase[i]) == base)) || + ((type & ResMem) && pvp->memBase[i] + && (B2M(TAG(pvp),pvp->memBase[i]) == base))) { pvp->size[i] = new_bits; return; } @@ -703,16 +787,12 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes) for (i = 0; i < 6; i++) { if (pvp->ioBase[i]) { - RANGE(range, pvp->ioBase[i],/*@@@*/ - pvp->ioBase[i] + (1 << pvp->size[i]) - 1, - ResExcIoBlock | resMisc); + PV_I_RANGE(range,pvp,i,ResExcIoBlock | resMisc); tmp = xf86AddResToList(NULL, &range, -1); removeOverlapsWithBridges(pvp->bus,tmp); *res = xf86JoinResLists(tmp,*res); } else if (pvp->memBase[i]) { - RANGE(range, pvp->memBase[i],/*@@@*/ - pvp->memBase[i] + (1 << pvp->size[i]) - 1, - ResExcMemBlock | resMisc); + PV_M_RANGE(range, pvp,i, ResExcMemBlock | resMisc); tmp = xf86AddResToList(NULL, &range, -1); removeOverlapsWithBridges(pvp->bus,tmp); *res = xf86JoinResLists(tmp,*res); @@ -722,9 +802,7 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes) * checking but reserve them! */ if (pvp->biosBase) { - RANGE(range, pvp->biosBase,/*@@@*/ - pvp->biosBase + (1 << pvp->biosSize) - 1, - ResExcMemBlock | resMisc); + PV_B_RANGE(range, pvp, ResExcMemBlock | resMisc); tmp = xf86AddResToList(NULL, &range, -1); removeOverlapsWithBridges(pvp->bus,tmp); *res = xf86JoinResLists(tmp,*res); @@ -754,38 +832,37 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes) basep = &pcrp->pci_base0; for (i = 0; i < 6; i++) { if (basep[i]) { - if (PCI_MAP_IS_IO(basep[i])) - RANGE(range,PCIGETIO(basep[i]),/*@@@*/ - range.rBegin + (1 << pcrp->basesize[i]) - 1, - ResExcIoBlock | resMisc) - else if (!PCI_MAP_IS64BITMEM(basep[i])) - RANGE(range,PCIGETMEMORY(basep[i]),/*@@@*/ - range.rBegin + (1 << pcrp->basesize[i]) - 1, - ResExcMemBlock | resMisc) + if (PCI_MAP_IS_IO(basep[i])) + P_I_RANGE(range,pcrp->tag,PCIGETIO(basep[i]), + pcrp->basesize[i], ResExcIoBlock | resMisc) + else if (!PCI_MAP_IS64BITMEM(basep[i])) + P_M_RANGE(range,pcrp->tag,PCIGETMEMORY(basep[i]), + pcrp->basesize[i], ResExcMemBlock | resMisc) else { i++; #if defined LONG64 || defined WORD64 - RANGE(range,PCIGETMEMORY(basep[i-1])/*@@@*/ - | ((memType)basep[i] << 32), - range.rBegin + (1<<pcrp->basesize[i-1]) - 1, - ResExcMemBlock | resMisc) + P_M_RANGE(range,pcrp->tag,PCIGETMEMORY64(basep[i-1]), + pcrp->basesize[i-1], ResExcMemBlock | resMisc) #else - continue; + continue; #endif - } + } + if (range.rBegin) { /* catch cases where PCI base is unset */ + tmp = xf86AddResToList(NULL, &range, -1); + removeOverlapsWithBridges(pcrp->busnum,tmp); + *res = xf86JoinResLists(tmp,*res); + } + } + } + if (pcrp->pci_baserom) { + P_M_RANGE(range,pcrp->tag,PCIGETROM(pcrp->pci_baserom), + pcrp->basesize[6], ResExcMemBlock | resMisc); + if (range.rBegin) { tmp = xf86AddResToList(NULL, &range, -1); removeOverlapsWithBridges(pcrp->busnum,tmp); *res = xf86JoinResLists(tmp,*res); } } - if (pcrp->pci_baserom) { - RANGE(range,PCIGETROM(pcrp->pci_baserom),/*@@@*/ - range.rBegin + (1 << pcrp->basesize[6]) - 1, - ResExcMemBlock | resMisc); - tmp = xf86AddResToList(NULL, &range, -1); - removeOverlapsWithBridges(pcrp->busnum,tmp); - *res = xf86JoinResLists(tmp,*res); - } } if (*activeRes) { @@ -812,7 +889,7 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes) range = pRes->val; RemoveOverlaps(pRes, *activeRes, TRUE); - if (xf86EstimateSizesAggressively > 0) + if (xf86Info.estimateSizesAggressively > 0) RemoveOverlaps(pRes, *inactiveRes, TRUE); if (range.rEnd > pRes->block_end) { @@ -832,7 +909,7 @@ xf86GetPciRes(resPtr *activeRes, resPtr *inactiveRes) xf86PrintResList(3, *activeRes); } - if (*inactiveRes && (xf86EstimateSizesAggressively > 1)) { + if (*inactiveRes && (xf86Info.estimateSizesAggressively > 1)) { /* Check for overlaps */ for (pRes = *inactiveRes; pRes; pRes = pRes->next) { if (ResIsEstimated(&pRes->val)) { @@ -898,13 +975,13 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) int *p_size; unsigned char p_type; resPtr AccTmp = NULL; + resPtr orgAcc = NULL; resPtr *pAcc = &AccTmp; resPtr avoid = NULL; - resList p_avoid = PciAvoid; resRange range; resPtr resSize = NULL; resPtr w_tmp, w = NULL, w_2nd = NULL; - PCITAG tag; + PCITAG tag = pciTag(pvp->bus,pvp->device,pvp->func); PciBusPtr pbp = xf86PciBus, pbp1 = xf86PciBus; resPtr tmp; @@ -920,7 +997,7 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) p_size = &(pvp->size[res_n]); p_type = pvp->type[res_n]; if (!PCI_MAP_IS64BITMEM(pvp->type[res_n])) { - RANGE(range,0,0xffffffff,ResExcMemBlock);/*@@@*/ + PCI_M_RANGE(range,tag,0,0xffffffff,ResExcMemBlock); resSize = xf86AddResToList(resSize,&range,-1); } } else if (pvp->ioBase[prt]){ @@ -937,7 +1014,7 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) p_size = &(pvp->biosSize); /* XXX This should also include the PCI_MAP_MEMORY_TYPE_MASK part */ p_type = 0; - RANGE(range,0,0xffffffff,ResExcMemBlock);/*@@@*/ + PCI_M_RANGE(range,tag,0,0xffffffff,ResExcMemBlock); resSize = xf86AddResToList(resSize,&range,-1); } else return FALSE; @@ -945,8 +1022,8 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) type |= ResBlock; - /* setup avoid */ - avoid = xf86AddRangesToList(avoid,p_avoid,-1); + /* setup avoid: PciAvoid is bus range: convert later */ + avoid = xf86AddRangesToList(avoid,PciAvoid,-1); while (pbp) { if (pbp->secondary == pvp->bus) { @@ -986,7 +1063,10 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) } pbp = pbp->next; } - + + /* convert bus based entries in avoid list to host base */ + xf86ConvertListToHost(xf86GetEntityForPciInfo(pvp),avoid); + if (!w) w = xf86DupResList(ResRange); xf86MsgVerb(X_INFO, 3, "window:\n"); @@ -1010,15 +1090,16 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) if (!alignment) alignment = (1 << (*p_size)) - 1; - + /* Access list holds bios resources -- remove this one */ #ifdef NOTYET AccTmp = xf86DupResList(Acc); while ((*pAcc)) { if ((((*pAcc)->res_type & (type & ~ResAccMask)) == (type & ~ResAccMask)) - && ((*pAcc)->block_begin == (*p_base))/*@@@*/ - && ((*pAcc)->block_end == (*p_base) + (1 << (*p_size)) - 1)) { + && ((*pAcc)->block_begin == (B2H(tag,(*p_base),type))) + && ((*pAcc)->block_end == (B2H(tag, + (*p_base)+SIZE(*p_size),type)))) { resPtr acc_tmp = (*pAcc)->next; xfree((*pAcc)); (*pAcc) = acc_tmp; @@ -1027,12 +1108,13 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) pAcc = &((*pAcc)->next); } /* check if we really need to fix anything */ - RANGE(range, (*p_base), (*p_base) + (1 << (*p_size)) - 1, type);/*@@@*/ + P_X_RANGE(range,tag,(*p_base),(*p_base) + SIZE((*p_size)),type); if (!ChkConflict(&range,avoid,SETUP) && !ChkConflict(&range,AccTmp,SETUP) - && (((*p_base) & alignment) == (*p_base)->block_begin)/*@@@*/ - && ((isSubsetOf(range,w) - || (w_2nd && isSubsetOf(range,w_2n))))) { + && ((B2H(tag,(*p_base),type) & PCI_SIZE(type,tag,alignment) + == range->block_begin) + && ((xf86IsSubsetOf(range,w) + || (w_2nd && xf86IsSubsetOf(range,w_2n))))) { #ifdef DEBUG ErrorF("nothing to fix\n"); #endif @@ -1045,16 +1127,18 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) #ifdef DEBUG ErrorF("removing old resource\n"); #endif - xf86FreeResList(Acc); + orgAcc = Acc; Acc = AccTmp; } #else + orgAcc = xf86DupResList(Acc); pAcc = &Acc; while ((*pAcc)) { if ((((*pAcc)->res_type & (type & ~ResAccMask)) == (type & ~ResAccMask)) - && ((*pAcc)->block_begin == (*p_base))/*@@@*/ - && ((*pAcc)->block_end == (*p_base) + (1 << (*p_size)) - 1)) { + && ((*pAcc)->block_begin == B2H(tag,(*p_base),type)) + && ((*pAcc)->block_end == B2H(tag,(*p_base) + SIZE(*p_size), + type))) { #ifdef DEBUG ErrorF("removing old resource\n"); #endif @@ -1066,8 +1150,8 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) #endif #ifdef DEBUG - ErrorF("base: 0x%lx alignment: 0x%lx size[bit]: 0x%x\n", - (*p_base),alignment,(*p_size)); + ErrorF("base: 0x%lx alignment: 0x%lx host alignment: 0x%lx size[bit]: 0x%x\n", + (*p_base),alignment,PCI_SIZE(type,tag,alignment),(*p_size)); xf86MsgVerb(X_INFO, 3, "window:\n"); xf86PrintResList(3, w); if (w_2nd) @@ -1083,8 +1167,9 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) ErrorF("block_begin: 0x%lx block_end: 0x%lx\n",w->block_begin, w->block_end); #endif - range = xf86GetBlock(type,alignment + 1, w->block_begin, - w->block_end, alignment,avoid); + range = xf86GetBlock(type,PCI_SIZE(type,tag,alignment + 1), + w->block_begin, w->block_end, + PCI_SIZE(type,tag,alignment),avoid); if (range.type != ResEnd) break; } @@ -1100,8 +1185,9 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) ErrorF("block_begin: 0x%lx block_end: 0x%lx\n",w_2nd->block_begin, w_2nd->block_end); #endif - range = xf86GetBlock(type,alignment + 1, w_2nd->block_begin, - w_2nd->block_end,alignment,avoid); + range = xf86GetBlock(type,PCI_SIZE(type,tag,alignment + 1), + w_2nd->block_begin, w_2nd->block_end, + PCI_SIZE(type,tag,alignment),avoid); if (range.type != ResEnd) break; } @@ -1113,8 +1199,11 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) if (range.type == ResEnd) { xf86MsgVerb(X_ERROR,3,"Cannot find a replacement memory range\n"); + xf86FreeResList(Acc); + Acc = orgAcc; return FALSE; } + xf86FreeResList(orgAcc); #ifdef DEBUG ErrorF("begin: 0x%lx, end: 0x%lx\n",range.a,range.b); #endif @@ -1122,13 +1211,12 @@ fixPciResource(int prt, memType alignment, pciVideoPtr pvp, long type) (*p_size) = 0; while (alignment >> (*p_size)) (*p_size)++; - (*p_base) = range.rBegin;/*@@@*/ + (*p_base) = H2B(tag,range.rBegin,type); #ifdef DEBUG ErrorF("New PCI res %i base: 0x%lx, size: 0x%lx, type %s\n", res_n,(*p_base),(1 << (*p_size)),type | ResMem ? "Mem" : "Io"); #endif - tag = pciTag(pvp->bus,pvp->device,pvp->func); if (res_n != 0xff) { pciWriteLong(tag,PCI_CMD_BASE_REG + res_n * sizeof(CARD32), @@ -1171,22 +1259,23 @@ xf86ReallocatePciResources(int entityIndex, resPtr pRes) while (pRes) { switch (pRes->res_type & ResPhysMask) { case ResMem: - if (pRes->block_begin == pvp->biosBase &&/*@@@*/ - pRes->block_end == pvp->biosBase + (1 << (pvp->biosSize)) - 1) + if (pRes->block_begin == B2M(TAG(pvp),pvp->biosBase) && + pRes->block_end == B2M(TAG(pvp),pvp->biosBase + + SIZE(pvp->biosSize))) prt = 6; else for (i = 0 ; i < 6; i++) - if (pRes->block_begin == pvp->memBase[i]/*@@@*/ - && pRes->block_end - == pvp->memBase[i] + (1 << (pvp->size[i])) - 1) { + if ((pRes->block_begin == B2M(TAG(pvp),pvp->memBase[i])) + && (pRes->block_end == B2M(TAG(pvp),pvp->memBase[i] + + SIZE(pvp->size[i])))) { prt = i; break; } break; case ResIo: for (i = 0 ; i < 6; i++) - if (pRes->block_begin == pvp->ioBase[i]/*@@@*/ - && pRes->block_end - == pvp->ioBase[i] + (1 << (pvp->size[i])) - 1) { + if (pRes->block_begin == B2I(TAG(pvp),pvp->ioBase[i]) + && pRes->block_end == B2I(TAG(pvp),pvp->ioBase[i] + + SIZE(pvp->size[i]))) { prt = i; break; } @@ -1216,8 +1305,7 @@ getValidBIOSBase(PCITAG tag, int num) { pciVideoPtr pvp = NULL; PciBusPtr pbp, pbp1; - memType start_mp = 0, start_m = 0; - memType end_mp, end_m; + resPtr m = NULL; resPtr tmp, avoid; resRange range; int n = 0; @@ -1235,19 +1323,20 @@ getValidBIOSBase(PCITAG tag, int num) biosSize = pvp->biosSize; alignment = (1 << biosSize) - 1; if (biosSize > 24) - biosSize = 1 << 24; + biosSize = 24; avoid = NULL; - end_m = end_mp = PCI_MEM32_LENGTH_MAX; + pbp = pbp1 = xf86PciBus; while (pbp) { if (pbp->secondary == pvp->bus) { - if (pbp->pmem) { - start_mp = pbp->pmem->block_begin; - end_mp = MIN(end_mp,pbp->pmem->block_end); - } - if (pbp->mem) { - start_m = pbp->mem->block_begin; - end_m = MIN(end_m,pbp->mem->block_end); + tmp = xf86DupResList(pbp->pmem); + m = xf86JoinResLists(m,tmp); + tmp = xf86DupResList(pbp->mem); + m = xf86JoinResLists(m,tmp); + tmp = m; + while (tmp) { + tmp->block_end = MIN(tmp->block_end,PCI_MEM32_LENGTH_MAX); + tmp = tmp->next; } } while (pbp1) { @@ -1263,40 +1352,42 @@ getValidBIOSBase(PCITAG tag, int num) } if (pvp->biosBase) { /* try biosBase first */ - RANGE(range, pvp->biosBase,/*@@@*/ - pvp->biosBase + (1 << biosSize) - 1, - ResExcMemBlock); - if (((range.rBegin >= start_m && range.rEnd <= end_m) || - (range.rBegin >= start_mp && range.rEnd <= end_mp)) - && ! ChkConflict(&range,avoid,SETUP)) { + P_M_RANGE(range, TAG(pvp),pvp->biosBase,biosSize,ResExcMemBlock); + if (xf86IsSubsetOf(range,m) && ! ChkConflict(&range,avoid,SETUP)) { xf86FreeResList(avoid); + xf86FreeResList(m); return pvp->biosBase; } } -#if 1 if (num >= 0 && num <= 5 && pvp->memBase[num]) maxnum = num; else { num = 0; } for (; num <= maxnum; num++) { - /* then try suggested memBase */ - RANGE(range, pvp->memBase[num],/*@@@*/ - pvp->memBase[num] + (1 << biosSize) - 1, - ResExcMemBlock); /* keep bios size ! */ - if ( pvp->size[num] >= biosSize - && ((range.rBegin >= start_m && range.rEnd <= end_m) - || (range.rBegin >= start_mp && range.rEnd <= end_mp)) + /* then try suggested memBase */ + /* keep bios size ! */ + P_M_RANGE(range,TAG(pvp),pvp->memBase[num],biosSize,ResExcMemBlock); + if ( pvp->size[num] >= biosSize && xf86IsSubsetOf(range,m) && ! ChkConflict(&range,avoid,SETUP)) { xf86FreeResList(avoid); + xf86FreeResList(m); return pvp->memBase[num]; } } -#endif - range = xf86GetBlock(ResExcMemBlock, (1 << biosSize),start_m,end_m, - alignment, avoid); + while (m) { + range = xf86GetBlock(ResExcMemBlock, + PCI_SIZE(ResMem,TAG(pvp),(1 << biosSize)), + m->block_begin, m->block_end, + PCI_SIZE(ResMem,TAG(pvp),alignment), avoid); + if (range.type != ResEnd) + break; + m = m->next; + } + xf86FreeResList(avoid); - return range.rBase;/*@@@*/ + xf86FreeResList(m); + return M2B(TAG(pvp),range.rBase); } /* @@ -1306,21 +1397,20 @@ getValidBIOSBase(PCITAG tag, int num) void xf86PciProbe(void) { + void (* DataSetupFunc)(SymTabPtr *, pciVendorDeviceInfo **, + pciVendorCardInfo **); #ifdef XFree86LOADER /* * we need to get the pointer to the pci data structures initialized */ - xf86PCIVendorNameInfo = - (SymTabPtr)LoaderSymbol("xf86PCIVendorNameInfoData"); - xf86PCIVendorInfo = - (pciVendorDeviceInfo*)LoaderSymbol("xf86PCIVendorInfoData"); - xf86PCICardInfo = - (pciVendorCardInfo*)LoaderSymbol("xf86PCICardInfoData"); + + DataSetupFunc = LoaderSymbol("xf86SetupPciData"); #else - xf86PCIVendorNameInfo = xf86PCIVendorNameInfoData; - xf86PCIVendorInfo = xf86PCIVendorInfoData; - xf86PCICardInfo = xf86PCICardInfoData; + DataSetupFunc = xf86SetupScanPci; #endif + + (*DataSetupFunc)(&xf86PCIVendorNameInfo, &xf86PCIVendorInfo, & + xf86PCICardInfo); FindPCIVideoInfo(); } @@ -1343,9 +1433,20 @@ xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo) for (pcrpp = pciInfo, pcrp = *pcrpp; pcrp; pcrp = *(++pcrpp)) { if (pcrp->busnum > MaxBus) MaxBus = pcrp->busnum; - if (pcrp->pci_base_class == PCI_CLASS_BRIDGE) - switch (pcrp->pci_sub_class) { + if ((pcrp->pci_base_class == PCI_CLASS_BRIDGE) + || (((pcrp->listed_class >> 8) & 0xff) == PCI_CLASS_BRIDGE)) { + int sub_class; + sub_class = (pcrp->listed_class & 0xffff) + ? (pcrp->listed_class & 0xff) : pcrp->pci_sub_class; + switch (sub_class) { case PCI_SUBCLASS_BRIDGE_PCI: + /* something fishy about the header? If so: just ignore! */ + if ((pcrp->pci_header_type & 0x7f) != 0x01) { + xf86MsgVerb(3,X_WARNING,"PCI-PCI bridge at %x:%x:%x has " + "funny header: 0x%x",pcrp->busnum,pcrp->devnum, + pcrp->funcnum,pcrp->pci_header_type); + break; + } *pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec)); pnPciBus = &PciBus->next; PciBus->secondary = pcrp->pci_secondary_bus_number; @@ -1354,39 +1455,39 @@ xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo) PciBus->brbus = pcrp->busnum; PciBus->brdev = pcrp->devnum; PciBus->brfunc = pcrp->funcnum; - PciBus->subclass = pcrp->pci_sub_class; + PciBus->subclass = sub_class; PciBus->brcontrol = pcrp->pci_bridge_control; if (pcrp->pci_io_base <= pcrp->pci_io_limit && (pcrp->pci_command & PCI_CMD_IO_ENABLE)) { - RANGE(range,pcrp->pci_io_base << 8 - | (pcrp->pci_upper_io_base << 16),/*@@@*/ - (pcrp->pci_io_limit << 8) - | (pcrp->pci_upper_io_limit << 16) | 0xfff, - ResIo | ResBlock | ResExclusive); + PCI_I_RANGE(range,pcrp->tag,pcrp->pci_io_base << 8 + | (pcrp->pci_upper_io_base << 16), + (pcrp->pci_io_limit << 8) + | (pcrp->pci_upper_io_limit << 16) | 0xfff, + ResIo | ResBlock | ResExclusive); PciBus->io = xf86AddResToList(NULL, &range, -1); } if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) { if (pcrp->pci_mem_base <= pcrp->pci_mem_limit) { - RANGE(range,pcrp->pci_mem_base << 16,/*@@@*/ - (pcrp->pci_mem_limit << 16) | 0xfffff, - ResMem | ResBlock | ResExclusive); + PCI_M_RANGE(range,pcrp->tag,pcrp->pci_mem_base << 16, + (pcrp->pci_mem_limit << 16) | 0xfffff, + ResMem | ResBlock | ResExclusive); PciBus->mem = xf86AddResToList(NULL, &range, -1); } if (pcrp->pci_prefetch_mem_base <= pcrp->pci_prefetch_mem_limit) { #if !defined(LONG64) && !defined(WORD64) - RANGE(range,pcrp->pci_prefetch_mem_base << 16, - (pcrp->pci_prefetch_mem_limit << 16) | 0xfffff, - ResMem | ResBlock | ResExclusive); + PCI_M_RANGE(range,pcrp->tag, + pcrp->pci_prefetch_mem_base << 16, + (pcrp->pci_prefetch_mem_limit << 16) + | 0xfffff, + ResMem | ResBlock | ResExclusive); #else - RANGE(range,pcrp->pci_prefetch_mem_base << 16 - | ((memType)pcrp->pci_prefetch_upper_mem_base - << 32),/*@@@*/ - (pcrp->pci_prefetch_mem_limit - << 16) | 0xfffff - | ((memType)pcrp->pci_prefetch_upper_mem_limit - << 32), - ResMem | ResBlock | ResExclusive); + PCI_M_RANGE(range, pcrp->tag, + pcrp->pci_prefetch_mem_base << 16 + | ((memType)pcrp->pci_prefetch_upper_mem_base << 32), + (pcrp->pci_prefetch_mem_limit << 16) | 0xfffff + | ((memType)pcrp->pci_prefetch_upper_mem_limit << 32), + ResMem | ResBlock | ResExclusive); #endif PciBus->pmem = xf86AddResToList(NULL, &range, -1); } @@ -1400,27 +1501,29 @@ xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo) PciBus->brbus = pcrp->busnum; PciBus->brdev = pcrp->devnum; PciBus->brfunc = pcrp->funcnum; - PciBus->subclass = pcrp->pci_sub_class; + PciBus->subclass = sub_class; break; case PCI_SUBCLASS_BRIDGE_HOST: *pnPciBus = PciBus = xnfcalloc(1, sizeof(PciBusRec)); pnPciBus = &PciBus->next; PciBus->primary = -1; - PciBus->secondary = 0; - PciBus->subclass = pcrp->pci_sub_class; - RANGE(range, 0, 0xFFFFFFFF, ResIo | ResBlock | ResExclusive); - PciBus->io = xf86AddResToList(NULL, &range, -1); - RANGE(range, 0, ~(memType)0, ResMem | ResBlock | ResExclusive); - PciBus->mem = xf86AddResToList(NULL, &range, -1); - PciBus->pmem = xf86AddResToList(NULL, &range, -1); + PciBus->secondary = -1; /* to be set below */ + PciBus->subclass = sub_class; + PciBus->io = xf86ExtractTypeFromList( + xf86PciBusAccWindowsFromOS(),ResIo); + PciBus->mem = xf86ExtractTypeFromList( + xf86PciBusAccWindowsFromOS(),ResMem); + PciBus->pmem = xf86ExtractTypeFromList( + xf86PciBusAccWindowsFromOS(),ResMem); break; default: break; } + } } for (i = 0; i <= MaxBus; i++) { /* find PCI buses not attached to bridge */ for (PciBus = PciBusBase; PciBus; PciBus = PciBus->next) - if (PciBus->secondary) break; + if (PciBus->secondary == i) break; if (!PciBus) { /* We assume it's behind a HOST-PCI bridge */ int minTag = 0xFFFFFF; /*find the 'smallest' free HOST-PCI bridge*/ int tag; /*'small' is in the order of pciTag() */ @@ -1441,11 +1544,12 @@ xf86GetPciBridgeInfo(const pciConfigPtr *pciInfo) PciBus->primary = -1; PciBus->secondary = i; PciBus->subclass = PCI_SUBCLASS_BRIDGE_HOST; - RANGE(range, 0, 0xFFFFFFFF, ResIo | ResBlock | ResExclusive); - PciBus->io = xf86AddResToList(NULL, &range, -1); - RANGE(range, 0, ~(memType)0, ResMem | ResBlock | ResExclusive); - PciBus->mem = xf86AddResToList(NULL, &range, -1); - PciBus->pmem = xf86AddResToList(NULL, &range, -1); + PciBus->io = xf86ExtractTypeFromList( + xf86PciBusAccWindowsFromOS(),ResIo); + PciBus->mem = xf86ExtractTypeFromList( + xf86PciBusAccWindowsFromOS(),ResMem); + PciBus->pmem = xf86ExtractTypeFromList( + xf86PciBusAccWindowsFromOS(),ResMem); } } } @@ -1552,14 +1656,10 @@ ValidatePci(void) for (i = 0; i<6; i++) { if (pvp->ioBase[i]) { - RANGE(range,pvp->ioBase[i],/*@@@*/ - pvp->ioBase[i] + (1 << pvp->size[i]) - 1, - ResExcIoBlock); + PV_I_RANGE(range,pvp,i,ResExcIoBlock); Sys = xf86AddResToList(Sys,&range,-1); } else if (pvp->memBase[i]) { - RANGE(range,pvp->memBase[i],/*@@@*/ - pvp->memBase[i] + (1 << pvp->size[i]) - 1, - ResExcMemBlock); + PV_M_RANGE(range,pvp,i,ResExcMemBlock); Sys = xf86AddResToList(Sys,&range,-1); } } @@ -1576,20 +1676,16 @@ ValidatePci(void) for (i = 0; i < 6; i++) { if (basep[i]) { if (PCI_MAP_IS_IO(basep[i])) - RANGE(range,PCIGETIO(basep[i]),/*@@@*/ - range.rBegin + (1 << pcrp->basesize[i]) - 1, - ResExcIoBlock) + P_I_RANGE(range,pcrp->tag,PCIGETIO(basep[i]), + pcrp->basesize[i], ResExcIoBlock) else if (!PCI_MAP_IS64BITMEM(basep[i])) - RANGE(range,PCIGETMEMORY(basep[i]),/*@@@*/ - range.rBegin + (1 << pcrp->basesize[i]) - 1, - ResExcMemBlock) + P_M_RANGE(range,pcrp->tag,PCIGETMEMORY(basep[i]), + pcrp->basesize[i],ResExcMemBlock) else { i++; #if defined LONG64 || defined WORD64 - RANGE(range,PCIGETMEMORY(basep[i-1])/*@@@*/ - | ((memType)basep[i] << 32), - range.rBegin + (1<<pcrp->basesize[i-1]) - 1, - ResExcMemBlock) + P_M_RANGE(range,pcrp->tag,PCIGETMEMORY64(basep[i-1]), + pcrp->basesize[i-1],ResExcMemBlock) #else continue; #endif @@ -1598,9 +1694,8 @@ ValidatePci(void) } } if (pcrp->pci_baserom) { - RANGE(range,PCIGETROM(pcrp->pci_baserom),/*@@@*/ - range.rBegin + (1 << pcrp->basesize[6]) - 1, - ResExcMemBlock); + P_M_RANGE(range,pcrp->tag,PCIGETROM(pcrp->pci_baserom), + pcrp->basesize[6],ResExcMemBlock); Sys = xf86AddResToList(Sys, &range, -1); } } @@ -1617,7 +1712,7 @@ ValidatePci(void) resPtr res_mp = NULL, res_m_io = NULL; resPtr NonSys = NULL; resPtr tmp, avoid = NULL; - + if (!pvp->validate) continue; NonSys = xf86DupResList(Sys); m = n; @@ -1625,14 +1720,10 @@ ValidatePci(void) if (!pvp1->validate) continue; for (i = 0; i<6; i++) { if (pvp1->ioBase[i]) { - RANGE(range,pvp1->ioBase[i],/*@@@*/ - pvp1->ioBase[i] + (1 << pvp1->size[i]) - 1, - ResExcIoBlock); + PV_I_RANGE(range,pvp1,i,ResExcIoBlock); NonSys = xf86AddResToList(NonSys,&range,-1); } else if (pvp1->memBase[i]) { - RANGE(range,pvp1->memBase[i],/*@@@*/ - pvp1->memBase[i] + (1 << pvp1->size[i]) - 1, - ResExcMemBlock); + PV_M_RANGE(range,pvp1,i,ResExcMemBlock); NonSys = xf86AddResToList(NonSys,&range,-1); } } @@ -1641,7 +1732,6 @@ ValidatePci(void) xf86MsgVerb(X_INFO, 3,"NonSys:\n"); xf86PrintResList(3,NonSys); #endif - avoid = NULL; pbp = pbp1 = xf86PciBus; while (pbp) { if (pbp->secondary == pvp->bus) { @@ -1686,14 +1776,10 @@ ValidatePci(void) resPtr own = NULL; for (j = i+1; j < 6; j++) { if (pvp->ioBase[j]) { - RANGE(range,pvp->ioBase[j],/*@@@*/ - pvp->ioBase[j] + (1 << pvp->size[j]) - 1, - ResExcIoBlock); + PV_I_RANGE(range,pvp,j,ResExcIoBlock); own = xf86AddResToList(own,&range,-1); - } else if (pvp->memBase[j]) {/*@@@*/ - RANGE(range,pvp->memBase[j], - pvp->memBase[j] + (1 << pvp->size[j]) - 1, - ResExcMemBlock); + } else if (pvp->memBase[j]) { + PV_M_RANGE(range,pvp,j,ResExcMemBlock); own = xf86AddResToList(own,&range,-1); } } @@ -1702,10 +1788,8 @@ ValidatePci(void) xf86PrintResList(3,own); #endif if (pvp->ioBase[i]) { - RANGE(range,pvp->ioBase[i],/*@@@*/ - pvp->ioBase[i] + (1 << pvp->size[i]) - 1, - ResExcIoBlock); - if (isSubsetOf(range,res_m_io) + PV_I_RANGE(range,pvp,i,ResExcIoBlock); + if (xf86IsSubsetOf(range,res_m_io) && ! ChkConflict(&range,own,SETUP) && ! ChkConflict(&range,avoid,SETUP) && ! ChkConflict(&range,NonSys,SETUP)) @@ -1718,17 +1802,15 @@ ValidatePci(void) #endif fixPciResource(i, 0, pvp, range.type); } else if (pvp->memBase[i]) { - RANGE(range,pvp->memBase[i],/*@@@*/ - pvp->memBase[i] + (1 << pvp->size[i]) - 1, - ResExcMemBlock); + PV_M_RANGE(range,pvp,i,ResExcMemBlock); if (pvp->type[i] & PCI_MAP_MEMORY_CACHABLE) { - if (isSubsetOf(range,res_mp) + if (xf86IsSubsetOf(range,res_mp) && ! ChkConflict(&range,own,SETUP) && ! ChkConflict(&range,avoid,SETUP) && ! ChkConflict(&range,NonSys,SETUP)) continue; } - if (isSubsetOf(range,res_m_io) + if (xf86IsSubsetOf(range,res_m_io) && ! ChkConflict(&range,own,SETUP) && ! ChkConflict(&range,avoid,SETUP) && ! ChkConflict(&range,NonSys,SETUP)) @@ -1778,22 +1860,16 @@ GetImplicitPciResources(int entityIndex) for (i = 0; i < 6; i++) { if (pvp->ioBase[i]) { list = xnfrealloc(list,sizeof(resRange) * (++num)); - RANGE(list[num - 1],pvp->ioBase[i],/*@@@*/ - pvp->ioBase[i] + (1 << pvp->size[i]) - 1, - ResShrIoBlock | ResBios); + PV_I_RANGE(list[num - 1],pvp,i,ResShrIoBlock | ResBios); } else if (pvp->memBase[i]) { list = xnfrealloc(list,sizeof(resRange) * (++num)); - RANGE(list[num - 1],pvp->memBase[i],/*@@@*/ - pvp->memBase[i] + (1 << pvp->size[i]) - 1, - ResShrMemBlock | ResBios); + PV_M_RANGE(list[num - 1],pvp,i,ResShrMemBlock | ResBios); } } #if 0 if (pvp->biosBase) { list = xnfrealloc(list,sizeof(resRange) * (++num)); - RANGE(list[num - 1], pvp->biosBase, - pvp->biosBase + (1 << pvp->biosSize) - 1, - ResShrMemBlock | ResBios); + PV_B_RANGE(list[num - 1],pvp,ResShrMemBlock | ResBios); } #endif list = xnfrealloc(list,sizeof(resRange) * (++num)); @@ -1828,7 +1904,10 @@ initPciState(void) pcaccp->funcnum = pvp->func; pcaccp->arg.tag = pciTag(pvp->bus, pvp->device, pvp->func); pcaccp->arg.func = - (SetBitsProcPtr)pciLongFunc(pcaccp->arg.tag,SET_BITS); +#ifdef notanymore + (SetBitsProcPtr)pciLongFunc(pcaccp->arg.tag,SET_BITS); +#endif + (WriteProcPtr)pciLongFunc(pcaccp->arg.tag,WRITE); pcaccp->ioAccess.AccessDisable = pciIoAccessDisable; pcaccp->ioAccess.AccessEnable = pciIoAccessEnable; pcaccp->ioAccess.arg = &pcaccp->arg; @@ -1843,6 +1922,7 @@ initPciState(void) else pcaccp->ctrl = FALSE; savePciState(pcaccp->arg.tag, &pcaccp->save); + pcaccp->arg.ctrl = pcaccp->save.command; } } @@ -1949,6 +2029,7 @@ PciStateEnter(void) continue; savePciState(paccp->arg.tag, &paccp->save); restorePciState(paccp->arg.tag, &paccp->restore); + paccp->arg.ctrl = paccp->restore.command; } } @@ -2380,6 +2461,23 @@ xf86GetPciInfoForEntity(int entityIndex) return NULL; } +int +xf86GetEntityForPciInfo(pciVideoPtr pvp) +{ + int i; + + for (i = 0; i < xf86NumEntities; i++) { + EntityPtr p = xf86Entities[i]; + if (p->busType != BUS_PCI) continue; + + if (p->pciBusId.bus == pvp->bus && + p->pciBusId.device == pvp->device && + p->pciBusId.func == pvp->func) + return i; + } + return -1; +} + /* * xf86CheckPciMemBase() checks that the memory base value matches one of the * PCI base address register values for the given PCI device. @@ -2416,3 +2514,215 @@ xf86CheckPciSlot(int bus, int device, int func) return TRUE; } + +CARD32 (*FindPCIClassInCardList)( + unsigned short vendorID, unsigned short subsystemID); +CARD32 (*FindPCIClassInDeviceList)( + unsigned short vendorID, unsigned short deviceID); + +static void +getPciClassFlags(pciConfigPtr *pcrpp) +{ + pciConfigPtr pcrp; + int i = 0; +#ifdef XFree86LOADER + pointer scan_mod = NULL; +#endif + + if (!pcrpp) + return; + +#ifdef XFree86LOADER + if (!(scan_mod = xf86LoadOneModule("scanpci", NULL))) { + xf86Msg(X_WARNING,"Could not load scanpci module\n"); + return; + } else { + FindPCIClassInCardList = (CARD32 (*)(unsigned short, unsigned short)) + LoaderSymbol("xf86FindPCIClassInCardList"); + FindPCIClassInDeviceList = (CARD32 (*)(unsigned short, unsigned short)) + LoaderSymbol("xf86FindPCIClassInDeviceList"); + } +#else + FindPCIClassInCardList = xf86FindPCIClassInCardList; + FindPCIClassInDeviceList = xf86FindPCIClassInDeviceList; +#endif + + while ((pcrp = pcrpp[i])) { + if (!(pcrp->listed_class = FindPCIClassInCardList( + pcrp->pci_subsys_vendor,pcrp->pci_subsys_card))) + pcrp->listed_class = FindPCIClassInDeviceList( + pcrp->pci_vendor,pcrp->pci_device); + i++; + } + +#ifdef XFree86LOADER + UnloadModule(scan_mod); +#endif +} + +/* + * xf86FindPciVendorDevice() xf86FindPciClass(): These functions + * are ment to be used by the pci bios emulation. Some bioses + * need to see if there are _other_ chips of the same type around + * so by setting pvp_exclude one pci device can be explicitely + * _excluded if required. + */ +pciVideoPtr +xf86FindPciDeviceVendor(CARD16 vendorID, CARD16 deviceID, + char n, pciVideoPtr pvp_exclude) +{ + pciVideoPtr pvp, *ppvp; + n++; + + for (ppvp = xf86PciVideoInfo, pvp =*ppvp; pvp ; pvp = *(++ppvp)) { + if (pvp == pvp_exclude) continue; + if ((pvp->vendor == vendorID) && (pvp->chipType == deviceID)) { + if (!(--n)) break; + } + } + return pvp; +} + +pciVideoPtr +xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class, + char n, pciVideoPtr pvp_exclude) +{ + pciVideoPtr pvp, *ppvp; + n++; + + for (ppvp = xf86PciVideoInfo, pvp =*ppvp; pvp ; pvp = *(++ppvp)) { + if (pvp == pvp_exclude) continue; + if ((pvp->interface == intf) && (pvp->subclass == subClass) + && (pvp->class == class)) { + if (!(--n)) break; + } + } + return pvp; +} + +/* + * This attempts to detect a multi-device card and set up a list + * of pci tags of the devices of this card. On some of these + * cards the BIOS is not visible from all chipsets. We therefore + * need to us the bios from a chipset where it is visible. + * We do the following heuristics: + * If we detect only identical pci devices on a bus we assume it's + * a multi-device card. This assumption isn't true alwaus, however. + * One might just use identical cards on a bus. We therefore don't + * detect this situation when we set up the PCI video info. Instead + * we wait until an attempt to read the BIOS fails. + */ +int +pciTestMultiDeviceCard(int bus, int dev, int func, PCITAG** pTag) +{ + pciConfigPtr *ppcrp = xf86PciInfo; + pciConfigPtr pcrp = NULL; + int i,j; + Bool multicard = FALSE; + Bool multifunc = FALSE; + char str[256]; + char *str1; + + str1 = str; + if (!pTag) + return 0; + + *pTag = NULL; + + for (i=0; i < 8; i++) { + j = 0; + + while (ppcrp[j]) { + if (ppcrp[j]->busnum == bus && ppcrp[j]->funcnum == i) { + pcrp = ppcrp[j]; + break; + } + j++; + } + + if (!pcrp) return 0; + /* + * we check all functions here: since multifunc devices need + * to implement func 0 we catch all devices on the bus when + * i = 0 + */ + if (pcrp->pci_header_type &0x80) + multifunc = TRUE; + + ppcrp = xf86PciInfo; + + while (ppcrp[j]) { + if (ppcrp[j]->busnum == bus && ppcrp[j]->funcnum == i + && ppcrp[j]->devnum != pcrp->devnum) { + /* don't test subsys ID here. It might be set by POST + - however some cars might not have been POSTed */ + if (ppcrp[j]->pci_device_vendor != pcrp->pci_device_vendor + || ppcrp[j]->pci_class_revision != pcrp->pci_class_revision + || ppcrp[j]->pci_header_type != pcrp->pci_header_type ) + return 0; + else + multicard = TRUE; + } + j++; + } + if (!multifunc) + break; + } + + if (!multicard) + return 0; + + j = 0; + i = 0; + while (ppcrp[i]) { + if (ppcrp[i]->busnum == bus && ppcrp[i]->funcnum == func) { + str1 += sprintf(str1,"[%x:%x:%x]",ppcrp[i]->busnum, + ppcrp[i]->devnum,ppcrp[i]->funcnum); + *pTag = xnfrealloc(*pTag,sizeof(PCITAG) * (j + 1)); + (*pTag)[j++] = pciTag(ppcrp[i]->busnum, + ppcrp[i]->devnum,ppcrp[i]->funcnum); + } + i++; + } + xf86MsgVerb(X_INFO,3,"Multi Device Card detected: %s\n",str); + return j; +} + +void +pciConvertRange2Host(int entityIndex, resRange *pRange) +{ + PCITAG tag = TAG(xf86GetPciInfoForEntity(entityIndex)); + + switch(pRange->type & ResPhysMask) { + case ResMem: + switch(pRange->type & ResExtMask) { + case ResBlock: + pRange->rBegin = pciBusAddrToHostAddr(tag,PCI_MEM, pRange->rBegin); + pRange->rEnd = pciBusAddrToHostAddr(tag,PCI_MEM, pRange->rEnd); + break; + case ResSparse: + pRange->rBase = pciBusAddrToHostAddr(tag,PCI_MEM_SPARSE_BASE, + pRange->rBegin); + pRange->rMask = pciBusAddrToHostAddr(tag,PCI_MEM_SPARSE_MASK, + pRange->rEnd); + break; + } + break; + case ResIo: + switch(pRange->type & ResExtMask) { + case ResBlock: + pRange->rBegin = pciBusAddrToHostAddr(tag,PCI_IO, pRange->rBegin); + pRange->rEnd = pciBusAddrToHostAddr(tag,PCI_IO, pRange->rEnd); + break; + case ResSparse: + pRange->rBase = pciBusAddrToHostAddr(tag,PCI_IO_SPARSE_BASE + , pRange->rBegin); + pRange->rMask = pciBusAddrToHostAddr(tag,PCI_IO_SPARSE_MASK + , pRange->rEnd); + break; + } + break; + } +} + + diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h index ca5fe747a..19434edfa 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h,v 3.2 1999/12/06 03:52:41 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.h,v 3.4 2000/02/12 23:59:10 eich Exp $ */ #ifndef _XF86_PCI_BUS_H #define _XF86_PCI_BUS_H @@ -12,10 +12,15 @@ typedef struct { } pciSave, *pciSavePtr; typedef void (*SetBitsProcPtr)(PCITAG, int, CARD32, CARD32); +typedef void (*WriteProcPtr)(PCITAG, int, CARD32); typedef struct { PCITAG tag; +#ifdef notanymore SetBitsProcPtr func; +#endif + WriteProcPtr func; + CARD32 ctrl; } pciArg; typedef struct pci_io { @@ -51,6 +56,8 @@ void PciBusStateEnter(void); void PciStateLeave(void); void PciBusStateLeave(void); resPtr ResourceBrokerInitPci(resPtr *osRes); +void pciConvertRange2Host(int entityIndex, resRange *pRange); +void isaConvertRange2Host(resRange *pRange); extern pciAccPtr * xf86PciAccInfo; diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86str.h b/xc/programs/Xserver/hw/xfree86/common/xf86str.h index 3cee2acfe..f1c6dbb0b 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86str.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86str.h @@ -1,7 +1,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.58 1999/12/13 01:39:47 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.66 2000/02/12 23:59:10 eich Exp $ */ /* - * Copyright (c) 1997 by The XFree86 Project, Inc. + * Copyright (c) 1997-2000 by The XFree86 Project, Inc. */ /* @@ -15,7 +15,9 @@ #include "misc.h" #include "input.h" #include "scrnintstr.h" +#include "pixmapstr.h" #include "xf86Module.h" +#include "xf86Opt.h" /* * memType is of the size of the addressable memory (machine size) @@ -212,6 +214,7 @@ typedef struct _DriverRec { char * driverName; void (*Identify)(int flags); Bool (*Probe)(struct _DriverRec *drv, int flags); + OptionInfoPtr (*AvailableOptions)(int chipid, int bustype); pointer module; int refCount; } DriverRec, *DriverPtr; @@ -312,6 +315,7 @@ typedef struct { pointer thisCard; Bool validSize; Bool validate; + CARD32 listed_class; } pciVideoRec, *pciVideoPtr; typedef struct { @@ -433,12 +437,31 @@ typedef enum { Pix24Use32 } Pix24Flags; -/* flags for SaveRestoreImage */ +/* Power management events: so far we only support APM */ + +typedef enum { + XF86_APM_UNKNOWN = -1, + XF86_APM_SYS_STANDBY, + XF86_APM_SYS_SUSPEND, + XF86_APM_CRITICAL_SUSPEND, + XF86_APM_USER_STANDBY, + XF86_APM_USER_SUSPEND, + XF86_APM_STANDBY_RESUME, + XF86_APM_NORMAL_RESUME, + XF86_APM_CRITICAL_RESUME, + XF86_APM_LOW_BATTERY, + XF86_APM_POWER_STATUS_CHANGE, + XF86_APM_UPDATE_TIME, + XF86_APM_CAPABILITY_CHANGED, + XF86_APM_STANDBY_FAILED, + XF86_APM_SUSPEND_FAILED +} pmEvent; + typedef enum { - SaveImage, - RestoreImage, - FreeImage -} SaveRestoreFlags; + PM_WAIT, + PM_CONTINUE, + PM_NONE +} pmWait; /* * The IO access enabler struct. This contains the address for @@ -500,6 +523,8 @@ typedef struct _CurrAccRec { #define ResBios 0x4000 #define ResMiscMask 0xF000 +#define ResBus 0x10000 + #define ResEnd ResNone #define ResExcMemBlock (ResMem | ResExclusive | ResBlock) @@ -592,6 +617,17 @@ typedef enum { OPERATING } xf86State; +typedef enum { + NOTIFY_SETUP_TRANSITION, + NOTIFY_SETUP, + NOTIFY_OPERATING, + NOTIFY_OPERATING_TRANSITION, + NOTIFY_ENABLE, + NOTIFY_ENTER, + NOTIFY_LEAVE +} xf86NotifyState; + +typedef void (*xf86StateChangeNotificationCallbackFunc)(xf86NotifyState state,pointer); /* DGA */ @@ -632,9 +668,11 @@ typedef struct { /* * Flags for driver Probe() functions. */ -#define PROBE_DEFAULT 0x00 -#define PROBE_DETECT 0x01 -#define PROBE_TRYHARD 0x02 +#define PROBE_DEFAULT 0x00 +#define PROBE_DETECTPCI 0x01 +#define PROBE_DETECTISA 0x02 +#define PROBE_DETECTFBDEV 0x04 +#define PROBE_DETECT (PROBE_DETECTPCI | PROBE_DETECTISA | PROBE_DETECTFBDEV) /* * ScrnInfoRec @@ -747,8 +785,8 @@ typedef struct _ScrnInfoRec { /* Allow screens to be enabled/disabled individually */ Bool vtSema; - PixmapPtr ppix; /* Previous screen root pixmap - * while switched out */ + DevUnion pixmapPrivate; /* saved devPrivate from pixmap */ + /* hw cursor moves at SIGIO time */ Bool silkenMouse; @@ -781,12 +819,13 @@ typedef struct _ScrnInfoRec { void (*FreeScreen)(int scrnIndex, int flags); int (*ValidMode)(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); - Bool (*SaveRestoreImage)(int scrnIndex, - SaveRestoreFlags what); + void (*EnableDisableFBAccess)(int scrnIndex, Bool enable); int (*SetDGAMode)(int scrnIndex, int num, DGADevicePtr devRet); int (*ChangeGamma)(int scrnIndex, Gamma gamma); void (*PointerMoved)(int scrnIndex, int x, int y); + Bool (*PMEvent)(int scrnIndex, pmEvent event); + /* * This can be used when the minor ABI version is incremented. * The NUM_* parameter must be reduced appropriately to keep the @@ -836,7 +875,6 @@ typedef struct { const char * name; /* token name */ } SymTabRec, *SymTabPtr; - /* flags for xf86LookupMode */ typedef enum { LOOKUP_DEFAULT = 0, /* Use default mode lookup method */ diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xv.c b/xc/programs/Xserver/hw/xfree86/common/xf86xv.c index ecbaea0c9..b23513c11 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86xv.c +++ b/xc/programs/Xserver/hw/xfree86/common/xf86xv.c @@ -6,7 +6,7 @@ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.16 1999/12/17 02:45:37 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.18 2000/02/11 20:39:20 mvojkovi Exp $ */ #include "misc.h" #include "xf86.h" @@ -63,7 +63,8 @@ static int xf86XVQueryBestSize(ClientPtr, XvPortPtr, CARD8, static int xf86XVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16, - XvImagePtr, char*, Bool, CARD16, CARD16); + XvImagePtr, unsigned char*, Bool, + CARD16, CARD16); static int xf86XVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr, CARD16*, CARD16*, int*, int*); @@ -78,6 +79,7 @@ static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy); static Bool xf86XVEnterVT(int, int); static void xf86XVLeaveVT(int, int); +static void xf86XVAdjustFrame(int index, int x, int y, int flags); /* misc */ @@ -184,6 +186,7 @@ xf86XVScreenInit( ScreenPriv->DestroyWindow = pScreen->DestroyWindow; ScreenPriv->EnterVT = pScrn->EnterVT; ScreenPriv->LeaveVT = pScrn->LeaveVT; + ScreenPriv->AdjustFrame = pScrn->AdjustFrame; pScreen->ClipNotify = xf86XVClipNotify; @@ -191,6 +194,7 @@ xf86XVScreenInit( pScreen->DestroyWindow = xf86XVDestroyWindow; pScrn->EnterVT = xf86XVEnterVT; pScrn->LeaveVT = xf86XVLeaveVT; + pScrn->AdjustFrame = xf86XVAdjustFrame; if(!xf86XVInitAdaptors(pScreen, adaptors, num)) return FALSE; @@ -463,6 +467,7 @@ xf86XVInitAdaptors( adaptorPriv->QueryBestSize = adaptorPtr->QueryBestSize; adaptorPriv->QueryImageAttributes = adaptorPtr->QueryImageAttributes; adaptorPriv->PutImage = adaptorPtr->PutImage; + adaptorPriv->ReputImage = adaptorPtr->ReputImage; pa->devPriv.ptr = (pointer)adaptorPriv; @@ -759,6 +764,91 @@ CLIP_VIDEO_BAILOUT: } static int +xf86XVReputImage(XvPortRecPrivatePtr portPriv) +{ + RegionRec WinRegion; + RegionRec ClipRegion; + BoxRec WinBox; + ScreenPtr pScreen = portPriv->pDraw->pScreen; + int ret = Success; + Bool clippedAway = FALSE; + + xf86XVUpdateCompositeClip(portPriv); + + /* translate the video region to the screen */ + WinBox.x1 = portPriv->pDraw->x + portPriv->drw_x; + WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; + WinBox.x2 = WinBox.x1 + portPriv->drw_w; + WinBox.y2 = WinBox.y1 + portPriv->drw_h; + + /* clip to the window composite clip */ + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); + REGION_INIT(pScreen, &ClipRegion, NullBox, 1); + REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + + /* clip and translate to the viewport */ + if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { + RegionRec VPReg; + BoxRec VPBox; + + VPBox.x1 = portPriv->pScrn->frameX0; + VPBox.y1 = portPriv->pScrn->frameY0; + VPBox.x2 = portPriv->pScrn->frameX1; + VPBox.y2 = portPriv->pScrn->frameY1; + + REGION_INIT(pScreen, &VPReg, &VPBox, 1); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_UNINIT(pScreen, &VPReg); + } + + /* that's all if it's totally obscured */ + if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { + clippedAway = TRUE; + goto CLIP_VIDEO_BAILOUT; + } + + /* bailout if we have to clip but the hardware doesn't support it */ + if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { + BoxPtr clipBox = REGION_RECTS(&ClipRegion); + if( (REGION_NUM_RECTS(&ClipRegion) != 1) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + { + clippedAway = TRUE; + goto CLIP_VIDEO_BAILOUT; + } + } + + if(portPriv->AdaptorRec->flags & VIDEO_INVERT_CLIPLIST) { + REGION_SUBTRACT(pScreen, &ClipRegion, &WinRegion, &ClipRegion); + } + + ret = (*portPriv->AdaptorRec->ReputImage)(portPriv->pScrn, + WinBox.x1, WinBox.y1, + &ClipRegion, portPriv->DevPriv.ptr); + + portPriv->isOn = (ret == Success); + +CLIP_VIDEO_BAILOUT: + + if((clippedAway || (ret != Success)) && portPriv->isOn) { + (*portPriv->AdaptorRec->StopVideo)( + portPriv->pScrn, portPriv->DevPriv.ptr, FALSE); + portPriv->isOn = FALSE; + } + + /* This clip was copied and only good for one shot */ + if(!portPriv->FreeCompositeClip) + portPriv->pCompositeClip = NULL; + + REGION_UNINIT(pScreen, &WinRegion); + REGION_UNINIT(pScreen, &ClipRegion); + + return ret; +} + + +static int xf86XVReputAllVideo(WindowPtr pWin, pointer data) { XF86XVWindowPtr WinPriv = @@ -881,6 +971,7 @@ xf86XVDestroyWindow(WindowPtr pWin) } + static void xf86XVClipNotify(WindowPtr pWin, int dx, int dy) { @@ -900,18 +991,28 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy) pPriv->pCompositeClip = NULL; if(!pPriv->type) { /* overlaid still/image */ - (*pPriv->AdaptorRec->StopVideo)( - pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); - - pPriv->pDraw = NULL; - if(!pPrev) - pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)(WinPriv->next); - else - pPrev->next = WinPriv->next; - tmp = WinPriv; - WinPriv = WinPriv->next; - xfree(tmp); - continue; + if ((pPriv->AdaptorRec->ReputImage) && + ((pWin->visibility == VisibilityUnobscured) || + (pWin->visibility == VisibilityPartiallyObscured))) + { + xf86XVReputImage(pPriv); + } + else { + (*pPriv->AdaptorRec->StopVideo)( + pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); + + pPriv->isOn = FALSE; + pPriv->pDraw = NULL; + if(!pPrev) + pWin->devPrivates[XF86XVWindowIndex].ptr = + (pointer)(WinPriv->next); + else + pPrev->next = WinPriv->next; + tmp = WinPriv; + WinPriv = WinPriv->next; + xfree(tmp); + continue; + } } else { if(pPriv->type == XvInputMask) xf86XVReputVideo(pPriv); @@ -950,6 +1051,7 @@ xf86XVCloseScreen(int i, ScreenPtr pScreen) pScrn->EnterVT = ScreenPriv->EnterVT; pScrn->LeaveVT = ScreenPriv->LeaveVT; + pScrn->AdjustFrame = ScreenPriv->AdjustFrame; for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { xf86XVFreeAdaptor(pa); @@ -1035,6 +1137,56 @@ xf86XVLeaveVT(int index, int flags) (*ScreenPriv->LeaveVT)(index, flags); } +static void +xf86XVAdjustFrame(int index, int x, int y, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[index]; + ScreenPtr pScreen = pScrn->pScreen; + XvScreenPtr pxvs = (XvScreenPtr)pScreen->devPrivates[XF86XvScreenIndex].ptr; + XF86XVScreenPtr ScreenPriv = (XF86XVScreenPtr)pxvs->devPriv.ptr; + WindowPtr pWin; + XvAdaptorPtr pa; + int c, i; + + if(ScreenPriv->AdjustFrame) { + pScrn->AdjustFrame = ScreenPriv->AdjustFrame; + (*pScrn->AdjustFrame)(index, x, y, flags); + pScrn->AdjustFrame = xf86XVAdjustFrame; + } + + for(c = pxvs->nAdaptors, pa = pxvs->pAdaptors; c > 0; c--, pa++) { + XvPortPtr pPort = pa->pPorts; + XvPortRecPrivatePtr pPriv; + + for(i = pa->nPorts; i > 0; i--, pPort++) { + pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; + + if(!pPriv->type && pPriv->isOn) { /* overlaid still/image */ + + if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) + REGION_DESTROY(pScreen, pPriv->pCompositeClip); + + pPriv->pCompositeClip = NULL; + + pWin = (WindowPtr)pPriv->pDraw; + + if ((pPriv->AdaptorRec->ReputImage) && + ((pWin->visibility == VisibilityUnobscured) || + (pWin->visibility == VisibilityPartiallyObscured))) + { + xf86XVReputImage(pPriv); + } else { + (*pPriv->AdaptorRec->StopVideo)( + pPriv->pScrn, pPriv->DevPriv.ptr, FALSE); + xf86XVRemovePortFromWindow(pWin, pPriv); + pPriv->isOn = FALSE; + continue; + } + } + } + } +} + /**** XvAdaptorRec fields ****/ @@ -1187,6 +1339,8 @@ xf86XVPutStill( xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv); portPriv->isOn = TRUE; portPriv->pDraw = pDraw; + portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; + portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; portPriv->type = 0; /* no mask means it's transient and should not be reput once it's removed */ } @@ -1405,7 +1559,7 @@ xf86XVPutImage( INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h, XvImagePtr format, - char* data, + unsigned char* data, Bool sync, CARD16 width, CARD16 height ){ @@ -1480,6 +1634,8 @@ xf86XVPutImage( xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv); portPriv->isOn = TRUE; portPriv->pDraw = pDraw; + portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; + portPriv->drw_w = drw_w; portPriv->drw_h = drw_h; portPriv->type = 0; /* no mask means it's transient and should not be reput once it's removed */ } diff --git a/xc/programs/Xserver/hw/xfree86/common/xf86xv.h b/xc/programs/Xserver/hw/xfree86/common/xf86xv.h index 362c2e01c..6e4590199 100644 --- a/xc/programs/Xserver/hw/xfree86/common/xf86xv.h +++ b/xc/programs/Xserver/hw/xfree86/common/xf86xv.h @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.8 1999/12/11 19:25:06 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.10 2000/02/11 20:39:20 mvojkovi Exp $ */ #ifndef _XVDIX_H_ #define _XVDIX_H_ @@ -16,7 +16,7 @@ typedef struct { int id; int type; int byte_order; - char guid[16]; + unsigned char guid[16]; int bits_per_pixel; int format; int num_planes; @@ -69,10 +69,12 @@ typedef void (* QueryBestSizeFuncPtr)(ScrnInfoPtr pScrn, Bool motion, typedef int (* PutImageFuncPtr)( ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x, short drw_y, short src_w, short src_h, short drw_w, short drw_h, - int image, char* buf, short width, short height, Bool sync, + int image, unsigned char* buf, short width, short height, Bool sync, RegionPtr clipBoxes, pointer data ); +typedef int (* ReputImageFuncPtr)( ScrnInfoPtr pScrn, short drw_x, short drw_y, + RegionPtr clipBoxes, pointer data ); typedef int (*QueryImageAttributesFuncPtr)(ScrnInfoPtr pScrn, - int image, short *width, short *height, + int image, unsigned short *width, unsigned short *height, int *pitches, int *offsets); /*** this is what the driver needs to fill out ***/ @@ -119,6 +121,7 @@ typedef struct { GetPortAttributeFuncPtr GetPortAttribute; QueryBestSizeFuncPtr QueryBestSize; PutImageFuncPtr PutImage; + ReputImageFuncPtr ReputImage; QueryImageAttributesFuncPtr QueryImageAttributes; } XF86VideoAdaptorRec, *XF86VideoAdaptorPtr; @@ -149,6 +152,7 @@ typedef struct { CreateWindowProcPtr CreateWindow; DestroyWindowProcPtr DestroyWindow; ClipNotifyProcPtr ClipNotify; + void (*AdjustFrame)(int, int, int, int); Bool (*EnterVT)(int, int); void (*LeaveVT)(int, int); } XF86XVScreenRec, *XF86XVScreenPtr; @@ -164,6 +168,7 @@ typedef struct { GetPortAttributeFuncPtr GetPortAttribute; QueryBestSizeFuncPtr QueryBestSize; PutImageFuncPtr PutImage; + ReputImageFuncPtr ReputImage; QueryImageAttributesFuncPtr QueryImageAttributes; } XvAdaptorRecPrivate, *XvAdaptorRecPrivatePtr; |