[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/8] seabios: pciinit: factor out bar offset calcula
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH 5/8] seabios: pciinit: factor out bar offset calculation. |
Date: |
Thu, 17 Jun 2010 20:03:13 +0900 |
This patch factors out bar offset calculation.
Later the calculation logic will be enhanced.
Signed-off-by: Isaku Yamahata <address@hidden>
---
src/pciinit.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/pciinit.c b/src/pciinit.c
index b6ab157..6ba51f2 100644
--- a/src/pciinit.c
+++ b/src/pciinit.c
@@ -22,15 +22,19 @@ static u8 pci_irqs[4] = {
10, 10, 11, 11
};
+static u32 pci_bar(u16 bdf, int region_num)
+{
+ if (region_num != PCI_ROM_SLOT) {
+ return PCI_BASE_ADDRESS_0 + region_num * 4;
+ }
+ return PCI_ROM_ADDRESS;
+}
+
static void pci_set_io_region_addr(u16 bdf, int region_num, u32 addr)
{
u32 ofs, old_addr;
- if (region_num == PCI_ROM_SLOT) {
- ofs = PCI_ROM_ADDRESS;
- } else {
- ofs = PCI_BASE_ADDRESS_0 + region_num * 4;
- }
+ ofs = pci_bar(bdf, region_num);
old_addr = pci_config_readl(bdf, ofs);
@@ -46,11 +50,7 @@ static void pci_set_io_region_addr(u16 bdf, int region_num,
u32 addr)
static int pci_bios_allocate_region(u16 bdf, int region_num)
{
u32 *paddr;
- int ofs;
- if (region_num == PCI_ROM_SLOT)
- ofs = PCI_ROM_ADDRESS;
- else
- ofs = PCI_BASE_ADDRESS_0 + region_num * 4;
+ u32 ofs = pci_bar(bdf, region_num);
u32 old = pci_config_readl(bdf, ofs);
u32 mask;
--
1.6.6.1
- [Qemu-devel] [PATCH 0/8] seabios: pci: multi pci bus support, Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 7/8] seabios: pciinit: pci bridge bus initialization., Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 2/8] seabios: pciinit: factor out pci bar region allocation logic., Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 4/8] seabios: pciinit: make pci bar assigner preferchable memory aware., Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 1/8] seabios: pci: introduce foreachpci_in_bus() helper macro., Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 5/8] seabios: pciinit: factor out bar offset calculation.,
Isaku Yamahata <=
- [Qemu-devel] [PATCH 8/8] seabios: pciinit: initialize pci bridge filtering registers., Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 6/8] seabios: pciinit: make bar offset calculation pci bridge aware., Isaku Yamahata, 2010/06/17
- [Qemu-devel] [PATCH 3/8] seabios: pciinit: make pci memory space assignment 64bit aware., Isaku Yamahata, 2010/06/17
- [Qemu-devel] Re: [PATCH 0/8] seabios: pci: multi pci bus support, Michael S. Tsirkin, 2010/06/17