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 | */ |
| 5 | #include <common.h> |
| 6 | #include <asm/asm.h> |
| 7 | #include <asm/pvr.h> |
| 8 | |
| 9 | int microblaze_cpu_has_pvr_full(void) |
| 10 | { |
| 11 | u32 msr, pvr0; |
| 12 | |
| 13 | MFS(msr, rmsr); |
| 14 | if (!(msr & PVR_MSR_BIT)) |
| 15 | return 0; |
| 16 | |
| 17 | get_pvr(0, pvr0); |
| 18 | debug("%s: pvr0 is 0x%08x\n", __func__, pvr0); |
| 19 | |
| 20 | if (!(pvr0 & PVR0_PVR_FULL_MASK)) |
| 21 | return 0; |
| 22 | |
| 23 | return 1; |
| 24 | } |
| 25 | |
| 26 | void microblaze_get_all_pvrs(u32 pvr[PVR_FULL_COUNT]) |
| 27 | { |
| 28 | get_pvr(0, pvr[0]); |
| 29 | get_pvr(1, pvr[1]); |
| 30 | get_pvr(2, pvr[2]); |
| 31 | get_pvr(3, pvr[3]); |
| 32 | get_pvr(4, pvr[4]); |
| 33 | get_pvr(5, pvr[5]); |
| 34 | get_pvr(6, pvr[6]); |
| 35 | get_pvr(7, pvr[7]); |
| 36 | get_pvr(8, pvr[8]); |
| 37 | get_pvr(9, pvr[9]); |
| 38 | get_pvr(10, pvr[10]); |
| 39 | get_pvr(11, pvr[11]); |
| 40 | get_pvr(12, pvr[12]); |
| 41 | } |