// SPDX-License-Identifier: GPL-2.0-or-later /* * Driver for the NXP SAA7164 PCIe bridge * * Copyright (c) 2010-2015 Steven Toth <[email protected]> */ #include <linux/slab.h> #include "saa7164.h" /* The PCI address space for buffer handling looks like this: * * +-u32 wide-------------+ * | + * +-u64 wide------------------------------------+ * + + * +----------------------+ * | CurrentBufferPtr + Pointer to current PCI buffer >-+ * +----------------------+ | * | Unused + | * +----------------------+ | * | Pitch + = 188 (bytes) | * +----------------------+ | * | PCI buffer size + = pitch * number of lines (312) | * +----------------------+ | * |0| Buf0 Write Offset + | * +----------------------+ v * |1| Buf1 Write Offset + | * +----------------------+ | * |2| Buf2 Write Offset + | * +----------------------+ | * |3| Buf3 Write Offset + | * +----------------------+ | * ... More write offsets | * +---------------------------------------------+ | * +0| set of ptrs to PCI pagetables + | * +---------------------------------------------+ | * +1| set of ptrs to PCI pagetables + <--------+ * +---------------------------------------------+ * +2| set of ptrs to PCI pagetables + * +---------------------------------------------+ * +3| set of ptrs to PCI pagetables + >--+ * +---------------------------------------------+ | * ... More buffer pointers | +----------------+ * +->| pt[0] TS data | * | +----------------+ * | * | +----------------+ * +->| pt[1] TS data | * | +----------------+ * | etc */ void saa7164_buffer_display(struct saa7164_buffer *buf) { … } /* Allocate a new buffer structure and associated PCI space in bytes. * len must be a multiple of sizeof(u64) */ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port, u32 len) { … } int saa7164_buffer_dealloc(struct saa7164_buffer *buf) { … } int saa7164_buffer_zero_offsets(struct saa7164_port *port, int i) { … } /* Write a buffer into the hardware */ int saa7164_buffer_activate(struct saa7164_buffer *buf, int i) { … } int saa7164_buffer_cfg_port(struct saa7164_port *port) { … } struct saa7164_user_buffer *saa7164_buffer_alloc_user(struct saa7164_dev *dev, u32 len) { … } void saa7164_buffer_dealloc_user(struct saa7164_user_buffer *buf) { … }