Source
x
* This modifies msc::base, which requires msc::buf_mutex to serialize, so the
// SPDX-License-Identifier: GPL-2.0
/*
* Intel(R) Trace Hub Memory Storage Unit
*
* Copyright (C) 2014-2015 Intel Corporation.
*/
/**
* struct msc_block - multiblock mode block descriptor
* @bdesc: pointer to hardware descriptor (beginning of the block)
* @addr: physical address of the block
*/
struct msc_block {
struct msc_block_desc *bdesc;
dma_addr_t addr;
};
/**
* struct msc_window - multiblock mode window descriptor
* @entry: window list linkage (msc::win_list)
* @pgoff: page offset into the buffer that this window starts at
* @nr_blocks: number of blocks (pages) in this window
* @block: array of block descriptors
*/
struct msc_window {
struct list_head entry;
unsigned long pgoff;
unsigned int nr_blocks;
struct msc *msc;
struct msc_block block[0];
};
/**
* struct msc_iter - iterator for msc buffer
* @entry: msc::iter_list linkage
* @msc: pointer to the MSC device
* @start_win: oldest window
* @win: current window
* @offset: current logical offset into the buffer
* @start_block: oldest block in the window
* @block: block number in the window
* @block_off: offset into current block
* @wrap_count: block wrapping handling
* @eof: end of buffer reached
*/
struct msc_iter {
struct list_head entry;
struct msc *msc;
struct msc_window *start_win;
struct msc_window *win;
unsigned long offset;
int start_block;
int block;
unsigned int block_off;
unsigned int wrap_count;
unsigned int eof;
};
/**
* struct msc - MSC device representation
* @reg_base: register window base address
* @thdev: intel_th_device pointer
* @win_list: list of windows in multiblock mode
* @nr_pages: total number of pages allocated for this buffer
* @single_sz: amount of data in single mode
* @single_wrap: single mode wrap occurred
* @base: buffer's base pointer
* @base_addr: buffer's base address
* @user_count: number of users of the buffer