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 "edid.h"␊ |
20 | ␊ |
21 | #if DEBUG␊ |
22 | #ifndef AUTORES_DEBUG␊ |
23 | #define AUTORES_DEBUG␊ |
24 | #endif␊ |
25 | #endif␊ |
26 | ␊ |
27 | #ifdef AUTORES_DEBUG␊ |
28 | #define PRINT(a, b...) printf(a, ##b);␊ |
29 | #else ␊ |
30 | #define PRINT(a, b...) verbose(a, ##b);␊ |
31 | #endif␊ |
32 | ␊ |
33 | #define __packed __attribute__((packed))␊ |
34 | ␊ |
35 | #define NEW(a) ((a *)(malloc(sizeof(a))))␊ |
36 | #define FREE(a) (free(a))␊ |
37 | ␊ |
38 | #define VBIOS_START 0xc0000␊ |
39 | #define VBIOS_SIZE 0x10000␊ |
40 | ␊ |
41 | #define false 0␊ |
42 | #define true 1␊ |
43 | ␊ |
44 | ␊ |
45 | bool gAutoResolution;␊ |
46 | UInt32 params[4];␊ |
47 | ␊ |
48 | typedef struct␊ |
49 | {␊ |
50 | ␉uint8_t width;␊ |
51 | ␉uint8_t height;␊ |
52 | } sAspect;␊ |
53 | ␊ |
54 | ␊ |
55 | typedef enum␊ |
56 | {␊ |
57 | ␉CT_UNKWN, CT_830, CT_845G, CT_855GM, CT_865G, ␊ |
58 | ␉CT_915G, CT_915GM, CT_945G, CT_945GM, CT_945GME, CT_946GZ, ␊ |
59 | ␉CT_950GM, CT_955X, CT_G965, CT_Q965, CT_965GM, CT_975X, ␊ |
60 | ␉CT_P35, CT_X48, CT_B43, CT_Q45, CT_P45,␊ |
61 | ␉CT_GM45, CT_G41, CT_G31, CT_G45, CT_500, CT_3150␊ |
62 | } chipsetType;␊ |
63 | ␊ |
64 | ␊ |
65 | typedef enum␊ |
66 | {␊ |
67 | ␉BT_UNKWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA␊ |
68 | } biosType;␊ |
69 | ␊ |
70 | typedef struct␊ |
71 | {␊ |
72 | ␉uint32_t␉clock;␊ |
73 | ␉uint16_t␉x;␊ |
74 | ␉uint16_t␉hSyncStart;␊ |
75 | ␉uint16_t␉hSyncEnd;␊ |
76 | ␉uint16_t␉hTotal;␊ |
77 | ␉uint16_t␉y;␊ |
78 | ␉uint16_t␉vSyncStart;␊ |
79 | ␉uint16_t␉vSyncEnd;␊ |
80 | ␉uint16_t␉vTotal;␊ |
81 | } generic_modeline;␊ |
82 | ␊ |
83 | typedef struct sModeTable_␊ |
84 | {␊ |
85 | ␉uint8_t␉*␉pointer;␊ |
86 | ␉␊ |
87 | ␉uint8_t␉␉id;␊ |
88 | ␉uint32_t␉size;␊ |
89 | ␉uint32_t␉modeCount;␊ |
90 | ␉␊ |
91 | ␉uint8_t *␉backup;␊ |
92 | ␉␊ |
93 | ␉struct sModeTable_ *prev;␊ |
94 | ␉struct sModeTable_ *next;␊ |
95 | } sModeTable;␊ |
96 | ␊ |
97 | typedef struct␊ |
98 | {␊ |
99 | ␉uint32_t chipsetId;␊ |
100 | ␉chipsetType chipset;␊ |
101 | ␉biosType bios;␊ |
102 | ␉␊ |
103 | ␉uint8_t* biosBackupPtr;␊ |
104 | ␉uint8_t* biosPtr;␊ |
105 | ␉␊ |
106 | ␉sModeTable *modeTables;␊ |
107 | ␉␊ |
108 | ␉uint32_t currentX, currentY;␊ |
109 | ␉uint8_t b1, b2;␊ |
110 | ␉␊ |
111 | ␉bool hasSwitched;␊ |
112 | ␉␊ |
113 | ␉bool (*setMode)(sModeTable *,uint8_t,uint32_t*,uint32_t*);␊ |
114 | ␉␊ |
115 | ␉sAspect aspectRatio;␊ |
116 | ␉␊ |
117 | ␉uint8_t unlocked;␊ |
118 | } vBiosMap;␊ |
119 | ␊ |
120 | vBiosMap *map;␊ |
121 | ␊ |
122 | vBiosMap * openVbios(chipsetType type);␊ |
123 | void closeVbios (vBiosMap* map);␊ |
124 | ␊ |
125 | void unlockVbios(vBiosMap* map);␊ |
126 | void relockVbios(vBiosMap* map);␊ |
127 | ␊ |
128 | void saveVbios(vBiosMap* map);␊ |
129 | void restoreVbios(vBiosMap* map);␊ |
130 | ␊ |
131 | void saveTables(sModeTable * table);␊ |
132 | void restoreTables(vBiosMap * map, sModeTable * table);␊ |
133 | ␊ |
134 | void gtfTimings(uint32_t x, uint32_t y, uint32_t freq,␊ |
135 | ␉␉␉␉ uint32_t *clock,␊ |
136 | ␉␉␉␉ uint16_t *hSyncStart, uint16_t *hSyncEnd, uint16_t *hBlank,␊ |
137 | ␉␉␉␉ uint16_t *vSyncStart, uint16_t *vSyncEnd, uint16_t *vBlank);␊ |
138 | ␊ |
139 | sModeTable * intializeTables(vBiosMap * map, int tablesCount);␊ |
140 | ␊ |
141 | void patchVbios(vBiosMap* map, uint32_t x, uint32_t y, uint32_t bp, uint32_t hTotal, uint32_t vTotal);␊ |
142 | ␊ |
143 | #endif␊ |
144 | |