Home | History | Annotate | Line # | Download | only in ieee1394
fwohcireg.h revision 1.5
      1  1.5  enami /*	$NetBSD: fwohcireg.h,v 1.5 2000/12/13 11:30:15 enami Exp $	*/
      2  1.5  enami 
      3  1.1   matt /*-
      4  1.1   matt  * Copyright (c) 2000 The NetBSD Foundation, Inc.
      5  1.1   matt  * All rights reserved.
      6  1.1   matt  *
      7  1.1   matt  * This code is derived from software contributed to The NetBSD Foundation
      8  1.1   matt  * by Matt Thomas of 3am Software Foundry.
      9  1.1   matt  *
     10  1.1   matt  * Redistribution and use in source and binary forms, with or without
     11  1.1   matt  * modification, are permitted provided that the following conditions
     12  1.1   matt  * are met:
     13  1.1   matt  * 1. Redistributions of source code must retain the above copyright
     14  1.1   matt  *    notice, this list of conditions and the following disclaimer.
     15  1.1   matt  * 2. Redistributions in binary form must reproduce the above copyright
     16  1.1   matt  *    notice, this list of conditions and the following disclaimer in the
     17  1.1   matt  *    documentation and/or other materials provided with the distribution.
     18  1.1   matt  * 3. All advertising materials mentioning features or use of this software
     19  1.1   matt  *    must display the following acknowledgement:
     20  1.1   matt  *        This product includes software developed by the NetBSD
     21  1.1   matt  *        Foundation, Inc. and its contributors.
     22  1.1   matt  * 4. Neither the name of The NetBSD Foundation nor the names of its
     23  1.1   matt  *    contributors may be used to endorse or promote products derived
     24  1.1   matt  *    from this software without specific prior written permission.
     25  1.1   matt  *
     26  1.1   matt  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
     27  1.1   matt  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     28  1.1   matt  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     29  1.1   matt  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
     30  1.1   matt  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     31  1.1   matt  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     32  1.1   matt  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     33  1.1   matt  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     34  1.1   matt  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     35  1.1   matt  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     36  1.1   matt  * POSSIBILITY OF SUCH DAMAGE.
     37  1.1   matt  */
     38  1.1   matt 
     39  1.1   matt #ifndef _DEV_IEEE1394_FWOHCIREG_H_
     40  1.1   matt #define _DEV_IEEE1394_FWOHCIREG_H_
     41  1.1   matt 
     42  1.1   matt /* PCI/CardBus-Specific definitions
     43  1.1   matt  */
     44  1.1   matt 
     45  1.1   matt /* In the PCI Class Code Register ...
     46  1.1   matt  */
     47  1.1   matt #define	PCI_INTERFACE_OHCI		0x10
     48  1.1   matt 
     49  1.1   matt /* The OHCI Regisers are in PCI BAR0.
     50  1.1   matt  */
     51  1.1   matt #define	PCI_OHCI_MAP_REGISTER		0x10
     52  1.1   matt 
     53  1.1   matt /* HCI Control Register (in PCI config space)
     54  1.1   matt  */
     55  1.1   matt #define	PCI_OHCI_CONTROL_REGISTER	0x40
     56  1.1   matt 
     57  1.1   matt /* If the following bit, all OHCI register access
     58  1.1   matt  * and DMA transactions are byte swapped.
     59  1.1   matt  */
     60  1.1   matt #define	PCI_GLOBAL_SWAP_BE		0x00000001
     61  1.1   matt 
     62  1.1   matt /* Bus Independent Definitions */
     63  1.1   matt 
     64  1.3   matt #define	OHCI_CONFIG_SIZE		1024
     65  1.3   matt #define	OHCI_CONFIG_ALIGNMENT		1024
     66  1.3   matt 
     67  1.1   matt /* OHCI Registers
     68  1.1   matt  * OHCI Registers are divided into four spaces:
     69  1.1   matt  *   1) 0x000 .. 0x17C = Control register space
     70  1.1   matt  *   2) 0x180 .. 0x1FC = Asynchronous DMA context register space
     71  1.1   matt  *			 (4 contexts)
     72  1.1   matt  *   3) 0x200 .. 0x3FC = Isochronous Transmit DMA context register space
     73  1.1   matt  *			 (32 contexts)
     74  1.1   matt  *   4) 0x400 .. 0x7FC = Isochronous Receive DMA context register space
     75  1.1   matt  *			 (32 contexts)
     76  1.1   matt  */
     77  1.1   matt #define	OHCI_REG_Version			0x000
     78  1.1   matt #define	OHCI_REG_Guid_Rom			0x004
     79  1.1   matt #define	OHCI_REG_ATRetries			0x008
     80  1.1   matt #define	OHCI_REG_CsrReadData			0x00c
     81  1.1   matt #define	OHCI_REG_CsrCompareData			0x010
     82  1.1   matt #define	OHCI_REG_CsrControl			0x014
     83  1.1   matt #define	OHCI_REG_ConfigROMhdr			0x018
     84  1.1   matt #define	OHCI_REG_BusId				0x01c
     85  1.1   matt #define	OHCI_REG_BusOptions			0x020
     86  1.1   matt #define	OHCI_REG_GUIDHi				0x024
     87  1.1   matt #define	OHCI_REG_GUIDLo				0x028
     88  1.1   matt #define	OHCI_REG_reserved_02c			0x02c
     89  1.1   matt #define	OHCI_REG_reserved_030			0x030
     90  1.1   matt #define	OHCI_REG_ConfigROMmap			0x034
     91  1.1   matt #define	OHCI_REG_PostedWriteAddressLo		0x038
     92  1.1   matt #define	OHCI_REG_PostedWriteAddressHi		0x03c
     93  1.1   matt #define	OHCI_REG_VendorId			0x040
     94  1.1   matt #define	OHCI_REG_reserved_044			0x044
     95  1.1   matt #define	OHCI_REG_reserved_048			0x048
     96  1.1   matt #define	OHCI_REG_reserved_04c			0x04c
     97  1.1   matt #define	OHCI_REG_HCControlSet			0x050
     98  1.1   matt #define	OHCI_REG_HCControlClear			0x054
     99  1.1   matt #define	OHCI_REG_reserved_058			0x058
    100  1.1   matt #define	OHCI_REG_reserved_05c			0x05c
    101  1.1   matt #define	OHCI_REG_reserved_060			0x060
    102  1.1   matt #define	OHCI_REG_SelfIDBuffer			0x064
    103  1.1   matt #define	OHCI_REG_SelfIDCount			0x068
    104  1.1   matt #define	OHCI_REG_reserved_06c			0x06c
    105  1.1   matt #define	OHCI_REG_IRMultiChanMaskHiSet		0x070
    106  1.1   matt #define	OHCI_REG_IRMultiChanMaskHiClear		0x074
    107  1.1   matt #define	OHCI_REG_IRMultiChanMaskLoSet		0x078
    108  1.1   matt #define	OHCI_REG_IRMultiChanMaskLoClear		0x07c
    109  1.1   matt #define	OHCI_REG_IntEventSet			0x080
    110  1.1   matt #define	OHCI_REG_IntEventClear			0x084
    111  1.1   matt #define	OHCI_REG_IntMaskSet			0x088
    112  1.1   matt #define	OHCI_REG_IntMaskClear			0x08c
    113  1.1   matt #define	OHCI_REG_IsoXmitIntEventSet		0x090
    114  1.1   matt #define	OHCI_REG_IsoXmitIntEventClear		0x094
    115  1.1   matt #define	OHCI_REG_IsoXmitIntMaskSet		0x098
    116  1.1   matt #define	OHCI_REG_IsoXmitIntMaskClear		0x09c
    117  1.1   matt #define	OHCI_REG_IsoRecvIntEventSet		0x0a0
    118  1.1   matt #define	OHCI_REG_IsoRecvIntEventClear		0x0a4
    119  1.1   matt #define	OHCI_REG_IsoRecvIntMaskSet		0x0a8
    120  1.1   matt #define	OHCI_REG_IsoRecvIntMaskClear		0x0ac
    121  1.1   matt #define	OHCI_REG_InitialBandwidthAvailable	0x0b0
    122  1.1   matt #define	OHCI_REG_InitialChannelsAvailableHi	0x0b4
    123  1.1   matt #define	OHCI_REG_InitialChannelsAvailableLo	0x0b8
    124  1.1   matt #define	OHCI_REG_reserved_0bc			0x0bc
    125  1.1   matt #define	OHCI_REG_reserved_0c0			0x0c0
    126  1.1   matt #define	OHCI_REG_reserved_0c4			0x0c4
    127  1.1   matt #define	OHCI_REG_reserved_0c8			0x0c8
    128  1.1   matt #define	OHCI_REG_reserved_0cc			0x0cc
    129  1.1   matt #define	OHCI_REG_reserved_0d0			0x0d0
    130  1.1   matt #define	OHCI_REG_reserved_0d4			0x0d4
    131  1.1   matt #define	OHCI_REG_reserved_0d8			0x0d8
    132  1.1   matt #define	OHCI_REG_FairnessConctrol		0x0dc
    133  1.1   matt #define	OHCI_REG_LinkControlSet			0x0e0
    134  1.1   matt #define	OHCI_REG_LinkControlClear		0x0e4
    135  1.1   matt #define	OHCI_REG_NodeId				0x0e8
    136  1.1   matt #define	OHCI_REG_PhyControl			0x0ec
    137  1.1   matt #define	OHCI_REG_IsochronousCycleTimer		0x0f0
    138  1.1   matt #define	OHCI_REG_reserved_0f0			0x0f4
    139  1.1   matt #define	OHCI_REG_reserved_0f8			0x0f8
    140  1.1   matt #define	OHCI_REG_reserved_0fc			0x0fc
    141  1.1   matt #define	OHCI_REG_AsynchronousRequestFilterHiSet	0x100
    142  1.1   matt #define	OHCI_REG_AsynchronousRequestFilterHiClear	0x104
    143  1.1   matt #define	OHCI_REG_AsynchronousRequestFilterLoSet	0x108
    144  1.1   matt #define	OHCI_REG_AsynchronousRequestFilterLoClear	0x10c
    145  1.1   matt #define	OHCI_REG_PhysicalRequestFilterHiSet	0x110
    146  1.1   matt #define	OHCI_REG_PhysicalRequestFilterHiClear	0x114
    147  1.1   matt #define	OHCI_REG_PhysicalRequestFilterLoSet	0x118
    148  1.1   matt #define	OHCI_REG_PhysicalRequestFilterLoCLear	0x11c
    149  1.1   matt #define	OHCI_REG_PhysicalUpperBound		0x120
    150  1.1   matt #define	OHCI_REG_reserved_124			0x124
    151  1.1   matt #define	OHCI_REG_reserved_128			0x128
    152  1.1   matt #define	OHCI_REG_reserved_12c			0x12c
    153  1.1   matt #define	OHCI_REG_reserved_130			0x130
    154  1.1   matt #define	OHCI_REG_reserved_134			0x134
    155  1.1   matt #define	OHCI_REG_reserved_138			0x138
    156  1.1   matt #define	OHCI_REG_reserved_13c			0x13c
    157  1.1   matt #define	OHCI_REG_reserved_140			0x140
    158  1.1   matt #define	OHCI_REG_reserved_144			0x144
    159  1.1   matt #define	OHCI_REG_reserved_148			0x148
    160  1.1   matt #define	OHCI_REG_reserved_14c			0x14c
    161  1.1   matt #define	OHCI_REG_reserved_150			0x150
    162  1.1   matt #define	OHCI_REG_reserved_154			0x154
    163  1.1   matt #define	OHCI_REG_reserved_158			0x158
    164  1.1   matt #define	OHCI_REG_reserved_15c			0x15c
    165  1.1   matt #define	OHCI_REG_reserved_160			0x160
    166  1.1   matt #define	OHCI_REG_reserved_164			0x164
    167  1.1   matt #define	OHCI_REG_reserved_168			0x168
    168  1.1   matt #define	OHCI_REG_reserved_16c			0x16c
    169  1.1   matt #define	OHCI_REG_reserved_170			0x170
    170  1.1   matt #define	OHCI_REG_reserved_174			0x174
    171  1.1   matt #define	OHCI_REG_reserved_178			0x178
    172  1.1   matt #define	OHCI_REG_reserved_17c			0x17c
    173  1.1   matt 
    174  1.1   matt 
    175  1.1   matt #define	OHCI_REG_ASYNC_DMA_BASE			0x180
    176  1.1   matt #define	OHCI_CTX_ASYNC_TX_REQUEST		0
    177  1.1   matt #define	OHCI_CTX_ASYNC_TX_RESPONSE		1
    178  1.1   matt #define	OHCI_CTX_ASYNC_RX_REQUEST		2
    179  1.1   matt #define	OHCI_CTX_ASYNC_RX_RESPONSE		3
    180  1.1   matt #define	OHCI_SUBREG_ContextControlSet		0x000
    181  1.1   matt #define	OHCI_SUBREG_ContextControlClear		0x004
    182  1.1   matt #define	OHCI_SUBREG_reserved_008		0x008
    183  1.1   matt #define	OHCI_SUBREG_CommandPtr			0x00c
    184  1.2   onoe #define	OHCI_SUBREG_ContextMatch		0x010
    185  1.1   matt #define	OHCI_SUBREG_reserved_014		0x014
    186  1.1   matt #define	OHCI_SUBREG_reserved_018		0x018
    187  1.1   matt #define	OHCI_SUBREG_reserved_01c		0x01c
    188  1.1   matt #define	OHCI_ASYNC_DMA_WRITE(sc, ctx, reg, val) \
    189  1.2   onoe 	OHCI_CSR_WRITE(sc, OHCI_REG_ASYNC_DMA_BASE + 32*(ctx) + (reg), val)
    190  1.2   onoe #define	OHCI_ASYNC_DMA_READ(sc, ctx, reg) \
    191  1.2   onoe 	OHCI_CSR_READ(sc, OHCI_REG_ASYNC_DMA_BASE + 32*(ctx) + (reg))
    192  1.1   matt 
    193  1.1   matt #define	OHCI_REG_SYNC_TX_DMA_BASE		0x200
    194  1.1   matt #define	OHCI_SYNC_TX_DMA_WRITE(sc, ctx, reg, val) \
    195  1.1   matt 	OHCI_CSR_WRITE(sc, OHCI_REG_SYNC_TX_DMA_BASE + 16*(ctx) + (reg), val)
    196  1.2   onoe #define	OHCI_SYNC_TX_DMA_READ(sc, ctx, reg) \
    197  1.2   onoe 	OHCI_CSR_READ(sc, OHCI_REG_SYNC_TX_DMA_BASE + 16*(ctx) + (reg))
    198  1.1   matt 
    199  1.1   matt #define	OHCI_REG_SYNC_RX_DMA_BASE	0x400
    200  1.1   matt #define	OHCI_SYNC_RX_DMA_WRITE(sc, ctx, reg, val) \
    201  1.1   matt 	OHCI_CSR_WRITE(sc, OHCI_REG_SYNC_RX_DMA_BASE + 32*(ctx) + (reg), val)
    202  1.2   onoe #define	OHCI_SYNC_RX_DMA_READ(sc, ctx, reg) \
    203  1.2   onoe 	OHCI_CSR_READ(sc, OHCI_REG_SYNC_RX_DMA_BASE + 32*(ctx) + (reg))
    204  1.1   matt 
    205  1.1   matt /* OHCI_REG_Version
    206  1.1   matt  */
    207  1.1   matt #define	OHCI_Version_GUID_ROM		0x01000000
    208  1.1   matt #define	OHCI_Version_GET_Version(x)	((((x) >> 16) & 0xf) + (((x) >> 20) & 0xf) * 10)
    209  1.1   matt #define	OHCI_Version_GET_Revision(x)	((((x) >> 4) & 0xf) + ((x) & 0xf) * 10)
    210  1.1   matt 
    211  1.1   matt /* OHCI_REG_GUIDxx
    212  1.1   matt  */
    213  1.1   matt 
    214  1.2   onoe /* OHCI_REG_CsrControl
    215  1.2   onoe  */
    216  1.2   onoe #define	OHCI_CsrControl_Done		0x80000000
    217  1.2   onoe #define	OHCI_CsrControl_SelMASK		0x00000003
    218  1.2   onoe #define	OHCI_CsrControl_BusManId		0
    219  1.2   onoe #define	OHCI_CsrControl_BWAvail			1
    220  1.2   onoe #define	OHCI_CsrControl_ChanAvailHi		2
    221  1.2   onoe #define	OHCI_CsrControl_ChanAvailLo		3
    222  1.2   onoe 
    223  1.1   matt /* OHCI_REG_BusOptions
    224  1.1   matt  */
    225  1.1   matt #define	OHCI_BusOptions_LinkSpd_MASK	0x00000007
    226  1.1   matt #define	OHCI_BusOptions_LinkSpd_BITPOS	0
    227  1.1   matt #define	OHCI_BusOptions_G_MASK		0x000000c0
    228  1.1   matt #define	OHCI_BusOptions_G_BITPOS	6
    229  1.1   matt #define	OHCI_BusOptions_MaxRec_MASK	0x0000f000
    230  1.1   matt #define	OHCI_BusOptions_MaxRec_BITPOS	12
    231  1.1   matt #define	OHCI_BusOptions_CycClkAcc_MASK	0x00ff0000
    232  1.1   matt #define	OHCI_BusOptions_CycClkAcc_BITPOS 16
    233  1.1   matt #define	OHCI_BusOptions_PMC		0x08000000
    234  1.1   matt #define	OHCI_BusOptions_BMC		0x10000000
    235  1.1   matt #define	OHCI_BusOptions_ISC		0x20000000
    236  1.1   matt #define	OHCI_BusOptions_CMC		0x40000000
    237  1.1   matt #define	OHCI_BusOptions_IRMC		0x80000000
    238  1.1   matt #define	OHCI_BusOptions_reserved	0x07000f38
    239  1.1   matt 
    240  1.2   onoe /* OHCI_REG_HCControl
    241  1.2   onoe  */
    242  1.2   onoe 
    243  1.2   onoe #define	OHCI_HCControl_SoftReset	0x00010000
    244  1.2   onoe #define	OHCI_HCControl_LinkEnable	0x00020000
    245  1.2   onoe #define	OHCI_HCControl_PostedWriteEnable 0x00040000
    246  1.2   onoe #define	OHCI_HCControl_LPS		0x00080000
    247  1.2   onoe #define	OHCI_HCControl_APhyEnhanceEnable 0x00400000
    248  1.2   onoe #define	OHCI_HCControl_ProgramPhyEnable	0x00800000
    249  1.2   onoe #define	OHCI_HCControl_NoByteSwapData	0x40000000
    250  1.2   onoe #define	OHCI_HCControl_BIBImageValid	0x80000000
    251  1.2   onoe 
    252  1.2   onoe /* OHCI_REG_SelfID
    253  1.2   onoe  */
    254  1.2   onoe #define	OHCI_SelfID_Error		0x80000000
    255  1.2   onoe #define	OHCI_SelfID_Gen_MASK		0x00ff0000
    256  1.2   onoe #define	OHCI_SelfID_Gen_BITPOS		16
    257  1.2   onoe #define	OHCI_SelfID_Size_MASK		0x000007fc
    258  1.2   onoe #define	OHCI_SelfID_Size_BITPOS		2
    259  1.2   onoe 
    260  1.1   matt /* OCHI_REG_Int{Event|Mask}*
    261  1.1   matt  */
    262  1.1   matt #define	OHCI_Int_MasterEnable		0x80000000
    263  1.2   onoe #define	OHCI_Int_VendorSpecific		0x40000000
    264  1.2   onoe #define	OHCI_Int_SoftInterrupt		0x20000000
    265  1.2   onoe #define	OHCI_Int_Ack_Tardy		0x08000000
    266  1.2   onoe #define	OHCI_Int_PhyRegRcvd		0x04000000
    267  1.2   onoe #define	OHCI_Int_CycleTooLong		0x02000000
    268  1.2   onoe #define	OHCI_Int_UnrecoverableError	0x01000000
    269  1.2   onoe #define	OHCI_Int_CycleInconsistent	0x00800000
    270  1.2   onoe #define	OHCI_Int_CycleLost		0x00400000
    271  1.2   onoe #define	OHCI_Int_Cycle64Seconds		0x00200000
    272  1.2   onoe #define	OHCI_Int_CycleSynch		0x00100000
    273  1.2   onoe #define	OHCI_Int_Phy			0x00080000
    274  1.2   onoe #define	OHCI_Int_RegAccessFail		0x00040000
    275  1.2   onoe #define	OHCI_Int_BusReset		0x00020000
    276  1.2   onoe #define	OHCI_Int_SelfIDComplete		0x00010000
    277  1.2   onoe #define	OHCI_Int_SelfIDCOmplete2	0x00008000
    278  1.2   onoe #define	OHCI_Int_LockRespErr		0x00000200
    279  1.2   onoe #define	OHCI_Int_PostedWriteErr		0x00000100
    280  1.2   onoe #define	OHCI_Int_IsochRx		0x00000080
    281  1.2   onoe #define	OHCI_Int_IsochTx		0x00000040
    282  1.2   onoe #define	OHCI_Int_RSPkt			0x00000020
    283  1.2   onoe #define	OHCI_Int_RQPkt			0x00000010
    284  1.2   onoe #define	OHCI_Int_ARRS			0x00000008
    285  1.2   onoe #define	OHCI_Int_ARRQ			0x00000004
    286  1.2   onoe #define	OHCI_Int_RespTxComplete		0x00000002
    287  1.2   onoe #define	OHCI_Int_ReqTxComplete		0x00000001
    288  1.2   onoe 
    289  1.2   onoe /* OHCI_REG_LinkControl
    290  1.2   onoe  */
    291  1.2   onoe #define	OHCI_LinkControl_CycleSource	0x00400000
    292  1.2   onoe #define	OHCI_LinkControl_CycleMaster	0x00200000
    293  1.2   onoe #define	OHCI_LinkControl_CycleTimerEnable 0x00100000
    294  1.2   onoe #define	OHCI_LinkControl_RcvPhyPkt	0x00000400
    295  1.2   onoe #define	OHCI_LinkControl_RcvSelfID	0x00000200
    296  1.2   onoe #define	OHCI_LinkControl_Tag1SyncFilterLock 0x00000040
    297  1.2   onoe 
    298  1.2   onoe /* OHCI_REG_NodeId
    299  1.2   onoe  */
    300  1.2   onoe #define	OHCI_NodeId_IDValid		0x80000000
    301  1.2   onoe #define	OHCI_NodeId_ROOT		0x40000000
    302  1.2   onoe #define	OHCI_NodeId_CPS			0x08000000
    303  1.2   onoe #define	OHCI_NodeId_BusNumber		0x0000ffc0
    304  1.2   onoe #define	OHCI_NodeId_NodeNumber		0x0000003f
    305  1.2   onoe 
    306  1.2   onoe /* OHCI_REG_PhyControl
    307  1.2   onoe  */
    308  1.2   onoe #define	OHCI_PhyControl_RdDone		0x80000000
    309  1.2   onoe #define	OHCI_PhyControl_RdAddr		0x0f000000
    310  1.2   onoe #define	OHCI_PhyControl_RdAddr_BITPOS	24
    311  1.2   onoe #define	OHCI_PhyControl_RdData		0x00ff0000
    312  1.2   onoe #define	OHCI_PhyControl_RdData_BITPOS	16
    313  1.2   onoe #define	OHCI_PhyControl_RdReg		0x00008000
    314  1.2   onoe #define	OHCI_PhyControl_WrReg		0x00004000
    315  1.2   onoe #define	OHCI_PhyControl_RegAddr		0x00000f00
    316  1.2   onoe #define	OHCI_PhyControl_RegAddr_BITPOS	8
    317  1.2   onoe #define	OHCI_PhyControl_WrData		0x000000ff
    318  1.2   onoe #define	OHCI_PhyControl_WrData_BITPOS	0
    319  1.1   matt 
    320  1.1   matt /*
    321  1.1   matt  * Section 3.1.1: ContextControl register
    322  1.1   matt  *
    323  1.1   matt  *
    324  1.1   matt  */
    325  1.1   matt #define	OHCI_CTXCTL_RUN			0x00008000
    326  1.1   matt #define	OHCI_CTXCTL_WAKE		0x00001000
    327  1.1   matt #define	OHCI_CTXCTL_DEAD		0x00000800
    328  1.1   matt #define	OHCI_CTXCTL_ACTIVE		0x00000400
    329  1.1   matt 
    330  1.1   matt #define	OHCI_CTXCTL_SPD_BITLEN		3
    331  1.1   matt #define	OHCI_CTXCTL_SPD_BITPOS		5
    332  1.1   matt 
    333  1.1   matt #define	OHCI_CTXCTL_SPD_100		0
    334  1.1   matt #define	OHCI_CTXCTL_SPD_200		1
    335  1.1   matt #define	OHCI_CTXCTL_SPD_400		2
    336  1.1   matt 
    337  1.1   matt #define	OHCI_CTXCTL_EVENT_BITLEN	5
    338  1.1   matt #define	OHCI_CTXCTL_EVENT_BITPOS	0
    339  1.1   matt 
    340  1.1   matt /* Events from 0 to 15 are generated by the OpenHCI controller.
    341  1.1   matt  * Events from 16 to 31 are four-bit IEEE 1394 ack codes or'ed with bit 4 set.
    342  1.1   matt  */
    343  1.1   matt #define	OHCI_CTXCTL_EVENT_NO_STATUS		0
    344  1.1   matt #define	OHCI_CTXCTL_EVENT_RESERVED1		1
    345  1.1   matt 
    346  1.1   matt /* The received data length was greater than the buffer's data_length.
    347  1.1   matt  */
    348  1.1   matt #define	OHCI_CTXCTL_EVENT_LONG_PACKET		2
    349  1.1   matt 
    350  1.1   matt /* A subaction gap was detected before an ack arrived or the received
    351  1.1   matt  * ack had a parity error.
    352  1.1   matt  */
    353  1.1   matt #define	OHCI_CTXCTL_EVENT_MISSING_ACK		3
    354  1.1   matt 
    355  1.1   matt /* Underrun on the corresponding FIFO. The packet was truncated.
    356  1.1   matt  */
    357  1.1   matt #define	OHCI_CTXCTL_EVENT_UNDERRUN		4
    358  1.1   matt 
    359  1.1   matt /* A receive FIFO overflowed during the reception of an isochronous packet.
    360  1.1   matt  */
    361  1.1   matt #define	OHCI_CTXCTL_EVENT_OVERRUN		5
    362  1.1   matt 
    363  1.1   matt /* An unrecoverable error occurred while the Host Controller was reading
    364  1.1   matt  * a descriptor block.
    365  1.1   matt  */
    366  1.1   matt #define	OHCI_CTXCTL_EVENT_DESCRIPTOR_READ	6
    367  1.1   matt 
    368  1.1   matt /* An error occurred while the Host Controller was attempting to read
    369  1.1   matt  * from host memory in the data stage of descriptor processing.
    370  1.1   matt  */
    371  1.1   matt #define	OHCI_CTXCTL_EVENT_DATA_READ		7
    372  1.1   matt 
    373  1.1   matt /* An error occurred while the Host Controller was attempting to write
    374  1.1   matt  * to host memory either in the data stage of descriptor processing
    375  1.1   matt  * (AR, IR), or when processing a single 16-bit host * memory write (IT).
    376  1.1   matt  */
    377  1.1   matt #define	OHCI_CTXCTL_EVENT_DATA_WRITE		8
    378  1.1   matt 
    379  1.1   matt /* Identifies a PHY packet in the receive buffer as being the synthesized
    380  1.1   matt  * bus reset packet.  (See section 8.4.2.3).
    381  1.1   matt  */
    382  1.1   matt #define	OHCI_CTXCTL_EVENT_BUS_RESET		9
    383  1.1   matt 
    384  1.1   matt /* Indicates that the asynchronous transmit response packet expired and
    385  1.1   matt  * was not transmitted, or that an IT DMA context experienced a skip
    386  1.1   matt  * processing overflow (See section 9.3.3).
    387  1.1   matt  */
    388  1.1   matt #define	OHCI_CTXCTL_EVENT_TIMEOUT		10
    389  1.1   matt 
    390  1.1   matt /* A bad tCode is associated with this packet. The packet was flushed.
    391  1.1   matt  */
    392  1.1   matt #define	OHCI_CTXCTL_EVENT_TCODE_ERR		11
    393  1.1   matt #define	OHCI_CTXCTL_EVENT_RESERVED12		12
    394  1.1   matt #define	OHCI_CTXCTL_EVENT_RESERVED13		13
    395  1.1   matt 
    396  1.1   matt /* An error condition has occurred that cannot be represented
    397  1.1   matt  * by any other event codes defined herein.
    398  1.1   matt  */
    399  1.1   matt #define	OHCI_CTXCTL_EVENT_UNKNOWN		14
    400  1.1   matt 
    401  1.1   matt /* Sent by the link side of the output FIFO when asynchronous
    402  1.1   matt  * packets are being flushed due to a bus reset.
    403  1.1   matt  */
    404  1.1   matt #define	OHCI_CTXCTL_EVENT_FLUSHED		15
    405  1.1   matt 
    406  1.1   matt /* IEEE1394 derived ACK codes follow
    407  1.1   matt  */
    408  1.1   matt #define	OHCI_CTXCTL_EVENT_RESERVED16		16
    409  1.1   matt 
    410  1.1   matt /* For asynchronous request and response packets, this event
    411  1.1   matt  * indicates the destination node has successfully accepted
    412  1.1   matt  * the packet. If the packet was a request subaction, the
    413  1.1   matt  * destination node has successfully completed the transaction
    414  1.1   matt  * and no response subaction shall follow.  The event code for
    415  1.1   matt  * transmitted PHY, isochronous, asynchronous stream and broadcast
    416  1.1   matt  * packets, none of which yields a 1394 ack code, shall be set
    417  1.1   matt  * by hardware to ack_complete unless an event occurs.
    418  1.1   matt  */
    419  1.1   matt #define	OHCI_CTXCTL_EVENT_ACK_COMPLETE		17
    420  1.1   matt 
    421  1.1   matt /* The destination node has successfully accepted the packet.
    422  1.1   matt  * If the packet was a request subaction, a response subaction
    423  1.1   matt  * should follow at a later time. This code is not returned for
    424  1.1   matt  * a response subaction.
    425  1.1   matt  */
    426  1.1   matt #define	OHCI_CTXCTL_EVENT_ACK_PENDING		18
    427  1.1   matt #define	OHCI_CTXCTL_EVENT_RESERVED19		19
    428  1.1   matt 
    429  1.1   matt /* The packet could not be accepted after max ATRetries (see
    430  1.1   matt  * section 5.4) attempts, and the last ack received was ack_busy_X.
    431  1.1   matt  */
    432  1.1   matt #define	OHCI_CTXCTL_EVENT_ACK_BUSY_X		20
    433  1.1   matt 
    434  1.1   matt /* The packet could not be accepted after max ATRetries (see
    435  1.1   matt  * section 5.4) attempts, and the last ack received was ack_busy_A.
    436  1.1   matt  */
    437  1.1   matt #define	OHCI_CTXCTL_EVENT_ACK_BUSY_A		21
    438  1.1   matt 
    439  1.1   matt /* The packet could not be accepted after max AT Retries (see
    440  1.1   matt  * section 5.4) attempts, and the last ack received was ack_busy_B.
    441  1.1   matt  */
    442  1.1   matt #define	OHCI_CTXCTL_EVENT_ACK_BUSY_B		22
    443  1.1   matt #define	OHCI_CTXCTL_EVENT_RESERVED23		23
    444  1.1   matt #define	OHCI_CTXCTL_EVENT_RESERVED24		24
    445  1.1   matt #define	OHCI_CTXCTL_EVENT_RESERVED25		25
    446  1.1   matt #define	OHCI_CTXCTL_EVENT_RESERVED26		26
    447  1.1   matt 
    448  1.1   matt /* The destination node could not accept the packet because
    449  1.1   matt  * the link and higher layers are in a suspended state.
    450  1.1   matt  */
    451  1.1   matt #define	OHCI_CTXCTL_EVENT_ACK_TARDY		27
    452  1.1   matt #define	OHCI_CTXCTL_EVENT_RESERVED28		28
    453  1.1   matt 
    454  1.1   matt /* An AT context received an ack_data_error, or an IR context
    455  1.1   matt  * in packet-per-buffer mode detected a data field CRC or
    456  1.1   matt  * data_length error.
    457  1.1   matt  */
    458  1.1   matt #define	OHCI_CTXCTL_EVENT_ACK_DATA_ERROR	29
    459  1.1   matt 
    460  1.1   matt /* A field in the request packet header was set to an unsupported or
    461  1.1   matt  * incorrect value, or an invalid transaction was attempted (e.g., a
    462  1.1   matt  * write to a read-only address).
    463  1.1   matt  */
    464  1.1   matt #define	OHCI_CTXCTL_EVENT_ACK_TYPE_ERROR	30
    465  1.1   matt #define	OHCI_CTXCTL_EVENT_RESERVED31		31
    466  1.2   onoe 
    467  1.2   onoe /* Context Control for isochronous transmit context
    468  1.2   onoe  */
    469  1.2   onoe #define	OHCI_CTXCTL_TX_CYCLE_MATCH_ENABLE	0x80000000
    470  1.2   onoe #define	OHCI_CTXCTL_TX_CYCLE_MATCH_BITLEN	0x7fff0000
    471  1.2   onoe #define	OHCI_CTXCTL_TX_CYCLE_MATCH_BITPOS	16
    472  1.2   onoe 
    473  1.2   onoe #define OHCI_CTXCTL_RX_BUFFER_FILL		0x80000000
    474  1.2   onoe #define	OHCI_CTXCTL_RX_ISOCH_HEADER		0x40000000
    475  1.2   onoe #define	OHCI_CTXCTL_RX_CYCLE_MATCH_ENABLE	0x20000000
    476  1.2   onoe #define	OHCI_CTXCTL_RX_MULTI_CHAN_MODE		0x10000000
    477  1.2   onoe #define	OHCI_CTXCTL_RX_DUAL_BUFFER_MODE		0x08000000
    478  1.2   onoe 
    479  1.2   onoe /* Context Match registers
    480  1.2   onoe  */
    481  1.2   onoe #define	OHCI_CTXMATCH_TAG3			0x80000000
    482  1.2   onoe #define	OHCI_CTXMATCH_TAG2			0x40000000
    483  1.2   onoe #define	OHCI_CTXMATCH_TAG1			0x20000000
    484  1.2   onoe #define	OHCI_CTXMATCH_TAG0			0x10000000
    485  1.2   onoe #define	OHCI_CTXMATCH_CYCLE_MATCH_MASK		0x07fff000
    486  1.2   onoe #define	OHCI_CTXMATCH_CYCLE_MATCH_BITPOS	12
    487  1.2   onoe #define	OHCI_CTXMATCH_SYNC_MASK			0x00000f00
    488  1.2   onoe #define	OHCI_CTXMATCH_SYNC_BITPOS		8
    489  1.2   onoe #define	OHCI_CTXMATCH_TAG1_SYNC_FILTER		0x00000040
    490  1.2   onoe #define	OHCI_CTXMATCH_CHANNEL_NUMBER_MASK	0x0000003f
    491  1.2   onoe #define	OHCI_CTXMATCH_CHANNEL_NUMBER_BITPOS	0
    492  1.2   onoe 
    493  1.2   onoe /*
    494  1.2   onoe  * Miscellaneous definitions.
    495  1.2   onoe  */
    496  1.2   onoe 
    497  1.2   onoe #define	OHCI_TCODE_PHY				0xe
    498  1.2   onoe 
    499  1.2   onoe #if BYTE_ORDER == BIG_ENDIAN
    500  1.2   onoe struct fwohci_desc {
    501  1.2   onoe 	u_int16_t	fd_flags;
    502  1.2   onoe 	u_int16_t	fd_reqcount;
    503  1.2   onoe 	u_int32_t	fd_data;
    504  1.2   onoe 	u_int32_t	fd_branch;
    505  1.2   onoe 	u_int16_t	fd_status;
    506  1.2   onoe 	u_int16_t	fd_rescount;
    507  1.2   onoe };
    508  1.2   onoe #endif
    509  1.2   onoe #if BYTE_ORDER == LITTLE_ENDIAN
    510  1.2   onoe struct fwohci_desc {
    511  1.2   onoe 	u_int16_t	fd_reqcount;
    512  1.2   onoe 	u_int16_t	fd_flags;
    513  1.2   onoe 	u_int32_t	fd_data;
    514  1.2   onoe 	u_int32_t	fd_branch;
    515  1.2   onoe 	u_int16_t	fd_rescount;
    516  1.2   onoe 	u_int16_t	fd_status;
    517  1.2   onoe };
    518  1.2   onoe #endif
    519  1.2   onoe #define	fd_timestamp	fd_rescount
    520  1.2   onoe 
    521  1.2   onoe #define	OHCI_DESC_INPUT		0x2000
    522  1.2   onoe #define	OHCI_DESC_LAST		0x1000
    523  1.2   onoe #define	OHCI_DESC_STATUS	0x0800
    524  1.2   onoe #define	OHCI_DESC_IMMED		0x0200
    525  1.2   onoe #define	OHCI_DESC_PING		0x0080
    526  1.2   onoe #define	OHCI_DESC_INTR_ALWAYS	0x0030
    527  1.2   onoe #define	OHCI_DESC_INTR_ERR	0x0010
    528  1.2   onoe #define	OHCI_DESC_BRANCH	0x000c
    529  1.2   onoe #define	OHCI_DESC_WAIT		0x0003
    530  1.1   matt 
    531  1.4   onoe #define	OHCI_DESC_MAX		8
    532  1.4   onoe 
    533  1.1   matt #endif	/* _DEV_IEEE1394_FWOHCIREG_ */
    534