From b574365fca954a999ebaeb7203d1e0ea6d99b3ea Mon Sep 17 00:00:00 2001 From: Aaron Plattner Date: Tue, 7 Oct 2008 13:09:11 -0700 Subject: [PATCH] Revert "Unexport (and unimplement) xf86SetAccessFuncs" for now. The nvidia driver currently uses these hooks to work around problems where RAC will disable access to the hardware at unexpected times. This change restores these hooks until we can come up with a better API for working around RAC. This reverts commit c1df4fbede8058c15ce3a5759a7758fecafbb9e7. --- hw/xfree86/common/xf86.h | 2 ++ hw/xfree86/common/xf86Bus.c | 18 ++++++++++++++++++ hw/xfree86/loader/xf86sym.c | 1 + 3 files changed, 21 insertions(+) diff --git a/hw/xfree86/common/xf86.h b/hw/xfree86/common/xf86.h index 03ea50e46..fbbfc7352 100644 --- a/hw/xfree86/common/xf86.h +++ b/hw/xfree86/common/xf86.h @@ -130,6 +130,8 @@ void xf86DeallocateResourcesForEntity(int entityIndex, unsigned long type); resPtr xf86RegisterResources(int entityIndex, resList list, unsigned long Access); Bool xf86CheckPciMemBase(struct pci_device * pPci, memType base); +void xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs, + xf86SetAccessFuncPtr oldFuncs); Bool xf86IsEntityPrimary(int entityIndex); resPtr xf86ReallocatePciResources(int entityIndex, resPtr pRes); resPtr xf86SetOperatingState(resList list, int entityIndex, int mask); diff --git a/hw/xfree86/common/xf86Bus.c b/hw/xfree86/common/xf86Bus.c index 3030a04ea..758560d14 100644 --- a/hw/xfree86/common/xf86Bus.c +++ b/hw/xfree86/common/xf86Bus.c @@ -819,6 +819,24 @@ xf86SetCurrentAccess(Bool Enable, ScrnInfoPtr pScrn) } } +_X_EXPORT void +xf86SetAccessFuncs(EntityInfoPtr pEnt, xf86SetAccessFuncPtr funcs, + xf86SetAccessFuncPtr oldFuncs) +{ + AccessFuncPtr rac; + + if (!xf86Entities[pEnt->index]->rac) + xf86Entities[pEnt->index]->rac = xnfcalloc(1,sizeof(AccessFuncRec)); + + rac = xf86Entities[pEnt->index]->rac; + + rac->mem_new = funcs->mem; + rac->io_new = funcs->io; + rac->io_mem_new = funcs->io_mem; + + rac->old = oldFuncs; +} + /* * Conflict checking */ diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 40b9ba4fb..494d2db8d 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -318,6 +318,7 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86GetPciInfoForEntity) SYMFUNC(xf86RegisterResources) SYMFUNC(xf86CheckPciMemBase) + SYMFUNC(xf86SetAccessFuncs) SYMFUNC(xf86IsEntityPrimary) SYMFUNC(xf86SetOperatingState) SYMFUNC(xf86FindScreenForEntity)