void osPciInit(void) { +#if defined(OPENBSD_MORE_CALLS) + xf86OpenConsole(); +#endif xf86InitVidMem(); }
pointer xf86MapVidMem(int ScreenNum, int Flags, unsigned long Base, unsigned long Size) { pointer vbase = NULL; VidMapPtr vp; MappingPtr mp; if (((Flags & VIDMEM_FRAMEBUFFER) && (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT)))) FatalError("Mapping memory with more than one type\n"); xf86InitVidMem(); if (!vidMemInfo.initialised || !vidMemInfo.mapMem) return NULL; vbase = vidMemInfo.mapMem(ScreenNum, Base, Size, Flags); if (!vbase || vbase == (pointer)-1) return NULL; vp = getVidMapRec(ScreenNum); mp = newMapping(vp); mp->physBase = Base; mp->size = Size; mp->virtBase = vbase; mp->flags = Flags; /* * Check the "mtrr" option even when MTRR isn't supported to avoid * warnings about unrecognised options. */ checkMtrrOption(vp); if (vp->mtrrEnabled && vidMemInfo.setWC) { if (Flags & (VIDMEM_MMIO | VIDMEM_MMIO_32BIT)) mp->mtrrInfo = vidMemInfo.setWC(ScreenNum, Base, Size, FALSE, vp->mtrrFrom); else if (Flags & VIDMEM_FRAMEBUFFER) mp->mtrrInfo = vidMemInfo.setWC(ScreenNum, Base, Size, TRUE, vp->mtrrFrom); } return vbase; }
Bool xf86LinearVidMem(void) { xf86InitVidMem(); return vidMemInfo.linearSupported; }
static pointer linuxMapPci(int ScreenNum, int Flags, PCITAG Tag, ADDRESS Base, unsigned long Size, int mmap_ioctl) { do { pciConfigPtr pPCI; unsigned char *result; ADDRESS realBase, Offset; int fd, mmapflags, prot; xf86InitVidMem(); pPCI = xf86GetPciHostConfigFromTag(Tag); if (((fd = linuxPciOpenFile(pPCI ? pPCI->tag : 0,FALSE)) < 0) || (ioctl(fd, mmap_ioctl, 0) < 0)) break; /* Note: IA-64 doesn't compile this and doesn't need to */ #ifdef __ia64__ # ifndef MAP_WRITECOMBINED # define MAP_WRITECOMBINED 0x00010000 # endif # ifndef MAP_NONCACHED # define MAP_NONCACHED 0x00020000 # endif if (Flags & VIDMEM_FRAMEBUFFER) mmapflags = MAP_SHARED | MAP_WRITECOMBINED; else mmapflags = MAP_SHARED | MAP_NONCACHED; #else /* !__ia64__ */ mmapflags = (Flags & VIDMEM_FRAMEBUFFER) / VIDMEM_FRAMEBUFFER; if (ioctl(fd, PCIIOC_WRITE_COMBINE, mmapflags) < 0) break; mmapflags = MAP_SHARED; #endif /* ?__ia64__ */ /* Align to page boundary */ realBase = Base & ~(getpagesize() - 1); Offset = Base - realBase; if (Flags & VIDMEM_READONLY) prot = PROT_READ; else prot = PROT_READ | PROT_WRITE; result = mmap(NULL, Size + Offset, prot, mmapflags, fd, realBase); if (!result || ((pointer)result == MAP_FAILED)) return NULL; xf86MakeNewMapping(ScreenNum, Flags, realBase, Size + Offset, result); return result + Offset; } while (0); if (mmap_ioctl == PCIIOC_MMAP_IS_MEM) return xf86MapVidMem(ScreenNum, Flags, Base, Size); return NULL; }
void bsdPciInit(void) { xf86InitVidMem(); }