brintos

brintos / linux-shallow public Read only

0
0
Text · 673 B · bd1ace9 Raw
41 lines · c
1// SPDX-License-Identifier: GPL-2.0-only2/*3 * Copyright 2014, Michael Ellerman, IBM Corp.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 no14 * kernel interaction required.15 */16int 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 37int main(void)38{39	return test_harness(reg_access, "reg_access");40}41