Ovidiu Panait | a850c32 | 2022-05-31 21:14:34 +0300 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
| 2 | /* |
| 3 | * Copyright (C) 2022, Ovidiu Panait <ovpanait@gmail.com> |
| 4 | */ |
Ovidiu Panait | a850c32 | 2022-05-31 21:14:34 +0300 | [diff] [blame] | 5 | #include <asm/asm.h> |
| 6 | #include <asm/pvr.h> |
| 7 | |
| 8 | int microblaze_cpu_has_pvr_full(void) |
| 9 | { |
| 10 | u32 msr, pvr0; |
| 11 | |
| 12 | MFS(msr, rmsr); |
| 13 | if (!(msr & PVR_MSR_BIT)) |
| 14 | return 0; |
| 15 | |
| 16 | get_pvr(0, pvr0); |
| 17 | debug("%s: pvr0 is 0x%08x\n", __func__, pvr0); |
| 18 | |
| 19 | if (!(pvr0 & PVR0_PVR_FULL_MASK)) |
| 20 | return 0; |
| 21 | |
| 22 | return 1; |
| 23 | } |
| 24 | |
| 25 | void microblaze_get_all_pvrs(u32 pvr[PVR_FULL_COUNT]) |
| 26 | { |
| 27 | get_pvr(0, pvr[0]); |
| 28 | get_pvr(1, pvr[1]); |
| 29 | get_pvr(2, pvr[2]); |
| 30 | get_pvr(3, pvr[3]); |
| 31 | get_pvr(4, pvr[4]); |
| 32 | get_pvr(5, pvr[5]); |
| 33 | get_pvr(6, pvr[6]); |
| 34 | get_pvr(7, pvr[7]); |
| 35 | get_pvr(8, pvr[8]); |
| 36 | get_pvr(9, pvr[9]); |
| 37 | get_pvr(10, pvr[10]); |
| 38 | get_pvr(11, pvr[11]); |
| 39 | get_pvr(12, pvr[12]); |
| 40 | } |