summaryrefslogtreecommitdiffstats
path: root/src/include/kernel
diff options
context:
space:
mode:
authorPatrick Williams <iawillia@us.ibm.com>2012-01-11 10:25:12 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-01-18 09:52:45 -0600
commitb699fc329722088174afe6031351d3bddb559f6c (patch)
tree62e2ad43fb7becba393346fbb2aeca1ba140efdf /src/include/kernel
parent811a7e18fb3630f4af77c545f057aa147b18334c (diff)
downloadtalos-hostboot-b699fc329722088174afe6031351d3bddb559f6c.tar.gz
talos-hostboot-b699fc329722088174afe6031351d3bddb559f6c.zip
Support additional device segments and MMIO blocks
Change-Id: Icd2e9ed7de2c0227b25979622d0f37a77595570a Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/609 Tested-by: Jenkins Server Reviewed-by: MATTHEW S. BARTH <msbarth@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/include/kernel')
-rw-r--r--src/include/kernel/devicesegment.H35
-rw-r--r--src/include/kernel/segmentmgr.H36
-rw-r--r--src/include/kernel/vmmmgr.H9
3 files changed, 50 insertions, 30 deletions
diff --git a/src/include/kernel/devicesegment.H b/src/include/kernel/devicesegment.H
index c60619705..dcaf78af8 100644
--- a/src/include/kernel/devicesegment.H
+++ b/src/include/kernel/devicesegment.H
@@ -35,9 +35,14 @@ class DeviceSegment : public Segment
{
public:
/**
- * @brief Constructor (Device segment at 2TB)
+ * @brief Constructor (Device segment at 2TB + N)
+ *
+ * @param[in] segId - Segment ID to map this device segment at.
+ *
+ * Associates itself with the SegmentManager.
*/
- DeviceSegment() : Segment(VMM_VADDR_DEVICE_SEGMENT) {};
+ explicit DeviceSegment(size_t segId) : Segment(segId * TERABYTE)
+ { init(segId); };
/**
* @brief Destructor
@@ -45,9 +50,9 @@ class DeviceSegment : public Segment
~DeviceSegment() {};
/**
- * @brief Add the device segment
+ * @brief Add the device segment to the SegmentManager.
*/
- static void init();
+ void init(size_t segId);
/**
* @brief Handle a page fault for a device address access
@@ -60,19 +65,19 @@ class DeviceSegment : public Segment
/**
- * @brief Map a device into the device segment(2TB)
+ * @brief Map a device into the device segment.
* @param ra[in] - Void pointer to real address to be mapped in
* @param i_devDataSize[in] - Size of device segment block
* @return void* - Pointer to beginning virtual address, NULL otherwise
*/
- static void* devMap(void* ra, uint64_t i_devDataSize);
+ void* devMap(void* ra, uint64_t i_devDataSize);
/**
- * @brief Unmap a device from the device segment(2TB)
+ * @brief Unmap a device from the device segment.
* @param ea[in] - Void pointer to effective address
* @return int - 0 for successful unmap, non-zero otherwise
*/
- static int devUnmap(void* ea);
+ int devUnmap(void* ea);
private:
/**
@@ -100,20 +105,6 @@ class DeviceSegment : public Segment
*/
void _init();
- /**
- * @brief Map a device into the device segment(2TB)
- * @param ra[in] - Void pointer to real address to be mapped in
- * @param i_devDataSize[in] - Size of device segment block
- * @return void* - Pointer to beginning virtual address, NULL otherwise
- */
- void* _devMap(void* ra, uint64_t i_devDataSize);
-
- /**
- * @brief Unmap a device from the device segment(2TB)
- * @param ea[in] - Void pointer to effective address
- * @return int - 0 for successful unmap, non-zero otherwise
- */
- int _devUnmap(void* ea);
};
#endif
diff --git a/src/include/kernel/segmentmgr.H b/src/include/kernel/segmentmgr.H
index d2e4be2df..85ecf3269 100644
--- a/src/include/kernel/segmentmgr.H
+++ b/src/include/kernel/segmentmgr.H
@@ -51,17 +51,18 @@ class SegmentManager
BASE_SEGMENT_ID = 0,
/** Task Stack Segment (1-2TB). */
STACK_SEGMENT_ID = 1,
- /** MMIO Space Segment (2-3TB). */
- MMIO_SEGMENT_ID = 2,
+ /** MMIO Space Segments (2-11TB). */
+ MMIO_FIRST_SEGMENT_ID = 2,
+ MMIO_LAST_SEGMENT_ID = MMIO_FIRST_SEGMENT_ID + 8,
- MAX_SEGMENTS = 4
+ MAX_SEGMENTS = 16
};
enum
{
CI_ACCESS = 0xFFFFFFFF
// Set to all F's to identify this type
- };
+ };
/**
* Constructor. Initializes instance variables.
@@ -130,12 +131,30 @@ class SegmentManager
*/
static void castOutPages(uint64_t i_type);
+ /**
+ * @brief Map a device into the device segment
+ * @param ra[in] - Void pointer to real address to be mapped in
+ * @param i_devDataSize[in] - Size of device segment block
+ * @return void* - Pointer to beginning virtual address, NULL otherwise
+ */
+ static void* devMap(void* ra, uint64_t i_devDataSize);
+
+ /**
+ * @brief Unmap a device from the device segment
+ * @param ea[in] - Void pointer to effective address
+ * @return int - 0 for successful unmap, non-zero otherwise
+ */
+ static int devUnmap(void* ea);
+
+
private:
/** See handlePageFault. */
bool _handlePageFault(task_t* i_task, uint64_t i_addr);
/** See addSegment. */
void _addSegment(Segment* i_segment, size_t i_segId);
+ /** See getSegment. */
+ Segment* _getSegment(size_t i_segId);
/** See initSLB. */
void _initSLB();
/** See updateRefCount. */
@@ -143,14 +162,19 @@ class SegmentManager
PageTableManager::UsageStats_t i_stats );
/** See castOutPages */
void _castOutPages(uint64_t i_type);
+ /** See devMap */
+ void* _devMap(void* ra, uint64_t i_devDataSize);
+ /** See devUnmap */
+ int _devUnmap(void* ea);
+
/** See findPhysicalAddress */
uint64_t _findPhysicalAddress(uint64_t i_vaddr) const;
ALWAYS_INLINE
- size_t getSegmentIdFromAddress(uint64_t i_addr) const
+ static size_t getSegmentIdFromAddress(uint64_t i_addr)
{
- return i_addr >> SLBE_s;
+ return i_addr >> SLBE_s;
}
/** Array of segment objects to associated segment IDs. */
diff --git a/src/include/kernel/vmmmgr.H b/src/include/kernel/vmmmgr.H
index 3782bb762..46f283e18 100644
--- a/src/include/kernel/vmmmgr.H
+++ b/src/include/kernel/vmmmgr.H
@@ -86,7 +86,7 @@ class VmmManager
static bool pteMiss(task_t* t, uint64_t effAddr);
/**
- * @brief Map a device into the device segment(2TB)
+ * @brief Map a device into the device segment
* @param ra[in] - Void pointer to real address to be mapped in
* @param i_devDataSize[in] - Size of device segment block
* @return void* - Pointer to beginning virtual address, NULL otherwise
@@ -94,7 +94,7 @@ class VmmManager
static void* devMap(void* ra, uint64_t i_devDataSize);
/**
- * @brief Unmap a device from the device segment(2TB)
+ * @brief Unmap a device from the device segment
* @param ea[in] - Void pointer to effective address
* @return int - 0 for successful unmap, non-zero otherwise
*/
@@ -198,6 +198,11 @@ class VmmManager
int _mmRemovePages(VmmManager::PAGE_REMOVAL_OPS i_op,void* i_vaddr,
uint64_t i_size,task_t* i_task);
+ /** See devMap */
+ void* _devMap(void* ra, uint64_t i_devDataSize);
+ /** See devUnmap */
+ int _devUnmap(void* ea);
+
public:
friend class Block;
friend class StackSegment;
OpenPOWER on IntegriCloud