diff options
author | Patrick Rudolph <siro@das-labor.org> | 2018-11-11 12:43:48 +0100 |
---|---|---|
committer | Ronald G. Minnich <rminnich@gmail.com> | 2018-11-11 21:23:27 +0000 |
commit | 69d5ef9d143afbd9904507dd02d32148c40c6474 (patch) | |
tree | 8de2998bbc69565c0db50112b6efbde504bf6cfc /src | |
parent | c0a1625df13ac9e95ca4de849ac52bb3af29c7b6 (diff) | |
download | coreboot-69d5ef9d143afbd9904507dd02d32148c40c6474.tar.xz |
mb/emulation/qemu-i440fx|q35: Link memory.c
Link memory.c instead of including it.
Change-Id: I2bc461b13332ec5885c33c87828a5fd023f8e730
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
Reviewed-on: https://review.coreboot.org/29574
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'src')
-rw-r--r-- | src/mainboard/emulation/qemu-i440fx/Makefile.inc | 2 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-i440fx/memory.c | 20 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-i440fx/memory.h | 24 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-i440fx/northbridge.c | 15 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-i440fx/romstage.c | 2 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-q35/Makefile.inc | 2 | ||||
-rw-r--r-- | src/mainboard/emulation/qemu-q35/romstage.c | 2 |
7 files changed, 48 insertions, 19 deletions
diff --git a/src/mainboard/emulation/qemu-i440fx/Makefile.inc b/src/mainboard/emulation/qemu-i440fx/Makefile.inc index f9cf252b8a..c986667f17 100644 --- a/src/mainboard/emulation/qemu-i440fx/Makefile.inc +++ b/src/mainboard/emulation/qemu-i440fx/Makefile.inc @@ -1,3 +1,5 @@ cpu_incs-y += $(src)/mainboard/emulation/qemu-i440fx/cache_as_ram.inc ramstage-y += northbridge.c ramstage-y += fw_cfg.c +romstage-y += memory.c +ramstage-y += memory.c
\ No newline at end of file diff --git a/src/mainboard/emulation/qemu-i440fx/memory.c b/src/mainboard/emulation/qemu-i440fx/memory.c index b8109e53fb..dea96f275d 100644 --- a/src/mainboard/emulation/qemu-i440fx/memory.c +++ b/src/mainboard/emulation/qemu-i440fx/memory.c @@ -14,6 +14,8 @@ */ #include <cbmem.h> +#include <arch/io.h> +#include "memory.h" #define CMOS_ADDR_PORT 0x70 #define CMOS_DATA_PORT 0x71 @@ -25,12 +27,24 @@ #define MID_HIGHRAM_ADDR 0x5c #define LOW_HIGHRAM_ADDR 0x5b -static unsigned long qemu_get_memory_size(void) +unsigned long qemu_get_high_memory_size(void) +{ + unsigned long high; + outb(HIGH_HIGHRAM_ADDR, CMOS_ADDR_PORT); + high = ((unsigned long) inb(CMOS_DATA_PORT)) << 22; + outb(MID_HIGHRAM_ADDR, CMOS_ADDR_PORT); + high |= ((unsigned long) inb(CMOS_DATA_PORT)) << 14; + outb(LOW_HIGHRAM_ADDR, CMOS_ADDR_PORT); + high |= ((unsigned long) inb(CMOS_DATA_PORT)) << 6; + return high; +} + +unsigned long qemu_get_memory_size(void) { unsigned long tomk; - outb (HIGH_RAM_ADDR, CMOS_ADDR_PORT); + outb(HIGH_RAM_ADDR, CMOS_ADDR_PORT); tomk = ((unsigned long) inb(CMOS_DATA_PORT)) << 14; - outb (LOW_RAM_ADDR, CMOS_ADDR_PORT); + outb(LOW_RAM_ADDR, CMOS_ADDR_PORT); tomk |= ((unsigned long) inb(CMOS_DATA_PORT)) << 6; tomk += 16 * 1024; return tomk; diff --git a/src/mainboard/emulation/qemu-i440fx/memory.h b/src/mainboard/emulation/qemu-i440fx/memory.h new file mode 100644 index 0000000000..d3b21a6673 --- /dev/null +++ b/src/mainboard/emulation/qemu-i440fx/memory.h @@ -0,0 +1,24 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2004 Stefan Reinauer <stefan.reinauer@coreboot.org> + * Copyright (C) 2018 Patrick Rudolph <siro@das-labor.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + + +#ifndef __QEMU_MEMORY_H_ +#define __QEMU_MEMORY_H_ + +unsigned long qemu_get_high_memory_size(void); +unsigned long qemu_get_memory_size(void); + +#endif diff --git a/src/mainboard/emulation/qemu-i440fx/northbridge.c b/src/mainboard/emulation/qemu-i440fx/northbridge.c index aa309de907..0795012bc5 100644 --- a/src/mainboard/emulation/qemu-i440fx/northbridge.c +++ b/src/mainboard/emulation/qemu-i440fx/northbridge.c @@ -23,26 +23,13 @@ #include <string.h> #include <delay.h> #include <smbios.h> -#include <cbmem.h> +#include "memory.h" #include "fw_cfg.h" #include "fw_cfg_if.h" -#include "memory.c" #include "acpi.h" -static unsigned long qemu_get_high_memory_size(void) -{ - unsigned long high; - outb (HIGH_HIGHRAM_ADDR, CMOS_ADDR_PORT); - high = ((unsigned long) inb(CMOS_DATA_PORT)) << 22; - outb (MID_HIGHRAM_ADDR, CMOS_ADDR_PORT); - high |= ((unsigned long) inb(CMOS_DATA_PORT)) << 14; - outb (LOW_HIGHRAM_ADDR, CMOS_ADDR_PORT); - high |= ((unsigned long) inb(CMOS_DATA_PORT)) << 6; - return high; -} - static void qemu_reserve_ports(struct device *dev, unsigned int idx, unsigned int base, unsigned int size, const char *name) diff --git a/src/mainboard/emulation/qemu-i440fx/romstage.c b/src/mainboard/emulation/qemu-i440fx/romstage.c index ce12a8bc6a..d41213a81c 100644 --- a/src/mainboard/emulation/qemu-i440fx/romstage.c +++ b/src/mainboard/emulation/qemu-i440fx/romstage.c @@ -18,6 +18,7 @@ #include <device/pci_ids.h> #include <arch/io.h> #include <device/pnp_def.h> +#include <cbmem.h> #include <console/console.h> #include <cpu/x86/bist.h> #include <cpu/intel/romstage.h> @@ -25,7 +26,6 @@ #include <delay.h> #include <cpu/x86/lapic.h> -#include "memory.c" void *asmlinkage romstage_main(unsigned long bist) { diff --git a/src/mainboard/emulation/qemu-q35/Makefile.inc b/src/mainboard/emulation/qemu-q35/Makefile.inc index fc4374ca83..923a28ed34 100644 --- a/src/mainboard/emulation/qemu-q35/Makefile.inc +++ b/src/mainboard/emulation/qemu-q35/Makefile.inc @@ -1,3 +1,5 @@ cpu_incs-y += $(src)/mainboard/emulation/qemu-i440fx/cache_as_ram.inc ramstage-y += ../qemu-i440fx/northbridge.c +ramstage-y += ../qemu-i440fx/memory.c ramstage-y += ../qemu-i440fx/fw_cfg.c +romstage-y += ../qemu-i440fx/memory.c diff --git a/src/mainboard/emulation/qemu-q35/romstage.c b/src/mainboard/emulation/qemu-q35/romstage.c index 870dd07762..846fcf312a 100644 --- a/src/mainboard/emulation/qemu-q35/romstage.c +++ b/src/mainboard/emulation/qemu-q35/romstage.c @@ -19,6 +19,7 @@ #include <arch/io.h> #include <device/pnp_def.h> #include <pc80/mc146818rtc.h> +#include <cbmem.h> #include <console/console.h> #include <southbridge/intel/i82801ix/i82801ix.h> #include <cpu/x86/bist.h> @@ -27,7 +28,6 @@ #include <delay.h> #include <cpu/x86/lapic.h> -#include "../qemu-i440fx/memory.c" void * asmlinkage romstage_main(unsigned long bist) { |