summaryrefslogtreecommitdiff
path: root/src/mga.h
diff options
context:
space:
mode:
authorIan Romanick <idr@us.ibm.com>2005-07-01 16:21:35 +0000
committerIan Romanick <idr@us.ibm.com>2005-07-01 16:21:35 +0000
commit800579ef040cf5df4a8b09a4a8db6118c3d84980 (patch)
tree0ad90713ec679988e7880a05b41997251b22cb54 /src/mga.h
parentacadff30e40af48592e50e55a94f9c81ab856971 (diff)
Re-write the PInS processing code
This patch dumps all of the old BIOS processing code from the MGA DDX. The new code, located in mga_bios.c, is modeled after the code in matroxfb_misc.c (though no actual code was copied). Basically, the BIOS is processed in one place, with "device independent" values stored in a data structure. This data is then used, without extra switch-statments, throughout the driver. In addition, this patch adds support for processing the BIOS on PowerPC systems. On PPC cards, the magic offset values (that give the location of the PInS data) is not in the BIOS. Instead the driver has to search the BIOS for the PInS structure signature. The patch does this and correctly handles byte-ordering (and data alignement) issues. This code has been tested on an AGP G400 on x86 and a PCI G450 on PowerPC. NOTE: The file mga_bios.h is also removed. The "documentation" in that file was moved to the file mga_PInS.txt. This file documents, as much as possible, the layout of the various PInS datastructure versions. The information in that file is 100% based on the old mga_bios.h and the code in matroxfb_misc.c. No additional information from Matrox documentation is included in that file. This just puts the information that was already known in one place. Xorg Bug: 3553
Diffstat (limited to 'src/mga.h')
-rw-r--r--src/mga.h60
1 files changed, 57 insertions, 3 deletions
diff --git a/src/mga.h b/src/mga.h
index 93dff48..93918a8 100644
--- a/src/mga.h
+++ b/src/mga.h
@@ -288,6 +288,61 @@ typedef struct {
ScrnInfoPtr pScrn_2;
} MGAEntRec, *MGAEntPtr;
+/**
+ * Track the range of a voltage controlled osciliator (VCO).
+ */
+struct mga_VCO {
+ /**
+ * Minimum selectable frequency for this VCO, measured in kHz.
+ */
+ unsigned min_freq;
+
+ /**
+ * Maximum selectable frequency for this VCO, measured in kHz.
+ *
+ * If this value is zero, then the VCO is not available.
+ */
+ unsigned max_freq;
+};
+
+/**
+ * Card information derrived from BIOS PInS data.
+ */
+struct mga_bios_values {
+ /**
+ * \name Voltage Controlled Oscilators
+ * \brief Track information about the various VCOs.
+ *
+ * MGA cards have between one and three VCOs that can be used to drive the
+ * various clocks. On older cards, only \c mga_bios_values::pixel VCO is
+ * available. On newer cards, such as the G450 and G550, all three are
+ * available. If \c mga_VCO::max_freq is zero, the VCO is not available.
+ */
+ /*@{*/
+ struct mga_VCO system; /**< System VCO. */
+ struct mga_VCO pixel; /**< Pixel VCO. */
+ struct mga_VCO video; /**< Video VCO. */
+ /*@}*/
+
+ /**
+ * Memory clock speed, measured in kHz.
+ */
+ unsigned mem_clock;
+
+ /**
+ * PLL reference frequency value. On older cards this is ~14MHz, and on
+ * newer cards it is ~27MHz.
+ */
+ unsigned pll_ref_freq;
+
+ /**
+ * Some older MGA cards have a "fast bitblt" mode. This is determined
+ * by a capability bit stored in the PInS data.
+ */
+ Bool fast_bitblt;
+};
+
+
typedef struct {
#ifdef USEMGAHAL
LPCLIENTDATA pClientStruct;
@@ -296,8 +351,7 @@ typedef struct {
LPMGAHWINFO pMgaHwInfo;
#endif
EntityInfoPtr pEnt;
- MGABiosInfo Bios;
- MGABios2Info Bios2;
+ struct mga_bios_values bios;
CARD8 BiosOutputMode;
pciVideoPtr PciInfo;
PCITAG PciTag;
@@ -497,7 +551,7 @@ Bool MGAGetRec(ScrnInfoPtr pScrn);
void MGAProbeDDC(ScrnInfoPtr pScrn, int index);
void MGASoftReset(ScrnInfoPtr pScrn);
void MGAFreeRec(ScrnInfoPtr pScrn);
-void MGAReadBios(ScrnInfoPtr pScrn);
+Bool mga_read_and_process_bios(ScrnInfoPtr pScrn);
void MGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode,
int flags);
void MGAAdjustFrameCrtc2(int scrnIndex, int x, int y, int flags);