Re: [SeaBIOS] [PATCH] fix calculation of PkgLength

2013-07-14 Thread Kevin O'Connor
On Fri, Jul 12, 2013 at 10:08:01AM +0800, Hu Tao wrote:
> On Sun, Jul 07, 2013 at 11:42:40PM -0400, Kevin O'Connor wrote:
> > On Wed, Jul 03, 2013 at 05:59:07PM +0800, Hu Tao wrote:
> > > Currently the calculation of PkgLength isn't acpi-compliant. This
> > > patch fixes it to be acpi-compliant.
> > 
> > What isn't acpi compliant with the current calculation?
> 
> Currently, the length of PkgLength itself is hard-coded(third parameter
> of encodeLen). If the length of PkgLength must have strictly the
> relationship with package length as follow as in ACPI specification:
> 
>  package length  PkgLength
>  0-631 byte
>  64-4096(2^12)   2 bytes
>  4097-1048576(2^20)  3 bytes
>  >10485764 bytes
> 
> then current calculation is not acpi-compliant. But if not, say,
> a 4-byte PkgLength can legally encode a 10-byte package, then current
> calculation is acpi-compliant.

My read of the spec was that one can always use a larger length
encoding than needed.  I haven't seen any issues with it in my tests.
Can you confirm that the length encoding is causing problems for you?

-Kevin

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCHv2] pci: load memory window setup from host

2013-07-14 Thread Kevin O'Connor
On Tue, Apr 30, 2013 at 09:34:55AM +0300, Michael S. Tsirkin wrote:
> Load memory window setup for pci from host.
> This makes it possible for host to make sure
> setup matches hardware exactly: especially important
> for when ACPI tables are loaded from host.
> This will also make it easier to add more chipsets
> down the road.

I'm struggling to understand this patch.  I think the code may need
some refactoring.

