diff options
Diffstat (limited to 'src/rdc.h')
-rw-r--r-- | src/rdc.h | 320 |
1 files changed, 320 insertions, 0 deletions
diff --git a/src/rdc.h b/src/rdc.h new file mode 100644 index 0000000..05ce1ed --- /dev/null +++ b/src/rdc.h @@ -0,0 +1,320 @@ +/* + * Copyright (C) 2009 RDC Semiconductor Co.,Ltd + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * For technical support : + * <jason.lin@rdc.com.tw> + */ + + +#if XSERVER_LIBPCIACCESS +#include <pciaccess.h> +#endif + +#define PCI_DEV_MAP_FLAG_WRITABLE (1U<<0) +#define PCI_DEV_MAP_FLAG_WRITE_COMBINE (1U<<1) +#define PCI_DEV_MAP_FLAG_CACHABLE (1U<<2) + +#if XSERVER_LIBPCIACCESS +#define RDC_MEMBASE(p,n) (p)->regions[(n)].base_addr +#define VENDOR_ID(p) (p)->vendor_id +#define DEVICE_ID(p) (p)->device_id +#define SUBVENDOR_ID(p) (p)->subvendor_id +#define SUBSYS_ID(p) (p)->subdevice_id +#define CHIP_REVISION(p) (p)->revision +#else +#define RDC_MEMBASE(p,n) (p)->memBase[n] +#define VENDOR_ID(p) (p)->vendor +#define DEVICE_ID(p) (p)->chipType +#define SUBVENDOR_ID(p) (p)->subsysVendor +#define SUBSYS_ID(p) (p)->subsysCard +#define CHIP_REVISION(p) (p)->chipRev +#endif + +/* Compiler Options */ +#define Accel_2D +#define Accel_2D_DEBUG 0 + +/* #define MMIO_2D */ +#define HWC +#define HWC_DEBUG 0 + +/* Vendor & Device Info */ +#ifndef PCI_VENDOR_RDC +#define PCI_VENDOR_RDC 0x17F3 +#endif + +#ifndef PCI_VENDOR_RDC_M2010_A0 +#define PCI_VENDOR_RDC_M2010_A0 0x25F0 +#endif + +#ifndef PCI_CHIP_M2010 +#define PCI_CHIP_M2010 0x2010 +#endif + +#ifndef PCI_CHIP_M2010_A0 +#define PCI_CHIP_M2010_A0 0x17F3 +#endif + +#ifndef PCI_CHIP_M2011 +#define PCI_CHIP_M2011 0x2011 +#endif + +typedef enum _CHIP_ID { + VGALegacy, + M2010, + M2011 +} CHIP_ID; + +/* RDC REC Info */ +#define RDC_NAME "RDC" +#define RDC_DRIVER_NAME "rdc" +#define RDC_MAJOR_VERSION 0 +#define RDC_MINOR_VERSION 0 +#define RDC_PATCH_VERSION 6 +#define RDC_VERSION \ + ((RDC_MAJOR_VERSION << 20) | (RDC_MINOR_VERSION << 10) | RDC_PATCH_VERSION) + +/* Customized Info */ +#define DEFAULT_VIDEOMEM_SIZE 0x00800000 +#define DEFAULT_MMIO_SIZE 0x00020000 +#define DEFAULT_CMDQ_SIZE 0x00100000 +#define MIN_CMDQ_SIZE 0x00040000 +#define CMD_QUEUE_GUARD_BAND 0x00000020 +#define DEFAULT_HWC_NUM 0x00000002 + +/* Data Type Definition */ +typedef INT32 LONG; +typedef CARD8 UCHAR; +typedef CARD16 USHORT; +typedef CARD32 ULONG; + +/* Verberse level define */ +#define ErrorLevel 0 /* Report Error message */ +#define DefaultLevel 4 /* Driver entry function */ +#define InfoLevel 5 /* Report information */ +#define InternalLevel 6 /* Driver interanl function entry */ + + +#define BIT0 0x00000001 +#define BIT1 0x00000002 +#define BIT2 0x00000004 +#define BIT3 0x00000008 +#define BIT4 0x00000010 +#define BIT5 0x00000020 +#define BIT6 0x00000040 +#define BIT7 0x00000080 +#define BIT8 0x00000100 +#define BIT9 0x00000200 +#define BIT10 0x00000400 +#define BIT11 0x00000800 +#define BIT12 0x00001000 +#define BIT13 0x00002000 +#define BIT14 0x00004000 +#define BIT15 0x00008000 +#define BIT16 0x00010000 +#define BIT17 0x00020000 +#define BIT18 0x00040000 +#define BIT19 0x00080000 +#define BIT20 0x00100000 +#define BIT21 0x00200000 +#define BIT22 0x00400000 +#define BIT23 0x00800000 +#define BIT24 0x01000000 +#define BIT25 0x02000000 +#define BIT26 0x04000000 +#define BIT27 0x08000000 +#define BIT28 0x10000000 +#define BIT29 0x20000000 +#define BIT30 0x40000000 +#define BIT31 0x80000000 + +#define BIOS_ROM_PATH_FILE "//root//RDCVBIOS.ROM" +#define BIOS_ROM_SIZE 32*1024 +#define BIOS_ROM_PHY_BASE 0xC0000 + + + +/* Data Structure Definition */ +typedef struct _RDCRegRec { +/* UCHAR ucScratch[0x1F];*/ + UCHAR ucPLLValue[3]; + UCHAR ucCRA3; + UCHAR ucSR58; +} RDCRegRec, *RDCRegPtr; + +typedef struct _VIDEOMODE { + + int ScreenWidth; + int ScreenHeight; + int bitsPerPixel; + int Bpp; + int ScreenPitch; + +} VIDEOMODE, *PVIDEOMODE; + +typedef struct { + + ULONG ulCMDQSize; + ULONG ulCMDQType; + + ULONG ulCMDQOffsetAddr; + UCHAR *pjCMDQVirtualAddr; + + UCHAR *pjCmdQBasePort; + UCHAR *pjWritePort; + UCHAR *pjReadPort; + UCHAR *pjEngStatePort; + + ULONG ulCMDQMask; + ULONG ulCurCMDQueueLen; + + ULONG ulWritePointer; + ULONG ulReadPointer; + + ULONG ulReadPointer_OK; /* for Eng_DBGChk */ + +} CMDQINFO, *PCMDQINFO; + +typedef struct { + + ULONG fg; + ULONG bg; + UCHAR *pjPatternVirtualAddr; + UCHAR ucXorBitmap[64*64/8]; + UCHAR ucAndBitmap[64*64/8]; + +} MONOHWC, *PMONOHWC; + +typedef struct { + + int HWC_NUM; + int HWC_NUM_Next; + + ULONG ulHWCOffsetAddr; + UCHAR *pjHWCVirtualAddr; + + USHORT cursortype; + USHORT width; + USHORT height; + USHORT xhot; + USHORT yhot; + USHORT offset_x; + USHORT offset_y; + int iScreenOffset_x; + int iScreenOffset_y; + MONOHWC MonoHWC; + +} HWCINFO, *PHWCINFO; + +typedef struct { + ULONG ulHorMaxResolution; + ULONG ulVerMaxResolution; +} MONITORSIZE; + +typedef struct { + Bool EnableHorScaler; + Bool EnableVerScaler; + int ulHorScalingFactor; + int ulVerScalingFactor; +} SCALER; + +typedef struct { + UCHAR ucDeviceID; + UCHAR ucDisplayPath; + MONITORSIZE MonitorSize; + SCALER ScalerConfig; + /* current mode: uce pScrn->currentMode */ +} DEVICEINFO; + +typedef struct { + Bool bOverlayEnable; + int iSrcWidth; + int iSrcHeight; + int iDstLeft; + int iDstTop; + int iDstWidth; + int iDstHeight; +} OVERLAY_STATUS; + + + +typedef struct _RDCRec { + + EntityInfoPtr pEnt; +#if XSERVER_LIBPCIACCESS + struct pci_device *PciInfo; +#else + pciVideoPtr PciInfo; + PCITAG PciTag; +#endif + + + OptionInfoPtr Options; + DisplayModePtr ModePtr; /* duplicate of pScrn->currentMode, delete this one */ + XAAInfoRecPtr AccelInfoPtr; + xf86CursorInfoPtr HWCInfoPtr; + + VIDEOMODE VideoModeInfo; /* duplicate of pScrn->currentMode, delete this one */ + RDCRegRec SavedReg; + CMDQINFO CMDQInfo; + HWCINFO HWCInfo; + OVERLAY_STATUS OverlayStatus; + DEVICEINFO DeviceInfo; + ULONG ulCMDReg; + Bool EnableClip; + + /* adapter information */ + UCHAR jChipType; + + ULONG ENGCaps; + ULONG FBPhysAddr; /* Frame buffer physical address */ + UCHAR *FBVirtualAddr; /* Map of frame buffer */ + unsigned long FbMapSize; + unsigned long AvailableFBsize; + + ULONG MMIOPhysAddr; /* MMIO region physical address */ + UCHAR *MMIOVirtualAddr; /* Map of MMIO region */ + unsigned long MMIOMapSize; + + UCHAR *BIOSVirtualAddr; /* BIOS virtual address */ + ULONG ulROMType; /* 0: no BIOS 1: VBIOS, 2: ROM file */ + + ULONG MemoryBandwidth; /* The unit is MB*/ + + IOADDRESS IODBase; /* Base of PIO memory area */ + IOADDRESS PIOOffset; + IOADDRESS RelocateIO; + + USHORT usSupportDevice; + + Bool noAccel; + Bool noHWC; + Bool MMIO2D; + int DBGSelect; + + CloseScreenProcPtr CloseScreen; +} RDCRec, *RDCRecPtr; + +#define RDCPTR(p) ((RDCRecPtr)((p)->driverPrivate)) +#define MODE_PRIVATE_PTR(p) ((MODE_PRIVATE*)(p->Private)) + +/* Include Files */ +#include "rdc_mode.h" +#include "rdc_vgatool.h" +#include "rdc_2dtool.h" +#include "rdc_cursor.h" +#include "CInt10.h" +#include "rdc_video.h" |