Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_ramdisc.c File Reference
#include "ocs.h"
#include "ocs_ramdisc.h"
#include "scsi_asc_ascq.h"
#include "ocs_dif.h"

Go to the source code of this file.

Macros

#define ENABLE_SEED_WITH_PATTERN   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_format_ramdisc (ocs_t *ocs, ocs_ramdisc_t *ramdisc, uint32_t block_size, uint8_t p_type, uint8_t prot_en, uint8_t dif_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 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...
 
static int32_t dif_pool_new (ocs_t *ocs, ocs_list_t *head)
 Allocate a new dif_pool_t entry. 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...
 
void ocs_ddump_ramdisc (ocs_textbuf_t *textbuf, ocs_ramdisc_t *ramdisc)
 

Macro Details

#define ENABLE_SEED_WITH_PATTERN   0

Definition at line 49 of file ocs_ramdisc.c.

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.

static int32_t dif_pool_new ( ocs_t *  ocs,
ocs_list_t *  head 
)
static

Allocate a new dif_pool_t entry.

Description
Allocates a new dif_pool_t entry.
Parameters
ocsPointer to the ocs_t structure.
headPointer to the head of DIF buffer entry linked list.
Returns
Returns 0 on success, a negative error code value on failure.

Definition at line 688 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.