summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/kernel/intmsghandler.H50
-rw-r--r--src/include/sys/interrupt.h41
-rw-r--r--src/include/sys/msg.h60
-rw-r--r--src/include/sys/vfs.h46
-rw-r--r--src/include/usr/intr/interrupt.H46
-rw-r--r--src/kernel/intmsghandler.C127
-rw-r--r--src/kernel/syscall.C9
-rw-r--r--src/lib/syscall_msg.C105
-rw-r--r--src/usr/intr/intrrp.C34
-rw-r--r--src/usr/intr/intrrp.H6
10 files changed, 263 insertions, 261 deletions
diff --git a/src/include/kernel/intmsghandler.H b/src/include/kernel/intmsghandler.H
index 500961668..b4042c950 100644
--- a/src/include/kernel/intmsghandler.H
+++ b/src/include/kernel/intmsghandler.H
@@ -1,25 +1,25 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/kernel/intmsghandler.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/kernel/intmsghandler.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 __KERNEL_INTERRUPTMSGHDLR_H
#define __KERNEL_INTERRUPTMSGHDLR_H
@@ -75,7 +75,7 @@ class InterruptMsgHdlr : public MessageHandler
* Constructor
*/
InterruptMsgHdlr(MessageQueue * i_msgQ)
- : MessageHandler(NULL,i_msgQ) {} // TODO need splinlock?
+ : MessageHandler(NULL,i_msgQ) {}
/**
* Destructor.
@@ -120,8 +120,9 @@ class InterruptMsgHdlr : public MessageHandler
/**
* Create the InterruptMsgHdlr to handle external interrupts
* @param[in] i_msgQ The message queue
+ * @param[in] i_ipc_addr The base address of the IPC registers
*/
- static void create(MessageQueue * i_msgQ);
+ static void create(MessageQueue * i_msgQ, uint64_t i_ipc_addr);
/**
* Handle an external interrupt from HW
@@ -138,6 +139,7 @@ class InterruptMsgHdlr : public MessageHandler
private:
static InterruptMsgHdlr * cv_instance;
+ static uint64_t cv_ipc_base_address;
};
diff --git a/src/include/sys/interrupt.h b/src/include/sys/interrupt.h
deleted file mode 100644
index 40e0e2bf8..000000000
--- a/src/include/sys/interrupt.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/include/sys/interrupt.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
- */
-#ifndef __INTERRUPT_H
-#define __INTERRUPT_H
-
-
-extern const char* INTR_MSGQ;
-
-/**
- * INTR constants
- */
-enum
-{
- ICPBAR_EN = 30, // BIT 30
- ICPBAR_SCOM_ADDR = 0x020109ca, //!< for P8, P7 = 0x02011C09
- // This BAR value agrees with simics (for now)
- ICPBAR_VAL = 0x3FFFF800, //!< ICPBAR value bits[0:29]>>34
-};
-
-#endif
diff --git a/src/include/sys/msg.h b/src/include/sys/msg.h
index 129d0c36b..9fadd8b70 100644
--- a/src/include/sys/msg.h
+++ b/src/include/sys/msg.h
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/include/sys/msg.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/sys/msg.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 __SYS_MSG_H
#define __SYS_MSG_H
@@ -141,10 +140,23 @@ void msg_q_destroy( msg_q_t q );
* @param[in] q - handle of message queue to name
* @param[in] name - name
*
- * @return Result of msg_sendrecv where zero indicates success
+ * @return Result of the syscall where zero indicates success
*/
int msg_q_register(msg_q_t q, const char* name);
+/** @fn msg_intr_q_register
+ * @brief Register the interrupt message queue
+ *
+ * @param[in] q - handle of message queue to register
+ * @param[in] i_ipc_base_addr Is the base MMIO address of the
+ * IPC register set
+ *
+ * @return Result of the syscall where zero indicates success
+ * < 0 is the ERRNO
+ */
+int msg_intr_q_register(msg_q_t q,
+ uint64_t i_ipc_base_addr);
+
/** @fn msg_q_remove
* @brief Remove a message queue from the registry
*
diff --git a/src/include/sys/vfs.h b/src/include/sys/vfs.h
index b4b7da594..224422ffa 100644
--- a/src/include/sys/vfs.h
+++ b/src/include/sys/vfs.h
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/include/sys/vfs.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/sys/vfs.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 __SYS_VFS_H
#define __SYS_VFS_H
@@ -64,6 +63,7 @@ extern const char* VFS_ROOT_BIN;
extern const char* VFS_ROOT_DATA;
extern const char* VFS_ROOT_MSG;
extern const char* VFS_ROOT_MSG_VFS;
+extern const char* VFS_ROOT_MSG_INTR;
enum VfsMessages
{
diff --git a/src/include/usr/intr/interrupt.H b/src/include/usr/intr/interrupt.H
index 751cedc07..67b984c4e 100644
--- a/src/include/usr/intr/interrupt.H
+++ b/src/include/usr/intr/interrupt.H
@@ -1,32 +1,30 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/include/usr/intr/interrupt.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/intr/interrupt.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 INTERRUPT_H
#define INTERRUPT_H
#include <sys/msg.h>
#include <errl/errlentry.H>
-#include <sys/interrupt.h>
namespace INTR
{
diff --git a/src/kernel/intmsghandler.C b/src/kernel/intmsghandler.C
index 73d14e787..a2f2fb096 100644
--- a/src/kernel/intmsghandler.C
+++ b/src/kernel/intmsghandler.C
@@ -1,31 +1,29 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/kernel/intmsghandler.C $
- *
- * 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/kernel/intmsghandler.C $ */
+/* */
+/* 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 <kernel/intmsghandler.H>
#include <sys/msg.h>
#include <util/singleton.H>
#include <kernel/console.H>
-#include <sys/interrupt.h>
#include <util/lockfree/atomic_construct.H>
#include <kernel/task.H>
#include <kernel/taskmgr.H>
@@ -33,13 +31,14 @@
#include <kernel/scheduler.H>
#include <arch/ppc.H>
-const char* INTR_MSGQ = "/msg/interrupt";
+const char* VFS_ROOT_MSG_INTR = "/msg/interrupt";
InterruptMsgHdlr * InterruptMsgHdlr::cv_instance = NULL;
+uint64_t InterruptMsgHdlr::cv_ipc_base_address = 0;
-
-void InterruptMsgHdlr::create(MessageQueue * i_msgQ)
+void InterruptMsgHdlr::create(MessageQueue * i_msgQ, uint64_t i_ipc_addr)
{
+ cv_ipc_base_address = i_ipc_addr;
if(cv_instance)
{
// TODO should this be considered an unrecoverable error?
@@ -75,42 +74,58 @@ void InterruptMsgHdlr::handleInterrupt()
{
uint64_t pir = getPIR();
- uint64_t xirrAddress = (static_cast<uint64_t>(ICPBAR_VAL) << 20);
+ if( cv_ipc_base_address != 0 )
+ {
+ uint64_t xirrAddress = cv_ipc_base_address;
- xirrAddress += mmio_offset(pir); // Add offset for this cpu
- xirrAddress += XIRR_ADDR_OFFSET; // Add offset for XIRR register
+ xirrAddress += mmio_offset(pir); // Add offset for this cpu
+ xirrAddress += XIRR_ADDR_OFFSET; // Add offset for XIRR register
- // Ignore HRMOR setting
- xirrAddress |= 0x8000000000000000ul;
+ // Ignore HRMOR setting
+ xirrAddress |= 0x8000000000000000ul;
- uint32_t xirr = 0;
- printkd ("XirrAddr %lx\n",xirrAddress);
+ uint32_t xirr = 0;
+ printkd ("XirrAddr %lx\n",xirrAddress);
- // Reading this register acknowledges the interrupt and deactivates the
- // external interrupt signal to the processor. The XIRR is now locked
- // and can't be pre-empted by a "more favored" interrupt.
- // This is a cache-inhibited load from hypervisor state.
- // lwzcix BOP1,Ref_G0,BOP2
- asm volatile("lwzcix %0, 0, %1"
- : "=r" (xirr) // output, %0
- : "r" (xirrAddress) // input, %1
- : ); // no impacts
+ // Reading this register acknowledges the interrupt and deactivates the
+ // external interrupt signal to the processor. The XIRR is now locked
+ // and can't be pre-empted by a "more favored" interrupt.
+ // This is a cache-inhibited load from hypervisor state.
+ // lwzcix BOP1,Ref_G0,BOP2
+ asm volatile("lwzcix %0, 0, %1"
+ : "=r" (xirr) // output, %0
+ : "r" (xirrAddress) // input, %1
+ : ); // no impacts
- if(cv_instance)
- {
- cv_instance->sendMessage(MSG_INTR_EXTERN,
- (void *)pir,
- (void *)xirr,
- NULL);
+ if(cv_instance)
+ {
+ cv_instance->sendMessage(MSG_INTR_EXTERN,
+ (void *)pir,
+ (void *)xirr,
+ NULL);
+ }
}
- // else we got an external interrupt before we got things set up.
- // TODO Is there anything that can be done other than
- // leave the interrupt presenter locked.
- // Does the code that sets up the IP registers need to check to see if
- // there is an interrupt sitting there and send an EOI?
- // Story 41868 - Mask off all interrupts very early - might
- // resolve this TODO.
+ if(cv_ipc_base_address == 0 || cv_instance == NULL)
+ {
+ static bool hit = false;
+
+ // print the message once
+ if(!hit)
+ {
+ printk("InterrurptMsgHdlr got called before IPC was setup\n");
+ hit = true;
+ }
+
+
+ // else we got an external interrupt before we got things set up.
+ // TODO Is there anything that can be done other than
+ // leave the interrupt presenter locked.
+ // Does the code that sets up the IP registers need to check to see if
+ // there is an interrupt sitting there and send an EOI?
+ // Story 41868 - Mask off all interrupts very early - might
+ // resolve this TODO.
+ }
}
diff --git a/src/kernel/syscall.C b/src/kernel/syscall.C
index b2a72d420..9ef1e36b3 100644
--- a/src/kernel/syscall.C
+++ b/src/kernel/syscall.C
@@ -272,9 +272,12 @@ namespace Systemcalls
break;
case MSGQ_ROOT_INTR:
- msgQIntr = (MessageQueue*) TASK_GETARG1(t);
- InterruptMsgHdlr::create(msgQIntr);
- TASK_SETRTN(t,0);
+ {
+ msgQIntr = (MessageQueue*) TASK_GETARG1(t);
+ uint64_t ipc_addr = (uint64_t) TASK_GETARG2(t);
+ InterruptMsgHdlr::create(msgQIntr,ipc_addr);
+ TASK_SETRTN(t,0);
+ }
break;
default:
diff --git a/src/lib/syscall_msg.C b/src/lib/syscall_msg.C
index b35f6eef1..907edf19a 100644
--- a/src/lib/syscall_msg.C
+++ b/src/lib/syscall_msg.C
@@ -1,30 +1,29 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/lib/syscall_msg.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 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/lib/syscall_msg.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 <sys/msg.h>
-#include <sys/interrupt.h>
#include <sys/syscall.h>
#include <sys/vfs.h>
+#include <errno.h>
#include <string.h>
@@ -44,30 +43,34 @@ int msg_q_register(msg_q_t q, const char* name)
{
if (0 == strcmp(VFS_ROOT, name))
{
- return (int64_t)_syscall2(MSGQ_REGISTER_ROOT,
- reinterpret_cast<void*>(MSGQ_ROOT_VFS),
- q);
- }
- else if (0 == strcmp(INTR_MSGQ, name))
- {
return (int64_t)_syscall2(MSGQ_REGISTER_ROOT,
- reinterpret_cast<void*>(MSGQ_ROOT_INTR),
+ reinterpret_cast<void*>(MSGQ_ROOT_VFS),
q);
}
else
{
- msg_q_t vfsQ = (msg_q_t)_syscall1(MSGQ_RESOLVE_ROOT,
- reinterpret_cast<void*>(MSGQ_ROOT_VFS));
- msg_t* msg = msg_allocate();
- msg->type = VFS_MSG_REGISTER_MSGQ;
- msg->data[0] = (uint64_t) q;
- msg->extra_data = (void*) name;
- int rc = msg_sendrecv(vfsQ, msg);
- msg_free(msg);
- return rc;
+ msg_q_t vfsQ = (msg_q_t)_syscall1(MSGQ_RESOLVE_ROOT,
+ reinterpret_cast<void*>(MSGQ_ROOT_VFS));
+ msg_t* msg = msg_allocate();
+ msg->type = VFS_MSG_REGISTER_MSGQ;
+ msg->data[0] = (uint64_t) q;
+ msg->extra_data = (void*) name;
+ int rc = msg_sendrecv(vfsQ, msg);
+ msg_free(msg);
+ return rc;
}
}
+int msg_intr_q_register(msg_q_t q, uint64_t i_ipc_base_addr)
+{
+ int rc = (int64_t)_syscall3(MSGQ_REGISTER_ROOT,
+ reinterpret_cast<void*>(MSGQ_ROOT_INTR),
+ q,
+ reinterpret_cast<void*>(i_ipc_base_addr));
+
+ return rc;
+}
+
int msg_q_remove(const char * name)
{
msg_q_t vfsQ = (msg_q_t)_syscall1(MSGQ_RESOLVE_ROOT,
@@ -85,25 +88,25 @@ msg_q_t msg_q_resolve(const char* name)
{
if (0 == strcmp(VFS_ROOT, name))
{
- return (msg_q_t)_syscall1(MSGQ_RESOLVE_ROOT,
+ return (msg_q_t)_syscall1(MSGQ_RESOLVE_ROOT,
reinterpret_cast<void*>(MSGQ_ROOT_VFS));
}
- else if (0 == strcmp(INTR_MSGQ, name))
+ else if (0 == strcmp(VFS_ROOT_MSG_INTR, name))
{
return (msg_q_t)_syscall1(MSGQ_RESOLVE_ROOT,
reinterpret_cast<void*>(MSGQ_ROOT_INTR));
}
else
{
- msg_q_t vfsQ = (msg_q_t)_syscall1(MSGQ_RESOLVE_ROOT,
- reinterpret_cast<void*>(MSGQ_ROOT_VFS));
- msg_t* msg = msg_allocate();
- msg->type = VFS_MSG_RESOLVE_MSGQ;
- msg->extra_data = (void*) name;
- msg_sendrecv(vfsQ, msg);
- msg_q_t rc = (msg_q_t) msg->data[0];
- msg_free(msg);
- return rc;
+ msg_q_t vfsQ = (msg_q_t)_syscall1(MSGQ_RESOLVE_ROOT,
+ reinterpret_cast<void*>(MSGQ_ROOT_VFS));
+ msg_t* msg = msg_allocate();
+ msg->type = VFS_MSG_RESOLVE_MSGQ;
+ msg->extra_data = (void*) name;
+ msg_sendrecv(vfsQ, msg);
+ msg_q_t rc = (msg_q_t) msg->data[0];
+ msg_free(msg);
+ return rc;
}
}
diff --git a/src/usr/intr/intrrp.C b/src/usr/intr/intrrp.C
index 3fb75d6ac..2d52f1432 100644
--- a/src/usr/intr/intrrp.C
+++ b/src/usr/intr/intrrp.C
@@ -41,6 +41,7 @@
#include <targeting/common/attributes.H>
#include <devicefw/userif.H>
#include <sys/time.h>
+#include <sys/vfs.h>
#define INTR_TRACE_NAME INTR_COMP_NAME
@@ -49,7 +50,6 @@ using namespace INTR;
trace_desc_t * g_trac_intr = NULL;
TRAC_INIT(&g_trac_intr, INTR_TRACE_NAME, 2 * 1024);
-
/**
* setup _start and handle barrier
*/
@@ -105,8 +105,14 @@ errlHndl_t IntrRp::_init()
// that would have the lowest BAR value in the system,
// whether it exists or not. In this case n0p0
- // [14:43] is BAR field in address to shift by (34 - 14)
- uint64_t realAddr = (static_cast<uint64_t>(ICPBAR_VAL)) << 20;
+ TARGETING::Target* procTarget = NULL;
+ TARGETING::targetService().masterProcChipTargetHandle( procTarget );
+
+ uint64_t barValue = 0;
+ procTarget->tryGetAttr<TARGETING::ATTR_INTP_BASE_ADDR>(barValue);
+
+ // Mask off node & chip id to get base address
+ uint64_t realAddr = barValue & ICPBAR_BASE_ADDRESS_MASK;
TRACFCOMP(g_trac_intr,"INTR: realAddr = %lx",realAddr);
@@ -117,9 +123,6 @@ errlHndl_t IntrRp::_init()
TRACFCOMP(g_trac_intr,"INTR: vAddr = %lx",iv_baseAddr);
// Set the BAR scom reg
- TARGETING::Target* procTarget = NULL;
- TARGETING::targetService().masterProcChipTargetHandle( procTarget );
-
err = setBAR(procTarget,iv_masterCpu);
if(!err)
@@ -148,7 +151,7 @@ errlHndl_t IntrRp::_init()
// Get the kernel msg queue for ext intr
// Create a task to handle the messages
iv_msgQ = msg_q_create();
- msg_q_register(iv_msgQ, INTR_MSGQ);
+ msg_intr_q_register(iv_msgQ, realAddr);
task_create(IntrRp::msg_handler, NULL);
@@ -426,9 +429,10 @@ errlHndl_t IntrRp::setBAR(TARGETING::Target * i_target,
{
errlHndl_t err = NULL;
- uint64_t barValue = static_cast<uint64_t>(ICPBAR_VAL) +
- (8 * i_pir.nodeId) + i_pir.chipId;
- barValue <<= 34;
+ uint64_t barValue = 0;
+ i_target->tryGetAttr<TARGETING::ATTR_INTP_BASE_ADDR>(barValue);
+
+ barValue <<= 14;
barValue |= 1ULL << (63 - ICPBAR_EN);
TRACFCOMP(g_trac_intr,"INTR: Target %p. ICPBAR value: 0x%016lx",
@@ -674,7 +678,7 @@ errlHndl_t INTR::registerMsgQ(msg_q_t i_msgQ,
errlHndl_t err = NULL;
// Can't add while handling an interrupt, so
// send msg instead of direct call
- msg_q_t intr_msgQ = msg_q_resolve(INTR_MSGQ);
+ msg_q_t intr_msgQ = msg_q_resolve(VFS_ROOT_MSG_INTR);
if(intr_msgQ)
{
msg_t * msg = msg_allocate();
@@ -726,7 +730,7 @@ errlHndl_t INTR::registerMsgQ(msg_q_t i_msgQ,
msg_q_t INTR::unRegisterMsgQ(ext_intr_t i_type)
{
msg_q_t msgQ = NULL;
- msg_q_t intr_msgQ = msg_q_resolve(INTR_MSGQ);
+ msg_q_t intr_msgQ = msg_q_resolve(VFS_ROOT_MSG_INTR);
if(intr_msgQ)
{
msg_t * msg = msg_allocate();
@@ -758,8 +762,8 @@ msg_q_t INTR::unRegisterMsgQ(ext_intr_t i_type)
errlHndl_t INTR::enableExternalInterrupts()
{
errlHndl_t err = NULL;
- msg_q_t intr_msgQ = msg_q_resolve(INTR_MSGQ);
- if(intr_msgQ)
+ msg_q_t intr_msgQ = msg_q_resolve(VFS_ROOT_MSG_INTR);
+ if(intr_msgQ)
{
msg_t * msg = msg_allocate();
msg->type = MSG_INTR_ENABLE;
@@ -800,7 +804,7 @@ errlHndl_t INTR::disableExternalInterrupts()
{
errlHndl_t err = NULL;
// Can't disable while handling interrupt, so send msg to serialize
- msg_q_t intr_msgQ = msg_q_resolve(INTR_MSGQ);
+ msg_q_t intr_msgQ = msg_q_resolve(VFS_ROOT_MSG_INTR);
if(intr_msgQ)
{
msg_t * msg = msg_allocate();
diff --git a/src/usr/intr/intrrp.H b/src/usr/intr/intrrp.H
index c2ed0d30b..d8c01208b 100644
--- a/src/usr/intr/intrrp.H
+++ b/src/usr/intr/intrrp.H
@@ -89,6 +89,12 @@ namespace INTR
LINKB_OFFSET = 20, //!< offset to LINKB register
LINKC_OFFSET = 24, //!< offset to LINKC register
XISR_MASK = 0x00FFFFFF, //!< XISR MASK in XIRR register
+
+ ICPBAR_EN = 30, //!< BAR enable bit pos
+ ICPBAR_SCOM_ADDR = 0x020109ca, //!< ICP BAR scom address
+
+ // MASK base ICP address
+ ICPBAR_BASE_ADDRESS_MASK = 0xFFFFFFFFFC000000ULL,
};
// If the interrupt can't be handled by the current chip there are
OpenPOWER on IntegriCloud