From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bin Meng Date: Mon, 5 Jan 2015 21:49:44 +0800 Subject: [U-Boot] [PATCH 09/10] x86: Access the VGA ROM when needed In-Reply-To: References: <1419906751-29776-1-git-send-email-sjg@chromium.org> <1419906751-29776-10-git-send-email-sjg@chromium.org> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Simon, On Mon, Jan 5, 2015 at 9:45 AM, Simon Glass wrote: > Hi Bin, > > On 3 January 2015 at 22:54, Bin Meng wrote: >> Hi Simon, >> >> On Tue, Dec 30, 2014 at 10:32 AM, Simon Glass wrote: >>> Add code to the generic pci_rom file to access the VGA ROM in PCI space >>> when needed. >>> >>> Signed-off-by: Simon Glass >>> --- >>> >>> 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 >>> - >>> +#include >>> #include >>> >>> #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. >>> + 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. [snip] Regards, Bin