drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/atomisp/pci/runtime/bufq/src/bufq.c- Extension
.c- Size
- 14781 bytes
- Lines
- 524
- Domain
- Driver Families
- Bucket
- drivers/staging
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
assert_support.hia_css_buffer.hsp.hia_css_bufq.hia_css_queue.hsw_event_global.hia_css_eventq.hia_css_debug.hsh_css_internal.hsp_local.hsh_css_firmware.h
Detected Declarations
struct sh_css_queuesfunction ia_css_queue_map_initfunction ia_css_queue_mapfunction ia_css_query_internal_queue_idfunction map_buffer_type_to_queue_idfunction unmap_buffer_type_to_queue_idfunction init_bufqfunction ia_css_bufq_initfunction ia_css_bufq_enqueue_bufferfunction ia_css_bufq_dequeue_bufferfunction ia_css_bufq_enqueue_psys_eventfunction ia_css_bufq_dequeue_psys_eventfunction ia_css_bufq_dequeue_isys_eventfunction ia_css_bufq_enqueue_isys_eventfunction ia_css_bufq_enqueue_tag_cmdfunction ia_css_bufq_deinitfunction bufq_dump_queue_infofunction ia_css_bufq_dump_queue_info
Annotated Snippet
struct sh_css_queues {
/* Host2SP buffer queue */
ia_css_queue_t host2sp_buffer_queue_handles
[SH_CSS_MAX_SP_THREADS][SH_CSS_MAX_NUM_QUEUES];
/* SP2Host buffer queue */
ia_css_queue_t sp2host_buffer_queue_handles
[SH_CSS_MAX_NUM_QUEUES];
/* Host2SP event queue */
ia_css_queue_t host2sp_psys_event_queue_handle;
/* SP2Host event queue */
ia_css_queue_t sp2host_psys_event_queue_handle;
/* Host2SP ISYS event queue */
ia_css_queue_t host2sp_isys_event_queue_handle;
/* SP2Host ISYS event queue */
ia_css_queue_t sp2host_isys_event_queue_handle;
/* Tagger command queue */
ia_css_queue_t host2sp_tag_cmd_queue_handle;
};
/*******************************************************
*** Static variables
********************************************************/
static struct sh_css_queues css_queues;
static int
buffer_type_to_queue_id_map[SH_CSS_MAX_SP_THREADS][IA_CSS_NUM_DYNAMIC_BUFFER_TYPE];
static bool queue_availability[SH_CSS_MAX_SP_THREADS][SH_CSS_MAX_NUM_QUEUES];
/*******************************************************
*** Static functions
********************************************************/
static void map_buffer_type_to_queue_id(
unsigned int thread_id,
enum ia_css_buffer_type buf_type
);
static void unmap_buffer_type_to_queue_id(
unsigned int thread_id,
enum ia_css_buffer_type buf_type
);
static ia_css_queue_t *bufq_get_qhandle(
enum sh_css_queue_type type,
enum sh_css_queue_id id,
int thread
);
/*******************************************************
*** Public functions
********************************************************/
void ia_css_queue_map_init(void)
{
unsigned int i, j;
for (i = 0; i < SH_CSS_MAX_SP_THREADS; i++) {
for (j = 0; j < SH_CSS_MAX_NUM_QUEUES; j++)
queue_availability[i][j] = true;
}
for (i = 0; i < SH_CSS_MAX_SP_THREADS; i++) {
for (j = 0; j < IA_CSS_NUM_DYNAMIC_BUFFER_TYPE; j++)
buffer_type_to_queue_id_map[i][j] = SH_CSS_INVALID_QUEUE_ID;
}
}
void ia_css_queue_map(
unsigned int thread_id,
enum ia_css_buffer_type buf_type,
bool map)
{
assert(buf_type < IA_CSS_NUM_DYNAMIC_BUFFER_TYPE);
assert(thread_id < SH_CSS_MAX_SP_THREADS);
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
"ia_css_queue_map() enter: buf_type=%d, thread_id=%d\n", buf_type, thread_id);
if (map)
map_buffer_type_to_queue_id(thread_id, buf_type);
else
unmap_buffer_type_to_queue_id(thread_id, buf_type);
}
/*
* @brief Query the internal queue ID.
*/
bool ia_css_query_internal_queue_id(
enum ia_css_buffer_type buf_type,
Annotation
- Immediate include surface: `assert_support.h`, `ia_css_buffer.h`, `sp.h`, `ia_css_bufq.h`, `ia_css_queue.h`, `sw_event_global.h`, `ia_css_eventq.h`, `ia_css_debug.h`.
- Detected declarations: `struct sh_css_queues`, `function ia_css_queue_map_init`, `function ia_css_queue_map`, `function ia_css_query_internal_queue_id`, `function map_buffer_type_to_queue_id`, `function unmap_buffer_type_to_queue_id`, `function init_bufq`, `function ia_css_bufq_init`, `function ia_css_bufq_enqueue_buffer`, `function ia_css_bufq_dequeue_buffer`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.