summaryrefslogtreecommitdiffstats
path: root/src/import/chips/p9/procedures/ppe
diff options
context:
space:
mode:
authorDoug Gilbert <dgilbert@us.ibm.com>2017-06-09 15:51:51 -0500
committerSachin Gupta <sgupta2m@in.ibm.com>2017-06-22 17:37:13 -0400
commitf2de0d3c03281e942b1d9d5f0874f5558d20c9ac (patch)
tree5acc5bff6830fc0210c460997d6bbd29ffc0012b /src/import/chips/p9/procedures/ppe
parent0a96b93f20fb5b564ff77589cb55e238f833d6fd (diff)
downloadtalos-sbe-f2de0d3c03281e942b1d9d5f0874f5558d20c9ac.tar.gz
talos-sbe-f2de0d3c03281e942b1d9d5f0874f5558d20c9ac.zip
DERP/DORP Implementation for pgpe dd2
Change-Id: Iccfab131b8704666b2a45c20d6326f2007acced9 RTC:173229 Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41634 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Tested-by: PPE CI <ppe-ci+hostboot@us.ibm.com> Reviewed-by: Michael S. Floyd <mfloyd@us.ibm.com> Reviewed-by: Brian T. Vanderpool <vanderp@us.ibm.com> Reviewed-by: Gregory S. Still <stillgs@us.ibm.com> Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/41636 Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com> Reviewed-by: Sachin Gupta <sgupta2m@in.ibm.com>
Diffstat (limited to 'src/import/chips/p9/procedures/ppe')
-rw-r--r--src/import/chips/p9/procedures/ppe/pk/ppe42/div32.S5
-rw-r--r--src/import/chips/p9/procedures/ppe/pk/ppe42/math.c75
2 files changed, 76 insertions, 4 deletions
diff --git a/src/import/chips/p9/procedures/ppe/pk/ppe42/div32.S b/src/import/chips/p9/procedures/ppe/pk/ppe42/div32.S
index d9e7aa0c..aeeadf86 100644
--- a/src/import/chips/p9/procedures/ppe/pk/ppe42/div32.S
+++ b/src/import/chips/p9/procedures/ppe/pk/ppe42/div32.S
@@ -5,7 +5,7 @@
#
# OpenPOWER sbe Project
#
-# Contributors Listed Below - COPYRIGHT 2016
+# Contributors Listed Below - COPYRIGHT 2016,2017
# [+] International Business Machines Corp.
#
#
@@ -22,6 +22,7 @@
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG
+#if (!defined(PSTATE_GPE) || NIMBUS_DD_LEVEL==1)
.nolist
#include "ppe42_asm.h"
.list
@@ -78,5 +79,5 @@ __umodsi3:
mtctr %r10
li %r9,1
b udivmodsi4_loop
-
+#endif
diff --git a/src/import/chips/p9/procedures/ppe/pk/ppe42/math.c b/src/import/chips/p9/procedures/ppe/pk/ppe42/math.c
index 10943ce8..4deeb8b2 100644
--- a/src/import/chips/p9/procedures/ppe/pk/ppe42/math.c
+++ b/src/import/chips/p9/procedures/ppe/pk/ppe42/math.c
@@ -5,7 +5,7 @@
/* */
/* OpenPOWER sbe Project */
/* */
-/* Contributors Listed Below - COPYRIGHT 2016 */
+/* Contributors Listed Below - COPYRIGHT 2016,2017 */
/* [+] International Business Machines Corp. */
/* */
/* */
@@ -37,6 +37,75 @@ extern "C"
//}
+#ifdef PSTATE_GPE
+#if (NIMBUS_DD_LEVEL != 1)
+
+#include "ocb_register_addresses.h"
+#define out64(addr, data) \
+ {\
+ unsigned long long __d = (data); \
+ unsigned long* __a = (unsigned long*)(addr); \
+ asm volatile \
+ (\
+ "stvd %1, %0 \n" \
+ : "=o"(*__a) \
+ : "r"(__d) \
+ ); \
+ }
+
+#define in64(addr) \
+ ({\
+ unsigned long long __d; \
+ unsigned long* __a = (unsigned long*)(addr); \
+ asm volatile \
+ (\
+ "lvd %0, %1 \n" \
+ :"=r"(__d) \
+ :"o"(*__a) \
+ ); \
+ __d; \
+ })
+
+
+unsigned long udivmodsi4(unsigned long long _a,
+ unsigned long _mod)
+{
+
+ out64(OCB_DERP, _a);
+
+ do
+ {
+ _a = in64(OCB_DORP);
+ }
+ while((~_a) == 0);
+
+ if(_mod)
+ {
+ return (unsigned long)_a;
+ }
+
+ return (unsigned long)(_a >> 32);
+}
+
+unsigned long __udivsi3(unsigned long _a, unsigned long _b)
+{
+ unsigned long long v =
+ ((unsigned long long)_a) << 32 |
+ ((unsigned long long)_b);
+
+ return udivmodsi4(v, 0);
+}
+
+unsigned long __umodsi3(unsigned long _a, unsigned long _b)
+{
+ unsigned long long v =
+ ((unsigned long long)_a) << 32 |
+ ((unsigned long long)_b);
+ return udivmodsi4(v, 1);
+}
+#endif
+#endif
+
// 32 bit signed divide
int __divsi3(int _a, int _b)
{
@@ -54,7 +123,7 @@ int __divsi3(int _a, int _b)
neg = !neg;
}
- int c = __udivsi3((unsigned long)_a, (unsigned long)_b);
+ int c = (int)__udivsi3((unsigned long)_a, (unsigned long)_b);
if(neg)
{
@@ -64,6 +133,7 @@ int __divsi3(int _a, int _b)
return c;
}
+
// 32 bit unsigned mutiply
unsigned long __umulsi3(unsigned long _a, unsigned long _b)
{
@@ -139,6 +209,7 @@ unsigned long long __muldi3(unsigned long long _a, unsigned long long _b)
return sum;
}
+
//float __mulsf3(float _a , float _b)
//{
// // floating point math
OpenPOWER on IntegriCloud