hal: Define new struct pass_resource_memory for memory h/w device 45/146345/3
authorChanwoo Choi <cw00.choi@samsung.com>
Mon, 28 Aug 2017 01:34:07 +0000 (10:34 +0900)
committerChanwoo Choi <cw00.choi@samsung.com>
Thu, 7 Sep 2017 04:57:19 +0000 (13:57 +0900)
This patch defines the new 'struct pass_resource_memory' in order to
manage the memory[1] h/w device. The struct pass_resource_memory
includes the functions to handle the 'fault_around_bytes'[2]
for memory device.

[1] https://en.wikipedia.org/wiki/Computer_memory
[2] https://lkml.org/lkml/2016/4/18/612

Change-Id: Ib5694331ce24700ec6b84802a807826ed57192f2
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
src/hal/hal.h

index 277a6e08c7bd5e02e65b747b3b8a07d4d7381c3d..5cae596d2c7fe542f7b81597cfb3a04ebd71639d 100644 (file)
 #define PASS_RESOURCE_CPU_ID           1
 #define PASS_RESOURCE_BUS_ID           2
 #define PASS_RESOURCE_GPU_ID           3
+#define PASS_RESOURCE_MEMORY_ID                4
 #define PASS_RESOURCE_NONSTANDARD_ID   99
 
 #define PASS_RESOURCE_CPU_NAME         "cpu"
 #define PASS_RESOURCE_BUS_NAME         "bus"
 #define PASS_RESOURCE_GPU_NAME         "gpu"
+#define PASS_RESOURCE_MEMORY_NAME      "memory"
 #define PASS_RESOURCE_NONSTANDARD_NAME "nonstandard"
 
 /**
@@ -60,11 +62,13 @@ struct pass_resource_common;
  *             - PASS_RESOURCE_CPU_ID
  *             - PASS_RESOURCE_BUS_ID
  *             - PASS_RESOURCE_GPU_ID
+ *             - PASS_RESOURCE_MEMORY_ID
  *             - PASS_RESOURCE_NONSTANDARD_ID
  * @name       : device name, can have the following value.
  *             - PASS_RESOURCE_CPU_NAME
  *             - PASS_RESOURCE_BUS_NAME
  *             - PASS_RESOURCE_GPU_NAME
+ *             - PASS_RESOURCE_MEMORY_NAME
  *             - PASS_RESOURCE_NONSTANDARD_NAME
  * @dso                : module's dso
  * @resourced[]        : reserved for future use
@@ -187,6 +191,19 @@ struct pass_resource_gpu {
        struct pass_resource_tmu_ops tmu;
 };
 
+/*
+ * Define the resource structure for Memory H/W.
+ *
+ * @common     : common resource structure.
+ */
+struct pass_resource_memory {
+       struct pass_resource_common common;
+
+       /* Get and set the /sys/kernel/debug/fault_around_bytes */
+       int (*get_fault_around_bytes)(char *res_name);
+       int (*set_fault_around_bytes)(char *res_name, int fault_around_bytes);
+};
+
 /*
  * Define the resource structure for nonstandard H/W.
  *