• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
11 
12 /*
13  * Test basic access to the EBB regs, they should be user accessible with no
14  * kernel interaction required.
15  */
reg_access(void)16 int reg_access(void)
17 {
18 	uint64_t val, expected;
19 
20 	SKIP_IF(!ebb_is_supported());
21 
22 	expected = 0x8000000100000000ull;
23 	mtspr(SPRN_BESCR, expected);
24 	val = mfspr(SPRN_BESCR);
25 
26 	FAIL_IF(val != expected);
27 
28 	expected = 0x0000000001000000ull;
29 	mtspr(SPRN_EBBHR, expected);
30 	val = mfspr(SPRN_EBBHR);
31 
32 	FAIL_IF(val != expected);
33 
34 	return 0;
35 }
36 
main(void)37 int main(void)
38 {
39 	return test_harness(reg_access, "reg_access");
40 }
41