[...]
> --- a/src/pciinit.c
> +++ b/src/pciinit.c
> @@ -13,6 +13,7 @@
>  #include "config.h" // CONFIG_*
>  #include "memmap.h" // add_e820
>  #include "paravirt.h" // RamSize
> +#include "byteorder.h" // le64_to_cpu
>  #include "dev-q35.h"
>  
>  /* PM Timer ticks per second (HZ) */
> @@ -61,6 +62,13 @@ struct pci_bus {
>  struct pci_device *bus_dev;
>  };
>  
> +struct pci_mem {
> + u64 start32;

SeaBIOS uses spaces; not tabs.

[...]
>  void i440fx_mem_addr_setup(struct pci_device *dev, void *arg)
>  {
> +if (arg)
> + /* use supplied memory */;

Huh?

[...]
>  /
>   * Main setup code
>   /
> -
>  void
>  pci_setup(void)
>  {
> @@ -823,25 +868,39 @@ pci_setup(void)
>  dprintf(1, "=== PCI device probing ===\n");
>  pci_probe_devices();
>  
> -pcimem_start = RamSize;
> -pci_bios_init_platform();
> +struct pci_mem *mem = pci_mem_get();
> +
> +if (mem) {
> +pcimem_start = mem->start32;
> +pcimem_end = mem->end32;
> +pcimem64_start = mem->start64;
> +pcimem64_end = mem->end64;
> +} else {
> +pcimem_start = RamSize;
> +}
> +
> +pci_bios_init_platform(mem);
>  
>  dprintf(1, "=== PCI new allocation pass #1 ===\n");
>  struct pci_bus *busses = malloc_tmp(sizeof(*busses) * (MaxPCIBus + 1));
>  if (!busses) {
>  warn_noalloc();
> -return;
> +goto done;
>  }
>  memset(busses, 0, sizeof(*busses) * (MaxPCIBus + 1));
>  if (pci_bios_check_devices(busses))
> -return;
> +goto done;
>  
>  dprintf(1, "=== PCI new allocation pass #2 ===\n");
> -pci_bios_map_devices(busses);
> +pci_bios_map_devices(busses, mem);
>  
>  pci_bios_init_devices();
>  
>  free(busses);
>  
>  pci_enable_default_vga();
> +
> +done:
> +if (mem)
> +free(mem);

I don't understand why dynamic memory is used, and I don't understand
why "mem" is passed around and inspected in so many places.

-Kevin

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] Call for Proposals: 2013 Linux Plumbers Virtualization Microconference

2013-07-14 Thread Alex Williamson
On Fri, 2013-07-12 at 14:38 -0600, Alex Williamson wrote:
> The Call for Proposals for the 2013 Linux Plumbers Virtualization
> Microconference is now open.  This uconf is being held as part of Linux
> Plumbers Conference in New Orleans, Louisiana, USA September 18-20th and
> is co-located with LinuxCon North America.  For more information see:
> 
> http://www.linuxplumbersconf.org/2013/
> 
> The tentative deadline for proposals is August 1st.  To submit a topic
> please email a brief abstract to lpc2013-virt...@codemonkey.ws  If you
> require travel assistance (extremely limited) in order to attend, please
> note that in your submission.  Also, please keep an eye on:
> 
> http://www.linuxplumbersconf.org/2013/submitting-topic/
> http://www.linuxplumbersconf.org/2013/participate/
> 
> We've setup the above email submission as an interim approach until the
> LPC program committee brings the official submission tool online.  I'll
> send a follow-up message when that occurs, but please send your
> proposals as soon as possible.  Thanks,

And the official tool is now online.  Please see:

http://www.linuxplumbersconf.org/2013/microconference-discussion-topic-bof-submissions-now-open/

for instructions to propose a discussion topic for the virtualization
microconference.  Thanks,

Alex


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


[SeaBIOS] [PATCH] PIC code cleanups.

2013-07-14 Thread Kevin O'Connor
Preface PIC functions with a pic_ to provide a more consistent
naming.

Convert the irqmask code to a more consistent
pic_irqmask_read/write/mask form.

Move code from pic.h to pic.c.

Signed-off-by: Kevin O'Connor 
---
 src/clock.c   |  6 ++---
 src/csm.c |  7 +++---
 src/disk.c|  4 +--
 src/floppy.c  |  4 +--
 src/misc.c|  2 +-
 src/pic.c | 79 +-
 src/pic.h | 80 +++
 src/ps2port.c |  6 ++---
 src/resume.c  |  4 +--
 src/system.c  |  4 +--
 10 files changed, 90 insertions(+), 106 deletions(-)

diff --git a/src/clock.c b/src/clock.c
index 5926a07..2eedab8 100644
--- a/src/clock.c
+++ b/src/clock.c
@@ -9,7 +9,7 @@
 #include "util.h" // debug_enter
 #include "disk.h" // floppy_tick
 #include "cmos.h" // inb_cmos
-#include "pic.h" // eoi_pic1
+#include "pic.h" // pic_eoi1
 #include "bregs.h" // struct bregs
 #include "biosvar.h" // GET_GLOBAL
 #include "usb-hid.h" // usb_check_event
@@ -583,7 +583,7 @@ handle_08(void)
 br.flags = F_IF;
 call16_int(0x1c, &br);
 
-eoi_pic1();
+pic_eoi1();
 }
 
 
@@ -746,5 +746,5 @@ handle_70(void)
 }
 
 done:
-eoi_pic2();
+pic_eoi2();
 }
diff --git a/src/csm.c b/src/csm.c
index 4336e16..2886bba 100644
--- a/src/csm.c
+++ b/src/csm.c
@@ -30,10 +30,11 @@ EFI_COMPATIBILITY16_TABLE csm_compat_table VARFSEG 
__aligned(16) = {
 .AcpiRsdPtrPointer = (u32)&csm_rsdp,
 };
 
-
 EFI_TO_COMPATIBILITY16_INIT_TABLE *csm_init_table;
 EFI_TO_COMPATIBILITY16_BOOT_TABLE *csm_boot_table;
 
+static u16 PICMask = PIC_IRQMASK_DEFAULT;
+
 extern void __csm_return(struct bregs *regs) __noreturn;
 
 static void
@@ -41,7 +42,7 @@ csm_return(struct bregs *regs)
 {
 dprintf(3, "handle_csm returning AX=%04x\n", regs->ax);
 
-pic_save_mask();
+PICMask = pic_irqmask_read();
 __csm_return(regs);
 }
 
