|
1 /* |
|
2 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. |
|
3 * |
|
4 * Permission is hereby granted, free of charge, to any person obtaining a |
|
5 * copy of this software and associated documentation files (the "Software"), |
|
6 * to deal in the Software without restriction, including without limitation |
|
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
|
8 * and/or sell copies of the Software, and to permit persons to whom the |
|
9 * Software is furnished to do so, subject to the following conditions: |
|
10 * |
|
11 * The above copyright notice and this permission notice (including the next |
|
12 * paragraph) shall be included in all copies or substantial portions of the |
|
13 * Software. |
|
14 * |
|
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
|
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
|
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
|
21 * DEALINGS IN THE SOFTWARE. |
|
22 */ |
|
23 |
|
24 #ifndef _GFX_COMMON_H |
|
25 #define _GFX_COMMON_H |
|
26 |
|
27 #include <sys/types.h> |
|
28 |
|
29 #define GFXIOC ('g' << 8) |
|
30 |
|
31 #define GFX_IOCTL_GET_IDENTIFIER (GFXIOC | 1) |
|
32 #define GFX_IOCTL_GET_CURRENT_VIDEO_MODE (GFXIOC | 2) |
|
33 #define GFX_IOCTL_GET_PCI_CONFIG (GFXIOC | 3) |
|
34 #define GFX_IOCTL_SET_VIDEO_MODE (GFXIOC | 4) |
|
35 #define GFX_IOCTL_GET_EDID_LENGTH (GFXIOC | 5) |
|
36 #define GFX_IOCTL_GET_EDID (GFXIOC | 6) |
|
37 |
|
38 #define GFX_MAX_MODELNAME_LEN 36 |
|
39 #define GFX_MAX_PARTNUM_LEN 36 |
|
40 #define GFX_MAX_VMODE_LEN 48 |
|
41 |
|
42 #define GFX_IDENT_VERSION 1 |
|
43 #define GFX_IDENT_MODELNAME 0x01 |
|
44 #define GFX_IDENT_PARTNUM 0x02 |
|
45 |
|
46 #define GFX_EDID_VERSION 1 |
|
47 #define GFX_EDID_BLOCK_SIZE 128 |
|
48 #define GFX_EDID_HEAD_ONE 1 |
|
49 #define GFX_EDID_HEAD_TWO 2 |
|
50 #define GFX_EDID_HEAD_THREE 3 |
|
51 #define GFX_EDID_HEAD_FOUR 4 |
|
52 |
|
53 |
|
54 typedef struct gfx_identifier { |
|
55 uint32_t version; |
|
56 uint32_t flags; |
|
57 char model_name[GFX_MAX_MODELNAME_LEN]; |
|
58 char part_number[GFX_MAX_PARTNUM_LEN]; |
|
59 char pad[100]; |
|
60 } gfx_identifier_t; |
|
61 |
|
62 |
|
63 typedef struct gfx_video_mode { |
|
64 char mode_name[GFX_MAX_VMODE_LEN]; |
|
65 uint32_t vRefresh; |
|
66 char pad[96]; |
|
67 } gfx_video_mode_t; |
|
68 |
|
69 |
|
70 typedef struct gfx_pci_cfg { |
|
71 uint16_t VendorID; |
|
72 uint16_t DeviceID; |
|
73 uint16_t Command; |
|
74 uint16_t Status; |
|
75 uint8_t RevisionID; |
|
76 uint8_t ProgIF; |
|
77 uint8_t SubClass; |
|
78 uint8_t BaseClass; |
|
79 |
|
80 uint8_t CacheLineSize; |
|
81 uint8_t LatencyTimer; |
|
82 uint8_t HeaderType; |
|
83 uint8_t BIST; |
|
84 |
|
85 uint32_t bar[6]; |
|
86 uint32_t CIS; |
|
87 uint16_t SubVendorID; |
|
88 uint16_t SubSystemID; |
|
89 uint32_t ROMBaseAddress; |
|
90 |
|
91 uint8_t CapabilitiesPtr; |
|
92 uint8_t Reserved_1[3]; |
|
93 uint32_t Reserved_2; |
|
94 |
|
95 uint8_t InterruptLine; |
|
96 uint8_t InterruptPin; |
|
97 uint8_t MinimumGrant; |
|
98 uint8_t MaximumLatency; |
|
99 |
|
100 uint8_t pad[100]; |
|
101 } gfx_pci_cfg_t; |
|
102 |
|
103 |
|
104 typedef struct gfx_edid { |
|
105 uint32_t version; |
|
106 uint32_t head; |
|
107 #ifndef _LP64 |
|
108 uint32_t pad; |
|
109 #endif |
|
110 caddr_t data; /* pointer to the buffer that receives data */ |
|
111 uint32_t length; /* length of the buffer. */ |
|
112 } gfx_edid_t; |
|
113 |
|
114 #endif /* _GFX_COMMON_H */ |
|
115 |
|
116 |