summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2013-01-07 12:31:20 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-01-15 11:57:02 -0600
commitf0036f0c657e090d38b58b8cd95b4ddde1d55b33 (patch)
tree1601dc566fe7083603494a2b22d61fadf7fe5c03 /src/usr
parenta84cc4b307526e9895747f2e78bb36c93582d796 (diff)
downloadtalos-hostboot-f0036f0c657e090d38b58b8cd95b4ddde1d55b33.tar.gz
talos-hostboot-f0036f0c657e090d38b58b8cd95b4ddde1d55b33.zip
Refactor VPD code to eliminate redundancies
After noticing some redundant code and some odd include gymnastics I pulled all of the VPD related code (spd,mvpd) into a single vpd directory/module/component. This should make the addition of the centaur fru vpd simpler as well. Note: this is part of Story 39177 but not all of it, merging this early to not hold up the work for Story 44009. Change-Id: I7637a94d22e188050403ed5600b2d7f304c3d006 RTC: 39177 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2863 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/fsi/fsipres.C4
-rw-r--r--src/usr/hwas/hwasPlat.C2
-rw-r--r--src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C4
-rw-r--r--src/usr/hwpf/hwp/dram_initialization/dram_initialization.C2
-rw-r--r--src/usr/hwpf/hwp/nest_chiplets/nest_chiplets.C47
-rw-r--r--src/usr/hwpf/hwp/thread_activate/thread_activate.C47
-rw-r--r--src/usr/hwpf/plat/fapiPlatAttributeService.C4
-rw-r--r--src/usr/hwpf/plat/fapiPlatMvpdAccess.C47
-rw-r--r--src/usr/hwpf/test/hwpftest.H4
-rw-r--r--src/usr/initservice/extinitsvc/extinitsvctasks.H16
-rw-r--r--src/usr/makefile46
-rw-r--r--src/usr/mvpd/makefile32
-rw-r--r--src/usr/mvpd/test/makefile28
-rw-r--r--src/usr/spd/makefile32
-rw-r--r--src/usr/spd/test/makefile28
-rwxr-xr-xsrc/usr/vpd/dimmPres.C (renamed from src/usr/spd/dimmPres.C)16
-rw-r--r--src/usr/vpd/makefile33
-rwxr-xr-xsrc/usr/vpd/mvpd.C (renamed from src/usr/mvpd/mvpd.C)147
-rwxr-xr-xsrc/usr/vpd/mvpd.H (renamed from src/usr/mvpd/mvpd.H)45
-rwxr-xr-xsrc/usr/vpd/spd.C (renamed from src/usr/spd/spd.C)494
-rwxr-xr-xsrc/usr/vpd/spd.H (renamed from src/usr/spd/spd.H)156
-rwxr-xr-xsrc/usr/vpd/spdDDR3.H (renamed from src/usr/spd/spdDDR3.H)45
-rwxr-xr-xsrc/usr/vpd/test/dimmPrestest.H (renamed from src/usr/spd/test/dimmPrestest.H)52
-rw-r--r--src/usr/vpd/test/makefile28
-rwxr-xr-xsrc/usr/vpd/test/mvpdtest.H (renamed from src/usr/mvpd/test/mvpdtest.H)53
-rwxr-xr-xsrc/usr/vpd/test/spdtest.H (renamed from src/usr/spd/test/spdtest.H)56
-rw-r--r--src/usr/vpd/vpd.C325
-rw-r--r--src/usr/vpd/vpd.H204
28 files changed, 1052 insertions, 945 deletions
diff --git a/src/usr/fsi/fsipres.C b/src/usr/fsi/fsipres.C
index 7c4aff01c..e42a2f75e 100644
--- a/src/usr/fsi/fsipres.C
+++ b/src/usr/fsi/fsipres.C
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* COPYRIGHT International Business Machines Corp. 2011,2013 */
/* */
/* p1 */
/* */
@@ -24,7 +24,7 @@
#include <targeting/common/attributes.H>
#include <fsi/fsiif.H>
#include <fsi/fsi_reasoncodes.H>
-#include <mvpd/mvpdenums.H>
+#include <vpd/mvpdenums.H>
#include <errl/errlmanager.H>
#include <targeting/common/predicates/predicatectm.H>
diff --git a/src/usr/hwas/hwasPlat.C b/src/usr/hwas/hwasPlat.C
index 9a38ba23d..973bccafa 100644
--- a/src/usr/hwas/hwasPlat.C
+++ b/src/usr/hwas/hwasPlat.C
@@ -32,7 +32,7 @@
#include <devicefw/driverif.H>
#include <initservice/taskargs.H>
-#include <mvpd/mvpdenums.H>
+#include <vpd/mvpdenums.H>
#include <stdio.h>
#include <sys/mm.h>
diff --git a/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C b/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C
index b838537aa..c30f853f7 100644
--- a/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C
+++ b/src/usr/hwpf/hwp/build_winkle_images/build_winkle_images.C
@@ -59,8 +59,8 @@
#include <fapiPlatHwpInvoker.H>
#include <devicefw/userif.H>
-#include <mvpd/mvpdenums.H>
-#include <mvpd/mvpdreasoncodes.H>
+#include <vpd/mvpdenums.H>
+#include <vpd/vpdreasoncodes.H>
#include <hwpf/istepreasoncodes.H>
diff --git a/src/usr/hwpf/hwp/dram_initialization/dram_initialization.C b/src/usr/hwpf/hwp/dram_initialization/dram_initialization.C
index aff018ea5..2d57c5100 100644
--- a/src/usr/hwpf/hwp/dram_initialization/dram_initialization.C
+++ b/src/usr/hwpf/hwp/dram_initialization/dram_initialization.C
@@ -76,7 +76,7 @@
#include <hwpf/plat/fapiPlatReasonCodes.H>
//remove these once memory setup workaround is removed
#include <devicefw/driverif.H>
-#include <spd/spdenums.H>
+#include <vpd/spdenums.H>
#include <sys/time.h>
#include <sys/mm.h>
diff --git a/src/usr/hwpf/hwp/nest_chiplets/nest_chiplets.C b/src/usr/hwpf/hwp/nest_chiplets/nest_chiplets.C
index 02eecd810..16a00927f 100644
--- a/src/usr/hwpf/hwp/nest_chiplets/nest_chiplets.C
+++ b/src/usr/hwpf/hwp/nest_chiplets/nest_chiplets.C
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/hwpf/hwp/nest_chiplets/nest_chiplets.C $
- *
- * 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_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/hwpf/hwp/nest_chiplets/nest_chiplets.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* */
+/* 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 */
/**
@file nest_chiplets.C
*
@@ -59,7 +58,7 @@
// MVPD
#include <devicefw/userif.H>
-#include <mvpd/mvpdenums.H>
+#include <vpd/mvpdenums.H>
// -- prototype includes --
diff --git a/src/usr/hwpf/hwp/thread_activate/thread_activate.C b/src/usr/hwpf/hwp/thread_activate/thread_activate.C
index 747829427..23040c4bc 100644
--- a/src/usr/hwpf/hwp/thread_activate/thread_activate.C
+++ b/src/usr/hwpf/hwp/thread_activate/thread_activate.C
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/hwpf/hwp/thread_activate/thread_activate.C $
- *
- * 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_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/hwpf/hwp/thread_activate/thread_activate.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* */
+/* 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 */
/**
* @file thread_activate.C
*
@@ -54,7 +53,7 @@
#include <hwpf/plat/fapiPlatTrace.H>
#include <pnor/pnorif.H>
-#include <mvpd/mvpdenums.H>
+#include <vpd/mvpdenums.H>
namespace THREAD_ACTIVATE
{
diff --git a/src/usr/hwpf/plat/fapiPlatAttributeService.C b/src/usr/hwpf/plat/fapiPlatAttributeService.C
index d24d3665f..ebe686901 100644
--- a/src/usr/hwpf/plat/fapiPlatAttributeService.C
+++ b/src/usr/hwpf/plat/fapiPlatAttributeService.C
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* COPYRIGHT International Business Machines Corp. 2011,2013 */
/* */
/* p1 */
/* */
@@ -36,7 +36,7 @@
#include <errl/errlentry.H>
#include <hwpf/plat/fapiPlatAttributeService.H>
#include <hwpf/plat/fapiPlatReasonCodes.H>
-#include <spd/spdenums.H>
+#include <vpd/spdenums.H>
#include <devicefw/driverif.H>
#include <hwas/common/hwas.H>
#include <hwas/common/hwasCommon.H>
diff --git a/src/usr/hwpf/plat/fapiPlatMvpdAccess.C b/src/usr/hwpf/plat/fapiPlatMvpdAccess.C
index e7230dc49..934137b61 100644
--- a/src/usr/hwpf/plat/fapiPlatMvpdAccess.C
+++ b/src/usr/hwpf/plat/fapiPlatMvpdAccess.C
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/hwpf/plat/fapiPlatMvpdAccess.C $
- *
- * 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_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/hwpf/plat/fapiPlatMvpdAccess.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* */
+/* 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 */
/**
* @file fapiPlatMvpdAccess.C
*
@@ -36,7 +35,7 @@
// MVPD
#include <devicefw/userif.H>
-#include <mvpd/mvpdenums.H>
+#include <vpd/mvpdenums.H>
namespace fapi
diff --git a/src/usr/hwpf/test/hwpftest.H b/src/usr/hwpf/test/hwpftest.H
index f589c4eac..ae267b83e 100644
--- a/src/usr/hwpf/test/hwpftest.H
+++ b/src/usr/hwpf/test/hwpftest.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* COPYRIGHT International Business Machines Corp. 2011,2013 */
/* */
/* p1 */
/* */
@@ -37,7 +37,7 @@
#include <targeting/common/commontargeting.H>
#include <targeting/common/utilFilter.H>
#include <fapiHwpExecInitFile.H>
-#include <spd/spdenums.H>
+#include <vpd/spdenums.H>
using namespace fapi;
using namespace TARGETING;
diff --git a/src/usr/initservice/extinitsvc/extinitsvctasks.H b/src/usr/initservice/extinitsvc/extinitsvctasks.H
index aecc7372a..1ae0d4932 100644
--- a/src/usr/initservice/extinitsvc/extinitsvctasks.H
+++ b/src/usr/initservice/extinitsvc/extinitsvctasks.H
@@ -5,7 +5,7 @@
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2011,2012 */
+/* COPYRIGHT International Business Machines Corp. 2011,2013 */
/* */
/* p1 */
/* */
@@ -157,19 +157,7 @@ const TaskInfo g_exttaskinfolist[] = {
* @brief spd task
*/
{
- "libspd.so", // taskname
- NULL, // no pointer to fn
- {
- INIT_TASK, // task type
- EXT_IMAGE, // Extended module
- }
- },
-
- /**
- * @brief mvpd task
- */
- {
- "libmvpd.so", // taskname
+ "libvpd.so", // taskname
NULL, // no pointer to fn
{
INIT_TASK, // task type
diff --git a/src/usr/makefile b/src/usr/makefile
index fc4a6f9c6..a93a1827a 100644
--- a/src/usr/makefile
+++ b/src/usr/makefile
@@ -1,25 +1,25 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/usr/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
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/makefile $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2010,2013
+#
+# 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
ROOTPATH = ../..
# Do not instrument the module_init.o
@@ -29,7 +29,7 @@ OBJS = module_init.o
SUBDIRS = example.d trace.d cxxtest.d testcore.d errl.d devicefw.d \
scom.d xscom.d targeting.d initservice.d hwpf.d \
ecmddatabuffer.d pnor.d i2c.d vfs.d fsi.d hwas.d fsiscom.d \
- intr.d spd.d pore.d util.d mbox.d diag.d mvpd.d scan.d \
+ intr.d pore.d util.d mbox.d diag.d vpd.d scan.d \
runtime.d ibscom.d
include ${ROOTPATH}/config.mk
diff --git a/src/usr/mvpd/makefile b/src/usr/mvpd/makefile
deleted file mode 100644
index 48bc81824..000000000
--- a/src/usr/mvpd/makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/usr/mvpd/makefile $
-#
-# 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_TAG
-ROOTPATH = ../../..
-MODULE = mvpd
-
-OBJS = mvpd.o
-
-SUBDIRS = test.d
-
-BINARY_FILES = $(IMGDIR)/procmvpd.dat:fd9fac85d9132c287f81468045c79f1c98409811
-
-include ${ROOTPATH}/config.mk
diff --git a/src/usr/mvpd/test/makefile b/src/usr/mvpd/test/makefile
deleted file mode 100644
index 8c7f74570..000000000
--- a/src/usr/mvpd/test/makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/usr/mvpd/test/makefile $
-#
-# 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
-ROOTPATH = ../../../..
-
-MODULE = testmvpd
-TESTS = *.H
-
-include ${ROOTPATH}/config.mk
diff --git a/src/usr/spd/makefile b/src/usr/spd/makefile
deleted file mode 100644
index cc0831272..000000000
--- a/src/usr/spd/makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/usr/spd/makefile $
-#
-# 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
-ROOTPATH = ../../..
-MODULE = spd
-
-OBJS = spd.o dimmPres.o
-
-SUBDIRS = test.d
-
-BINARY_FILES = $(IMGDIR)/dimmspd.dat:4ff2e1b8616d10de13b63f56ca4eaa077ae6cdd8
-
-include ${ROOTPATH}/config.mk
diff --git a/src/usr/spd/test/makefile b/src/usr/spd/test/makefile
deleted file mode 100644
index 58e8fd562..000000000
--- a/src/usr/spd/test/makefile
+++ /dev/null
@@ -1,28 +0,0 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
-#
-# $Source: src/usr/spd/test/makefile $
-#
-# 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
-ROOTPATH = ../../../..
-
-MODULE = testspd
-TESTS = *.H
-
-include ${ROOTPATH}/config.mk
diff --git a/src/usr/spd/dimmPres.C b/src/usr/vpd/dimmPres.C
index 70d6d36fe..1d913a933 100755
--- a/src/usr/spd/dimmPres.C
+++ b/src/usr/vpd/dimmPres.C
@@ -1,11 +1,11 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
-/* $Source: src/usr/spd/dimmPres.C $ */
+/* $Source: src/usr/vpd/dimmPres.C $ */
/* */
/* IBM CONFIDENTIAL */
/* */
-/* COPYRIGHT International Business Machines Corp. 2012 */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
/* */
/* p1 */
/* */
@@ -35,8 +35,8 @@
#include <errl/errlmanager.H>
#include <targeting/common/targetservice.H>
#include <devicefw/driverif.H>
-#include <spd/spdreasoncodes.H>
-#include <spd/spdenums.H>
+#include <vpd/vpdreasoncodes.H>
+#include <vpd/spdenums.H>
#include "spd.H"
@@ -98,16 +98,16 @@ errlHndl_t dimmPresenceDetect( DeviceFW::OperationType i_opType,
/*@
* @errortype
- * @reasoncode SPD_INSUFFICIENT_BUFFER_SIZE
+ * @reasoncode VPD::VPD_INSUFFICIENT_BUFFER_SIZE
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_PRESENCE_DETECT
+ * @moduleid VPD::VPD_SPD_PRESENCE_DETECT
* @userdata1 Buffer Length
* @userdata2 <UNUSED>
* @devdesc Buffer for checking Presence Detect was not the correct size.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_PRESENCE_DETECT,
- SPD_INSUFFICIENT_BUFFER_SIZE,
+ VPD::VPD_SPD_PRESENCE_DETECT,
+ VPD::VPD_INSUFFICIENT_BUFFER_SIZE,
TO_UINT64(io_buflen),
0x0 );
diff --git a/src/usr/vpd/makefile b/src/usr/vpd/makefile
new file mode 100644
index 000000000..30b30a15e
--- /dev/null
+++ b/src/usr/vpd/makefile
@@ -0,0 +1,33 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/vpd/makefile $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2012,2013
+#
+# 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
+ROOTPATH = ../../..
+MODULE = vpd
+
+OBJS = vpd.o spd.o mvpd.o dimmPres.o
+
+SUBDIRS = test.d
+
+BINARY_FILES = $(IMGDIR)/procmvpd.dat:fd9fac85d9132c287f81468045c79f1c98409811
+BINARY_FILES += $(IMGDIR)/dimmspd.dat:4ff2e1b8616d10de13b63f56ca4eaa077ae6cdd8
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/mvpd/mvpd.C b/src/usr/vpd/mvpd.C
index b8b6f7412..cf935758e 100755
--- a/src/usr/mvpd/mvpd.C
+++ b/src/usr/vpd/mvpd.C
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/mvpd/mvpd.C $
- *
- * 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_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/vpd/mvpd.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* */
+/* 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 */
/**
* @file mvpd.C
*
@@ -39,23 +38,11 @@
#include <targeting/common/targetservice.H>
#include <devicefw/driverif.H>
#include <vfs/vfs.H>
-#include <spd/spdif.H>
-#include <mvpd/mvpdreasoncodes.H>
-#include <mvpd/mvpdenums.H>
+#include <vpd/vpdreasoncodes.H>
+#include <vpd/mvpdenums.H>
#include "mvpd.H"
-
-// ----------------------------------------------
-// Globals
-// ----------------------------------------------
-bool g_loadModule = true;
-mutex_t g_mvpdMutex = MUTEX_INITIALIZER;
-
-uint64_t g_mvpdPnorAddr = 0x0;
-
-// By setting to false, allows debug at a later time by allowing to
-// substitute a binary file (procmvpd.dat) into PNOR.
-const bool g_readPNOR = true;
+#include "vpd.H"
// ----------------------------------------------
// Trace definitions
@@ -78,6 +65,18 @@ TRAC_INIT( & g_trac_mvpd, "MVPD", KILOBYTE);
namespace MVPD
{
+// ----------------------------------------------
+// Globals
+// ----------------------------------------------
+bool g_loadModule = true;
+mutex_t g_mvpdMutex = MUTEX_INITIALIZER;
+
+uint64_t g_mvpdPnorAddr = 0x0;
+
+// By setting to false, allows debug at a later time by allowing to
+// substitute a binary file (procmvpd.dat) into PNOR.
+const bool g_readPNOR = true;
+
/**
* @brief This function compares 2 mvpd record values. Used for binary
@@ -235,16 +234,16 @@ errlHndl_t mvpdWrite ( DeviceFW::OperationType i_opType,
/*@
* @errortype
- * @reasoncode MVPD_OPERATION_NOT_SUPPORTED
+ * @reasoncode VPD::VPD_OPERATION_NOT_SUPPORTED
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid MVPD_WRITE
+ * @moduleid VPD::VPD_MVPD_WRITE
* @userdata1 Requested Record
* @userdata2 Requested Keyword
* @devdesc MVPD Writes are not supported currently.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- MVPD_WRITE,
- MVPD_OPERATION_NOT_SUPPORTED,
+ VPD::VPD_MVPD_WRITE,
+ VPD::VPD_OPERATION_NOT_SUPPORTED,
args.record,
args.keyword );
@@ -289,17 +288,17 @@ errlHndl_t mvpdTranslateRecord ( mvpdRecord i_record,
/*@
* @errortype
- * @reasoncode MVPD_RECORD_NOT_FOUND
+ * @reasoncode VPD::VPD_RECORD_NOT_FOUND
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid MVPD_TRANSLATE_RECORD
+ * @moduleid VPD::VPD_MVPD_TRANSLATE_RECORD
* @userdata1 Record enumeration.
* @userdata2 <UNUSED>
* @devdesc The record enumeration did not have a
* corresponding string value.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- MVPD_TRANSLATE_RECORD,
- MVPD_RECORD_NOT_FOUND,
+ VPD::VPD_MVPD_TRANSLATE_RECORD,
+ VPD::VPD_RECORD_NOT_FOUND,
i_record,
0x0 );
@@ -349,17 +348,17 @@ errlHndl_t mvpdTranslateKeyword ( mvpdKeyword i_keyword,
/*@
* @errortype
- * @reasoncode MVPD_KEYWORD_NOT_FOUND
+ * @reasoncode VPD::VPD_KEYWORD_NOT_FOUND
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid MVPD_TRANSLATE_KEYWORD
+ * @moduleid VPD::VPD_MVPD_TRANSLATE_KEYWORD
* @userdata1 Keyword Enumeration
* @userdata2 <UNUSED>
* @devdesc The keyword enumeration did not have a
* corresponding string value.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- MVPD_TRANSLATE_KEYWORD,
- MVPD_KEYWORD_NOT_FOUND,
+ VPD::VPD_MVPD_TRANSLATE_KEYWORD,
+ VPD::VPD_KEYWORD_NOT_FOUND,
i_keyword,
0x0 );
@@ -460,16 +459,16 @@ errlHndl_t mvpdFindRecordOffset ( const char * i_record,
/*@
* @errortype
- * @reasoncode MVPD_RECORD_NOT_FOUND
+ * @reasoncode VPD::VPD_RECORD_NOT_FOUND
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid MVPD_FIND_RECORD_OFFSET
+ * @moduleid VPD::VPD_MVPD_FIND_RECORD_OFFSET
* @userdata1 Requested Record
* @userdata2 Requested Keyword
* @devdesc The requested record was not found in the MVPD TOC.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- MVPD_FIND_RECORD_OFFSET,
- MVPD_RECORD_NOT_FOUND,
+ VPD::VPD_MVPD_FIND_RECORD_OFFSET,
+ VPD::VPD_RECORD_NOT_FOUND,
i_args.record,
i_args.keyword );
// Add trace to the log so we know what record was being requested.
@@ -550,17 +549,17 @@ errlHndl_t mvpdRetrieveKeyword ( const char * i_keywordName,
/*@
* @errortype
- * @reasoncode MVPD_RECORD_MISMATCH
+ * @reasoncode VPD::VPD_RECORD_MISMATCH
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid MVPD_RETRIEVE_KEYWORD
+ * @moduleid VPD::VPD_MVPD_RETRIEVE_KEYWORD
* @userdata1 Current offset into MVPD
* @userdata2 Start of Record offset
* @devdesc Record name does not match value expected for
* offset read.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- MVPD_RETRIEVE_KEYWORD,
- MVPD_RECORD_MISMATCH,
+ VPD::VPD_MVPD_RETRIEVE_KEYWORD,
+ VPD::VPD_RECORD_MISMATCH,
offset,
i_offset );
// Add trace so we see what record was being compared
@@ -693,9 +692,9 @@ errlHndl_t mvpdRetrieveKeyword ( const char * i_keywordName,
/*@
* @errortype
- * @reasoncode MVPD_KEYWORD_NOT_FOUND
+ * @reasoncode VPD::VPD_KEYWORD_NOT_FOUND
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid MVPD_RETRIEVE_KEYWORD
+ * @moduleid VPD::VPD_MVPD_RETRIEVE_KEYWORD
* @userdata1 Start of Record Offset
* @userdata2[0:31] Requested Record
* @userdata2[32:63] Requested Keyword
@@ -703,8 +702,8 @@ errlHndl_t mvpdRetrieveKeyword ( const char * i_keywordName,
* offset.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- MVPD_RETRIEVE_KEYWORD,
- MVPD_KEYWORD_NOT_FOUND,
+ VPD::VPD_MVPD_RETRIEVE_KEYWORD,
+ VPD::VPD_KEYWORD_NOT_FOUND,
i_offset,
TWO_UINT32_TO_UINT64( i_args.record,
i_args.keyword ) );
@@ -737,15 +736,13 @@ errlHndl_t mvpdFetchData ( uint64_t i_byteAddr,
{
if( g_readPNOR )
{
- // Call a function in the SPD code which does an identical thing,
- // but with different address offsets. Saves us having to
- // duplicate the code between the 2 modules.
- SPD::pnorInformation info;
+ // Call a function in the common VPD code
+ VPD::pnorInformation info;
info.segmentSize = MVPD_SECTION_SIZE;
info.maxSegments = MVPD_MAX_SECTIONS;
info.pnorSection = PNOR::MODULE_VPD;
info.pnorSide = PNOR::CURRENT_SIDE;
- err = SPD::readPNOR( i_byteAddr,
+ err = VPD::readPNOR( i_byteAddr,
i_numBytes,
o_data,
i_target,
@@ -854,9 +851,9 @@ errlHndl_t mvpdReadBinaryFile ( uint64_t i_offset,
/*@
* @errortype
- * @reasoncode MVPD_INSUFFICIENT_FILE_SIZE
+ * @reasoncode VPD::VPD_INSUFFICIENT_FILE_SIZE
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid MVPD_READ_BINARY_FILE
+ * @moduleid VPD::VPD_MVPD_READ_BINARY_FILE
* @userdata1 File Size
* @userdata2[0:31] Starting offset into file
* @userdata2[32:63] Number of bytes to read
@@ -864,8 +861,8 @@ errlHndl_t mvpdReadBinaryFile ( uint64_t i_offset,
* bytes at offset given without overrunning file.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- MVPD_READ_BINARY_FILE,
- MVPD_INSUFFICIENT_FILE_SIZE,
+ VPD::VPD_MVPD_READ_BINARY_FILE,
+ VPD::VPD_INSUFFICIENT_FILE_SIZE,
fileSize,
TWO_UINT32_TO_UINT64( i_offset,
fileSize ) );
@@ -904,17 +901,17 @@ errlHndl_t checkBufferSize( size_t i_bufferSize,
/*@
* @errortype
- * @reasoncode MVPD_INSUFFICIENT_BUFFER_SIZE
+ * @reasoncode VPD::VPD_INSUFFICIENT_BUFFER_SIZE
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid MVPD_CHECK_BUFFER_SIZE
+ * @moduleid VPD::VPD_MVPD_CHECK_BUFFER_SIZE
* @userdata1 Buffer Size
* @userdata2 Expected Buffer Size
* @devdesc Buffer size was not greater than or equal to
* expected buffer size.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- MVPD_CHECK_BUFFER_SIZE,
- MVPD_INSUFFICIENT_BUFFER_SIZE,
+ VPD::VPD_MVPD_CHECK_BUFFER_SIZE,
+ VPD::VPD_INSUFFICIENT_BUFFER_SIZE,
i_bufferSize,
i_expectedSize );
}
diff --git a/src/usr/mvpd/mvpd.H b/src/usr/vpd/mvpd.H
index 82a8fd4a5..680119fcd 100755
--- a/src/usr/mvpd/mvpd.H
+++ b/src/usr/vpd/mvpd.H
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/mvpd/mvpd.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_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/vpd/mvpd.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* */
+/* 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 __MVPD_H
#define __MVPD_H
diff --git a/src/usr/spd/spd.C b/src/usr/vpd/spd.C
index f5fec88f4..27df54b2a 100755
--- a/src/usr/spd/spd.C
+++ b/src/usr/vpd/spd.C
@@ -37,27 +37,13 @@
#include <devicefw/driverif.H>
#include <vfs/vfs.H>
#include <pnor/pnorif.H>
-#include <spd/spdreasoncodes.H>
-#include <spd/spdenums.H>
+#include <vpd/vpdreasoncodes.H>
+#include <vpd/spdenums.H>
#include <algorithm>
#include "spd.H"
#include "spdDDR3.H"
// ----------------------------------------------
-// Globals
-// ----------------------------------------------
-bool g_loadModule = true;
-
-// This mutex is used to lock for writing/updating the global variables.
-mutex_t g_spdMutex = MUTEX_INITIALIZER;
-
-uint64_t g_spdPnorAddr = 0x0;
-
-// By setting to false, allows debug at a later time by allowing to
-// substitute a binary file (dimmspd.dat) into PNOR.
-const bool g_usePNOR = true;
-
-// ----------------------------------------------
// Trace definitions
// ----------------------------------------------
trace_desc_t* g_trac_spd = NULL;
@@ -78,6 +64,20 @@ TRAC_INIT( & g_trac_spd, "SPD", KILOBYTE );
namespace SPD
{
+// ----------------------------------------------
+// Globals
+// ----------------------------------------------
+bool g_loadModule = true;
+
+// This mutex is used to lock for writing/updating the global variables.
+mutex_t g_spdMutex = MUTEX_INITIALIZER;
+
+uint64_t g_spdPnorAddr = 0x0;
+
+// By setting to false, allows debug at a later time by allowing to
+// substitute a binary file (dimmspd.dat) into PNOR.
+const bool g_usePNOR = true;
+
/**
* @brief Compare two values and return whether e2 is greater than
@@ -202,16 +202,16 @@ errlHndl_t spdGetKeywordValue ( DeviceFW::OperationType i_opType,
/*@
* @errortype
- * @reasoncode SPD_INVALID_BASIC_MEMORY_TYPE
+ * @reasoncode VPD::VPD_INVALID_BASIC_MEMORY_TYPE
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_GET_KEYWORD_VALUE
+ * @moduleid VPD::VPD_SPD_GET_KEYWORD_VALUE
* @userdata1 Basic Memory Type (Byte 2)
* @userdata2 Keyword Requested
* @devdesc Invalid Basic Memory Type
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_GET_KEYWORD_VALUE,
- SPD_INVALID_BASIC_MEMORY_TYPE,
+ VPD::VPD_SPD_GET_KEYWORD_VALUE,
+ VPD::VPD_INVALID_BASIC_MEMORY_TYPE,
memType,
keyword );
@@ -276,16 +276,16 @@ errlHndl_t spdWriteKeywordValue ( DeviceFW::OperationType i_opType,
/*@
* @errortype
- * @reasoncode SPD_INVALID_BASIC_MEMORY_TYPE
+ * @reasoncode VPD::VPD_INVALID_BASIC_MEMORY_TYPE
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_WRITE_KEYWORD_VALUE
+ * @moduleid VPD::VPD_SPD_WRITE_KEYWORD_VALUE
* @userdata1 Basic Memory Type (Byte 2)
* @userdata2 Keyword Requested
* @devdesc Invalid Basic Memory Type
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_WRITE_KEYWORD_VALUE,
- SPD_INVALID_BASIC_MEMORY_TYPE,
+ VPD::VPD_SPD_WRITE_KEYWORD_VALUE,
+ VPD::VPD_INVALID_BASIC_MEMORY_TYPE,
memType,
keyword );
@@ -318,18 +318,18 @@ errlHndl_t spdFetchData ( uint64_t i_byteAddr,
if( likely( g_usePNOR ) )
{
// Setup info needed to read from PNOR
- pnorInformation info;
+ VPD::pnorInformation info;
info.segmentSize = DIMM_SPD_SECTION_SIZE;
info.maxSegments = DIMM_SPD_MAX_SECTIONS;
info.pnorSection = PNOR::DIMM_JEDEC_VPD;
info.pnorSide = PNOR::CURRENT_SIDE;
- err = readPNOR( i_byteAddr,
- i_numBytes,
- o_data,
- i_target,
- info,
- g_spdPnorAddr,
- &g_spdMutex );
+ err = VPD::readPNOR( i_byteAddr,
+ i_numBytes,
+ o_data,
+ i_target,
+ info,
+ g_spdPnorAddr,
+ &g_spdMutex );
if( err )
{
@@ -374,18 +374,18 @@ errlHndl_t spdWriteData ( uint64_t i_offset,
if( likely( g_usePNOR ) )
{
// Setup info needed to write from PNOR
- pnorInformation info;
+ VPD::pnorInformation info;
info.segmentSize = DIMM_SPD_SECTION_SIZE;
info.maxSegments = DIMM_SPD_MAX_SECTIONS;
info.pnorSection = PNOR::DIMM_JEDEC_VPD;
info.pnorSide = PNOR::CURRENT_SIDE;
- err = writePNOR( i_offset,
- i_numBytes,
- i_data,
- i_target,
- info,
- g_spdPnorAddr,
- &g_spdMutex );
+ err = VPD::writePNOR( i_offset,
+ i_numBytes,
+ i_data,
+ i_target,
+ info,
+ g_spdPnorAddr,
+ &g_spdMutex );
if( err )
{
@@ -399,17 +399,17 @@ errlHndl_t spdWriteData ( uint64_t i_offset,
/*@
* @errortype
- * @reasoncode SPD_INVALID_WRITE_METHOD
+ * @reasoncode VPD::VPD_INVALID_WRITE_METHOD
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_WRITE_DATA
+ * @moduleid VPD::VPD_SPD_WRITE_DATA
* @userdata1 Write Offset
* @userdata2 Number of Bytes to Write
* @devdesc g_usePNOR is false, but there isn't an
* alternate way to write PNOR.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_WRITE_DATA,
- SPD_INVALID_WRITE_METHOD,
+ VPD::VPD_SPD_WRITE_DATA,
+ VPD::VPD_INVALID_WRITE_METHOD,
i_offset,
i_numBytes );
@@ -459,9 +459,9 @@ errlHndl_t spdGetValue ( uint64_t i_keyword,
/*@
* @errortype
- * @reasoncode SPD_NULL_ENTRY
+ * @reasoncode VPD::VPD_NULL_ENTRY
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_GET_VALUE
+ * @moduleid VPD::VPD_SPD_GET_VALUE
* @userdata1 SPD Keyword
* @userdata2[0:31] Buffer Size
* @userdata2[32:63] Memory Type
@@ -469,8 +469,8 @@ errlHndl_t spdGetValue ( uint64_t i_keyword,
* NULL.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_GET_VALUE,
- SPD_NULL_ENTRY,
+ VPD::VPD_SPD_GET_VALUE,
+ VPD::VPD_NULL_ENTRY,
i_keyword,
TWO_UINT32_TO_UINT64( io_buflen,
i_DDRRev ) );
@@ -583,9 +583,9 @@ errlHndl_t spdWriteValue ( uint64_t i_keyword,
/*@
* @errortype
- * @reasoncode SPD_NULL_ENTRY
+ * @reasoncode VPD::VPD_NULL_ENTRY
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_WRITE_VALUE
+ * @moduleid VPD::VPD_SPD_WRITE_VALUE
* @userdata1 SPD Keyword
* @userdata2[0:31] Buffer Length
* @userdata2[32:63] Memory Type
@@ -593,8 +593,8 @@ errlHndl_t spdWriteValue ( uint64_t i_keyword,
* NULL.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_WRITE_VALUE,
- SPD_NULL_ENTRY,
+ VPD::VPD_SPD_WRITE_VALUE,
+ VPD::VPD_NULL_ENTRY,
i_keyword,
TWO_UINT32_TO_UINT64( io_buflen,
i_DDRRev ) );
@@ -631,10 +631,16 @@ errlHndl_t spdWriteValue ( uint64_t i_keyword,
}
// Send mbox message with new data to Fsp
- err = spdSendMboxWriteMsg( entry->offset,
- io_buflen,
- io_buffer,
- i_target );
+ VPD::VpdWriteMsg_t msgdata;
+ msgdata.rec_num = i_target->getAttr<TARGETING::ATTR_VPD_REC_NUM>();
+ //XXXX=offset relative to whole section
+ memcpy( msgdata.record, "XXXX", 4 );
+ msgdata.offset = entry->offset;
+ err = VPD::sendMboxWriteMsg( io_buflen,
+ io_buffer,
+ i_target,
+ VPD::VPD_WRITE_DIMM,
+ msgdata );
if( err )
{
@@ -651,17 +657,17 @@ errlHndl_t spdWriteValue ( uint64_t i_keyword,
/*@
* @errortype
- * @reasoncode SPD_KEYWORD_NOT_WRITABLE
+ * @reasoncode VPD::VPD_KEYWORD_NOT_WRITABLE
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_WRITE_VALUE
+ * @moduleid VPD::VPD_SPD_WRITE_VALUE
* @userdata1 SPD Keyword
* @userdata2[0:31] Buffer Length
* @userdata2[32:63] Memory Type
* @devdesc The SPD Keyword is not writable.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_WRITE_VALUE,
- SPD_KEYWORD_NOT_WRITABLE,
+ VPD::VPD_SPD_WRITE_VALUE,
+ VPD::VPD_KEYWORD_NOT_WRITABLE,
i_keyword,
TWO_UINT32_TO_UINT64( io_buflen,
i_DDRRev ) );
@@ -824,16 +830,16 @@ errlHndl_t spdSpecialCases ( KeywordData i_kwdData,
/*@
* @errortype
- * @reasoncode SPD_INVALID_SPD_KEYWORD
+ * @reasoncode VPD::VPD_INVALID_SPD_KEYWORD
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_SPECIAL_CASES
+ * @moduleid VPD::VPD_SPD_SPECIAL_CASES
* @userdata1 SPD Keyword
* @userdata2 UNUSED
* @devdesc Keyword is not a special case keyword.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_SPECIAL_CASES,
- SPD_INVALID_SPD_KEYWORD,
+ VPD::VPD_SPD_SPECIAL_CASES,
+ VPD::VPD_INVALID_SPD_KEYWORD,
i_kwdData.keyword,
0x0 );
break;
@@ -847,16 +853,16 @@ errlHndl_t spdSpecialCases ( KeywordData i_kwdData,
/*@
* @errortype
- * @reasoncode SPD_INVALID_BASIC_MEMORY_TYPE
+ * @reasoncode VPD::VPD_INVALID_BASIC_MEMORY_TYPE
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_SPECIAL_CASES
+ * @moduleid VPD::VPD_SPD_SPECIAL_CASES
* @userdata1 SPD Keyword
* @userdata2 DIMM DDR Revision
* @devdesc Invalid DDR Revision
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_SPECIAL_CASES,
- SPD_INVALID_BASIC_MEMORY_TYPE,
+ VPD::VPD_SPD_SPECIAL_CASES,
+ VPD::VPD_INVALID_BASIC_MEMORY_TYPE,
i_kwdData.keyword,
i_DDRRev );
@@ -891,9 +897,9 @@ errlHndl_t spdCheckSize ( size_t i_bufferSz,
/*@
* @errortype
- * @reasoncode SPD_INSUFFICIENT_BUFFER_SIZE
+ * @reasoncode VPD::VPD_INSUFFICIENT_BUFFER_SIZE
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_CHECK_SIZE
+ * @moduleid VPD::VPD_SPD_CHECK_SIZE
* @userdata1 Keyword
* @userdata2[0:31] Needed Buffer Size
* @userdata2[32:63] Expected Buffer Size
@@ -901,8 +907,8 @@ errlHndl_t spdCheckSize ( size_t i_bufferSz,
* the keyword requested.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_CHECK_SIZE,
- SPD_INSUFFICIENT_BUFFER_SIZE,
+ VPD::VPD_SPD_CHECK_SIZE,
+ VPD::VPD_INSUFFICIENT_BUFFER_SIZE,
i_keyword,
TWO_UINT32_TO_UINT64( i_bufferSz,
i_expBufferSz ) );
@@ -990,9 +996,9 @@ errlHndl_t spdReadBinaryFile ( uint64_t i_byteAddr,
/*@
* @errortype
- * @reasoncode SPD_INSUFFICIENT_FILE_SIZE
+ * @reasoncode VPD::VPD_INSUFFICIENT_FILE_SIZE
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_READ_BINARY_FILE
+ * @moduleid VPD::VPD_SPD_READ_BINARY_FILE
* @userdata1 File Size
* @userdata2[0:48] Starting offset into file
* @userdata2[49:63] Number of bytes to read
@@ -1000,8 +1006,8 @@ errlHndl_t spdReadBinaryFile ( uint64_t i_byteAddr,
* bytes at offset given without overrunning file.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_READ_BINARY_FILE,
- SPD_INSUFFICIENT_FILE_SIZE,
+ VPD::VPD_SPD_READ_BINARY_FILE,
+ VPD::VPD_INSUFFICIENT_FILE_SIZE,
fileSize,
tmpData );
@@ -1022,278 +1028,6 @@ errlHndl_t spdReadBinaryFile ( uint64_t i_byteAddr,
// ------------------------------------------------------------------
-// spdSendMboxWriteMsg
-// ------------------------------------------------------------------
-errlHndl_t spdSendMboxWriteMsg ( uint64_t i_offset,
- size_t i_numBytes,
- void * i_data,
- TARGETING::Target * i_target )
-{
- errlHndl_t l_err = NULL;
- msg_t* msg = NULL;
-
- TRACSSCOMP( g_trac_spd,
- ENTER_MRK"spdSendMboxWriteMsg()" );
-
- do
- {
- //Create a mailbox message to send to FSP
- msg = msg_allocate();
- msg->type = VPD_WRITE_DIMM;
-
- VpdWriteMsg_t msgdata;
- msgdata.rec_num = i_target->getAttr<TARGETING::ATTR_VPD_REC_NUM>();
- memcpy( msgdata.record, "XXXX", 4 ); //offset relative to whole section
- msgdata.offset = i_offset;
- msg->data[0] = msgdata.data0;
- msg->data[1] = i_numBytes;
-
- //should never need more than 4KB
- assert( i_numBytes < PAGESIZE);
-
- msg->extra_data = malloc( i_numBytes );
- memcpy( msg->extra_data, i_data, i_numBytes );
- TRACFCOMP( g_trac_spd, "extra_data=%p", msg->extra_data );
-
- TRACFCOMP( g_trac_spd,
- INFO_MRK"Send msg to FSP to write record %d, offset 0x%X",
- msgdata.rec_num,
- msgdata.offset );
-
- //Create a mbox message with the error log and send it to FSP
- //We only send error log to FSP when mailbox is enabled
- if( !MBOX::mailbox_enabled() )
- {
- TRACFCOMP(g_trac_spd, INFO_MRK "Mailbox is disabled, skipping SPD write");
- TRACFBIN( g_trac_spd, "msg=", msg, sizeof(msg_t) );
- TRACFBIN( g_trac_spd, "extra=", msg->extra_data, i_numBytes );
- }
-
- l_err = MBOX::send( MBOX::FSP_VPD_MSGQ, msg );
- if( l_err )
- {
- TRACFCOMP(g_trac_spd, ERR_MRK "Failed sending SPD to FSP");
- // just commit the log and move on, nothing else to do
- l_err->collectTrace("SPD",1024);
- errlCommit( l_err, SPD_COMP_ID );
- l_err = NULL;
-
- msg_free( msg );
- }
- } while( 0 );
-
- TRACSSCOMP( g_trac_spd,
- EXIT_MRK"spdSendMboxWriteMsg()" );
-
- return l_err;
-}
-
-
-// ------------------------------------------------------------------
-// readPNOR
-// ------------------------------------------------------------------
-errlHndl_t readPNOR ( uint64_t i_byteAddr,
- size_t i_numBytes,
- void * o_data,
- TARGETING::Target * i_target,
- pnorInformation & i_pnorInfo,
- uint64_t &io_cachedAddr,
- mutex_t * i_mutex )
-{
- errlHndl_t err = NULL;
- int64_t vpdLocation = 0;
- uint64_t addr = 0x0;
- const char * readAddr = NULL;
-
- TRACSSCOMP( g_trac_spd,
- ENTER_MRK"readPNOR()" );
-
- do
- {
- // Check if we have the PNOR addr cached.
- if( 0x0 == io_cachedAddr )
- {
- err = getPnorAddr( i_pnorInfo,
- io_cachedAddr,
- i_mutex );
-
- if( err )
- {
- break;
- }
- }
- addr = io_cachedAddr;
-
- // Find vpd location of the target
- err = getVpdLocation( vpdLocation,
- i_target );
-
- if( err )
- {
- break;
- }
-
- // Offset cached address by vpd location multiplier
- addr += (vpdLocation * i_pnorInfo.segmentSize);
-
- // Now offset into that chunk of data by i_byteAddr
- addr += i_byteAddr;
-
- TRACUCOMP( g_trac_spd,
- INFO_MRK"Address to read: 0x%08x",
- addr );
-
- //TODO: Validate write is within bounds of appropriate PNOR
- // partition/section. RTC: 51807
-
- // Pull the data
- readAddr = reinterpret_cast<const char*>( addr );
- memcpy( o_data,
- readAddr,
- i_numBytes );
- } while( 0 );
-
- TRACSSCOMP( g_trac_spd,
- EXIT_MRK"readPNOR()" );
-
- return err;
-}
-
-
-// ------------------------------------------------------------------
-// writePNOR
-// ------------------------------------------------------------------
-errlHndl_t writePNOR ( uint64_t i_byteAddr,
- size_t i_numBytes,
- void * i_data,
- TARGETING::Target * i_target,
- pnorInformation & i_pnorInfo,
- uint64_t &io_cachedAddr,
- mutex_t * i_mutex )
-{
- errlHndl_t err = NULL;
- int64_t vpdLocation = 0;
- uint64_t addr = 0x0;
- const char * writeAddr = NULL;
-
- TRACSSCOMP( g_trac_spd,
- ENTER_MRK"writePNOR()" );
-
- do
- {
- // Check if we have the PNOR addr cached.
- if( 0x0 == io_cachedAddr )
- {
- err = getPnorAddr( i_pnorInfo,
- io_cachedAddr,
- i_mutex );
-
- if( err )
- {
- break;
- }
- }
- addr = io_cachedAddr;
-
- // Find vpd location of the target
- err = getVpdLocation( vpdLocation,
- i_target );
-
- if( err )
- {
- break;
- }
-
- // Offset cached address by vpd location multiplier
- addr += (vpdLocation * i_pnorInfo.segmentSize);
-
- // Now offset into that chunk of data by i_byteAddr
- addr += i_byteAddr;
-
- //TODO: Validate write is within bounds of appropriate PNOR
- // partition/section. RTC: 51807
-
- TRACUCOMP( g_trac_spd,
- INFO_MRK"Address to write: 0x%08x",
- addr );
-
- // Write the data
- writeAddr = reinterpret_cast<const char*>( addr );
- memcpy( (void*)(writeAddr),
- i_data,
- i_numBytes );
- } while( 0 );
-
- TRACSSCOMP( g_trac_spd,
- EXIT_MRK"writePNOR()" );
-
- return err;
-}
-
-
-// ------------------------------------------------------------------
-// getPnorAddr
-// ------------------------------------------------------------------
-errlHndl_t getPnorAddr ( pnorInformation & i_pnorInfo,
- uint64_t &io_cachedAddr,
- mutex_t * i_mutex )
-{
- errlHndl_t err = NULL;
- PNOR::SectionInfo_t info;
-
- TRACSSCOMP( g_trac_spd,
- ENTER_MRK"getPnorAddr()" );
-
- do
- {
- // Get SPD PNOR section info from PNOR RP
- err = PNOR::getSectionInfo( i_pnorInfo.pnorSection,
- i_pnorInfo.pnorSide,
- info );
-
- if( err )
- {
- break;
- }
-
- // Set the globals appropriately
- mutex_lock( i_mutex );
- io_cachedAddr = info.vaddr;
- mutex_unlock( i_mutex );
- } while( 0 );
-
- TRACSSCOMP( g_trac_spd,
- EXIT_MRK"getPnorAddr() - addr: 0x%08x",
- io_cachedAddr );
-
- return err;
-}
-
-
-// ------------------------------------------------------------------
-// getVpdLocation
-// ------------------------------------------------------------------
-errlHndl_t getVpdLocation ( int64_t & o_vpdLocation,
- TARGETING::Target * i_target )
-{
- errlHndl_t err = NULL;
-
- TRACSSCOMP( g_trac_spd,
- ENTER_MRK"getVpdLocation()" );
-
- o_vpdLocation = i_target->getAttr<TARGETING::ATTR_VPD_REC_NUM>();
- TRACUCOMP( g_trac_spd,
- INFO_MRK"Using VPD location: %d",
- o_vpdLocation );
-
- TRACSSCOMP( g_trac_spd,
- EXIT_MRK"getVpdLocation()" );
-
- return err;
-}
-
-
-// ------------------------------------------------------------------
// compareEntries
// ------------------------------------------------------------------
bool compareEntries ( const KeywordData e1,
@@ -1353,16 +1087,16 @@ errlHndl_t checkModSpecificKeyword ( KeywordData i_kwdData,
/*@
* @errortype
- * @reasoncode SPD_NULL_ENTRY
+ * @reasoncode VPD::VPD_NULL_ENTRY
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_CHECK_MODULE_SPECIFIC_KEYWORD
+ * @moduleid VPD::VPD_SPD_CHECK_MODULE_SPECIFIC_KEYWORD
* @userdata1 i_memType
* @userdata2 <UNUSED>
* @devdesc Entry to get Module type is NULL
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_CHECK_MODULE_SPECIFIC_KEYWORD,
- SPD_NULL_ENTRY,
+ VPD::VPD_SPD_CHECK_MODULE_SPECIFIC_KEYWORD,
+ VPD::VPD_NULL_ENTRY,
i_memType,
0x0 );
@@ -1400,9 +1134,9 @@ errlHndl_t checkModSpecificKeyword ( KeywordData i_kwdData,
/*@
* @errortype
- * @reasoncode SPD_MOD_SPECIFIC_MISMATCH_UMM
+ * @reasoncode VPD::VPD_MOD_SPECIFIC_MISMATCH_UMM
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_CHECK_MODULE_SPECIFIC_KEYWORD
+ * @moduleid VPD::VPD_SPD_CHECK_MODULE_SPECIFIC_KEYWORD
* @userdata1[0:31] Module Type (byte 3[3:0])
* @userdata1[32:63] Memory Type (byte 2)
* @userdata2[0:31] SPD Keyword
@@ -1410,8 +1144,8 @@ errlHndl_t checkModSpecificKeyword ( KeywordData i_kwdData,
* @devdesc Keyword requested was not UMM Module specific.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_CHECK_MODULE_SPECIFIC_KEYWORD,
- SPD_MOD_SPECIFIC_MISMATCH_UMM,
+ VPD::VPD_SPD_CHECK_MODULE_SPECIFIC_KEYWORD,
+ VPD::VPD_MOD_SPECIFIC_MISMATCH_UMM,
TWO_UINT32_TO_UINT64( modType, i_memType ),
TWO_UINT32_TO_UINT64( i_kwdData.keyword,
i_kwdData.modSpec ) );
@@ -1433,9 +1167,9 @@ errlHndl_t checkModSpecificKeyword ( KeywordData i_kwdData,
/*@
* @errortype
- * @reasoncode SPD_MOD_SPECIFIC_MISMATCH_RMM
+ * @reasoncode VPD::VPD_MOD_SPECIFIC_MISMATCH_RMM
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_CHECK_MODULE_SPECIFIC_KEYWORD
+ * @moduleid VPD::VPD_SPD_CHECK_MODULE_SPECIFIC_KEYWORD
* @userdata1[0:31] Module Type (byte 3[3:0])
* @userdata1[32:63] Memory Type (byte 2)
* @userdata2[0:31] SPD Keyword
@@ -1443,8 +1177,8 @@ errlHndl_t checkModSpecificKeyword ( KeywordData i_kwdData,
* @devdesc Keyword requested was not RMM Module specific.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_CHECK_MODULE_SPECIFIC_KEYWORD,
- SPD_MOD_SPECIFIC_MISMATCH_RMM,
+ VPD::VPD_SPD_CHECK_MODULE_SPECIFIC_KEYWORD,
+ VPD::VPD_MOD_SPECIFIC_MISMATCH_RMM,
TWO_UINT32_TO_UINT64( modType, i_memType ),
TWO_UINT32_TO_UINT64( i_kwdData.keyword,
i_kwdData.modSpec ) );
@@ -1465,9 +1199,9 @@ errlHndl_t checkModSpecificKeyword ( KeywordData i_kwdData,
/*@
* @errortype
- * @reasoncode SPD_MOD_SPECIFIC_MISMATCH_CMM
+ * @reasoncode VPD::VPD_MOD_SPECIFIC_MISMATCH_CMM
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_CHECK_MODULE_SPECIFIC_KEYWORD
+ * @moduleid VPD::VPD_SPD_CHECK_MODULE_SPECIFIC_KEYWORD
* @userdata1[0:31] Module Type (byte 3[3:0])
* @userdata1[32:63] Memory Type (byte 2)
* @userdata2[0:31] SPD Keyword
@@ -1475,8 +1209,8 @@ errlHndl_t checkModSpecificKeyword ( KeywordData i_kwdData,
* @devdesc Keyword requested was not CMM Module specific.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_CHECK_MODULE_SPECIFIC_KEYWORD,
- SPD_MOD_SPECIFIC_MISMATCH_CMM,
+ VPD::VPD_SPD_CHECK_MODULE_SPECIFIC_KEYWORD,
+ VPD::VPD_MOD_SPECIFIC_MISMATCH_CMM,
TWO_UINT32_TO_UINT64( modType, i_memType ),
TWO_UINT32_TO_UINT64( i_kwdData.keyword,
i_kwdData.modSpec ) );
@@ -1496,9 +1230,9 @@ errlHndl_t checkModSpecificKeyword ( KeywordData i_kwdData,
/*@
* @errortype
- * @reasoncode SPD_MOD_SPECIFIC_MISMATCH_LRMM
+ * @reasoncode VPD::VPD_MOD_SPECIFIC_MISMATCH_LRMM
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_CHECK_MODULE_SPECIFIC_KEYWORD
+ * @moduleid VPD::VPD_SPD_CHECK_MODULE_SPECIFIC_KEYWORD
* @userdata1[0:31] Module Type (byte 3[3:0])
* @userdata1[32:63] Memory Type (byte 2)
* @userdata2[0:31] SPD Keyword
@@ -1506,8 +1240,8 @@ errlHndl_t checkModSpecificKeyword ( KeywordData i_kwdData,
* @devdesc Keyword requested was not LRMM Module specific.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_CHECK_MODULE_SPECIFIC_KEYWORD,
- SPD_MOD_SPECIFIC_MISMATCH_LRMM,
+ VPD::VPD_SPD_CHECK_MODULE_SPECIFIC_KEYWORD,
+ VPD::VPD_MOD_SPECIFIC_MISMATCH_LRMM,
TWO_UINT32_TO_UINT64( modType, i_memType ),
TWO_UINT32_TO_UINT64( i_kwdData.keyword,
i_kwdData.modSpec ) );
@@ -1528,9 +1262,9 @@ errlHndl_t checkModSpecificKeyword ( KeywordData i_kwdData,
/*@
* @errortype
- * @reasoncode SPD_MOD_SPECIFIC_UNSUPPORTED
+ * @reasoncode VPD::VPD_MOD_SPECIFIC_UNSUPPORTED
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_CHECK_MODULE_SPECIFIC_KEYWORD
+ * @moduleid VPD::VPD_SPD_CHECK_MODULE_SPECIFIC_KEYWORD
* @userdata1[0:31] Module Type (byte 3[3:0])
* @userdata1[32:63] Memory Type (byte 2)
* @userdata2[0:31] SPD Keyword
@@ -1538,8 +1272,8 @@ errlHndl_t checkModSpecificKeyword ( KeywordData i_kwdData,
* @devdesc Unsupported Module Specific setup.
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_CHECK_MODULE_SPECIFIC_KEYWORD,
- SPD_MOD_SPECIFIC_UNSUPPORTED,
+ VPD::VPD_SPD_CHECK_MODULE_SPECIFIC_KEYWORD,
+ VPD::VPD_MOD_SPECIFIC_UNSUPPORTED,
TWO_UINT32_TO_UINT64( modType, i_memType ),
TWO_UINT32_TO_UINT64( i_kwdData.keyword,
i_kwdData.modSpec ) );
@@ -1607,16 +1341,16 @@ errlHndl_t getKeywordEntry ( uint64_t i_keyword,
/*@
* @errortype
- * @reasoncode SPD_INVALID_BASIC_MEMORY_TYPE
+ * @reasoncode VPD::VPD_INVALID_BASIC_MEMORY_TYPE
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_GET_KEYWORD_ENTRY
+ * @moduleid VPD::VPD_SPD_GET_KEYWORD_ENTRY
* @userdata1 SPD Keyword
* @userdata2 The DDR Revision
* @devdesc Invalid DDR Revision
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_GET_KEYWORD_ENTRY,
- SPD_INVALID_BASIC_MEMORY_TYPE,
+ VPD::VPD_SPD_GET_KEYWORD_ENTRY,
+ VPD::VPD_INVALID_BASIC_MEMORY_TYPE,
i_keyword,
i_memType );
@@ -1639,16 +1373,16 @@ errlHndl_t getKeywordEntry ( uint64_t i_keyword,
/*@
* @errortype
- * @reasoncode SPD_KEYWORD_NOT_FOUND
+ * @reasoncode VPD::VPD_KEYWORD_NOT_FOUND
* @severity ERRORLOG::ERRL_SEV_UNRECOVERABLE
- * @moduleid SPD_GET_KEYWORD_ENTRY
+ * @moduleid VPD::VPD_SPD_GET_KEYWORD_ENTRY
* @userdata1 SPD Keyword
* @userdata2 <UNUSED>
* @devdesc Invalid SPD Keyword
*/
err = new ERRORLOG::ErrlEntry( ERRORLOG::ERRL_SEV_UNRECOVERABLE,
- SPD_GET_KEYWORD_ENTRY,
- SPD_KEYWORD_NOT_FOUND,
+ VPD::VPD_SPD_GET_KEYWORD_ENTRY,
+ VPD::VPD_KEYWORD_NOT_FOUND,
i_keyword,
0x0 );
diff --git a/src/usr/spd/spd.H b/src/usr/vpd/spd.H
index 83595d5b6..b21d34bf9 100755
--- a/src/usr/spd/spd.H
+++ b/src/usr/vpd/spd.H
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/spd/spd.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_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/vpd/spd.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* */
+/* 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 __SPD_H
#define __SPD_H
@@ -35,7 +34,7 @@
// Includes
// ----------------------------------------------
#include <errl/errlentry.H>
-#include <spd/spdif.H>
+#include "vpd.H"
namespace SPD
{
@@ -357,28 +356,6 @@ errlHndl_t checkModSpecificKeyword ( KeywordData i_kwdData,
TARGETING::Target * i_target );
/**
- * @brief This function will query the PNOR RP to get the offset of the
- * section requested. It will then set global variables to save this
- * value away for later use. This function only needs to be called once.
- *
- * @param[in] i_pnorInfo - Structure of common PNOR information needed to
- * query for the sections address.
- *
- * @param[in/out] io_cachedAddr - This parameter is a gloval variable in the
- * calling code. It is the address that is obtained from the PNOR
- * RP.
- *
- * @param[in] i_mutex - The Mutex from the calling code. It is locked when
- * the globals are modified.
- *
- * @return errlHndl_t - NULL if successful, otherwise a pointer to the
- * Error log.
-*/
-errlHndl_t getPnorAddr ( pnorInformation & i_pnorInfo,
- uint64_t &io_cachedAddr,
- mutex_t * i_mutex );
-
-/**
* @brief This function is used to query the attribute code to get the VPD
* Location value for the target provided.
*
@@ -393,93 +370,6 @@ errlHndl_t getVpdLocation ( int64_t & o_vpdLocation,
TARGETING::Target * i_target );
-/**
- * @brief This function will read the PNOR at the correct offset and number of
- * bytes for the keyword requested.
- *
- * @param[in] i_byteAddr - The offset to access in the PNOR.
- *
- * @param[in] i_numBytes - Number of bytes to read.
- *
- * @param[out] o_data - The data buffer that the read data will be placed
- * into.
- *
- * @param[in] i_target - The chip target to access the data for.
- *
- * @param[in] i_pnorInfo - Information about the PNOR section and side that we
- * need to know to make the request.
- *
- * @param[in/out] io_cachedAddr - The address offset to the data chunk in
- * PNOR.
- *
- * @param[in] i_mutex - The mutex to lock/unlock while setting io_isAddrCached
- * and io_cachedAddr. It is assumed that those parameters are global
- * variables in the code where they reside.
- *
- * @return errlHndl_t - NULL if successful, otherwise a pointer to the error
- * log.
- */
-errlHndl_t readPNOR ( uint64_t i_byteAddr,
- size_t i_numBytes,
- void * o_data,
- TARGETING::Target * i_target,
- pnorInformation & i_pnorInfo,
- uint64_t &io_cachedAddr,
- mutex_t i_mutex );
-
-/**
- * @brief This function will write the PNOR at the correct offset and number
- * of bytes for the keyword requested.
- *
- * @param[in] i_byteAddr - The offset to access in the PNOR.
- *
- * @param[in] i_numBytes - The number of bytes to write.
- *
- * @param[in] i_data - The data buffer of the data to be written.
- *
- * @param[in] i_target - The chip target to access the data for.
- *
- * @param[in] i_pnorInfo - Information about the PNOR section and side that we
- * need to know to make the request.
- *
- * @param[in/out] io_cachedAddr - The address offset to the data chunk in
- * PNOR.
- *
- * @param[in] i_mutex - The mutex to lock/unlock while setting io_isAddrCached
- * and io_cachedAddr. It is assumed that those parameters are global
- * variables in the code where they reside.
- *
- * @return errlHndl_t - NULL if successful, otherwise a pointer to the error
- * log.
- */
-errlHndl_t writePNOR ( uint64_t i_byteAddr,
- size_t i_numBytes,
- void * i_data,
- TARGETING::Target * i_target,
- pnorInformation & i_pnorInfo,
- uint64_t &io_cachedAddr,
- mutex_t * i_mutex );
-
-/**
- * @brief This function handles sending the mailbox message to the Fsp to
- * notify of updates to the data.
- *
- * @param[in] i_offset - The offset into the JEDEC SPD layout.
- *
- * @param[in] i_numbytes - Number of bytes to read.
- *
- * @param[in] i_data - The data buffer that will return the data read.
- *
- * @param[in] i_target - The target DIMM to access.
- *
- * @return errlHndl_t - NULL if successful, otherwise a pointer to the error
- * log.
- */
-errlHndl_t spdSendMboxWriteMsg ( uint64_t i_offset,
- size_t i_numBytes,
- void * i_data,
- TARGETING::Target * i_target );
-
}; // end SPD namespace
#endif // __SPD_H
diff --git a/src/usr/spd/spdDDR3.H b/src/usr/vpd/spdDDR3.H
index 1112a1c79..bc2909312 100755
--- a/src/usr/spd/spdDDR3.H
+++ b/src/usr/vpd/spdDDR3.H
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/spd/spdDDR3.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_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/vpd/spdDDR3.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* */
+/* 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 __SPDDDR3_H
#define __SPDDDR3_H
diff --git a/src/usr/spd/test/dimmPrestest.H b/src/usr/vpd/test/dimmPrestest.H
index cd33f13dd..ff8c3e4cb 100755
--- a/src/usr/spd/test/dimmPrestest.H
+++ b/src/usr/vpd/test/dimmPrestest.H
@@ -1,25 +1,25 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/usr/spd/test/dimmPrestest.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/usr/vpd/test/dimmPrestest.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* */
+/* 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 __DIMMPRESTEST_H
#define __DIMMPRESTEST_H
@@ -36,8 +36,8 @@
#include <devicefw/driverif.H>
#include <targeting/common/predicates/predicates.H>
-#include <spd/spdreasoncodes.H>
-#include <spd/spdenums.H>
+#include <vpd/vpdreasoncodes.H>
+#include <vpd/spdenums.H>
#include "spdtest.H"
#include "../spd.H"
@@ -96,7 +96,7 @@ class DIMMPresTest: public CxxTest::TestSuite
TS_FAIL( "testDimmPres() - Error returned from DIMM Presence "
"Detect call!" );
errlCommit( err,
- SPD_COMP_ID );
+ VPD_COMP_ID );
continue;
}
else if( presentSize != sizeof(present) )
@@ -165,7 +165,7 @@ class DIMMPresTest: public CxxTest::TestSuite
TS_FAIL( "testDimmPresInvalidSize() - Error not flagged for "
"invalid size!" );
errlCommit( err,
- SPD_COMP_ID );
+ VPD_COMP_ID );
continue;
}
else
diff --git a/src/usr/vpd/test/makefile b/src/usr/vpd/test/makefile
new file mode 100644
index 000000000..2ef83c69c
--- /dev/null
+++ b/src/usr/vpd/test/makefile
@@ -0,0 +1,28 @@
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
+#
+# $Source: src/usr/vpd/test/makefile $
+#
+# IBM CONFIDENTIAL
+#
+# COPYRIGHT International Business Machines Corp. 2012,2013
+#
+# 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
+ROOTPATH = ../../../..
+
+MODULE = testvpd
+TESTS = *.H
+
+include ${ROOTPATH}/config.mk
diff --git a/src/usr/mvpd/test/mvpdtest.H b/src/usr/vpd/test/mvpdtest.H
index 059b81c0c..9480f2881 100755
--- a/src/usr/mvpd/test/mvpdtest.H
+++ b/src/usr/vpd/test/mvpdtest.H
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/usr/mvpd/test/mvpdtest.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_TAG
- */
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/vpd/test/mvpdtest.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2012,2013 */
+/* */
+/* 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 __MVPDTEST_H
#define __MVPDTEST_H
@@ -37,8 +36,8 @@
#include <devicefw/driverif.H>
#include <targeting/common/predicates/predicatectm.H>
-#include <mvpd/mvpdenums.H>
-#include <mvpd/mvpdreasoncodes.H>
+#include <vpd/mvpdenums.H>
+#include <vpd/vpdreasoncodes.H>
#include "../mvpd.H"
@@ -334,7 +333,7 @@ class MVPDTest: public CxxTest::TestSuite
theKeyword );
TS_FAIL( "testMvpdRead() - Failure reading keyword size!" );
errlCommit( err,
- MVPD_COMP_ID );
+ VPD_COMP_ID );
continue;
}
@@ -359,7 +358,7 @@ class MVPDTest: public CxxTest::TestSuite
theSize, curCmd );
TS_FAIL( "testMvpdRead() - Failure during MVPD read!" );
errlCommit( err,
- MVPD_COMP_ID );
+ VPD_COMP_ID );
// Free the data
if( NULL != theData )
diff --git a/src/usr/spd/test/spdtest.H b/src/usr/vpd/test/spdtest.H
index a2d8f765d..38b53bf23 100755
--- a/src/usr/spd/test/spdtest.H
+++ b/src/usr/vpd/test/spdtest.H
@@ -1,7 +1,7 @@
/* IBM_PROLOG_BEGIN_TAG */
/* This is an automatically generated prolog. */
/* */
-/* $Source: src/usr/spd/test/spdtest.H $ */
+/* $Source: src/usr/vpd/test/spdtest.H $ */
/* */
/* IBM CONFIDENTIAL */
/* */
@@ -37,8 +37,8 @@
#include <targeting/common/predicates/predicates.H>
#include <targeting/common/utilFilter.H>
-#include <spd/spdreasoncodes.H>
-#include <spd/spdenums.H>
+#include <vpd/vpdreasoncodes.H>
+#include <vpd/spdenums.H>
#include "../spdDDR3.H"
#include "../spd.H"
@@ -120,7 +120,7 @@ class SPDTest: public CxxTest::TestSuite
fails++;
TS_FAIL( "testSpdRead- Failure reading Basic memory type!" );
errlCommit( err,
- SPD_COMP_ID );
+ VPD_COMP_ID );
break;;
}
@@ -179,7 +179,7 @@ class SPDTest: public CxxTest::TestSuite
TS_FAIL( "testSpdRead - Failure on keyword: %04x",
keyword );
errlCommit( err,
- SPD_COMP_ID );
+ VPD_COMP_ID );
continue;
}
@@ -221,6 +221,7 @@ class SPDTest: public CxxTest::TestSuite
uint64_t cmds = 0x0;
uint64_t fails = 0x0;
uint8_t * theData = NULL;
+ uint8_t * origData = NULL;
TRACFCOMP( g_trac_spd,
ENTER_MRK"testSpdWrite()" );
@@ -256,7 +257,7 @@ class SPDTest: public CxxTest::TestSuite
fails++;
TS_FAIL( "testSpdWrite - failed to read memtype!" );
errlCommit( err,
- SPD_COMP_ID );
+ VPD_COMP_ID );
break;
}
@@ -282,7 +283,7 @@ class SPDTest: public CxxTest::TestSuite
memType );
TS_FAIL( "testSpdWrite - Unsupported Memory Type!" );
errlCommit( err,
- SPD_COMP_ID );
+ VPD_COMP_ID );
break;
}
@@ -300,10 +301,13 @@ class SPDTest: public CxxTest::TestSuite
fails++;
TS_FAIL( "testSpdWrite - failed to read DIMM Bad DQ data!" );
errlCommit( err,
- SPD_COMP_ID );
+ VPD_COMP_ID );
break;
}
+ origData = static_cast<uint8_t*>(malloc( theSize ));
+ memcpy( origData, theData, theSize );
+
// Write the data back
err = deviceWrite( theTarget,
theData,
@@ -323,6 +327,30 @@ class SPDTest: public CxxTest::TestSuite
delete err;
err = NULL;
}
+
+ // Read the data out again to check it
+ err = deviceRead( theTarget,
+ theData,
+ theSize,
+ DEVICE_SPD_ADDRESS( DIMM_BAD_DQ_DATA ) );
+
+ if( err )
+ {
+ fails++;
+ TS_FAIL( "testSpdWrite - failed to read DIMM Bad DQ data! [2]" );
+ errlCommit( err,
+ VPD_COMP_ID );
+ break;
+ }
+
+ if( memcmp( theData, origData, theSize ) )
+ {
+ fails++;
+ TS_FAIL( "testSpdWrite - DIMM Bad DQ data does not match what we wrote!" );
+ TRACFBIN( g_trac_spd, "orig=", origData, theSize );
+ TRACFBIN( g_trac_spd, "read=", theData, theSize );
+ }
+
} while( 0 );
if( NULL != theData )
@@ -331,6 +359,12 @@ class SPDTest: public CxxTest::TestSuite
theData = NULL;
}
+ if( NULL != origData )
+ {
+ free( origData );
+ theData = NULL;
+ }
+
TRACFCOMP( g_trac_spd,
"testSpdWrite - %d/%d fails",
fails, cmds );
@@ -564,7 +598,7 @@ class SPDTest: public CxxTest::TestSuite
TS_FAIL( "testspdDDR3ModSpecKwds- Failure reading Basic "
"memory type!" );
errlCommit( err,
- SPD_COMP_ID );
+ VPD_COMP_ID );
break;
}
@@ -580,7 +614,7 @@ class SPDTest: public CxxTest::TestSuite
TS_FAIL( "testspdDDR3ModSpecKwds - Failure reading Module "
"type" );
errlCommit( err,
- SPD_COMP_ID );
+ VPD_COMP_ID );
break;
}
@@ -662,7 +696,7 @@ class SPDTest: public CxxTest::TestSuite
"d: %04x",
keyword );
errlCommit( err,
- SPD_COMP_ID );
+ VPD_COMP_ID );
continue;
}
diff --git a/src/usr/vpd/vpd.C b/src/usr/vpd/vpd.C
new file mode 100644
index 000000000..e23279309
--- /dev/null
+++ b/src/usr/vpd/vpd.C
@@ -0,0 +1,325 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/vpd/vpd.C $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2013 */
+/* */
+/* 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 <trace/interface.H>
+#include <errl/errlentry.H>
+#include <errl/errlmanager.H>
+#include <errl/errludtarget.H>
+#include "vpd.H"
+
+// ----------------------------------------------
+// Trace definitions
+// ----------------------------------------------
+trace_desc_t* g_trac_vpd = NULL;
+TRAC_INIT( & g_trac_vpd, "VPD", KILOBYTE );
+
+namespace VPD
+{
+
+// ------------------------------------------------------------------
+// getVpdLocation
+// ------------------------------------------------------------------
+errlHndl_t getVpdLocation ( int64_t & o_vpdLocation,
+ TARGETING::Target * i_target )
+{
+ errlHndl_t err = NULL;
+
+ TRACSSCOMP( g_trac_spd,
+ ENTER_MRK"getVpdLocation()" );
+
+ o_vpdLocation = i_target->getAttr<TARGETING::ATTR_VPD_REC_NUM>();
+ TRACUCOMP( g_trac_spd,
+ INFO_MRK"Using VPD location: %d",
+ o_vpdLocation );
+
+ TRACSSCOMP( g_trac_spd,
+ EXIT_MRK"getVpdLocation()" );
+
+ return err;
+}
+
+
+// ------------------------------------------------------------------
+// getPnorAddr
+// ------------------------------------------------------------------
+errlHndl_t getPnorAddr ( pnorInformation & i_pnorInfo,
+ uint64_t &io_cachedAddr,
+ mutex_t * i_mutex )
+{
+ errlHndl_t err = NULL;
+ PNOR::SectionInfo_t info;
+
+ TRACSSCOMP( g_trac_vpd,
+ ENTER_MRK"getPnorAddr()" );
+
+ do
+ {
+ // Get SPD PNOR section info from PNOR RP
+ err = PNOR::getSectionInfo( i_pnorInfo.pnorSection,
+ i_pnorInfo.pnorSide,
+ info );
+
+ if( err )
+ {
+ break;
+ }
+
+ // Set the globals appropriately
+ mutex_lock( i_mutex );
+ io_cachedAddr = info.vaddr;
+ mutex_unlock( i_mutex );
+ } while( 0 );
+
+ TRACSSCOMP( g_trac_vpd,
+ EXIT_MRK"getPnorAddr() - addr: 0x%08x",
+ io_cachedAddr );
+
+ return err;
+}
+
+
+// ------------------------------------------------------------------
+// readPNOR
+// ------------------------------------------------------------------
+errlHndl_t readPNOR ( uint64_t i_byteAddr,
+ size_t i_numBytes,
+ void * o_data,
+ TARGETING::Target * i_target,
+ pnorInformation & i_pnorInfo,
+ uint64_t &io_cachedAddr,
+ mutex_t * i_mutex )
+{
+ errlHndl_t err = NULL;
+ int64_t vpdLocation = 0;
+ uint64_t addr = 0x0;
+ const char * readAddr = NULL;
+
+ TRACSSCOMP( g_trac_vpd,
+ ENTER_MRK"readPNOR()" );
+
+ do
+ {
+ // Check if we have the PNOR addr cached.
+ if( 0x0 == io_cachedAddr )
+ {
+ err = getPnorAddr( i_pnorInfo,
+ io_cachedAddr,
+ i_mutex );
+
+ if( err )
+ {
+ break;
+ }
+ }
+ addr = io_cachedAddr;
+
+ // Find vpd location of the target
+ err = getVpdLocation( vpdLocation,
+ i_target );
+
+ if( err )
+ {
+ break;
+ }
+
+ // Offset cached address by vpd location multiplier
+ addr += (vpdLocation * i_pnorInfo.segmentSize);
+
+ // Now offset into that chunk of data by i_byteAddr
+ addr += i_byteAddr;
+
+ TRACUCOMP( g_trac_vpd,
+ INFO_MRK"Address to read: 0x%08x",
+ addr );
+
+ //TODO: Validate write is within bounds of appropriate PNOR
+ // partition/section. RTC: 51807
+
+ // Pull the data
+ readAddr = reinterpret_cast<const char*>( addr );
+ memcpy( o_data,
+ readAddr,
+ i_numBytes );
+ } while( 0 );
+
+ TRACSSCOMP( g_trac_vpd,
+ EXIT_MRK"readPNOR()" );
+
+ return err;
+}
+
+
+// ------------------------------------------------------------------
+// writePNOR
+// ------------------------------------------------------------------
+errlHndl_t writePNOR ( uint64_t i_byteAddr,
+ size_t i_numBytes,
+ void * i_data,
+ TARGETING::Target * i_target,
+ pnorInformation & i_pnorInfo,
+ uint64_t &io_cachedAddr,
+ mutex_t * i_mutex )
+{
+ errlHndl_t err = NULL;
+ int64_t vpdLocation = 0;
+ uint64_t addr = 0x0;
+ const char * writeAddr = NULL;
+
+ TRACSSCOMP( g_trac_vpd,
+ ENTER_MRK"writePNOR()" );
+
+ do
+ {
+ // Check if we have the PNOR addr cached.
+ if( 0x0 == io_cachedAddr )
+ {
+ err = getPnorAddr( i_pnorInfo,
+ io_cachedAddr,
+ i_mutex );
+
+ if( err )
+ {
+ break;
+ }
+ }
+ addr = io_cachedAddr;
+
+ // Find vpd location of the target
+ err = getVpdLocation( vpdLocation,
+ i_target );
+
+ if( err )
+ {
+ break;
+ }
+
+ // Offset cached address by vpd location multiplier
+ addr += (vpdLocation * i_pnorInfo.segmentSize);
+
+ // Now offset into that chunk of data by i_byteAddr
+ addr += i_byteAddr;
+
+ //TODO: Validate write is within bounds of appropriate PNOR
+ // partition/section. RTC: 51807
+
+ TRACUCOMP( g_trac_vpd,
+ INFO_MRK"Address to write: 0x%08x",
+ addr );
+
+ // Write the data
+ writeAddr = reinterpret_cast<const char*>( addr );
+ memcpy( (void*)(writeAddr),
+ i_data,
+ i_numBytes );
+ } while( 0 );
+
+ TRACSSCOMP( g_trac_vpd,
+ EXIT_MRK"writePNOR()" );
+
+ return err;
+}
+
+// ------------------------------------------------------------------
+// sendMboxWriteMsg
+// ------------------------------------------------------------------
+errlHndl_t sendMboxWriteMsg ( size_t i_numBytes,
+ void * i_data,
+ TARGETING::Target * i_target,
+ VPD_MSG_TYPE i_type,
+ VpdWriteMsg_t& i_record )
+{
+ errlHndl_t l_err = NULL;
+ msg_t* msg = NULL;
+
+ TRACSSCOMP( g_trac_vpd,
+ ENTER_MRK"sendMboxWriteMsg()" );
+
+ do
+ {
+ //Create a mailbox message to send to FSP
+ msg = msg_allocate();
+ msg->type = i_type;
+ msg->data[0] = i_record.data0;
+ msg->data[1] = i_numBytes;
+
+ //should never need more than 4KB @fixme
+ assert( i_numBytes < PAGESIZE);
+
+ msg->extra_data = malloc( i_numBytes );
+ memcpy( msg->extra_data, i_data, i_numBytes );
+ TRACFCOMP( g_trac_vpd, "extra_data=%p", msg->extra_data );
+
+ TRACFCOMP( g_trac_vpd,
+ INFO_MRK"Send msg to FSP to write VPD type %.8X, record %d, offset 0x%X",
+ i_type,
+ i_record.rec_num,
+ i_record.offset );
+
+ //Create a mbox message with the error log and send it to FSP
+ //We only send error log to FSP when mailbox is enabled
+ if( !MBOX::mailbox_enabled() )
+ {
+ TRACFCOMP(g_trac_vpd, INFO_MRK "Mailbox is disabled, skipping VPD write");
+ TRACFBIN( g_trac_vpd, "msg=", msg, sizeof(msg_t) );
+ TRACFBIN( g_trac_vpd, "extra=", msg->extra_data, i_numBytes );
+ }
+
+ l_err = MBOX::send( MBOX::FSP_VPD_MSGQ, msg );
+ if( l_err )
+ {
+ TRACFCOMP(g_trac_vpd,
+ ERR_MRK "Failed sending VPD to FSP for %.8X",
+ TARGETING::get_huid(i_target));
+ ERRORLOG::ErrlUserDetailsTarget(i_target).addToLog(l_err);
+
+ l_err->collectTrace("VPD",1024);
+ if( VPD_WRITE_DIMM == i_type )
+ {
+ l_err->collectTrace("SPD",1024);
+ }
+ else if( VPD_WRITE_PROC == i_type )
+ {
+ l_err->collectTrace("MVPD",1024);
+ }
+ else if( VPD_WRITE_MEMBUF == i_type )
+ {
+ //l_err->collectTrace("CVPD",1024); @TODO-Fill in with RTC:44009
+ }
+
+ // just commit the log and move on, nothing else to do
+ errlCommit( l_err, VPD_COMP_ID );
+ l_err = NULL;
+
+ free( msg->extra_data );
+ msg->extra_data = NULL;
+ msg_free( msg );
+ }
+ } while( 0 );
+
+ TRACSSCOMP( g_trac_vpd,
+ EXIT_MRK"sendMboxWriteMsg()" );
+
+ return l_err;
+}
+
+
+}; //end VPD namespace
diff --git a/src/usr/vpd/vpd.H b/src/usr/vpd/vpd.H
new file mode 100644
index 000000000..20ff3d908
--- /dev/null
+++ b/src/usr/vpd/vpd.H
@@ -0,0 +1,204 @@
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/usr/vpd/vpd.H $ */
+/* */
+/* IBM CONFIDENTIAL */
+/* */
+/* COPYRIGHT International Business Machines Corp. 2013 */
+/* */
+/* 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 __VPD_H
+#define __VPD_H
+
+#include <pnor/pnorif.H>
+
+// ------------------------
+// Macros for unit testing
+//#define TRACUCOMP(args...) TRACFCOMP(args)
+#define TRACUCOMP(args...)
+//#define TRACSSCOMP(args...) TRACFCOMP(args)
+#define TRACSSCOMP(args...)
+
+namespace VPD
+{
+
+/**
+ * @brief This structure is used to transfer common information needed
+ * for reading the address from the PNOR RP.
+ */
+struct pnorInformation
+{
+ uint64_t segmentSize;
+ uint64_t maxSegments;
+ PNOR::SectionId pnorSection;
+ PNOR::SideSelect pnorSide;
+};
+
+/**
+ * @brief VPD Message Types
+ */
+enum VPD_MSG_TYPE
+{
+ VPD_WRITE_DIMM = 0x00C1, //< DIMM SPD
+ VPD_WRITE_PROC = 0x00C2, //< Processor MVPD
+ VPD_WRITE_MEMBUF = 0x00C3, //< Centaur FRU VPD
+};
+
+/**
+ * @brief Message definition for VPD Write Request
+ *
+ * - data0 :
+ * - [16] VPD Record Number
+ * - [32] 4-byte ASCII String for record name
+ * 'XXXX'=Entire VPD section from PNOR
+ * - [16] 2-byte ASCII String for keyword or offset into SPD
+ * 'XX'=Entire VPD record
+ * - data1 :
+ * - [64] Size of binary data in bytes
+ * - extra data : Binary VPD Data
+ */
+union VpdWriteMsg_t
+{
+ uint64_t data0;
+ struct
+ {
+ uint16_t rec_num; //< VPD_REC_NUM
+ char record[4]; //< ASCII Record Name
+ union
+ {
+ char keyword[2]; //< ASCII Keyword (for IBM VPD)
+ uint16_t offset; //< Offset into record in bytes (for DIMM SPD)
+ };
+ } PACKED;
+};
+
+
+/**
+ * @brief This function will query the PNOR RP to get the offset of the
+ * section requested. It will then set global variables to save this
+ * value away for later use. This function only needs to be called once.
+ *
+ * @param[in] i_pnorInfo - Structure of common PNOR information needed to
+ * query for the sections address.
+ *
+ * @param[in/out] io_cachedAddr - This parameter is a gloval variable in the
+ * calling code. It is the address that is obtained from the PNOR
+ * RP.
+ *
+ * @param[in] i_mutex - The Mutex from the calling code. It is locked when
+ * the globals are modified.
+ *
+ * @return errlHndl_t - NULL if successful, otherwise a pointer to the
+ * Error log.
+*/
+errlHndl_t getPnorAddr ( pnorInformation & i_pnorInfo,
+ uint64_t &io_cachedAddr,
+ mutex_t * i_mutex );
+
+/**
+ * @brief This function will read the PNOR at the correct offset and number of
+ * bytes for the keyword requested.
+ *
+ * @param[in] i_byteAddr - The offset to access in the PNOR.
+ *
+ * @param[in] i_numBytes - Number of bytes to read.
+ *
+ * @param[out] o_data - The data buffer that the read data will be placed
+ * into.
+ *
+ * @param[in] i_target - The chip target to access the data for.
+ *
+ * @param[in] i_pnorInfo - Information about the PNOR section and side that we
+ * need to know to make the request.
+ *
+ * @param[in/out] io_cachedAddr - The address offset to the data chunk in
+ * PNOR.
+ *
+ * @param[in] i_mutex - The mutex to lock/unlock while setting io_isAddrCached
+ * and io_cachedAddr. It is assumed that those parameters are global
+ * variables in the code where they reside.
+ *
+ * @return errlHndl_t - NULL if successful, otherwise a pointer to the error
+ * log.
+ */
+errlHndl_t readPNOR ( uint64_t i_byteAddr,
+ size_t i_numBytes,
+ void * o_data,
+ TARGETING::Target * i_target,
+ pnorInformation & i_pnorInfo,
+ uint64_t &io_cachedAddr,
+ mutex_t* i_mutex );
+
+/**
+ * @brief This function will write the PNOR at the correct offset and number
+ * of bytes for the keyword requested.
+ *
+ * @param[in] i_byteAddr - The offset to access in the PNOR.
+ *
+ * @param[in] i_numBytes - The number of bytes to write.
+ *
+ * @param[in] i_data - The data buffer of the data to be written.
+ *
+ * @param[in] i_target - The chip target to access the data for.
+ *
+ * @param[in] i_pnorInfo - Information about the PNOR section and side that we
+ * need to know to make the request.
+ *
+ * @param[in/out] io_cachedAddr - The address offset to the data chunk in
+ * PNOR.
+ *
+ * @param[in] i_mutex - The mutex to lock/unlock while setting io_isAddrCached
+ * and io_cachedAddr. It is assumed that those parameters are global
+ * variables in the code where they reside.
+ *
+ * @return errlHndl_t - NULL if successful, otherwise a pointer to the error
+ * log.
+ */
+errlHndl_t writePNOR ( uint64_t i_byteAddr,
+ size_t i_numBytes,
+ void * i_data,
+ TARGETING::Target * i_target,
+ pnorInformation & i_pnorInfo,
+ uint64_t &io_cachedAddr,
+ mutex_t* i_mutex );
+
+/**
+ * @brief This function handles sending the mailbox message to the Fsp to
+ * notify of updates to the data.
+ *
+ * @param[in] i_numbytes - Number of bytes to read.
+ *
+ * @param[in] i_data - The data buffer that will return the data read.
+ *
+ * @param[in] i_target - The target to access.
+ *
+ * @param[in] i_type - The type of VPD being written.
+ *
+ * @param[in] i_record - The rec_num + record/keyword.
+ *
+ * @return errlHndl_t - NULL if successful, otherwise a pointer to the error
+ * log.
+ */
+errlHndl_t sendMboxWriteMsg ( size_t i_numBytes,
+ void * i_data,
+ TARGETING::Target * i_target,
+ VPD_MSG_TYPE i_type,
+ VpdWriteMsg_t& i_record );
+
+
+}; //end VPD namespace
+
+#endif
OpenPOWER on IntegriCloud