| * (C) Copyright 2016 Beniamino Galvani <b.galvani@gmail.com> |
| * SPDX-License-Identifier: GPL-2.0+ |
| #include <asm/arch/gxbb.h> |
| #include <linux/kernel.h> |
| #define FN_GET_SHARE_MEM_INPUT_BASE 0x82000020 |
| #define FN_GET_SHARE_MEM_OUTPUT_BASE 0x82000021 |
| #define FN_EFUSE_READ 0x82000030 |
| #define FN_EFUSE_WRITE 0x82000031 |
| static void *shmem_input; |
| static void *shmem_output; |
| static void meson_init_shmem(void) |
| if (shmem_input && shmem_output) |
| regs.regs[0] = FN_GET_SHARE_MEM_INPUT_BASE; |
| shmem_input = (void *)regs.regs[0]; |
| regs.regs[0] = FN_GET_SHARE_MEM_OUTPUT_BASE; |
| shmem_output = (void *)regs.regs[0]; |
| debug("Secure Monitor shmem: 0x%p 0x%p\n", shmem_input, shmem_output); |
| ssize_t meson_sm_read_efuse(uintptr_t offset, void *buffer, size_t size) |
| regs.regs[0] = FN_EFUSE_READ; |
| memcpy(buffer, shmem_output, min(size, regs.regs[0])); |