1445N/A CreateScreenResourcesProcPtr CreateScreenResources;
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);
1445N/A extern Bool bASTIsVGAEnabled(ScrnInfoPtr pScrn);
1445N/A extern Bool ASTGetVGA2EDID(ScrnInfoPtr pScrn, unsigned char *pEDIDBuffer);
1445N/A /* Driver specific headers */
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);
1445N/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 * 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) \
1445N/A #define DelayUS(x) usleep(x)
1445N/A #define DelayMS(x) DelayUS(1000*x)
691N/A+#endif /* ASTVGATOOL_H */
1445N/A ASTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags)
1445N/A if (pAST->jTxChipType == Tx_DP501) SetDP501VideoOutput(pScrn, 1);
1445N/A PCI_READ_LONG(pAST->PciInfo, &ulData, 0x04);
1445N/A PCI_WRITE_LONG(pAST->PciInfo, ulData, 0x04);
1265N/A PCI_READ_LONG(pAST->PciInfo, &ulData, 0x04);
1445N/A PCI_WRITE_LONG(pAST->PciInfo, ulData, 0x04);
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);
1445N/A outb(pAST->RelocateIO + 0x42, 0x01);
1445N/A static ModeStatus ASTValidMode(SCRN_ARG_TYPE arg, DisplayModePtr mode, Bool verbose, int flags);
1445N/A /* Internally used functions */
1445N/A-static Bool ASTGetRec(ScrnInfoPtr pScrn);
1445N/A+extern Bool ASTGetRec(ScrnInfoPtr pScrn);
1445N/A static void ASTFreeRec(ScrnInfoPtr pScrn);
1445N/A static Bool ASTSaveScreen(ScreenPtr pScreen, Bool unblack);
1445N/A static Bool ASTCloseScreen(CLOSE_SCREEN_ARGS_DECL);
1445N/A-#ifndef XSERVER_LIBPCIACCESS
1445N/A+#if !defined(XSERVER_LIBPCIACCESS) && !defined(__sparc__)
1445N/A * This probing is just checking the PCI data the server already
1445N/A numUsed = xf86MatchPciInstances(AST_NAME, PCI_VENDOR_AST,
1445N/A ASTChipsets, ASTPciChipsets,
1445N/A devSections, numDevSections,
1445N/A+ if (flags & PROBE_DETECT) {
1445N/A+ for (i = 0; i < numDevSections; i++) {
1445N/A+ /* Allocate new ScrnInfoRec and claim the slot */
1445N/A+ if (pScrn = ASTAllocScreen(drv, devSections[i])) {
1445N/A+ pScrn->driverVersion = AST_VERSION;
1445N/A+ pScrn->driverName = AST_DRIVER_NAME;
1445N/A+ pScrn->PreInit = ASTPreInit;
1445N/A+ pScrn->ScreenInit = ASTScreenInit;
1445N/A+ pScrn->SwitchMode = ASTSwitchMode;
1445N/A+ pScrn->AdjustFrame = ASTAdjustFrame;
1445N/A+ pScrn->EnterVT = ASTEnterVT;
1445N/A+ pScrn->LeaveVT = ASTLeaveVT;
1445N/A+ pScrn->FreeScreen = ASTFreeScreen;
1445N/A+ pScrn->ValidMode = ASTValidMode;
1445N/A pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
1445N/A if (flags & PROBE_DETECT) {
1445N/A ASTProbeDDC(pScrn, pEnt->index);
1445N/A pAST->pEnt = xf86GetEntityInfo(pScrn->entityList[0]);
1445N/A pAST->PciInfo = xf86GetPciInfoForEntity(pAST->pEnt->index);
1445N/A+ pAST->PciInfo = ASTGetPciInfo(pAST);
1445N/A #ifndef XSERVER_LIBPCIACCESS
1445N/A pAST->PciTag = pciTag(pAST->PciInfo->bus, pAST->PciInfo->device,
1445N/A xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n",
1445N/A (pScrn->chipset != NULL) ? pScrn->chipset : "Unknown ast");
1445N/A #if GET_ABI_MAJOR(ABI_VIDEODRV_VERSION) < 12
1445N/A /* "Patch" the PIOOffset inside vgaHW in order to force
1445N/A * the vgaHW module to use our relocated i/o ports.
1445N/A VGAHWPTR(pScrn)->PIOOffset =
1445N/A pScrn->domainIOBase + PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO) - 0x380;
1445N/A pAST->RelocateIO = pScrn->domainIOBase +
1445N/A PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO);
1445N/A pAST->RelocateIO = (PCI_REGION_BASE(pAST->PciInfo, 2, REGION_IO));
1445N/A if (pAST->pEnt->device->MemBase != 0) {
1445N/A pAST->FBPhysAddr = pAST->pEnt->device->MemBase;
1445N/A /* Enable VGA MMIO Access */
1351N/A if (!xf86IsPrimaryPci(pAST->PciInfo))
1445N/A+ ASTNotifyModeChanged(pScrn);
1445N/A if (!ASTModeInit(pScrn, pScrn->currentMode)) {
1445N/A xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Mode Init Failed \n");
1445N/A * These two functions create and destroy that private data.
1445N/A ASTGetRec(ScrnInfoPtr pScrn)
1445N/A infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
1445N/A HARDWARE_CURSOR_INVERT_MASK |
1445N/A HARDWARE_CURSOR_BIT_ORDER_MSBFIRST;
1445N/A infoPtr->MaxWidth = MAX_HWC_WIDTH;
1445N/A infoPtr->MaxHeight = MAX_HWC_HEIGHT;