Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 14382
b: refs/heads/master
c: b341e32
h: refs/heads/master
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Paul Mackerras committed Nov 17, 2005
1 parent 848a2d8 commit 99797cd
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 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: 1e28a7ddd3e713384e9c6768e7c502031dc205e2
refs/heads/master: b341e32e5cc1a154cb0ac2f4229c2d040647804b
40 changes: 35 additions & 5 deletions trunk/drivers/video/offb.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,8 @@ static void __init offb_init_nodriver(struct device_node *dp)
int *pp, i;
unsigned int len;
int width = 640, height = 480, depth = 8, pitch;
unsigned *up;
unsigned long address;
unsigned int rsize, *up;
unsigned long address = 0;

if ((pp = (int *) get_property(dp, "depth", &len)) != NULL
&& len == sizeof(int))
Expand All @@ -344,10 +344,40 @@ static void __init offb_init_nodriver(struct device_node *dp)
pitch = 0x1000;
} else
pitch = width;
if ((up = (unsigned *) get_property(dp, "address", &len)) != NULL
&& len == sizeof(unsigned))

rsize = (unsigned long)pitch * (unsigned long)height *
(unsigned long)(depth / 8);

/* Try to match device to a PCI device in order to get a properly
* translated address rather then trying to decode the open firmware
* stuff in various incorrect ways
*/
#ifdef CONFIG_PCI
/* First try to locate the PCI device if any */
{
struct pci_dev *pdev = NULL;

for_each_pci_dev(pdev) {
if (dp == pci_device_to_OF_node(pdev))
break;
}
if (pdev) {
for (i = 0; i < 6 && address == 0; i++) {
if ((pci_resource_flags(pdev, i) &
IORESOURCE_MEM) &&
(pci_resource_len(pdev, i) >= rsize))
address = pci_resource_start(pdev, i);
}
pci_dev_put(pdev);
}
}
#endif /* CONFIG_PCI */

if (address == 0 &&
(up = (unsigned *) get_property(dp, "address", &len)) != NULL &&
len == sizeof(unsigned))
address = (u_long) * up;
else {
if (address == 0) {
for (i = 0; i < dp->n_addrs; ++i)
if (dp->addrs[i].size >=
pitch * height * depth / 8)
Expand Down

0 comments on commit 99797cd

Please sign in to comment.