forked from Mirrors/opensbi
lib: Add a fifo implementation.
Implement a fifo to accomodate outstanding IPIs for a specific hart at the same time. Signed-off-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
32
include/sbi/sbi_fifo.h
Normal file
32
include/sbi/sbi_fifo.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*
|
||||
* Copyright (c) 2019 Western Digital Corporation or its affiliates.
|
||||
*
|
||||
* Authors:
|
||||
* Atish Patra<atish.patra@wdc.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __SBI_FIFO_H__
|
||||
#define __SBI_FIFO_H__
|
||||
|
||||
#include <sbi/riscv_locks.h>
|
||||
#include <sbi/sbi_types.h>
|
||||
|
||||
struct sbi_fifo {
|
||||
int head;
|
||||
int tail;
|
||||
spinlock_t qlock;
|
||||
unsigned long entrysize;
|
||||
unsigned long num_entries;
|
||||
void *queue;
|
||||
};
|
||||
|
||||
int sbi_fifo_dequeue(struct sbi_fifo *fifo, void *data);
|
||||
int sbi_fifo_enqueue(struct sbi_fifo *fifo, void *data);
|
||||
void sbi_fifo_init(struct sbi_fifo *fifo, unsigned long entries,
|
||||
unsigned long entrysize);
|
||||
bool sbi_fifo_is_empty(struct sbi_fifo *fifo);
|
||||
bool sbi_fifo_is_full(struct sbi_fifo *fifo);
|
||||
#endif
|
Reference in New Issue
Block a user