Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Copyright 2014, Michael Ellerman, IBM Corp.
0004  */
0005 
0006 #include <stdio.h>
0007 #include <stdlib.h>
0008 
0009 #include "ebb.h"
0010 
0011 
0012 /*
0013  * Test basic access to the EBB regs, they should be user accessible with no
0014  * kernel interaction required.
0015  */
0016 int reg_access(void)
0017 {
0018     uint64_t val, expected;
0019 
0020     SKIP_IF(!ebb_is_supported());
0021 
0022     expected = 0x8000000100000000ull;
0023     mtspr(SPRN_BESCR, expected);
0024     val = mfspr(SPRN_BESCR);
0025 
0026     FAIL_IF(val != expected);
0027 
0028     expected = 0x0000000001000000ull;
0029     mtspr(SPRN_EBBHR, expected);
0030     val = mfspr(SPRN_EBBHR);
0031 
0032     FAIL_IF(val != expected);
0033 
0034     return 0;
0035 }
0036 
0037 int main(void)
0038 {
0039     return test_harness(reg_access, "reg_access");
0040 }