diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/kernel/devicesegment.H | 53 | ||||
-rw-r--r-- | src/include/kernel/ptmgr.H | 52 | ||||
-rw-r--r-- | src/include/kernel/syscalls.H | 48 | ||||
-rw-r--r-- | src/include/kernel/vmmmgr.H | 69 | ||||
-rw-r--r-- | src/include/sys/mm.h | 56 |
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 |