705N/A * PERFORMANCE OF THIS SOFTWARE.
1265N/A Atom xvGammaRed, xvGammaGreen, xvGammaBlue;
1265N/A } ASTRec, *ASTRecPtr, *ASTPtr;
705N/A #define ASTPTR(p) ((ASTRecPtr)((p)->driverPrivate))
705N/A+#ifndef VIS_GETPCICONFIG
705N/A+ * These definitions will be removed when they are included in the
705N/A+#define VIS_GETVIDEOMODENAME (VIOC | 12)
705N/A+#define VIS_STOREVIDEOMODENAME (VIOC | 13)
705N/A+#define VIS_MAX_VMODE_LEN 48
705N/A+typedef struct vis_video_mode {
705N/A+ char mode_name[VIS_MAX_VMODE_LEN];
1351N/A+#define VIS_GETPCICONFIG (VIOC | 14)
705N/A+typedef struct vis_pci_cfg {
705N/A+ uint8_t CacheLineSize;
705N/A+ uint32_t ROMBaseAddress;
705N/A+ uint8_t CapabilitiesPtr;
705N/A+ uint8_t Reserved_1[3];
705N/A+ uint8_t MaximumLatency;
705N/A+#define VIS_SETIOREG (VIOC | 17)
705N/A+#define VIS_GETIOREG (VIOC | 18)
705N/A+typedef struct vis_io_reg {
705N/A+extern struct pci_device *ASTGetPciInfo(ASTRecPtr);
705N/A+extern ScrnInfoPtr ASTAllocScreen(DriverPtr, GDevPtr);
1351N/A+extern pointer ASTMapVidMem(ScrnInfoPtr, unsigned int, PCITAG,
1351N/A+ unsigned long, unsigned long);
1351N/A+extern void ASTUnmapVidMem(ScrnInfoPtr, pointer, unsigned long);
1351N/A+extern void ASTNotifyModeChanged(ScrnInfoPtr);
1351N/A+extern void ASTSaveHW(ScrnInfoPtr);
1351N/A+extern void ASTRestoreHW(ScrnInfoPtr);
691N/A infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
691N/A HARDWARE_CURSOR_INVERT_MASK |
691N/A HARDWARE_CURSOR_BIT_ORDER_MSBFIRST;
691N/A infoPtr->MaxWidth = MAX_HWC_WIDTH;
691N/A infoPtr->MaxHeight = MAX_HWC_HEIGHT;
1351N/A static ModeStatus ASTValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags);
691N/A /* Internally used functions */
691N/A-static Bool ASTGetRec(ScrnInfoPtr pScrn);
691N/A+extern Bool ASTGetRec(ScrnInfoPtr pScrn);
691N/A static void ASTFreeRec(ScrnInfoPtr pScrn);
691N/A static Bool ASTSaveScreen(ScreenPtr pScreen, Bool unblack);
1351N/A static Bool ASTCloseScreen(CLOSE_SCREEN_ARGS_DECL);
691N/A-#ifndef XSERVER_LIBPCIACCESS
691N/A+#if !defined(XSERVER_LIBPCIACCESS) && !defined(__sparc__)
691N/A * This probing is just checking the PCI data the server already
691N/A+#if !defined(__sparc__)
691N/A numUsed = xf86MatchPciInstances(AST_NAME, PCI_VENDOR_AST,
691N/A ASTChipsets, ASTPciChipsets,
691N/A devSections, numDevSections,
691N/A } /* end of if flags */
1265N/A+ if (flags & PROBE_DETECT) {
1265N/A+ for (i = 0; i < numDevSections; i++) {
1351N/A+ /* Allocate new ScrnInfoRec and claim the slot */
1351N/A+ if (pScrn = ASTAllocScreen(drv, devSections[i])) {
1351N/A+ pScrn->driverVersion = AST_VERSION;
1351N/A+ pScrn->driverName = AST_DRIVER_NAME;
1351N/A+ pScrn->PreInit = ASTPreInit;
1351N/A+ pScrn->ScreenInit = ASTScreenInit;
1351N/A+ pScrn->SwitchMode = ASTSwitchMode;
1351N/A+ pScrn->AdjustFrame = ASTAdjustFrame;
1351N/A+ pScrn->EnterVT = ASTEnterVT;
1351N/A+ pScrn->LeaveVT = ASTLeaveVT;
1351N/A+ pScrn->FreeScreen = ASTFreeScreen;
1351N/A+ pScrn->ValidMode = ASTValidMode;
691N/A pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
691N/A if (flags & PROBE_DETECT) {
691N/A ASTProbeDDC(pScrn, pEnt->index);
691N/A pAST->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
691N/A+#if !defined(__sparc__)
691N/A pAST->PciInfo = xf86GetPciInfoForEntity(pAST->pEnt->index);
1265N/A+ pAST->PciInfo = ASTGetPciInfo(pAST);
691N/A #ifndef XSERVER_LIBPCIACCESS
691N/A pAST->PciTag = pciTag(pAST->PciInfo->bus, pAST->PciInfo->device,
1351N/A /* "Patch" the PIOOffset inside vgaHW in order to force
691N/A * the vgaHW module to use our relocated i/o ports.
1265N/A #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
1265N/A VGAHWPTR(pScrn)->PIOOffset = /* ... */
1265N/A pAST->IODBase + PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) - 0x380;
691N/A pAST->RelocateIO = (IOADDRESS)(PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) + pAST->IODBase);
691N/A vFillASTModeInfo (pScrn);
691N/A+#if (defined(__sparc__))
691N/A+ ASTNotifyModeChanged(pScrn);
1351N/A if (!ASTModeInit(pScrn, pScrn->currentMode)) {
1351N/A xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Mode Init Failed \n");
691N/A * These two functions create and destroy that private data.
691N/A ASTGetRec(ScrnInfoPtr pScrn)
691N/A if (pScrn->driverPrivate)
691N/A Bool ASTMapMMIO(ScrnInfoPtr pScrn);
691N/A void ASTUnmapMMIO(ScrnInfoPtr pScrn);
691N/A+extern pointer ASTMapVidMem(ScrnInfoPtr, unsigned int, PCITAG,
691N/A+ unsigned long, unsigned long);
691N/A+extern void ASTUnmapVidMem(ScrnInfoPtr, pointer, unsigned long);
691N/A ASTMapMem(ScrnInfoPtr pScrn)
691N/A ASTRecPtr pAST = ASTPTR(pScrn);
691N/A-#ifndef XSERVER_LIBPCIACCESS
691N/A+#if !defined(XSERVER_LIBPCIACCESS) || defined(__sparc__)
691N/A+#if !defined(__sparc__)
691N/A pAST->FBVirtualAddr = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER,
691N/A pAST->FBPhysAddr, pAST->FbMapSize);
691N/A+ pAST->FBVirtualAddr = ASTMapVidMem(pScrn, VIDMEM_FRAMEBUFFER, NULL,
691N/A+ pAST->FBPhysAddr, pAST->FbMapSize);
691N/A void** result = (void**)&pAST->FBVirtualAddr;
691N/A int err = pci_device_map_range(pAST->PciInfo,
691N/A ASTRecPtr pAST = ASTPTR(pScrn);
691N/A-#ifndef XSERVER_LIBPCIACCESS
1351N/A+#if !defined(XSERVER_LIBPCIACCESS) || defined(__sparc__)
691N/A+#if !defined(__sparc__)
691N/A xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pAST->FBVirtualAddr,
1265N/A+ ASTUnmapVidMem(pScrn, (pointer)pAST->FBVirtualAddr, pAST->FbMapSize);
691N/A pci_device_unmap_range(pAST->PciInfo, pAST->FBVirtualAddr, pAST->FbMapSize);
691N/A ASTMapMMIO(ScrnInfoPtr pScrn)
691N/A ASTRecPtr pAST = ASTPTR(pScrn);
691N/A-#ifndef XSERVER_LIBPCIACCESS
691N/A+#if !defined(XSERVER_LIBPCIACCESS) || defined(__sparc__)
691N/A #if !defined(__alpha__)
1351N/A mmioFlags = VIDMEM_MMIO | VIDMEM_READSIDEEFFECT | VIDMEM_SPARSE;
691N/A+#if !defined(__sparc__)
691N/A pAST->MMIOVirtualAddr = xf86MapPciMem(pScrn->scrnIndex, mmioFlags,
691N/A pAST->MMIOPhysAddr, pAST->MMIOMapSize);
691N/A+ pAST->MMIOVirtualAddr = ASTMapVidMem(pScrn,
691N/A+ VIDMEM_MMIO | VIDMEM_READSIDEEFFECT, NULL,
691N/A+ pAST->MMIOPhysAddr, pAST->MMIOMapSize);
1351N/A void** result = (void**)&pAST->MMIOVirtualAddr;
1351N/A int err = pci_device_map_range(pAST->PciInfo,
691N/A ASTRecPtr pAST = ASTPTR(pScrn);
691N/A-#ifndef XSERVER_LIBPCIACCESS
691N/A+#if !defined(XSERVER_LIBPCIACCESS) || defined(__sparc__)
691N/A+#if !defined(__sparc__)
691N/A xf86UnMapVidMem(pScrn->scrnIndex, (pointer) pAST->MMIOVirtualAddr,
691N/A+ ASTUnmapVidMem(pScrn, (pointer)pAST->MMIOVirtualAddr, pAST->MMIOMapSize);
691N/A pci_device_unmap_range(pAST->PciInfo, pAST->MMIOVirtualAddr, pAST->MMIOMapSize);
691N/A pAST->MMIOVirtualAddr = 0;
691N/A ASTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
1265N/A SetIndexRegMask(SEQ_PORT,0x01, 0xDF, SEQ01);
1265N/A SetIndexRegMask(CRTC_PORT,0xB6, 0xFC, CRB6);
691N/A { 0x0030, 0x00000040 },
691N/A { 0x0028, 0x00000003 },
691N/A { 0x000C, 0x00005a21 },
691N/A- { 0x0034, 0x00007c03 },
691N/A+ { 0x0034, 0x00007c43 },
691N/A { 0x0120, 0x00004c41 },
691N/A { 0xffff, 0xffffffff },
691N/A { 0x0030, 0x00000040 },
691N/A { 0x0028, 0x00000003 },
691N/A { 0x000C, 0x00005a21 },
691N/A- { 0x0034, 0x00007c03 },
691N/A+ { 0x0034, 0x00007c43 },
691N/A { 0x0120, 0x00005061 },
691N/A { 0xffff, 0xffffffff },
999N/A PCI_READ_LONG(pAST->PciInfo, &ulData, 0x04);
999N/A PCI_WRITE_LONG(pAST->PciInfo, ulData, 0x04);
1351N/A * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
691N/A * PERFORMANCE OF THIS SOFTWARE.
691N/A /* VRAM Size Definition */
691N/A #define VIDEOMEM_SIZE_08M 0x00800000
691N/A #define VIDEOMEM_SIZE_16M 0x01000000
1351N/A+#define MISC_PORT_WRITE 0x42
1351N/A+#define VGA_ENABLE_PORT 0x43
1351N/A+#define DAC_INDEX_READ 0x47
1351N/A+#define DAC_INDEX_WRITE 0x48
1351N/A+#define INPUT_STATUS1_READ 0x5A
1351N/A+#define MISC_PORT_READ 0x4C
1265N/A+_GetRegFromFd(uchar_t off, int fd)
1351N/A+ struct vis_io_reg io_reg = {
1351N/A+ ioctl(fd, VIS_GETIOREG, &io_reg);
1351N/A+#define GetReg(off) _GetRegFromFd(off, pAST->fd)
1351N/A+#define SetReg(off, val) do { \
1351N/A+ struct vis_io_reg io_reg = { \
1351N/A+ ioctl(pAST->fd, VIS_SETIOREG, &io_reg); \
1351N/A+#define GetIndexReg(off, index, val) do { \
1351N/A+ struct vis_io_reg io_reg = { \
1351N/A+ ioctl(pAST->fd, VIS_SETIOREG, &io_reg); \
1351N/A+ ioctl(pAST->fd, VIS_GETIOREG, &io_reg); \
1351N/A+#define SetIndexReg(off, index, val) do { \
1351N/A+ struct vis_io_reg io_reg = { \
1351N/A+ ioctl(pAST->fd, VIS_SETIOREG, &io_reg); \
1351N/A+ ioctl(pAST->fd, VIS_SETIOREG, &io_reg); \
1351N/A+#define GetIndexRegMask(off, index, and, val) do { \
1351N/A+ struct vis_io_reg io_reg = { \
1351N/A+ ioctl(pAST->fd, VIS_SETIOREG, &io_reg); \
1351N/A+ ioctl(pAST->fd, VIS_GETIOREG, &io_reg); \
1351N/A+#define SetIndexRegMask(off, index, and, val) do { \
1351N/A+ struct vis_io_reg io_reg = { \
1351N/A+ ioctl(pAST->fd, VIS_SETIOREG, &io_reg); \
1351N/A+ ioctl(pAST->fd, VIS_GETIOREG, &io_reg); \
1351N/A+ ioctl(pAST->fd, VIS_SETIOREG, &io_reg); \
1351N/A+ ioctl(pAST->fd, VIS_SETIOREG, &io_reg); \
1351N/A #define AR_PORT_WRITE (pAST->MMIOVirtualAddr + 0x3c0)
1351N/A #define MISC_PORT_WRITE (pAST->MMIOVirtualAddr + 0x3c2)
1351N/A #define VGA_ENABLE_PORT (pAST->MMIOVirtualAddr + 0x3c3)
1351N/A __Temp = (MMIO_IN8(base, 1)&(and))|(val); \
1351N/A SetIndexReg(base,index,__Temp); \
1265N/A #define VGA_GET_PALETTE_INDEX(index, red, green, blue) \
1265N/A *(ULONG *) (pAST->MMIOVirtualAddr + 0xF000) = 0x1; \
1265N/A *(ULONG *) (pAST->MMIOVirtualAddr + 0x10000 + ((addr) & 0x0000FFFF)) = (data); \
691N/A+#endif /* ASTVGATOOL_H */
1265N/A PCI_READ_LONG(pAST->PciInfo, &ulData, 0x04);
1265N/A PCI_WRITE_LONG(pAST->PciInfo, ulData, 0x04);
1351N/A if (!xf86IsPrimaryPci(pAST->PciInfo))
1351N/A PCI_READ_LONG(pAST->PciInfo, &ulData, 0x04);
1351N/A PCI_WRITE_LONG(pAST->PciInfo, ulData, 0x04);
1351N/A outb(pAST->RelocateIO + 0x43, 0x01);
1351N/A outb(pAST->RelocateIO + 0x42, 0x01);
1351N/A /* Enable VGA MMIO Access */
1351N/A if (!xf86IsPrimaryPci(pAST->PciInfo))