Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 307092
b: refs/heads/master
c: b4aa016
h: refs/heads/master
v: v3
  • Loading branch information
Matthew Garrett authored and Dave Airlie committed Apr 24, 2012
1 parent 8bc5e79 commit 5518be5
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 88674088d10ca2538b2efd2559f6620ade8ec373
refs/heads/master: b4aa0163056b6c70029b6e8619ce07c274351f42
6 changes: 6 additions & 0 deletions trunk/arch/x86/include/asm/vga.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,10 @@
#define vga_readb(x) (*(x))
#define vga_writeb(x, y) (*(y) = (x))

#ifdef CONFIG_FB_EFI
#define __ARCH_HAS_VGA_DEFAULT_DEVICE
extern struct pci_dev *vga_default_device(void);
extern void vga_set_default_device(struct pci_dev *pdev);
#endif

#endif /* _ASM_X86_VGA_H */
77 changes: 57 additions & 20 deletions trunk/drivers/video/efifb.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

static bool request_mem_succeeded = false;

static struct pci_dev *default_vga;

static struct fb_var_screeninfo efifb_defined __devinitdata = {
.activate = FB_ACTIVATE_NOW,
.height = -1,
Expand Down Expand Up @@ -298,35 +300,70 @@ static struct fb_ops efifb_ops = {
.fb_imageblit = cfb_imageblit,
};

struct pci_dev *vga_default_device(void)
{
return default_vga;
}

void vga_set_default_device(struct pci_dev *pdev)
{
default_vga = pdev;
}

static int __init efifb_setup(char *options)
{
char *this_opt;
int i;
struct pci_dev *dev = NULL;

if (options && *options) {
while ((this_opt = strsep(&options, ",")) != NULL) {
if (!*this_opt) continue;

for (i = 0; i < M_UNKNOWN; i++) {
if (!strcmp(this_opt, dmi_list[i].optname) &&
dmi_list[i].base != 0) {
screen_info.lfb_base = dmi_list[i].base;
screen_info.lfb_linelength = dmi_list[i].stride;
screen_info.lfb_width = dmi_list[i].width;
screen_info.lfb_height = dmi_list[i].height;
}
}
if (!strncmp(this_opt, "base:", 5))
screen_info.lfb_base = simple_strtoul(this_opt+5, NULL, 0);
else if (!strncmp(this_opt, "stride:", 7))
screen_info.lfb_linelength = simple_strtoul(this_opt+7, NULL, 0) * 4;
else if (!strncmp(this_opt, "height:", 7))
screen_info.lfb_height = simple_strtoul(this_opt+7, NULL, 0);
else if (!strncmp(this_opt, "width:", 6))
screen_info.lfb_width = simple_strtoul(this_opt+6, NULL, 0);
}
}

if (!options || !*options)
return 0;
for_each_pci_dev(dev) {
int i;

while ((this_opt = strsep(&options, ",")) != NULL) {
if (!*this_opt) continue;
if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
continue;

for (i = 0; i < M_UNKNOWN; i++) {
if (!strcmp(this_opt, dmi_list[i].optname) &&
dmi_list[i].base != 0) {
screen_info.lfb_base = dmi_list[i].base;
screen_info.lfb_linelength = dmi_list[i].stride;
screen_info.lfb_width = dmi_list[i].width;
screen_info.lfb_height = dmi_list[i].height;
}
for (i=0; i < DEVICE_COUNT_RESOURCE; i++) {
resource_size_t start, end;

if (!(pci_resource_flags(dev, i) & IORESOURCE_MEM))
continue;

start = pci_resource_start(dev, i);
end = pci_resource_end(dev, i);

if (!start || !end)
continue;

if (screen_info.lfb_base >= start &&
(screen_info.lfb_base + screen_info.lfb_size) < end)
default_vga = dev;
}
if (!strncmp(this_opt, "base:", 5))
screen_info.lfb_base = simple_strtoul(this_opt+5, NULL, 0);
else if (!strncmp(this_opt, "stride:", 7))
screen_info.lfb_linelength = simple_strtoul(this_opt+7, NULL, 0) * 4;
else if (!strncmp(this_opt, "height:", 7))
screen_info.lfb_height = simple_strtoul(this_opt+7, NULL, 0);
else if (!strncmp(this_opt, "width:", 6))
screen_info.lfb_width = simple_strtoul(this_opt+6, NULL, 0);
}

return 0;
}

Expand Down

0 comments on commit 5518be5

Please sign in to comment.