Extracting (boardvendor and) boardtype
Arend van Spriel
arend at broadcom.com
Tue Mar 19 07:45:30 EDT 2013
On 03/19/2013 12:37 PM, Rafał Miłecki wrote:
> 2013/3/19 Arend van Spriel <arend at broadcom.com>:
>> On 03/19/2013 12:18 PM, Rafał Miłecki wrote:
>>> 2013/3/19 Jonas Gorski <jogo at openwrt.org>:
>>>> On 19 March 2013 11:36, Rafał Miłecki <zajec5 at gmail.com> wrote:
>>>>> However take a look at siutils.c you're using internally at Broadcom.
>>>>> I've found it in:
>>>>> This file contains si_nvram_process. This function calls that
>>>>> si_getdevpathintvar and getintvar I'm not sure about. Does
>>>>> si_nvram_process prefer SPROM's boardtype (offset SROM_SSID==0x2 or
>>>>> offset SSB_SPROM1_SPID==0x4) if it's available (not 0xFFFF)?
>>>> The getdevpathintvar and getintvar are for extracting these values
>>>> from nvram instead of SPROM - remember that embedded bcm47xx devices
>>>> are "sprom"-less and have these values stored in nvram. Since there is
>>>> only one global nvram, you need to prefix these values with the
>>>> "pci/sb" device path to differentiate if you have more than one wifi
>>>> chip (e.g. "sb/1/boardflags" or "pci/1/boardflags"). But this isn't
>>>> necessarily done for single wifi devices, hence the getdevpathintvar
>>>> -> getinvar path (as the fall back).
>>> So what function does Broadcom use to extract something from SPROM?
> OK, so for PCI:
> 1) srom_var_init calls initvars_srom_pci
> 2) initvars_srom_pci calls _initvars_srom_pci
> 3) _initvars_srom_pci calls varbuf_append for every entry
> After all we end up with varbuf_t variable filled like an NVRAM
> So AFAIU getdevpathintvar and getintvar are still used to access SPROM
> (just in a form common for NVRAM), is that right?
> If the above is right, in si_nvram_process we access SPROM (with the
> use of getdevpathintvar/getintvar). So it seems in si_nvram_process we
> always prefer "boardtype", no matter if it comes from SPROM of NVRAM.
> Is that correct?
Yes. Non-volatile variables take precedence to PCI config info
regardless from which device, SPROM or flash, it was loaded.
More information about the b43-dev