@@ -271,7 +272,7 @@ handle_csm(struct bregs *regs)
 
 dprintf(3, "handle_csm regs %p AX=%04x\n", regs, regs->ax);
 
-pic_restore_mask();
+pic_irqmask_write(PICMask);
 
 switch(regs->ax) {
 case : handle_csm_(regs); break;
diff --git a/src/disk.c b/src/disk.c
index 0291fe3..975d053 100644
--- a/src/disk.c
+++ b/src/disk.c
@@ -9,7 +9,7 @@
 #include "biosvar.h" // SET_BDA
 #include "config.h" // CONFIG_*
 #include "util.h" // debug_enter
-#include "pic.h" // eoi_pic2
+#include "pic.h" // pic_eoi2
 #include "bregs.h" // struct bregs
 #include "pci.h" // pci_bdf_to_bus
 #include "ata.h" // ATA_CB_DC
@@ -889,7 +889,7 @@ handle_76(void)
 {
 debug_isr(DEBUG_ISR_76);
 SET_BDA(disk_interrupt_flag, 0xff);
-eoi_pic2();
+pic_eoi2();
 }
 
 // Old Fixed Disk Parameter Table (newer tables are in the ebda).
diff --git a/src/floppy.c b/src/floppy.c
index 62802ba..83dfaf8 100644
--- a/src/floppy.c
+++ b/src/floppy.c
@@ -11,7 +11,7 @@
 #include "biosvar.h" // SET_BDA
 #include "util.h" // dprintf
 #include "cmos.h" // inb_cmos
-#include "pic.h" // eoi_pic1
+#include "pic.h" // pic_eoi1
 #include "bregs.h" // struct bregs
 #include "boot.h" // boot_add_floppy
 #include "pci.h" // pci_to_bdf
@@ -679,7 +679,7 @@ handle_0e(void)
 u8 frs = GET_BDA(floppy_recalibration_status);
 SET_BDA(floppy_recalibration_status, frs | FRS_IRQ);
 
-eoi_pic1();
+pic_eoi1();
 }
 
 // Called from int08 handler.
diff --git a/src/misc.c b/src/misc.c
index def31f8..c84cac8 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -71,7 +71,7 @@ handle_75(void)
 // clear irq13
 outb(0, PORT_MATH_CLEAR);
 // clear interrupt
-eoi_pic2();
+pic_eoi2();
 // legacy nmi call
 struct bregs br;
 memset(&br, 0, sizeof(br));
diff --git a/src/pic.c b/src/pic.c
index 3e96bb3..9a3ea0b 100644
--- a/src/pic.c
+++ b/src/pic.c
@@ -5,12 +5,34 @@
 //
 // This file may be distributed under the terms of the GNU LGPLv3 license.
 
-#include "pic.h" // get_pic1_isr
+#include "pic.h" // pic_*
 #include "util.h" // dprintf
 #include "config.h" // CONFIG_*
+#include "biosvar.h" // SET_IVT
+
+u16
+pic_irqmask_read(void)
+{
+return inb(PORT_PIC1_DATA) | (inb(PORT_PIC2_DATA) << 8);
+}
+
+void
+pic_irqmask_write(u16 mask)
+{
+outb(mask, PORT_PIC1_DATA);
+outb(mask >> 8, PORT_PIC2_DATA);
+}
 
 void
