/* SPDX-License-Identifier: GPL-2.0+ */ /* * plx9080.h * * Copyright (C) 2002,2003 Frank Mori Hess <fmhess@users.sourceforge.net> * ******************************************************************** * * Copyright (C) 1999 RG Studio s.c. * Written by Krzysztof Halasa <khc@rgstudio.com.pl> * * Portions (C) SBE Inc., used by permission.
*/
/** * struct plx_dma_desc - DMA descriptor format for PLX PCI 9080 * @pci_start_addr: PCI Bus address for transfer (DMAPADR). * @local_start_addr: Local Bus address for transfer (DMALADR). * @transfer_size: Transfer size in bytes (max 8 MiB) (DMASIZ). * @next: Address of next descriptor + flags (DMADPR). * * Describes the format of a scatter-gather DMA descriptor for the PLX * PCI 9080. All members are raw, little-endian register values that * will be transferred by the DMA engine from local or PCI memory into * corresponding registers for the DMA channel. * * The DMA descriptors must be aligned on a 16-byte boundary. Bits 3:0 * of @next contain flags describing the address space of the next * descriptor (local or PCI), an "end of chain" marker, an "interrupt on * terminal count" bit, and a data transfer direction.
*/ struct plx_dma_desc {
__le32 pci_start_addr;
__le32 local_start_addr;
__le32 transfer_size;
__le32 next;
};
/* * Register Offsets and Bit Definitions
*/
/* Local Address Space 0 Range Register */ #define PLX_REG_LAS0RR 0x0000 /* Local Address Space 1 Range Register */ #define PLX_REG_LAS1RR 0x00f0
#define PLX_LASRR_IO BIT(0) /* Map to: 1=I/O, 0=Mem */ #define PLX_LASRR_MLOC_ANY32 (BIT(1) * 0) /* Locate anywhere in 32 bit */ #define PLX_LASRR_MLOC_LT1MB (BIT(1) * 1) /* Locate in 1st meg */ #define PLX_LASRR_MLOC_ANY64 (BIT(1) * 2) /* Locate anywhere in 64 bit */ #define PLX_LASRR_MLOC_MASK GENMASK(2, 1) /* Memory location bits */ #define PLX_LASRR_PREFETCH BIT(3) /* Memory is prefetchable */ /* bits that specify range for memory space decode bits */ #define PLX_LASRR_MEM_MASK GENMASK(31, 4) /* bits that specify range for i/o space decode bits */ #define PLX_LASRR_IO_MASK GENMASK(31, 2)
/* Local Address Space 0 Local Base Address (Remap) Register */ #define PLX_REG_LAS0BA 0x0004 /* Local Address Space 1 Local Base Address (Remap) Register */ #define PLX_REG_LAS1BA 0x00f4
#define PLX_LASBA_EN BIT(0) /* Enable slave decode */ /* bits that specify local base address for memory space */ #define PLX_LASBA_MEM_MASK GENMASK(31, 4) /* bits that specify local base address for i/o space */ #define PLX_LASBA_IO_MASK GENMASK(31, 2)
/* Configuration Register Big Endian Mode */ #define PLX_BIGEND_CONFIG BIT(0) /* Direct Master Big Endian Mode */ #define PLX_BIGEND_DM BIT(1) /* Direct Slave Address Space 0 Big Endian Mode */ #define PLX_BIGEND_DSAS0 BIT(2) /* Direct Slave Expansion ROM Big Endian Mode */ #define PLX_BIGEND_EROM BIT(3) /* Big Endian Byte Lane Mode - use most significant byte lanes */ #define PLX_BIGEND_BEBLM BIT(4) /* Direct Slave Address Space 1 Big Endian Mode */ #define PLX_BIGEND_DSAS1 BIT(5) /* DMA Channel 1 Big Endian Mode */ #define PLX_BIGEND_DMA1 BIT(6) /* DMA Channel 0 Big Endian Mode */ #define PLX_BIGEND_DMA0 BIT(7) /* DMA Channel N Big Endian Mode (N <= 1) */ #define PLX_BIGEND_DMA(n) ((n) ? PLX_BIGEND_DMA1 : PLX_BIGEND_DMA0)
/* * Note: The Expansion ROM stuff is only relevant to the PC environment. * This expansion ROM code is executed by the host CPU at boot time. * For this reason no bit definitions are provided here.
*/
/* Expansion ROM Range Register */ #define PLX_REG_EROMRR 0x0010 /* Expansion ROM Local Base Address (Remap) Register */ #define PLX_REG_EROMBA 0x0014
/* Local Address Space 0/Expansion ROM Bus Region Descriptor Register */ #define PLX_REG_LBRD0 0x0018 /* Local Address Space 1 Bus Region Descriptor Register */ #define PLX_REG_LBRD1 0x00f8
/* * Mailbox Register N (N <= 7) * * Note that if the I2O feature is enabled (QSR[0] is set), Mailbox Register 0 * is replaced by the Inbound Queue Port, and Mailbox Register 1 is replaced * by the Outbound Queue Port. However, Mailbox Register 0 and 1 are always * accessible at alternative offsets if the I2O feature is enabled.
*/ #define PLX_REG_MBOX(n) (0x0040 + (n) * 4) #define PLX_REG_MBOX0 PLX_REG_MBOX(0) #define PLX_REG_MBOX1 PLX_REG_MBOX(1) #define PLX_REG_MBOX2 PLX_REG_MBOX(2) #define PLX_REG_MBOX3 PLX_REG_MBOX(3) #define PLX_REG_MBOX4 PLX_REG_MBOX(4) #define PLX_REG_MBOX5 PLX_REG_MBOX(5) #define PLX_REG_MBOX6 PLX_REG_MBOX(6) #define PLX_REG_MBOX7 PLX_REG_MBOX(7)
/* Alternative offsets for Mailbox Registers 0 and 1 (in case I2O is enabled) */ #define PLX_REG_ALT_MBOX(n) ((n) < 2 ? 0x0078 + (n) * 4 : PLX_REG_MBOX(n)) #define PLX_REG_ALT_MBOX0 PLX_REG_ALT_MBOX(0) #define PLX_REG_ALT_MBOX1 PLX_REG_ALT_MBOX(1)
/* Descriptor Located In PCI Address Space (not local address space) */ #define PLX_DMADPR_DESCPCI BIT(0) /* End Of Chain */ #define PLX_DMADPR_CHAINEND BIT(1) /* Interrupt After Terminal Count */ #define PLX_DMADPR_TCINTR BIT(2) /* Direction Of Transfer Local Bus To PCI (not PCI to local) */ #define PLX_DMADPR_XFERL2P BIT(3) /* Next Descriptor Address Bits 31:4 (16 byte boundary) */ #define PLX_DMADPR_NEXT_MASK GENMASK(31, 4)
/* DMA Channel 0 PCI-to-Local Almost Full (divided by 2, minus 1) */ #define PLX_DMATHR_C0PLAF(x) (BIT(0) * ((x) & 0xf)) #define PLX_DMATHR_C0PLAF_MASK GENMASK(3, 0) #define PLX_DMATHR_TO_C0PLAF(r) ((r) & PLX_DMATHR_C0PLAF_MASK) /* DMA Channel 0 Local-to-PCI Almost Empty (divided by 2, minus 1) */ #define PLX_DMATHR_C0LPAE(x) (BIT(4) * ((x) & 0xf)) #define PLX_DMATHR_C0LPAE_MASK GENMASK(7, 4) #define PLX_DMATHR_TO_C0LPAE(r) (((r) & PLX_DMATHR_C0LPAE_MASK) >> 4) /* DMA Channel 0 Local-to-PCI Almost Full (divided by 2, minus 1) */ #define PLX_DMATHR_C0LPAF(x) (BIT(8) * ((x) & 0xf)) #define PLX_DMATHR_C0LPAF_MASK GENMASK(11, 8) #define PLX_DMATHR_TO_C0LPAF(r) (((r) & PLX_DMATHR_C0LPAF_MASK) >> 8) /* DMA Channel 0 PCI-to-Local Almost Empty (divided by 2, minus 1) */ #define PLX_DMATHR_C0PLAE(x) (BIT(12) * ((x) & 0xf)) #define PLX_DMATHR_C0PLAE_MASK GENMASK(15, 12) #define PLX_DMATHR_TO_C0PLAE(r) (((r) & PLX_DMATHR_C0PLAE_MASK) >> 12) /* DMA Channel 1 PCI-to-Local Almost Full (divided by 2, minus 1) */ #define PLX_DMATHR_C1PLAF(x) (BIT(16) * ((x) & 0xf)) #define PLX_DMATHR_C1PLAF_MASK GENMASK(19, 16) #define PLX_DMATHR_TO_C1PLAF(r) (((r) & PLX_DMATHR_C1PLAF_MASK) >> 16) /* DMA Channel 1 Local-to-PCI Almost Empty (divided by 2, minus 1) */ #define PLX_DMATHR_C1LPAE(x) (BIT(20) * ((x) & 0xf)) #define PLX_DMATHR_C1LPAE_MASK GENMASK(23, 20) #define PLX_DMATHR_TO_C1LPAE(r) (((r) & PLX_DMATHR_C1LPAE_MASK) >> 20) /* DMA Channel 1 Local-to-PCI Almost Full (divided by 2, minus 1) */ #define PLX_DMATHR_C1LPAF(x) (BIT(24) * ((x) & 0xf)) #define PLX_DMATHR_C1LPAF_MASK GENMASK(27, 24) #define PLX_DMATHR_TO_C1LPAF(r) (((r) & PLX_DMATHR_C1LPAF_MASK) >> 24) /* DMA Channel 1 PCI-to-Local Almost Empty (divided by 2, minus 1) */ #define PLX_DMATHR_C1PLAE(x) (BIT(28) * ((x) & 0xf)) #define PLX_DMATHR_C1PLAE_MASK GENMASK(31, 28) #define PLX_DMATHR_TO_C1PLAE(r) (((r) & PLX_DMATHR_C1PLAE_MASK) >> 28)
/* * Messaging Queue Registers OPLFIS, OPLFIM, IQP, OQP, MQCR, QBAR, IFHPR, * IFTPR, IPHPR, IPTPR, OFHPR, OFTPR, OPHPR, OPTPR, and QSR have been omitted. * They are used by the I2O feature. (IQP and OQP occupy the usual offsets of * the MBOX0 and MBOX1 registers if the I2O feature is enabled, but MBOX0 and * MBOX1 are accessible via alternative offsets.
*/
/* Value of QSR after reset - disables I2O feature completely. */ #define PLX_QSR_VALUE_AFTER_RESET 0x00000050
/* * Accesses near the end of memory can cause the PLX chip * to pre-fetch data off of end-of-ram. Limit the size of * memory so host-side accesses cannot occur.
*/
#define PLX_PREFETCH 32
/** * plx9080_abort_dma - Abort a PLX PCI 9080 DMA transfer * @iobase: Remapped base address of configuration registers. * @channel: DMA channel number (0 or 1). * * Aborts the DMA transfer on the channel, which must have been enabled * and started beforehand. * * Return: * %0 on success. * -%ETIMEDOUT if timed out waiting for abort to complete.
*/ staticinlineint plx9080_abort_dma(void __iomem *iobase, unsignedint channel)
{ void __iomem *dma_cs_addr;
u8 dma_status; constint timeout = 10000; unsignedint i;
dma_cs_addr = iobase + PLX_REG_DMACSR(channel);
/* abort dma transfer if necessary */
dma_status = readb(dma_cs_addr); if ((dma_status & PLX_DMACSR_ENABLE) == 0) return 0;
/* wait to make sure done bit is zero */ for (i = 0; (dma_status & PLX_DMACSR_DONE) && i < timeout; i++) {
udelay(1);
dma_status = readb(dma_cs_addr);
} if (i == timeout) return -ETIMEDOUT;
/* disable and abort channel */
writeb(PLX_DMACSR_ABORT, dma_cs_addr); /* wait for dma done bit */
dma_status = readb(dma_cs_addr); for (i = 0; (dma_status & PLX_DMACSR_DONE) == 0 && i < timeout; i++) {
udelay(1);
dma_status = readb(dma_cs_addr);
} if (i == timeout) return -ETIMEDOUT;
return 0;
}
#endif/* __COMEDI_PLX9080_H */
Messung V0.5
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.