1 /*
2  * Copyright 2014, Michael Ellerman, IBM Corp.
3  * Licensed under GPLv2.
4  */
5 
6 #include <stdio.h>
7 #include <stdlib.h>
8 
9 #include "ebb.h"
10 #include "reg.h"
11 
12 
13 /*
14  * Test basic access to the EBB regs, they should be user accessible with no
15  * kernel interaction required.
16  */
17 int reg_access(void)
18 {
19 	uint64_t val, expected;
20 
21 	expected = 0x8000000100000000ull;
22 	mtspr(SPRN_BESCR, expected);
23 	val = mfspr(SPRN_BESCR);
24 
25 	FAIL_IF(val != expected);
26 
27 	expected = 0x0000000001000000ull;
28 	mtspr(SPRN_EBBHR, expected);
29 	val = mfspr(SPRN_EBBHR);
30 
31 	FAIL_IF(val != expected);
32 
33 	return 0;
34 }
35 
36 int main(void)
37 {
38 	return test_harness(reg_access, "reg_access");
39 }
40