/****************************** INFO BAR ************************************
Edit: Last Modified: 31/12/07, Leo Link Added.
FOR LEOPARD:
---------------------------------
Thanks to John Stormdrake, a driver for Leopard is now available
here.
Files
----------------------------------
1. Darwin 8.8.1 -
PCGenRTL8139Ethernet-1.2.0.zip
MD5 (PCGenRTL8139Ethernet-1.2.0.zip) = c2e4ac081c855e95ee4a3af52c2df63c
2. Darwin 8.4.1 -
PCGenRTL8139Ethernet-1.1.0.zip
MD5 (PCGenRTL8139Ethernet-1.1.0.zip) = a7cec7c9ec113c41126de8ba877715b8
Compatibility Guidelines
----------------------------------
(10.4.9) = Reported to work with Tubgirl's AMD release - pls. see this thread.
For Kernel 8.8.1
(10.4.8) + IONetworkingFamily (1.5.1)
For Kernel 8.4.1
(10.4.6) + IONetworkingFamily (1.5.0)
(10.4.7) + IONetworkingFamily (1.5.0)
(10.4.8) + IONetworkingFamily (1.5.0)
Other configurations may work, but these are the ones I have tested.
******************************************************************************/
DISCUSSION THREAD STARTS BELOW:
Hi all,
I am pleased to announce the release of PCGenRTLEthernet8139.kext - another addition to the 'Generic PC drivers' project for Darwin.
This driver is based on the AppleRTL8139Ethernet-3 and AppleRTL8139Ethernet-4 sources and extends functionality to include
ON-BOARD RTL 8139/810x Fast Ethernet Family devices, which were previously unworkable. The driver will continue to work for add-on devices. It should be backwards compatible with the Apple versions.
CHANGES
---------------------------------------------------------
10/01/07
* Changes on x86 based systems:
(+) Added MMIO access mode (adds support for on-board RTL8139/810x family devices)
(+) To override PIO mode, added ForceMMIOAccess (true/false) key to Info.plist, default false.
(+) Added hard chip reset if soft reset fails logic.
CREDITS
---------------------------------------------------------
- Thanks to Owen Wei for the original Apple Realtek code. This was invaluable.
- Thanks to cremes' OSX tulip driver.
- Thanks to Linux. In my case. Gentoo 2.6.17.
discussion
Problem: On-board RTL8139/810x devices are not detected by the AppleRTL8139Ethernet driver.
Cause: The Apple driver only used PIO access to speak to the RTL chip. But PIO access fails to initialize for on-board devices.
Solution: Using MMIO acces mode works for on-board devices.
Implementation Options Considered:
0. Make 2 versions of the kext using a compiler directive selecting PIO/MMIO at compile time (e.g. Linux).
Advantages: Simple to do.
Disadvantages: Two kext versions, user specifies which one.
1. Make 1 version of the kext using MMIO only.
Advantages: Simple to do, tested and works.
Disadvantages: Breaks compatibility with existing code base.
2. Make 1 version of the kext with run-time PIO/MMIO allocation.
Advantages: Single kext, retains backwards compatibility.
Disadvantages: Need to create fast coding model.
We could have done something like:
inline UInt32 csrRead32( UInt16 offset )
{
if (ioAccessMode == kIOAccessModeIsPIO) return pciNub->ioRead32(offset, csrMap);
else return OSReadLittleInt32( ( void * ) csrBase, offset );
}
But this is not true run-time allocation. Instead, this is a good case for using the features of C++ - in particular, the ability the cast a derived class to a base class. For interested parties, the details are in the code, but the final implementation is class based:
class ioAccessor : public OSObject
{
OSDeclareAbstractStructors ( ioAccessor )
public:
virtual void csrWrite32 ( UInt16 offset, UInt32 value ) = 0;
virtual void csrWrite16 ( UInt16 offset, UInt16 value ) = 0;
virtual void csrWrite8 ( UInt16 offset, UInt8 value ) = 0;
virtual void csrWrite32Slow ( UInt16 offset, UInt32 value ) = 0;
virtual void csrWrite16Slow ( UInt16 offset, UInt16 value ) = 0;
virtual void csrWrite8Slow ( UInt16 offset, UInt8 value ) = 0;
virtual UInt32 csrRead32 ( UInt16 offset ) = 0;
virtual UInt16 csrRead16 ( UInt16 offset ) = 0;
virtual UInt8 csrRead8 ( UInt16 offset ) = 0;
protected:
virtual bool init ( );
};
as the abstract base class, then
class ioAccessorPIO : public ioAccessor
{
...
};
class ioAccessorMMIO : public ioAccessor
{
...
};
which implement the appropriate access methods and variables.
Best