1
diff --git a/Makefile b/Makefile
2
index f28d86c..20da6d0 100644
5
@@ -84,7 +84,7 @@ vpath %.S src vgasrc
6
################ Common build rules
8
# Verify the build environment works.
9
-TESTGCC:=$(shell CC="$(CC)" LD="$(LD)" IASL="$(IASL)" tools/test-build.sh)
10
+TESTGCC:=$(shell OUT="$(OUT)" CC="$(CC)" LD="$(LD)" IASL="$(IASL)" tools/test-build.sh)
11
ifeq "$(TESTGCC)" "-1"
12
$(error "Please upgrade the build environment")
14
@@ -97,7 +97,7 @@ endif
15
# Do a whole file compile by textually including all C code.
17
@echo " Compiling whole program $3"
18
-$(Q)printf '$(foreach i,$2,#include "../$i"\n)' > $3.tmp.c
19
+$(Q)printf '$(foreach i,$2,#include "$(CURDIR)/$i"\n)' > $3.tmp.c
20
$(Q)$(CC) $1 $(CFLAGSWHOLE) -c $3.tmp.c -o $3
23
@@ -126,11 +126,11 @@ $(OUT)asm-offsets.h: $(OUT)asm-offsets.s
24
@echo " Generating offset file $@"
25
$(Q)./tools/gen-offsets.sh $< $@
27
-$(OUT)ccode16.o: $(OUT)autoconf.h $(patsubst %.c, out/%.o,$(SRC16)) ; $(call whole-compile, $(CFLAGS16), $(addprefix src/, $(SRC16)),$@)
28
+$(OUT)ccode16.o: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRC16)) ; $(call whole-compile, $(CFLAGS16), $(addprefix src/, $(SRC16)),$@)
30
-$(OUT)code32seg.o: $(OUT)autoconf.h $(patsubst %.c, out/%.o,$(SRC32SEG)) ; $(call whole-compile, $(CFLAGS32SEG), $(addprefix src/, $(SRC32SEG)),$@)
31
+$(OUT)code32seg.o: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRC32SEG)) ; $(call whole-compile, $(CFLAGS32SEG), $(addprefix src/, $(SRC32SEG)),$@)
33
-$(OUT)ccode32flat.o: $(OUT)autoconf.h $(patsubst %.c, out/%.o,$(SRC32FLAT)) ; $(call whole-compile, $(CFLAGS32FLAT), $(addprefix src/, $(SRC32FLAT)),$@)
34
+$(OUT)ccode32flat.o: $(OUT)autoconf.h $(patsubst %.c, $(OUT)%.o,$(SRC32FLAT)) ; $(call whole-compile, $(CFLAGS32FLAT), $(addprefix src/, $(SRC32FLAT)),$@)
36
$(OUT)romlayout.o: romlayout.S $(OUT)asm-offsets.h
37
@echo " Compiling (16bit) $@"
38
diff --git a/src/Kconfig b/src/Kconfig
39
index 0b112ed..2c9100d 100644
42
@@ -367,7 +367,7 @@ menu "BIOS Tables"
43
Support generation of ACPI tables.
46
-source ../vgasrc/Kconfig
47
+source vgasrc/Kconfig
51
diff --git a/src/pciinit.c b/src/pciinit.c
52
index a406bbd..b3f359f 100644
55
@@ -91,8 +91,18 @@ const u8 pci_irqs[4] = {
59
+static int dummy_pci_slot_get_irq(struct pci_device *pci, int pin)
61
+ dprintf(1, "pci_slot_get_irq called with unknown routing\n");
63
+ return 0xff; /* PCI defined "unknown" or "no connection" for x86 */
66
+static int (*pci_slot_get_irq)(struct pci_device *pci, int pin) =
67
+ dummy_pci_slot_get_irq;
69
// Return the global irq number corresponding to a host bus device irq pin.
70
-static int pci_slot_get_irq(struct pci_device *pci, int pin)
71
+static int piix_pci_slot_get_irq(struct pci_device *pci, int pin)
75
@@ -104,6 +114,31 @@ static int pci_slot_get_irq(struct pci_device *pci, int pin)
76
return pci_irqs[(pin - 1 + slot_addend) & 3];
79
+static int mch_pci_slot_get_irq(struct pci_device *pci, int pin)
81
+ int irq, slot, pin_addend = 0;
83
+ while (pci->parent != NULL) {
84
+ pin_addend += pci_bdf_to_dev(pci->bdf);
87
+ slot = pci_bdf_to_dev(pci->bdf);
90
+ /* Slots 0-24 rotate slot:pin mapping similar to piix above, but
91
+ with a different starting index - see q35-acpi-dsdt.dsl */
93
+ irq = pci_irqs[(pin - 1 + pin_addend + slot) & 3];
95
+ /* Slots 25-31 all use LNKA mapping (or LNKE, but A:D = E:H) */
97
+ irq = pci_irqs[(pin - 1 + pin_addend) & 3];
104
/* PIIX3/PIIX4 PCI to ISA bridge */
105
static void piix_isa_bridge_init(struct pci_device *pci, void *arg)
107
@@ -143,11 +178,9 @@ void mch_isa_bridge_init(struct pci_device *dev, void *arg)
108
/* activate irq remapping in LPC */
110
/* PIRQ[A-D] routing */
111
- pci_config_writeb(bdf, ICH9_LPC_PIRQA_ROUT + i,
112
- irq | ICH9_LPC_PIRQ_ROUT_IRQEN);
113
+ pci_config_writeb(bdf, ICH9_LPC_PIRQA_ROUT + i, irq);
114
/* PIRQ[E-H] routing */
115
- pci_config_writeb(bdf, ICH9_LPC_PIRQE_ROUT + i,
116
- irq | ICH9_LPC_PIRQ_ROUT_IRQEN);
117
+ pci_config_writeb(bdf, ICH9_LPC_PIRQE_ROUT + i, irq);
119
outb(elcr[0], ICH9_LPC_PORT_ELCR1);
120
outb(elcr[1], ICH9_LPC_PORT_ELCR2);
121
@@ -294,6 +327,8 @@ void i440fx_mem_addr_init(struct pci_device *dev, void *arg)
122
pcimem_start = 0x80000000;
123
else if (RamSize <= 0xc0000000)
124
pcimem_start = 0xc0000000;
126
+ pci_slot_get_irq = piix_pci_slot_get_irq;
129
void mch_mem_addr_init(struct pci_device *dev, void *arg)
130
@@ -312,6 +347,8 @@ void mch_mem_addr_init(struct pci_device *dev, void *arg)
132
/* setup pci i/o window (above mmconfig) */
133
pcimem_start = addr + size;
135
+ pci_slot_get_irq = mch_pci_slot_get_irq;
138
static const struct pci_device_id pci_platform_tbl[] = {
139
diff --git a/src/usb-ehci.c b/src/usb-ehci.c
140
index 2676615..8580f1d 100644
143
@@ -347,9 +347,9 @@ ehci_init(struct pci_device *pci, int busid, struct pci_device *comppci)
145
cntl->usb.type = USB_TYPE_EHCI;
147
+ cntl->regs = (void*)caps + readb(&caps->caplength);
148
if (hcc_params & HCC_64BIT_ADDR)
149
cntl->regs->ctrldssegment = 0;
150
- cntl->regs = (void*)caps + readb(&caps->caplength);
152
dprintf(1, "EHCI init on dev %02x:%02x.%x (regs=%p)\n"
153
, pci_bdf_to_bus(bdf), pci_bdf_to_dev(bdf)
154
diff --git a/tools/acpi_extract.py b/tools/acpi_extract.py
155
index 3295678..dd3ccfd 100755
156
--- a/tools/acpi_extract.py
157
+++ b/tools/acpi_extract.py
158
@@ -225,12 +225,12 @@ for line in fileinput.input():
160
debug = "input line %d: %s" % (lineno, line)
161
#ASL listing: space, then line#, then ...., then code
162
- pasl = re.compile('^\s+([0-9]+)\.\.\.\.\s*')
163
+ pasl = re.compile('^\s+([0-9]+)(:\s\s|\.\.\.\.)\s*')
164
m = pasl.search(line)
166
add_asl(lineno, pasl.sub("", line));
167
# AML listing: offset in hex, then ...., then code
168
- paml = re.compile('^([0-9A-Fa-f]+)\.\.\.\.\s*')
169
+ paml = re.compile('^([0-9A-Fa-f]+)(:\s\s|\.\.\.\.)\s*')
170
m = paml.search(line)
172
add_aml(m.group(1), paml.sub("", line))
173
diff --git a/tools/test-build.sh b/tools/test-build.sh
174
index 7bd6d1f..081f9fd 100755
175
--- a/tools/test-build.sh
176
+++ b/tools/test-build.sh
177
@@ -14,13 +14,13 @@ if [ $? -ne 0 ]; then
182
-TMPFILE1=out/tmp_testcompile1.c
183
-TMPFILE1o=out/tmp_testcompile1.o
184
-TMPFILE1_ld=out/tmp_testcompile1.lds
185
-TMPFILE2=out/tmp_testcompile2.c
186
-TMPFILE2o=out/tmp_testcompile2.o
187
-TMPFILE3o=out/tmp_testcompile3.o
189
+TMPFILE1=${OUT}/tmp_testcompile1.c
190
+TMPFILE1o=${OUT}/tmp_testcompile1.o
191
+TMPFILE1_ld=${OUT}/tmp_testcompile1.lds
192
+TMPFILE2=${OUT}/tmp_testcompile2.c
193
+TMPFILE2o=${OUT}/tmp_testcompile2.o
194
+TMPFILE3o=${OUT}/tmp_testcompile3.o
196
# Test if ld's alignment handling is correct. This is a known problem
197
# with the linker that ships with Ubuntu 11.04.
198
@@ -41,9 +41,16 @@ SECTIONS
201
$CC -O -g -c $TMPFILE1 -o $TMPFILE1o > /dev/null 2>&1
202
+if [ $? -ne 0 ]; then
203
+ echo "Unable to execute the C compiler ($CC)." >&2
205
+ echo "Please install a working compiler and retry." >&2
209
$LD -T $TMPFILE1_ld $TMPFILE1o -o $TMPFILE2o > /dev/null 2>&1
210
if [ $? -ne 0 ]; then
211
- echo "The version of LD on this system does not properly handle" >&2
212
+ echo "The version of LD on this system ($LD) does not properly handle" >&2
213
echo "alignments. As a result, this project can not be built." >&2
215
echo "The problem may be the result of this LD bug report:" >&2