lib: More improvements to sbi_fifo

This patch does following improvements to sbi_fifo:
1. Use valid SBI_Exxxx error codes instead of -1
2. The sbi_fifo_is_full() and sbi_fifo_is_empty() did
   not acquire qlock before accessing head and tail
   hence fixed it
3. Added avail member for ease in debugging and simplifying
   head/tail updates.

Due to above changes size of sbi_fifo changes from 48 bytes
to 56 bytes.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
Anup Patel
2019-04-03 10:24:03 +05:30
committed by Atish Patra
parent 6dc1b0f6e2
commit 9dc95021db
4 changed files with 73 additions and 43 deletions

View File

@@ -184,8 +184,8 @@ int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot)
struct sbi_fifo *tlb_info_q = sbi_tlb_fifo_head_ptr(scratch);
sbi_ipi_data_ptr(scratch)->ipi_type = 0x00;
tlb_info_q->queue = sbi_tlb_fifo_mem_ptr(scratch);
sbi_fifo_init(tlb_info_q, SBI_TLB_FIFO_NUM_ENTRIES, SBI_TLB_INFO_SIZE);
sbi_fifo_init(tlb_info_q, sbi_tlb_fifo_mem_ptr(scratch),
SBI_TLB_FIFO_NUM_ENTRIES, SBI_TLB_INFO_SIZE);
/* Enable software interrupts */
csr_set(CSR_MIE, MIP_MSIP);