phantom.h
Go to the documentation of this file.00001 #ifndef _PHANTOM_H
00002 #define _PHANTOM_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 FILE_LICENCE ( GPL2_OR_LATER );
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <stdint.h>
00033
00034
00035 #include "nx_bitops.h"
00036 #include "phantom_hw.h"
00037 struct phantom_rds { NX_PSEUDO_BIT_STRUCT ( struct phantom_rds_pb ) };
00038 struct phantom_sds { NX_PSEUDO_BIT_STRUCT ( struct phantom_sds_pb ) };
00039 union phantom_cds { NX_PSEUDO_BIT_STRUCT ( union phantom_cds_pb ) };
00040
00041
00042 typedef uint8_t U8;
00043 typedef uint16_t U16;
00044 typedef uint32_t U32;
00045 typedef uint64_t U64;
00046 typedef uint32_t nx_rcode_t;
00047 #define NXHAL_VERSION 1
00048 #include "nxhal_nic_interface.h"
00049
00050
00051 #define UNM_DMA_BUFFER_ALIGN 16
00052
00053
00054 #define __unm_dma_aligned __attribute__ (( aligned ( UNM_DMA_BUFFER_ALIGN ) ))
00055
00056
00057
00058
00059
00060
00061
00062 #define UNM_128M_CRB_WINDOW 0x6110210UL
00063 #define UNM_32M_CRB_WINDOW 0x0110210UL
00064 #define UNM_2M_CRB_WINDOW 0x0130060UL
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074 enum unm_reg_blocks {
00075 UNM_CRB_BLK_PCIE = 0x01,
00076 UNM_CRB_BLK_CAM = 0x22,
00077 UNM_CRB_BLK_ROMUSB = 0x33,
00078 UNM_CRB_BLK_TEST = 0x02,
00079 UNM_CRB_BLK_PEG_0 = 0x11,
00080 UNM_CRB_BLK_PEG_1 = 0x12,
00081 UNM_CRB_BLK_PEG_2 = 0x13,
00082 UNM_CRB_BLK_PEG_3 = 0x14,
00083 UNM_CRB_BLK_PEG_4 = 0x0f,
00084 };
00085 #define UNM_CRB_BASE(blk) ( (blk) << 20 )
00086 #define UNM_CRB_BLK(reg) ( (reg) >> 20 )
00087 #define UNM_CRB_OFFSET(reg) ( (reg) & 0x000fffff )
00088
00089 #define UNM_CRB_PCIE UNM_CRB_BASE ( UNM_CRB_BLK_PCIE )
00090 #define UNM_PCIE_SEM2_LOCK ( UNM_CRB_PCIE + 0x1c010 )
00091 #define UNM_PCIE_SEM2_UNLOCK ( UNM_CRB_PCIE + 0x1c014 )
00092 #define UNM_PCIE_IRQ_VECTOR ( UNM_CRB_PCIE + 0x10100 )
00093 #define UNM_PCIE_IRQ_VECTOR_BIT(n) ( 1 << ( (n) + 7 ) )
00094 #define UNM_PCIE_IRQ_STATE ( UNM_CRB_PCIE + 0x1206c )
00095 #define UNM_PCIE_IRQ_STATE_TRIGGERED(state) (( (state) & 0x300 ) == 0x200 )
00096 #define UNM_PCIE_IRQ_MASK_F0 ( UNM_CRB_PCIE + 0x10128 )
00097 #define UNM_PCIE_IRQ_MASK_F1 ( UNM_CRB_PCIE + 0x10170 )
00098 #define UNM_PCIE_IRQ_MASK_F2 ( UNM_CRB_PCIE + 0x10174 )
00099 #define UNM_PCIE_IRQ_MASK_F3 ( UNM_CRB_PCIE + 0x10178 )
00100 #define UNM_PCIE_IRQ_MASK_F4 ( UNM_CRB_PCIE + 0x10370 )
00101 #define UNM_PCIE_IRQ_MASK_F5 ( UNM_CRB_PCIE + 0x10374 )
00102 #define UNM_PCIE_IRQ_MASK_F6 ( UNM_CRB_PCIE + 0x10378 )
00103 #define UNM_PCIE_IRQ_MASK_F7 ( UNM_CRB_PCIE + 0x1037c )
00104 #define UNM_PCIE_IRQ_MASK_MAGIC 0x0000fbffUL
00105 #define UNM_PCIE_IRQ_STATUS_F0 ( UNM_CRB_PCIE + 0x10118 )
00106 #define UNM_PCIE_IRQ_STATUS_F1 ( UNM_CRB_PCIE + 0x10160 )
00107 #define UNM_PCIE_IRQ_STATUS_F2 ( UNM_CRB_PCIE + 0x10164 )
00108 #define UNM_PCIE_IRQ_STATUS_F3 ( UNM_CRB_PCIE + 0x10168 )
00109 #define UNM_PCIE_IRQ_STATUS_F4 ( UNM_CRB_PCIE + 0x10360 )
00110 #define UNM_PCIE_IRQ_STATUS_F5 ( UNM_CRB_PCIE + 0x10364 )
00111 #define UNM_PCIE_IRQ_STATUS_F6 ( UNM_CRB_PCIE + 0x10368 )
00112 #define UNM_PCIE_IRQ_STATUS_F7 ( UNM_CRB_PCIE + 0x1036c )
00113 #define UNM_PCIE_IRQ_STATUS_MAGIC 0xffffffffUL
00114
00115 #define UNM_CRB_CAM UNM_CRB_BASE ( UNM_CRB_BLK_CAM )
00116
00117 #define UNM_CAM_RAM ( UNM_CRB_CAM + 0x02000 )
00118 #define UNM_CAM_RAM_PORT_MODE ( UNM_CAM_RAM + 0x00024 )
00119 #define UNM_CAM_RAM_PORT_MODE_AUTO_NEG 4
00120 #define UNM_CAM_RAM_PORT_MODE_AUTO_NEG_1G 5
00121 #define UNM_CAM_RAM_DMESG_HEAD(n) ( UNM_CAM_RAM + 0x00030 + (n) * 0x10 )
00122 #define UNM_CAM_RAM_DMESG_LEN(n) ( UNM_CAM_RAM + 0x00034 + (n) * 0x10 )
00123 #define UNM_CAM_RAM_DMESG_TAIL(n) ( UNM_CAM_RAM + 0x00038 + (n) * 0x10 )
00124 #define UNM_CAM_RAM_DMESG_SIG(n) ( UNM_CAM_RAM + 0x0003c + (n) * 0x10 )
00125 #define UNM_CAM_RAM_DMESG_SIG_MAGIC 0xcafebabeUL
00126 #define UNM_CAM_RAM_NUM_DMESG_BUFFERS 5
00127 #define UNM_CAM_RAM_CLP_COMMAND ( UNM_CAM_RAM + 0x000c0 )
00128 #define UNM_CAM_RAM_CLP_COMMAND_LAST 0x00000080UL
00129 #define UNM_CAM_RAM_CLP_DATA_LO ( UNM_CAM_RAM + 0x000c4 )
00130 #define UNM_CAM_RAM_CLP_DATA_HI ( UNM_CAM_RAM + 0x000c8 )
00131 #define UNM_CAM_RAM_CLP_STATUS ( UNM_CAM_RAM + 0x000cc )
00132 #define UNM_CAM_RAM_CLP_STATUS_START 0x00000001UL
00133 #define UNM_CAM_RAM_CLP_STATUS_DONE 0x00000002UL
00134 #define UNM_CAM_RAM_CLP_STATUS_ERROR 0x0000ff00UL
00135 #define UNM_CAM_RAM_CLP_STATUS_UNINITIALISED 0xffffffffUL
00136 #define UNM_CAM_RAM_BOOT_ENABLE ( UNM_CAM_RAM + 0x000fc )
00137 #define UNM_CAM_RAM_WOL_PORT_MODE ( UNM_CAM_RAM + 0x00198 )
00138 #define UNM_CAM_RAM_MAC_ADDRS ( UNM_CAM_RAM + 0x001c0 )
00139 #define UNM_CAM_RAM_COLD_BOOT ( UNM_CAM_RAM + 0x001fc )
00140 #define UNM_CAM_RAM_COLD_BOOT_MAGIC 0x55555555UL
00141
00142 #define UNM_NIC_REG ( UNM_CRB_CAM + 0x02200 )
00143 #define UNM_NIC_REG_NX_CDRP ( UNM_NIC_REG + 0x00018 )
00144 #define UNM_NIC_REG_NX_ARG1 ( UNM_NIC_REG + 0x0001c )
00145 #define UNM_NIC_REG_NX_ARG2 ( UNM_NIC_REG + 0x00020 )
00146 #define UNM_NIC_REG_NX_ARG3 ( UNM_NIC_REG + 0x00024 )
00147 #define UNM_NIC_REG_NX_SIGN ( UNM_NIC_REG + 0x00028 )
00148 #define UNM_NIC_REG_DUMMY_BUF_ADDR_HI ( UNM_NIC_REG + 0x0003c )
00149 #define UNM_NIC_REG_DUMMY_BUF_ADDR_LO ( UNM_NIC_REG + 0x00040 )
00150 #define UNM_NIC_REG_CMDPEG_STATE ( UNM_NIC_REG + 0x00050 )
00151 #define UNM_NIC_REG_CMDPEG_STATE_INITIALIZED 0xff01
00152 #define UNM_NIC_REG_CMDPEG_STATE_INITIALIZE_ACK 0xf00f
00153 #define UNM_NIC_REG_DUMMY_BUF ( UNM_NIC_REG + 0x000fc )
00154 #define UNM_NIC_REG_DUMMY_BUF_INIT 0
00155 #define UNM_NIC_REG_XG_STATE_P3 ( UNM_NIC_REG + 0x00098 )
00156 #define UNM_NIC_REG_XG_STATE_P3_LINK( port, state_p3 ) \
00157 ( ( (state_p3) >> ( (port) * 4 ) ) & 0x0f )
00158 #define UNM_NIC_REG_XG_STATE_P3_LINK_UP 0x01
00159 #define UNM_NIC_REG_XG_STATE_P3_LINK_DOWN 0x02
00160 #define UNM_NIC_REG_RCVPEG_STATE ( UNM_NIC_REG + 0x0013c )
00161 #define UNM_NIC_REG_RCVPEG_STATE_INITIALIZED 0xff01
00162
00163 #define UNM_CRB_ROMUSB UNM_CRB_BASE ( UNM_CRB_BLK_ROMUSB )
00164
00165 #define UNM_ROMUSB_GLB ( UNM_CRB_ROMUSB + 0x00000 )
00166 #define UNM_ROMUSB_GLB_STATUS ( UNM_ROMUSB_GLB + 0x00004 )
00167 #define UNM_ROMUSB_GLB_STATUS_ROM_DONE ( 1 << 1 )
00168 #define UNM_ROMUSB_GLB_SW_RESET ( UNM_ROMUSB_GLB + 0x00008 )
00169 #define UNM_ROMUSB_GLB_SW_RESET_MAGIC 0x0080000fUL
00170 #define UNM_ROMUSB_GLB_PEGTUNE_DONE ( UNM_ROMUSB_GLB + 0x0005c )
00171 #define UNM_ROMUSB_GLB_PEGTUNE_DONE_MAGIC 0x31
00172
00173 #define UNM_ROMUSB_ROM ( UNM_CRB_ROMUSB + 0x10000 )
00174 #define UNM_ROMUSB_ROM_INSTR_OPCODE ( UNM_ROMUSB_ROM + 0x00004 )
00175 #define UNM_ROMUSB_ROM_ADDRESS ( UNM_ROMUSB_ROM + 0x00008 )
00176 #define UNM_ROMUSB_ROM_WDATA ( UNM_ROMUSB_ROM + 0x0000c )
00177 #define UNM_ROMUSB_ROM_ABYTE_CNT ( UNM_ROMUSB_ROM + 0x00010 )
00178 #define UNM_ROMUSB_ROM_DUMMY_BYTE_CNT ( UNM_ROMUSB_ROM + 0x00014 )
00179 #define UNM_ROMUSB_ROM_RDATA ( UNM_ROMUSB_ROM + 0x00018 )
00180
00181 #define UNM_CRB_TEST UNM_CRB_BASE ( UNM_CRB_BLK_TEST )
00182
00183 #define UNM_TEST_CONTROL ( UNM_CRB_TEST + 0x00090 )
00184 #define UNM_TEST_CONTROL_START 0x01
00185 #define UNM_TEST_CONTROL_ENABLE 0x02
00186 #define UNM_TEST_CONTROL_BUSY 0x08
00187 #define UNM_TEST_ADDR_LO ( UNM_CRB_TEST + 0x00094 )
00188 #define UNM_TEST_ADDR_HI ( UNM_CRB_TEST + 0x00098 )
00189 #define UNM_TEST_RDDATA_LO ( UNM_CRB_TEST + 0x000a8 )
00190 #define UNM_TEST_RDDATA_HI ( UNM_CRB_TEST + 0x000ac )
00191
00192 #define UNM_CRB_PEG_0 UNM_CRB_BASE ( UNM_CRB_BLK_PEG_0 )
00193 #define UNM_PEG_0_HALT_STATUS ( UNM_CRB_PEG_0 + 0x00030 )
00194 #define UNM_PEG_0_HALT ( UNM_CRB_PEG_0 + 0x0003c )
00195
00196 #define UNM_CRB_PEG_1 UNM_CRB_BASE ( UNM_CRB_BLK_PEG_1 )
00197 #define UNM_PEG_1_HALT_STATUS ( UNM_CRB_PEG_1 + 0x00030 )
00198 #define UNM_PEG_1_HALT ( UNM_CRB_PEG_1 + 0x0003c )
00199
00200 #define UNM_CRB_PEG_2 UNM_CRB_BASE ( UNM_CRB_BLK_PEG_2 )
00201 #define UNM_PEG_2_HALT_STATUS ( UNM_CRB_PEG_2 + 0x00030 )
00202 #define UNM_PEG_2_HALT ( UNM_CRB_PEG_2 + 0x0003c )
00203
00204 #define UNM_CRB_PEG_3 UNM_CRB_BASE ( UNM_CRB_BLK_PEG_3 )
00205 #define UNM_PEG_3_HALT_STATUS ( UNM_CRB_PEG_3 + 0x00030 )
00206 #define UNM_PEG_3_HALT ( UNM_CRB_PEG_3 + 0x0003c )
00207
00208 #define UNM_CRB_PEG_4 UNM_CRB_BASE ( UNM_CRB_BLK_PEG_4 )
00209 #define UNM_PEG_4_HALT_STATUS ( UNM_CRB_PEG_4 + 0x00030 )
00210 #define UNM_PEG_4_HALT ( UNM_CRB_PEG_4 + 0x0003c )
00211
00212 #endif