Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2598
-gerrit
commit fcd8a6c3c5080464a16bcf939dc31bc9210b319a
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Wed Mar 6 20:19:27 2013 +0200
Refactor matching filters to actions
Each hooks list has some criteria when an action matches a filter.
For memory and IO, the action address must be within the range
of an enabled filter.
For CPUID and MSR, the filter must be enabled, and the filter
internally checks the index parameters.
Change-Id: I6f035a0a39d1f94dc77e1b1dc16459b071ca871a
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
SerialICE/simba/hooks.lua | 56 ++++++++++++++++++++++-------------------------
1 file changed, 26 insertions(+), 30 deletions(-)
diff --git a/SerialICE/simba/hooks.lua b/SerialICE/simba/hooks.lua
index 4a0d529..8877cd7 100644
--- a/SerialICE/simba/hooks.lua
+++ b/SerialICE/simba/hooks.lua
@@ -3,8 +3,8 @@
froot = { id = 0, name = "SerialICE" }
fresource = { id = 1, name = "Resource" }
-function new_hooks(str)
- return { list = nil, name = str }
+function new_hooks(str, rule)
+ return { list = nil, name = str, match_filter = rule }
end
next_filter_id = 2
@@ -21,12 +21,22 @@ function new_parent_action()
current_parent_id = action_id()
end
+function filter_in_range(f, action)
+ if f.enable and action.addr >= f.base and action.addr < f.base + f.size then
+ return true
+ end
+ return false
+end
+
+function filter_enabled(f, action)
+ return f.enable
+end
-io_hooks = new_hooks("IO")
-mem_hooks = new_hooks("MEM")
+io_hooks = new_hooks("IO", filter_in_range)
+mem_hooks = new_hooks("MEM", filter_in_range)
-cpumsr_hooks = new_hooks("CPU MSR")
-cpuid_hooks = new_hooks("CPUID")
+cpumsr_hooks = new_hooks("CPU MSR", filter_enabled)
+cpuid_hooks = new_hooks("CPUID", filter_enabled)
function enable_hook(list, filter)
if not filter then
@@ -76,21 +86,14 @@ function walk_pre_hooks(list, action)
local l = list.list
local f = nil
- local no_base_check = true
- if list == io_hooks or list == mem_hooks then
- no_base_check = false
- end
-
while l and not logged do
f = l.hook
- if no_base_check or action.addr >= f.base and action.addr < f.base + f.size then
- if f.enable and f.pre then
- if f.pre(f, action) then
- if not f.raw then
- action.logged_pre = f
- end
- logged = true
+ if list.match_filter(f, action) then
+ if f.pre and f.pre(f, action) then
+ if not f.raw then
+ action.logged_pre = f
end
+ logged = true
end
end
l = l.next
@@ -113,21 +116,14 @@ function walk_post_hooks(list, action)
local l = list.list
local f = nil
- local no_base_check = true
- if list == io_hooks or list == mem_hooks then
- no_base_check = false
- end
-
while l and not logged do
f = l.hook
- if no_base_check or action.addr >= f.base and action.addr < f.base + f.size then
- if f.enable and f.post then
- if f.post(f, action) then
- if not f.raw then
- action.logged_post = f
- end
- logged = false
+ if list.match_filter(f, action) then
+ if f.post and f.post(f, action) then
+ if not f.raw then
+ action.logged_post = f
end
+ logged = false
end
end
l = l.next
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2595
-gerrit
commit 32d7438bc4086c2a120b4b429a7e6c471d65072b
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Wed Mar 6 19:53:09 2013 +0200
Fix flag combinations
In some rare case writes go to both hardware and qemu,
so put those at different columns.
Only one of "Undefined, Dropped or Faked" is possible
at a time, place them on same column.
Change-Id: I9b891e44ca1f044c68c21021599fa3a0f8dbae9e
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
SerialICE/simba/output.lua | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/SerialICE/simba/output.lua b/SerialICE/simba/output.lua
index a01e074..10977ea 100644
--- a/SerialICE/simba/output.lua
+++ b/SerialICE/simba/output.lua
@@ -21,17 +21,17 @@ function printk(f, action, fmt, ...)
end
if action.to_hw then
str = str .. "H"
- elseif action.to_qemu then
- str = str .. "Q"
else
str = str .. "."
end
- if action.undefined then
- str = str .. "U"
+ if action.to_qemu then
+ str = str .. "Q"
else
str = str .. "."
end
- if action.dropped then
+ if action.undefined then
+ str = str .. "U"
+ elseif action.dropped then
str = str .. "D"
elseif action.faked then
str = str .. "F"
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2596
-gerrit
commit abf616c01e81c21084fe7112cd6a4f1545b6c268
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Wed Mar 6 20:00:11 2013 +0200
Fix variable MTRR filter
Separate this from the MSR fallback filter.
This filter is not enabled by default and was actually
broken because it did not check correctly for the MSR index.
Change-Id: I83caabe38070bf45a534585f1243bc2fe9f0c724
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
SerialICE/simba/cpu.lua | 32 ++++++++++++++++++++++++++++----
1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/SerialICE/simba/cpu.lua b/SerialICE/simba/cpu.lua
index 22ccb33..6dad741 100644
--- a/SerialICE/simba/cpu.lua
+++ b/SerialICE/simba/cpu.lua
@@ -2,11 +2,14 @@
-- CPU MSR filters
function var_mtrr_post(f, action)
-
local addr = action.rin.ecx
local hi = action.rin.edx
local lo = action.rin.eax
+ if not action.write then
+ return true
+ end
+
if addr % 2 == 0 then
mt = lo % 0x100
if mt == 0 then memtype = "Uncacheable"
@@ -25,8 +28,32 @@ function var_mtrr_post(f, action)
end
printk(f, action, "Set MTRR %x mask to %08x.%08x (%s)\n", (addr - 0x200) / 2, hi, bit32.band(lo, 0xfffff000), valid)
end
+ return true
+end
+
+function mtrr_pre(f, action)
+ local addr = action.rin.ecx
+ if addr >= 0x200 and addr < 0x210 then
+ return handle_action(f, action)
+ end
+ return false
end
+function mtrr_post(f, action)
+ local addr = action.rin.ecx
+ if addr >= 0x200 and addr < 0x210 then
+ return var_mtrr_post(f, action)
+ end
+ return false
+end
+
+filter_mtrr = {
+ name = "MTRR",
+ pre = mtrr_pre,
+ post = mtrr_post,
+ hide = true,
+}
+
function cpumsr_pre(f, action)
return handle_action(f, action)
end
@@ -35,9 +62,6 @@ function cpumsr_post(f, action)
if action.write then
printk(f, action, "[%08x] <= %08x.%08x\n",
action.rin.ecx, action.rin.edx, action.rin.eax)
- if action.addr >= 0x200 and action.addr < 0x210 then
- var_mtrr_post(f, action)
- end
else
printk(f, action, "[%08x] => %08x.%08x\n",
action.rin.ecx, action.rout.edx, action.rout.eax)
Kyösti Mälkki (kyosti.malkki(a)gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2580
-gerrit
commit 25cea143bd7c0ea477f115e51dfa319dde02d40d
Author: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
Date: Mon Mar 4 10:17:37 2013 +0200
Do not add RAM filters on default_setup()
To forward JEDEC init cycles to dram memory banks, using the
memory fallback -filter, we must not enable RAM filters
already at start-up.
A mainboard-specific hook shall call enable_ram() only after
raminit and possible quick memtest have completed.
Change-Id: I9b3c0283fd4dd15b4d12e96e02e70d8ccc77f835
Signed-off-by: Kyösti Mälkki <kyosti.malkki(a)gmail.com>
---
SerialICE/simba/memory.lua | 49 ++++++++++++-------------------------------
SerialICE/simba/serialice.lua | 1 -
2 files changed, 13 insertions(+), 37 deletions(-)
diff --git a/SerialICE/simba/memory.lua b/SerialICE/simba/memory.lua
index 4e60bad..b05f09c 100644
--- a/SerialICE/simba/memory.lua
+++ b/SerialICE/simba/memory.lua
@@ -13,12 +13,7 @@ function mem_qemu_rom_pre(f, action)
end
function mem_rom_post(f, action)
- if not action.write then
- return true
- end
- -- Writes to ROM space fall-thru to the fallback filter,
- -- so they get logged there.
- return false
+ return true
end
filter_rom_low = {
@@ -81,21 +76,15 @@ end
ram_is_initialized = false
--- This is handled by SerialICE but *NOT* exclusively.
--- Writes end up in Qemu memory, too
-function mem_ram_low(f, action)
- if ram_is_initialized then
- -- RAM init is done. Send all RAM accesses
- -- to Qemu. Using the target as storage would
- -- only slow execution down.
- action.to_hw = false
- action.to_qemu = true
- else
- -- RAM init has not been marked done yet.
- -- so send reads to the target only.
- action.to_hw = true
- action.to_qemu = action.write
- end
+function mem_qemu_only(f, action)
+ action.to_hw = false
+ action.to_qemu = true
+ return true
+end
+
+function mem_target_only(f, action)
+ action.to_hw = true
+ action.to_qemu = false
return true
end
@@ -113,14 +102,10 @@ function mem_smi_vga(f, action)
end
-function mem_post_pre_ram_only(f, action)
- return ram_is_initialized
-end
-
filter_ram_low = {
name = "MEM",
pre = mem_ram_low,
- post = mem_post_pre_ram_only,
+ post = mem_post,
hide = true,
base = 0x0,
size = 0xa0000
@@ -138,19 +123,12 @@ filter_smi_vga = {
filter_ram_low_2 = {
name = "MEM",
pre = mem_ram_low,
- post = mem_post_pre_ram_only,
+ post = mem_post,
hide = true,
base = 0xc0000,
size = 0x20000
}
-
-function mem_target_only(f, action)
- action.to_hw = true
- action.to_qemu = false
- return true
-end
-
-- 3.25GB RAM. This is handled by SerialICE.
-- FIXME: use TOLM here
@@ -160,7 +138,7 @@ end
filter_ram_high = {
name = "MEM",
pre = mem_target_only,
- post = mem_post_pre_ram_only,
+ post = mem_post,
hide = true,
base = 0x100000,
size = 0xd0000000 - 0x100000
@@ -172,7 +150,6 @@ function ram_enabled()
end
function enable_ram()
-
enable_hook(mem_hooks, filter_ram_low)
enable_hook(mem_hooks, filter_smi_vga)
enable_hook(mem_hooks, filter_ram_low_2)
diff --git a/SerialICE/simba/serialice.lua b/SerialICE/simba/serialice.lua
index 82a2b03..7cabf67 100644
--- a/SerialICE/simba/serialice.lua
+++ b/SerialICE/simba/serialice.lua
@@ -78,7 +78,6 @@ function do_minimal_setup()
end
function do_default_setup()
- enable_ram()
enable_hook(mem_hooks, filter_lapic)
enable_hook(mem_hooks, filter_ioapic)
enable_hook(io_hooks, filter_pci_io_cfg)