Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_ramdisc.h File Reference

Go to the source code of this file.

Detailed Description

OCS ramdisc declarations and exported API

Definition in file ocs_ramdisc.h.

Data Structures

struct  dif_t
 
struct  dif_pool_t
 DIF separates allocation pool. More...
 
struct  ocs_difdma_t
 
struct  ramdisc_segment_t
 ramdisc segment structure More...
 
struct  ocs_ramdisc_t
 ramdisc instance structure More...
 
struct  ocs_ramdisc_sgl_t
 generic ramdisc scatter-gather list More...
 

Macros

#define DIF_POOL_SIZE   OCS_MAX_DMA_ALLOC
 
#define RAMDISC_MIN_BLOCK_SIZE   512
 
#define ENABLE_DIF_VERIFICATION   0
 
#define SGL_REQ_FLAGS_PHYS   (1U << 0)
 

Functions

int32_t ocs_new_ramdisc (ocs_t *ocs, ocs_ramdisc_t *ramdisc, uint32_t block_size, uint32_t blocks_per_segment, uint64_t block_count)
 Create a new ramdisc instance (LUN). More...
 
int32_t ocs_del_ramdisc (ocs_t *ocs, ocs_ramdisc_t *ramdisc)
 Delete a ramdisc instance. More...
 
int32_t ocs_ramdisc_sgl (ocs_t *ocs, ocs_ramdisc_t *ramdisc, ocs_ramdisc_sgl_t *sgl, uint32_t max_sgl, uint32_t max_sge_size, uint32_t lba, uint32_t *block_count, uint32_t req_flags, uint8_t dump_buffer)
 Build an SGL list for blocks in a ramdisc. More...
 
int32_t ocs_ramdisc_first_burst (ocs_t *ocs, ocs_ramdisc_t *ramdisc, uint32_t lba, uint32_t lba_offset, uint8_t *buffer, uint32_t buffer_size)
 
int32_t ocs_format_ramdisc (ocs_t *ocs, ocs_ramdisc_t *ramdisc, uint32_t block_size, uint8_t p_type, uint8_t prot_en, uint8_t separate)
 Reformat an existing ramdisc, possibly the changing block size and/or protection. More...
 
void ocs_set_ramdisc_blocksize (ocs_t *ocs, ocs_ramdisc_t *ramdisc, uint32_t block_size)
 Set the ramdisc block size. More...
 
uint32_t ocs_get_ramdisc_blocksize (ocs_t *ocs, ocs_ramdisc_t *ramdisc)
 Get the ramdisc block size. More...
 
uint8_t * ocs_ramdisc_lba_address (ocs_ramdisc_t *ramdisc, uint64_t lba)
 Return the address of a ramdisc logical block. More...
 
dif_t * ocs_ramdisc_dif_address (ocs_ramdisc_t *ramdisc, uint64_t lba)
 Return the address of the DIF block if protection is enabled. More...
 
void ocs_ddump_ramdisc (ocs_textbuf_t *textbuf, ocs_ramdisc_t *ramdisc)
 
void dif_pool_init (ocs_t *ocs, ocs_list_t *head)
 initialize the DIF memory pool More...
 
void dif_pool_free (ocs_t *ocs, ocs_list_t *head)
 Free the DIF memory pool. More...
 
int32_t dif_pool_alloc (ocs_t *ocs, ocs_list_t *head, uint32_t size, ocs_difdma_t *difdma)
 Allocate memory for the DIF memory pool. More...
 

Macro Details

#define DIF_POOL_SIZE   OCS_MAX_DMA_ALLOC

Definition at line 41 of file ocs_ramdisc.h.

#define ENABLE_DIF_VERIFICATION   0

Definition at line 45 of file ocs_ramdisc.h.

#define RAMDISC_MIN_BLOCK_SIZE   512

Definition at line 42 of file ocs_ramdisc.h.

#define SGL_REQ_FLAGS_PHYS   (1U << 0)

Definition at line 129 of file ocs_ramdisc.h.

Function Details

int32_t dif_pool_alloc ( ocs_t *  ocs,
ocs_list_t *  head,
uint32_t  size,
ocs_difdma_t *  difdma 
)

Allocate memory for the DIF memory pool.

Description
Allocates a buffer of size from a DIF memory pool. Returns a physical address.
Parameters
ocsPointer to the ocs_t structure.
headPointer to the head of a DIF pool entry linked list.
sizeSize of the memory to allocate.
difdmaReturns the address of the requested DIF segment.
Returns
Returns 0 on success.

Definition at line 724 of file ocs_ramdisc.c.

void dif_pool_free ( ocs_t *  ocs,
ocs_list_t *  head 
)

Free the DIF memory pool.

Description
Frees all of the DIF memory pool buffers.
Parameters
ocsPointer to the ocs structure.
headPointer to the head of DIF pool entries list.
Returns
None.

Definition at line 660 of file ocs_ramdisc.c.

void dif_pool_init ( ocs_t *  ocs,
ocs_list_t *  head 
)

initialize the DIF memory pool

Description
Clears all previous allocations of DIF memory. Leaves all the previously-allocated memory buffers in the pool.
Parameters
ocsPointer to the ocs structure.
headHead of the dif_pool_t linked list.
Returns
None.

Definition at line 636 of file ocs_ramdisc.c.

void ocs_ddump_ramdisc ( ocs_textbuf_t *  textbuf,
ocs_ramdisc_t *  ramdisc 
)

Definition at line 759 of file ocs_ramdisc.c.

int32_t ocs_ramdisc_first_burst ( ocs_t *  ocs,
ocs_ramdisc_t *  ramdisc,
uint32_t  lba,
uint32_t  lba_offset,
uint8_t *  buffer,
uint32_t  buffer_size 
)