[U-Boot] [PATCH 09/10] x86: Access the VGA ROM when needed
Bin Meng
bmeng.cn at gmail.com
Thu Jan 15 03:17:27 CET 2015
Hi Simon,
On Thu, Jan 15, 2015 at 3:36 AM, Simon Glass <sjg at chromium.org> wrote:
> Hi Bin,
>
> On 5 January 2015 at 06:49, Bin Meng <bmeng.cn at gmail.com> wrote:
>> Hi Simon,
>>
>> On Mon, Jan 5, 2015 at 9:45 AM, Simon Glass <sjg at chromium.org> wrote:
>>> Hi Bin,
>>>
>>> On 3 January 2015 at 22:54, Bin Meng <bmeng.cn at gmail.com> wrote:
>>>> Hi Simon,
>>>>
>>>> On Tue, Dec 30, 2014 at 10:32 AM, Simon Glass <sjg at chromium.org> wrote:
>>>>> Add code to the generic pci_rom file to access the VGA ROM in PCI space
>>>>> when needed.
>>>>>
>>>>> Signed-off-by: Simon Glass <sjg at chromium.org>
>>>>> ---
>>>>>
>>>>> drivers/pci/pci_auto.c | 28 +++++++++++++++++++++++++++-
>>>>> drivers/pci/pci_rom.c | 7 ++++++-
>>>>> include/pci.h | 9 +++++++++
>>>>> 3 files changed, 42 insertions(+), 2 deletions(-)
>>>>>
>>>>> diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c
>>>>> index 44470fa..61bf6b4 100644
>>>>> --- a/drivers/pci/pci_auto.c
>>>>> +++ b/drivers/pci/pci_auto.c
>>>>> @@ -11,7 +11,7 @@
>>>>> */
>>>>>
>>>>> #include <common.h>
>>>>> -
>>>>> +#include <errno.h>
>>>>> #include <pci.h>
>>>>>
>>>>> #undef DEBUG
>>>>> @@ -191,6 +191,32 @@ void pciauto_setup_device(struct pci_controller *hose,
>>>>> pci_hose_write_config_byte(hose, dev, PCI_LATENCY_TIMER, 0x80);
>>>>> }
>>>>>
>>>>> +int pciauto_setup_rom(struct pci_controller *hose, pci_dev_t dev)
>>>>> +{
>>>>> + pci_addr_t bar_value;
>>>>> + pci_size_t bar_size;
>>>>> + u32 bar_response;
>>>>> + u16 cmdstat = 0;
>>>>> +
>>>>> + pci_hose_write_config_dword(hose, dev, PCI_ROM_ADDRESS, -2);
>>
>> I think it is better for people to understand if not writing -2.
>
> What should we use instead?
0xfffffffe
>>
>>>>> + pci_hose_read_config_dword(hose, dev, PCI_ROM_ADDRESS, &bar_response);
>>>>> + if (!bar_response)
>>>>> + return -ENOENT;
>>>>> +
>>>>> + bar_size = -(bar_response & ~1);
>>>>> + DEBUGF("PCI Autoconfig: ROM, size=%#x, ", bar_size);
>>>>> + if (pciauto_region_allocate(hose->pci_mem, bar_size, &bar_value) == 0) {
>>>>
>>>> Should we assume pci roms are always mapped using the pci_mem region?
>>>> If not, maybe we can add another parameter 'region_type' to
>>>> pciauto_setup_rom()?
>>>
>>> I'm not sure - do you think we should support the cacheable area too?
>>> Would that help?
>>>
>>
>> I'm not sure either. I thought you might know more than me as so far I
>> see pci rom is used for vga, ahci, pxe roms, and storage media for mac
>> addresses on some ethernet cards. They all belong to pci_mem regions.
>> Let's do it pci_mem and revisit it in the future if we see something
>> different.
>
> OK.
>
Regards,
Bin
More information about the U-Boot
mailing list