Bool CirMapMem(CirPtr pCir, int scrnIndex) { int mmioFlags; #ifdef CIR_DEBUG ErrorF("CirMapMem\n"); #endif /* * Map the frame buffer. */ if (pCir->FbMapSize) { pCir->FbBase = xf86MapPciMem(scrnIndex, VIDMEM_FRAMEBUFFER, pCir->PciTag, pCir->FbAddress, pCir->FbMapSize); if (pCir->FbBase == NULL) return FALSE; } #ifdef CIR_DEBUG ErrorF("CirMapMem pCir->FbBase=0x%08x\n", pCir->FbBase); #endif /* * Map IO registers to virtual address space */ if (pCir->IOAddress == 0) { pCir->IOBase = NULL; /* Until we are ready to use MMIO */ } else { mmioFlags = VIDMEM_MMIO; /* * For Alpha, we need to map SPARSE memory, since we need * byte/short access. Common-level will automatically use * sparse mapping for MMIO. */ pCir->IOBase = xf86MapPciMem(scrnIndex, mmioFlags, pCir->PciTag, pCir->IOAddress, pCir->IoMapSize); if (pCir->IOBase == NULL) return FALSE; } #ifdef CIR_DEBUG ErrorF("CirMapMem pCir->IOBase=0x%08x [length=%08x] from PCI=%08x\n", pCir->IOBase, pCir->IoMapSize, pCir->IOAddress); ErrorF("MMIO[GR31] = %2X\n", (int) ((volatile unsigned char*) pCir->IOBase)[0x40]); #endif return TRUE; }
Bool ASTMapMem(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); #ifndef XSERVER_LIBPCIACCESS pAST->FBVirtualAddr = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pAST->PciTag, pAST->FBPhysAddr, pAST->FbMapSize); #else { void** result = (void**)&pAST->FBVirtualAddr; int err = pci_device_map_range(pAST->PciInfo, pAST->FBPhysAddr, pAST->FbMapSize, PCI_DEV_MAP_FLAG_WRITABLE | PCI_DEV_MAP_FLAG_WRITE_COMBINE, result); if (err) return FALSE; } #endif if (!pAST->FBVirtualAddr) return FALSE; return TRUE; }
Bool ASTMapMMIO(ScrnInfoPtr pScrn) { ASTRecPtr pAST = ASTPTR(pScrn); #ifndef XSERVER_LIBPCIACCESS int mmioFlags; #if !defined(__alpha__) mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT; #else mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE; #endif pAST->MMIOVirtualAddr = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pAST->PciTag, pAST->MMIOPhysAddr, pAST->MMIOMapSize); #else { void** result = (void**)&pAST->MMIOVirtualAddr; int err = pci_device_map_range(pAST->PciInfo, pAST->MMIOPhysAddr, pAST->MMIOMapSize, PCI_DEV_MAP_FLAG_WRITABLE, result); if (err) return FALSE; } #endif if (!pAST->MMIOVirtualAddr) return FALSE; return TRUE; }
/* Mandatory */ static Bool VoodooPreInit(ScrnInfoPtr pScrn, int flags) { VoodooPtr pVoo; int i; ClockRangePtr clockRanges; MessageType from; int maxwidth; if (flags & PROBE_DETECT) return FALSE; /* Check the number of entities, and fail if it isn't one. */ if (pScrn->numEntities != 1) return FALSE; /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; if (!xf86SetDepthBpp(pScrn, 16, 0, 0, Support32bppFb)) { return FALSE; } /* Check that the returned depth is one we support */ switch (pScrn->depth) { case 16: case 24: case 32: break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given depth (%d) is not supported by this driver\n", pScrn->depth); return FALSE; } xf86PrintDepthBpp(pScrn); if(pScrn->depth == 32) pScrn->depth = 24; /* * This must happen after pScrn->display has been set because * xf86SetWeight references it. */ if (pScrn->depth > 8) { /* The defaults are OK for us */ rgb zeros = {0, 0, 0}; if (!xf86SetWeight(pScrn, zeros, zeros)) { return FALSE; } else { /* XXX check that weight returned is supported */ ; } } /* Set the default visual. */ if (!xf86SetDefaultVisual(pScrn, -1)) { return FALSE; } /* We don't support DirectColor at > 8bpp */ if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual" " (%s) is not supported at depth %d\n", xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); return FALSE; } /* Set default gamma */ { Gamma zeros = {0.0, 0.0, 0.0}; if (!xf86SetGamma(pScrn, zeros)) { return FALSE; } } /* We use a programmable clock */ pScrn->progClock = TRUE; /* Allocate the VoodooRec driverPrivate */ if (!VoodooGetRec(pScrn)) { return FALSE; } pVoo = VoodooPTR(pScrn); /* Get the entity */ pVoo->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); pVoo->PciInfo = xf86GetPciInfoForEntity(pVoo->pEnt->index); #ifndef XSERVER_LIBPCIACCESS pVoo->PciTag = pciTag(pVoo->PciInfo->bus, pVoo->PciInfo->device, pVoo->PciInfo->func); #endif /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); /* Process the options */ if (!(pVoo->Options = malloc(sizeof(VoodooOptions)))) return FALSE; memcpy(pVoo->Options, VoodooOptions, sizeof(VoodooOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pVoo->Options); /* Need to do rotation some day */ if(pVoo->pEnt->chipset == PCI_CHIP_VOODOO2) { pVoo->Voodoo2 = 1; /* We have 2D accel, interlace, double */ pVoo->Accel = 1; } else { pVoo->Voodoo2 = 0; pVoo->ShadowFB = 1; xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "Using shadowFB with Voodoo1 hardware.\n"); } from = X_DEFAULT; if (xf86ReturnOptValBool(pVoo->Options, OPTION_SHADOW_FB, FALSE)) { pVoo->ShadowFB = 1; pVoo->Accel = 0; } if (xf86ReturnOptValBool(pVoo->Options, OPTION_PASS_THROUGH, FALSE)) pVoo->PassThrough = 1; if (xf86ReturnOptValBool(pVoo->Options, OPTION_NOACCEL, FALSE)) { pVoo->ShadowFB = 1; pVoo->Accel = 0; } if(pScrn->depth == 24 && !pVoo->ShadowFB) { xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, "ShadowFB is required for 24/32bit modes.\n"); pVoo->ShadowFB = 1; pVoo->Accel = 0; } /* MMIO at 0 , FB at 4Mb, Texture at 8Mb */ pVoo->PhysBase = PCI_REGION_BASE(pVoo->PciInfo, 0, REGION_MEM) + 0x400000; #ifndef XSERVER_LIBPCIACCESS pVoo->MMIO = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVoo->PciTag, pVoo->PciInfo->memBase[0], 0x400000); pVoo->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVoo->PciTag, pVoo->PciInfo->memBase[0] + 0x400000, 0x400000); #else { void** result = (void**)&pVoo->MMIO; int err = pci_device_map_range(pVoo->PciInfo, PCI_REGION_BASE(pVoo->PciInfo, 0, REGION_MEM), 0x400000, PCI_DEV_MAP_FLAG_WRITABLE, result); if (err) return FALSE; } { void** result = (void**)&pVoo->FBBase; int err = pci_device_map_range(pVoo->PciInfo, PCI_REGION_BASE(pVoo->PciInfo, 0, REGION_MEM) + 0x400000, 0x400000, PCI_DEV_MAP_FLAG_WRITABLE| PCI_DEV_MAP_FLAG_WRITE_COMBINE, result); if (err) return FALSE; } #endif VoodooHardwareInit(pVoo); /* * If the user has specified the amount of memory in the XF86Config * file, we respect that setting. */ if (pVoo->pEnt->device->videoRam != 0) { pScrn->videoRam = pVoo->pEnt->device->videoRam; from = X_CONFIG; } else { pScrn->videoRam = VoodooMemorySize(pVoo) * 1024 ; /* Sizer reports Mbytes */ from = X_PROBED; } xf86DrvMsg(pScrn->scrnIndex, from, "Video RAM: %d kB\n", pScrn->videoRam); /* Set up clock ranges so that the xf86ValidateModes() function will not fail a mode because of the clock requirement (because we don't use the clock value anyway) */ clockRanges = xnfcalloc(sizeof(ClockRange), 1); clockRanges->next = NULL; clockRanges->minClock = 10000; clockRanges->maxClock = 250000; /* 250MHz DAC */ clockRanges->clockIndex = -1; /* programmable */ if(pVoo->Voodoo2) { clockRanges->interlaceAllowed = TRUE; clockRanges->doubleScanAllowed = TRUE; maxwidth = min(1024, pScrn->display->virtualX); } else { clockRanges->interlaceAllowed = FALSE; clockRanges->doubleScanAllowed = FALSE; maxwidth = min(800, pScrn->display->virtualX); } /* Select valid modes from those available */ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, NULL, 256, 2048, pScrn->bitsPerPixel, 128, 768, pScrn->display->virtualX, pScrn->display->virtualY, pScrn->videoRam * 1024, LOOKUP_BEST_REFRESH); if (i == -1) { VoodooFreeRec(pScrn); return FALSE; } /* Prune the modes marked as invalid */ xf86PruneDriverModes(pScrn); /* If no valid modes, return */ if (i == 0 || pScrn->modes == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); VoodooFreeRec(pScrn); return FALSE; } /* Set the current mode to the first in the list */ xf86SetCrtcForModes(pScrn, 0); pScrn->currentMode = pScrn->modes; /* Do some checking, we will not support a virtual framebuffer larger than the visible screen. */ if (pScrn->currentMode->HDisplay != pScrn->virtualX || pScrn->currentMode->VDisplay != pScrn->virtualY || pScrn->displayWidth != pScrn->virtualX) { /* FIXME: In this case we could use shadowfb and clip the drawing into the physical buffer */ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Virtual size doesn't equal display size. Forcing virtual size to equal display size.\n"); xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "(Virtual size: %dx%d, Display size: %dx%d)\n", pScrn->virtualX, pScrn->virtualY, pScrn->currentMode->HDisplay, pScrn->currentMode->VDisplay); /* I'm not entirely sure this is "legal" but I hope so. */ pScrn->virtualX = pScrn->currentMode->HDisplay; pScrn->virtualY = pScrn->currentMode->VDisplay; pScrn->displayWidth = pScrn->virtualX; } /* Print the list of modes being used */ xf86PrintModes(pScrn); /* Set display resolution */ xf86SetDpi(pScrn, 0, 0); /* Load fb */ if (xf86LoadSubModule(pScrn, "fb") == NULL) { VoodooFreeRec(pScrn); return FALSE; } if (!xf86LoadSubModule(pScrn, "xaa")) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Falling back to shadowfb\n"); pVoo->Accel = 0; pVoo->ShadowFB = 1; } if(pVoo->ShadowFB) { /* Load the shadow framebuffer */ if (!xf86LoadSubModule(pScrn, "shadowfb")) { VoodooFreeRec(pScrn); return FALSE; } } return TRUE; }
int Permedia3MemorySizeDetect(ScrnInfoPtr pScrn) { GLINTPtr pGlint = GLINTPTR (pScrn); CARD32 size = 0, temp, temp1, temp2, i; /* We can map 64MB, as that's the size of the Permedia3 aperture * regardless of memory configuration */ pGlint->FbMapSize = 64*1024*1024; #ifndef XSERVER_LIBPCIACCESS /* Mark as VIDMEM_MMIO to avoid write-combining while detecting memory */ pGlint->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pGlint->PciTag, pGlint->FbAddress, pGlint->FbMapSize); #else { void** result = (void**)&pGlint->FbBase; int err = pci_device_map_range(pGlint->PciInfo, pGlint->FbAddress, pGlint->FbMapSize, PCI_DEV_MAP_FLAG_WRITABLE, result); if (err) return FALSE; } #endif if (pGlint->FbBase == NULL) return 0; temp = GLINT_READ_REG(PM3MemBypassWriteMask); GLINT_SLOW_WRITE_REG(0xffffffff, PM3MemBypassWriteMask); /* The Permedia3 splits up memory, and even replicates it. Grrr. * So that each 32MB appears at offset 0, and offset 32, unless * there's really 64MB attached to the chip. * So, 16MB appears at offset 0, nothing between 16-32, then it re-appears * at offset 32. * This below is to detect the cases of memory combinations */ /* Test first 32MB */ for(i=0;i<32;i++) { /* write test pattern */ MMIO_OUT32(pGlint->FbBase, i*1024*1024, i*0x00345678); mem_barrier(); temp1 = MMIO_IN32(pGlint->FbBase, i*1024*1024); /* Let's check for wrapover, write will fail at 16MB boundary */ if (temp1 == (i*0x00345678)) size = i; else break; } /* Ok, we're satisfied we've got 32MB, let's test the second lot */ if ((size + 1) == i) { for(i=0;i<32;i++) { /* Clear first 32MB */ MMIO_OUT32(pGlint->FbBase, i*1024*1024, 0); } mem_barrier(); for(i=32;i<64;i++) { /* write test pattern */ MMIO_OUT32(pGlint->FbBase, i*1024*1024, i*0x00345678); mem_barrier(); temp1 = MMIO_IN32(pGlint->FbBase, i*1024*1024); temp2 = MMIO_IN32(pGlint->FbBase, (i-32)*1024*1024); /* Let's check for wrapover */ if ( (temp1 == (i*0x00345678)) && (temp2 == 0) ) size = i; else break; } } GLINT_SLOW_WRITE_REG(temp, PM3MemBypassWriteMask); #ifndef XSERVER_LIBPCIACCESS xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pGlint->FbBase, pGlint->FbMapSize); #else pci_device_unmap_range(pGlint->PciInfo, pGlint->FbBase, pGlint->FbMapSize); #endif pGlint->FbBase = NULL; pGlint->FbMapSize = 0; return ( (size+1) * 1024 ); }
Bool smi_mapmemory_820(ScrnInfoPtr pScrn, SMIPtr pSmi) { vgaHWPtr hwp; CARD32 memBase; memBase = pSmi->PciInfo->memBase[0] + 0x680000; pSmi->MapSize = 0x180000; pSmi->MapBase = xf86MapPciMem (pScrn->scrnIndex, VIDMEM_MMIO | VIDMEM_MMIO_32BIT, pSmi->PciTag, memBase, pSmi->MapSize); if (pSmi->MapBase == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Internal error: could not map " "MMIO registers.\n"); return (FALSE); } pSmi->DPRBase = pSmi->MapBase + 0x000000; pSmi->VPRBase = pSmi->MapBase + 0x000800; pSmi->CPRBase = pSmi->MapBase + 0x001000; pSmi->IOBase = pSmi->MapBase + 0x040000; pSmi->DataPortBase = pSmi->MapBase + 0x080000; pSmi->DataPortSize = 0x100000; pScrn->memPhysBase = pSmi->PciInfo->memBase[0]; pSmi->fbMapOffset = 0x0; if (pSmi->videoRAMBytes) { pSmi->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pSmi->PciTag, pScrn->memPhysBase + pSmi->fbMapOffset, pSmi->videoRAMBytes); if (pSmi->FBBase == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Internal error: could not " "map framebuffer.\n"); return (FALSE); } } pSmi->FBOffset = 0; pScrn->fbOffset = pSmi->FBOffset + pSmi->fbMapOffset; SMI_EnableMmio(pScrn); pSmi->FBCursorOffset = pSmi->videoRAMBytes - 1024; pSmi->FBReserved = pSmi->videoRAMBytes - 2048; if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x01) { CARD32 fifoOffset = 0; fifoOffset |= VGAIN8_INDEX (pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x46) << 3; fifoOffset |= VGAIN8_INDEX (pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x47) << 11; fifoOffset |= (VGAIN8_INDEX (pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x49) & 0x1C) << 17; pSmi->FBReserved = fifoOffset; } #if LCD_SIZE_DETECT pSmi->lcd = VGAIN8_INDEX (pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x31) & 0x01; if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x01) { pSmi->lcd <<= 1; } switch (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x0C) { case 0x00: pSmi->lcdWidth = 640; pSmi->lcdHeight = 480; break; case 0x04: pSmi->lcdWidth = 800; pSmi->lcdHeight = 600; break; case 0x08: if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x74) & 0x02) { pSmi->lcdWidth = 1024; pSmi->lcdHeight = 600; } else { pSmi->lcdWidth = 1024; pSmi->lcdHeight = 768; } break; case 0x0C: pSmi->lcdWidth = 1280; pSmi->lcdHeight = 1024; break; } #else if (!pSmi->lcdWidth) pSmi->lcdWidth = pScrn->virtualX; if (!pSmi->lcdHeight) pSmi->lcdHeight = pScrn->virtualY; #endif return (TRUE); }
static Bool VIAMapFB(ScrnInfoPtr pScrn) { VIAPtr pVia = VIAPTR(pScrn); #ifdef HAVE_PCIACCESS if (pVia->Chipset == VIA_VX900) { pVia->FrameBufferBase = pVia->PciInfo->regions[2].base_addr; } else { pVia->FrameBufferBase = pVia->PciInfo->regions[0].base_addr; } int err; #else if (pVia->Chipset == VIA_VX900) { pVia->FrameBufferBase = pVia->PciInfo->memBase[2]; } else { pVia->FrameBufferBase = pVia->PciInfo->memBase[0]; } #endif DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAMapFB\n")); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "mapping framebuffer @ 0x%lx with size 0x%lx\n", pVia->FrameBufferBase, pVia->videoRambytes); if (pVia->videoRambytes) { #ifndef HAVE_PCIACCESS /* * FIXME: This is a hack to get rid of offending wrongly sized * MTRR regions set up by the VIA BIOS. Should be taken care of * in the OS support layer. */ unsigned char *tmp; tmp = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVia->PciTag, pVia->FrameBufferBase, pVia->videoRambytes); xf86UnMapVidMem(pScrn->scrnIndex, (pointer) tmp, pVia->videoRambytes); /* * And, as if this wasn't enough, 2.6 series kernels don't * remove MTRR regions on the first attempt. So try again. */ tmp = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVia->PciTag, pVia->FrameBufferBase, pVia->videoRambytes); xf86UnMapVidMem(pScrn->scrnIndex, (pointer) tmp, pVia->videoRambytes); /* * End of hack. */ #endif #ifdef HAVE_PCIACCESS err = pci_device_map_range(pVia->PciInfo, pVia->FrameBufferBase, pVia->videoRambytes, (PCI_DEV_MAP_FLAG_WRITABLE | PCI_DEV_MAP_FLAG_WRITE_COMBINE), (void **)&pVia->FBBase); if (err) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to map mmio BAR. %s (%d)\n", strerror(err), err); return FALSE; } #else pVia->FBBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pVia->PciTag, pVia->FrameBufferBase, pVia->videoRambytes); if (!pVia->FBBase) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Internal error: could not map framebuffer\n"); return FALSE; } #endif pVia->FBFreeStart = 0; pVia->FBFreeEnd = pVia->videoRambytes; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Frame buffer start: %p, free start: 0x%x end: 0x%x\n", pVia->FBBase, pVia->FBFreeStart, pVia->FBFreeEnd); } #ifdef HAVE_PCIACCESS pScrn->memPhysBase = pVia->PciInfo->regions[0].base_addr; #else pScrn->memPhysBase = pVia->PciInfo->memBase[0]; #endif pScrn->fbOffset = 0; if (pVia->IsSecondary) pScrn->fbOffset = pScrn->videoRam << 10; return TRUE; }
static Bool VIAMapMMIO(ScrnInfoPtr pScrn) { VIAPtr pVia = VIAPTR(pScrn); #ifdef HAVE_PCIACCESS pVia->MmioBase = pVia->PciInfo->regions[1].base_addr; int err; #else pVia->MmioBase = pVia->PciInfo->memBase[1]; #endif DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAMapMMIO\n")); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "mapping MMIO @ 0x%lx with size 0x%x\n", pVia->MmioBase, VIA_MMIO_REGSIZE); #ifdef HAVE_PCIACCESS err = pci_device_map_range(pVia->PciInfo, pVia->MmioBase, VIA_MMIO_REGSIZE, PCI_DEV_MAP_FLAG_WRITABLE, (void **)&pVia->MapBase); if (err) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to map mmio BAR. %s (%d)\n", strerror(err), err); return FALSE; } #else pVia->MapBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVia->PciTag, pVia->MmioBase, VIA_MMIO_REGSIZE); if (!pVia->MapBase) return FALSE; #endif xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "mapping BitBlt MMIO @ 0x%lx with size 0x%x\n", pVia->MmioBase + VIA_MMIO_BLTBASE, VIA_MMIO_BLTSIZE); #ifdef HAVE_PCIACCESS err = pci_device_map_range(pVia->PciInfo, pVia->MmioBase + VIA_MMIO_BLTBASE, VIA_MMIO_BLTSIZE, PCI_DEV_MAP_FLAG_WRITABLE, (void **)&pVia->BltBase); if (err) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Unable to map blt BAR. %s (%d)\n", strerror(err), err); return FALSE; } #else pVia->BltBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVia->PciTag, pVia->MmioBase + VIA_MMIO_BLTBASE, VIA_MMIO_BLTSIZE); if (!pVia->BltBase) return FALSE; #endif if (!pVia->MapBase || !pVia->BltBase) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "BitBlit could not be mapped.\n"); return FALSE; } /* Memory mapped IO for mpeg engine. */ pVia->MpegMapBase = pVia->MapBase + 0xc00; /* Set up MMIO vgaHW. */ { vgaHWPtr hwp = VGAHWPTR(pScrn); CARD8 val; vgaHWSetMmioFuncs(hwp, pVia->MapBase, 0x8000); val = hwp->readEnable(hwp); hwp->writeEnable(hwp, val | 0x01); val = hwp->readMiscOut(hwp); hwp->writeMiscOut(hwp, val | 0x01); /* Unlock extended IO space. */ ViaSeqMask(hwp, 0x10, 0x01, 0x01); ViaMMIOEnable(pScrn); vgaHWSetMmioFuncs(hwp, pVia->MapBase, 0x8000); /* Unlock CRTC. */ ViaCrtcMask(hwp, 0x47, 0x00, 0x01); vgaHWGetIOBase(hwp); } return TRUE; }