1 | ␊ |
2 | /* Copied from 915 resolution created by steve tomljenovic␊ |
3 | *␊ |
4 | * This code is based on the techniques used in :␊ |
5 | *␊ |
6 | * - 855patch. Many thanks to Christian Zietz (czietz gmx net)␊ |
7 | * for demonstrating how to shadow the VBIOS into system RAM␊ |
8 | * and then modify it.␊ |
9 | *␊ |
10 | * - 1280patch by Andrew Tipton (andrewtipton null li).␊ |
11 | *␊ |
12 | * - 855resolution by Alain Poirier␊ |
13 | *␊ |
14 | * This source code is into the public domain.␊ |
15 | */␊ |
16 | #ifndef __915_RESOLUTION_H␊ |
17 | #define __915_RESOLUTION_H␊ |
18 | ␊ |
19 | #include "edid.h"␊ |
20 | ␊ |
21 | #define NEW(a) ((a *)(malloc(sizeof(a))))␊ |
22 | #define FREE(a) (free(a))␊ |
23 | ␊ |
24 | #ifdef AUTORES_DEBUG␊ |
25 | #define PRINT(a, b...) printf(a, ##b);␊ |
26 | #else ␊ |
27 | #define PRINT(a, b...) verbose(a, ##b);␊ |
28 | #endif␊ |
29 | ␊ |
30 | #define VBIOS_START 0xc0000␊ |
31 | #define VBIOS_SIZE 0x10000␊ |
32 | ␊ |
33 | #define FALSE 0␊ |
34 | #define TRUE 1␊ |
35 | ␊ |
36 | typedef struct {␊ |
37 | ␉unsigned char width;␊ |
38 | ␉unsigned char height;␊ |
39 | } s_aspect;␊ |
40 | ␊ |
41 | ␊ |
42 | typedef enum {␊ |
43 | ␉CT_UNKWN, CT_830, CT_845G, CT_855GM, CT_865G, ␊ |
44 | ␉CT_915G, CT_915GM, CT_945G, CT_945GM, CT_945GME, CT_946GZ, ␊ |
45 | ␉CT_955X, CT_G965, CT_Q965, CT_965GM, CT_975X, ␊ |
46 | ␉CT_P35, CT_X48, CT_B43, CT_Q45, CT_P45,␊ |
47 | ␉CT_GM45, CT_G41, CT_G31, CT_G45, CT_500␊ |
48 | } chipset_type;␊ |
49 | ␊ |
50 | ␊ |
51 | typedef enum {␊ |
52 | ␉BT_UNKWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA␊ |
53 | } bios_type;␊ |
54 | ␊ |
55 | typedef struct {␊ |
56 | ␉␉UInt32␉clock;␊ |
57 | ␉␉UInt16␉x;␊ |
58 | ␉␉UInt16␉hsyncstart;␊ |
59 | ␉␉UInt16␉hsyncend;␊ |
60 | ␉␉UInt16␉htotal;␊ |
61 | ␉␉UInt16␉y;␊ |
62 | ␉␉UInt16␉vsyncstart;␊ |
63 | ␉␉UInt16␉vsyncend;␊ |
64 | ␉␉UInt16␉vtotal;␊ |
65 | ␉} generic_modeline;␊ |
66 | ␊ |
67 | ␊ |
68 | typedef struct {␊ |
69 | ␉UInt32 chipset_id;␊ |
70 | ␉chipset_type chipset;␊ |
71 | ␉bios_type bios;␊ |
72 | ␉␊ |
73 | ␉UInt32 bios_fd;␊ |
74 | ␉unsigned char* bios_backup_ptr;␊ |
75 | ␉unsigned char* bios_ptr;␊ |
76 | ␉␊ |
77 | ␉char * mode_table;␊ |
78 | ␉char * nv_mode_table_2;␊ |
79 | ␉␊ |
80 | ␉UInt32 mode_table_size;␊ |
81 | ␉UInt32 nv_mode_table_2_size;␊ |
82 | ␉␊ |
83 | ␉UInt32 modeline_num;␊ |
84 | ␉UInt32 nv_modeline_num_2;␊ |
85 | ␉␊ |
86 | ␉UInt8 b1, b2;␊ |
87 | ␉␊ |
88 | ␉s_aspect aspect_ratio;␊ |
89 | ␉␊ |
90 | ␉UInt8 unlocked;␊ |
91 | } vbios_map;␊ |
92 | ␊ |
93 | vbios_map * open_vbios(chipset_type);␊ |
94 | void close_vbios (vbios_map*);␊ |
95 | void unlock_vbios(vbios_map*);␊ |
96 | void relock_vbios(vbios_map*);␊ |
97 | void save_vbios(vbios_map*);␊ |
98 | void restore_vbios(vbios_map*);␊ |
99 | ␊ |
100 | void gtf_timings(UInt32 x, UInt32 y, UInt32 freq,␊ |
101 | ␉␉␉␉ unsigned long *clock,␊ |
102 | ␉␉␉␉ UInt16 *hsyncstart, UInt16 *hsyncend, UInt16 *hblank,␊ |
103 | ␉␉␉␉ UInt16 *vsyncstart, UInt16 *vsyncend, UInt16 *vblank);␊ |
104 | ␊ |
105 | void cvt_timings(UInt32 x, UInt32 y, UInt32 freq,␊ |
106 | ␉␉␉␉ unsigned long *clock,␊ |
107 | ␉␉␉␉ UInt16 *hsyncstart, UInt16 *hsyncend, UInt16 *hblank,␊ |
108 | ␉␉␉␉ UInt16 *vsyncstart, UInt16 *vsyncend, UInt16 *vblank, bool reduced);␊ |
109 | ␊ |
110 | void patch_vbios(vbios_map*, UInt32, UInt32, UInt32, UInt32, UInt32);␊ |
111 | ␊ |
112 | #endif␊ |
113 | |