summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorDan Crowell <dcrowell@us.ibm.com>2012-08-10 14:48:06 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-09-16 15:09:40 -0500
commit2f50c376a718ea6542b42e029a6735f719a8f407 (patch)
treef54c4c46d71f1a3226a3e12e69664614ce4db138 /src/include
parenta0206bc94f427a1a4e3913fa9122b5530c5500ad (diff)
downloadblackbird-hostboot-2f50c376a718ea6542b42e029a6735f719a8f407.tar.gz
blackbird-hostboot-2f50c376a718ea6542b42e029a6735f719a8f407.zip
Support for Non-zero HRMOR
Changes to kernel code to support detection and use of HRMOR offset in memory Changes to tooling to handle the real memory offset New interface to retrieve the physical address that corresponds to a virtual address To test, run these commands before starting up Hostboot: system_cmp0.cpu0_0_05_0.write-reg HRMOR 0x8000000 proc_venicechip_cmp0.phys_mem.del-map p8Proc0.l3_cache_ram 0 0 RTC: 46032 Change-Id: I50ab248f941218a3a14a8f0fc12a551b56dc7cf3 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/1553 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/kernel/devicesegment.H53
-rw-r--r--src/include/kernel/ptmgr.H52
-rw-r--r--src/include/kernel/syscalls.H48
-rw-r--r--src/include/kernel/vmmmgr.H69
-rw-r--r--src/include/sys/mm.h56
5 files changed, 160 insertions, 118 deletions
diff --git a/src/include/kernel/devicesegment.H b/src/include/kernel/devicesegment.H
index 2b87c9161..c010ffba8 100644
--- a/src/include/kernel/devicesegment.H
+++ b/src/include/kernel/devicesegment.H
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/include/kernel/devicesegment.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/kernel/devicesegment.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_DEVICESEGMENT_H
#define __KERNEL_DEVICESEGMENT_H
@@ -81,6 +80,14 @@ class DeviceSegment : public Segment
*/
int devUnmap(void* ea);
+ /**
+ * @brief Locate the physical address of the given virtual address
+ * @param[in] i_vaddr virtual address
+ * @return the physical address bound to the virtual address, or
+ * -EFAULT if i_vaddr not found. @see errno.h
+ */
+ uint64_t findPhysicalAddress(uint64_t i_vaddr) const;
+
private:
/**
* Attributes to represent a mapped device within a segment block
diff --git a/src/include/kernel/ptmgr.H b/src/include/kernel/ptmgr.H
index b570e0d14..ba86bf965 100644
--- a/src/include/kernel/ptmgr.H
+++ b/src/include/kernel/ptmgr.H
@@ -1,25 +1,25 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/kernel/ptmgr.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/ptmgr.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_PTMGR_H
#define __KERNEL_PTMGR_H
@@ -121,15 +121,19 @@ class PageTableManager
*
* @param[in] i_pnStart First Physical Page to remove (page number)
* @param[in] i_pnFinish Last Physical Page to remove (page number)
+ * @param[in] i_applyHRMOR If true then the HRMOR is applied to the
+ * page numbers, MMIOs should set to false
*/
static void delRangePN( uint64_t i_pnStart,
- uint64_t i_pnFinish );
+ uint64_t i_pnFinish,
+ bool i_applyHRMOR = true );
/**
* @brief Return status information about an entry in the hardware page table
*
* @param[in] i_vAddr Virtual Address within the page to be queried (full address)
- * @param[out] o_pn Real physical page number to map to, INVALID_PN if PTE is invalid
+ * @param[out] o_pn Real physical page number va is mapped to,
+ * INVALID_PN if PTE is invalid
*
* @return uint64_t ORed combination of status flags
*/
diff --git a/src/include/kernel/syscalls.H b/src/include/kernel/syscalls.H
index b02fd2216..f31526868 100644
--- a/src/include/kernel/syscalls.H
+++ b/src/include/kernel/syscalls.H
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/include/kernel/syscalls.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/kernel/syscalls.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 */
/** @file syscalls.H
* @brief Defines all the system call IDs to be shared between the kernel and
* the system libc.
@@ -108,6 +107,9 @@ namespace Systemcalls
/** mm_alloc_pages() */
MM_ALLOC_PAGES,
+ /** mm_virt_to_phys() */
+ MM_VIRT_TO_PHYS,
+
SYSCALL_MAX
};
diff --git a/src/include/kernel/vmmmgr.H b/src/include/kernel/vmmmgr.H
index 8a8fb6103..0c11ffeb8 100644
--- a/src/include/kernel/vmmmgr.H
+++ b/src/include/kernel/vmmmgr.H
@@ -1,25 +1,25 @@
-// IBM_PROLOG_BEGIN_TAG
-// This is an automatically generated prolog.
-//
-// $Source: src/include/kernel/vmmmgr.H $
-//
-// IBM CONFIDENTIAL
-//
-// COPYRIGHT International Business Machines Corp. 2010 - 2011
-//
-// p1
-//
-// Object Code Only (OCO) source materials
-// Licensed Internal Code Source Materials
-// IBM HostBoot Licensed Internal Code
-//
-// The source code for this program is not published or other-
-// wise divested of its trade secrets, irrespective of what has
-// been deposited with the U.S. Copyright Office.
-//
-// Origin: 30
-//
-// IBM_PROLOG_END
+/* IBM_PROLOG_BEGIN_TAG */
+/* This is an automatically generated prolog. */
+/* */
+/* $Source: src/include/kernel/vmmmgr.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 __KERNEL_VMMMGR_H
#define __KERNEL_VMMMGR_H
@@ -29,6 +29,7 @@
#include <kernel/types.h>
#include <kernel/spinlock.H>
+
class MessageQueue;
class VmmManager
@@ -43,12 +44,16 @@ class VmmManager
// put the Page Table at the end of our memory space
PTSIZE = (1 << 18),
- HTABORG = (FULL_MEM_SIZE - PTSIZE),
+ HTABORG_OFFSET = (FULL_MEM_SIZE - PTSIZE),
// Put the DMA Pages just under the Page Table
MBOX_DMA_PAGES = 64, // must be <= 64
MBOX_DMA_PAGESIZE = (1 * KILOBYTE),
- MBOX_DMA_ADDR = (HTABORG - (MBOX_DMA_PAGES * MBOX_DMA_PAGESIZE))
+ MBOX_DMA_ADDR = (HTABORG_OFFSET
+ - (MBOX_DMA_PAGES * MBOX_DMA_PAGESIZE)),
+
+ // Tells processor to ignore HRMOR
+ FORCE_PHYS_ADDR = 0x8000000000000000,
};
enum castout_t
@@ -117,7 +122,7 @@ class VmmManager
static int mmAllocBlock(MessageQueue* i_mq,void* i_va,uint64_t i_size);
/**
- * @brief Find the phyiscal address bound to the given address
+ * @brief Find the physical address bound to the given address
* @param[in] i_vaddr The address
* @return the physical address or -EFAULT @see errno.h
*/
@@ -166,6 +171,20 @@ class VmmManager
*/
static int mmSetPermission(void* i_va,uint64_t i_size, uint64_t i_access_type);
+ /**
+ * @brief Retrieve the current HTABORG value
+ * @return uint64_t - value of HTABORG
+ */
+ static uint64_t HTABORG();
+
+ /**
+ * @brief Find the kernel addressable address bound to the
+ * given virtual address
+ * @param[in] i_vaddr The address
+ * @return the kernel address or -EFAULT @see errno.h
+ */
+ static uint64_t findKernelAddress(uint64_t i_vaddr);
+
protected:
VmmManager();
~VmmManager() {};
diff --git a/src/include/sys/mm.h b/src/include/sys/mm.h
index d9b5536a1..82e32bf46 100644
--- a/src/include/sys/mm.h
+++ b/src/include/sys/mm.h
@@ -1,26 +1,25 @@
-/* IBM_PROLOG_BEGIN_TAG
- * This is an automatically generated prolog.
- *
- * $Source: src/include/sys/mm.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/sys/mm.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 __SYS_MM_H
#define __SYS_MM_H
@@ -109,5 +108,16 @@ int mm_set_permission(void* va, uint64_t size, uint64_t access_type);
*/
void mm_icache_invalidate(void * i_addr, size_t i_cpu_word_count);
+/** @fn mm_virt_to_phys()
+ * @brief System call to return the physical address backing a
+ * virtual address
+ *
+ * @param[in] i_vaddr - Virtual address to translate
+ *
+ * @return uint64_t - 0 if there is no associated address,
+ * physical address otherwise
+ */
+uint64_t mm_virt_to_phys( void* i_vaddr );
+
#endif
OpenPOWER on IntegriCloud