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 | #define VBIOS_START 0xc0000␊ |
25 | #define VBIOS_SIZE 0x10000␊ |
26 | ␊ |
27 | #define FALSE 0␊ |
28 | #define TRUE 1␊ |
29 | ␊ |
30 | typedef struct {␊ |
31 | ␉unsigned char width;␊ |
32 | ␉unsigned char height;␊ |
33 | } s_aspect;␊ |
34 | ␊ |
35 | ␊ |
36 | typedef enum {␊ |
37 | ␉CT_UNKWN, CT_830, CT_845G, CT_855GM, CT_865G, ␊ |
38 | ␉CT_915G, CT_915GM, CT_945G, CT_945GM, CT_945GME, CT_946GZ, ␊ |
39 | ␉CT_955X, CT_G965, CT_Q965, CT_965GM, CT_975X, ␊ |
40 | ␉CT_P35, CT_X48, CT_B43, CT_Q45, CT_P45,␊ |
41 | ␉CT_GM45, CT_G41, CT_G31, CT_G45, CT_500␊ |
42 | } chipset_type;␊ |
43 | ␊ |
44 | ␊ |
45 | typedef enum {␊ |
46 | ␉BT_UNKWN, BT_1, BT_2, BT_3, BT_ATI_1, BT_ATI_2, BT_NVDA␊ |
47 | } bios_type;␊ |
48 | ␊ |
49 | typedef struct {␊ |
50 | ␉␉UInt32␉clock;␊ |
51 | ␉␉UInt16␉x;␊ |
52 | ␉␉UInt16␉hsyncstart;␊ |
53 | ␉␉UInt16␉hsyncend;␊ |
54 | ␉␉UInt16␉htotal;␊ |
55 | ␉␉UInt16␉y;␊ |
56 | ␉␉UInt16␉vsyncstart;␊ |
57 | ␉␉UInt16␉vsyncend;␊ |
58 | ␉␉UInt16␉vtotal;␊ |
59 | ␉} generic_modeline;␊ |
60 | ␊ |
61 | ␊ |
62 | typedef struct {␊ |
63 | ␉UInt32 chipset_id;␊ |
64 | ␉chipset_type chipset;␊ |
65 | ␉bios_type bios;␊ |
66 | ␉␊ |
67 | ␉UInt32 bios_fd;␊ |
68 | ␉unsigned char* bios_backup_ptr;␊ |
69 | ␉unsigned char* bios_ptr;␊ |
70 | ␉␊ |
71 | ␉char * mode_table;␊ |
72 | ␉char * nv_mode_table_2;␊ |
73 | ␉UInt32 nv_mode_table_2_size;␊ |
74 | ␉␊ |
75 | ␉UInt32 mode_table_size;␊ |
76 | ␉UInt32 modeline_num;␊ |
77 | ␉UInt32 nv_modeline_num_2;␊ |
78 | ␉UInt8 b1, b2;␊ |
79 | ␉␊ |
80 | ␉s_aspect aspect_ratio;␊ |
81 | ␉␊ |
82 | ␉UInt8 unlocked;␊ |
83 | } vbios_map;␊ |
84 | ␊ |
85 | vbios_map * open_vbios(chipset_type);␊ |
86 | void close_vbios (vbios_map*);␊ |
87 | void unlock_vbios(vbios_map*);␊ |
88 | void relock_vbios(vbios_map*);␊ |
89 | void save_vbios(vbios_map*);␊ |
90 | void restore_vbios(vbios_map*);␊ |
91 | ␊ |
92 | void gtf_timings(UInt32 x, UInt32 y, UInt32 freq,␊ |
93 | ␉␉␉␉ unsigned long *clock,␊ |
94 | ␉␉␉␉ UInt16 *hsyncstart, UInt16 *hsyncend, UInt16 *hblank,␊ |
95 | ␉␉␉␉ UInt16 *vsyncstart, UInt16 *vsyncend, UInt16 *vblank);␊ |
96 | ␊ |
97 | void cvt_timings(UInt32 x, UInt32 y, UInt32 freq,␊ |
98 | ␉␉␉␉ unsigned long *clock,␊ |
99 | ␉␉␉␉ UInt16 *hsyncstart, UInt16 *hsyncend, UInt16 *hblank,␊ |
100 | ␉␉␉␉ UInt16 *vsyncstart, UInt16 *vsyncend, UInt16 *vblank, bool reduced);␊ |
101 | ␊ |
102 | void patch_vbios(vbios_map*, UInt32, UInt32, UInt32, UInt32, UInt32);␊ |
103 | ␊ |
104 | #endif␊ |
105 | |