-set_pics(u8 irq0, u8 irq8)
+pic_irqmask_mask(u16 off, u16 on)
+{
+u8 pic1off = off, pic1on = on, pic2off = off>>8, pic2on = on>>8;
+outb((inb(PORT_PIC1_DATA) & ~pic1off) | pic1on, PORT_PIC1_DATA);
+outb((inb(PORT_PIC2_DATA) & ~pic2off) | pic2on, PORT_PIC2_DATA);
+}
+
+void
+pic_reset(u8 irq0, u8 irq8)
 {
 // Send ICW1 (select OCW1 + will send ICW4)
 outb(0x11, PORT_PIC1_CMD);
@@ -25,44 +47,55 @@ set_pics(u8 irq0, u8 irq8)
 outb(0x01, PORT_PIC1_DATA);
 outb(0x01, PORT_PIC2_DATA);
 // Mask all irqs (except cascaded PIC2 irq)
-outb(~PIC1_IRQ2, PORT_PIC1_DATA);
-outb(~0, PORT_PIC2_DATA);
+pic_irqmask_write(PIC_IRQMASK_DEFAULT);
 }
 
 void
 pic_setup(void)
 {
 dprintf(3, "init pic\n");
-

Re: [SeaBIOS] [PATCH v2 4/5] acpi: load and link tables from /etc/acpi/

2013-07-14 Thread Kevin O'Connor
On Sun, Jul 07, 2013 at 06:42:43PM +0300, Michael S. Tsirkin wrote:
> Load files in /etc/acpi/, link them using
> a linker script and use for acpi tables, including the RSDP.
> Presense of RSDP in this directory completely disables
> generating and loading legacy acpi tables.
> 
> Signed-off-by: Michael S. Tsirkin 
> ---
>  src/acpi.c | 39 +++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/src/acpi.c b/src/acpi.c
> index a81f0cb..07d311a 100644
> --- a/src/acpi.c
> +++ b/src/acpi.c
> @@ -27,6 +27,7 @@
>  #include "config.h" // CONFIG_*
>  #include "paravirt.h" // RamSize
>  #include "dev-q35.h"
> +#include "linker.h"
>  
>  #include "acpi-dsdt.hex"
>  
> @@ -599,6 +600,34 @@ static const struct pci_device_id acpi_find_tbl[] = {
>  
>  struct rsdp_descriptor *RsdpAddr;
>  
> +/* Look for RSDP signature in files loaded in FSEG */
> +struct rsdp_descriptor *
> +acpi_find_rsdp_rom(void)
> +{
> +struct romfile_s *file = NULL;
> +struct rsdp_descriptor *rsdp = NULL;
> +for (;;) {
> +file = romfile_findprefix("", file);
> +if (!file)
> +break;
> +
> +if (!file->data || !pmm_test_fseg(file->data) ||
> +file->size < sizeof(rsdp->signature))
> +continue;
> +
> +void *data;
> +
> +for (data = file->data;
> + data + sizeof(*rsdp) <= file->data + file->size;
> + data++) {
> +rsdp = data;
> +if (rsdp->signature == cpu_to_le64(RSDP_SIGNATURE))
> +return rsdp;
> +}
> +}
> +return NULL;
> +}
> +
>  #define MAX_ACPI_TABLES 20
>  void
>  acpi_setup(void)
> @@ -608,6 +637,16 @@ acpi_setup(void)
>  
>  dprintf(3, "init ACPI tables\n");
>  
> +linker_loader_execute("/etc/linker-script");
> +
> +RsdpAddr = acpi_find_rsdp_rom();
> +
> +if (RsdpAddr) {
> +return;
> +}

I don't understand this.  Why not use the presence of
"/etc/linker-script" to determine if ACPI should be produced.

Also, /etc/linker-script is not very informative - how about something
like "/etc/biostables".

-Kevin

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH v2 1/5] linker: utility to patch in-memory ROM files

2013-07-14 Thread Kevin O'Connor
On Sun, Jul 07, 2013 at 06:42:35PM +0300, Michael S. Tsirkin wrote:
> Add ability for a ROM file to point to
> it's image in memory. When file is in memory,
> add utility that can patch it, storing
> pointers to one file within another file.

Thanks.  See my comments below.

[...]
> --- /dev/null
> +++ b/src/linker.c
[...]
> +void linker_loader_execute(const char *name)
> +{
> +struct linker_loader_entry_s *entry;
> +int size, offset = 0;
> +void *data = romfile_loadfile(name, &size);
> +if (!data)
> +return;
> +
> +for (offset = 0; offset < size; offset += sizeof *entry) {

For consistent style, please treat sizeof like a function (ie,
sizeof(*entry) ).

> +entry = data + offset;
> +/* Check that entry fits in buffer. */
> +if (offset + sizeof *entry > size) {
> +warn_internalerror();
> +break;
> +}
> + switch (le32_to_cpu(entry->command)) {
> + case LINKER_LOADER_COMMAND_ALLOCATE:
> + linker_loader_allocate(entry);

SeaBIOS uses 4 spaces for indentation, and no tabs.

[...]
> --- a/src/util.h
> +++ b/src/util.h
> @@ -436,6 +436,7 @@ struct romfile_s {
>  char name[128];
>  u32 size;
>  int (*copy)(struct romfile_s *file, void *dest, u32 maxlen);
> +void *data;
>  };

I'd prefer to see this tracked within the "linker" code and not in the
generic romfile struct.

Also, is there another name besides "linker" that could be used?
SeaBIOS has code to self-relocate and fixup code relocations.  I think
having code in the repo called "linker" could cause confusion.

-Kevin

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] Commit b98a4b1 prevents USB drives from being detected

2013-07-14 Thread Kevin O'Connor
On Fri, Jul 12, 2013 at 03:22:43PM -0500, Dave Frodin wrote:

> I'm using the current seabios (master or stable) as a payload for
> coreboot.  If I build the current seabios I've found that commit
> b98a4b1 "Convert PCIDevices list to use standard list manipultion
> code."  prevents the system from finding USB thumbdrives. The USB
> keyboard and mouse still work.

Thanks.  The PCI list changes broke the ordering of the PCIDevices
list.  Can you confirm the patch below fixes it for you?

-Kevin


commit 2a9aeabdfb34374ecac25e7a8d21c9e368618cd4
Author: Kevin O'Connor 
Date:   Sun Jul 14 13:55:52 2013 -0400

Fix USB EHCI detection that was broken in hlist conversion of PCIDevices.

Make sure the PCI device list is ordered in bus order.

Don't iterate past the end of the list when detecting EHCI devices.

Signed-off-by: Kevin O'Connor 

diff --git a/src/pci.c b/src/pci.c
index 6163a29..dc62c5c 100644
--- a/src/pci.c
+++ b/src/pci.c
@@ -122,6 +122,7 @@ pci_probe_devices(void)
 }
 memset(dev, 0, sizeof(*dev));
 hlist_add(&dev->node, pprev);
+pprev = &dev->node.next;
 count++;
 
 // Find parent device.
diff --git a/src/usb.c b/src/usb.c
index ecccd75..42541ff 100644
--- a/src/usb.c
+++ b/src/usb.c
@@ -444,7 +444,7 @@ usb_setup(void)
 }
 if (ehcipci->class == PCI_CLASS_SERIAL_USB)
 found++;
-ehcipci = container_of(
+ehcipci = container_of_or_null(
 ehcipci->node.next, struct pci_device, node);
 if (!ehcipci || (pci_bdf_to_busdev(ehcipci->bdf)
  != pci_bdf_to_busdev(pci->bdf)))

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCHv2] pci: load memory window setup from host

2013-07-14 Thread Michael S. Tsirkin
On Tue, Apr 30, 2013 at 09:34:55AM +0300, Michael S. Tsirkin wrote:
> Load memory window setup for pci from host.
> This makes it possible for host to make sure
> setup matches hardware exactly: especially important
> for when ACPI tables are loaded from host.
> This will also make it easier to add more chipsets
> down the road.
> 
> Signed-off-by: Michael S. Tsirkin 
> ---
> 
> Changes from v1:
>   - fix bug in 64 bit range check
>   - address Kevin's comments:
>   move file load into pciinit.c
>   dont reorder initialization
>   sizeof style fix
> 
>  src/pciinit.c | 91 
> ---
>  1 file changed, 75 insertions(+), 16 deletions(-)

QEMU now includes these interfaces - could the bios side be
merged please?


> diff --git a/src/pciinit.c b/src/pciinit.c
> index bb9355f..a4a5bf5 100644
> --- a/src/pciinit.c
> +++ b/src/pciinit.c
> @@ -13,6 +13,7 @@
>  #include "config.h" // CONFIG_*
>  #include "memmap.h" // add_e820
>  #include "paravirt.h" // RamSize
> +#include "byteorder.h" // le64_to_cpu
>  #include "dev-q35.h"
>  
>  /* PM Timer ticks per second (HZ) */
> @@ -61,6 +62,13 @@ struct pci_bus {
>  struct pci_device *bus_dev;
>  };
>  
> +struct pci_mem {
> + u64 start32;
> + u64 end32;
> + u64 start64;
> + u64 end64;
> +};
> +
>  static u32 pci_bar(struct pci_device *pci, int region_num)
>  {
>  if (region_num != PCI_ROM_SLOT) {
> @@ -361,6 +369,8 @@ static void pci_enable_default_vga(void)
>  
>  void i440fx_mem_addr_setup(struct pci_device *dev, void *arg)
>  {
> +if (arg)
> + /* use supplied memory */;
>  if (RamSize <= 0x8000)
>  pcimem_start = 0x8000;
>  else if (RamSize <= 0xc000)
> @@ -383,8 +393,9 @@ void mch_mem_addr_setup(struct pci_device *dev, void *arg)
>  pci_config_writel(bdf, Q35_HOST_BRIDGE_PCIEXBAR, lower);
>  add_e820(addr, size, E820_RESERVED);
>  
> -/* setup pci i/o window (above mmconfig) */
> -pcimem_start = addr + size;
> +/* unless done already, setup pci i/o window (above mmconfig) */
> +if (!arg)
> + pcimem_start = addr + size;
>  
>  pci_slot_get_irq = mch_pci_slot_get_irq;
>  }
> @@ -397,11 +408,11 @@ static const struct pci_device_id pci_platform_tbl[] = {
>  PCI_DEVICE_END
>  };
>  
> -static void pci_bios_init_platform(void)
> +static void pci_bios_init_platform(struct pci_mem *mem)
>  {
>  struct pci_device *pci;
>  foreachpci(pci) {
> -pci_init_device(pci_platform_tbl, pci, NULL);
> +pci_init_device(pci_platform_tbl, pci, mem);
>  }
>  }
>  
> @@ -762,10 +773,14 @@ static void pci_region_map_entries(struct pci_bus 
> *busses, struct pci_region *r)
>  }
>  }
>  
> -static void pci_bios_map_devices(struct pci_bus *busses)
> +static void pci_bios_map_devices(struct pci_bus *busses, struct pci_mem *mem)
>  {
>  if (pci_bios_init_root_regions(busses)) {
>  struct pci_region r64_mem, r64_pref;
> +
> +if (mem && mem->start64 >= mem->end64)
> +panic("PCI: out of 32bit address space\n");
> +
>  r64_mem.list = NULL;
>  r64_pref.list = NULL;
>  pci_region_migrate_64bit_entries(&busses[0].r[PCI_REGION_TYPE_MEM],
> @@ -781,14 +796,27 @@ static void pci_bios_map_devices(struct pci_bus *busses)
>  u64 align_mem = pci_region_align(&r64_mem);
>  u64 align_pref = pci_region_align(&r64_pref);
>  
> -r64_mem.base = ALIGN(0x1LL + RamSizeOver4G, align_mem);
> -r64_pref.base = ALIGN(r64_mem.base + sum_mem, align_pref);
> -pcimem64_start = r64_mem.base;
> -pcimem64_end = r64_pref.base + sum_pref;
> +if (mem) {
> +/*
> + * Non prefetcheable memory at start of the window,
> + * prefetcheable memory at the end.
> + * This way OS has the maximum flexibility for
> + * allocating the rest of the memory.
> + */
> +r64_mem.base = ALIGN(mem->start64, align_mem);
> +r64_pref.base = ALIGN_DOWN(mem->end64 - sum_pref + 1, 
> align_pref);
> +if (sum_pref && r64_pref.base < r64_mem.base + sum_mem)
> +panic("PCI: out of 64bit address space\n");
> +} else {
> +r64_mem.base = ALIGN(0x1LL + RamSizeOver4G, align_mem);
> +r64_pref.base = ALIGN(r64_mem.base + sum_mem, align_pref);
> +pcimem64_start = r64_mem.base;
> +pcimem64_end = r64_pref.base + sum_pref;
> +}
>  
>  pci_region_map_entries(busses, &r64_mem);
>  pci_region_map_entries(busses, &r64_pref);
> -} else {
> +} else if (!mem) {
>  // no bars mapped high -> drop 64bit window (see dsdt)
>  pcimem64_start = 0;
>  }
> @@ -801,11 +829,28 @@ static void pci_bios_map_devices(struct pci_bus *busses)
>  }
>  }
>  
> +static
> +struct pci_mem *pci_mem_get(void)
> +{
> +int psize;
>