Linux Kernel
3.7.1
|
#include "crystalhd.h"
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/ioctl.h>
#include <linux/dma-mapping.h>
#include <linux/sched.h>
#include "bc_dts_glob_lnx.h"
Go to the source code of this file.
Data Structures | |
struct | crystalhd_dio_user_info |
struct | crystalhd_dio_req |
struct | crystalhd_elem |
struct | crystalhd_dioq |
Macros | |
#define | BC_LINK_ELEM_POOL_SZ ((BC_TX_LIST_CNT * 2) + BC_RX_LIST_CNT + 2 + 4) |
#define | CHD_IODATA_POOL_SZ (BC_IOCTL_DATA_POOL_SIZE * BC_LINK_MAX_OPENS) |
#define | BC_LINK_SG_POOL_SZ (BC_TX_LIST_CNT + BC_RX_LIST_CNT) |
#define | BC_LINK_DIOQ_SIG (0x09223280) |
#define | crystalhd_create_event(_ev) init_waitqueue_head(_ev) |
#define | crystalhd_set_event(_ev) wake_up_interruptible(_ev) |
#define | crystalhd_wait_on_event(ev, condition, timeout, ret, nosig) |
#define | crystalhd_get_sgle_paddr(_dio, _ix) (cpu_to_le64(sg_dma_address(&_dio->sg[_ix]))) |
#define | crystalhd_get_sgle_len(_dio, _ix) (cpu_to_le32(sg_dma_len(&_dio->sg[_ix]))) |
#define | crystalhd_dioq_count(_ioq) ((_ioq) ? _ioq->count : 0) |
#define | BCMLOG(trace, fmt, args...) |
#define | BCMLOG_ERR(fmt, args...) |
Typedefs | |
typedef void(* | crystalhd_data_free_cb )(void *context, void *data) |
typedef void(* | hw_comp_callback )(struct crystalhd_dio_req *, wait_queue_head_t *event, enum BC_STATUS sts) |
Enumerations | |
enum | crystalhd_dio_sig { crystalhd_dio_inv = 0, crystalhd_dio_locked, crystalhd_dio_sg_mapped } |
enum | _chd_log_levels { BCMLOG_ERROR = 0x80000000, BCMLOG_DATA = 0x40000000, BCMLOG_SPINLOCK = 0x20000000, BCMLOG_INFO = 0x00000001, BCMLOG_DBG = 0x00000002, BCMLOG_SSTEP = 0x00000004 } |
Variables | |
uint32_t | g_linklog_level |
#define BC_LINK_DIOQ_SIG (0x09223280) |
Definition at line 95 of file crystalhd_misc.h.
#define BC_LINK_ELEM_POOL_SZ ((BC_TX_LIST_CNT * 2) + BC_RX_LIST_CNT + 2 + 4) |
Definition at line 50 of file crystalhd_misc.h.
#define BC_LINK_SG_POOL_SZ (BC_TX_LIST_CNT + BC_RX_LIST_CNT) |
Definition at line 56 of file crystalhd_misc.h.
Definition at line 207 of file crystalhd_misc.h.
#define BCMLOG_ERR | ( | fmt, | |
args... | |||
) |
Definition at line 214 of file crystalhd_misc.h.
#define CHD_IODATA_POOL_SZ (BC_IOCTL_DATA_POOL_SIZE * BC_LINK_MAX_OPENS) |
Definition at line 53 of file crystalhd_misc.h.
#define crystalhd_create_event | ( | _ev | ) | init_waitqueue_head(_ev) |
Definition at line 141 of file crystalhd_misc.h.
#define crystalhd_dioq_count | ( | _ioq | ) | ((_ioq) ? _ioq->count : 0) |
Definition at line 186 of file crystalhd_misc.h.
#define crystalhd_get_sgle_len | ( | _dio, | |
_ix | |||
) | (cpu_to_le32(sg_dma_len(&_dio->sg[_ix]))) |
Definition at line 176 of file crystalhd_misc.h.
#define crystalhd_get_sgle_paddr | ( | _dio, | |
_ix | |||
) | (cpu_to_le64(sg_dma_address(&_dio->sg[_ix]))) |
Definition at line 175 of file crystalhd_misc.h.
#define crystalhd_set_event | ( | _ev | ) | wake_up_interruptible(_ev) |
Definition at line 142 of file crystalhd_misc.h.
Definition at line 143 of file crystalhd_misc.h.
Definition at line 104 of file crystalhd_misc.h.
typedef void(* hw_comp_callback)(struct crystalhd_dio_req *, wait_queue_head_t *event, enum BC_STATUS sts) |
Definition at line 118 of file crystalhd_misc.h.
enum _chd_log_levels |
Definition at line 195 of file crystalhd_misc.h.
enum crystalhd_dio_sig |
Definition at line 58 of file crystalhd_misc.h.
uint32_t bc_dec_reg_rd | ( | struct crystalhd_adp * | adp, |
uint32_t | reg_off | ||
) |
bc_dec_reg_rd - Read 7412's device register. : Adapter instance : Register offset.
Return: 32bit value read
7412's device register read routine. This interface use 7412's device access range mapped from BAR-2 (4M) of PCIe configuration space.
Definition at line 142 of file crystalhd_misc.c.
void bc_dec_reg_wr | ( | struct crystalhd_adp * | adp, |
uint32_t | reg_off, | ||
uint32_t | val | ||
) |
bc_dec_reg_wr - Write 7412's device register : Adapter instance : Register offset. : Dword value to be written.
Return: none.
7412's device register write routine. This interface use 7412's device access range mapped from BAR-2 (4M) of PCIe configuration space.
Definition at line 165 of file crystalhd_misc.c.
void* bc_kern_dma_alloc | ( | struct crystalhd_adp * | adp, |
uint32_t | sz, | ||
dma_addr_t * | phy_addr | ||
) |
bc_kern_dma_alloc - Allocate memory for Dma rings : Adapter instance : Size of the memory to allocate. : Physical address of the memory allocated. Typedef to system's dma_addr_t (u64)
Return: Pointer to allocated memory..
Wrapper to Linux kernel interface.
Definition at line 379 of file crystalhd_misc.c.
void bc_kern_dma_free | ( | struct crystalhd_adp * | adp, |
uint32_t | sz, | ||
void * | ka, | ||
dma_addr_t | phy_addr | ||
) |
bc_kern_dma_free - Release Dma ring memory. : Adapter instance : Size of the memory to allocate. : Kernel virtual address returned during _dio_alloc() : Physical address of the memory allocated. Typedef to system's dma_addr_t (u64)
Return: none.
Definition at line 407 of file crystalhd_misc.c.
int crystalhd_create_dio_pool | ( | struct crystalhd_adp * | adp, |
uint32_t | max_pages | ||
) |
crystalhd_create_dio_pool - Allocate mem pool for DIO management. : Adapter instance : Max pages for size calculation.
Return: system error.
This routine creates a memory pool to hold dio context for for HW Direct IO operation.
Definition at line 862 of file crystalhd_misc.c.
enum BC_STATUS crystalhd_create_dioq | ( | struct crystalhd_adp * | adp, |
struct crystalhd_dioq ** | dioq_hnd, | ||
crystalhd_data_free_cb | cb, | ||
void * | cbctx | ||
) |
crystalhd_create_dioq - Create Generic DIO queue : Adapter instance : Handle to the dio queue created : Optional - Call back To free the element. : Context to pass to callback.
Return: status
Initialize Generic DIO queue to hold any data. Callback will be used to free elements while deleting the queue.
Definition at line 431 of file crystalhd_misc.c.
int crystalhd_create_elem_pool | ( | struct crystalhd_adp * | adp, |
uint32_t | pool_size | ||
) |
crystalhd_create_elem_pool - List element pool creation. : Adapter instance : Number of elements in the pool.
Return: 0 - success, <0 error
Create general purpose list element pool to hold pending, and active requests.
Definition at line 963 of file crystalhd_misc.c.
void crystalhd_delete_dioq | ( | struct crystalhd_adp * | adp, |
struct crystalhd_dioq * | dioq | ||
) |
crystalhd_delete_dioq - Delete Generic DIO queue : Adapter instance : DIOQ instance..
Return: None.
Release Generic DIO queue. This function will remove all the entries from the Queue and will release data by calling the call back provided during creation.
Definition at line 472 of file crystalhd_misc.c.
void crystalhd_delete_elem_pool | ( | struct crystalhd_adp * | adp | ) |
crystalhd_delete_elem_pool - List element pool deletion. : Adapter instance
Return: none
Delete general purpose list element pool.
Definition at line 993 of file crystalhd_misc.c.
void crystalhd_destroy_dio_pool | ( | struct crystalhd_adp * | adp | ) |
crystalhd_destroy_dio_pool - Release DIO mem pool. : Adapter instance
Return: none.
This routine releases dio memory pool during close.
Definition at line 923 of file crystalhd_misc.c.
enum BC_STATUS crystalhd_dioq_add | ( | struct crystalhd_dioq * | ioq, |
void * | data, | ||
bool | wake, | ||
uint32_t | tag | ||
) |
crystalhd_dioq_add - Add new DIO request element. : DIO queue instance : DIO request to be added. : True - Wake up suspended process. : Special tag to assign - For search and get.
Return: Status.
Insert new element to Q tail.
Definition at line 500 of file crystalhd_misc.c.
void* crystalhd_dioq_fetch | ( | struct crystalhd_dioq * | ioq | ) |
crystalhd_dioq_fetch - Fetch element from head. : DIO queue instance
Return: data element from the head..
Remove an element from Queue.
Definition at line 542 of file crystalhd_misc.c.
void* crystalhd_dioq_fetch_wait | ( | struct crystalhd_dioq * | ioq, |
uint32_t | to_secs, | ||
uint32_t * | sig_pend | ||
) |
crystalhd_dioq_fetch_wait - Fetch element from Head. : DIO queue instance : Wait timeout in seconds..
Return: element from the head..
Return element from head if Q is not empty. Wait for new element if Q is empty for Timeout seconds.
Definition at line 625 of file crystalhd_misc.c.
void* crystalhd_dioq_find_and_fetch | ( | struct crystalhd_dioq * | ioq, |
uint32_t | tag | ||
) |
crystalhd_dioq_find_and_fetch - Search the tag and Fetch element : DIO queue instance : Tag to search for.
Return: element from the head..
Search TAG and remove the element.
Definition at line 580 of file crystalhd_misc.c.
enum BC_STATUS crystalhd_map_dio | ( | struct crystalhd_adp * | adp, |
void * | ubuff, | ||
uint32_t | ubuff_sz, | ||
uint32_t | uv_offset, | ||
bool | en_422mode, | ||
bool | dir_tx, | ||
struct crystalhd_dio_req ** | dio_hnd | ||
) |
crystalhd_map_dio - Map user address for DMA : Adapter instance : User buffer to map. : User buffer size. : UV buffer offset. : TRUE:422 FALSE:420 Capture mode. : TRUE for Tx (To device from host) : Handle to mapped DIO request.
Return: Status.
This routine maps user address and lock pages for DMA.
Definition at line 675 of file crystalhd_misc.c.
enum BC_STATUS crystalhd_mem_rd | ( | struct crystalhd_adp * | adp, |
uint32_t | start_off, | ||
uint32_t | dw_cnt, | ||
uint32_t * | rd_buff | ||
) |
crystalhd_mem_rd - Read data from 7412's DRAM area. : Adapter instance : Start offset. : Count in dwords. : Buffer to copy the data from dram.
Return: Status.
7412's Dram read routine.
Definition at line 232 of file crystalhd_misc.c.
enum BC_STATUS crystalhd_mem_wr | ( | struct crystalhd_adp * | adp, |
uint32_t | start_off, | ||
uint32_t | dw_cnt, | ||
uint32_t * | wr_buff | ||
) |
crystalhd_mem_wr - Write data to 7412's DRAM area. : Adapter instance : Start offset. : Count in dwords. : Data Buffer to be written.
Return: Status.
7412's Dram write routine.
Definition at line 260 of file crystalhd_misc.c.
enum BC_STATUS crystalhd_pci_cfg_rd | ( | struct crystalhd_adp * | adp, |
uint32_t | off, | ||
uint32_t | len, | ||
uint32_t * | val | ||
) |
crystalhd_pci_cfg_rd - PCIe config read : Adapter instance : PCI config space offset. : Size – Byte, Word & dword. : Value read
Return: Status.
Get value from Link's PCIe config space.
Definition at line 288 of file crystalhd_misc.c.
enum BC_STATUS crystalhd_pci_cfg_wr | ( | struct crystalhd_adp * | adp, |
uint32_t | off, | ||
uint32_t | len, | ||
uint32_t | val | ||
) |
crystalhd_pci_cfg_wr - PCIe config write : Adapter instance : PCI config space offset. : Size – Byte, Word & dword. : Value to be written
Return: Status.
Set value to Link's PCIe config space.
Definition at line 333 of file crystalhd_misc.c.
uint32_t crystalhd_reg_rd | ( | struct crystalhd_adp * | adp, |
uint32_t | reg_off | ||
) |
crystalhd_reg_rd - Read Link's device register. : Adapter instance : Register offset.
Return: 32bit value read
Link device register read routine. This interface use Link's device access range mapped from BAR-1 (64K) of PCIe configuration space.
Definition at line 188 of file crystalhd_misc.c.
void crystalhd_reg_wr | ( | struct crystalhd_adp * | adp, |
uint32_t | reg_off, | ||
uint32_t | val | ||
) |
crystalhd_reg_wr - Write Link's device register : Adapter instance : Register offset. : Dword value to be written.
Return: none.
Link device register write routine. This interface use Link's device access range mapped from BAR-1 (64K) of PCIe configuration space.
Definition at line 211 of file crystalhd_misc.c.
Definition at line 1013 of file crystalhd_misc.c.
enum BC_STATUS crystalhd_unmap_dio | ( | struct crystalhd_adp * | adp, |
struct crystalhd_dio_req * | dio | ||
) |
crystalhd_unmap_sgl - Release mapped resources : Adapter instance : DIO request instance
Return: Status.
This routine is to unmap the user buffer pages.
Definition at line 822 of file crystalhd_misc.c.
uint32_t g_linklog_level |
Definition at line 31 of file crystalhd_misc.c.