[U-Boot] [PATCH 3/5] x86: Add an API for finding pci devices in the early phase

Simon Glass sjg at chromium.org
Sun Dec 21 19:54:50 CET 2014


Hi Bin,

On 19 December 2014 at 22:34, Bin Meng <bmeng.cn at gmail.com> wrote:
> Hi Simon,
>
> On Sat, Dec 20, 2014 at 12:56 PM, Simon Glass <sjg at chromium.org> wrote:
>> Hi Bin,
>>
>> On 19 December 2014 at 19:37, Bin Meng <bmeng.cn at gmail.com> wrote:
>>>
>>> Hi Simon,
>>>
>>> On Sat, Dec 20, 2014 at 5:53 AM, Simon Glass <sjg at chromium.org> wrote:
>>> > Hi Bin,
>>> >
>>> > On 19 December 2014 at 00:19, Bin Meng <bmeng.cn at gmail.com> wrote:
>>> >> This new API pci_early_find_devices() is derived from the generic
>>> >> version of pci_find_devices() with modifications required in the
>>> >> early phase (like hose, config space access routines).
>>> >>
>>> >> Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
>>> >> ---
>>> >>
>>> >>  arch/x86/cpu/pci.c         | 41 +++++++++++++++++++++++++++++++++++++++++
>>> >>  arch/x86/include/asm/pci.h |  2 ++
>>> >>  2 files changed, 43 insertions(+)
>>> >>
>>> >> diff --git a/arch/x86/cpu/pci.c b/arch/x86/cpu/pci.c
>>> >> index 1eee08b..cdfb981 100644
>>> >> --- a/arch/x86/cpu/pci.c
>>> >> +++ b/arch/x86/cpu/pci.c
>>> >> @@ -111,3 +111,44 @@ void pci_write_config32(pci_dev_t dev, unsigned where, unsigned value)
>>> >>  {
>>> >>         pci_hose_write_config_dword(get_hose(), dev, where, value);
>>> >>  }
>>> >> +
>>> >> +pci_dev_t pci_early_find_devices(struct pci_device_id *ids, int index)
>>> >
>>> > Can't we just call the normal function? We have an early 'hose'...
>>> >
>>>
>>> We can, but doing this way requires a large update of the
>>> drivers/pci/pci.c file, and requires every architecture to have an
>>> early hose in its global data. So that early hose becomes a generic
>>> feature for every arch we support, not only x86. Do you want to do
>>> this?
>>
>> Are you sure it requires a large update? The idea with the early PCI
>> support was that it would use the same data structures, etc. and avoid
>> duplicating code. In fact I avoided using the x86-specific config
>> calls because I didn't want to invent a parallel API.
>>
>> Yes I think early hose should be a generic feature potentially.
>>
>
> OK, I will try to make the early hose a generic feature.

OK. Perhaps it just needs to be called from x86_cpu_init_f()?

Regards,
Simon


More information about the U-Boot mailing list