[LinuxBIOS] How to study the source code...?

Li-Ta Lo ollie at lanl.gov
Mon Jun 20 16:43:12 CEST 2005


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 ;-)

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.

-- 
Li-Ta Lo <ollie at lanl.gov>
Los Alamos National Lab





More information about the coreboot mailing list