coreboot
Threads by month
- ----- 2025 -----
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
March 2010
- 61 participants
- 434 discussions
Author: oxygene
Date: Sat Mar 6 22:18:43 2010
New Revision: 5195
URL: http://tracker.coreboot.org/trac/coreboot/changeset/5195
Log:
More readable recursive descent macro in Makefile
Signed-off-by: Patrick Georgi <patrick.georgi(a)coresystems.de>
Acked-by: Stefan Reinauer <stepan(a)coresystems.de>
Modified:
trunk/Makefile
Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile Sat Mar 6 19:16:25 2010 (r5194)
+++ trunk/Makefile Sat Mar 6 22:18:43 2010 (r5195)
@@ -119,8 +119,32 @@
crt0s:=
ldscripts:=
types:=obj initobj driver smmobj
-includemakefiles=$(foreach type,$(2), $(eval $(type)-y:=)) $(eval subdirs-y:=) $(eval -include $(1)) $(if $(strip $(3)),$(foreach type,$(2),$(eval $(type)s+=$$(patsubst util/%,$(obj)/util/%,$$(patsubst src/%,$(obj)/%,$$(addprefix $(dir $(1)),$$($(type)-y))))))) $(eval subdirs+=$$(subst $(PWD)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))
-evaluate_subdirs=$(eval cursubdirs:=$(subdirs)) $(eval subdirs:=) $(foreach dir,$(cursubdirs),$(eval $(call includemakefiles,$(dir)/Makefile.inc,$(types),$(1)))) $(if $(subdirs),$(eval $(call evaluate_subdirs, $(1))))
+
+# Clean -y variables, include Makefile.inc
+# If $(3) is non-empty, add paths to files in X-y, and add them to Xs
+# Add subdirs-y to subdirs
+includemakefiles= \
+ $(foreach type,$(2), $(eval $(type)-y:=)) \
+ $(eval subdirs-y:=) \
+ $(eval -include $(1)) \
+ $(if $(strip $(3)), \
+ $(foreach type,$(2), \
+ $(eval $(type)s+= \
+ $$(patsubst util/%, \
+ $(obj)/util/%, \
+ $$(patsubst src/%, \
+ $(obj)/%, \
+ $$(addprefix $(dir $(1)),$$($(type)-y))))))) \
+ $(eval subdirs+=$$(subst $(PWD)/,,$$(abspath $$(addprefix $(dir $(1)),$$(subdirs-y)))))
+
+# For each path in $(subdirs) call includemakefiles, passing $(1) as $(3)
+# Repeat until subdirs is empty
+evaluate_subdirs= \
+ $(eval cursubdirs:=$(subdirs)) \
+ $(eval subdirs:=) \
+ $(foreach dir,$(cursubdirs), \
+ $(eval $(call includemakefiles,$(dir)/Makefile.inc,$(types),$(1)))) \
+ $(if $(subdirs),$(eval $(call evaluate_subdirs, $(1))))
# collect all object files eligible for building
subdirs:=$(PLATFORM-y) $(BUILD-y)
1
0

March 6, 2010
Author: uwe
Date: Sat Mar 6 19:16:25 2010
New Revision: 5194
URL: http://tracker.coreboot.org/trac/coreboot/changeset/5194
Log:
440BX: Do not hardcode DIMM number + size anymore.
The code currently assumes a 4-DIMM-slots board, this will be fixed soon.
Signed-off-by: Keith Hui <buurin(a)gmail.com>
Acked-by: Uwe Hermann <uwe(a)hermann-uwe.de>
Modified:
trunk/src/northbridge/intel/i440bx/i440bx.h
trunk/src/northbridge/intel/i440bx/raminit.c
Modified: trunk/src/northbridge/intel/i440bx/i440bx.h
==============================================================================
--- trunk/src/northbridge/intel/i440bx/i440bx.h Sat Mar 6 17:19:11 2010 (r5193)
+++ trunk/src/northbridge/intel/i440bx/i440bx.h Sat Mar 6 19:16:25 2010 (r5194)
@@ -32,11 +32,27 @@
* Any addresses between 0x00 and 0xff not listed below are either
* Reserved or Intel Reserved and should not be touched.
*/
+
#define NBXCFG 0x50 /* 440BX Configuration (0x0000:00S0_0000_000S_0S00b). */
#define DRAMC 0x57 /* DRAM Control (00S0_0000b). */
#define DRAMT 0x58 /* DRAM Timing (0x03). */
#define PAM 0x59 /* Programmable Attribute Map, 7 registers (0x00). */
+#define PAM0 0x59
+#define PAM1 0x5a
+#define PAM2 0x5b
+#define PAM3 0x5c
+#define PAM4 0x5d
+#define PAM5 0x5e
+#define PAM6 0x5f
#define DRB 0x60 /* DRAM Row Boundary, 8 registers (0x01). */
+#define DRB0 0x60
+#define DRB1 0x61
+#define DRB2 0x62
+#define DRB3 0x63
+#define DRB4 0x64
+#define DRB5 0x65
+#define DRB6 0x66
+#define DRB7 0x67
#define FDHC 0x68 /* Fixed SDRAM Hole Control (0x00). */
#define MBSC 0x69 /* Memory Buffer Strength Control (0x0000-0000-0000). */
#define SMRAM 0x72 /* System Management RAM Control (0x02). */
@@ -50,27 +66,24 @@
#define ERRCMD 0x90 /* Error Command Register (0x80). */
#define ERRSTS 0x91 /* Error Status (0x0000). */
// TODO: AGP stuff.
+#define ACAPID 0xa0 /* AGP Capability Identifier (0x00100002 or 0x00000000) */
+#define AGPSTAT 0xa4 /* AGP Status Register (0x1f000203, read only) */
+#define AGPCMD 0xa8 /* AGP Command Register (0x00000000) */
+#define AGPCTRL 0xb0 /* AGP Control Register (0x00000000) */
+#define APSIZE 0xb4 /* Aperture Size Control Register (0x00) */
+#define ATTBASE 0xb8 /* Aperture Translation Table (0x00000000) */
+
#define MBFS 0xca /* Memory Buffer Frequency Select (0x000000). */
#define BSPAD 0xd0 /* BIOS Scratch Pad (0x000..000). */
+#define BSPAD0 0xd0 /* These are free for our use. */
+#define BSPAD1 0xd1
+#define BSPAD2 0xd2
+#define BSPAD3 0xd3
+#define BSPAD4 0xd4
+#define BSPAD5 0xd5
+#define BSPAD6 0xd6
+#define BSPAD7 0xd7
#define DWTC 0xe0 /* DRAM Write Thermal Throttling Control (0x000..000). */
#define DRTC 0xe8 /* DRAM Read Thermal Throttling Control (0x000..000). */
#define BUFFC 0xf0 /* Buffer Control Register (0x0000). */
-/* For convenience: */
-#define DRB0 0x60
-#define DRB1 0x61
-#define DRB2 0x62
-#define DRB3 0x63
-#define DRB4 0x64
-#define DRB5 0x65
-#define DRB6 0x66
-#define DRB7 0x67
-
-#define PAM0 0x59
-#define PAM1 0x5a
-#define PAM2 0x5b
-#define PAM3 0x5c
-#define PAM4 0x5d
-#define PAM5 0x5e
-#define PAM6 0x5f
-
Modified: trunk/src/northbridge/intel/i440bx/raminit.c
==============================================================================
--- trunk/src/northbridge/intel/i440bx/raminit.c Sat Mar 6 17:19:11 2010 (r5193)
+++ trunk/src/northbridge/intel/i440bx/raminit.c Sat Mar 6 19:16:25 2010 (r5194)
@@ -2,6 +2,7 @@
* This file is part of the coreboot project.
*
* Copyright (C) 2007-2008 Uwe Hermann <uwe(a)hermann-uwe.de>
+ * Copyright (C) 2010 Keith Hui <buurin(a)gmail.com>
*
* 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
@@ -23,6 +24,7 @@
#include <delay.h>
#include <stdlib.h>
#include "i440bx.h"
+#include "raminit.h"
/*-----------------------------------------------------------------------------
Macros and definitions.
@@ -185,14 +187,23 @@
* 10 = Write Only (Writes to DRAM, reads to memory mapped I/O space)
* 11 = Read/Write (all access goes to DRAM)
*/
- // TODO
- PAM0, 0x00, 0x00,
- PAM1, 0x00, 0x00,
- PAM2, 0x00, 0x00,
- PAM3, 0x00, 0x00,
- PAM4, 0x00, 0x00,
- PAM5, 0x00, 0x00,
- PAM6, 0x00, 0x00,
+
+ /*
+ * Map all legacy regions to RAM (read/write). This is required if
+ * you want to use the RAM area from 768 KB - 1 MB. If the PAM
+ * registers are not set here appropriately, the RAM in that region
+ * will not be accessible, thus a RAM check of it will also fail.
+ *
+ * TODO: This was set in sdram_set_spd_registers().
+ * Test if it still works when set here.
+ */
+ PAM0, 0x00, 0x30,
+ PAM1, 0x00, 0x33,
+ PAM2, 0x00, 0x33,
+ PAM3, 0x00, 0x33,
+ PAM4, 0x00, 0x33,
+ PAM5, 0x00, 0x33,
+ PAM6, 0x00, 0x33,
/* DRB[0:7] - DRAM Row Boundary Registers
* 0x60 - 0x67
@@ -340,6 +351,9 @@
// PMCR, 0x00, 0x14,
// PMCR, 0x00, 0x10,
PMCR, 0x00, 0x00,
+
+ /* Enable SCRR.SRRAEN and let BX choose the SRR. */
+ SCRR + 1, 0x00, 0x10,
};
/*-----------------------------------------------------------------------------
@@ -374,8 +388,8 @@
/* Send the RAM command to each row of memory. */
dimm_start = 0;
for (i = 0; i < (DIMM_SOCKETS * 2); i++) {
- addr_offset = 0;
- caslatency = 3; /* TODO: Dynamically get CAS latency later. */
+ addr_offset = 0;
+ caslatency = 3; /* TODO: Dynamically get CAS latency later. */
if (command == RAM_COMMAND_MRS) {
/*
* MAA[12:11,9:0] must be inverted when sent to DIMM
@@ -411,6 +425,19 @@
}
}
+static void set_dram_buffer_strength(void)
+{
+ /* TODO: This needs to be set according to the DRAM tech
+ * (x8, x16, or x32). Argh, Intel provides no docs on this!
+ * Currently, it needs to be pulled from the output of
+ * lspci -xxx Rx92
+ *
+ * Relevant registers: MBSC, MBFS, BUFFC.
+ */
+
+ pci_write_config8(NB, MBSC, 0x03);
+}
+
/*-----------------------------------------------------------------------------
DIMM-independant configuration functions.
-----------------------------------------------------------------------------*/
@@ -458,69 +485,311 @@
reg &= register_values[i + 1];
reg |= register_values[i + 2] & ~(register_values[i + 1]);
pci_write_config8(NB, register_values[i], reg);
-
+#if 0
PRINT_DEBUG(" Set register 0x");
PRINT_DEBUG_HEX8(register_values[i]);
PRINT_DEBUG(" to 0x");
PRINT_DEBUG_HEX8(reg);
PRINT_DEBUG("\r\n");
+#endif
}
}
-static void sdram_set_spd_registers(void)
+struct dimm_size {
+ unsigned long side1;
+ unsigned long side2;
+};
+
+static struct dimm_size spd_get_dimm_size(unsigned int device)
{
- /* TODO: Don't hardcode the values here, get info via SPD. */
+ struct dimm_size sz;
+ int i, module_density, dimm_banks;
+ sz.side1 = 0;
+ module_density = spd_read_byte(device, SPD_DENSITY_OF_EACH_ROW_ON_MODULE);
+ dimm_banks = spd_read_byte(device, SPD_NUM_DIMM_BANKS);
+
+ /* Find the size of side1. */
+ /* Find the larger value. The larger value is always side1. */
+ for (i = 512; i >= 0; i >>= 1) {
+ if ((module_density & i) == i) {
+ sz.side1 = i;
+ break;
+ }
+ }
- /* Map all legacy regions to RAM (read/write). This is required if
- * you want to use the RAM area from 768 KB - 1 MB. If the PAM
- * registers are not set here appropriately, the RAM in that region
- * will not be accessible, thus a RAM check of it will also fail.
+ /* Set to 0 in case it's single sided. */
+ sz.side2 = 0;
+
+ /* Test if it's a dual-sided DIMM. */
+ if (dimm_banks > 1) {
+ /* Test if there's a second value. If so it's asymmetrical. */
+ if (module_density != i) {
+ /*
+ * Find second value, picking up where we left off.
+ * i >>= 1 done initially to make sure we don't get
+ * the same value again.
+ */
+ for (i >>= 1; i >= 0; i >>= 1) {
+ if (module_density == (sz.side1 | i)) {
+ sz.side2 = i;
+ break;
+ }
+ }
+ /* If not, it's symmetrical. */
+ } else {
+ sz.side2 = sz.side1;
+ }
+ }
+
+ /*
+ * SPD byte 31 is the memory size divided by 4 so we
+ * need to muliply by 4 to get the total size.
*/
- pci_write_config8(NB, PAM0, 0x30);
- pci_write_config8(NB, PAM1, 0x33);
- pci_write_config8(NB, PAM2, 0x33);
- pci_write_config8(NB, PAM3, 0x33);
- pci_write_config8(NB, PAM4, 0x33);
- pci_write_config8(NB, PAM5, 0x33);
- pci_write_config8(NB, PAM6, 0x33);
-
- /* TODO: Set DRB0-DRB7. */
- /* Currently this is hardcoded to one 64 MB DIMM in slot 0. */
- pci_write_config8(NB, DRB0, 0x08);
- pci_write_config8(NB, DRB1, 0x08);
- pci_write_config8(NB, DRB2, 0x08);
- pci_write_config8(NB, DRB3, 0x08);
- pci_write_config8(NB, DRB4, 0x08);
- pci_write_config8(NB, DRB5, 0x08);
- pci_write_config8(NB, DRB6, 0x08);
- pci_write_config8(NB, DRB7, 0x08);
+ sz.side1 *= 4;
+ sz.side2 *= 4;
+
+ return sz;
+}
+/*
+ * Sets DRAM attributes one DIMM at a time, based on SPD data.
+ * Northbridge settings that are set: NBXCFG[31:24], DRB0-DRB7, RPS, DRAMC.
+ */
+static void set_dram_row_attributes(void)
+{
+ int i, dra, drb, col, width, value, rps, edosd, ecc, nbxecc;
+ u8 bpr; /* Top 8 bits of PGPOL */
- /* TODO: Set DRAMC. Don't enable refresh for now. */
- pci_write_config8(NB, DRAMC, 0x08);
+ edosd = 0;
+ rps = 0;
+ drb = 0;
+ bpr = 0;
+ nbxecc = 0xff;
- /* TODO: Set RPS. Needs to be fixed for multiple DIMM support. */
- pci_write_config16(NB, RPS, 0x0001);
+ for (i = 0; i < DIMM_SOCKETS; i++) {
+ unsigned int device;
+ device = DIMM_SPD_BASE + i;
+ bpr >>= 2;
+
+ /* First check if a DIMM is actually present. */
+ value = spd_read_byte(device, SPD_MEMORY_TYPE);
+ /* This is 440BX! We do EDO too! */
+ if (value == SPD_MEMORY_TYPE_EDO
+ || value == SPD_MEMORY_TYPE_SDRAM) {
+
+ PRINT_DEBUG("Found ");
+ if (value == SPD_MEMORY_TYPE_EDO) {
+ edosd |= 0x02;
+ } else if (value == SPD_MEMORY_TYPE_SDRAM) {
+ edosd |= 0x04;
+ }
+ PRINT_DEBUG("DIMM in slot ");
+ PRINT_DEBUG_HEX8(i);
+ PRINT_DEBUG("\r\n");
+
+ if (edosd == 0x06) {
+ print_err("Mixing EDO/SDRAM unsupported!\r\n");
+ die("HALT\r\n");
+ }
+
+ /* "DRA" is our RPS for the two rows on this DIMM. */
+ dra = 0;
+
+ /* Columns */
+ col = spd_read_byte(device, SPD_NUM_COLUMNS);
+
+ /*
+ * Is this an ECC DIMM? Actually will be a 2 if so.
+ * TODO: Other register than NBXCFG also needs this
+ * ECC information.
+ */
+ ecc = spd_read_byte(device, SPD_DIMM_CONFIG_TYPE);
+
+ /* Data width */
+ width = spd_read_byte(device, SPD_MODULE_DATA_WIDTH_LSB);
+
+ /* Exclude error checking data width from page size calculations */
+ if (ecc) {
+ value = spd_read_byte(device,
+ SPD_ERROR_CHECKING_SDRAM_WIDTH);
+ width -= value;
+ /* ### ECC */
+ /* Clear top 2 bits to help set up NBXCFG. */
+ ecc &= 0x3f;
+ } else {
+ /* Without ECC, top 2 bits should be 11. */
+ ecc |= 0xc0;
+ }
+
+ /* Calculate page size in bits. */
+ value = ((1 << col) * width);
+
+ /* Convert to KB. */
+ dra = (value >> 13);
+
+ /* Number of banks of DIMM (single or double sided). */
+ value = spd_read_byte(device, SPD_NUM_DIMM_BANKS);
+
+ /* Once we have dra, col is done and can be reused.
+ * So it's reused for number of banks.
+ */
+ col = spd_read_byte(device, SPD_NUM_BANKS_PER_SDRAM);
+
+ if (value == 1) {
+ /*
+ * Second bank of 1-bank DIMMs "doesn't have
+ * ECC" - or anything.
+ */
+ ecc |= 0x80;
+ if (dra == 2) {
+ dra = 0x0; /* 2KB */
+ } else if (dra == 4) {
+ dra = 0x1; /* 4KB */
+ } else if (dra == 8) {
+ dra = 0x2; /* 8KB */
+ } else {
+ dra = -1;
+ }
+ /*
+ * Sets a flag in PGPOL[BPR] if this DIMM has
+ * 4 banks per row.
+ */
+ if (col == 4)
+ bpr |= 0x40;
+ } else if (value == 2) {
+ if (dra == 2) {
+ dra = 0x0; /* 2KB */
+ } else if (dra == 4) {
+ dra = 0x05; /* 4KB */
+ } else if (dra == 8) {
+ dra = 0x0a; /* 8KB */
+ } else {
+ dra = -1;
+ }
+ /* Ditto */
+ if (col == 4)
+ bpr |= 0xc0;
+ } else {
+ print_err("# of banks of DIMM unsupported!\r\n");
+ die("HALT\r\n");
+ }
+ if (dra == -1) {
+ print_err("Page size not supported\r\n");
+ die("HALT\r\n");
+ }
+
+ /*
+ * 440BX supports asymmetrical dual-sided DIMMs,
+ * but can't handle DIMMs smaller than 8MB per
+ * side or larger than 128MB per side.
+ */
+ struct dimm_size sz = spd_get_dimm_size(device);
+ if ((sz.side1 < 8)) {
+ print_err("DIMMs smaller than 8MB per side\r\n"
+ "are not supported on this NB.\r\n");
+ die("HALT\r\n");
+ }
+ if ((sz.side1 > 128)) {
+ print_err ("DIMMs > 128MB per side\r\n"
+ "are not supported on this NB\r\n");
+ die("HALT\r\n");
+ }
+
+ /* Divide size by 8 to set up the DRB registers. */
+ drb += (sz.side1 / 8);
+
+ /*
+ * Build the DRB for the next row in MSB so it gets
+ * placed in DRB[n+1] where it belongs when written
+ * as a 16-bit word.
+ */
+ drb &= 0xff;
+ drb |= (drb + (sz.side2 / 8)) << 8;
+ } else {
+#if 0
+ PRINT_DEBUG("No DIMM found in slot ");
+ PRINT_DEBUG_HEX8(i);
+ PRINT_DEBUG("\r\n");
+#endif
+
+ /* If there's no DIMM in the slot, set dra to 0x00. */
+ dra = 0x00;
+ ecc = 0xc0;
+ /* Still have to propagate DRB over. */
+ drb &= 0xff;
+ drb |= (drb << 8);
+ }
+
+ pci_write_config16(NB, DRB + (2 * i), drb);
+#if 0
+ PRINT_DEBUG("DRB has been set to 0x");
+ PRINT_DEBUG_HEX16(drb);
+ PRINT_DEBUG("\r\n");
+#endif
+
+ /* Brings the upper DRB back down to be base for
+ * DRB calculations for the next two rows.
+ */
+ drb >>= 8;
+
+ rps |= (dra & 0x0f) << (i * 4);
+ nbxecc = (nbxecc >> 2) | (ecc & 0xc0);
+ }
+
+ /* Set paging policy register. */
+ pci_write_config8(NB, PGPOL + 1, bpr);
+ PRINT_DEBUG("PGPOL[BPR] has been set to 0x");
+ PRINT_DEBUG_HEX8(bpr);
+ PRINT_DEBUG("\r\n");
+
+ /* Set DRAM row page size register. */
+ pci_write_config16(NB, RPS, rps);
+ PRINT_DEBUG("RPS has been set to 0x");
+ PRINT_DEBUG_HEX16(rps);
+ PRINT_DEBUG("\r\n");
+
+ /* ### ECC */
+ pci_write_config8(NB, NBXCFG + 3, nbxecc);
+ PRINT_DEBUG("NBXECC[31:24] has been set to 0x");
+ PRINT_DEBUG_HEX8(nbxecc);
+ PRINT_DEBUG("\r\n");
+
+ /* Set DRAMC[4:3] to proper memory type (EDO/SDRAM).
+ * TODO: Registered SDRAM support.
+ */
+ edosd &= 0x07;
+ if (edosd & 0x02) {
+ edosd |= 0x00;
+ } else if (edosd & 0x04) {
+ edosd |= 0x08;
+ }
+ edosd &= 0x18;
+
+ /* edosd is now in the form needed for DRAMC[4:3]. */
+ value = pci_read_config8(NB, DRAMC) & 0xe7;
+ value |= edosd;
+ pci_write_config8(NB, DRAMC, value);
+ PRINT_DEBUG("DRAMC has been set to 0x");
+ PRINT_DEBUG_HEX8(value);
+ PRINT_DEBUG("\r\n");
+}
+
+static void sdram_set_spd_registers(void)
+{
+ /* Setup DRAM row boundary registers and other attributes. */
+ set_dram_row_attributes();
/* TODO: Set SDRAMC. */
pci_write_config16(NB, SDRAMC, 0x0010); /* SDRAMPWR=1: 4 DIMM config */
- /* TODO: Set PGPOL. */
- // pci_write_config16(NB, PGPOL, 0x0107);
- pci_write_config16(NB, PGPOL, 0x0123);
-
- /* TODO: Set NBXCFG. */
- // pci_write_config32(NB, NBXCFG, 0x0100220c); // FIXME?
- pci_write_config32(NB, NBXCFG, 0xff00800c);
+ /* TODO */
+ set_dram_buffer_strength();
/* TODO: Set PMCR? */
// pci_write_config8(NB, PMCR, 0x14);
pci_write_config8(NB, PMCR, 0x10);
/* TODO? */
- pci_write_config8(NB, PCI_LATENCY_TIMER, 0x40);
pci_write_config8(NB, DRAMT, 0x03);
- pci_write_config8(NB, MBSC, 0x03);
- pci_write_config8(NB, SCRR, 0x38);
}
static void sdram_enable(void)
1
0
Author: uwe
Date: Sat Mar 6 17:19:11 2010
New Revision: 5193
URL: http://tracker.coreboot.org/trac/coreboot/changeset/5193
Log:
Add support for the 0x06B1 CPU ID for Celeron (Tualatin).
Signed-off-by: Keith Hui <buurin(a)gmail.com>
Acked-by: Uwe Hermann <uwe(a)hermann-uwe.de>
Modified:
trunk/src/cpu/intel/model_6xx/model_6xx_init.c
Modified: trunk/src/cpu/intel/model_6xx/model_6xx_init.c
==============================================================================
--- trunk/src/cpu/intel/model_6xx/model_6xx_init.c Fri Mar 5 20:12:34 2010 (r5192)
+++ trunk/src/cpu/intel/model_6xx/model_6xx_init.c Sat Mar 6 17:19:11 2010 (r5193)
@@ -58,6 +58,7 @@
{ X86_VENDOR_INTEL, 0x06A1 },
{ X86_VENDOR_INTEL, 0x06A4 },
{ X86_VENDOR_INTEL, 0x06B0 }, /* Mobile Celeron FCBGA */
+ { X86_VENDOR_INTEL, 0x06B1 }, /* Celeron (Tualatin) */
{ X86_VENDOR_INTEL, 0x06B4 },
{ 0, 0 },
};
1
0
Hi,
attached patch should help devs to more easily understand the "main
loop" that includes Makefile.incs.
Signed-off-by: Patrick Georgi <patrick.georgi(a)coresystems.de>
2
1
Dear coreboot readers!
This is the automatic build system of coreboot.
The developer "myles" checked in revision 5192 to
the coreboot repository. This caused the following
changes:
Change Log:
Remove redundant run_bios prototype. Trivial.
Signed-off-by: Myles Watson <mylesgw(a)gmail.com>
Acked-by: Myles Watson <mylesgw(a)gmail.com>
Build Log:
Compilation of emulation:qemu-x86 has been fixed
If something broke during this checkin please be a pain
in myles's neck until the issue is fixed.
If this issue is not fixed within 24h the revision should
be backed out.
Best regards,
coreboot automatic build system
1
0

