From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Anderson Date: Tue, 4 Feb 2020 09:48:05 -0500 Subject: [PATCH v3 07/12] riscv: Add option to support RISC-V privileged spec 1.9.1 In-Reply-To: References: <39c496a7-bc32-8257-86b6-4a3cfc49e333@gmail.com> <976c6451-7f9d-4609-0a89-fafa6d005eae@gmail.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2/4/20 9:38 AM, Bin Meng wrote: > Hi Sean, > > On Tue, Feb 4, 2020 at 10:19 PM Sean Anderson wrote: >> I believe the macro compiles to "csrs CSR_FOO". At least with my >> gcc/binutils (9.2.0/2.33.1) this style is not available for these older >> CSRs. Perhaps it would work if we switched to letting it compile with >> the numeric CSR as defined earlier in asm/csr.h > > It's already using the numeric CSR for csr_write(). Could you double check? Well, the current definition is #define csr_write(csr, val) \ ({ \ unsigned long __v = (unsigned long)(val); \ __asm__ __volatile__ ("csrw " __ASM_STR(csr) ", %0" \ : : "rK" (__v) \ : "memory"); \ }) and _ASM_STR(csr) evaluates to #csr. I think that results in something like __asm__("csrw " "CSR_FOO" ", %0" In any case, the errors I get are arch/riscv/cpu/cpu.c: Assembler messages: arch/riscv/cpu/cpu.c:94: Error: unknown CSR `CSR_MSCOUNTEREN' arch/riscv/cpu/cpu.c:94: Error: unknown CSR `CSR_MSCOUNTEREN' which doesn't seem like a numeric CSR to me. --Sean