3c59x: read eeprom

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Adek336

3c59x: read eeprom

Post by Adek336 »

Hi! :)

I can find my 3c556 hurragane nic pci bus and device no and it's io base addr. I found out that the following pseudo-code should return 0x6055, the deviceid:

Code: Select all

 Set-Active-Register-Window ( 0 ) ; // outw ( 1<<11 + 0, baseaddr + 0xe)
 Ensure-EepromCommand-Not-Busy () ; // wait for bit 15 in inw ( baseaddr + 0xa ) to clear
 Write-To-Register-By-IO ( reg_Eeprom_Command, cmdReadEeprom + offsetEeprom_DeviceId ); // outw ( 1<<7 + 3, baseaddr + 0xa);
 Ensure-EepromCommand-Not-Busy () ; // wait for bit 15 in inw ( baseaddr + 0xa ) to clear
  Read-From-Register-By-Io ( reg_Eeprom_Data , &foo); //foo = inw ( baseaddr + 0xc );
foo gets filled with 0xffff. Do I need to initialize the card prior to reading eeprom?

I followed sample drivers like
http://koders.com/c/fidF4DF59676417BEC5C1810CBB42F1CE37D5C30640.aspx?s=3c59x
http://koders.com/c/fidF032F73835297E3B6018361AB99075FE9753E884.aspx?s=3c90x

And specifications
http://www.italios.it/oslib/3c90xb.zip
http://www.italios.it/oslib/3c90xc.zip
http://www.italios.it/oslib/3c59x.zip

Having in mind, that 3c556, 3c90x, 3c90xb, 3c90xc, 3c59x are somewhat compatible.

Cheers :)

[edit] It seems I fail to SelectRegisterWindow using pci32 routines.. The IntStatus register tells me that I'm always on window #0.
Adek336

Re:3c59x: read eeprom

Post by Adek336 »

8)
I'm so cool, I found out the problem.
It occurs, that EepromRead on a 3c556 chipset is value 0x230 and is not value 0x80 as on 3c59x and 3c90x.
http://lists.gnu.org/archive/html/bug-hurd/2004-02/msg00173.html

Anyways, it seems that the 3c556 card is a seldom choice for osdevers.
Cheers.

I'm so proud with succeeding to read my nic's eeprom I think I'll make a wiki entry for it :)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:3c59x: read eeprom

Post by Pype.Clicker »

just to make sure i got what's in balance here, what so useful is there to be read in that chip's eeprom ?
Adek336

Re:3c59x: read eeprom

Post by Adek336 »

I can't do anything useful with the card if I don't have access to the eeprom. Of course, I could prompt the user for the MAC address, the connector types availlable etc.

I also wanted to get this function up and running, because it is the simplest thing I could do with the card. I thought, "Adrian how can you transmit packets or whatever if you can't read the eeprom".

Btw, transmitting packets is not yet implemented.

Cheers :)
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:3c59x: read eeprom

Post by Pype.Clicker »

Yup. Makes sense.

Other NICs i know just let you access the MAC address like any other registers (afaik, the NIC reads the MAC address from the EEPROM and then transfer it to registers at bootup, so you don't have to toy with EEPROM yourself ;)
Post Reply