summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.mk57
-rw-r--r--makefile44
-rwxr-xr-xsrc/build/debug/Hostboot/Errl.pm45
-rwxr-xr-xsrc/build/debug/Hostboot/Gcov.pm193
-rwxr-xr-xsrc/build/debug/Hostboot/_DebugFrameworkVMM.pm33
-rwxr-xr-xsrc/build/debug/hb-dump-debug101
-rwxr-xr-xsrc/build/debug/simics-debug-framework.pl126
-rwxr-xr-xsrc/build/debug/simics-debug-framework.py14
-rwxr-xr-xsrc/build/vpo/hb-virtdebug.pl39
-rw-r--r--src/include/ctype.h46
-rw-r--r--src/include/math.h46
-rw-r--r--src/include/stdlib.h48
-rwxr-xr-xsrc/include/string.h55
-rw-r--r--src/include/usr/gcov.h141
-rw-r--r--src/include/usr/pnor/pnorif.H49
-rw-r--r--src/include/util/locked/pqueue.H107
-rwxr-xr-xsrc/libc++/builtins.C56
-rw-r--r--src/makefile29
-rw-r--r--src/usr/errl/errlmanager.C16
-rw-r--r--src/usr/initservice/extinitsvc/extinitsvctasks.H66
-rw-r--r--src/usr/makefile2
-rw-r--r--src/usr/pnor/pnordd.H19
22 files changed, 878 insertions, 454 deletions
diff --git a/config.mk b/config.mk
index c34a8e89b..19194cc25 100644
--- a/config.mk
+++ b/config.mk
@@ -1,24 +1,24 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: config.mk $
-#
-# IBM CONFIDENTIAL
-#
-# COPYRIGHT International Business Machines Corp. 2010,2012
-#
-# p1
-#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
-#
-# The source code for this program is not published or otherwise
-# divested of its trade secrets, irrespective of what has been
-# deposited with the U.S. Copyright Office.
-#
-# Origin: 30
-#
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: config.mk $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2010,2012
+#
+# p1
+#
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
+#
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
# IBM_PROLOG_END_TAG
all:
${MAKE} gen_pass
@@ -39,9 +39,11 @@ ifdef STRICT
EXTRACOMMONFLAGS += -Weffc++
endif
CUSTOMFLAGS += -D__HOSTBOOT_MODULE=${MODULE}
+ifndef TESTS
ifdef HOSTBOOT_PROFILE
vpath %.C ${ROOTPATH}/src/sys/prof
-OBJS += gcov.o
+OBJS := gcov.o ${OBJS}
+endif
endif
LIBS += $(addsuffix .so, $(addprefix lib, ${MODULE}))
MODULE_INIT = ${ROOTPATH}/obj/core/module_init.o
@@ -77,9 +79,13 @@ endif
endif
endif
+ifndef TESTS
ifdef HOSTBOOT_PROFILE
+ifndef HOSTBOOT_PROFILE_NO_INSTRUMENT
CUSTOMFLAGS += --coverage
endif
+endif
+endif
TRACEPP = ${ROOTPATH}/src/build/trace/tracepp
CUSTOM_LINKER_EXE = ${ROOTPATH}/src/build/linker/linker
@@ -109,7 +115,12 @@ BEAMFLAGS = \
--beam::exit0 \
-o /dev/null
-COMMONFLAGS = -O3 -nostdlib ${EXTRACOMMONFLAGS}
+ifdef HOSTBOOT_PROFILE
+COMMONFLAGS = -Os
+else
+COMMONFLAGS = -O3
+endif
+COMMONFLAGS += -nostdlib ${EXTRACOMMONFLAGS}
CFLAGS = ${COMMONFLAGS} -mcpu=power7 -nostdinc -g -mno-vsx -mno-altivec\
-Wall -Werror -mtraceback=no ${CUSTOMFLAGS}
ASMFLAGS = ${COMMONFLAGS} -mcpu=power7
diff --git a/makefile b/makefile
index 7881d08c5..618d0f585 100644
--- a/makefile
+++ b/makefile
@@ -1,24 +1,24 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: makefile $
-#
-# IBM CONFIDENTIAL
-#
-# COPYRIGHT International Business Machines Corp. 2010,2012
-#
-# p1
-#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
-#
-# The source code for this program is not published or otherwise
-# divested of its trade secrets, irrespective of what has been
-# deposited with the U.S. Copyright Office.
-#
-# Origin: 30
-#
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: makefile $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2010,2012
+#
+# p1
+#
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
+#
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
# IBM_PROLOG_END_TAG
SUBDIRS = src.d
ROOTPATH = .
@@ -39,5 +39,5 @@ gcov:
make gcov_pass
find obj/gcov/ -size 0c | xargs rm # Delete empty files.
genhtml obj/gcov/*.lcov -o obj/gcov/html
- echo "View GCOV results with: firefox obj/gcov/html/index.html"
+ @echo "View GCOV results with: firefox obj/gcov/html/index.html"
diff --git a/src/build/debug/Hostboot/Errl.pm b/src/build/debug/Hostboot/Errl.pm
index ca4564d24..46d510b5a 100755
--- a/src/build/debug/Hostboot/Errl.pm
+++ b/src/build/debug/Hostboot/Errl.pm
@@ -1,26 +1,26 @@
#!/usr/bin/perl
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/build/debug/Hostboot/Errl.pm $
-#
-# IBM CONFIDENTIAL
-#
-# COPYRIGHT International Business Machines Corp. 2011
-#
-# p1
-#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
-#
-# The source code for this program is not published or other-
-# wise divested of its trade secrets, irrespective of what has
-# been deposited with the U.S. Copyright Office.
-#
-# Origin: 30
-#
-# IBM_PROLOG_END
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/debug/Hostboot/Errl.pm $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2011,2012
+#
+# p1
+#
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
+#
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
+# IBM_PROLOG_END_TAG
use strict;
use File::Temp;
@@ -83,6 +83,7 @@ sub main
::userDisplay "Couldn't find symbol ERRORLOG::g_ErrlStorage\n";
die;
}
+ $symAddr = ::read64($symAddr); # Dereference g_ErrlStorage pointer.
# Size of buffer resides at offset zero of buffer for length of 4
my $errlSize;
diff --git a/src/build/debug/Hostboot/Gcov.pm b/src/build/debug/Hostboot/Gcov.pm
index 73325f58c..0ebfaaef3 100755
--- a/src/build/debug/Hostboot/Gcov.pm
+++ b/src/build/debug/Hostboot/Gcov.pm
@@ -26,6 +26,8 @@ use File::Path;
use File::Basename;
package Hostboot::Gcov;
+use Hostboot::_DebugFrameworkVMM qw(NotFound NotPresent getPhysicalAddr);
+
use Exporter;
our @EXPORT_OK = ('main');
@@ -170,12 +172,16 @@ sub parseModuleGcov
userDebug("\tFound info at 0x" . (sprintf "%x", $gcov_info) . "\n");
- # TODO: We don't support extended image modules yet because the VMM
- # debug tools don't exist yet.
- if ($gcov_info > GCOV_EXTENDED_IMAGE_ADDRESS)
+ # Translate gcov_info chain to a physical address if in a module.
+ if (isVirtualAddress($gcov_info))
{
- ::userDisplay "\tUnable to parse extended image modules. Skipped.\n";
- return;
+ $gcov_info = getPhysicalAddr($gcov_info);
+
+ if (($gcov_info eq NotFound) || ($gcov_info eq NotPresent))
+ {
+ ::userDisplay "\tModule data is not present.\n";
+ return;
+ }
}
# Check that we found the gcov_info chain.
@@ -186,7 +192,7 @@ sub parseModuleGcov
}
# Parse info chain.
- parseGcovInfo(::read64($gcov_info));
+ parseGcovInfo(read64($gcov_info));
}
sub parseGcovInfo
@@ -194,19 +200,19 @@ sub parseGcovInfo
my $info_ptr = shift;
return if (0 eq $info_ptr);
- my $filename = ::readStr(::read64($info_ptr + GCOV_INFO_FILENAME_OFFSET));
+ my $filename = readStr(read64($info_ptr + GCOV_INFO_FILENAME_OFFSET));
userDebug("\tFile = ".$filename."\n");
- my $version = ::read32($info_ptr + GCOV_INFO_VERSION_OFFSET);
- my $stamp = ::read32($info_ptr + GCOV_INFO_TIMESTAMP_OFFSET);
+ my $version = read32($info_ptr + GCOV_INFO_VERSION_OFFSET);
+ my $stamp = read32($info_ptr + GCOV_INFO_TIMESTAMP_OFFSET);
- my $func_count = ::read32($info_ptr + GCOV_INFO_NFUNCTIONS_OFFSET);
+ my $func_count = read32($info_ptr + GCOV_INFO_NFUNCTIONS_OFFSET);
userDebug("\tFunction Count = ".$func_count."\n");
- my $funcs = ::read64($info_ptr + GCOV_INFO_FUNCTIONS_OFFSET);
+ my $funcs = read64($info_ptr + GCOV_INFO_FUNCTIONS_OFFSET);
userDebug("\tFunc Address = ".(sprintf "%x", $funcs)."\n");
- my $ctrmask = ::read32($info_ptr + GCOV_INFO_CTRMASK_OFFSET);
+ my $ctrmask = read32($info_ptr + GCOV_INFO_CTRMASK_OFFSET);
if ($ctrmask % 2) # Check that COUNTER_ARCS is turned on.
{
# COUNTER_ARCS is on. Create file, find arc-values array,
@@ -214,7 +220,7 @@ sub parseGcovInfo
my $fd = createGcovFile($filename, $version, $stamp);
- my $arcs_ptr = ::read64($info_ptr + GCOV_INFO_COUNTS_OFFSET +
+ my $arcs_ptr = read64($info_ptr + GCOV_INFO_COUNTS_OFFSET +
GCOV_CTRINFO_VALUEPTR_OFFSET);
parseGcovFuncs($fd, $funcs, $func_count, $ctrmask, $arcs_ptr);
@@ -226,7 +232,7 @@ sub parseGcovInfo
}
# Look for next .o in gcov_info chain, parse.
- my $next = ::read64($info_ptr + GCOV_INFO_NEXT_OFFSET);
+ my $next = read64($info_ptr + GCOV_INFO_NEXT_OFFSET);
parseGcovInfo($next);
}
@@ -270,8 +276,8 @@ sub parseGcovFuncs
for(my $function = 0; $function < $func_count; $function++)
{
my $func_off = ($func_ptr + $func_size * $function);
- my $ident = ::read32($func_off + GCOV_FNINFO_IDENT_OFFSET);
- my $chksum = ::read32($func_off + GCOV_FNINFO_CHECKSUM_OFFSET);
+ my $ident = read32($func_off + GCOV_FNINFO_IDENT_OFFSET);
+ my $chksum = read32($func_off + GCOV_FNINFO_CHECKSUM_OFFSET);
userDebug("Ident = ".(sprintf "%x", $ident)."\n");
userDebug("Chksum = ".(sprintf "%x", $chksum)."\n");
@@ -281,16 +287,21 @@ sub parseGcovFuncs
print $fd pack('l', $ident); # Write ident.
print $fd pack('l', $chksum); # Write checksum.
- my $nctr_val = ::read32($func_off + GCOV_FNINFO_NCTRS_OFFSET);
+ my $nctr_val = read32($func_off + GCOV_FNINFO_NCTRS_OFFSET);
userDebug("N-Counters = ".$nctr_val."\n");
print $fd pack('l', GCOV_COUNTERS_TAG); # Write counter tag.
print $fd pack('l', $nctr_val * 2); # Write counter length.
# Read each counter value, output.
+ # Read as one big block for performance reasons.
+ my $counters = readData($val_ptr + 8*($fn_offset), 8 * $nctr_val);
for(my $v_idx = 0; $v_idx < $nctr_val; $v_idx++)
{
- my $val = ::read64($val_ptr + 8*($fn_offset + $v_idx));
+ my $val = substr $counters, 0, 8;
+ $counters = substr $counters, 8;
+ if (::littleendian()) { $val = reverse($val); }
+ $val = unpack("Q", $val);
userDebug("\tValue[$v_idx] = ".$val."\n");
print $fd pack('l', $val & 0xFFFFFFFF); # Write lower word.
@@ -356,6 +367,152 @@ sub getModules
return @result;
}
+# Determine if an address is virtual.
+sub isVirtualAddress
+{
+ my $addr = shift;
+
+ return ($addr >= GCOV_EXTENDED_IMAGE_ADDRESS);
+}
+
+# Utility to read a block of data from eithr memory or using the extended
+# image file as a fallback if not present in memory.
+use constant PAGESIZE => 4096;
+sub readData
+{
+ my $addr = shift;
+ my $size = shift;
+
+ if (isVirtualAddress($addr))
+ {
+ my $result = "";
+
+ while($size)
+ {
+ my $amount = $size;
+
+ if ((($addr % PAGESIZE) + $size) >= PAGESIZE)
+ {
+ $amount = PAGESIZE - ($addr % PAGESIZE);
+ }
+
+ my $paddr = getPhysicalAddr($addr);
+ if ((NotFound eq $paddr) || (NotPresent eq $paddr))
+ {
+ $paddr = $addr - GCOV_EXTENDED_IMAGE_ADDRESS;
+ $result = $result.::readExtImage($paddr, $amount);
+ }
+ else
+ {
+ $result = $result.::readData($paddr, $amount);
+ }
+
+ $size = $size - $amount;
+ }
+
+ return $result;
+ }
+
+ return ::readData($addr, $size);
+}
+
+# Utility to read 64 bits from either memory or using the extended image file
+# as a fallback if not present in memory.
+sub read64
+{
+ my $addr = shift;
+ my $old_addr = $addr;
+ if (isVirtualAddress($addr))
+ {
+ $addr = getPhysicalAddr($addr);
+ if ((NotFound eq $addr) || (NotPresent eq $addr))
+ {
+ $addr = $old_addr - GCOV_EXTENDED_IMAGE_ADDRESS;
+ my $result = ::readExtImage($addr, 8);
+ if (::littleendian()) { $result = reverse($result); }
+ return unpack("Q", $result);
+ }
+ }
+
+ return ::read64($addr);
+}
+
+# Utility to read 32 bits from either memory or using the extended image file
+# as a fallback if not present in memory.
+sub read32
+{
+ my $addr = shift;
+ my $old_addr = $addr;
+ if (isVirtualAddress($addr))
+ {
+ $addr = getPhysicalAddr($addr);
+ if ((NotFound eq $addr) || (NotPresent eq $addr))
+ {
+ $addr = $old_addr - GCOV_EXTENDED_IMAGE_ADDRESS;
+ my $result = ::readExtImage($addr, 4);
+ if (::littleendian()) { $result = reverse($result); }
+ return unpack("L", $result);
+ }
+ }
+
+ return ::read32($addr);
+}
+
+# Utility to read 8 bits from either memory or using the extended image file
+# as a fallback if not present in memory.
+sub read8
+{
+ my $addr = shift;
+ my $old_addr = $addr;
+ if (isVirtualAddress($addr))
+ {
+ $addr = getPhysicalAddr($addr);
+ if ((NotFound eq $addr) || (NotPresent eq $addr))
+ {
+ $addr = $old_addr - GCOV_EXTENDED_IMAGE_ADDRESS;
+ my $result = ::readExtImage($addr, 1);
+ return unpack("C", $result);
+ }
+ }
+
+ return ::read8($addr);
+}
+
+# Utility to read a string from either memory or using the extended image file
+# as a fallback if not present in memory.
+sub readStr
+{
+ my $addr = shift;
+ my $old_addr = $addr;
+ if (isVirtualAddress($addr))
+ {
+ $addr = $addr - GCOV_EXTENDED_IMAGE_ADDRESS;
+
+ # Virtual address, so need to read 1 byte at a time from the file.
+ my $string = "";
+ my $byte = 0;
+
+ do
+ {
+ $byte = ::readExtImage($addr,1);
+ $addr = $addr + 1;
+
+ if (unpack("C",$byte) eq 0)
+ {
+ return $string;
+ }
+
+ $string = $string.$byte;
+
+ } while (1)
+ }
+ else
+ {
+ ::readStr($addr);
+ }
+}
+
+
sub userDebug
{
return if (!$debug_mode);
diff --git a/src/build/debug/Hostboot/_DebugFrameworkVMM.pm b/src/build/debug/Hostboot/_DebugFrameworkVMM.pm
index dc5cbfa59..7de8d548d 100755
--- a/src/build/debug/Hostboot/_DebugFrameworkVMM.pm
+++ b/src/build/debug/Hostboot/_DebugFrameworkVMM.pm
@@ -1,26 +1,26 @@
#!/usr/bin/perl
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
-#
+#
# $Source: src/build/debug/Hostboot/_DebugFrameworkVMM.pm $
-#
+#
# IBM CONFIDENTIAL
-#
+#
# COPYRIGHT International Business Machines Corp. 2011,2012
-#
+#
# p1
-#
+#
# Object Code Only (OCO) source materials
# Licensed Internal Code Source Materials
# IBM HostBoot Licensed Internal Code
-#
+#
# The source code for this program is not published or otherwise
# divested of its trade secrets, irrespective of what has been
# deposited with the U.S. Copyright Office.
-#
+#
# Origin: 30
-#
-# IBM_PROLOG_END_TAG
+#
+# IBM_PROLOG_END_TAG
# _DebugFrameworkVMM.pm
#
# This module is a set of utility functions for the debug framework, which
@@ -51,7 +51,6 @@ our @EXPORT = (
'printDeviceSegments'
);
-
use constant NotFound => 'not found';
use constant NotPresent => 'not present';
@@ -86,9 +85,9 @@ use constant BLOCK_SPTE_OFFSET => 32;
-our @EXPORT_OK = ('NotFound');
-our @EXPORT_OK = ('NotPresent');
-our @EXPORT_OK = ('SEGMGR_BASE_SEGMENT_OFFSET',
+our @EXPORT_OK = ('NotFound',
+ 'NotPresent',
+ 'SEGMGR_BASE_SEGMENT_OFFSET',
'SEGMGR_STACK_SEGMENT_OFFSET',
'SEGMGR_FIRSTDEVICE_SEGMENT_OFFSET',
'STACKSEGMENT_BASEADDR_OFFSET',
@@ -797,7 +796,7 @@ sub getNumPresentPages
while( $i<$pages)
{
- my $SPTE_entry = ::read32 ($SPTE_ptr + $i, 4);
+ my $SPTE_entry = ::read32 ($SPTE_ptr + (4*$i), 4);
# if found present
if ($SPTE_entry & 0x00000800)
@@ -823,7 +822,7 @@ sub getNumPresentPages
# their info.
# In addition each individual device segment could have
# up to 32 mmio devices populated so this routine will print
-# out those as well.
+# out those as well.
#
# @param Ptr to the Address of the First Device segment
# we need to work with from the segment manager
@@ -856,7 +855,7 @@ sub printDeviceSegments
DEVICESEGMENT_BASEADDR_OFFSET, 8);
# If the device segment is valid, then print out its info and
- # check for MMIO devices populated.
+ # check for MMIO devices populated.
if ($deviceSegmentPtr != 0)
{
#::userDisplay (sprintf " segmentbaseaddr: %X\n" , $segmentbaseaddr);
@@ -912,6 +911,6 @@ sub printDeviceSegments
}
-
+1;
__END__
diff --git a/src/build/debug/hb-dump-debug b/src/build/debug/hb-dump-debug
index 4cbf08c4e..1ae6a74d2 100755
--- a/src/build/debug/hb-dump-debug
+++ b/src/build/debug/hb-dump-debug
@@ -1,26 +1,26 @@
#!/usr/bin/perl
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/build/debug/hb-dump-debug $
-#
-# IBM CONFIDENTIAL
-#
-# COPYRIGHT International Business Machines Corp. 2011
-#
-# p1
-#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
-#
-# The source code for this program is not published or other-
-# wise divested of its trade secrets, irrespective of what has
-# been deposited with the U.S. Copyright Office.
-#
-# Origin: 30
-#
-# IBM_PROLOG_END
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/build/debug/hb-dump-debug $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2011,2012
+#
+# p1
+#
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
+#
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
+#
+# Origin: 30
+#
+# IBM_PROLOG_END_TAG
use strict;
@@ -141,7 +141,64 @@ sub getIsTest
return $testImage;
}
+# @sub getHRMOR
+#
+# Returns the HRMOR (0 for a dump file).
+#
+sub getHRMOR
+{
+ return 0;
+}
+# @sub readExtImage
+#
+# Reads from the extended image file.
+#
+# @param addr - Address to read.
+# @param size - Size to read.
+sub readExtImage
+{
+ my $addr = shift;
+ my $size = shift;
+
+ my $extImage = extImageFile();
+
+ seek $extImage, $addr, SEEK_SET;
+
+ my $result = "";
+ read $extImage, $result, $size;
+
+ return $result;
+}
+
+# @sub extImageFile
+#
+# Returns a file descriptor to the extended image file.
+#
+my $extImage = 0;
+sub extImageFile
+{
+ if ($extImage == 0)
+ {
+ my $path = determineImagePath(getImgPath());
+
+ if (getIsTest())
+ {
+ $path = $path . "hbicore_test_extended.bin";
+ }
+ else
+ {
+ $path = $path . "hbicore_extended.bin";
+ }
+
+ print $path."\n";
+
+ open($extImage, "< $path") or die "Cannot find extended image";
+ binmode($extImage);
+ }
+
+ return $extImage;
+}
__END__
diff --git a/src/build/debug/simics-debug-framework.pl b/src/build/debug/simics-debug-framework.pl
index c83ed905f..4699e3fb3 100755
--- a/src/build/debug/simics-debug-framework.pl
+++ b/src/build/debug/simics-debug-framework.pl
@@ -1,26 +1,26 @@
#!/usr/bin/perl
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
-#
+#
# $Source: src/build/debug/simics-debug-framework.pl $
-#
+#
# IBM CONFIDENTIAL
-#
+#
# COPYRIGHT International Business Machines Corp. 2011,2012
-#
+#
# p1
-#
+#
# Object Code Only (OCO) source materials
# Licensed Internal Code Source Materials
# IBM HostBoot Licensed Internal Code
-#
+#
# The source code for this program is not published or otherwise
# divested of its trade secrets, irrespective of what has been
# deposited with the U.S. Copyright Office.
-#
+#
# Origin: 30
-#
-# IBM_PROLOG_END_TAG
+#
+# IBM_PROLOG_END_TAG
# @file simics-debug-framework.pl
# @brief Implementation of the common debug framework for running in simics.
#
@@ -282,26 +282,101 @@ sub writeScom
return;
}
-
-##
-## Dummy module to match continuous trace call in VPO
-##
-sub checkContTrace()
+# @sub getHRMOR
+# @brief Retrieve the HRMOR value
+#
+my $cached_HRMOR = "";
+sub getHRMOR
{
+ if ($cached_HRMOR eq "")
+ {
+ sendIPCMsg("get-hrmor","");
+ my ($unused, $hrmor) = recvIPCMsg();
+ $cached_HRMOR = $hrmor;
+ return $hrmor;
+ }
+
+ return $cached_HRMOR;
}
-##
-## Retrieve the HRMOR value
-##
-sub getHRMOR()
+use constant PNOR_MODE_UNKNOWN => 0;
+use constant PNOR_MODE_MEMCPY => PNOR_MODE_UNKNOWN + 1;
+use constant PNOR_MODE_LPC_MEM => PNOR_MODE_MEMCPY + 1;
+use constant PNOR_MODE_REAL_CMD => PNOR_MODE_LPC_MEM + 1;
+use constant PNOR_MODE_REAL_MMIO => PNOR_MODE_REAL_CMD + 1;
+my $extImageMode = PNOR_MODE_UNKNOWN;
+my $extImageOffset = 0;
+
+use constant PNOR_DD_MODE_OFFSET => 8;
+use constant PNOR_DD_FAKESTART_OFFSET => PNOR_DD_MODE_OFFSET + 16;
+
+use constant PNOR_RP_HBEXT_SECTION => 1;
+use constant PNOR_RP_SECTIONDATA_SIZE => 3 * 8 + 2;
+use constant PNOR_RP_SECTIONDATA_FLASHADDR_OFFSET => 2 * 8;
+
+sub determineExtImageInfo
+{
+ my ($pnorDDAddr, $pnorDDSize) =
+ ::findSymbolAddress("Singleton<PnorDD>::instance()::instance");
+
+ $extImageMode = read32($pnorDDAddr + PNOR_DD_MODE_OFFSET);
+ if ((PNOR_MODE_MEMCPY == $extImageMode) ||
+ (PNOR_MODE_LPC_MEM == $extImageMode))
+ {
+ $extImageOffset = read32($pnorDDAddr + PNOR_DD_FAKESTART_OFFSET);
+ }
+
+ my ($pnorRPAddr, $pnorRPSize) =
+ ::findSymbolAddress("Singleton<PnorRP>::instance()::instance");
+
+ $extImageOffset +=
+ read32($pnorRPAddr +
+ (PNOR_RP_SECTIONDATA_SIZE * PNOR_RP_HBEXT_SECTION) +
+ PNOR_RP_SECTIONDATA_FLASHADDR_OFFSET);
+}
+
+# @sub readExtImage
+#
+# Reads from the extended image file.
+#
+# @param addr - Address to read.
+# @param size - Size to read.
+sub readExtImage
{
- sendIPCMsg("get-hrmor","");
- my ($unused, $hrmor) = recvIPCMsg();
- return $hrmor;
+ my $addr = shift;
+ my $size = shift;
+
+ if ($extImageMode == PNOR_MODE_UNKNOWN) { determineExtImageInfo(); }
+
+ if ((PNOR_MODE_MEMCPY == $extImageMode) ||
+ (PNOR_MODE_LPC_MEM == $extImageMode))
+ {
+ $addr += getHRMOR() + $extImageOffset;
+ return readData($addr, $size);
+ }
+ else
+ {
+ $addr += $extImageOffset;
+ sendIPCMsg("read-pnor", "$addr,$size");
+
+ my ($type, $data) = recvIPCMsg();
+
+ if (length($data) == $size)
+ {
+ return $data;
+ }
+ }
+ return "";
+
}
+
+
+
+
+
# Get tool name.
sendIPCMsg("get-tool","");
my ($unused, $tool) = recvIPCMsg();
@@ -326,3 +401,12 @@ parseToolOpts($toolOpts);
# Execute module.
callToolModule($tool);
+
+##
+## Dummy function to match continuous trace call in VPO
+##
+sub checkContTrace
+{
+
+}
+
diff --git a/src/build/debug/simics-debug-framework.py b/src/build/debug/simics-debug-framework.py
index 0824839e0..b7536eea7 100755
--- a/src/build/debug/simics-debug-framework.py
+++ b/src/build/debug/simics-debug-framework.py
@@ -169,6 +169,19 @@ class DebugFrameworkProcess:
conf.system_cmp0.phys_mem.memory[[addr, addr+size-1]] = data;
+ # Read data from PNOR.
+ # This message has data of the format "0dADDRESS,0dSIZE".
+ def read_pnor(self,data):
+ pattern = re.compile("([0-9]+),([0-9]+)")
+ match = pattern.search(data)
+
+ addr = int(match.group(1))
+ size = int(match.group(2))
+
+ data = "".join(map(chr,
+ conf.fpga0.sfc_master_mem.memory[[addr , addr+size-1]]))
+ self.sendMsg("data-response", data)
+
# Clock forward the model.
# This message had data of the format "0dCYCLES".
def execute_instrs(self,data):
@@ -260,6 +273,7 @@ def run_hb_debug_framework(tool = "Printk", toolOpts = "",
operations = { "display" : DebugFrameworkProcess.display,
"read-data" : DebugFrameworkProcess.read_data,
"write-data" : DebugFrameworkProcess.write_data,
+ "read-pnor" : DebugFrameworkProcess.read_pnor,
"execute-instrs" : DebugFrameworkProcess.execute_instrs,
"ready-for-instr" : DebugFrameworkProcess.ready_for_instr,
"get-tool" : DebugFrameworkProcess.get_tool,
diff --git a/src/build/vpo/hb-virtdebug.pl b/src/build/vpo/hb-virtdebug.pl
index d74f61cb6..d9bc88cfe 100755
--- a/src/build/vpo/hb-virtdebug.pl
+++ b/src/build/vpo/hb-virtdebug.pl
@@ -1,26 +1,26 @@
#!/usr/bin/perl
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/build/vpo/hb-virtdebug.pl $
+# $Source: src/build/vpo/hb-virtdebug.pl $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011-2012
+# COPYRIGHT International Business Machines Corp. 2011,2012
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
#
-# The source code for this program is not published or other-
-# wise divested of its trade secrets, irrespective of what has
-# been deposited with the U.S. Copyright Office.
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
#
-# Origin: 30
+# Origin: 30
#
-# IBM_PROLOG_END_TAG
+# IBM_PROLOG_END_TAG
#
# Purpose: This perl script works on VBU and will dump either the entire L3 or
# relevant data such as the code version, kernel printk buffer & component traces.
@@ -419,15 +419,15 @@ if ($dumpTrace)
print "$command\n";
die if (system("$command") != 0);
- # Get the length of the buffer from the component trace header
- $buffer = readBinFile( "$outDir/trace.out",
- $offset+TRAC_BUFFER_SIZE_OFFSET,
+ # Get the length of the buffer from the component trace header
+ $buffer = readBinFile( "$outDir/trace.out",
+ $offset+TRAC_BUFFER_SIZE_OFFSET,
TRAC_BUFFER_SIZE_SIZE );
my $compBufferSize=unpack('H*',$buffer);
$compBufferSize = hex $compBufferSize;
- # Re-read trace buffer using correct buffer size
+ # Re-read trace buffer using correct buffer size
$offset = $compBufAddr % CACHE_LINE_SIZE;
$cacheLines = ceil( $compBufferSize / CACHE_LINE_SIZE);
if ($offset != 0)
@@ -494,11 +494,12 @@ if ($dumpTrace)
#------------------------------------------------------------------------------
-# Dump the error logs
+# Dump the error logs
#------------------------------------------------------------------------------
if ($dumpErrl)
{
#Find address and size of the g_ErrlStorage from the .syms file
+ #TODO: This is broken - Expect all this to disappear with Story 47517
$string = 'g_ErrlStorage';
($addr, $size) = getAddrNSize($string, \@symsLines);
diff --git a/src/include/ctype.h b/src/include/ctype.h
index 46e89c2ab..6970da734 100644
--- a/src/include/ctype.h
+++ b/src/include/ctype.h
@@ -1,25 +1,25 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/ctype.h $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2011
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/ctype.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
#ifndef __CTYPE_H
#define __CTYPE_H
@@ -36,7 +36,7 @@ extern "C"
* @param[in] Input letter
* @return int. Uppercase letter
*/
-int toupper(int);
+int toupper(int) __attribute__((const));
#ifdef __cplusplus
};
diff --git a/src/include/math.h b/src/include/math.h
index 63584a26e..1d221cd96 100644
--- a/src/include/math.h
+++ b/src/include/math.h
@@ -1,25 +1,25 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/math.h $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2011
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/math.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
#include <stdint.h>
#include <builtins.h>
@@ -38,7 +38,7 @@ static inline int64_t log2(uint64_t s)
return 63-n;
}
-double sqrt(double);
+double sqrt(double) __attribute__((const));
#ifdef __cplusplus
};
diff --git a/src/include/stdlib.h b/src/include/stdlib.h
index ef2859de5..36d2c147c 100644
--- a/src/include/stdlib.h
+++ b/src/include/stdlib.h
@@ -1,25 +1,25 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/stdlib.h $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2010 - 2011
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/stdlib.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2010,2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
#ifndef __STDLIB_H
#define __STDLIB_H
@@ -30,10 +30,10 @@ extern "C"
{
#endif
-void* malloc(size_t);
+void* malloc(size_t) __attribute__((malloc));
void free(void*);
void* realloc(void*, size_t);
-void* calloc(size_t, size_t);
+void* calloc(size_t, size_t) __attribute__((malloc));
#ifdef __cplusplus
};
diff --git a/src/include/string.h b/src/include/string.h
index 50acecac1..62e6107d7 100755
--- a/src/include/string.h
+++ b/src/include/string.h
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/include/string.h $
- *
- * IBM CONFIDENTIAL
- *
- * COPYRIGHT International Business Machines Corp. 2010-2012
- *
- * p1
- *
- * Object Code Only (OCO) source materials
- * Licensed Internal Code Source Materials
- * IBM HostBoot Licensed Internal Code
- *
- * The source code for this program is not published or other-
- * wise divested of its trade secrets, irrespective of what has
- * been deposited with the U.S. Copyright Office.
- *
- * Origin: 30
- *
- * IBM_PROLOG_END_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/string.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2010,2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
#ifndef __STRING_H
#define __STRING_H
@@ -34,18 +33,18 @@ extern "C"
void bzero(void *vdest, size_t len);
void *memcpy(void *dest, const void *src, size_t num);
void *memmove(void *vdest, const void *vsrc, size_t len);
- int memcmp(const void *p1, const void *p2, size_t len);
+ int memcmp(const void *p1, const void *p2, size_t len) __attribute__((pure));
void *memmem(const void *haystack, size_t haystacklen,
- const void *needle, size_t needlelen);
+ const void *needle, size_t needlelen) __attribute__((pure));
char* strcpy(char* d, const char* s);
- int strcmp(const char* s1, const char* s2);
- size_t strlen(const char* s1);
+ int strcmp(const char* s1, const char* s2) __attribute__((pure));
+ size_t strlen(const char* s1) __attribute__((pure));
char* strcat(char* d, const char* s);
char* strncat(char* d, const char* s, size_t n);
- char* strchr(const char* s, int c);
+ char* strchr(const char* s, int c) __attribute__((pure));
#ifdef __cplusplus
};
diff --git a/src/include/usr/gcov.h b/src/include/usr/gcov.h
index dd249e1d5..a8e20f4fc 100644
--- a/src/include/usr/gcov.h
+++ b/src/include/usr/gcov.h
@@ -1,25 +1,25 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/usr/gcov.h $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2012
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/gcov.h $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
#ifndef __USR_GCOV_H
#define __USR_GCOV_H
@@ -37,31 +37,54 @@
*/
#include <stddef.h>
+#include <stdint.h>
+#include <string.h>
/** @struct gcov_info
* @brief Structure generated by gcc. Do not use.
*
* This structure is automatically generated and instances of it created by
* gcc when the --coverage compile option is used. We don't need to
- * manipulate this structure from code except to fix up the chains as objects
- * are added to the chain. The rest of this structure is parsed by the
- * Gcov.pm debug tool.
+ * manipulate this structure from code except:
+ * 1) To fix up the chains as objects are added to the chain.
+ * 2) To copy the gcov_info and counters into the base-chain when we
+ * unload a module.
+ *
+ * The rest of this structure is parsed by the Gcov.pm debug tool.
+ *
+ * Most of the items in here are used as uint32_t's by gcov but are still
+ * aligned on a 64-bit boundary. The unusedN fields are to ensure proper
+ * alignment.
*/
struct gcov_info
{
- unsigned int version; // Purposefully chose 'unsigned int' to match gcc.
+ uint32_t version;
+ uint32_t unused0;
gcov_info* next;
- // Really there is more after here in the structure, but this is all
- // we care about from an in-memory perspective.
-};
+ uint32_t timestamp;
+ uint32_t unused1;
+ char* filename;
+ uint32_t n_functions;
+ uint32_t unused2;
+ void* functions;
+ uint32_t counter_mask;
+ uint32_t unused3;
+ uint32_t n_counters;
+ uint32_t unused4;
+ uint64_t* counters;
+} PACKED;
// Preprocessor magic to create a variable name based off the module name.
// GCOV_INFO_OBJ() will create a post-processed name like
// 'foobar_gcov_info_head' or 'core_gcov_info_head'.
#ifdef __HOSTBOOT_MODULE
#define __GCOV_PREFIX __HOSTBOOT_MODULE
+ #define ___GCOV_STRINGIFY(X) #X
+ #define __GCOV_STRINGIFY(X) ___GCOV_STRINGIFY(X)
+ #define __GCOV_PREFIX_NAME __GCOV_STRINGIFY(__HOSTBOOT_MODULE)
#else
#define __GCOV_PREFIX core
+ #define __GCOV_PREFIX_NAME "core"
#endif
#define __GCOV_INFO_OBJ(X,Y) X ## Y
@@ -85,6 +108,66 @@ void __gcov_init(gcov_info* i_info)
i_info->next, i_info));
}
+// This ifdef has two pieces of code which are used in module unloading.
+//
+// In the modules themselves we have a function that is registered via atexit
+// to call to copy the contents of their own gcov_info chain into the base
+// gcov_info chain. This is required because the module's memory is going
+// away as it is unloaded.
+//
+// In the base code (non-modules) we have a single implementation of the
+// code for actually doing a copy of the gcov_info chain into the base code's
+// own chain. This is kept in just the base code for space savings.
+//
+#ifdef __HOSTBOOT_MODULE
+// Forward declaration of __gcov_module_copychain for modules.
+extern "C" void __gcov_module_copychain(gcov_info* chain);
+
+/** Function called by module unloading to move the module's gcov_info
+ * instances to the global chain.
+ */
+extern "C"
+void __gcov_module_unload(void* unused)
+{
+ __gcov_module_copychain(GCOV_INFO_OBJ());
+}
+ // Register __gcov_module_unload with __cxa_atexit.
+extern void* __dso_handle;
+extern "C" int __cxa_atexit(void(*)(void*),void*,void*);
+int __unused_gcov_cxa_register =
+ __cxa_atexit(&__gcov_module_unload, NULL, __dso_handle);
+#else
+/** Function called by a module being unloaded (via __gcov_module_unload) to
+ * copy the module's gcov_info chain into the base gcov_info chain.
+ */
+extern "C"
+void __gcov_module_copychain(gcov_info* chain)
+{
+ while(chain != NULL)
+ {
+ // Copy old info.
+ gcov_info* new_info = new gcov_info;
+ memcpy(new_info, chain, sizeof(gcov_info));
+
+ // Copy old counters.
+ uint64_t* new_counters = new uint64_t[chain->n_counters];
+ memcpy(new_counters, chain->counters,
+ chain->n_counters*sizeof(uint64_t));
+ new_info->counters = new_counters;
+
+ // Atomically push new_info onto the core_gcov_info_head stack.
+ do
+ {
+ new_info->next = GCOV_INFO_OBJ();
+ } while (!__sync_bool_compare_and_swap(&GCOV_INFO_OBJ(),
+ new_info->next, new_info));
+
+ // Advance to next info in this modules chain.
+ chain = chain->next;
+ }
+}
+#endif
+
/** Unneeded function but must be defined to compile.
*
* This function appears to be typically used by libgcov.so when instrumented
diff --git a/src/include/usr/pnor/pnorif.H b/src/include/usr/pnor/pnorif.H
index 35ef9bacb..055dadbb9 100644
--- a/src/include/usr/pnor/pnorif.H
+++ b/src/include/usr/pnor/pnorif.H
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/include/usr/pnor/pnorif.H $
- *
- * IBM CONFIDENTIAL
- *
- * COPYRIGHT International Business Machines Corp. 2011-2012
- *
- * p1
- *
- * Object Code Only (OCO) source materials
- * Licensed Internal Code Source Materials
- * IBM HostBoot Licensed Internal Code
- *
- * The source code for this program is not published or other-
- * wise divested of its trade secrets, irrespective of what has
- * been deposited with the U.S. Copyright Office.
- *
- * Origin: 30
- *
- * IBM_PROLOG_END_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/usr/pnor/pnorif.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
#ifndef __PNOR_PNORIF_H
#define __PNOR_PNORIF_H
@@ -37,12 +36,13 @@ namespace PNOR
enum SectionId
{
TOC, /**< Table of Contents */
+ // Value of HB_EXT_CODE must be 1 for debug framework.
HB_EXT_CODE, /**< Hostboot Extended Image */
HB_DATA, /**< Hostboot Data */
DIMM_JEDEC_VPD, /**< DIMM JEDEC VPD */
MODULE_VPD, /**< Module VPD */
HB_BASE_CODE, /**< Hostboot Base Image */
- TEST, /**< Scratch space for PNOR test cases */
+ TEST, /**< Scratch space for PNOR test cases */
NUM_SECTIONS, /**< Number of defined sections */
//Not currently used
@@ -70,6 +70,7 @@ enum SideSelect
/**
* Information about a section of PNOR
*/
+ // Size and layout of this structure must be maintained for debug framework.
struct SectionInfo_t
{
SectionId id; /**< Identifier for this section */
diff --git a/src/include/util/locked/pqueue.H b/src/include/util/locked/pqueue.H
index 2a6324fe6..4c21cd310 100644
--- a/src/include/util/locked/pqueue.H
+++ b/src/include/util/locked/pqueue.H
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/include/util/locked/pqueue.H $
- *
- * IBM CONFIDENTIAL
- *
- * COPYRIGHT International Business Machines Corp. 2010-2012
- *
- * p1
- *
- * Object Code Only (OCO) source materials
- * Licensed Internal Code Source Materials
- * IBM HostBoot Licensed Internal Code
- *
- * The source code for this program is not published or other-
- * wise divested of its trade secrets, irrespective of what has
- * been deposited with the U.S. Copyright Office.
- *
- * Origin: 30
- *
- * IBM_PROLOG_END_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/util/locked/pqueue.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2010,2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
#ifndef __UTIL_LOCKED_PQUEUE_H
#define __UTIL_LOCKED_PQUEUE_H
@@ -119,43 +118,45 @@ namespace Util
template <typename _T, typename _K, bool locked, typename _S>
void PQueue<_T,_K,locked,_S>::bubbleUp(_T* item)
{
- if (!item->next)
- return;
+ while(1)
+ {
- if (item->next->key <= item->key)
- return;
+ if (!item->next)
+ break;
- if (this->head == item)
- this->head = item->next;
- if (this->tail == item->next)
- this->tail = item;
+ if (item->next->key <= item->key)
+ break;
- _T* temp = item->next;
+ if (this->head == item)
+ this->head = item->next;
+ if (this->tail == item->next)
+ this->tail = item;
- if (temp->next)
- {
- temp->next->prev = item;
- item->next = item->next->next;
- }
- else
- {
- item->next = NULL;
- }
+ _T* temp = item->next;
- if (item->prev)
- {
- item->prev->next = temp;
- temp->prev = item->prev;
- }
- else
- {
- temp->prev = NULL;
- }
+ if (temp->next)
+ {
+ temp->next->prev = item;
+ item->next = item->next->next;
+ }
+ else
+ {
+ item->next = NULL;
+ }
- temp->next = item;
- item->prev = temp;
+ if (item->prev)
+ {
+ item->prev->next = temp;
+ temp->prev = item->prev;
+ }
+ else
+ {
+ temp->prev = NULL;
+ }
- bubbleUp(item);
+ temp->next = item;
+ item->prev = temp;
+ }
}
diff --git a/src/libc++/builtins.C b/src/libc++/builtins.C
index e65d1d967..7cef85485 100755
--- a/src/libc++/builtins.C
+++ b/src/libc++/builtins.C
@@ -1,30 +1,31 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/libc++/builtins.C $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2010 - 2011
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/libc++/builtins.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2010,2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
#include <stdint.h>
#include <stdlib.h>
#include <arch/ppc.H>
#include <util/locked/list.H>
+#include <sys/sync.h>
void* operator new(size_t s)
{
@@ -109,13 +110,13 @@ struct DtorEntry_t
key_type key;
void (*dtor)(void*);
void * arg;
- void * dso_handle;
DtorEntry_t * next;
DtorEntry_t * prev;
};
Util::Locked::List<DtorEntry_t, DtorEntry_t::key_type> g_dtorRegistry;
+mutex_t g_dtorLock = MUTEX_INITIALIZER;
/**
@@ -125,15 +126,17 @@ Util::Locked::List<DtorEntry_t, DtorEntry_t::key_type> g_dtorRegistry;
*/
void call_dtors(void * i_dso_handle)
{
+ mutex_lock(&g_dtorLock);
+
DtorEntry_t * entry = NULL;
- // A module is never exited by different threads so
- // assume no locking needed here.
while( NULL != (entry = g_dtorRegistry.find(i_dso_handle)) )
{
g_dtorRegistry.erase(entry); // remove from list
(*(entry->dtor))(entry->arg);
delete entry;
}
+
+ mutex_unlock(&g_dtorLock);
}
@@ -150,7 +153,10 @@ extern "C" int __cxa_atexit(void (*i_dtor)(void*),
entry->key = i_dso_handle;
entry->dtor = i_dtor;
entry->arg = i_arg;
+
+ mutex_lock(&g_dtorLock);
g_dtorRegistry.insert(entry);
+ mutex_unlock(&g_dtorLock);
}
return 0;
}
diff --git a/src/makefile b/src/makefile
index 4f46d8fa8..e11d441fe 100644
--- a/src/makefile
+++ b/src/makefile
@@ -46,18 +46,13 @@ DIRECT_BOOT_OBJECTS = start.o kernel.o taskmgr.o cpumgr.o syscall.o \
blockmsghdlr.o stacksegment.o softpatch_p7.o \
shutdown.o
-## STUB_TESTCASE_OBJECT = cxxtest_stub.o
-
-RUNTIME_OBJECTS =
-
-
BASE_MODULES = trace errl devicefw scom xscom initservice \
- pnor vfs scan
+ pnor vfs
EXTENDED_MODULES = targeting ecmddatabuffer fapi hwp plat \
- extinitsvc istepdisp hwas fsi fsiscom i2c intr \
- spd dmi_training fapiporeve poreve util \
- sbe_centaur_init mc_config dram_training \
+ extinitsvc istepdisp hwas fsi fsiscom i2c intr scan \
+ spd dmi_training fapiporeve poreve util \
+ sbe_centaur_init mc_config dram_training \
mdia mbox mvpd prdf bus_training \
activate_powerbus build_winkle_images \
core_activate dram_initialization edi_ei_initialization \
@@ -65,9 +60,6 @@ EXTENDED_MODULES = targeting ecmddatabuffer fapi hwp plat \
nest_chiplets start_payload thread_activate slave_sbe \
attn
-DIRECT_BOOT_MODULES = example
-RUNTIME_MODULES =
-
TESTCASE_MODULES = cxxtest testerrl testdevicefw testsyslib \
testscom testxscom testtargeting testinitservice testkernel \
testhwpf testecmddatabuffer initsvctesttask testcxxtest \
@@ -77,8 +69,8 @@ TESTCASE_MODULES = cxxtest testerrl testdevicefw testsyslib \
RELOCATABLE_IMAGE_LDFLAGS = -pie --export-dynamic
-hbicore_OBJECTS = ${BASE_OBJECTS} ${DIRECT_BOOT_OBJECTS} ${STUB_TESTCASE_OBJECT}
-hbicore_MODULES = ${BASE_MODULES} ${DIRECT_BOOT_MODULES}
+hbicore_OBJECTS = ${BASE_OBJECTS} ${DIRECT_BOOT_OBJECTS}
+hbicore_MODULES = ${BASE_MODULES}
hbicore_EXTENDED_MODULES = ${EXTENDED_MODULES}
#@todo - Temporary workaround
# The centaur.sbe_pnor.bin is manually built from CVS SBE procedure files in
@@ -91,16 +83,11 @@ hbicore_DATA_MODULES = sample.if p8.dmi.scom.if cen.dmi.scom.if \
hbicore_LIDNUMBER = 80f00100
-hbicore_test_OBJECTS = ${BASE_OBJECTS} ${DIRECT_BOOT_OBJECTS}
+hbicore_test_OBJECTS = ${hbicore_OBJECTS}
hbicore_test_MODULES = ${hbicore_MODULES}
hbicore_test_EXTENDED_MODULES = ${hbicore_EXTENDED_MODULES} ${TESTCASE_MODULES}
hbicore_test_DATA_MODULES = ${hbicore_DATA_MODULES} testdata
-#halruntime_OBJECTS = ${BASE_OBJECTS} ${RUNTIME_OBJECTS}
-#halruntime_MODULES = ${BASE_MODULES} ${EXTENDED_MODULES} ${RUNTIME_MODULES}
-#halruntime_LDFLAGS = ${RELOCATABLE_IMAGE_LDFLAGS}
-#halruntime_LIDNUMBER = 80f00101
-
dslid_LIDNUMBER = 80f001fe
IMAGE_EXTRA_TARGETS = buildpnor
@@ -108,4 +95,4 @@ IMAGE_EXTRA_TARGETS = buildpnor
include ${ROOTPATH}/config.mk
buildpnor: ${IMAGES}
- cd build/buildpnor/ && make buildpnor
+ cd build/buildpnor/ && ${MAKE} buildpnor
diff --git a/src/usr/errl/errlmanager.C b/src/usr/errl/errlmanager.C
index bc4e84c0b..132ec49c1 100644
--- a/src/usr/errl/errlmanager.C
+++ b/src/usr/errl/errlmanager.C
@@ -48,7 +48,7 @@ extern trace_desc_t* g_trac_errl;
// Scaffolding
// Store error logs in this memory buffer in L3 RAM.
-char g_ErrlStorage[ ERRL_STORAGE_SIZE ];
+char* g_ErrlStorage = new char[ ERRL_STORAGE_SIZE ];
/**
@@ -90,23 +90,19 @@ ErrlManager::ErrlManager()
// This buffer has a header (storage_header_t) followed by
// storage.
iv_pStorage = reinterpret_cast<storage_header_t*>(g_ErrlStorage);
-
- // g_ErrlStorage is in BSS segment, therefore already zeroed.
- // memset( iv_pStorage, 0, sizeof(storage_header_t));
+ memset( iv_pStorage, 0, sizeof(storage_header_t));
// Storage size is placed here for benefit of downstream parsers.
- iv_pStorage->cbStorage = sizeof( g_ErrlStorage );
+ iv_pStorage->cbStorage = ERRL_STORAGE_SIZE;
// Offsets are zero-based at &g_ErrlStorage[0],
// so the first usable offset is just past the header.
iv_pStorage->offsetMarker = sizeof(storage_header_t);
iv_pStorage->offsetStart = sizeof(storage_header_t);
- // g_ErrlStorage is in BSS segment, therefore already zeroed.
- // Thus, the prime marker in storage is already zero.
- // marker_t* l_pMarker = OFFSET2MARKER( iv_pStorage->offsetStart );
- // l_pMarker->offsetNext = 0;
- // l_pMarker->length = 0;
+ marker_t* l_pMarker = OFFSET2MARKER( iv_pStorage->offsetStart );
+ l_pMarker->offsetNext = 0;
+ l_pMarker->length = 0;
}
diff --git a/src/usr/initservice/extinitsvc/extinitsvctasks.H b/src/usr/initservice/extinitsvc/extinitsvctasks.H
index 37a2cd07c..202ddda81 100644
--- a/src/usr/initservice/extinitsvc/extinitsvctasks.H
+++ b/src/usr/initservice/extinitsvc/extinitsvctasks.H
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/initservice/extinitsvc/extinitsvctasks.H $
- *
- * IBM CONFIDENTIAL
- *
- * COPYRIGHT International Business Machines Corp. 2011-2012
- *
- * p1
- *
- * Object Code Only (OCO) source materials
- * Licensed Internal Code Source Materials
- * IBM HostBoot Licensed Internal Code
- *
- * The source code for this program is not published or other-
- * wise divested of its trade secrets, irrespective of what has
- * been deposited with the U.S. Copyright Office.
- *
- * Origin: 30
- *
- * IBM_PROLOG_END_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/initservice/extinitsvc/extinitsvctasks.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* */
+/* p1 */
+/* */
+/* Object Code Only (OCO) source materials */
+/* Licensed Internal Code Source Materials */
+/* IBM HostBoot Licensed Internal Code */
+/* */
+/* The source code for this program is not published or otherwise */
+/* divested of its trade secrets, irrespective of what has been */
+/* deposited with the U.S. Copyright Office. */
+/* */
+/* Origin: 30 */
+/* */
+/* IBM_PROLOG_END_TAG */
#ifndef __EXT_INIT_SVC_TASKS_H
#define __EXT_INIT_SVC_TASKS_H
@@ -116,6 +115,19 @@ const TaskInfo g_exttaskinfolist[] = {
},
/**
+ * @brief SCAN Device Driver
+ */
+ {
+ "libscan.so" , // taskname
+ NULL, // no pointer to fn
+ {
+ INIT_TASK, // task type
+ EXT_IMAGE, // Extended Module
+ }
+ },
+
+
+ /**
* @brief I2C Device Driver
*/
{
@@ -229,6 +241,14 @@ const TaskInfo g_exttaskinfolist[] = {
EXT_IMAGE, // Extended Module
}
},
+ {
+ "libthread_activate.so" , // taskname
+ NULL, // no pointer to fn
+ {
+ UNINIT_TASK, // task type
+ EXT_IMAGE, // Extended Module
+ }
+ },
// TODO: Should these be automatically loaded / unloaded by istepdispatcher?
/**
diff --git a/src/usr/makefile b/src/usr/makefile
index a4e413cbd..e4ae0117d 100644
--- a/src/usr/makefile
+++ b/src/usr/makefile
@@ -22,6 +22,8 @@
# IBM_PROLOG_END_TAG
ROOTPATH = ../..
+# Do not instrument the module_init.o
+HOSTBOOT_PROFILE_NO_INSTRUMENT = 1
OBJS = module_init.o
SUBDIRS = example.d trace.d cxxtest.d testcore.d errl.d devicefw.d \
diff --git a/src/usr/pnor/pnordd.H b/src/usr/pnor/pnordd.H
index c2f1589a1..1f04157ce 100644
--- a/src/usr/pnor/pnordd.H
+++ b/src/usr/pnor/pnordd.H
@@ -48,7 +48,7 @@ class PnorDD
* @brief Performs a PNOR Read Operation
*
* @parm o_buffer Buffer to read data into
- * @parm io_buflen Input: Number of bytes to read,
+ * @parm io_buflen Input: Number of bytes to read,
* Output: Number of bytes actually read
* @parm i_address Offset into flash to read
*
@@ -62,7 +62,7 @@ class PnorDD
* @brief Performs a PNOR Write Operation
*
* @parm i_buffer Buffer to write data from
- * @parm io_buflen Input: Number of bytes to write,
+ * @parm io_buflen Input: Number of bytes to write,
* Output: Number of bytes actually written
* @parm i_address Offset into flash to write
*
@@ -72,6 +72,7 @@ class PnorDD
size_t& io_buflen,
uint64_t i_address);
+ // Enumeration values must match those in debug framework.
enum PnorMode_t {
MODEL_UNKNOWN, /**< Invalid */
MODEL_MEMCPY, /**< No LPC logic, just do memcpy into cache area */
@@ -93,7 +94,7 @@ class PnorDD
*/
~PnorDD();
- protected:
+ protected:
/**
@@ -106,7 +107,7 @@ class PnorDD
LPC_REG_BAR2 = 0x08, /**< BAR2 : LPC Memory space */
LPC_REG_BAR3 = 0x0C, /**< BAR3 : LPC Firmware space */
};
-
+
/**
* @brief SPI Config Info
* OP Codes and other MISC info for configuring SFC
@@ -437,7 +438,7 @@ class PnorDD
* @parm i_address Offset into flash
* @parm i_byteSize Number of bytes in range
*
- * @return Number of full or partial erase blocks
+ * @return Number of full or partial erase blocks
*/
uint32_t getNumAffectedBlocks(uint32_t i_address,
size_t i_byteSize)
@@ -502,7 +503,7 @@ class PnorDD
uint64_t address : 32; /**< 32:63 = LPC Address */
};
- ControlReg_t() : data64(LPC_CTL_REG_DEFAULT) {};
+ ControlReg_t() : data64(LPC_CTL_REG_DEFAULT) {};
};
/**
@@ -526,6 +527,10 @@ class PnorDD
};
private: // Variables
+
+ // NOTE: The layout of the variables in this class must be maintained
+ // along with the offsets in the debug framework.
+
/**
* @brief Mutex to prevent concurrent PNOR accesses
* This needs to be static so we can mutex across multiple instances of PnorDD
@@ -540,7 +545,7 @@ class PnorDD
*/
uint8_t* iv_erases;
- /**
+ /**
* @brief Determine how much of the PNOR logic to use,
* this is required due to different model functionality
* in the current VPO and Simics models
OpenPOWER on IntegriCloud