eenurkka commented on code in PR #6304: URL: https://github.com/apache/incubator-nuttx/pull/6304#discussion_r877906705
########## arch/risc-v/src/mpfs/mpfs_opensbi.c: ########## @@ -499,6 +517,72 @@ static void mpfs_opensbi_pmp_setup(void) csr_write(pmpcfg2, 0); } +/**************************************************************************** + * Name: mpfs_opensbi_vendor_ext_check + * + * Description: + * Used by the OpenSBI in vendor probe to check the vendor ID. + * + * Input Parameters: + * extid - hart number to be prepared + * + * Returned Value: + * 1 on match, zero if not + * + ****************************************************************************/ + +#ifdef CONFIG_MPFS_IHC +static int mpfs_opensbi_vendor_ext_check(long extid) +{ + return (SBI_EXT_MICROCHIP_TECHNOLOGY == extid); +} + +/**************************************************************************** + * Name: mpfs_opensbi_ecall_handler + * + * Description: + * Used by the S-mode kernel such as Linux to perform M-mode ecall actions + * related to Inter-Hart Communication (IHC). + * + * Input Parameters: + * extid - Vendor ID + * funcid - One of the valid functions + * sbi_trap_regs - SBI trap registers + * out_val - Error code location + * out_trap - Trap registers such as epc, unused + * + * Returned Value: + * 0 always + * + ****************************************************************************/ + +static int mpfs_opensbi_ecall_handler(long extid, long funcid, + const struct sbi_trap_regs *regs, + unsigned long *out_val, + struct sbi_trap_info *out_trap) +{ + uint32_t remote_channel = (uint32_t)regs->a0; + uint32_t *message_ptr = (uint32_t *)regs->a1; + int result = 0; + + switch (funcid) + { + case SBI_EXT_IHC_CTX_INIT: + case SBI_EXT_IHC_SEND: + case SBI_EXT_IHC_RECEIVE: + result = mpfs_ihc_sbi_ecall_handler(funcid, remote_channel, + message_ptr); + break; + default: Review Comment: pushed new with fixes -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org