Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 8501
b: refs/heads/master
c: ce1289a
h: refs/heads/master
i:
  8499: f375afd
v: v3
  • Loading branch information
Willy Tarreau authored and Linus Torvalds committed Sep 11, 2005
1 parent d0fa154 commit 23bd98f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 27 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: 4120b028dd231743935d954732045a87edda2a0a
refs/heads/master: ce1289adeb67b5480f35cb257cbf6e9881153783
43 changes: 17 additions & 26 deletions trunk/drivers/net/sunhme.c
Original file line number Diff line number Diff line change
Expand Up @@ -2954,7 +2954,7 @@ static int is_quattro_p(struct pci_dev *pdev)
}

/* Fetch MAC address from vital product data of PCI ROM. */
static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsigned char *dev_addr)
static int find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, unsigned char *dev_addr)
{
int this_offset;

Expand All @@ -2977,42 +2977,33 @@ static void find_eth_addr_in_vpd(void __iomem *rom_base, int len, int index, uns

for (i = 0; i < 6; i++)
dev_addr[i] = readb(p + i);
break;
return 1;
}
index--;
}
return 0;
}

static void get_hme_mac_nonsparc(struct pci_dev *pdev, unsigned char *dev_addr)
{
u32 rom_reg_orig;
void __iomem *p;
int index;
size_t size;
void __iomem *p = pci_map_rom(pdev, &size);

index = 0;
if (is_quattro_p(pdev))
index = PCI_SLOT(pdev->devfn);

if (pdev->resource[PCI_ROM_RESOURCE].parent == NULL) {
if (pci_assign_resource(pdev, PCI_ROM_RESOURCE) < 0)
goto use_random;
}
if (p) {
int index = 0;
int found;

pci_read_config_dword(pdev, pdev->rom_base_reg, &rom_reg_orig);
pci_write_config_dword(pdev, pdev->rom_base_reg,
rom_reg_orig | PCI_ROM_ADDRESS_ENABLE);
if (is_quattro_p(pdev))
index = PCI_SLOT(pdev->devfn);

p = ioremap(pci_resource_start(pdev, PCI_ROM_RESOURCE), (64 * 1024));
if (p != NULL && readb(p) == 0x55 && readb(p + 1) == 0xaa)
find_eth_addr_in_vpd(p, (64 * 1024), index, dev_addr);

if (p != NULL)
iounmap(p);

pci_write_config_dword(pdev, pdev->rom_base_reg, rom_reg_orig);
return;
found = readb(p) == 0x55 &&
readb(p + 1) == 0xaa &&
find_eth_addr_in_vpd(p, (64 * 1024), index, dev_addr);
pci_unmap_rom(pdev, p);
if (found)
return;
}

use_random:
/* Sun MAC prefix then 3 random bytes. */
dev_addr[0] = 0x08;
dev_addr[1] = 0x00;
Expand Down

0 comments on commit 23bd98f

Please sign in to comment.