1 | /* Copied from 915 resolution created by steve tomljenovic␊ |
2 | *␊ |
3 | * This code is based on the techniques used in :␊ |
4 | *␊ |
5 | * - 855patch. Many thanks to Christian Zietz (czietz gmx net)␊ |
6 | * for demonstrating how to shadow the VBIOS into system RAM␊ |
7 | * and then modify it.␊ |
8 | *␊ |
9 | * - 1280patch by Andrew Tipton (andrewtipton null li).␊ |
10 | *␊ |
11 | * - 855resolution by Alain Poirier␊ |
12 | *␊ |
13 | * This source code is into the public domain.␊ |
14 | */␊ |
15 | ␊ |
16 | #ifndef __915_RESOLUTION_H␊ |
17 | #define __915_RESOLUTION_H␊ |
18 | ␊ |
19 | #include "libsa.h"␊ |
20 | #include "saio_internal.h"␊ |
21 | #include "edid.h"␊ |
22 | ␊ |
23 | ␊ |
24 | #if DEBUG␊ |
25 | #ifndef AUTORES_DEBUG␊ |
26 | #define AUTORES_DEBUG //Azi: review␊ |
27 | #endif␊ |
28 | #endif␊ |
29 | ␊ |
30 | #ifdef AUTORES_DEBUG␊ |
31 | #define PRINT(a, b...) printf(a, ##b);␊ |
32 | #else ␊ |
33 | #define PRINT(a, b...) verbose(a, ##b);␊ |
34 | #endif␊ |
35 | ␊ |
36 | #define __packed __attribute__((packed))␊ |
37 | ␊ |
38 | #define NEW(a) ((a *)(malloc(sizeof(a))))␊ |
39 | #define FREE(a) (free(a))␊ |
40 | ␊ |
41 | #define VBIOS_START 0xc0000␊ |
42 | #define VBIOS_SIZE 0x10000␊ |
43 | ␊ |
44 | //#define false 0␉␉␉//Azi: (Reviewing...)␊ |
45 | //#define true 1␊ |
46 | ␊ |
47 | bool gAutoResolution;␊ |
48 | UInt32 paramsAR[4]; //Azi: testing autoresolution␊ |
49 | ␊ |
50 | ␊ |
51 | typedef struct␊ |
52 | {␊ |
53 | ␉uint8_t width;␊ |
54 | ␉uint8_t height;␊ |
55 | } sAspect;␊ |
56 | ␊ |
57 | typedef enum␊ |
58 | {␊ |
59 | ␉CT_UNKNOWN, CT_830, CT_845G, CT_855GM, CT_865G, ␊ |
60 | ␉CT_915G, CT_915GM, CT_945G, CT_945GM, CT_945GME, CT_946GZ, ␊ |
61 | ␉CT_955X, CT_G965, CT_Q965, CT_965GM, CT_975X, ␊ |
62 | ␉CT_P35, CT_X48, CT_B43, CT_Q45, CT_P45,␊ |
63 | ␉CT_GM45, CT_G41, CT_G31, CT_G45, CT_500␊ |
64 | } chipsetType;␊ |
65 | ␊ |
66 | typedef enum␊ |
67 | {␊ |
68 | ␉BT_UNKNOWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA␊ |
69 | } biosType;␊ |
70 | ␊ |
71 | typedef struct␊ |
72 | {␊ |
73 | ␉uint32_t␉clock;␊ |
74 | ␉uint16_t␉x;␊ |
75 | ␉uint16_t␉hSyncStart;␊ |
76 | ␉uint16_t␉hSyncEnd;␊ |
77 | ␉uint16_t␉hTotal;␊ |
78 | ␉uint16_t␉y;␊ |
79 | ␉uint16_t␉vSyncStart;␊ |
80 | ␉uint16_t␉vSyncEnd;␊ |
81 | ␉uint16_t␉vTotal;␊ |
82 | } generic_modeline;␊ |
83 | ␊ |
84 | typedef struct sModeTable_␊ |
85 | {␊ |
86 | ␉uint8_t␉*␉pointer;␊ |
87 | ␉␊ |
88 | ␉uint8_t␉␉id;␊ |
89 | ␉uint32_t␉size;␊ |
90 | ␉uint32_t␉modeCount;␊ |
91 | ␉␊ |
92 | ␉uint8_t *␉backup;␊ |
93 | ␉␊ |
94 | ␉struct sModeTable_ *prev;␊ |
95 | ␉struct sModeTable_ *next;␊ |
96 | } sModeTable;␊ |
97 | ␊ |
98 | typedef struct␊ |
99 | {␊ |
100 | ␉uint32_t chipsetId;␊ |
101 | ␉chipsetType chipset;␊ |
102 | ␉biosType bios;␊ |
103 | ␉␊ |
104 | ␉uint8_t* biosBackupPtr;␊ |
105 | ␉uint8_t* biosPtr;␊ |
106 | ␉␊ |
107 | ␉sModeTable *modeTables;␊ |
108 | ␉␊ |
109 | ␉uint32_t currentX, currentY;␊ |
110 | ␉uint8_t b1, b2;␊ |
111 | ␉␊ |
112 | //␉bool hasSwitched; //Azi: autoresolution␊ |
113 | ␉␊ |
114 | ␉bool (*setMode)(sModeTable *,uint8_t,uint32_t*,uint32_t*);␊ |
115 | ␉␊ |
116 | ␉sAspect aspectRatio;␊ |
117 | ␉␊ |
118 | ␉uint8_t unlocked;␊ |
119 | } vBiosMap;␊ |
120 | ␊ |
121 | vBiosMap *map;␊ |
122 | ␊ |
123 | vBiosMap * openVbios(chipsetType type);␊ |
124 | void closeVbios (vBiosMap* map);␊ |
125 | ␊ |
126 | void unlockVbios(vBiosMap* map);␊ |
127 | void relockVbios(vBiosMap* map);␊ |
128 | ␊ |
129 | void saveVbios(vBiosMap* map);␊ |
130 | void restoreVbios(vBiosMap* map);␊ |
131 | ␊ |
132 | void saveTables(sModeTable * table);␊ |
133 | void restoreTables(vBiosMap * map, sModeTable * table);␊ |
134 | ␊ |
135 | void gtfTimings(uint32_t x, uint32_t y, uint32_t freq,␊ |
136 | ␉␉␉␉ uint32_t *clock,␊ |
137 | ␉␉␉␉ uint16_t *hSyncStart, uint16_t *hSyncEnd, uint16_t *hBlank,␊ |
138 | ␉␉␉␉ uint16_t *vSyncStart, uint16_t *vSyncEnd, uint16_t *vBlank);␊ |
139 | ␊ |
140 | sModeTable * intializeTables(vBiosMap * map, int tablesCount);␊ |
141 | ␊ |
142 | void patchVbios(vBiosMap* map, uint32_t x, uint32_t y, uint32_t bp, uint32_t hTotal, uint32_t vTotal);␊ |
143 | ␊ |
144 | #endif␊ |
145 | |