[BULK] Re: [LinuxBIOS] How to study the source code...?

Eric W. Biederman ebiederman at lnxi.com
Tue Jun 21 00:31:13 CEST 2005

Li-Ta Lo <ollie at lanl.gov> writes:

> On Mon, 2005-06-20 at 19:20 +0800, Huang-Jen Wang wrote:
>> Dear all,
>> Recently I am studying the source code , because I want to try to 
>> porting new mainboard later, but  it is not easy to realize source code
>> I begin my study  from the src/southbridge/amd8111/amd8111.c
>> There are some lines that I can't understand even I have amd8111
>> datasheet....hope you can tell me
>> 1.devfn = bus_dev->path.u.pci.devfn + (1 << 3); 
>> 2.index = ((dev->path.u.pci.devfn & ~7) >> 3) + 8;
>> 3.devfn = (dev->path.u.pci.devfn) & ~7;
> You choose the worst file in the whole tree to start. You are not 
> supposed understand it unless you are Eric Biederman ;-)

Hmm.  It must need a good comment then :(
But I agree that is pretty abstract way to start.

You certainly need to understand how pci encodes bus/device/function information
and how LinuxBIOS deals with it to make sense of those lines.

> The reason that file is so complicated is because the LPC bridge inside 
> amd8111 controls the enable and disable of devices on both side of the
> PCI bridge (in amd8111). The function in amd8111.c is call with every
> devices in the 8111 chip as argument. The function has to figure out
> which device it is given and how to enable or disable the device.
> This is done by device_t to devfn magic you see.


More information about the coreboot mailing list