A few months ago I had to write a small tool to program the eeprom of a rtl8139-card. It's basically the rtl8139-diag tool stripped down to read/write the eeprom.
This tool has to be extend to be able to program the eeprom of rtl8101-cards now. This was not a problem, as the interface to the eeprom is similar to the one of the rtl8139. Actually, the only difference is the contents of the eeprom-file.
What I want to implement is an auto-detection that checks, if the card at the given port-address is an rtl8139 or rtl8101 and selects the fitting eeprom-dump. I cannot determine the difference of these chips by reading out the eeprom as the cards to be programmed are 'virgin' and the eeprom-contents is basically 0xffff
.
I noticed, that Linux always loads the fitting driver for these cards, regardless of the contents of the eeprom. So I think, that I just have to read the chip-id of the card.
How do I do that?