diff options
author | Luc Verhaegen <libv@skynet.be> | 2006-04-15 05:23:36 +0200 |
---|---|---|
committer | Luc Verhaegen <libv@skynet.be> | 2006-04-15 05:23:36 +0200 |
commit | a5b8c226cdd69285043ed0362ff6b5262d6025b0 (patch) | |
tree | 75c6be23086e70306a15f780f0699f87e78cb161 | |
parent | dd7983dc10bd18c6e7a54bfca1be01a19435a16b (diff) |
Start using a cleaned up version of ATIClaimResources again. This dropped off
when i made the leap to clean Probe. Proper fixed resource handling needs to be
moved into Probe again though.
-rw-r--r-- | ChangeLog | 15 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/atibus.c | 143 | ||||
-rw-r--r-- | src/atibus.h | 57 | ||||
-rw-r--r-- | src/atidri.c | 1 | ||||
-rw-r--r-- | src/atimach64.c | 1 | ||||
-rw-r--r-- | src/atipreinit.c | 83 | ||||
-rw-r--r-- | src/atiscreen.c | 1 | ||||
-rw-r--r-- | src/atistruct.h | 10 |
9 files changed, 85 insertions, 229 deletions
@@ -1,3 +1,18 @@ +2006-04-15 Luc Verhaegen <libv@skynet.be> + + * src/Makefile.am: + * src/atibus.c: (ATIClaimResources): + * src/atibus.h: + * src/atidri.c: + * src/atimach64.c: + * src/atipreinit.c: (ATIClaimResources), (ATIPreInit): + * src/atiscreen.c: + * src/atistruct.h: + + Start using a cleaned up version of ATIClaimResources again. + This dropped off when i made the leap to clean Probe. Proper + fixed resource handling needs to be moved into Probe again though. + 2006-04-14 Luc Verhaegen <libv@skynet.be> * src/ati.h: diff --git a/src/Makefile.am b/src/Makefile.am index 12c415e..298060f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -44,7 +44,7 @@ mach64_drv_la_LTLIBRARIES = mach64_drv.la mach64_drv_la_LDFLAGS = -module -avoid-version mach64_drv_ladir = @moduledir@/drivers mach64_drv_la_SOURCES = \ - atibus.c atioption.c atividmem.c atiaccel.c atiadjust.c \ + atioption.c atividmem.c atiaccel.c atiadjust.c \ atiaudio.c aticlock.c aticonfig.c aticonsole.c aticursor.c atidac.c \ atidecoder.c atidsp.c atii2c.c atilock.c atimach64.c atimach64accel.c \ atimach64cursor.c atimach64i2c.c atimach64io.c atimach64xv.c \ @@ -57,7 +57,6 @@ EXTRA_DIST = \ atiadjust.h \ atiaudio.h \ atibank.h \ - atibus.h \ atichip.h \ aticlock.h \ aticonfig.h \ diff --git a/src/atibus.c b/src/atibus.c deleted file mode 100644 index 5ae8ebc..0000000 --- a/src/atibus.c +++ /dev/null @@ -1,143 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c,v 1.18 2003/01/22 21:44:10 tsi Exp $ */ -/* - * Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org - * - * 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 Marc Aurele La France not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Marc Aurele La France makes no representations - * about the suitability of this software for any purpose. It is provided - * "as-is" without express or implied warranty. - * - * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO - * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "ati.h" -#include <string.h> - -#include "atibus.h" -#include "atichip.h" -#include "atiio.h" -#include "atistruct.h" -#include "ativersion.h" - -/* - * Definitions related to an adapter's system bus interface. - */ - -const char *ATIBusNames[] = -{ - "16-Bit ISA", - "EISA", - "16-Bit MicroChannel", - "32-Bit MicroChannel", - "386SX Local Bus", - "386DX Local Bus", - "VESA Local Bus", - "PCI", - "AGP" -}; - -/* - * ATIClaimResources -- - * - * This function registers most of the bus resources used by an adapter. The - * exceptions are PCI-configured resources and non-PCI non-AGP linear - * apertures, both of which are registered by ATIPreInit(). This function also - * attempts to register unshareable resources for inactive PCI adapters, - * whether or not they are relocatable. - */ -void -ATIClaimResources -( - ATIPtr pATI, - Bool Active -) -{ - resPtr pResources; - -#ifndef AVOID_CPIO - - resRange Resources[2] = {{0, 0, 0}, _END}; - - /* Claim VGA and VGAWonder resources */ - if ((pATI->IsVGA) && (Active || !pATI->SharedVGA)) { - /* - * 18800-x's are the only ATI controllers that decode all ISA aliases - * of VGA and VGA Wonder I/O ports. Other x8800's do not decode >any< - * VGA aliases, but do decode VGA Wonder aliases whose most significant - * nibble is zero. - */ - xf86ClaimFixedResources(pATI->SharedVGA ? resVgaShared : resVgaExclusive, - pATI->iEntity); - - if (pATI->CPIO_VGAWonder) - { - if (pATI->SharedVGA) - Resources[0].type = ResShrIoSparse | ResBus; - else - Resources[0].type = ResExcIoSparse | ResBus; - Resources[0].rBase = pATI->CPIO_VGAWonder; - Resources[0].rMask = 0xF3FEU; - - xf86ClaimFixedResources(Resources, pATI->iEntity); - - (void)memcpy(pATI->VGAWonderResources, - Resources, SizeOf(Resources)); - } - } - - if (!Active && pATI->SharedAccelerator) - return; - - /* Claim Mach64 sparse I/O resources */ - if (pATI->CPIODecoding == SPARSE_IO) { - if (pATI->SharedAccelerator) - Resources[0].type = ResShrIoSparse | ResBus; - else - Resources[0].type = ResExcIoSparse | ResBus; - Resources[0].rBase = pATI->CPIOBase; - Resources[0].rMask = 0x03FCU; - - xf86ClaimFixedResources(Resources, pATI->iEntity); - } - - if (Active) - return; - -#else /* AVOID_CPIO */ - - if (pATI->SharedAccelerator) - return; - -#endif /* AVOID_CPIO */ - - /* Register unshared relocatable resources for inactive adapters */ - do - { - pResources = xf86RegisterResources(pATI->iEntity, NULL, ResExclusive); - if (!pResources) - return; - - pResources = xf86ReallocatePciResources(pATI->iEntity, pResources); - } while (!pResources); - - xf86Msg(X_WARNING, - ATI_NAME ": Unable to register the following resources for inactive" - " adapter:\n"); - xf86PrintResList(1, pResources); - xf86FreeResList(pResources); -} diff --git a/src/atibus.h b/src/atibus.h deleted file mode 100644 index 63b74af..0000000 --- a/src/atibus.h +++ /dev/null @@ -1,57 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h,v 1.11 2003/01/01 19:16:30 tsi Exp $ */ -/* - * Copyright 1997 through 2004 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org - * - * 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 Marc Aurele La France not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Marc Aurele La France makes no representations - * about the suitability of this software for any purpose. It is provided - * "as-is" without express or implied warranty. - * - * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO - * EVENT SHALL MARC AURELE LA FRANCE 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. - */ - -#ifndef ___ATIBUS_H___ - -#if !defined(___ATI_H___) && defined(XFree86Module) -# error missing #include "ati.h" before #include "atibus.h" -# undef XFree86Module -#endif - -#define ___ATIBUS_H___ 1 - -#include "atipriv.h" - -#include "xf86str.h" - -/* - * Definitions related to an adapter's system bus interface. - */ -typedef enum -{ - ATI_BUS_ISA = 0, - ATI_BUS_EISA, - ATI_BUS_MCA16, - ATI_BUS_MCA32, - ATI_BUS_SXLB, - ATI_BUS_DXLB, - ATI_BUS_VLB, - ATI_BUS_PCI, - ATI_BUS_AGP -} ATIBusType; - -extern const char *ATIBusNames[]; - -void ATIClaimResources(ATIPtr pATI, Bool Active); - -#endif /* ___ATIBUS_H___ */ diff --git a/src/atidri.c b/src/atidri.c index 075f7d2..b6b701e 100644 --- a/src/atidri.c +++ b/src/atidri.c @@ -37,7 +37,6 @@ #include <string.h> #include <stdio.h> -#include "atibus.h" #include "atidri.h" #include "atiregs.h" #include "atistruct.h" diff --git a/src/atimach64.c b/src/atimach64.c index 856cfbf..deaa81f 100644 --- a/src/atimach64.c +++ b/src/atimach64.c @@ -56,7 +56,6 @@ #include "ati.h" #include <string.h> -#include "atibus.h" #include "atichip.h" #include "atidac.h" #include "atimach64.h" diff --git a/src/atipreinit.c b/src/atipreinit.c index 61af217..d2402d5 100644 --- a/src/atipreinit.c +++ b/src/atipreinit.c @@ -35,7 +35,6 @@ #include "atiadjust.h" #include "atiaudio.h" -#include "atibus.h" #include "atichip.h" #include "aticonfig.h" #include "aticursor.h" @@ -273,6 +272,50 @@ ATIMach64Probe(ATIPtr pATI) return TRUE; } +/* + * ATIClaimResources -- + * + * This function registers most of the bus resources used by an adapter. The + * exceptions are PCI-configured resources and non-PCI non-AGP linear + * apertures, both of which are registered by ATIPreInit(). This function also + * attempts to register unshareable resources for inactive PCI adapters, + * whether or not they are relocatable. + */ +static void +ATIClaimResources(ATIPtr pATI) +{ + /* Claim VGA and VGAWonder resources */ + if (pATI->IsVGA) { + /* + * 18800-x's are the only ATI controllers that decode all ISA aliases + * of VGA and VGA Wonder I/O ports. Other x8800's do not decode >any< + * VGA aliases, but do decode VGA Wonder aliases whose most significant + * nibble is zero. + */ + xf86ClaimFixedResources(resVgaShared, pATI->iEntity); + + if (pATI->CPIO_VGAWonder) { + resRange Resources[2] = {{0, 0, 0}, _END}; + Resources[0].type = ResShrIoSparse | ResBus; + Resources[0].rBase = pATI->CPIO_VGAWonder; + Resources[0].rMask = 0xF3FEU; + + xf86ClaimFixedResources(Resources, pATI->iEntity); + + (void)memcpy(pATI->VGAWonderResources, Resources, SizeOf(Resources)); + } + } + + /* Claim Mach64 sparse I/O resources */ + if (pATI->CPIODecoding == SPARSE_IO) { + resRange Resources[2] = {{0, 0, 0}, _END}; + Resources[0].type = ResShrIoSparse | ResBus; + Resources[0].rBase = pATI->CPIOBase; + Resources[0].rMask = 0x03FCU; + + xf86ClaimFixedResources(Resources, pATI->iEntity); + } +} #endif /* AVOID_CPIO */ /* @@ -894,8 +937,6 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) pATI->Chip = pEntity->chipset; Mach64ChipIDInfo(pATI); - pATI->SharedAccelerator = TRUE; - /* block IO? */ if (pATI->PCIInfo->size[1]) { pATI->CPIOBase = pATI->PCIInfo->ioBase[1]; @@ -920,11 +961,13 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) return FALSE; } +#ifndef AVOID_CPIO + ATIClaimResources(pATI); +#endif + if (!pResources) - pResources = xf86RegisterResources(pATI->iEntity, NULL, - pATI->SharedAccelerator ? ResShared : ResExclusive); - if (pResources) - { + pResources = xf86RegisterResources(pATI->iEntity, NULL, ResShared); + if (pResources) { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, "Unable to register the following bus resources:\n"); xf86PrintResList(0, pResources); @@ -932,6 +975,8 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) return FALSE; } + xf86PrintResList(3, pResources); + ConfiguredMonitor = NULL; (void)memset(BIOS, 0, SizeOf(BIOS)); @@ -1316,24 +1361,14 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) /* Report what was found */ xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, - "%s graphics controller detected.\n", - Mach64ChipsetString(pScreenInfo)); - - Message = Buffer + snprintf(Buffer, SizeOf(Buffer), - "%s bus interface detected", - ATIBusNames[pATI->BusType]); -#ifndef AVOID_CPIO - - Message += snprintf(Message, Buffer + SizeOf(Buffer) - Message, - "; %s I/O base is 0x%04lX", - (pATI->CPIODecoding == SPARSE_IO) ? "sparse" : "block", - pATI->CPIOBase); - -#endif /* AVOID_CPIO */ - - xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "%s.\n", Buffer); + "%s graphics controller on %s Bus detected.\n", + Mach64ChipsetString(pScreenInfo), + (pATI->BusType == ATI_BUS_AGP) ? "AGP" : "PCI"); #ifndef AVOID_CPIO + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, "%s I/O base is 0x%04lX\n", + (pATI->CPIODecoding == SPARSE_IO) ? "sparse" : "block", + pATI->CPIOBase); if (pATI->CPIO_VGAWonder) xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, @@ -1475,6 +1510,8 @@ ATIPreInit(ScrnInfoPtr pScreenInfo, int flags) xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Using Mach64 accelerator CRTC.\n"); + + #ifndef AVOID_CPIO if (pATI->IsVGA) { diff --git a/src/atiscreen.c b/src/atiscreen.c index a9e65ad..5e324dd 100644 --- a/src/atiscreen.c +++ b/src/atiscreen.c @@ -33,7 +33,6 @@ #include "ati.h" #include <string.h> -#include "atibus.h" #include "atichip.h" #include "atiaccel.h" #include "aticonsole.h" diff --git a/src/atistruct.h b/src/atistruct.h index 72b6f99..abaa540 100644 --- a/src/atistruct.h +++ b/src/atistruct.h @@ -225,7 +225,6 @@ typedef struct _ATIRec */ pciVideoPtr PCIInfo; CARD8 BusType; - CARD8 SharedAccelerator; #ifndef AVOID_CPIO @@ -486,4 +485,13 @@ typedef struct _ATIRec #define ATIPTR(_p) ((ATIPtr)((_p)->driverPrivate)) +/* + * Definitions related to an adapter's system bus interface. + */ +typedef enum +{ + ATI_BUS_PCI, + ATI_BUS_AGP +} ATIBusType; + #endif /* ___ATISTRUCT_H___ */ |