diff options
author | Stephen Hemminger <shemminger@linux-foundation.org> | 2008-08-27 23:48:23 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-09-03 10:23:58 -0400 |
commit | c844d483004df596b0bd6e68a3be8e0cd85536ce (patch) | |
tree | bf86650d8d43e79aff88171e9afa533ed6afde06 /drivers | |
parent | 1413235c14301c4bd27aabf408e4336719b6f505 (diff) |
sky2: display product info on boot.
Change bootup messages to print more information. This is to help users
who may have old buggy EEPROM image.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/sky2.c | 73 |
1 files changed, 69 insertions, 4 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 4e3e2a37c3d1..3805b9318be7 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -4191,6 +4191,69 @@ static int __devinit pci_wake_enabled(struct pci_dev *dev) | |||
4191 | return value & PCI_PM_CTRL_PME_ENABLE; | 4191 | return value & PCI_PM_CTRL_PME_ENABLE; |
4192 | } | 4192 | } |
4193 | 4193 | ||
4194 | /* | ||
4195 | * Read and parse the first part of Vital Product Data | ||
4196 | */ | ||
4197 | #define VPD_SIZE 128 | ||
4198 | #define VPD_MAGIC 0x82 | ||
4199 | |||
4200 | static void __devinit sky2_vpd_info(struct sky2_hw *hw) | ||
4201 | { | ||
4202 | int cap = pci_find_capability(hw->pdev, PCI_CAP_ID_VPD); | ||
4203 | const u8 *p; | ||
4204 | u8 *vpd_buf = NULL; | ||
4205 | u16 len; | ||
4206 | static struct vpd_tag { | ||
4207 | char tag[2]; | ||
4208 | char *label; | ||
4209 | } vpd_tags[] = { | ||
4210 | { "PN", "Part Number" }, | ||
4211 | { "EC", "Engineering Level" }, | ||
4212 | { "MN", "Manufacturer" }, | ||
4213 | }; | ||
4214 | |||
4215 | if (!cap) | ||
4216 | goto out; | ||
4217 | |||
4218 | vpd_buf = kmalloc(VPD_SIZE, GFP_KERNEL); | ||
4219 | if (!vpd_buf) | ||
4220 | goto out; | ||
4221 | |||
4222 | if (sky2_vpd_read(hw, cap, vpd_buf, 0, VPD_SIZE)) | ||
4223 | goto out; | ||
4224 | |||
4225 | if (vpd_buf[0] != VPD_MAGIC) | ||
4226 | goto out; | ||
4227 | len = vpd_buf[1]; | ||
4228 | if (len == 0 || len > VPD_SIZE - 4) | ||
4229 | goto out; | ||
4230 | p = vpd_buf + 3; | ||
4231 | dev_info(&hw->pdev->dev, "%.*s\n", len, p); | ||
4232 | p += len; | ||
4233 | |||
4234 | while (p < vpd_buf + VPD_SIZE - 4) { | ||
4235 | int i; | ||
4236 | |||
4237 | if (!memcmp("RW", p, 2)) /* end marker */ | ||
4238 | break; | ||
4239 | |||
4240 | len = p[2]; | ||
4241 | if (len > (p - vpd_buf) - 4) | ||
4242 | break; | ||
4243 | |||
4244 | for (i = 0; i < ARRAY_SIZE(vpd_tags); i++) { | ||
4245 | if (!memcmp(vpd_tags[i].tag, p, 2)) { | ||
4246 | printk(KERN_DEBUG " %s: %.*s\n", | ||
4247 | vpd_tags[i].label, len, p + 3); | ||
4248 | break; | ||
4249 | } | ||
4250 | } | ||
4251 | p += len + 3; | ||
4252 | } | ||
4253 | out: | ||
4254 | kfree(vpd_buf); | ||
4255 | } | ||
4256 | |||
4194 | /* This driver supports yukon2 chipset only */ | 4257 | /* This driver supports yukon2 chipset only */ |
4195 | static const char *sky2_name(u8 chipid, char *buf, int sz) | 4258 | static const char *sky2_name(u8 chipid, char *buf, int sz) |
4196 | { | 4259 | { |
@@ -4289,13 +4352,13 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
4289 | if (err) | 4352 | if (err) |
4290 | goto err_out_iounmap; | 4353 | goto err_out_iounmap; |
4291 | 4354 | ||
4292 | dev_info(&pdev->dev, "v%s addr 0x%llx irq %d Yukon-2 %s rev %d\n", | 4355 | dev_info(&pdev->dev, "Yukon-2 %s chip revision %d\n", |
4293 | DRV_VERSION, (unsigned long long)pci_resource_start(pdev, 0), | 4356 | sky2_name(hw->chip_id, buf1, sizeof(buf1)), hw->chip_rev); |
4294 | pdev->irq, sky2_name(hw->chip_id, buf1, sizeof(buf1)), | ||
4295 | hw->chip_rev); | ||
4296 | 4357 | ||
4297 | sky2_reset(hw); | 4358 | sky2_reset(hw); |
4298 | 4359 | ||
4360 | sky2_vpd_info(hw); | ||
4361 | |||
4299 | dev = sky2_init_netdev(hw, 0, using_dac, wol_default); | 4362 | dev = sky2_init_netdev(hw, 0, using_dac, wol_default); |
4300 | if (!dev) { | 4363 | if (!dev) { |
4301 | err = -ENOMEM; | 4364 | err = -ENOMEM; |
@@ -4546,6 +4609,8 @@ static struct pci_driver sky2_driver = { | |||
4546 | 4609 | ||
4547 | static int __init sky2_init_module(void) | 4610 | static int __init sky2_init_module(void) |
4548 | { | 4611 | { |
4612 | pr_info(PFX "driver version " DRV_VERSION "\n"); | ||
4613 | |||
4549 | sky2_debug_init(); | 4614 | sky2_debug_init(); |
4550 | return pci_register_driver(&sky2_driver); | 4615 | return pci_register_driver(&sky2_driver); |
4551 | } | 4616 | } |