[commit] r5185 - in trunk: src src/console src/cpu/x86/smm src/devices src/mainboard/amd/dbm690t src/mainboard/amd/pistachio src/mainboard/amd/serengeti_cheetah_fam10 src/mainboard/asus/a8n_e src/m...
by repository service March 5, 2010
by repository service March 5, 2010
March 5, 2010
Author: stepan
Date: Fri Mar 5 11:03:50 2010
New Revision: 5185
URL: http://tracker.coreboot.org/trac/coreboot/changeset/5185
Log:
This patch is from 2009-10-20
Convert all DEBUG_SMBUS, DEBUG_SMI, and DEBUG_RAM_SETUP custom and
local #defines into globally configurable kconfig options (and Options.lb
options for as long as newconfig still exists) which can be enabled
by the user in the "Debugging" menu.
The respective menu items only appear if a board is selected where the
chipset code actually provides such additional DEBUG output.
All three variables default to 0 / off for now.
Also, drop a small chunk of dead/useless code in the
src/northbridge/via/cn700/raminit.c file, which would otherwise break
compilation.
Signed-off-by: Uwe Hermann <uwe(a)hermann-uwe.de>
Reworked to still apply to trunk, added X86EMU_DEBUG (and make the x86emu/yabel
code only work printf instead of a redefined version of printk and
Acked-by: Stefan Reinauer <stepan(a)coresystems.de>
Modified:
trunk/src/Kconfig
trunk/src/console/printk.c
trunk/src/cpu/x86/smm/smihandler.c
trunk/src/cpu/x86/smm/smiutil.c
trunk/src/devices/Kconfig
trunk/src/mainboard/amd/dbm690t/romstage.c
trunk/src/mainboard/amd/pistachio/romstage.c
trunk/src/mainboard/amd/serengeti_cheetah_fam10/romstage.c
trunk/src/mainboard/asus/a8n_e/romstage.c
trunk/src/mainboard/asus/a8v-e_se/romstage.c
trunk/src/mainboard/asus/m2v-mx_se/romstage.c
trunk/src/mainboard/kontron/986lcd-m/romstage.c
trunk/src/mainboard/msi/ms7135/romstage.c
trunk/src/mainboard/msi/ms7260/romstage.c
trunk/src/mainboard/msi/ms9185/romstage.c
trunk/src/mainboard/msi/ms9282/romstage.c
trunk/src/northbridge/amd/amdfam10/debug.c
trunk/src/northbridge/amd/amdfam10/raminit_amdmct.c
trunk/src/northbridge/amd/amdk8/debug.c
trunk/src/northbridge/amd/amdk8/raminit_f.c
trunk/src/northbridge/intel/e7501/raminit.c
trunk/src/northbridge/intel/i440bx/raminit.c
trunk/src/northbridge/intel/i82810/raminit.c
trunk/src/northbridge/intel/i82830/raminit.c
trunk/src/northbridge/intel/i945/raminit.c
trunk/src/northbridge/via/cn700/raminit.c
trunk/src/northbridge/via/cx700/cx700_early_smbus.c
trunk/src/northbridge/via/cx700/raminit.c
trunk/src/northbridge/via/vx800/raminit.c
trunk/src/northbridge/via/vx800/vx800_early_smbus.c
trunk/src/southbridge/intel/i82801gx/i82801gx_smihandler.c
trunk/src/southbridge/via/vt8237r/vt8237r.h
trunk/util/x86emu/include/x86emu/fpu_regs.h
trunk/util/x86emu/include/x86emu/regs.h
trunk/util/x86emu/include/x86emu/x86emu.h
trunk/util/x86emu/x86.c
trunk/util/x86emu/x86_interrupts.c
trunk/util/x86emu/x86emu/debug.c
trunk/util/x86emu/x86emu/debug.h
trunk/util/x86emu/x86emu/decode.c
trunk/util/x86emu/x86emu/fpu.c
trunk/util/x86emu/x86emu/ops.c
trunk/util/x86emu/x86emu/ops2.c
trunk/util/x86emu/x86emu/sys.c
trunk/util/x86emu/x86emu/x86emui.h
trunk/util/x86emu/yabel/biosemu.c
trunk/util/x86emu/yabel/biosemu.h
trunk/util/x86emu/yabel/compat/functions.c
trunk/util/x86emu/yabel/debug.h
trunk/util/x86emu/yabel/device.c
trunk/util/x86emu/yabel/interrupt.c
trunk/util/x86emu/yabel/io.c
trunk/util/x86emu/yabel/mem.c
trunk/util/x86emu/yabel/vbe.c
Modified: trunk/src/Kconfig
==============================================================================
--- trunk/src/Kconfig Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/Kconfig Fri Mar 5 11:03:50 2010 (r5185)
@@ -609,6 +609,190 @@
If enabled, you will be able to set breakpoints for gdb debugging.
See src/arch/i386/lib/c_start.S for details.
+config DEBUG_RAM_SETUP
+ bool "Output verbose RAM init debug messages"
+ default n
+ depends on (NORTHBRIDGE_AMD_AMDFAM10 \
+ || NORTHBRIDGE_AMD_AMDK8 \
+ || NORTHBRIDGE_VIA_CN700 \
+ || NORTHBRIDGE_VIA_CX700 \
+ || NORTHBRIDGE_VIA_VX800 \
+ || NORTHBRIDGE_INTEL_E7501 \
+ || NORTHBRIDGE_INTEL_I440BX \
+ || NORTHBRIDGE_INTEL_I82810 \
+ || NORTHBRIDGE_INTEL_I82830 \
+ || NORTHBRIDGE_INTEL_I945)
+ help
+ This option enables additional RAM init related debug messages.
+ It is recommended to enable this when debugging issues on your
+ board which might be RAM init related.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config DEBUG_SMBUS
+ bool "Output verbose SMBus debug messages"
+ default n
+ depends on (SOUTHBRIDGE_VIA_VT8237R \
+ || NORTHBRIDGE_VIA_VX800 \
+ || NORTHBRIDGE_VIA_CX700 \
+ || NORTHBRIDGE_AMD_AMDK8)
+ help
+ This option enables additional SMBus (and SPD) debug messages.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config DEBUG_SMI
+ bool "Output verbose SMI debug messages"
+ default n
+ depends on HAVE_SMI_HANDLER
+ help
+ This option enables additional SMI related debug messages.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config X86EMU_DEBUG
+ bool "Output verbose x86emu debug messages"
+ default n
+ depends on PCI_OPTION_ROM_RUN_YABEL
+ help
+ This option enables additional x86emu related debug messages.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config X86EMU_DEBUG_JMP
+ bool "Trace JMP/RETF"
+ default n
+ depends on X86EMU_DEBUG
+ help
+ Print information about JMP and RETF opcodes from x86emu.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config X86EMU_DEBUG_TRACE
+ bool "Trace all opcodes"
+ default n
+ depends on X86EMU_DEBUG
+ help
+ Print _all_ opcodes that are executed by x86emu.
+
+ WARNING: This will produce a LOT of output and take a long time.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config X86EMU_DEBUG_PNP
+ bool "Log Plug&Play accesses"
+ default n
+ depends on X86EMU_DEBUG
+ help
+ Print Plug And Play accesses made by option ROMs.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config X86EMU_DEBUG_DISK
+ bool "Log Disk I/O"
+ default n
+ depends on X86EMU_DEBUG
+ help
+ Print Disk I/O related messages.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config X86EMU_DEBUG_PMM
+ bool "Log PMM"
+ default n
+ depends on X86EMU_DEBUG
+ help
+ Print messages related to POST Memory Manager (PMM).
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+
+config X86EMU_DEBUG_VBE
+ bool "Debug VESA BIOS Extensions"
+ default n
+ depends on X86EMU_DEBUG
+ help
+ Print messages related to VESA BIOS Extension (VBE) functions.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config X86EMU_DEBUG_INT10
+ bool "Redirect INT10 output to console"
+ default n
+ depends on X86EMU_DEBUG
+ help
+ Let INT10 (i.e. character output) calls print messages to debug output.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config X86EMU_DEBUG_INTERRUPTS
+ bool "Log intXX calls"
+ default n
+ depends on X86EMU_DEBUG
+ help
+ Print messages related to interrupt handling.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config X86EMU_DEBUG_CHECK_VMEM_ACCESS
+ bool "Log special memory accesses"
+ default n
+ depends on X86EMU_DEBUG
+ help
+ Print messages related to accesses to certain areas of the virtual
+ memory (e.g. BDA (BIOS Data Area) or interrupt vectors)
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config X86EMU_DEBUG_MEM
+ bool "Log all memory accesses"
+ default n
+ depends on X86EMU_DEBUG
+ help
+ Print memory accesses made by option ROM.
+ Note: This also includes accesses to fetch instructions.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
+config X86EMU_DEBUG_IO
+ bool "Log IO accesses"
+ default n
+ depends on X86EMU_DEBUG
+ help
+ Print I/O accesses made by option ROM.
+
+ Note: This option will increase the size of the coreboot image.
+
+ If unsure, say N.
+
endmenu
config LIFT_BSP_APIC_ID
Modified: trunk/src/console/printk.c
==============================================================================
--- trunk/src/console/printk.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/console/printk.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -19,8 +19,6 @@
/* Keep together for sysctl support */
int console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
-int default_message_loglevel = DEFAULT_MESSAGE_LOGLEVEL;
-int minimum_console_loglevel = MINIMUM_CONSOLE_LOGLEVEL;
int default_console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
DECLARE_SPIN_LOCK(console_lock)
Modified: trunk/src/cpu/x86/smm/smihandler.c
==============================================================================
--- trunk/src/cpu/x86/smm/smihandler.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/cpu/x86/smm/smihandler.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -27,8 +27,6 @@
void southbridge_smi_set_eos(void);
-/* To enable SMI define DEBUG_SMI in smiutil.c */
-
typedef enum { SMI_LOCKED, SMI_UNLOCKED } smi_semaphore;
/* SMI multiprocessing semaphore */
Modified: trunk/src/cpu/x86/smm/smiutil.c
==============================================================================
--- trunk/src/cpu/x86/smm/smiutil.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/cpu/x86/smm/smiutil.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -25,8 +25,6 @@
#include <cpu/x86/cache.h>
#include <cpu/x86/smm.h>
-// #define DEBUG_SMI
-
/* ********************* smi_util ************************* */
/* Data */
@@ -119,7 +117,7 @@
void console_init(void)
{
-#ifdef DEBUG_SMI
+#if CONFIG_DEBUG_SMI
console_loglevel = CONFIG_DEFAULT_CONSOLE_LOGLEVEL;
uart_init();
#else
Modified: trunk/src/devices/Kconfig
==============================================================================
--- trunk/src/devices/Kconfig Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/devices/Kconfig Fri Mar 5 11:03:50 2010 (r5185)
@@ -74,63 +74,6 @@
endchoice
-# TODO: Describe better, and/or make a "choice" selection for this.
-config YABEL_DEBUG_FLAGS
- prompt "Hex value for YABEL debug flags"
- hex
- default 0x0
- depends on PCI_OPTION_ROM_RUN_YABEL
- help
- CONFIG_YABEL_DEBUG_FLAGS is a binary switch that allows you
- to select the following items to debug. 1=on 0=off. After you
- decide what you want to debug create the binary value, convert to
- hex and set the option.
-
- Example for "debug all":
- CONFIG_YABEL_DEBUG_FLAGS = 0x31FF
-
- |-DEBUG_JMP - Print info about JMP and RETF opcodes from x86emu
- ||-DEBUG_TRACE_X86EMU - Print _all_ opcodes that are executed by
- || x86emu (WARNING: this will produce a LOT
- || of output)
- |||-Currently unused
- ||||-Currently unused
- |||||-Currently unused
- ||||||-DEBUG_PNP - Print Plug And Play accesses made by option ROM
- |||||||-DEBUG_DISK - Print Disk I/O related messages, currently unused
- ||||||||-DEBUG_PMM - Print messages related to POST Memory
- |||||||| Manager (PMM)
- |||||||||-DEBUG_VBE - Print messages related to VESA BIOS Extension
- ||||||||| (VBE) functions
- ||||||||||-DEBUG_PRINT_INT10 - Let INT10 (i.e. character output)
- |||||||||| calls print messages to debug output
- |||||||||||-DEBUG_INTR - Print messages related to interrupt handling
- ||||||||||||-DEBUG_CHECK_VMEM_ACCESS - Print messages related to
- |||||||||||| accesses to certain areas of
- |||||||||||| the virtual memory (e.g. BDA
- |||||||||||| (BIOS Data Area) or interrupt
- |||||||||||| vectors)
- |||||||||||||-DEBUG_MEM - Print memory accesses made by option ROM
- ||||||||||||| (NOTE: this also includes accesses to
- ||||||||||||| fetch instructions)
- ||||||||||||||-DEBUG_IO - Print I/O accesses made by option ROM
- 11000111111111 - Maximum binary value, i.e. "debug all"
- (WARNING: This could run for hours)
-
- DEBUG_IO 0x0001
- DEBUG_MEM 0x0002
- DEBUG_CHECK_VMEM_ACCESS 0x0004
- DEBUG_INTR 0x0008
- DEBUG_PRINT_INT10 0x0010
- DEBUG_VBE 0x0020
- DEBUG_PMM 0x0040
- DEBUG_DISK 0x0080
- DEBUG_PNP 0x0100
- DEBUG_TRACE_X86EMU 0x1000
- DEBUG_JMP 0x2000
-
- See debug.h for values. 0 is no debug output, 0x31ff is _verbose_.
-
config YABEL_PCI_ACCESS_OTHER_DEVICES
prompt "Allow option ROMs to access other devices"
bool
@@ -150,6 +93,11 @@
YABEL requires 1MB memory for its CPU emulation. This memory is
normally located at 16MB.
+config YABEL_VIRTMEM_LOCATION
+ hex
+ depends on PCI_OPTION_ROM_RUN_YABEL && !EXPERT
+ default 0x1000000
+
config YABEL_DIRECTHW
prompt "Direct hardware access"
bool
Modified: trunk/src/mainboard/amd/dbm690t/romstage.c
==============================================================================
--- trunk/src/mainboard/amd/dbm690t/romstage.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/mainboard/amd/dbm690t/romstage.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -57,7 +57,6 @@
#include "cpu/x86/lapic/boot_cpu.c"
#include "northbridge/amd/amdk8/reset_test.c"
-#include "northbridge/amd/amdk8/debug.c"
#include "superio/ite/it8712f/it8712f_early_serial.c"
#include "cpu/amd/mtrr/amd_earlymtrr.c"
@@ -67,6 +66,7 @@
#include "southbridge/amd/rs690/rs690_early_setup.c"
#include "southbridge/amd/sb600/sb600_early_setup.c"
+#include "northbridge/amd/amdk8/debug.c" /* After sb600_early_setup.c! */
/* CAN'T BE REMOVED! crt0.S will use it. I don't know WHY!*/
static void memreset(int controllers, const struct mem_controller *ctrl)
Modified: trunk/src/mainboard/amd/pistachio/romstage.c
==============================================================================
--- trunk/src/mainboard/amd/pistachio/romstage.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/mainboard/amd/pistachio/romstage.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -51,7 +51,6 @@
#include "cpu/x86/lapic/boot_cpu.c"
#include "northbridge/amd/amdk8/reset_test.c"
-#include "northbridge/amd/amdk8/debug.c"
#include "superio/ite/it8712f/it8712f_early_serial.c"
#include "cpu/amd/mtrr/amd_earlymtrr.c"
@@ -61,6 +60,7 @@
#include "southbridge/amd/rs690/rs690_early_setup.c"
#include "southbridge/amd/sb600/sb600_early_setup.c"
+#include "northbridge/amd/amdk8/debug.c" /* After sb600_early_setup.c! */
/* CAN'T BE REMOVED! crt0.S will use it. I don't know WHY!*/
static void memreset(int controllers, const struct mem_controller *ctrl)
Modified: trunk/src/mainboard/amd/serengeti_cheetah_fam10/romstage.c
==============================================================================
--- trunk/src/mainboard/amd/serengeti_cheetah_fam10/romstage.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/mainboard/amd/serengeti_cheetah_fam10/romstage.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -29,8 +29,6 @@
#define RAMINIT_SYSINFO 1
#define CACHE_AS_RAM_ADDRESS_DEBUG 1
-#define DEBUG_SMBUS 1
-
#define SET_NB_CFG_54 1
//used by raminit
Modified: trunk/src/mainboard/asus/a8n_e/romstage.c
==============================================================================
--- trunk/src/mainboard/asus/a8n_e/romstage.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/mainboard/asus/a8n_e/romstage.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -30,9 +30,6 @@
/* Used by raminit. */
#define QRANK_DIMM_SUPPORT 1
-/* Turn this on for SMBus debugging output. */
-#define DEBUG_SMBUS 0
-
#if CONFIG_LOGICAL_CPUS == 1
#define SET_NB_CFG_54 1
#endif
Modified: trunk/src/mainboard/asus/a8v-e_se/romstage.c
==============================================================================
--- trunk/src/mainboard/asus/a8v-e_se/romstage.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/mainboard/asus/a8v-e_se/romstage.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -40,8 +40,6 @@
/* If we want to wait for core1 done before DQS training, set it to 0. */
#define K8_SET_FIDVID_CORE0_ONLY 1
-/* #define DEBUG_SMBUS 1 */
-
#include <stdint.h>
#include <string.h>
#include <device/pci_def.h>
@@ -59,10 +57,10 @@
#include "lib/delay.c"
#include "cpu/x86/lapic/boot_cpu.c"
#include "northbridge/amd/amdk8/reset_test.c"
-#include "northbridge/amd/amdk8/debug.c"
#include "northbridge/amd/amdk8/early_ht.c"
#include "superio/winbond/w83627ehg/w83627ehg_early_serial.c"
#include "southbridge/via/vt8237r/vt8237r_early_smbus.c"
+#include "northbridge/amd/amdk8/debug.c" /* After vt8237r_early_smbus.c! */
#include "cpu/amd/mtrr/amd_earlymtrr.c"
#include "cpu/x86/bist.h"
#include "northbridge/amd/amdk8/setup_resource_map.c"
Modified: trunk/src/mainboard/asus/m2v-mx_se/romstage.c
==============================================================================
--- trunk/src/mainboard/asus/m2v-mx_se/romstage.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/mainboard/asus/m2v-mx_se/romstage.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -44,8 +44,6 @@
#define K8_REV_F_SUPPORT_F0_F1_WORKAROUND 0
#endif
-/* #define DEBUG_SMBUS 1 */
-
#include <stdint.h>
#include <string.h>
#include <device/pci_def.h>
Modified: trunk/src/mainboard/kontron/986lcd-m/romstage.c
==============================================================================
--- trunk/src/mainboard/kontron/986lcd-m/romstage.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/mainboard/kontron/986lcd-m/romstage.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -445,7 +445,7 @@
#if !CONFIG_HAVE_ACPI_RESUME
#if CONFIG_DEFAULT_CONSOLE_LOGLEVEL > 8
-#if defined(DEBUG_RAM_SETUP)
+#if CONFIG_DEBUG_RAM_SETUP
sdram_dump_mchbar_registers();
#endif
Modified: trunk/src/mainboard/msi/ms7135/romstage.c
==============================================================================
--- trunk/src/mainboard/msi/ms7135/romstage.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/mainboard/msi/ms7135/romstage.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -30,9 +30,6 @@
/* Used by raminit. */
#define QRANK_DIMM_SUPPORT 1
-/* Turn this on for SMBus debugging output. */
-#define DEBUG_SMBUS 0
-
#if CONFIG_LOGICAL_CPUS == 1
#define SET_NB_CFG_54 1
#endif
Modified: trunk/src/mainboard/msi/ms7260/romstage.c
==============================================================================
--- trunk/src/mainboard/msi/ms7260/romstage.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/mainboard/msi/ms7260/romstage.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -24,7 +24,6 @@
#define __PRE_RAM__
// #define CACHE_AS_RAM_ADDRESS_DEBUG 1
-// #define DEBUG_SMBUS 1
// #define RAM_TIMING_DEBUG 1
// #define DQS_TRAIN_DEBUG 1
// #define RES_DEBUG 1
Modified: trunk/src/mainboard/msi/ms9185/romstage.c
==============================================================================
--- trunk/src/mainboard/msi/ms9185/romstage.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/mainboard/msi/ms9185/romstage.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -42,8 +42,6 @@
//if we want to wait for core1 done before DQS training, set it to 0
#define K8_SET_FIDVID_CORE0_ONLY 1
-#define DEBUG_SMBUS 1
-
#include <stdint.h>
#include <string.h>
#include <device/pci_def.h>
Modified: trunk/src/mainboard/msi/ms9282/romstage.c
==============================================================================
--- trunk/src/mainboard/msi/ms9282/romstage.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/mainboard/msi/ms9282/romstage.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -38,8 +38,6 @@
//if we want to wait for core1 done before DQS training, set it to 0
#define K8_SET_FIDVID_CORE0_ONLY 1
-#define DEBUG_SMBUS 1
-
#include <stdint.h>
#include <string.h>
#include <device/pci_def.h>
Modified: trunk/src/northbridge/amd/amdfam10/debug.c
==============================================================================
--- trunk/src/northbridge/amd/amdfam10/debug.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/amd/amdfam10/debug.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -220,11 +220,7 @@
}
}
-#ifndef DEBUG_SMBUS
-#define DEBUG_SMBUS 0
-#endif
-
-#if DEBUG_SMBUS == 1
+#if CONFIG_DEBUG_SMBUS
static void dump_spd_registers(const struct mem_controller *ctrl)
{
Modified: trunk/src/northbridge/amd/amdfam10/raminit_amdmct.c
==============================================================================
--- trunk/src/northbridge/amd/amdfam10/raminit_amdmct.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/amd/amdfam10/raminit_amdmct.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -23,21 +23,16 @@
printk_debug("%s%08x\n", strval, val);
}
-
-#define RAMINIT_DEBUG 1
-
-
static void print_tx(const char *strval, u32 val)
{
-#if RAMINIT_DEBUG == 1
+#if CONFIG_DEBUG_RAM_SETUP
print_raminit(strval, val);
#endif
}
-
static void print_t(const char *strval)
{
-#if RAMINIT_DEBUG == 1
+#if CONFIG_DEBUG_RAM_SETUP
print_debug(strval);
#endif
}
Modified: trunk/src/northbridge/amd/amdk8/debug.c
==============================================================================
--- trunk/src/northbridge/amd/amdk8/debug.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/amd/amdk8/debug.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -134,11 +134,8 @@
}
}
-#ifndef DEBUG_SMBUS
-#define DEBUG_SMBUS 0
-#endif
+#if CONFIG_DEBUG_SMBUS
-#if DEBUG_SMBUS == 1
static void dump_spd_registers(const struct mem_controller *ctrl)
{
int i;
Modified: trunk/src/northbridge/amd/amdk8/raminit_f.c
==============================================================================
--- trunk/src/northbridge/amd/amdk8/raminit_f.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/amd/amdk8/raminit_f.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -34,9 +34,7 @@
#define QRANK_DIMM_SUPPORT 0
#endif
-#define RAM_TIMING_DEBUG 0
-
-#if RAM_TIMING_DEBUG == 1
+#if DEBUG_RAM_SETUP
#define printk_raminit printk_debug
#else
#define printk_raminit(fmt, arg...)
Modified: trunk/src/northbridge/intel/e7501/raminit.c
==============================================================================
--- trunk/src/northbridge/intel/e7501/raminit.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/intel/e7501/raminit.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -22,10 +22,7 @@
// Unfortunately the code seems to chew up several K of space.
//#define VALIDATE_DIMM_COMPATIBILITY
-// Uncomment this to enable local debugging messages
-//#define DEBUG_RAM_CONFIG
-
-#if defined(DEBUG_RAM_CONFIG)
+#if CONFIG_DEBUG_RAM_SETUP
#define RAM_DEBUG_MESSAGE(x) print_debug(x)
#define RAM_DEBUG_HEX32(x) print_debug_hex32(x)
#define RAM_DEBUG_HEX8(x) print_debug_hex8(x)
Modified: trunk/src/northbridge/intel/i440bx/raminit.c
==============================================================================
--- trunk/src/northbridge/intel/i440bx/raminit.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/intel/i440bx/raminit.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -28,11 +28,8 @@
Macros and definitions.
-----------------------------------------------------------------------------*/
-/* Uncomment this to enable debugging output. */
-#define DEBUG_RAM_SETUP 1
-
/* Debugging macros. */
-#if defined(DEBUG_RAM_SETUP)
+#if CONFIG_DEBUG_RAM_SETUP
#define PRINT_DEBUG(x) print_debug(x)
#define PRINT_DEBUG_HEX8(x) print_debug_hex8(x)
#define PRINT_DEBUG_HEX16(x) print_debug_hex16(x)
Modified: trunk/src/northbridge/intel/i82810/raminit.c
==============================================================================
--- trunk/src/northbridge/intel/i82810/raminit.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/intel/i82810/raminit.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -29,11 +29,8 @@
Macros and definitions.
-----------------------------------------------------------------------------*/
-/* Uncomment this to enable debugging output. */
-// #define DEBUG_RAM_SETUP 1
-
/* Debugging macros. */
-#if defined(DEBUG_RAM_SETUP)
+#if CONFIG_DEBUG_RAM_SETUP
#define PRINT_DEBUG(x) print_debug(x)
#define PRINT_DEBUG_HEX8(x) print_debug_hex8(x)
#define PRINT_DEBUG_HEX16(x) print_debug_hex16(x)
Modified: trunk/src/northbridge/intel/i82830/raminit.c
==============================================================================
--- trunk/src/northbridge/intel/i82830/raminit.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/intel/i82830/raminit.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -29,11 +29,8 @@
Macros and definitions.
-----------------------------------------------------------------------------*/
-/* Uncomment this to enable debugging output. */
-/* #define DEBUG_RAM_SETUP 1 */
-
/* Debugging macros. */
-#if defined(DEBUG_RAM_SETUP)
+#if CONFIG_DEBUG_RAM_SETUP
#define PRINT_DEBUG(x) print_debug(x)
#define PRINT_DEBUG_HEX8(x) print_debug_hex8(x)
#define PRINT_DEBUG_HEX16(x) print_debug_hex16(x)
Modified: trunk/src/northbridge/intel/i945/raminit.c
==============================================================================
--- trunk/src/northbridge/intel/i945/raminit.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/intel/i945/raminit.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -24,10 +24,8 @@
#include "raminit.h"
#include "i945.h"
-#define DEBUG_RAM_SETUP
-
/* Debugging macros. */
-#if defined(DEBUG_RAM_SETUP)
+#if CONFIG_DEBUG_RAM_SETUP
#define PRINTK_DEBUG(x...) printk_debug(x)
#else
#define PRINTK_DEBUG(x...)
@@ -73,7 +71,7 @@
read32(offset);
}
-#ifdef DEBUG_RAM_SETUP
+#if CONFIG_DEBUG_RAM_SETUP
static void sdram_dump_mchbar_registers(void)
{
int i;
Modified: trunk/src/northbridge/via/cn700/raminit.c
==============================================================================
--- trunk/src/northbridge/via/cn700/raminit.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/via/cn700/raminit.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -25,9 +25,7 @@
#include <delay.h>
#include "cn700.h"
-// #define DEBUG_RAM_SETUP 1
-
-#ifdef DEBUG_RAM_SETUP
+#ifdef CONFIG_DEBUG_RAM_SETUP
#define PRINT_DEBUG_MEM(x) print_debug(x)
#define PRINT_DEBUG_MEM_HEX8(x) print_debug_hex8(x)
#define PRINT_DEBUG_MEM_HEX16(x) print_debug_hex16(x)
@@ -51,12 +49,6 @@
reg &= 0xf8; /* Clear bits 2-0. */
reg |= command;
pci_write_config8(dev, DRAM_MISC_CTL, reg);
-
- PRINT_DEBUG_MEM(" Sending RAM command 0x");
- PRINT_DEBUG_MEM_HEX8(reg);
- PRINT_DEBUG_MEM(" to 0x");
- PRINT_DEBUG_MEM_HEX32(0 + addr_offset);
- PRINT_DEBUG_MEM("\r\n");
}
/**
Modified: trunk/src/northbridge/via/cx700/cx700_early_smbus.c
==============================================================================
--- trunk/src/northbridge/via/cx700/cx700_early_smbus.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/via/cx700/cx700_early_smbus.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -48,10 +48,7 @@
#define SMBUS_DELAY() outb(0x80, 0x80)
/* Debugging macros. */
-
-// #define DEBUG_SMBUS 1
-
-#ifdef DEBUG_SMBUS
+#if CONFIG_DEBUG_SMBUS
#define PRINT_DEBUG(x) print_debug(x)
#define PRINT_DEBUG_HEX16(x) print_debug_hex16(x)
#else
@@ -102,7 +99,7 @@
SMBUS_DELAY();
++loops;
}
-#ifdef DEBUG_SMBUS
+#if CONFIG_DEBUG_SMBUS
/* Some systems seem to have a flakey SMBus. No need to spew a lot of
* errors on those, once we know that SMBus access is principally
* working.
@@ -234,7 +231,7 @@
}
/* Debugging Function */
-#ifdef DEBUG_SMBUS
+#ifdef CONFIG_DEBUG_SMBUS
static void dump_spd_data(const struct mem_controller *ctrl)
{
int dimm, offset, regs;
Modified: trunk/src/northbridge/via/cx700/raminit.c
==============================================================================
--- trunk/src/northbridge/via/cx700/raminit.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/via/cx700/raminit.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -24,10 +24,8 @@
#include <delay.h>
#include "cx700_registers.h"
-// #define DEBUG_RAM_SETUP 1
-
/* Debugging macros. */
-#if defined(DEBUG_RAM_SETUP)
+#if CONFIG_DEBUG_RAM_SETUP
#define PRINTK_DEBUG(x...) printk_debug(x)
#else
#define PRINTK_DEBUG(x...)
Modified: trunk/src/northbridge/via/vx800/raminit.c
==============================================================================
--- trunk/src/northbridge/via/vx800/raminit.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/via/vx800/raminit.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -21,9 +21,7 @@
#include <sdram_mode.h>
#include <delay.h>
-#define DEBUG_RAM_SETUP 1
-
-#ifdef DEBUG_RAM_SETUP
+#if CONFIG_DEBUG_RAM_SETUP
#define PRINT_DEBUG_MEM(x) print_debug(x)
#define PRINT_DEBUG_MEM_HEX8(x) print_debug_hex8(x)
#define PRINT_DEBUG_MEM_HEX16(x) print_debug_hex16(x)
Modified: trunk/src/northbridge/via/vx800/vx800_early_smbus.c
==============================================================================
--- trunk/src/northbridge/via/vx800/vx800_early_smbus.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/northbridge/via/vx800/vx800_early_smbus.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -49,11 +49,7 @@
#define SMBUS_DELAY() outb(0x80, 0x80)
-/* Debugging macros. Only necessary if something isn't working right */
-
-#define DEBUG_SMBUS 1
-
-#ifdef DEBUG_SMBUS
+#ifdef CONFIG_DEBUG_SMBUS
#define PRINT_DEBUG(x) print_debug(x)
#define PRINT_DEBUG_HEX16(x) print_debug_hex16(x)
#else
@@ -289,7 +285,7 @@
}
/* Debugging Function */
-#ifdef DEBUG_SMBUS
+#if CONFIG_DEBUG_SMBUS
static void dump_spd_data(void)
{
int dimm, offset, regs;
Modified: trunk/src/southbridge/intel/i82801gx/i82801gx_smihandler.c
==============================================================================
--- trunk/src/southbridge/intel/i82801gx/i82801gx_smihandler.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/southbridge/intel/i82801gx/i82801gx_smihandler.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -28,8 +28,6 @@
#include <device/pci_def.h>
#include "i82801gx.h"
-#define DEBUG_SMI
-
#define APM_CNT 0xb2
#define CST_CONTROL 0x85
#define PST_CONTROL 0x80
Modified: trunk/src/southbridge/via/vt8237r/vt8237r.h
==============================================================================
--- trunk/src/southbridge/via/vt8237r/vt8237r.h Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/src/southbridge/via/vt8237r/vt8237r.h Fri Mar 5 11:03:50 2010 (r5185)
@@ -65,7 +65,7 @@
#define I2C_TRANS_CMD 0x40
#define CLOCK_SLAVE_ADDRESS 0x69
-#if DEBUG_SMBUS == 1
+#if CONFIG_DEBUG_SMBUS
#define PRINT_DEBUG(x) print_debug(x)
#define PRINT_DEBUG_HEX16(x) print_debug_hex16(x)
#else
Modified: trunk/util/x86emu/include/x86emu/fpu_regs.h
==============================================================================
--- trunk/util/x86emu/include/x86emu/fpu_regs.h Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/include/x86emu/fpu_regs.h Fri Mar 5 11:03:50 2010 (r5185)
@@ -102,7 +102,7 @@
#endif /* X86_FPU_SUPPORT */
-#ifdef DEBUG
+#if CONFIG_X86EMU_DEBUG
# define DECODE_PRINTINSTR32(t,mod,rh,rl) \
DECODE_PRINTF(t[(mod<<3)+(rh)]);
# define DECODE_PRINTINSTR256(t,mod,rh,rl) \
Modified: trunk/util/x86emu/include/x86emu/regs.h
==============================================================================
--- trunk/util/x86emu/include/x86emu/regs.h Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/include/x86emu/regs.h Fri Mar 5 11:03:50 2010 (r5185)
@@ -279,7 +279,7 @@
u32 mode;
volatile int intr; /* mask of pending interrupts */
volatile int debug;
-#ifdef DEBUG
+#if CONFIG_X86EMU_DEBUG
int check;
u16 saved_ip;
u16 saved_cs;
@@ -365,13 +365,6 @@
#define X86_CH M.x86.R_CH
#define X86_DH M.x86.R_DH
-
-/*-------------------------- Function Prototypes --------------------------*/
-
-/* Function to log information at runtime */
-
-//void printk(const char *fmt, ...);
-
#ifdef __cplusplus
} /* End of "C" linkage for C++ */
#endif
Modified: trunk/util/x86emu/include/x86emu/x86emu.h
==============================================================================
--- trunk/util/x86emu/include/x86emu/x86emu.h Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/include/x86emu/x86emu.h Fri Mar 5 11:03:50 2010 (r5185)
@@ -42,27 +42,15 @@
#ifndef __X86EMU_X86EMU_H
#define __X86EMU_X86EMU_H
-/* FIXME: redefine printk for the moment */
#include <stddef.h>
#include <console/console.h>
-#undef printk
-#define printk(x...) do_printk(BIOS_DEBUG, x)
-#if defined(CONFIG_YABEL_DEBUG_FLAGS) && (CONFIG_YABEL_DEBUG_FLAGS != 0)
+#if CONFIG_X86EMU_DEBUG
#define DEBUG
-#else
-#undef DEBUG
#endif
-#ifdef SCITECH
-#include "scitech.h"
-#define X86API _ASMAPI
-#define X86APIP _ASMAPIP
-typedef int X86EMU_pioAddr;
-#else
#include "types.h"
#define X86API
#define X86APIP *
-#endif
#include "regs.h"
/*---------------------- Macros and type definitions ----------------------*/
@@ -166,9 +154,9 @@
void X86EMU_exec(void);
void X86EMU_halt_sys(void);
-#ifdef DEBUG
+#if CONFIG_X86EMU_DEBUG
#define HALT_SYS() \
- printk("halt_sys: in %s\n", __func__); \
+ printf("halt_sys: in %s\n", __func__); \
X86EMU_halt_sys();
#else
#define HALT_SYS() X86EMU_halt_sys()
Modified: trunk/util/x86emu/x86.c
==============================================================================
--- trunk/util/x86emu/x86.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/x86.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -23,8 +23,6 @@
#include <arch/io.h>
#include <arch/registers.h>
#include <console/console.h>
-#define printk(x...) do_printk(x)
-
#include <arch/interrupt.h>
#define REALMODE_BASE ((void *)0x600)
Modified: trunk/util/x86emu/x86_interrupts.c
==============================================================================
--- trunk/util/x86emu/x86_interrupts.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/x86_interrupts.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -26,7 +26,6 @@
#include <console/console.h>
#include <arch/io.h>
#include <arch/registers.h>
-#define printk(x...) do_printk(x)
enum {
PCIBIOS_CHECK = 0xb101,
Modified: trunk/util/x86emu/x86emu/debug.c
==============================================================================
--- trunk/util/x86emu/x86emu/debug.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/x86emu/debug.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -38,7 +38,6 @@
****************************************************************************/
#include "x86emui.h"
-// #include <stdarg.h>
/*----------------------------- Implementation ----------------------------*/
@@ -59,7 +58,7 @@
}
}
if (DEBUG_DECODE() && ! DEBUG_DECODE_NOPRINT()) {
- printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
+ printf("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
print_decoded_instruction();
}
@@ -78,7 +77,7 @@
* This routine called if the flag DEBUG_DISASSEMBLE is set kind
* of a hack!
*/
- printk("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
+ printf("%04x:%04x ",M.x86.saved_cs, M.x86.saved_ip);
print_encoded_bytes( M.x86.saved_cs, M.x86.saved_ip);
print_decoded_instruction();
}
@@ -162,13 +161,13 @@
M.x86.enc_pos += x;
}
-void x86emu_decode_printf (char *x)
+void x86emu_decode_printf (const char *x)
{
sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",x);
M.x86.enc_str_pos += strlen(x);
}
-void x86emu_decode_printf2 (char *x, int y)
+void x86emu_decode_printf2 (const char *x, int y)
{
char temp[100];
sprintf(temp,x,y);
@@ -189,12 +188,12 @@
for (i=0; i< M.x86.enc_pos; i++) {
sprintf(buf1+2*i,"%02x", fetch_data_byte_abs(s,o+i));
}
- printk("%-20s ",buf1);
+ printf("%-20s ",buf1);
}
static void print_decoded_instruction (void)
{
- printk("%s", M.x86.decoded_buf);
+ printf("%s", M.x86.decoded_buf);
}
void x86emu_print_int_vect (u16 iv)
@@ -204,7 +203,7 @@
if (iv > 256) return;
seg = fetch_data_word_abs(0,iv*4);
off = fetch_data_word_abs(0,iv*4+2);
- printk("%04x:%04x ", seg, off);
+ printf("%04x:%04x ", seg, off);
}
void X86EMU_dump_memory (u16 seg, u16 off, u32 amt)
@@ -216,12 +215,12 @@
current = start;
while (end <= off + amt) {
- printk("%04x:%04x ", seg, start);
+ printf("%04x:%04x ", seg, start);
for (i=start; i< off; i++)
- printk(" ");
+ printf(" ");
for ( ; i< end; i++)
- printk("%02x ", fetch_data_byte_abs(seg,i));
- printk("\n");
+ printf("%02x ", fetch_data_byte_abs(seg,i));
+ printf("\n");
start = end;
end = start + 16;
}
@@ -256,7 +255,7 @@
done=0;
offset = M.x86.saved_ip;
while (!done) {
- printk("-");
+ printf("-");
p = fgets(s, 1023, stdin);
cmd = parse_line(s, ps, &ntok);
switch(cmd) {
@@ -310,7 +309,7 @@
return;
case 'P':
noDecode = (noDecode)?0:1;
- printk("Toggled decoding to %s\n",(noDecode)?"FALSE":"TRUE");
+ printf("Toggled decoding to %s\n",(noDecode)?"FALSE":"TRUE");
break;
case 't':
case 0:
@@ -368,68 +367,68 @@
void x86emu_dump_regs (void)
{
- printk("\tAX=%04x ", M.x86.R_AX );
- printk("BX=%04x ", M.x86.R_BX );
- printk("CX=%04x ", M.x86.R_CX );
- printk("DX=%04x ", M.x86.R_DX );
- printk("SP=%04x ", M.x86.R_SP );
- printk("BP=%04x ", M.x86.R_BP );
- printk("SI=%04x ", M.x86.R_SI );
- printk("DI=%04x\n", M.x86.R_DI );
- printk("\tDS=%04x ", M.x86.R_DS );
- printk("ES=%04x ", M.x86.R_ES );
- printk("SS=%04x ", M.x86.R_SS );
- printk("CS=%04x ", M.x86.R_CS );
- printk("IP=%04x ", M.x86.R_IP );
- if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */
- else printk("NV ");
- if (ACCESS_FLAG(F_DF)) printk("DN ");
- else printk("UP ");
- if (ACCESS_FLAG(F_IF)) printk("EI ");
- else printk("DI ");
- if (ACCESS_FLAG(F_SF)) printk("NG ");
- else printk("PL ");
- if (ACCESS_FLAG(F_ZF)) printk("ZR ");
- else printk("NZ ");
- if (ACCESS_FLAG(F_AF)) printk("AC ");
- else printk("NA ");
- if (ACCESS_FLAG(F_PF)) printk("PE ");
- else printk("PO ");
- if (ACCESS_FLAG(F_CF)) printk("CY ");
- else printk("NC ");
- printk("\n");
+ printf("\tAX=%04x ", M.x86.R_AX );
+ printf("BX=%04x ", M.x86.R_BX );
+ printf("CX=%04x ", M.x86.R_CX );
+ printf("DX=%04x ", M.x86.R_DX );
+ printf("SP=%04x ", M.x86.R_SP );
+ printf("BP=%04x ", M.x86.R_BP );
+ printf("SI=%04x ", M.x86.R_SI );
+ printf("DI=%04x\n", M.x86.R_DI );
+ printf("\tDS=%04x ", M.x86.R_DS );
+ printf("ES=%04x ", M.x86.R_ES );
+ printf("SS=%04x ", M.x86.R_SS );
+ printf("CS=%04x ", M.x86.R_CS );
+ printf("IP=%04x ", M.x86.R_IP );
+ if (ACCESS_FLAG(F_OF)) printf("OV "); /* CHECKED... */
+ else printf("NV ");
+ if (ACCESS_FLAG(F_DF)) printf("DN ");
+ else printf("UP ");
+ if (ACCESS_FLAG(F_IF)) printf("EI ");
+ else printf("DI ");
+ if (ACCESS_FLAG(F_SF)) printf("NG ");
+ else printf("PL ");
+ if (ACCESS_FLAG(F_ZF)) printf("ZR ");
+ else printf("NZ ");
+ if (ACCESS_FLAG(F_AF)) printf("AC ");
+ else printf("NA ");
+ if (ACCESS_FLAG(F_PF)) printf("PE ");
+ else printf("PO ");
+ if (ACCESS_FLAG(F_CF)) printf("CY ");
+ else printf("NC ");
+ printf("\n");
}
void x86emu_dump_xregs (void)
{
- printk("\tEAX=%08x ", M.x86.R_EAX );
- printk("EBX=%08x ", M.x86.R_EBX );
- printk("ECX=%08x ", M.x86.R_ECX );
- printk("EDX=%08x \n", M.x86.R_EDX );
- printk("\tESP=%08x ", M.x86.R_ESP );
- printk("EBP=%08x ", M.x86.R_EBP );
- printk("ESI=%08x ", M.x86.R_ESI );
- printk("EDI=%08x\n", M.x86.R_EDI );
- printk("\tDS=%04x ", M.x86.R_DS );
- printk("ES=%04x ", M.x86.R_ES );
- printk("SS=%04x ", M.x86.R_SS );
- printk("CS=%04x ", M.x86.R_CS );
- printk("EIP=%08x\n\t", M.x86.R_EIP );
- if (ACCESS_FLAG(F_OF)) printk("OV "); /* CHECKED... */
- else printk("NV ");
- if (ACCESS_FLAG(F_DF)) printk("DN ");
- else printk("UP ");
- if (ACCESS_FLAG(F_IF)) printk("EI ");
- else printk("DI ");
- if (ACCESS_FLAG(F_SF)) printk("NG ");
- else printk("PL ");
- if (ACCESS_FLAG(F_ZF)) printk("ZR ");
- else printk("NZ ");
- if (ACCESS_FLAG(F_AF)) printk("AC ");
- else printk("NA ");
- if (ACCESS_FLAG(F_PF)) printk("PE ");
- else printk("PO ");
- if (ACCESS_FLAG(F_CF)) printk("CY ");
- else printk("NC ");
- printk("\n");
+ printf("\tEAX=%08x ", M.x86.R_EAX );
+ printf("EBX=%08x ", M.x86.R_EBX );
+ printf("ECX=%08x ", M.x86.R_ECX );
+ printf("EDX=%08x \n", M.x86.R_EDX );
+ printf("\tESP=%08x ", M.x86.R_ESP );
+ printf("EBP=%08x ", M.x86.R_EBP );
+ printf("ESI=%08x ", M.x86.R_ESI );
+ printf("EDI=%08x\n", M.x86.R_EDI );
+ printf("\tDS=%04x ", M.x86.R_DS );
+ printf("ES=%04x ", M.x86.R_ES );
+ printf("SS=%04x ", M.x86.R_SS );
+ printf("CS=%04x ", M.x86.R_CS );
+ printf("EIP=%08x\n\t", M.x86.R_EIP );
+ if (ACCESS_FLAG(F_OF)) printf("OV "); /* CHECKED... */
+ else printf("NV ");
+ if (ACCESS_FLAG(F_DF)) printf("DN ");
+ else printf("UP ");
+ if (ACCESS_FLAG(F_IF)) printf("EI ");
+ else printf("DI ");
+ if (ACCESS_FLAG(F_SF)) printf("NG ");
+ else printf("PL ");
+ if (ACCESS_FLAG(F_ZF)) printf("ZR ");
+ else printf("NZ ");
+ if (ACCESS_FLAG(F_AF)) printf("AC ");
+ else printf("NA ");
+ if (ACCESS_FLAG(F_PF)) printf("PE ");
+ else printf("PO ");
+ if (ACCESS_FLAG(F_CF)) printf("CY ");
+ else printf("NC ");
+ printf("\n");
}
Modified: trunk/util/x86emu/x86emu/debug.h
==============================================================================
--- trunk/util/x86emu/x86emu/debug.h Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/x86emu/debug.h Fri Mar 5 11:03:50 2010 (r5185)
@@ -40,10 +40,11 @@
#ifndef __X86EMU_DEBUG_H
#define __X86EMU_DEBUG_H
-//#define DEBUG 0
-//#undef DEBUG
/*---------------------- Macros and type definitions ----------------------*/
+/* printf is not available in coreboot... use printk */
+#define printf(x...) printk(BIOS_DEBUG, x)
+
/* checks to be enabled for "runtime" */
#define CHECK_IP_FETCH_F 0x1
@@ -172,17 +173,17 @@
if (DEBUG_TRACECALLREGS()) \
x86emu_dump_regs(); \
if (DEBUG_TRACECALL()) \
- printk("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x);
+ printf("%04x:%04x: CALL %s%04x:%04x\n", u , v, s, w, x);
# define RETURN_TRACE(u,v,w,x,s) \
if (DEBUG_TRACECALLREGS()) \
x86emu_dump_regs(); \
if (DEBUG_TRACECALL()) \
- printk("%04x:%04x: RET %s %04x:%04x\n",u,v,s,w,x);
+ printf("%04x:%04x: RET %s %04x:%04x\n",u,v,s,w,x);
# define JMP_TRACE(u,v,w,x,s) \
if (DEBUG_TRACEJMPREGS()) \
x86emu_dump_regs(); \
if (DEBUG_TRACEJMP()) \
- printk("%04x:%04x: JMP %s%04x:%04x\n", u , v, s, w, x);
+ printf("%04x:%04x: JMP %s%04x:%04x\n", u , v, s, w, x);
#else
# define CALL_TRACE(u,v,w,x,s)
# define RETURN_TRACE(u,v,w,x,s)
@@ -201,20 +202,22 @@
extern "C" { /* Use "C" linkage when in C++ mode */
#endif
-extern void x86emu_inc_decoded_inst_len (int x);
-extern void x86emu_decode_printf (char *x);
-extern void x86emu_decode_printf2 (char *x, int y);
-extern void x86emu_just_disassemble (void);
-extern void x86emu_single_step (void);
-extern void x86emu_end_instr (void);
-extern void x86emu_dump_regs (void);
-extern void x86emu_dump_xregs (void);
-extern void x86emu_print_int_vect (u16 iv);
-extern void x86emu_instrument_instruction (void);
-extern void x86emu_check_ip_access (void);
-extern void x86emu_check_sp_access (void);
-extern void x86emu_check_mem_access (u32 p);
-extern void x86emu_check_data_access (uint s, uint o);
+void x86emu_inc_decoded_inst_len (int x);
+void x86emu_decode_printf (const char *x);
+void x86emu_decode_printf2 (const char *x, int y);
+void x86emu_just_disassemble (void);
+void x86emu_single_step (void);
+void x86emu_end_instr (void);
+void x86emu_dump_regs (void);
+void x86emu_dump_xregs (void);
+void x86emu_print_int_vect (u16 iv);
+void x86emu_instrument_instruction (void);
+void x86emu_check_ip_access (void);
+void x86emu_check_sp_access (void);
+void x86emu_check_mem_access (u32 p);
+void x86emu_check_data_access (uint s, uint o);
+
+void disassemble_forward (u16 seg, u16 off, int n);
#ifdef __cplusplus
} /* End of "C" linkage for C++ */
Modified: trunk/util/x86emu/x86emu/decode.c
==============================================================================
--- trunk/util/x86emu/x86emu/decode.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/x86emu/decode.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -77,7 +77,7 @@
void x86emu_intr_raise(
u8 intrnum)
{
- printk("%s, rasing execption %x\n", __func__, intrnum);
+ printf("%s, raising exeception %x\n", __func__, intrnum);
x86emu_dump_regs();
M.x86.intno = intrnum;
M.x86.intr |= INTR_SYNCH;
@@ -105,12 +105,12 @@
if (M.x86.intr) {
if (M.x86.intr & INTR_HALTED) {
DB( if (M.x86.R_SP != 0) {
- printk("halted\n");
+ printf("halted\n");
X86EMU_trace_regs();
}
else {
if (M.x86.debug)
- printk("Service completed successfully\n");
+ printf("Service completed successfully\n");
})
return;
}
@@ -286,7 +286,7 @@
return M.x86.R_SS;
default:
#ifdef DEBUG
- printk("error: should not happen: multiple overrides.\n");
+ printf("error: should not happen: multiple overrides.\n");
#endif
HALT_SYS();
return 0;
Modified: trunk/util/x86emu/x86emu/fpu.c
==============================================================================
--- trunk/util/x86emu/x86emu/fpu.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/x86emu/fpu.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -52,7 +52,7 @@
#ifdef DEBUG
-static char *x86emu_fpu_op_d9_tab[] = {
+static const char *x86emu_fpu_op_d9_tab[] = {
"FLD\tDWORD PTR ", "ESC_D9\t", "FST\tDWORD PTR ", "FSTP\tDWORD PTR ",
"FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
@@ -63,7 +63,7 @@
"FLDENV\t", "FLDCW\t", "FSTENV\t", "FSTCW\t",
};
-static char *x86emu_fpu_op_d9_tab1[] = {
+static const char *x86emu_fpu_op_d9_tab1[] = {
"FLD\t", "FLD\t", "FLD\t", "FLD\t",
"FLD\t", "FLD\t", "FLD\t", "FLD\t",
@@ -296,7 +296,7 @@
#ifdef DEBUG
-char *x86emu_fpu_op_da_tab[] = {
+static const char *x86emu_fpu_op_da_tab[] = {
"FIADD\tDWORD PTR ", "FIMUL\tDWORD PTR ", "FICOM\tDWORD PTR ",
"FICOMP\tDWORD PTR ",
"FISUB\tDWORD PTR ", "FISUBR\tDWORD PTR ", "FIDIV\tDWORD PTR ",
@@ -386,7 +386,7 @@
#ifdef DEBUG
-char *x86emu_fpu_op_db_tab[] = {
+static const char *x86emu_fpu_op_db_tab[] = {
"FILD\tDWORD PTR ", "ESC_DB\t19", "FIST\tDWORD PTR ", "FISTP\tDWORD PTR ",
"ESC_DB\t1C", "FLD\tTBYTE PTR ", "ESC_DB\t1E", "FSTP\tTBYTE PTR ",
@@ -505,7 +505,7 @@
}
#ifdef DEBUG
-char *x86emu_fpu_op_dc_tab[] = {
+static const char *x86emu_fpu_op_dc_tab[] = {
"FADD\tQWORD PTR ", "FMUL\tQWORD PTR ", "FCOM\tQWORD PTR ",
"FCOMP\tQWORD PTR ",
"FSUB\tQWORD PTR ", "FSUBR\tQWORD PTR ", "FDIV\tQWORD PTR ",
@@ -620,7 +620,7 @@
#ifdef DEBUG
-static char *x86emu_fpu_op_dd_tab[] = {
+static const char *x86emu_fpu_op_dd_tab[] = {
"FLD\tQWORD PTR ", "ESC_DD\t29,", "FST\tQWORD PTR ", "FSTP\tQWORD PTR ",
"FRSTOR\t", "ESC_DD\t2D,", "FSAVE\t", "FSTSW\t",
@@ -720,7 +720,7 @@
#ifdef DEBUG
-static char *x86emu_fpu_op_de_tab[] =
+static const char *x86emu_fpu_op_de_tab[] =
{
"FIADD\tWORD PTR ", "FIMUL\tWORD PTR ", "FICOM\tWORD PTR ",
"FICOMP\tWORD PTR ",
@@ -839,7 +839,7 @@
#ifdef DEBUG
-static char *x86emu_fpu_op_df_tab[] = {
+static const char *x86emu_fpu_op_df_tab[] = {
/* mod == 00 */
"FILD\tWORD PTR ", "ESC_DF\t39\n", "FIST\tWORD PTR ", "FISTP\tWORD PTR ",
"FBLD\tTBYTE PTR ", "FILD\tQWORD PTR ", "FBSTP\tTBYTE PTR ",
Modified: trunk/util/x86emu/x86emu/ops.c
==============================================================================
--- trunk/util/x86emu/x86emu/ops.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/x86emu/ops.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -77,7 +77,7 @@
/* constant arrays to do several instructions in just one function */
#ifdef DEBUG
-static char *x86emu_GenOpName[8] = {
+static const char *x86emu_GenOpName[8] = {
"ADD", "OR", "ADC", "SBB", "AND", "SUB", "XOR", "CMP"};
#endif
@@ -159,7 +159,7 @@
#ifdef DEBUG
-static char *opF6_names[8] =
+static const char *opF6_names[8] =
{ "TEST\t", "", "NOT\t", "NEG\t", "MUL\t", "IMUL\t", "DIV\t", "IDIV\t" };
#endif
@@ -178,7 +178,7 @@
if (M.x86.R_SP != 0) {
DECODE_PRINTF("ILLEGAL X86 OPCODE\n");
TRACE_REGS();
- DB( printk("%04x:%04x: %02X ILLEGAL X86 OPCODE!\n",
+ DB( printf("%04x:%04x: %02X ILLEGAL X86 OPCODE!\n",
M.x86.R_CS, M.x86.R_IP-1,op1));
HALT_SYS();
}
Modified: trunk/util/x86emu/x86emu/ops2.c
==============================================================================
--- trunk/util/x86emu/x86emu/ops2.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/x86emu/ops2.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -54,7 +54,7 @@
START_OF_INSTR();
DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
TRACE_REGS();
- printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
+ printf("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
M.x86.R_CS, M.x86.R_IP-2, op2);
HALT_SYS();
END_OF_INSTR();
@@ -105,7 +105,7 @@
default:
DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE IN 0F 01\n");
TRACE_REGS();
- printk("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
+ printf("%04x:%04x: %02X ILLEGAL EXTENDED X86 OPCODE!\n",
M.x86.R_CS, M.x86.R_IP-2, op2);
HALT_SYS();
break;
@@ -1272,7 +1272,7 @@
default:
DECODE_PRINTF("ILLEGAL EXTENDED X86 OPCODE\n");
TRACE_REGS();
- printk("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
+ printf("%04x:%04x: %02X%02X ILLEGAL EXTENDED X86 OPCODE EXTENSION!\n",
M.x86.R_CS, M.x86.R_IP-3,op2, (mod<<6)|(rh<<3)|rl);
HALT_SYS();
}
Modified: trunk/util/x86emu/x86emu/sys.c
==============================================================================
--- trunk/util/x86emu/x86emu/sys.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/x86emu/sys.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -41,15 +41,11 @@
****************************************************************************/
/* $XFree86: xc/extras/x86emu/src/x86emu/sys.c,v 1.5 2000/08/23 22:10:01 tsi Exp $ */
+#include <arch/io.h>
#include <x86emu/x86emu.h>
#include <x86emu/regs.h>
#include "debug.h"
#include "prim_ops.h"
-#if 1 /* Coreboot needs to map prinkf to printk. */
-#include "arch/io.h"
-#else
-#include <sys/io.h>
-#endif
#ifdef IN_MODULE
#include "xf86_ansic.h"
@@ -69,11 +65,11 @@
u8 *retaddr = 0;
if (addr > M.mem_size - size) {
- DB(printk("mem_ptr: address %#x out of range!\n", addr);)
+ DB(printf("mem_ptr: address %#x out of range!\n", addr);)
HALT_SYS();
}
if (addr < 0x200) {
- //printk("%x:%x updating int vector 0x%x\n",
+ //printf("%x:%x updating int vector 0x%x\n",
// M.x86.R_CS, M.x86.R_IP, addr >> 2);
}
retaddr = (u8 *) (M.mem_base + addr);
@@ -100,7 +96,7 @@
val = *ptr;
DB(if (DEBUG_MEM_TRACE())
- printk("%#08x 1 -> %#x\n", addr, val);)
+ printf("%#08x 1 -> %#x\n", addr, val);)
return val;
}
@@ -123,7 +119,7 @@
val = *(u16 *) (ptr);
DB(if (DEBUG_MEM_TRACE())
- printk("%#08x 2 -> %#x\n", addr, val);)
+ printf("%#08x 2 -> %#x\n", addr, val);)
return val;
}
@@ -145,7 +141,7 @@
val = *(u32 *) (ptr);
DB(if (DEBUG_MEM_TRACE())
- printk("%#08x 4 -> %#x\n", addr, val);)
+ printf("%#08x 4 -> %#x\n", addr, val);)
return val;
}
@@ -165,7 +161,7 @@
*(u8 *) (ptr) = val;
DB(if (DEBUG_MEM_TRACE())
- printk("%#08x 1 <- %#x\n", addr, val);)
+ printf("%#08x 1 <- %#x\n", addr, val);)
}
/****************************************************************************
@@ -184,7 +180,7 @@
*(u16 *) (ptr) = val;
DB(if (DEBUG_MEM_TRACE())
- printk("%#08x 2 <- %#x\n", addr, val);)
+ printf("%#08x 2 <- %#x\n", addr, val);)
}
/****************************************************************************
@@ -203,7 +199,7 @@
*(u32 *) (ptr) = val;
DB(if (DEBUG_MEM_TRACE())
- printk("%#08x 4 <- %#x\n", addr, val);)
+ printf("%#08x 4 <- %#x\n", addr, val);)
}
@@ -219,7 +215,7 @@
static u8 X86API p_inb(X86EMU_pioAddr addr)
{
DB(if (DEBUG_IO_TRACE())
- printk("inb %#04x \n", addr);)
+ printf("inb %#04x \n", addr);)
return inb(addr);
}
@@ -234,7 +230,7 @@
static u16 X86API p_inw(X86EMU_pioAddr addr)
{
DB(if (DEBUG_IO_TRACE())
- printk("inw %#04x \n", addr);)
+ printf("inw %#04x \n", addr);)
return inw(addr);
}
@@ -249,7 +245,7 @@
static u32 X86API p_inl(X86EMU_pioAddr addr)
{
DB(if (DEBUG_IO_TRACE())
- printk("inl %#04x \n", addr);)
+ printf("inl %#04x \n", addr);)
return inl(addr);
}
@@ -263,7 +259,7 @@
static void X86API p_outb(X86EMU_pioAddr addr, u8 val)
{
DB(if (DEBUG_IO_TRACE())
- printk("outb %#02x -> %#04x \n", val, addr);)
+ printf("outb %#02x -> %#04x \n", val, addr);)
outb(val, addr);
return;
}
@@ -278,7 +274,7 @@
static void X86API p_outw(X86EMU_pioAddr addr, u16 val)
{
DB(if (DEBUG_IO_TRACE())
- printk("outw %#04x -> %#04x \n", val, addr);)
+ printf("outw %#04x -> %#04x \n", val, addr);)
outw(val, addr);
return;
}
@@ -293,7 +289,7 @@
static void X86API p_outl(X86EMU_pioAddr addr, u32 val)
{
DB(if (DEBUG_IO_TRACE())
- printk("outl %#08x -> %#04x \n", val, addr);)
+ printf("outl %#08x -> %#04x \n", val, addr);)
outl(val, addr);
return;
Modified: trunk/util/x86emu/x86emu/x86emui.h
==============================================================================
--- trunk/util/x86emu/x86emu/x86emui.h Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/x86emu/x86emui.h Fri Mar 5 11:03:50 2010 (r5185)
@@ -74,8 +74,6 @@
#ifdef IN_MODULE
#include <xf86_ansic.h>
#else
-//#include <stdio.h>
-//#include <stdlib.h>
#include <string.h>
#endif
/*--------------------------- Inline Functions ----------------------------*/
Modified: trunk/util/x86emu/yabel/biosemu.c
==============================================================================
--- trunk/util/x86emu/yabel/biosemu.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/yabel/biosemu.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -1,6 +1,7 @@
/******************************************************************************
* Copyright (c) 2004, 2008 IBM Corporation
* Copyright (c) 2008, 2009 Pattrick Hueper <phueper(a)hueper.net>
+ * Copyright (c) 2010 coresystems GmbH
* All rights reserved.
* This program and the accompanying materials
* are made available under the terms of the BSD License
@@ -12,7 +13,6 @@
*****************************************************************************/
#include <string.h>
-
#include <types.h>
#include "debug.h"
@@ -28,9 +28,8 @@
#include "device.h"
#include "pmm.h"
-#include "compat/rtas.h"
-
#include <device/device.h>
+#include "compat/rtas.h"
static X86EMU_memFuncs my_mem_funcs = {
my_rdb, my_rdw, my_rdl,
@@ -57,13 +56,42 @@
{
u8 *rom_image;
int i = 0;
-#ifdef DEBUG
- debug_flags = 0;//DEBUG_PRINT_INT10 | DEBUG_PNP | DEBUG_INTR | DEBUG_CHECK_VMEM_ACCESS | DEBUG_MEM | DEBUG_IO;
- // | DEBUG_CHECK_VMEM_ACCESS | DEBUG_MEM | DEBUG_IO;
- // | DEBUG_TRACE_X86EMU | DEBUG_JMP;
+#if CONFIG_X86EMU_DEBUG
+ debug_flags = 0;
+#if defined(CONFIG_X86EMU_DEBUG_JMP) && CONFIG_X86EMU_DEBUG_JMP
+ debug_flags |= DEBUG_JMP;
+#endif
+#if defined(CONFIG_X86EMU_DEBUG_TRACE) && CONFIG_X86EMU_DEBUG_TRACE
+ debug_flags |= DEBUG_TRACE_X86EMU;
+#endif
+#if defined(CONFIG_X86EMU_DEBUG_PNP) && CONFIG_X86EMU_DEBUG_PNP
+ debug_flags |= DEBUG_PNP;
+#endif
+#if defined(CONFIG_X86EMU_DEBUG_DISK) && CONFIG_X86EMU_DEBUG_DISK
+ debug_flags |= DEBUG_DISK;
+#endif
+#if defined(CONFIG_X86EMU_DEBUG_PMM) && CONFIG_X86EMU_DEBUG_PMM
+ debug_flags |= DEBUG_PMM;
+#endif
+#if defined(CONFIG_X86EMU_DEBUG_VBE) && CONFIG_X86EMU_DEBUG_VBE
+ debug_flags |= DEBUG_VBE;
+#endif
+#if defined(CONFIG_X86EMU_DEBUG_INT10) && CONFIG_X86EMU_DEBUG_INT10
+ debug_flags |= DEBUG_PRINT_INT10;
+#endif
+#if defined(CONFIG_X86EMU_DEBUG_INTERRUPTS) && CONFIG_X86EMU_DEBUG_INTERRUPTS
+ debug_flags |= DEBUG_INTR;
+#endif
+#if defined(CONFIG_X86EMU_DEBUG_CHECK_VMEM_ACCESS) && CONFIG_X86EMU_DEBUG_CHECK_VMEM_ACCESS
+ debug_flags |= DEBUG_CHECK_VMEM_ACCESS;
+#endif
+#if defined(CONFIG_X86EMU_DEBUG_MEM) && CONFIG_X86EMU_DEBUG_MEM
+ debug_flags |= DEBUG_MEM;
+#endif
+#if defined(CONFIG_X86EMU_DEBUG_IO) && CONFIG_X86EMU_DEBUG_IO
+ debug_flags |= DEBUG_IO;
+#endif
- /* use CONFIG_YABEL_DEBUG_FLAGS, too... */
- debug_flags |= CONFIG_YABEL_DEBUG_FLAGS;
#endif
if (biosmem_size < MIN_REQUIRED_VMEM_SIZE) {
printf("Error: Not enough virtual memory: %x, required: %x!\n",
@@ -200,11 +228,11 @@
//TODO: check for further needed EBDA data...
// setup original ROM BIOS Area (F000:xxxx)
- char *date = "06/11/99";
+ const char *date = "06/11/99";
for (i = 0; date[i]; i++)
my_wrb(0xffff5 + i, date[i]);
// set up eisa ident string
- char *ident = "PCI_ISA";
+ const char *ident = "PCI_ISA";
for (i = 0; ident[i]; i++)
my_wrb(0xfffd9 + i, ident[i]);
@@ -250,14 +278,14 @@
// push a HLT instruction and a pointer to it onto the stack
// any return will pop the pointer and jump to the HLT, thus
// exiting (more or less) cleanly
- push_word(0xf4f4); //F4=HLT
+ push_word(0xf4f4); // F4=HLT
push_word(M.x86.R_SS);
push_word(M.x86.R_SP + 2);
CHECK_DBG(DEBUG_TRACE_X86EMU) {
X86EMU_trace_on();
+#if 0
} else {
-#ifdef DEBUG
M.x86.debug |= DEBUG_SAVE_IP_CS_F;
M.x86.debug |= DEBUG_DECODE_F;
M.x86.debug |= DEBUG_DECODE_NOPRINT_F;
@@ -268,7 +296,7 @@
M.x86.debug |= DEBUG_TRACEJMP_REGS_F;
M.x86.debug |= DEBUG_TRACECALL_F;
M.x86.debug |= DEBUG_TRACECALL_REGS_F;
- }
+ }
DEBUG_PRINTF("Executing Initialization Vector...\n");
X86EMU_exec();
@@ -278,7 +306,7 @@
* some boot device status in AX (see PNP BIOS Spec Section 3.3
*/
DEBUG_PRINTF_CS_IP("Option ROM Exit Status: %04x\n", M.x86.R_AX);
-#ifdef DEBUG
+#if defined(CONFIG_X86EMU_DEBUG) && CONFIG_X86EMU_DEBUG
DEBUG_PRINTF("Exit Status Decode:\n");
if (M.x86.R_AX & 0x100) { // bit 8
DEBUG_PRINTF
@@ -344,14 +372,12 @@
&& (M.x86.R_SP == STACK_START_OFFSET)) {
DEBUG_PRINTF("Stack is clean, initialization successfull!\n");
} else {
- DEBUG_PRINTF
- ("Stack unclean, initialization probably NOT COMPLETE!!\n");
+ printf("Stack unclean, initialization probably NOT COMPLETE!\n");
DEBUG_PRINTF("SS:SP = %04x:%04x, expected: %04x:%04x\n",
M.x86.R_SS, M.x86.R_SP, STACK_SEGMENT,
STACK_START_OFFSET);
}
-
// TODO: according to the BIOS Boot Spec initializations may be ended using INT18h and setting
// the status.
// We need to implement INT18 accordingly, pseudo code is in specsbbs101.pdf page 30
Modified: trunk/util/x86emu/yabel/biosemu.h
==============================================================================
--- trunk/util/x86emu/yabel/biosemu.h Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/yabel/biosemu.h Fri Mar 5 11:03:50 2010 (r5185)
@@ -46,4 +46,7 @@
typedef int (* yabel_handleIntFunc)(void);
extern yabel_handleIntFunc yabel_intFuncArray[256];
+struct device;
+
+u32 biosemu(u8 *biosmem, u32 biosmem_size, struct device *dev, unsigned long rom_addr);
#endif
Modified: trunk/util/x86emu/yabel/compat/functions.c
==============================================================================
--- trunk/util/x86emu/yabel/compat/functions.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/yabel/compat/functions.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -17,6 +17,7 @@
#include <string.h>
#include <device/device.h>
#include "../debug.h"
+#include "../biosemu.h"
#define VMEM_SIZE (1024 * 1024) /* 1 MB */
@@ -30,8 +31,6 @@
u8* vmem = NULL;
#endif
-u32 biosemu(u8 *biosmem, u32 biosmem_size, struct device *dev,
- unsigned long rom_addr);
#if CONFIG_BOOTSPLASH
void vbe_set_graphics(void);
#endif
@@ -46,10 +45,10 @@
#endif
if (vmem != NULL) {
- printf("Copying legacy memory from 0x%08x to the lower 1MB\n", vmem);
- memcpy(0x00000, vmem + 0x00000, 0x400); // IVT
- memcpy(0x00400, vmem + 0x00400, 0x100); // BDA
- memcpy(0xc0000, vmem + 0xc0000, 0x10000); // VGA OPROM
+ printf("Copying legacy memory from %p to the lower 1MB\n", vmem);
+ memcpy((void *)0x00000, vmem + 0x00000, 0x400); // IVT
+ memcpy((void *)0x00400, vmem + 0x00400, 0x100); // BDA
+ memcpy((void *)0xc0000, vmem + 0xc0000, 0x10000); // VGA OPROM
}
}
Modified: trunk/util/x86emu/yabel/debug.h
==============================================================================
--- trunk/util/x86emu/yabel/debug.h Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/yabel/debug.h Fri Mar 5 11:03:50 2010 (r5185)
@@ -21,21 +21,18 @@
/* printf is not available in coreboot... use printk */
#include <console/console.h>
-/* uurgs... yuck... x86emu/x86emu.h is redefining printk... we include it here
- * and use its redefinition of printk
- * TODO: FIX!!!! */
#include "x86emu/x86emu.h"
-#define printf printk
+#define printf(x...) printk(BIOS_DEBUG, x)
/* PH: empty versions of set/clr_ci
* TODO: remove! */
static inline void clr_ci(void) {};
static inline void set_ci(void) {};
-/* Set CONFIG_YABEL_DEBUG_FLAGS is a binary switch that allows you
- * to select the following items to debug. 1=on 0=off. After you
- * decide what you want to debug create the binary value, convert to hex
- * and set the Option (Ex. CONFIG_YABEL_DEBUG_FLAGS = 0x31FF //Debug All).
+/* debug_flags is a binary switch that allows you to select the following items
+ * to debug. 1=on 0=off. After you decide what you want to debug create the
+ * binary value, convert to hex and set the option. These options can be
+ * selected in Kconfig.
*
* |-DEBUG_JMP - print info about JMP and RETF opcodes from x86emu
* ||-DEBUG_TRACE_X86EMU - print _all_ opcodes that are executed by x86emu (WARNING: this will produce a LOT of output)
@@ -69,9 +66,7 @@
// set to enable tracing of JMPs in x86emu
#define DEBUG_JMP 0x2000
-//#define DEBUG
-//#undef DEBUG
-#ifdef DEBUG
+#if defined(CONFIG_X86EMU_DEBUG) && CONFIG_X86EMU_DEBUG
#define CHECK_DBG(_flag) if (debug_flags & _flag)
Modified: trunk/util/x86emu/yabel/device.c
==============================================================================
--- trunk/util/x86emu/yabel/device.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/yabel/device.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -40,7 +40,7 @@
#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
/* coreboot version */
-void
+static void
biosemu_dev_get_addr_info(void)
{
int taa_index = 0;
@@ -112,7 +112,7 @@
}
// store last entry index of translate_address_array
taa_last_entry = taa_index - 1;
-#ifdef DEBUG
+#if defined(CONFIG_X86EMU_DEBUG) && CONFIG_X86EMU_DEBUG
//dump translate_address_array
printf("translate_address_array: \n");
translate_address_t ta;
@@ -195,7 +195,7 @@
}
// store last entry index of translate_address_array
taa_last_entry = taa_index - 1;
-#ifdef DEBUG
+#if defined(CONFIG_X86EMU_DEBUG) && CONFIG_X86EMU_DEBUG
//dump translate_address_array
printf("translate_address_array: \n");
translate_address_t ta;
@@ -210,11 +210,12 @@
}
#endif
+#ifndef CONFIG_PCI_OPTION_ROM_RUN_YABEL
// to simulate accesses to legacy VGA Memory (0xA0000-0xBFFFF)
// we look for the first prefetchable memory BAR, if no prefetchable BAR found,
// we use the first memory BAR
// dev_translate_addr will translate accesses to the legacy VGA Memory into the found vmem BAR
-void
+static void
biosemu_dev_find_vmem_addr(void)
{
int i = 0;
@@ -257,7 +258,6 @@
//bios_device.vmem_size = 0;
}
-#ifndef CONFIG_PCI_OPTION_ROM_RUN_YABEL
void
biosemu_dev_get_puid(void)
{
@@ -267,7 +267,7 @@
}
#endif
-void
+static void
biosemu_dev_get_device_vendor_id(void)
{
@@ -334,7 +334,7 @@
memcpy(&pci_ds, (void *) (rom_base_addr + pci_ds_offset),
sizeof(pci_ds));
clr_ci();
-#ifdef DEBUG
+#if defined(CONFIG_X86EMU_DEBUG) && CONFIG_X86EMU_DEBUG
DEBUG_PRINTF("PCI Data Structure @%lx:\n",
rom_base_addr + pci_ds_offset);
dump((void *) &pci_ds, sizeof(pci_ds));
Modified: trunk/util/x86emu/yabel/interrupt.c
==============================================================================
--- trunk/util/x86emu/yabel/interrupt.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/yabel/interrupt.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -11,6 +11,7 @@
* IBM Corporation - initial implementation
*****************************************************************************/
+#include <types.h>
#include "compat/rtas.h"
#include "biosemu.h"
@@ -18,6 +19,7 @@
#include "device.h"
#include "debug.h"
#include "pmm.h"
+#include "interrupt.h"
#include <x86emu/x86emu.h>
#include "../x86emu/prim_ops.h"
Modified: trunk/util/x86emu/yabel/io.c
==============================================================================
--- trunk/util/x86emu/yabel/io.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/yabel/io.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -17,6 +17,7 @@
#include "device.h"
#include "debug.h"
#include <x86emu/x86emu.h>
+#include "io.h"
#ifdef CONFIG_PCI_OPTION_ROM_RUN_YABEL
#include <device/pci.h>
@@ -87,10 +88,7 @@
u8 val;
val = inb(addr);
-#ifdef CONFIG_DEBUG
- if ((debug_flags & DEBUG_IO) && (addr != 0x40))
- printk("inb(0x%04x) = 0x%02x\n", addr, val);
-#endif
+ DEBUG_PRINTF_IO("inb(0x%04x) = 0x%02x\n", addr, val);
return val;
}
@@ -100,11 +98,8 @@
u16 val;
val = inw(addr);
+ DEBUG_PRINTF_IO("inw(0x%04x) = 0x%04x\n", addr, val);
-#ifdef CONFIG_DEBUG
- if (debug_flags & DEBUG_IO)
- printk("inw(0x%04x) = 0x%04x\n", addr, val);
-#endif
return val;
}
@@ -113,38 +108,26 @@
u32 val;
val = inl(addr);
+ DEBUG_PRINTF_IO("inl(0x%04x) = 0x%08x\n", addr, val);
-#ifdef CONFIG_DEBUG
- if (debug_flags & DEBUG_IO)
- printk("inl(0x%04x) = 0x%08x\n", addr, val);
-#endif
return val;
}
void my_outb(X86EMU_pioAddr addr, u8 val)
{
-#ifdef CONFIG_DEBUG
- if ((debug_flags & DEBUG_IO) && (addr != 0x43))
- printk("outb(0x%02x, 0x%04x)\n", val, addr);
-#endif
+ DEBUG_PRINTF_IO("outb(0x%02x, 0x%04x)\n", val, addr);
outb(val, addr);
}
void my_outw(X86EMU_pioAddr addr, u16 val)
{
-#ifdef CONFIG_DEBUG
- if (debug_flags & DEBUG_IO)
- printk("outw(0x%04x, 0x%04x)\n", val, addr);
-#endif
+ DEBUG_PRINTF_IO("outw(0x%04x, 0x%04x)\n", val, addr);
outw(val, addr);
}
void my_outl(X86EMU_pioAddr addr, u32 val)
{
-#ifdef CONFIG_DEBUG
- if (debug_flags & DEBUG_IO)
- printk("outl(0x%08x, 0x%04x)\n", val, addr);
-#endif
+ DEBUG_PRINTF_IO("outl(0x%08x, 0x%04x)\n", val, addr);
outl(val, addr);
}
Modified: trunk/util/x86emu/yabel/mem.c
==============================================================================
--- trunk/util/x86emu/yabel/mem.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/yabel/mem.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -16,10 +16,11 @@
#include "device.h"
#include "x86emu/x86emu.h"
#include "biosemu.h"
+#include "mem.h"
#include "compat/time.h"
// define a check for access to certain (virtual) memory regions (interrupt handlers, BIOS Data Area, ...)
-#ifdef DEBUG
+#if CONFIG_X86EMU_DEBUG
static u8 in_check = 0; // to avoid recursion...
u16 ebda_segment;
u32 ebda_size;
@@ -27,11 +28,6 @@
//TODO: these macros have grown so large, that they should be changed to an inline function,
//just for the sake of readability...
-//declare prototypes of the functions to follow, for use in DEBUG_CHECK_VMEM_ACCESS
-u8 my_rdb(u32);
-u16 my_rdw(u32);
-u32 my_rdl(u32);
-
#define DEBUG_CHECK_VMEM_READ(_addr, _rval) \
if ((debug_flags & DEBUG_CHECK_VMEM_ACCESS) && (in_check == 0)) { \
in_check = 1; \
Modified: trunk/util/x86emu/yabel/vbe.c
==============================================================================
--- trunk/util/x86emu/yabel/vbe.c Mon Mar 1 21:16:38 2010 (r5184)
+++ trunk/util/x86emu/yabel/vbe.c Fri Mar 5 11:03:50 2010 (r5185)
@@ -154,7 +154,7 @@
}
// VBE Function 00h
-u8
+static u8
vbe_info(vbe_info_t * info)
{
vbe_prepare();
@@ -223,7 +223,7 @@
}
// VBE Function 01h
-u8
+static u8
vbe_get_mode_info(vbe_mode_info_t * mode_info)
{
vbe_prepare();
@@ -264,7 +264,7 @@
}
// VBE Function 02h
-u8
+static u8
vbe_set_mode(vbe_mode_info_t * mode_info)
{
vbe_prepare();
@@ -301,7 +301,7 @@
}
//VBE Function 08h
-u8
+static u8
vbe_set_palette_format(u8 format)
{
vbe_prepare();
@@ -337,7 +337,7 @@
}
// VBE Function 09h
-u8
+static u8
vbe_set_color(u16 color_number, u32 color_value)
{
vbe_prepare();
@@ -379,7 +379,7 @@
return 0;
}
-u8
+static u8
vbe_get_color(u16 color_number, u32 * color_value)
{
vbe_prepare();
@@ -422,7 +422,7 @@
}
// VBE Function 15h
-u8
+static u8
vbe_get_ddc_info(vbe_ddc_info_t * ddc_info)
{
vbe_prepare();
@@ -496,7 +496,7 @@
return 0;
}
-u32
+static u32
vbe_get_info(void)
{
u8 rval;
@@ -571,7 +571,7 @@
}
#endif
if (*((u64 *) ddc_info.edid_block_zero) !=
- (u64) 0x00FFFFFFFFFFFF00) {
+ (u64) 0x00FFFFFFFFFFFF00ULL) {
// invalid EDID signature... probably no monitor
output->display_type = 0x0;
@@ -599,36 +599,36 @@
DEBUG_PRINTF_VBE("Video Mode 0x%04x available, %s\n",
mode_info.video_mode,
- (mode_info.attributes & 0x1) ==
+ (le16_to_cpu(mode_info.vesa.mode_attributes) & 0x1) ==
0 ? "not supported" : "supported");
DEBUG_PRINTF_VBE("\tTTY: %s\n",
- (mode_info.attributes & 0x4) ==
+ (le16_to_cpu(mode_info.vesa.mode_attributes) & 0x4) ==
0 ? "no" : "yes");
DEBUG_PRINTF_VBE("\tMode: %s %s\n",
- (mode_info.attributes & 0x8) ==
+ (le16_to_cpu(mode_info.vesa.mode_attributes) & 0x8) ==
0 ? "monochrome" : "color",
- (mode_info.attributes & 0x10) ==
+ (le16_to_cpu(mode_info.vesa.mode_attributes) & 0x10) ==
0 ? "text" : "graphics");
DEBUG_PRINTF_VBE("\tVGA: %s\n",
- (mode_info.attributes & 0x20) ==
+ (le16_to_cpu(mode_info.vesa.mode_attributes) & 0x20) ==
0 ? "compatible" : "not compatible");
DEBUG_PRINTF_VBE("\tWindowed Mode: %s\n",
- (mode_info.attributes & 0x40) ==
+ (le16_to_cpu(mode_info.vesa.mode_attributes) & 0x40) ==
0 ? "yes" : "no");
DEBUG_PRINTF_VBE("\tFramebuffer: %s\n",
- (mode_info.attributes & 0x80) ==
+ (le16_to_cpu(mode_info.vesa.mode_attributes) & 0x80) ==
0 ? "no" : "yes");
DEBUG_PRINTF_VBE("\tResolution: %dx%d\n",
- mode_info.x_resolution,
- mode_info.y_resolution);
+ le16_to_cpu(mode_info.vesa.x_resolution),
+ le16_to_cpu(mode_info.vesa.y_resolution));
DEBUG_PRINTF_VBE("\tChar Size: %dx%d\n",
- mode_info.x_charsize, mode_info.y_charsize);
+ mode_info.vesa.x_charsize, mode_info.vesa.y_charsize);
DEBUG_PRINTF_VBE("\tColor Depth: %dbpp\n",
- mode_info.bits_per_pixel);
+ mode_info.vesa.bits_per_pixel);
DEBUG_PRINTF_VBE("\tMemory Model: 0x%x\n",
- mode_info.memory_model);
+ mode_info.vesa.memory_model);
DEBUG_PRINTF_VBE("\tFramebuffer Offset: %08x\n",
- mode_info.framebuffer_address);
+ le32_to_cpu(mode_info.vesa.phys_base_ptr));
if ((mode_info.vesa.bits_per_pixel == input.color_depth)
&& (le16_to_cpu(mode_info.vesa.x_resolution) <= input.max_screen_width)
@@ -647,10 +647,10 @@
DEBUG_PRINTF_VBE
("Best Video Mode found: 0x%x, %dx%d, %dbpp, framebuffer_address: 0x%x\n",
best_mode_info.video_mode,
- best_mode_info.x_resolution,
- best_mode_info.y_resolution,
- best_mode_info.bits_per_pixel,
- best_mode_info.framebuffer_address);
+ best_mode_info.vesa.x_resolution,
+ best_mode_info.vesa.y_resolution,
+ best_mode_info.vesa.bits_per_pixel,
+ le32_to_cpu(best_mode_info.vesa.phys_base_ptr));
//printf("Mode Info Dump:");
//dump(best_mode_info.mode_info_block, 64);
3
2
Author: myles
Date: Fri Mar 5 20:12:34 2010
New Revision: 5192
URL: http://tracker.coreboot.org/trac/coreboot/changeset/5192
Log:
Remove redundant run_bios prototype. Trivial.
Signed-off-by: Myles Watson <mylesgw(a)gmail.com>
Acked-by: Myles Watson <mylesgw(a)gmail.com>
Modified:
trunk/util/x86emu/x86.c
Modified: trunk/util/x86emu/x86.c
==============================================================================
--- trunk/util/x86emu/x86.c Fri Mar 5 19:27:19 2010 (r5191)
+++ trunk/util/x86emu/x86.c Fri Mar 5 20:12:34 2010 (r5192)
@@ -32,7 +32,6 @@
};
void x86_exception(struct eregs *info);
-void run_bios(struct device *dev, unsigned long addr);
extern unsigned char __idt_handler, __idt_handler_size;
extern unsigned char __realmode_code, __realmode_code_size;
1
0
Dear coreboot readers!
This is the automatic build system of coreboot.
The developer "myles" checked in revision 5191 to
the coreboot repository. This caused the following
changes:
Change Log:
1. Move run_bios prototype to device.h
2. Use time.h for get_time() and move tb_freq into functions.c
3. Move read_io and write_io to io.c and make them static
4. Make a couple of functions static in interrupt.c
5. Refactor a cast from char[] to u64 to get rid of potential alignment problems and a warning
Signed-off-by: Myles Watson <mylesgw(a)gmail.com>
Acked-by: Stefan Reinauer <stepan(a)coresystems.de>
Build Log:
Compilation of emulation:qemu-x86 has been broken
See the error log at http://qa.coreboot.org/log_buildbrd.php?revision=5191&device=qemu-x86&vendo…
If something broke during this checkin please be a pain
in myles's neck until the issue is fixed.
If this issue is not fixed within 24h the revision should
be backed out.
Best regards,
coreboot automatic build system
1
0
This patch removes most of the rest of the compilation warnings for me.
1. Move run_bios prototype to device.h
2. Use time.h for get_time()
3. Move read_io and write_io to io.c and make them static
4. Make a couple of functions static in interrupt.c
5. Refactor a cast from char[] to u64 to get rid of potential alignment
problems and a warning
The only ones left are "unused" warnings.
I think we should get rid of that warning, since we conditionally call
functions based on debugging and various config variables. Is there a case
where it helps enough to justify all the warnings?
This next part isn't part of the patch, but applying it makes qemu compile
with yabel (with and without debugging).
Index: Makefile
===================================================================
--- Makefile (revision 5186)
+++ Makefile (working copy)
@@ -239,7 +239,7 @@
CFLAGS = $(INCLUDES) -Os -nostdinc
CFLAGS += -nostdlib -Wall -Wundef -Wstrict-prototypes -Wmissing-prototypes
CFLAGS += -Wwrite-strings -Wredundant-decls -Wno-trigraphs
-CFLAGS += -Wstrict-aliasing -Wshadow
+CFLAGS += -Wstrict-aliasing -Wshadow -Wno-unused
ifeq ($(CONFIG_WARNINGS_ARE_ERRORS),y)
CFLAGS += -Werror
endif
Signed-off-by: Myles Watson <mylesgw(a)gmail.com>
Thanks,
Myles
2
3

[commit] r5191 - in trunk: src/devices src/include/device util/x86emu/yabel util/x86emu/yabel/compat
by repository service March 5, 2010
by repository service March 5, 2010
March 5, 2010
Author: myles
Date: Fri Mar 5 19:27:19 2010
New Revision: 5191
URL: http://tracker.coreboot.org/trac/coreboot/changeset/5191
Log:
1. Move run_bios prototype to device.h
2. Use time.h for get_time() and move tb_freq into functions.c
3. Move read_io and write_io to io.c and make them static
4. Make a couple of functions static in interrupt.c
5. Refactor a cast from char[] to u64 to get rid of potential alignment problems and a warning
Signed-off-by: Myles Watson <mylesgw(a)gmail.com>
Acked-by: Stefan Reinauer <stepan(a)coresystems.de>
Modified:
trunk/src/devices/pci_device.c
trunk/src/include/device/device.h
trunk/util/x86emu/yabel/compat/functions.c
trunk/util/x86emu/yabel/compat/time.h
trunk/util/x86emu/yabel/interrupt.c
trunk/util/x86emu/yabel/io.c
trunk/util/x86emu/yabel/mem.c
trunk/util/x86emu/yabel/vbe.c
Modified: trunk/src/devices/pci_device.c
==============================================================================
--- trunk/src/devices/pci_device.c Fri Mar 5 19:25:19 2010 (r5190)
+++ trunk/src/devices/pci_device.c Fri Mar 5 19:27:19 2010 (r5191)
@@ -652,7 +652,6 @@
void pci_dev_init(struct device *dev)
{
#if CONFIG_PCI_ROM_RUN == 1 || CONFIG_VGA_ROM_RUN == 1
- void run_bios(struct device *dev, unsigned long addr);
struct rom_header *rom, *ram;
if (CONFIG_PCI_ROM_RUN != 1 && /* Only execute VGA ROMs. */
Modified: trunk/src/include/device/device.h
==============================================================================
--- trunk/src/include/device/device.h Fri Mar 5 19:25:19 2010 (r5190)
+++ trunk/src/include/device/device.h Fri Mar 5 19:27:19 2010 (r5191)
@@ -117,6 +117,9 @@
void dev_set_enabled(device_t dev, int enable);
void disable_children(struct bus *bus);
+/* Option ROM helper functions */
+void run_bios(struct device *dev, unsigned long addr);
+
/* Helper functions */
device_t find_dev_path(struct bus *parent, struct device_path *path);
device_t alloc_find_dev(struct bus *parent, struct device_path *path);
Modified: trunk/util/x86emu/yabel/compat/functions.c
==============================================================================
--- trunk/util/x86emu/yabel/compat/functions.c Fri Mar 5 19:25:19 2010 (r5190)
+++ trunk/util/x86emu/yabel/compat/functions.c Fri Mar 5 19:27:19 2010 (r5191)
@@ -18,6 +18,7 @@
#include <device/device.h>
#include "../debug.h"
#include "../biosemu.h"
+#include "../compat/time.h"
#define VMEM_SIZE (1024 * 1024) /* 1 MB */
@@ -52,6 +53,8 @@
}
}
+unsigned long tb_freq = 0;
+
u64 get_time(void)
{
u64 act;
@@ -64,50 +67,3 @@
act = ((u64) edx << 32) | eax;
return act;
}
-
-unsigned int
-read_io(void *addr, size_t sz)
-{
- unsigned int ret;
- /* since we are using inb instructions, we need the port number as 16bit value */
- u16 port = (u16)(u32) addr;
-
- switch (sz) {
- case 1:
- asm volatile ("inb %1, %b0" : "=a"(ret) : "d" (port));
- break;
- case 2:
- asm volatile ("inw %1, %w0" : "=a"(ret) : "d" (port));
- break;
- case 4:
- asm volatile ("inl %1, %0" : "=a"(ret) : "d" (port));
- break;
- default:
- ret = 0;
- }
-
- return ret;
-}
-
-int
-write_io(void *addr, unsigned int value, size_t sz)
-{
- u16 port = (u16)(u32) addr;
- switch (sz) {
- /* since we are using inb instructions, we need the port number as 16bit value */
- case 1:
- asm volatile ("outb %b0, %1" : : "a"(value), "d" (port));
- break;
- case 2:
- asm volatile ("outw %w0, %1" : : "a"(value), "d" (port));
- break;
- case 4:
- asm volatile ("outl %0, %1" : : "a"(value), "d" (port));
- break;
- default:
- return -1;
- }
-
- return 0;
-}
-
Modified: trunk/util/x86emu/yabel/compat/time.h
==============================================================================
--- trunk/util/x86emu/yabel/compat/time.h Fri Mar 5 19:25:19 2010 (r5190)
+++ trunk/util/x86emu/yabel/compat/time.h Fri Mar 5 19:27:19 2010 (r5191)
@@ -13,5 +13,6 @@
#define _BIOSEMU_COMPAT_TIME_H
/* TODO: check how this works in x86 */
-static unsigned long tb_freq = 0;
+extern unsigned long tb_freq;
+u64 get_time(void);
#endif
Modified: trunk/util/x86emu/yabel/interrupt.c
==============================================================================
--- trunk/util/x86emu/yabel/interrupt.c Fri Mar 5 19:25:19 2010 (r5190)
+++ trunk/util/x86emu/yabel/interrupt.c Fri Mar 5 19:27:19 2010 (r5191)
@@ -31,7 +31,7 @@
//setup to run the code at the address, that the Interrupt Vector points to...
-void
+static void
setupInt(int intNum)
{
DEBUG_PRINTF_INTR("%s(%x): executing interrupt handler @%08x\n",
@@ -50,7 +50,7 @@
}
// handle int10 (VGA BIOS Interrupt)
-void
+static void
handleInt10(void)
{
// the data for INT10 is stored in BDA (0000:0400h) offset 49h-66h
@@ -207,7 +207,7 @@
;
-void
+static void
translate_keycode(u64 * keycode)
{
u8 scan_code = 0;
@@ -233,7 +233,7 @@
}
// handle int16 (Keyboard BIOS Interrupt)
-void
+static void
handleInt16(void)
{
// keyboard buffer is in BIOS Memory Area:
@@ -319,7 +319,7 @@
}
// handle int1a (PCI BIOS Interrupt)
-void
+static void
handleInt1a(void)
{
// function number in AX
Modified: trunk/util/x86emu/yabel/io.c
==============================================================================
--- trunk/util/x86emu/yabel/io.c Fri Mar 5 19:25:19 2010 (r5190)
+++ trunk/util/x86emu/yabel/io.c Fri Mar 5 19:27:19 2010 (r5191)
@@ -24,12 +24,51 @@
#include <device/pci_ops.h>
#endif
-// those are defined in net-snk/oflib/pci.c
-extern unsigned int read_io(void *, size_t);
-extern int write_io(void *, unsigned int, size_t);
+static unsigned int
+read_io(void *addr, size_t sz)
+{
+ unsigned int ret;
+ /* since we are using inb instructions, we need the port number as 16bit value */
+ u16 port = (u16)(u32) addr;
-//defined in net-snk/kernel/timer.c
-extern u64 get_time(void);
+ switch (sz) {
+ case 1:
+ asm volatile ("inb %1, %b0" : "=a"(ret) : "d" (port));
+ break;
+ case 2:
+ asm volatile ("inw %1, %w0" : "=a"(ret) : "d" (port));
+ break;
+ case 4:
+ asm volatile ("inl %1, %0" : "=a"(ret) : "d" (port));
+ break;
+ default:
+ ret = 0;
+ }
+
+ return ret;
+}
+
+static int
+write_io(void *addr, unsigned int value, size_t sz)
+{
+ u16 port = (u16)(u32) addr;
+ switch (sz) {
+ /* since we are using inb instructions, we need the port number as 16bit value */
+ case 1:
+ asm volatile ("outb %b0, %1" : : "a"(value), "d" (port));
+ break;
+ case 2:
+ asm volatile ("outw %w0, %1" : : "a"(value), "d" (port));
+ break;
+ case 4:
+ asm volatile ("outl %0, %1" : : "a"(value), "d" (port));
+ break;
+ default:
+ return -1;
+ }
+
+ return 0;
+}
#ifdef CONFIG_ARCH_X86
#include <arch/io.h>
Modified: trunk/util/x86emu/yabel/mem.c
==============================================================================
--- trunk/util/x86emu/yabel/mem.c Fri Mar 5 19:25:19 2010 (r5190)
+++ trunk/util/x86emu/yabel/mem.c Fri Mar 5 19:27:19 2010 (r5191)
@@ -159,9 +159,6 @@
#define DEBUG_CHECK_VMEM_WRITE(_addr, _val)
#endif
-//defined in net-snk/kernel/timer.c
-extern u64 get_time(void);
-
void update_time(u32);
#if !defined(CONFIG_YABEL_DIRECTHW) || (!CONFIG_YABEL_DIRECTHW)
Modified: trunk/util/x86emu/yabel/vbe.c
==============================================================================
--- trunk/util/x86emu/yabel/vbe.c Fri Mar 5 19:25:19 2010 (r5190)
+++ trunk/util/x86emu/yabel/vbe.c Fri Mar 5 19:27:19 2010 (r5191)
@@ -570,8 +570,17 @@
sizeof(ddc_info.edid_block_zero));
}
#endif
- if (*((u64 *) ddc_info.edid_block_zero) !=
- (u64) 0x00FFFFFFFFFFFF00ULL) {
+/* This could fail because of alignment issues, so use a longer form.
+ *((u64 *) ddc_info.edid_block_zero) != (u64) 0x00FFFFFFFFFFFF00ULL
+*/
+ if (ddc_info.edid_block_zero[0] != 0x00 ||
+ ddc_info.edid_block_zero[1] != 0xFF ||
+ ddc_info.edid_block_zero[2] != 0xFF ||
+ ddc_info.edid_block_zero[3] != 0xFF ||
+ ddc_info.edid_block_zero[4] != 0xFF ||
+ ddc_info.edid_block_zero[5] != 0xFF ||
+ ddc_info.edid_block_zero[6] != 0xFF ||
+ ddc_info.edid_block_zero[7] != 0x00 ) {
// invalid EDID signature... probably no monitor
output->display_type = 0x0;
1
0