64
67
M_MBP_6_1, /* MacBook Pro, 6,1th gen */
65
68
M_MBP_6_2, /* MacBook Pro, 6,2th gen */
66
69
M_MBP_7_1, /* MacBook Pro, 7,1th gen */
70
M_MBP_8_2, /* MacBook Pro, 8,2nd gen */
67
71
M_UNKNOWN /* placeholder */
74
#define OVERRIDE_NONE 0x0
75
#define OVERRIDE_BASE 0x1
76
#define OVERRIDE_STRIDE 0x2
77
#define OVERRIDE_HEIGHT 0x4
78
#define OVERRIDE_WIDTH 0x8
70
80
static struct efifb_dmi_info {
72
82
unsigned long base;
76
87
} dmi_list[] __initdata = {
77
[M_I17] = { "i17", 0x80010000, 1472 * 4, 1440, 900 },
78
[M_I20] = { "i20", 0x80010000, 1728 * 4, 1680, 1050 }, /* guess */
79
[M_I20_SR] = { "imac7", 0x40010000, 1728 * 4, 1680, 1050 },
80
[M_I24] = { "i24", 0x80010000, 2048 * 4, 1920, 1200 }, /* guess */
81
[M_I24_8_1] = { "imac8", 0xc0060000, 2048 * 4, 1920, 1200 },
82
[M_I24_10_1] = { "imac10", 0xc0010000, 2048 * 4, 1920, 1080 },
83
[M_I27_11_1] = { "imac11", 0xc0010000, 2560 * 4, 2560, 1440 },
84
[M_MINI]= { "mini", 0x80000000, 2048 * 4, 1024, 768 },
85
[M_MINI_3_1] = { "mini31", 0x40010000, 1024 * 4, 1024, 768 },
86
[M_MINI_4_1] = { "mini41", 0xc0010000, 2048 * 4, 1920, 1200 },
87
[M_MB] = { "macbook", 0x80000000, 2048 * 4, 1280, 800 },
88
[M_MB_5_1] = { "macbook51", 0x80010000, 2048 * 4, 1280, 800 },
89
[M_MB_6_1] = { "macbook61", 0x80010000, 2048 * 4, 1280, 800 },
90
[M_MB_7_1] = { "macbook71", 0x80010000, 2048 * 4, 1280, 800 },
91
[M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800 },
92
[M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900 },
93
[M_MBP_2] = { "mbp2", 0, 0, 0, 0 }, /* placeholder */
94
[M_MBP_2_2] = { "mbp22", 0x80010000, 1472 * 4, 1440, 900 },
95
[M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900 },
96
[M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200 },
97
[M_MBP_5_1] = { "mbp51", 0xc0010000, 2048 * 4, 1440, 900 },
98
[M_MBP_5_2] = { "mbp52", 0xc0010000, 2048 * 4, 1920, 1200 },
99
[M_MBP_5_3] = { "mbp53", 0xd0010000, 2048 * 4, 1440, 900 },
100
[M_MBP_6_1] = { "mbp61", 0x90030000, 2048 * 4, 1920, 1200 },
101
[M_MBP_6_2] = { "mbp62", 0x90030000, 2048 * 4, 1680, 1050 },
102
[M_MBP_7_1] = { "mbp71", 0xc0010000, 2048 * 4, 1280, 800 },
103
[M_UNKNOWN] = { NULL, 0, 0, 0, 0 }
88
[M_I17] = { "i17", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
89
[M_I20] = { "i20", 0x80010000, 1728 * 4, 1680, 1050, OVERRIDE_NONE }, /* guess */
90
[M_I20_SR] = { "imac7", 0x40010000, 1728 * 4, 1680, 1050, OVERRIDE_NONE },
91
[M_I24] = { "i24", 0x80010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE }, /* guess */
92
[M_I24_8_1] = { "imac8", 0xc0060000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
93
[M_I24_10_1] = { "imac10", 0xc0010000, 2048 * 4, 1920, 1080, OVERRIDE_NONE },
94
[M_I27_11_1] = { "imac11", 0xc0010000, 2560 * 4, 2560, 1440, OVERRIDE_NONE },
95
[M_MINI]= { "mini", 0x80000000, 2048 * 4, 1024, 768, OVERRIDE_NONE },
96
[M_MINI_3_1] = { "mini31", 0x40010000, 1024 * 4, 1024, 768, OVERRIDE_NONE },
97
[M_MINI_4_1] = { "mini41", 0xc0010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
98
[M_MB] = { "macbook", 0x80000000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
99
[M_MB_5_1] = { "macbook51", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
100
[M_MB_6_1] = { "macbook61", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
101
[M_MB_7_1] = { "macbook71", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
102
[M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
103
/* 11" Macbook Air 3,1 passes the wrong stride */
104
[M_MBA_3] = { "mba3", 0, 2048 * 4, 0, 0, OVERRIDE_STRIDE },
105
[M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
106
[M_MBP_2] = { "mbp2", 0, 0, 0, 0, OVERRIDE_NONE }, /* placeholder */
107
[M_MBP_2_2] = { "mbp22", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
108
[M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
109
[M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
110
[M_MBP_5_1] = { "mbp51", 0xc0010000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
111
[M_MBP_5_2] = { "mbp52", 0xc0010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
112
[M_MBP_5_3] = { "mbp53", 0xd0010000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
113
[M_MBP_6_1] = { "mbp61", 0x90030000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
114
[M_MBP_6_2] = { "mbp62", 0x90030000, 2048 * 4, 1680, 1050, OVERRIDE_NONE },
115
[M_MBP_7_1] = { "mbp71", 0xc0010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
116
[M_MBP_8_2] = { "mbp82", 0x90010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
117
[M_UNKNOWN] = { NULL, 0, 0, 0, 0, OVERRIDE_NONE }
106
120
static int set_system(const struct dmi_system_id *id);
151
166
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro6,1", M_MBP_6_1),
152
167
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro6,2", M_MBP_6_2),
153
168
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro7,1", M_MBP_7_1),
169
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro8,2", M_MBP_8_2),
173
#define choose_value(dmivalue, fwvalue, field, flags) ({ \
174
typeof(fwvalue) _ret_ = fwvalue; \
175
if ((flags) & (field)) \
177
else if ((fwvalue) == 0) \
157
182
static int set_system(const struct dmi_system_id *id)
159
184
struct efifb_dmi_info *info = id->driver_data;
186
if (info->base == 0 && info->height == 0 && info->width == 0
187
&& info->stride == 0)
163
printk(KERN_INFO "efifb: dmi detected %s - framebuffer at %p "
164
"(%dx%d, stride %d)\n", id->ident,
165
(void *)info->base, info->width, info->height,
168
190
/* Trust the bootloader over the DMI tables */
169
191
if (screen_info.lfb_base == 0) {
170
192
#if defined(CONFIG_PCI)
171
193
struct pci_dev *dev = NULL;
172
194
int found_bar = 0;
174
screen_info.lfb_base = info->base;
197
screen_info.lfb_base = choose_value(info->base,
198
screen_info.lfb_base, OVERRIDE_BASE,
176
201
#if defined(CONFIG_PCI)
177
/* make sure that the address in the table is actually on a
178
* VGA device's PCI BAR */
180
for_each_pci_dev(dev) {
182
if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
184
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
185
resource_size_t start, end;
187
start = pci_resource_start(dev, i);
190
end = pci_resource_end(dev, i);
191
if (screen_info.lfb_base >= start &&
192
screen_info.lfb_base < end) {
202
/* make sure that the address in the table is actually
203
* on a VGA device's PCI BAR */
205
for_each_pci_dev(dev) {
207
if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
209
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
210
resource_size_t start, end;
212
start = pci_resource_start(dev, i);
215
end = pci_resource_end(dev, i);
216
if (screen_info.lfb_base >= start &&
217
screen_info.lfb_base < end) {
223
screen_info.lfb_base = 0;
198
screen_info.lfb_base = 0;
201
227
if (screen_info.lfb_base) {
202
if (screen_info.lfb_linelength == 0)
203
screen_info.lfb_linelength = info->stride;
204
if (screen_info.lfb_width == 0)
205
screen_info.lfb_width = info->width;
206
if (screen_info.lfb_height == 0)
207
screen_info.lfb_height = info->height;
228
screen_info.lfb_linelength = choose_value(info->stride,
229
screen_info.lfb_linelength, OVERRIDE_STRIDE,
231
screen_info.lfb_width = choose_value(info->width,
232
screen_info.lfb_width, OVERRIDE_WIDTH,
234
screen_info.lfb_height = choose_value(info->height,
235
screen_info.lfb_height, OVERRIDE_HEIGHT,
208
237
if (screen_info.orig_video_isVGA == 0)
209
238
screen_info.orig_video_isVGA = VIDEO_TYPE_EFI;