blob: 6bf891c87516d0eea1096622ef4cae28d36e8c2b [file] [log] [blame]
Werner Zehc42a6132015-02-12 12:40:15 +01001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2014 Siemens AG
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Werner Zehc42a6132015-02-12 12:40:15 +010014 */
15
16#ifndef _MODHWINFO_H_
17#define _MODHWINFO_H_
18
19#include <types.h>
20
21#define LEN_MAGIC_NUM 8
22#define LEN_MLFB 20
23#define LEN_SERIAL_NUM 16
24#define LEN_HW_REVISION 2
25#define LEN_MAC_ADDRESS 6
26#define LEN_SPD 128
27#define NUMBER_OF_MAC_ADDR 4
28#define LEN_EDID 128
29#define LEN_MAIN_HWINFO 509
30#define LEN_SHORT_INFO 289
31#define LEN_EDID_INFO 181
32#define NEXT_OFFSET_HWINFO 476
33#define NEXT_OFFSET_SIB 260
34#define NEXT_OFFSET_EDID 176
35#define HWI_LEN_OFFSET 12
36
37/* Define some masks and values */
38#define SIB_HWINIT_IDX 0x0e
39#define SIB_COLOR_6BIT 0x00
40#define SIB_COLOR_8BIT 0x01
41#define SIB_COLOR_10BIT 0x02
42#define SIB_DISP_CON_IDX 0x16
43#define SIB_LVDS_SINGLE_LANE 0x00
44#define SIB_LVDS_DUAL_LANE 0x05
45
46struct PhysDevStruc {
47 u8 bustype;
48 u8 devfn;
49 u16 bus;
50} __attribute__ ((packed));
51
52
53struct hwinfo {
54// Offset 0x0
55 char magicNumber[LEN_MAGIC_NUM];
56// Offset 0x08
57 u8 versionID[4];
58// Offset 0x0c
59 u16 length;
60// Offset 0x0e
61 char BGR_Name[128];
62//Offset 0x8e
63 char MLFB[LEN_MLFB];
64// Offset 0xa2
65 u8 uniqueNumber[16];
66// Offset 0xb2
67 u8 fill_1[12];
68// Offset 0xbe
69 u8 hwRevision[LEN_HW_REVISION];
70//Offset 0xc0
71 u8 macAddress1[LEN_MAC_ADDRESS];
72 u8 numOfAuxMacAddr1;
73 u8 fill_2;
74//Offset 0xc8
75 u8 macAddress2[LEN_MAC_ADDRESS];
76 u8 numOfAuxMacAddr2;
77 u8 fill_3;
78//Offset 0xd0
79 u8 macAddress3[LEN_MAC_ADDRESS];
80 u8 numOfAuxMacAddr3;
81 u8 fill_4;
82//Offset 0xd8
83 u8 macAddress4[LEN_MAC_ADDRESS];
84 u8 numOfAuxMacAddr4;
85 u8 fill_5;
86// Offset 0xe0
87 u8 SPD[LEN_SPD];
88// Offset 0x160
89 u8 fill_6[88];
90// Offset 0x1b8
91 u32 featureFlags;
92// Offset 0x1bc
93 u8 fill_7[4];
94// Offset 0x1c0
95 u32 biosFlags;
96// Offset 0x1c4
97 u8 fill_8[8];
98//Offset 0x1cc
99 struct PhysDevStruc etherDev[NUMBER_OF_MAC_ADDR];
100// Offset 0x1dc
101 s32 nextInfoOffset;
102// Offset 0x1e0
103 u8 fill_9[4];
104// Offset 0x1e4
105 u32 portRTC;
106// Offset 0x1e8
107 u8 typeRTC;
108// Offset 0x1e9
109 u8 fill_10[20];
110} __attribute__ ((packed));
111
112struct shortinfo {
113// Offset 0x0
114 char magicNumber[LEN_MAGIC_NUM];
115// Offset 0x08
116 u8 versionID[4];
117// Offset 0x0c
118 u16 length;
119// Offset 0x0e
120 char BGR_Name[128];
121//Offset 0x8e
122 char MLFB[LEN_MLFB];
123// Offset 0xa2
124 u8 uniqueNumber[26];
125// Offset 0xbc
126 u8 fill_1[12];
127//Offset 0xc8
128 u8 hwRevision[2];
129// Offset 0xca
130 u8 fill_2[18];
131// Offset 0xdc
132 u8 panelFeatures[32];
133// Offset 0xfc
134 u8 fill_3[8];
135// Offset 0x104
136 s32 nextInfoOffset;
137// Offset 0x108
138 u8 fill_4[25];
139} __attribute__ ((packed));
140
141struct edidinfo {
142// Offset 0x0
143 char magicNumber[LEN_MAGIC_NUM];
144// Offset 0x08
145 u8 versionID[4];
146// Offset 0x0c
147 u16 length;
148// Offset 0x0e
149 u8 fill_1[2];
150// Offset 0x10
151 u8 edid[LEN_EDID];
152// Offset 0x90
153 u8 fill_2[32];
154// Offset 0xb0
155 s32 nextInfoOffset;
156// Offset 0xb4
157 u8 fill_3;
158} __attribute__ ((packed));
159
160u8* get_first_linked_block(char *filename, u8 **starting_adr);
161struct hwinfo* get_hwinfo(char *filename);
162struct shortinfo* get_shortinfo(char *filename);
163struct edidinfo* get_edidinfo(char *filename);
164enum cb_err mainboard_get_mac_address(u16 bus, u8 devfn, u8 mac[6]);
165
166#endif /* _MODHWINFO_H_ */