Friday, September 26, 2008

Many changes

Many changes were made tonight, with quite a few exciting new bits of functionality. But, before I go into detail on any of those, let me start off with this:

[    3.193058] e100: eth0: e100_probe: addr 0xfbfff000, irq 10, MAC addr 00:02:b3:36:7d:72
[ 3.193229] 3c59x 0000:02:0c.0: enabling device (0000 -> 0003)
[ 3.193300] PCI: Found IRQ 11 for device 0000:02:0c.0
[ 3.193386] 3c59x: Donald Becker and others.
[ 3.193451] 0000:02:0c.0: 3Com PCI 3c905C Tornado at e0814000.
[ 3.314350] *** EEPROM MAC address is invalid.
[ 3.314411] 3c59x: vortex_probe1 fails. Returns -22
[ 3.314479] 3c59x: probe of 0000:02:0c.0 failed with error -22


We have, indeed, successfully bothered the 3c905 network card to cause it to go away and get off our bus. It wasn't the cleanest solution, but it did work. It turns out that if you set the BARs on a card to garbage, Linux will set them to non-garbage on card probe, and since we can't trap on 0xCF8/0xCFC accesses, those were *two* of the methods that we planned to use to bother this card gone. But, Linux will surely listen to you if you ask often enough; so, we asked the card every 64msec to stop responding to requests. This creates a race; it had better be the case that Linux does PCI enumeration more than 64msec before it loads the 3c905 driver, or else we will be hosed.

I'm not sure if there is a clean way to do this; suggestions would be appreciated. This works, at least, for the time being.

There were many more things that happened tonight, though. In particular:

  • SMI handlers now have enable routines -- instead of poking the hardware directly, you can smi_register_handler(...); smi_enable_event(...);. Much cleaner code, much more portable.
  • Structured packet support was added. If you put some magic values in the registers, then poke the GBL_RLS (BIOS request) bit on the southbridge like an ACPI handler would do, then you can make requests of NetWatch. You can even give it a logical address, and it'll do lookups just as if it were the kernel! Blame Jacob for that... ;)
  • We can now scan and probe devices on the PCI bus, with a relatively abstract method.
  • Output routines were unified -- now instead of deciding whether to call puts or dolog, you can call the function pointers output and its formatted friend, outputf and you'll get the Right Thing no matter whether you are in the loader or the aseg code itself.


The code is now much cleaner, and more extensible. Look forward to lwIP coming this weekend, or at least a small network driver.

No comments: