18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */ 28c2ecf20Sopenharmony_ci/* FDDI network adapter driver for DEC FDDIcontroller 700/700-C devices. 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Copyright (c) 2018 Maciej W. Rozycki 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * This program is free software; you can redistribute it and/or 78c2ecf20Sopenharmony_ci * modify it under the terms of the GNU General Public License 88c2ecf20Sopenharmony_ci * as published by the Free Software Foundation; either version 98c2ecf20Sopenharmony_ci * 2 of the License, or (at your option) any later version. 108c2ecf20Sopenharmony_ci * 118c2ecf20Sopenharmony_ci * References: 128c2ecf20Sopenharmony_ci * 138c2ecf20Sopenharmony_ci * Dave Sawyer & Phil Weeks & Frank Itkowsky, 148c2ecf20Sopenharmony_ci * "DEC FDDIcontroller 700 Port Specification", 158c2ecf20Sopenharmony_ci * Revision 1.1, Digital Equipment Corporation 168c2ecf20Sopenharmony_ci */ 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#include <linux/compiler.h> 198c2ecf20Sopenharmony_ci#include <linux/if_fddi.h> 208c2ecf20Sopenharmony_ci#include <linux/spinlock.h> 218c2ecf20Sopenharmony_ci#include <linux/timer.h> 228c2ecf20Sopenharmony_ci#include <linux/types.h> 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci/* IOmem register offsets. */ 258c2ecf20Sopenharmony_ci#define FZA_REG_BASE 0x100000 /* register base address */ 268c2ecf20Sopenharmony_ci#define FZA_REG_RESET 0x100200 /* reset, r/w */ 278c2ecf20Sopenharmony_ci#define FZA_REG_INT_EVENT 0x100400 /* interrupt event, r/w1c */ 288c2ecf20Sopenharmony_ci#define FZA_REG_STATUS 0x100402 /* status, r/o */ 298c2ecf20Sopenharmony_ci#define FZA_REG_INT_MASK 0x100404 /* interrupt mask, r/w */ 308c2ecf20Sopenharmony_ci#define FZA_REG_CONTROL_A 0x100500 /* control A, r/w1s */ 318c2ecf20Sopenharmony_ci#define FZA_REG_CONTROL_B 0x100502 /* control B, r/w */ 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci/* Reset register constants. Bits 1:0 are r/w, others are fixed at 0. */ 348c2ecf20Sopenharmony_ci#define FZA_RESET_DLU 0x0002 /* OR with INIT to blast flash memory */ 358c2ecf20Sopenharmony_ci#define FZA_RESET_INIT 0x0001 /* switch into the reset state */ 368c2ecf20Sopenharmony_ci#define FZA_RESET_CLR 0x0000 /* run self-test and return to work */ 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci/* Interrupt event register constants. All bits are r/w1c. */ 398c2ecf20Sopenharmony_ci#define FZA_EVENT_DLU_DONE 0x0800 /* flash memory write complete */ 408c2ecf20Sopenharmony_ci#define FZA_EVENT_FLUSH_TX 0x0400 /* transmit ring flush request */ 418c2ecf20Sopenharmony_ci#define FZA_EVENT_PM_PARITY_ERR 0x0200 /* onboard packet memory parity err */ 428c2ecf20Sopenharmony_ci#define FZA_EVENT_HB_PARITY_ERR 0x0100 /* host bus parity error */ 438c2ecf20Sopenharmony_ci#define FZA_EVENT_NXM_ERR 0x0080 /* non-existent memory access error; 448c2ecf20Sopenharmony_ci * also raised for unaligned and 458c2ecf20Sopenharmony_ci * unsupported partial-word accesses 468c2ecf20Sopenharmony_ci */ 478c2ecf20Sopenharmony_ci#define FZA_EVENT_LINK_ST_CHG 0x0040 /* link status change */ 488c2ecf20Sopenharmony_ci#define FZA_EVENT_STATE_CHG 0x0020 /* adapter state change */ 498c2ecf20Sopenharmony_ci#define FZA_EVENT_UNS_POLL 0x0010 /* unsolicited event service request */ 508c2ecf20Sopenharmony_ci#define FZA_EVENT_CMD_DONE 0x0008 /* command done ack */ 518c2ecf20Sopenharmony_ci#define FZA_EVENT_SMT_TX_POLL 0x0004 /* SMT frame transmit request */ 528c2ecf20Sopenharmony_ci#define FZA_EVENT_RX_POLL 0x0002 /* receive request (packet avail.) */ 538c2ecf20Sopenharmony_ci#define FZA_EVENT_TX_DONE 0x0001 /* RMC transmit done ack */ 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_ci/* Status register constants. All bits are r/o. */ 568c2ecf20Sopenharmony_ci#define FZA_STATUS_DLU_SHIFT 0xc /* down line upgrade status bits */ 578c2ecf20Sopenharmony_ci#define FZA_STATUS_DLU_MASK 0x03 588c2ecf20Sopenharmony_ci#define FZA_STATUS_LINK_SHIFT 0xb /* link status bits */ 598c2ecf20Sopenharmony_ci#define FZA_STATUS_LINK_MASK 0x01 608c2ecf20Sopenharmony_ci#define FZA_STATUS_STATE_SHIFT 0x8 /* adapter state bits */ 618c2ecf20Sopenharmony_ci#define FZA_STATUS_STATE_MASK 0x07 628c2ecf20Sopenharmony_ci#define FZA_STATUS_HALT_SHIFT 0x0 /* halt reason bits */ 638c2ecf20Sopenharmony_ci#define FZA_STATUS_HALT_MASK 0xff 648c2ecf20Sopenharmony_ci#define FZA_STATUS_TEST_SHIFT 0x0 /* test failure bits */ 658c2ecf20Sopenharmony_ci#define FZA_STATUS_TEST_MASK 0xff 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci#define FZA_STATUS_GET_DLU(x) (((x) >> FZA_STATUS_DLU_SHIFT) & \ 688c2ecf20Sopenharmony_ci FZA_STATUS_DLU_MASK) 698c2ecf20Sopenharmony_ci#define FZA_STATUS_GET_LINK(x) (((x) >> FZA_STATUS_LINK_SHIFT) & \ 708c2ecf20Sopenharmony_ci FZA_STATUS_LINK_MASK) 718c2ecf20Sopenharmony_ci#define FZA_STATUS_GET_STATE(x) (((x) >> FZA_STATUS_STATE_SHIFT) & \ 728c2ecf20Sopenharmony_ci FZA_STATUS_STATE_MASK) 738c2ecf20Sopenharmony_ci#define FZA_STATUS_GET_HALT(x) (((x) >> FZA_STATUS_HALT_SHIFT) & \ 748c2ecf20Sopenharmony_ci FZA_STATUS_HALT_MASK) 758c2ecf20Sopenharmony_ci#define FZA_STATUS_GET_TEST(x) (((x) >> FZA_STATUS_TEST_SHIFT) & \ 768c2ecf20Sopenharmony_ci FZA_STATUS_TEST_MASK) 778c2ecf20Sopenharmony_ci 788c2ecf20Sopenharmony_ci#define FZA_DLU_FAILURE 0x0 /* DLU catastrophic error; brain dead */ 798c2ecf20Sopenharmony_ci#define FZA_DLU_ERROR 0x1 /* DLU error; old firmware intact */ 808c2ecf20Sopenharmony_ci#define FZA_DLU_SUCCESS 0x2 /* DLU OK; new firmware loaded */ 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci#define FZA_LINK_OFF 0x0 /* link unavailable */ 838c2ecf20Sopenharmony_ci#define FZA_LINK_ON 0x1 /* link available */ 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ci#define FZA_STATE_RESET 0x0 /* resetting */ 868c2ecf20Sopenharmony_ci#define FZA_STATE_UNINITIALIZED 0x1 /* after a reset */ 878c2ecf20Sopenharmony_ci#define FZA_STATE_INITIALIZED 0x2 /* initialized */ 888c2ecf20Sopenharmony_ci#define FZA_STATE_RUNNING 0x3 /* running (link active) */ 898c2ecf20Sopenharmony_ci#define FZA_STATE_MAINTENANCE 0x4 /* running (link looped back) */ 908c2ecf20Sopenharmony_ci#define FZA_STATE_HALTED 0x5 /* halted (error condition) */ 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci#define FZA_HALT_UNKNOWN 0x00 /* unknown reason */ 938c2ecf20Sopenharmony_ci#define FZA_HALT_HOST 0x01 /* host-directed HALT */ 948c2ecf20Sopenharmony_ci#define FZA_HALT_HB_PARITY 0x02 /* host bus parity error */ 958c2ecf20Sopenharmony_ci#define FZA_HALT_NXM 0x03 /* adapter non-existent memory ref. */ 968c2ecf20Sopenharmony_ci#define FZA_HALT_SW 0x04 /* adapter software fault */ 978c2ecf20Sopenharmony_ci#define FZA_HALT_HW 0x05 /* adapter hardware fault */ 988c2ecf20Sopenharmony_ci#define FZA_HALT_PC_TRACE 0x06 /* PC Trace path test */ 998c2ecf20Sopenharmony_ci#define FZA_HALT_DLSW 0x07 /* data link software fault */ 1008c2ecf20Sopenharmony_ci#define FZA_HALT_DLHW 0x08 /* data link hardware fault */ 1018c2ecf20Sopenharmony_ci 1028c2ecf20Sopenharmony_ci#define FZA_TEST_FATAL 0x00 /* self-test catastrophic failure */ 1038c2ecf20Sopenharmony_ci#define FZA_TEST_68K 0x01 /* 68000 CPU */ 1048c2ecf20Sopenharmony_ci#define FZA_TEST_SRAM_BWADDR 0x02 /* SRAM byte/word address */ 1058c2ecf20Sopenharmony_ci#define FZA_TEST_SRAM_DBUS 0x03 /* SRAM data bus */ 1068c2ecf20Sopenharmony_ci#define FZA_TEST_SRAM_STUCK1 0x04 /* SRAM stuck-at range 1 */ 1078c2ecf20Sopenharmony_ci#define FZA_TEST_SRAM_STUCK2 0x05 /* SRAM stuck-at range 2 */ 1088c2ecf20Sopenharmony_ci#define FZA_TEST_SRAM_COUPL1 0x06 /* SRAM coupling range 1 */ 1098c2ecf20Sopenharmony_ci#define FZA_TEST_SRAM_COUPL2 0x07 /* SRAM coupling */ 1108c2ecf20Sopenharmony_ci#define FZA_TEST_FLASH_CRC 0x08 /* Flash CRC */ 1118c2ecf20Sopenharmony_ci#define FZA_TEST_ROM 0x09 /* option ROM */ 1128c2ecf20Sopenharmony_ci#define FZA_TEST_PHY_CSR 0x0a /* PHY CSR */ 1138c2ecf20Sopenharmony_ci#define FZA_TEST_MAC_BIST 0x0b /* MAC BiST */ 1148c2ecf20Sopenharmony_ci#define FZA_TEST_MAC_CSR 0x0c /* MAC CSR */ 1158c2ecf20Sopenharmony_ci#define FZA_TEST_MAC_ADDR_UNIQ 0x0d /* MAC unique address */ 1168c2ecf20Sopenharmony_ci#define FZA_TEST_ELM_BIST 0x0e /* ELM BiST */ 1178c2ecf20Sopenharmony_ci#define FZA_TEST_ELM_CSR 0x0f /* ELM CSR */ 1188c2ecf20Sopenharmony_ci#define FZA_TEST_ELM_ADDR_UNIQ 0x10 /* ELM unique address */ 1198c2ecf20Sopenharmony_ci#define FZA_TEST_CAM 0x11 /* CAM */ 1208c2ecf20Sopenharmony_ci#define FZA_TEST_NIROM 0x12 /* NI ROM checksum */ 1218c2ecf20Sopenharmony_ci#define FZA_TEST_SC_LOOP 0x13 /* SC loopback packet */ 1228c2ecf20Sopenharmony_ci#define FZA_TEST_LM_LOOP 0x14 /* LM loopback packet */ 1238c2ecf20Sopenharmony_ci#define FZA_TEST_EB_LOOP 0x15 /* EB loopback packet */ 1248c2ecf20Sopenharmony_ci#define FZA_TEST_SC_LOOP_BYPS 0x16 /* SC bypass loopback packet */ 1258c2ecf20Sopenharmony_ci#define FZA_TEST_LM_LOOP_LOCAL 0x17 /* LM local loopback packet */ 1268c2ecf20Sopenharmony_ci#define FZA_TEST_EB_LOOP_LOCAL 0x18 /* EB local loopback packet */ 1278c2ecf20Sopenharmony_ci#define FZA_TEST_CDC_LOOP 0x19 /* CDC loopback packet */ 1288c2ecf20Sopenharmony_ci#define FZA_TEST_FIBER_LOOP 0x1A /* FIBER loopback packet */ 1298c2ecf20Sopenharmony_ci#define FZA_TEST_CAM_MATCH_LOOP 0x1B /* CAM match packet loopback */ 1308c2ecf20Sopenharmony_ci#define FZA_TEST_68K_IRQ_STUCK 0x1C /* 68000 interrupt line stuck-at */ 1318c2ecf20Sopenharmony_ci#define FZA_TEST_IRQ_PRESENT 0x1D /* interrupt present register */ 1328c2ecf20Sopenharmony_ci#define FZA_TEST_RMC_BIST 0x1E /* RMC BiST */ 1338c2ecf20Sopenharmony_ci#define FZA_TEST_RMC_CSR 0x1F /* RMC CSR */ 1348c2ecf20Sopenharmony_ci#define FZA_TEST_RMC_ADDR_UNIQ 0x20 /* RMC unique address */ 1358c2ecf20Sopenharmony_ci#define FZA_TEST_PM_DPATH 0x21 /* packet memory data path */ 1368c2ecf20Sopenharmony_ci#define FZA_TEST_PM_ADDR 0x22 /* packet memory address */ 1378c2ecf20Sopenharmony_ci#define FZA_TEST_RES_23 0x23 /* reserved */ 1388c2ecf20Sopenharmony_ci#define FZA_TEST_PM_DESC 0x24 /* packet memory descriptor */ 1398c2ecf20Sopenharmony_ci#define FZA_TEST_PM_OWN 0x25 /* packet memory own bit */ 1408c2ecf20Sopenharmony_ci#define FZA_TEST_PM_PARITY 0x26 /* packet memory parity */ 1418c2ecf20Sopenharmony_ci#define FZA_TEST_PM_BSWAP 0x27 /* packet memory byte swap */ 1428c2ecf20Sopenharmony_ci#define FZA_TEST_PM_WSWAP 0x28 /* packet memory word swap */ 1438c2ecf20Sopenharmony_ci#define FZA_TEST_PM_REF 0x29 /* packet memory refresh */ 1448c2ecf20Sopenharmony_ci#define FZA_TEST_PM_CSR 0x2A /* PM CSR */ 1458c2ecf20Sopenharmony_ci#define FZA_TEST_PORT_STATUS 0x2B /* port status register */ 1468c2ecf20Sopenharmony_ci#define FZA_TEST_HOST_IRQMASK 0x2C /* host interrupt mask */ 1478c2ecf20Sopenharmony_ci#define FZA_TEST_TIMER_IRQ1 0x2D /* RTOS timer */ 1488c2ecf20Sopenharmony_ci#define FZA_TEST_FORCE_IRQ1 0x2E /* force RTOS IRQ1 */ 1498c2ecf20Sopenharmony_ci#define FZA_TEST_TIMER_IRQ5 0x2F /* IRQ5 backoff timer */ 1508c2ecf20Sopenharmony_ci#define FZA_TEST_FORCE_IRQ5 0x30 /* force IRQ5 */ 1518c2ecf20Sopenharmony_ci#define FZA_TEST_RES_31 0x31 /* reserved */ 1528c2ecf20Sopenharmony_ci#define FZA_TEST_IC_PRIO 0x32 /* interrupt controller priority */ 1538c2ecf20Sopenharmony_ci#define FZA_TEST_PM_FULL 0x33 /* full packet memory */ 1548c2ecf20Sopenharmony_ci#define FZA_TEST_PMI_DMA 0x34 /* PMI DMA */ 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci/* Interrupt mask register constants. All bits are r/w. */ 1578c2ecf20Sopenharmony_ci#define FZA_MASK_RESERVED 0xf000 /* unused */ 1588c2ecf20Sopenharmony_ci#define FZA_MASK_DLU_DONE 0x0800 /* flash memory write complete */ 1598c2ecf20Sopenharmony_ci#define FZA_MASK_FLUSH_TX 0x0400 /* transmit ring flush request */ 1608c2ecf20Sopenharmony_ci#define FZA_MASK_PM_PARITY_ERR 0x0200 /* onboard packet memory parity error 1618c2ecf20Sopenharmony_ci */ 1628c2ecf20Sopenharmony_ci#define FZA_MASK_HB_PARITY_ERR 0x0100 /* host bus parity error */ 1638c2ecf20Sopenharmony_ci#define FZA_MASK_NXM_ERR 0x0080 /* adapter non-existent memory 1648c2ecf20Sopenharmony_ci * reference 1658c2ecf20Sopenharmony_ci */ 1668c2ecf20Sopenharmony_ci#define FZA_MASK_LINK_ST_CHG 0x0040 /* link status change */ 1678c2ecf20Sopenharmony_ci#define FZA_MASK_STATE_CHG 0x0020 /* adapter state change */ 1688c2ecf20Sopenharmony_ci#define FZA_MASK_UNS_POLL 0x0010 /* unsolicited event service request */ 1698c2ecf20Sopenharmony_ci#define FZA_MASK_CMD_DONE 0x0008 /* command ring entry processed */ 1708c2ecf20Sopenharmony_ci#define FZA_MASK_SMT_TX_POLL 0x0004 /* SMT frame transmit request */ 1718c2ecf20Sopenharmony_ci#define FZA_MASK_RCV_POLL 0x0002 /* receive request (packet available) 1728c2ecf20Sopenharmony_ci */ 1738c2ecf20Sopenharmony_ci#define FZA_MASK_TX_DONE 0x0001 /* RMC transmit done acknowledge */ 1748c2ecf20Sopenharmony_ci 1758c2ecf20Sopenharmony_ci/* Which interrupts to receive: 0/1 is mask/unmask. */ 1768c2ecf20Sopenharmony_ci#define FZA_MASK_NONE 0x0000 1778c2ecf20Sopenharmony_ci#define FZA_MASK_NORMAL \ 1788c2ecf20Sopenharmony_ci ((~(FZA_MASK_RESERVED | FZA_MASK_DLU_DONE | \ 1798c2ecf20Sopenharmony_ci FZA_MASK_PM_PARITY_ERR | FZA_MASK_HB_PARITY_ERR | \ 1808c2ecf20Sopenharmony_ci FZA_MASK_NXM_ERR)) & 0xffff) 1818c2ecf20Sopenharmony_ci 1828c2ecf20Sopenharmony_ci/* Control A register constants. */ 1838c2ecf20Sopenharmony_ci#define FZA_CONTROL_A_HB_PARITY_ERR 0x8000 /* host bus parity error */ 1848c2ecf20Sopenharmony_ci#define FZA_CONTROL_A_NXM_ERR 0x4000 /* adapter non-existent memory 1858c2ecf20Sopenharmony_ci * reference 1868c2ecf20Sopenharmony_ci */ 1878c2ecf20Sopenharmony_ci#define FZA_CONTROL_A_SMT_RX_OVFL 0x0040 /* SMT receive overflow */ 1888c2ecf20Sopenharmony_ci#define FZA_CONTROL_A_FLUSH_DONE 0x0020 /* flush tx request complete */ 1898c2ecf20Sopenharmony_ci#define FZA_CONTROL_A_SHUT 0x0010 /* turn the interface off */ 1908c2ecf20Sopenharmony_ci#define FZA_CONTROL_A_HALT 0x0008 /* halt the controller */ 1918c2ecf20Sopenharmony_ci#define FZA_CONTROL_A_CMD_POLL 0x0004 /* command ring poll */ 1928c2ecf20Sopenharmony_ci#define FZA_CONTROL_A_SMT_RX_POLL 0x0002 /* SMT receive ring poll */ 1938c2ecf20Sopenharmony_ci#define FZA_CONTROL_A_TX_POLL 0x0001 /* transmit poll */ 1948c2ecf20Sopenharmony_ci 1958c2ecf20Sopenharmony_ci/* Control B register constants. All bits are r/w. 1968c2ecf20Sopenharmony_ci * 1978c2ecf20Sopenharmony_ci * Possible values: 1988c2ecf20Sopenharmony_ci * 0x0000 after booting into REX, 1998c2ecf20Sopenharmony_ci * 0x0003 after issuing `boot #/mop'. 2008c2ecf20Sopenharmony_ci */ 2018c2ecf20Sopenharmony_ci#define FZA_CONTROL_B_CONSOLE 0x0002 /* OR with DRIVER for console 2028c2ecf20Sopenharmony_ci * (TC firmware) mode 2038c2ecf20Sopenharmony_ci */ 2048c2ecf20Sopenharmony_ci#define FZA_CONTROL_B_DRIVER 0x0001 /* driver mode */ 2058c2ecf20Sopenharmony_ci#define FZA_CONTROL_B_IDLE 0x0000 /* no driver installed */ 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_ci#define FZA_RESET_PAD \ 2088c2ecf20Sopenharmony_ci (FZA_REG_RESET - FZA_REG_BASE) 2098c2ecf20Sopenharmony_ci#define FZA_INT_EVENT_PAD \ 2108c2ecf20Sopenharmony_ci (FZA_REG_INT_EVENT - FZA_REG_RESET - sizeof(u16)) 2118c2ecf20Sopenharmony_ci#define FZA_CONTROL_A_PAD \ 2128c2ecf20Sopenharmony_ci (FZA_REG_CONTROL_A - FZA_REG_INT_MASK - sizeof(u16)) 2138c2ecf20Sopenharmony_ci 2148c2ecf20Sopenharmony_ci/* Layout of registers. */ 2158c2ecf20Sopenharmony_cistruct fza_regs { 2168c2ecf20Sopenharmony_ci u8 pad0[FZA_RESET_PAD]; 2178c2ecf20Sopenharmony_ci u16 reset; /* reset register */ 2188c2ecf20Sopenharmony_ci u8 pad1[FZA_INT_EVENT_PAD]; 2198c2ecf20Sopenharmony_ci u16 int_event; /* interrupt event register */ 2208c2ecf20Sopenharmony_ci u16 status; /* status register */ 2218c2ecf20Sopenharmony_ci u16 int_mask; /* interrupt mask register */ 2228c2ecf20Sopenharmony_ci u8 pad2[FZA_CONTROL_A_PAD]; 2238c2ecf20Sopenharmony_ci u16 control_a; /* control A register */ 2248c2ecf20Sopenharmony_ci u16 control_b; /* control B register */ 2258c2ecf20Sopenharmony_ci}; 2268c2ecf20Sopenharmony_ci 2278c2ecf20Sopenharmony_ci/* Command descriptor ring entry. */ 2288c2ecf20Sopenharmony_cistruct fza_ring_cmd { 2298c2ecf20Sopenharmony_ci u32 cmd_own; /* bit 31: ownership, bits [30:0]: command */ 2308c2ecf20Sopenharmony_ci u32 stat; /* command status */ 2318c2ecf20Sopenharmony_ci u32 buffer; /* address of the buffer in the FZA space */ 2328c2ecf20Sopenharmony_ci u32 pad0; 2338c2ecf20Sopenharmony_ci}; 2348c2ecf20Sopenharmony_ci 2358c2ecf20Sopenharmony_ci#define FZA_RING_CMD 0x200400 /* command ring address */ 2368c2ecf20Sopenharmony_ci#define FZA_RING_CMD_SIZE 0x40 /* command descriptor ring 2378c2ecf20Sopenharmony_ci * size 2388c2ecf20Sopenharmony_ci */ 2398c2ecf20Sopenharmony_ci/* Command constants. */ 2408c2ecf20Sopenharmony_ci#define FZA_RING_CMD_MASK 0x7fffffff 2418c2ecf20Sopenharmony_ci#define FZA_RING_CMD_NOP 0x00000000 /* nop */ 2428c2ecf20Sopenharmony_ci#define FZA_RING_CMD_INIT 0x00000001 /* initialize */ 2438c2ecf20Sopenharmony_ci#define FZA_RING_CMD_MODCAM 0x00000002 /* modify CAM */ 2448c2ecf20Sopenharmony_ci#define FZA_RING_CMD_PARAM 0x00000003 /* set system parameters */ 2458c2ecf20Sopenharmony_ci#define FZA_RING_CMD_MODPROM 0x00000004 /* modify promiscuous mode */ 2468c2ecf20Sopenharmony_ci#define FZA_RING_CMD_SETCHAR 0x00000005 /* set link characteristics */ 2478c2ecf20Sopenharmony_ci#define FZA_RING_CMD_RDCNTR 0x00000006 /* read counters */ 2488c2ecf20Sopenharmony_ci#define FZA_RING_CMD_STATUS 0x00000007 /* get link status */ 2498c2ecf20Sopenharmony_ci#define FZA_RING_CMD_RDCAM 0x00000008 /* read CAM */ 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci/* Command status constants. */ 2528c2ecf20Sopenharmony_ci#define FZA_RING_STAT_SUCCESS 0x00000000 2538c2ecf20Sopenharmony_ci 2548c2ecf20Sopenharmony_ci/* Unsolicited event descriptor ring entry. */ 2558c2ecf20Sopenharmony_cistruct fza_ring_uns { 2568c2ecf20Sopenharmony_ci u32 own; /* bit 31: ownership, bits [30:0]: reserved */ 2578c2ecf20Sopenharmony_ci u32 id; /* event ID */ 2588c2ecf20Sopenharmony_ci u32 buffer; /* address of the buffer in the FZA space */ 2598c2ecf20Sopenharmony_ci u32 pad0; /* reserved */ 2608c2ecf20Sopenharmony_ci}; 2618c2ecf20Sopenharmony_ci 2628c2ecf20Sopenharmony_ci#define FZA_RING_UNS 0x200800 /* unsolicited ring address */ 2638c2ecf20Sopenharmony_ci#define FZA_RING_UNS_SIZE 0x40 /* unsolicited descriptor ring 2648c2ecf20Sopenharmony_ci * size 2658c2ecf20Sopenharmony_ci */ 2668c2ecf20Sopenharmony_ci/* Unsolicited event constants. */ 2678c2ecf20Sopenharmony_ci#define FZA_RING_UNS_UND 0x00000000 /* undefined event ID */ 2688c2ecf20Sopenharmony_ci#define FZA_RING_UNS_INIT_IN 0x00000001 /* ring init initiated */ 2698c2ecf20Sopenharmony_ci#define FZA_RING_UNS_INIT_RX 0x00000002 /* ring init received */ 2708c2ecf20Sopenharmony_ci#define FZA_RING_UNS_BEAC_IN 0x00000003 /* ring beaconing initiated */ 2718c2ecf20Sopenharmony_ci#define FZA_RING_UNS_DUP_ADDR 0x00000004 /* duplicate address detected */ 2728c2ecf20Sopenharmony_ci#define FZA_RING_UNS_DUP_TOK 0x00000005 /* duplicate token detected */ 2738c2ecf20Sopenharmony_ci#define FZA_RING_UNS_PURG_ERR 0x00000006 /* ring purger error */ 2748c2ecf20Sopenharmony_ci#define FZA_RING_UNS_STRIP_ERR 0x00000007 /* bridge strip error */ 2758c2ecf20Sopenharmony_ci#define FZA_RING_UNS_OP_OSC 0x00000008 /* ring op oscillation */ 2768c2ecf20Sopenharmony_ci#define FZA_RING_UNS_BEAC_RX 0x00000009 /* directed beacon received */ 2778c2ecf20Sopenharmony_ci#define FZA_RING_UNS_PCT_IN 0x0000000a /* PC trace initiated */ 2788c2ecf20Sopenharmony_ci#define FZA_RING_UNS_PCT_RX 0x0000000b /* PC trace received */ 2798c2ecf20Sopenharmony_ci#define FZA_RING_UNS_TX_UNDER 0x0000000c /* transmit underrun */ 2808c2ecf20Sopenharmony_ci#define FZA_RING_UNS_TX_FAIL 0x0000000d /* transmit failure */ 2818c2ecf20Sopenharmony_ci#define FZA_RING_UNS_RX_OVER 0x0000000e /* receive overrun */ 2828c2ecf20Sopenharmony_ci 2838c2ecf20Sopenharmony_ci/* RMC (Ring Memory Control) transmit descriptor ring entry. */ 2848c2ecf20Sopenharmony_cistruct fza_ring_rmc_tx { 2858c2ecf20Sopenharmony_ci u32 rmc; /* RMC information */ 2868c2ecf20Sopenharmony_ci u32 avl; /* available for host (unused by RMC) */ 2878c2ecf20Sopenharmony_ci u32 own; /* bit 31: ownership, bits [30:0]: reserved */ 2888c2ecf20Sopenharmony_ci u32 pad0; /* reserved */ 2898c2ecf20Sopenharmony_ci}; 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ci#define FZA_TX_BUFFER_ADDR(x) (0x200000 | (((x) & 0xffff) << 5)) 2928c2ecf20Sopenharmony_ci#define FZA_TX_BUFFER_SIZE 512 2938c2ecf20Sopenharmony_cistruct fza_buffer_tx { 2948c2ecf20Sopenharmony_ci u32 data[FZA_TX_BUFFER_SIZE / sizeof(u32)]; 2958c2ecf20Sopenharmony_ci}; 2968c2ecf20Sopenharmony_ci 2978c2ecf20Sopenharmony_ci/* Transmit ring RMC constants. */ 2988c2ecf20Sopenharmony_ci#define FZA_RING_TX_SOP 0x80000000 /* start of packet */ 2998c2ecf20Sopenharmony_ci#define FZA_RING_TX_EOP 0x40000000 /* end of packet */ 3008c2ecf20Sopenharmony_ci#define FZA_RING_TX_DTP 0x20000000 /* discard this packet */ 3018c2ecf20Sopenharmony_ci#define FZA_RING_TX_VBC 0x10000000 /* valid buffer byte count */ 3028c2ecf20Sopenharmony_ci#define FZA_RING_TX_DCC_MASK 0x0f000000 /* DMA completion code */ 3038c2ecf20Sopenharmony_ci#define FZA_RING_TX_DCC_SUCCESS 0x01000000 /* transmit succeeded */ 3048c2ecf20Sopenharmony_ci#define FZA_RING_TX_DCC_DTP_SOP 0x02000000 /* DTP set at SOP */ 3058c2ecf20Sopenharmony_ci#define FZA_RING_TX_DCC_DTP 0x04000000 /* DTP set within packet */ 3068c2ecf20Sopenharmony_ci#define FZA_RING_TX_DCC_ABORT 0x05000000 /* MAC-requested abort */ 3078c2ecf20Sopenharmony_ci#define FZA_RING_TX_DCC_PARITY 0x06000000 /* xmit data parity error */ 3088c2ecf20Sopenharmony_ci#define FZA_RING_TX_DCC_UNDRRUN 0x07000000 /* transmit underrun */ 3098c2ecf20Sopenharmony_ci#define FZA_RING_TX_XPO_MASK 0x003fe000 /* transmit packet offset */ 3108c2ecf20Sopenharmony_ci 3118c2ecf20Sopenharmony_ci/* Host receive descriptor ring entry. */ 3128c2ecf20Sopenharmony_cistruct fza_ring_hst_rx { 3138c2ecf20Sopenharmony_ci u32 buf0_own; /* bit 31: ownership, bits [30:23]: unused, 3148c2ecf20Sopenharmony_ci * bits [22:0]: right-shifted address of the 3158c2ecf20Sopenharmony_ci * buffer in system memory (low buffer) 3168c2ecf20Sopenharmony_ci */ 3178c2ecf20Sopenharmony_ci u32 buffer1; /* bits [31:23]: unused, 3188c2ecf20Sopenharmony_ci * bits [22:0]: right-shifted address of the 3198c2ecf20Sopenharmony_ci * buffer in system memory (high buffer) 3208c2ecf20Sopenharmony_ci */ 3218c2ecf20Sopenharmony_ci u32 rmc; /* RMC information */ 3228c2ecf20Sopenharmony_ci u32 pad0; 3238c2ecf20Sopenharmony_ci}; 3248c2ecf20Sopenharmony_ci 3258c2ecf20Sopenharmony_ci#define FZA_RX_BUFFER_SIZE (4096 + 512) /* buffer length */ 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci/* Receive ring RMC constants. */ 3288c2ecf20Sopenharmony_ci#define FZA_RING_RX_SOP 0x80000000 /* start of packet */ 3298c2ecf20Sopenharmony_ci#define FZA_RING_RX_EOP 0x40000000 /* end of packet */ 3308c2ecf20Sopenharmony_ci#define FZA_RING_RX_FSC_MASK 0x38000000 /* # of frame status bits */ 3318c2ecf20Sopenharmony_ci#define FZA_RING_RX_FSB_MASK 0x07c00000 /* frame status bits */ 3328c2ecf20Sopenharmony_ci#define FZA_RING_RX_FSB_ERR 0x04000000 /* error detected */ 3338c2ecf20Sopenharmony_ci#define FZA_RING_RX_FSB_ADDR 0x02000000 /* address recognized */ 3348c2ecf20Sopenharmony_ci#define FZA_RING_RX_FSB_COP 0x01000000 /* frame copied */ 3358c2ecf20Sopenharmony_ci#define FZA_RING_RX_FSB_F0 0x00800000 /* first additional flag */ 3368c2ecf20Sopenharmony_ci#define FZA_RING_RX_FSB_F1 0x00400000 /* second additional flag */ 3378c2ecf20Sopenharmony_ci#define FZA_RING_RX_BAD 0x00200000 /* bad packet */ 3388c2ecf20Sopenharmony_ci#define FZA_RING_RX_CRC 0x00100000 /* CRC error */ 3398c2ecf20Sopenharmony_ci#define FZA_RING_RX_RRR_MASK 0x000e0000 /* MAC receive status bits */ 3408c2ecf20Sopenharmony_ci#define FZA_RING_RX_RRR_OK 0x00000000 /* receive OK */ 3418c2ecf20Sopenharmony_ci#define FZA_RING_RX_RRR_SADDR 0x00020000 /* source address matched */ 3428c2ecf20Sopenharmony_ci#define FZA_RING_RX_RRR_DADDR 0x00040000 /* dest address not matched */ 3438c2ecf20Sopenharmony_ci#define FZA_RING_RX_RRR_ABORT 0x00060000 /* RMC abort */ 3448c2ecf20Sopenharmony_ci#define FZA_RING_RX_RRR_LENGTH 0x00080000 /* invalid length */ 3458c2ecf20Sopenharmony_ci#define FZA_RING_RX_RRR_FRAG 0x000a0000 /* fragment */ 3468c2ecf20Sopenharmony_ci#define FZA_RING_RX_RRR_FORMAT 0x000c0000 /* format error */ 3478c2ecf20Sopenharmony_ci#define FZA_RING_RX_RRR_RESET 0x000e0000 /* MAC reset */ 3488c2ecf20Sopenharmony_ci#define FZA_RING_RX_DA_MASK 0x00018000 /* daddr match status bits */ 3498c2ecf20Sopenharmony_ci#define FZA_RING_RX_DA_NONE 0x00000000 /* no match */ 3508c2ecf20Sopenharmony_ci#define FZA_RING_RX_DA_PROM 0x00008000 /* promiscuous match */ 3518c2ecf20Sopenharmony_ci#define FZA_RING_RX_DA_CAM 0x00010000 /* CAM entry match */ 3528c2ecf20Sopenharmony_ci#define FZA_RING_RX_DA_LOCAL 0x00018000 /* link addr or LLC bcast */ 3538c2ecf20Sopenharmony_ci#define FZA_RING_RX_SA_MASK 0x00006000 /* saddr match status bits */ 3548c2ecf20Sopenharmony_ci#define FZA_RING_RX_SA_NONE 0x00000000 /* no match */ 3558c2ecf20Sopenharmony_ci#define FZA_RING_RX_SA_ALIAS 0x00002000 /* alias address match */ 3568c2ecf20Sopenharmony_ci#define FZA_RING_RX_SA_CAM 0x00004000 /* CAM entry match */ 3578c2ecf20Sopenharmony_ci#define FZA_RING_RX_SA_LOCAL 0x00006000 /* link address match */ 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_ci/* SMT (Station Management) transmit/receive descriptor ring entry. */ 3608c2ecf20Sopenharmony_cistruct fza_ring_smt { 3618c2ecf20Sopenharmony_ci u32 own; /* bit 31: ownership, bits [30:0]: unused */ 3628c2ecf20Sopenharmony_ci u32 rmc; /* RMC information */ 3638c2ecf20Sopenharmony_ci u32 buffer; /* address of the buffer */ 3648c2ecf20Sopenharmony_ci u32 pad0; /* reserved */ 3658c2ecf20Sopenharmony_ci}; 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci/* Ownership constants. 3688c2ecf20Sopenharmony_ci * 3698c2ecf20Sopenharmony_ci * Only an owner is permitted to process a given ring entry. 3708c2ecf20Sopenharmony_ci * RMC transmit ring meanings are reversed. 3718c2ecf20Sopenharmony_ci */ 3728c2ecf20Sopenharmony_ci#define FZA_RING_OWN_MASK 0x80000000 3738c2ecf20Sopenharmony_ci#define FZA_RING_OWN_FZA 0x00000000 /* permit FZA, forbid host */ 3748c2ecf20Sopenharmony_ci#define FZA_RING_OWN_HOST 0x80000000 /* permit host, forbid FZA */ 3758c2ecf20Sopenharmony_ci#define FZA_RING_TX_OWN_RMC 0x80000000 /* permit RMC, forbid host */ 3768c2ecf20Sopenharmony_ci#define FZA_RING_TX_OWN_HOST 0x00000000 /* permit host, forbid RMC */ 3778c2ecf20Sopenharmony_ci 3788c2ecf20Sopenharmony_ci/* RMC constants. */ 3798c2ecf20Sopenharmony_ci#define FZA_RING_PBC_MASK 0x00001fff /* frame length */ 3808c2ecf20Sopenharmony_ci 3818c2ecf20Sopenharmony_ci/* Layout of counter buffers. */ 3828c2ecf20Sopenharmony_ci 3838c2ecf20Sopenharmony_cistruct fza_counter { 3848c2ecf20Sopenharmony_ci u32 msw; 3858c2ecf20Sopenharmony_ci u32 lsw; 3868c2ecf20Sopenharmony_ci}; 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_cistruct fza_counters { 3898c2ecf20Sopenharmony_ci struct fza_counter sys_buf; /* system buffer unavailable */ 3908c2ecf20Sopenharmony_ci struct fza_counter tx_under; /* transmit underruns */ 3918c2ecf20Sopenharmony_ci struct fza_counter tx_fail; /* transmit failures */ 3928c2ecf20Sopenharmony_ci struct fza_counter rx_over; /* receive data overruns */ 3938c2ecf20Sopenharmony_ci struct fza_counter frame_cnt; /* frame count */ 3948c2ecf20Sopenharmony_ci struct fza_counter error_cnt; /* error count */ 3958c2ecf20Sopenharmony_ci struct fza_counter lost_cnt; /* lost count */ 3968c2ecf20Sopenharmony_ci struct fza_counter rinit_in; /* ring initialization initiated */ 3978c2ecf20Sopenharmony_ci struct fza_counter rinit_rx; /* ring initialization received */ 3988c2ecf20Sopenharmony_ci struct fza_counter beac_in; /* ring beacon initiated */ 3998c2ecf20Sopenharmony_ci struct fza_counter dup_addr; /* duplicate address test failures */ 4008c2ecf20Sopenharmony_ci struct fza_counter dup_tok; /* duplicate token detected */ 4018c2ecf20Sopenharmony_ci struct fza_counter purg_err; /* ring purge errors */ 4028c2ecf20Sopenharmony_ci struct fza_counter strip_err; /* bridge strip errors */ 4038c2ecf20Sopenharmony_ci struct fza_counter pct_in; /* traces initiated */ 4048c2ecf20Sopenharmony_ci struct fza_counter pct_rx; /* traces received */ 4058c2ecf20Sopenharmony_ci struct fza_counter lem_rej; /* LEM rejects */ 4068c2ecf20Sopenharmony_ci struct fza_counter tne_rej; /* TNE expiry rejects */ 4078c2ecf20Sopenharmony_ci struct fza_counter lem_event; /* LEM events */ 4088c2ecf20Sopenharmony_ci struct fza_counter lct_rej; /* LCT rejects */ 4098c2ecf20Sopenharmony_ci struct fza_counter conn_cmpl; /* connections completed */ 4108c2ecf20Sopenharmony_ci struct fza_counter el_buf; /* elasticity buffer errors */ 4118c2ecf20Sopenharmony_ci}; 4128c2ecf20Sopenharmony_ci 4138c2ecf20Sopenharmony_ci/* Layout of command buffers. */ 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_ci/* INIT command buffer. 4168c2ecf20Sopenharmony_ci * 4178c2ecf20Sopenharmony_ci * Values of default link parameters given are as obtained from a 4188c2ecf20Sopenharmony_ci * DEFZA-AA rev. C03 board. The board counts time in units of 80ns. 4198c2ecf20Sopenharmony_ci */ 4208c2ecf20Sopenharmony_cistruct fza_cmd_init { 4218c2ecf20Sopenharmony_ci u32 tx_mode; /* transmit mode */ 4228c2ecf20Sopenharmony_ci u32 hst_rx_size; /* host receive ring entries */ 4238c2ecf20Sopenharmony_ci 4248c2ecf20Sopenharmony_ci struct fza_counters counters; /* counters */ 4258c2ecf20Sopenharmony_ci 4268c2ecf20Sopenharmony_ci u8 rmc_rev[4]; /* RMC revision */ 4278c2ecf20Sopenharmony_ci u8 rom_rev[4]; /* ROM revision */ 4288c2ecf20Sopenharmony_ci u8 fw_rev[4]; /* firmware revision */ 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_ci u32 mop_type; /* MOP device type */ 4318c2ecf20Sopenharmony_ci 4328c2ecf20Sopenharmony_ci u32 hst_rx; /* base of host rx descriptor ring */ 4338c2ecf20Sopenharmony_ci u32 rmc_tx; /* base of RMC tx descriptor ring */ 4348c2ecf20Sopenharmony_ci u32 rmc_tx_size; /* size of RMC tx descriptor ring */ 4358c2ecf20Sopenharmony_ci u32 smt_tx; /* base of SMT tx descriptor ring */ 4368c2ecf20Sopenharmony_ci u32 smt_tx_size; /* size of SMT tx descriptor ring */ 4378c2ecf20Sopenharmony_ci u32 smt_rx; /* base of SMT rx descriptor ring */ 4388c2ecf20Sopenharmony_ci u32 smt_rx_size; /* size of SMT rx descriptor ring */ 4398c2ecf20Sopenharmony_ci 4408c2ecf20Sopenharmony_ci u32 hw_addr[2]; /* link address */ 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_ci u32 def_t_req; /* default Requested TTRT (T_REQ) -- 4438c2ecf20Sopenharmony_ci * C03: 100000 [80ns] 4448c2ecf20Sopenharmony_ci */ 4458c2ecf20Sopenharmony_ci u32 def_tvx; /* default Valid Transmission Time 4468c2ecf20Sopenharmony_ci * (TVX) -- C03: 32768 [80ns] 4478c2ecf20Sopenharmony_ci */ 4488c2ecf20Sopenharmony_ci u32 def_t_max; /* default Maximum TTRT (T_MAX) -- 4498c2ecf20Sopenharmony_ci * C03: 2162688 [80ns] 4508c2ecf20Sopenharmony_ci */ 4518c2ecf20Sopenharmony_ci u32 lem_threshold; /* default LEM threshold -- C03: 8 */ 4528c2ecf20Sopenharmony_ci u32 def_station_id[2]; /* default station ID */ 4538c2ecf20Sopenharmony_ci 4548c2ecf20Sopenharmony_ci u32 pmd_type_alt; /* alternative PMD type code */ 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_ci u32 smt_ver; /* SMT version */ 4578c2ecf20Sopenharmony_ci 4588c2ecf20Sopenharmony_ci u32 rtoken_timeout; /* default restricted token timeout 4598c2ecf20Sopenharmony_ci * -- C03: 12500000 [80ns] 4608c2ecf20Sopenharmony_ci */ 4618c2ecf20Sopenharmony_ci u32 ring_purger; /* default ring purger enable -- 4628c2ecf20Sopenharmony_ci * C03: 1 4638c2ecf20Sopenharmony_ci */ 4648c2ecf20Sopenharmony_ci 4658c2ecf20Sopenharmony_ci u32 smt_ver_max; /* max SMT version ID */ 4668c2ecf20Sopenharmony_ci u32 smt_ver_min; /* min SMT version ID */ 4678c2ecf20Sopenharmony_ci u32 pmd_type; /* PMD type code */ 4688c2ecf20Sopenharmony_ci}; 4698c2ecf20Sopenharmony_ci 4708c2ecf20Sopenharmony_ci/* INIT command PMD type codes. */ 4718c2ecf20Sopenharmony_ci#define FZA_PMD_TYPE_MMF 0 /* Multimode fiber */ 4728c2ecf20Sopenharmony_ci#define FZA_PMD_TYPE_TW 101 /* ThinWire */ 4738c2ecf20Sopenharmony_ci#define FZA_PMD_TYPE_STP 102 /* STP */ 4748c2ecf20Sopenharmony_ci 4758c2ecf20Sopenharmony_ci/* MODCAM/RDCAM command buffer. */ 4768c2ecf20Sopenharmony_ci#define FZA_CMD_CAM_SIZE 64 /* CAM address entry count */ 4778c2ecf20Sopenharmony_cistruct fza_cmd_cam { 4788c2ecf20Sopenharmony_ci u32 hw_addr[FZA_CMD_CAM_SIZE][2]; /* CAM address entries */ 4798c2ecf20Sopenharmony_ci}; 4808c2ecf20Sopenharmony_ci 4818c2ecf20Sopenharmony_ci/* PARAM command buffer. 4828c2ecf20Sopenharmony_ci * 4838c2ecf20Sopenharmony_ci * Permitted ranges given are as defined by the spec and obtained from a 4848c2ecf20Sopenharmony_ci * DEFZA-AA rev. C03 board, respectively. The rtoken_timeout field is 4858c2ecf20Sopenharmony_ci * erroneously interpreted in units of ms. 4868c2ecf20Sopenharmony_ci */ 4878c2ecf20Sopenharmony_cistruct fza_cmd_param { 4888c2ecf20Sopenharmony_ci u32 loop_mode; /* loopback mode */ 4898c2ecf20Sopenharmony_ci u32 t_max; /* Maximum TTRT (T_MAX) 4908c2ecf20Sopenharmony_ci * def: ??? [80ns] 4918c2ecf20Sopenharmony_ci * C03: [t_req+1,4294967295] [80ns] 4928c2ecf20Sopenharmony_ci */ 4938c2ecf20Sopenharmony_ci u32 t_req; /* Requested TTRT (T_REQ) 4948c2ecf20Sopenharmony_ci * def: [50000,2097151] [80ns] 4958c2ecf20Sopenharmony_ci * C03: [50001,t_max-1] [80ns] 4968c2ecf20Sopenharmony_ci */ 4978c2ecf20Sopenharmony_ci u32 tvx; /* Valid Transmission Time (TVX) 4988c2ecf20Sopenharmony_ci * def: [29375,65280] [80ns] 4998c2ecf20Sopenharmony_ci * C03: [29376,65279] [80ns] 5008c2ecf20Sopenharmony_ci */ 5018c2ecf20Sopenharmony_ci u32 lem_threshold; /* LEM threshold */ 5028c2ecf20Sopenharmony_ci u32 station_id[2]; /* station ID */ 5038c2ecf20Sopenharmony_ci u32 rtoken_timeout; /* restricted token timeout 5048c2ecf20Sopenharmony_ci * def: [0,125000000] [80ns] 5058c2ecf20Sopenharmony_ci * C03: [0,9999] [ms] 5068c2ecf20Sopenharmony_ci */ 5078c2ecf20Sopenharmony_ci u32 ring_purger; /* ring purger enable: 0|1 */ 5088c2ecf20Sopenharmony_ci}; 5098c2ecf20Sopenharmony_ci 5108c2ecf20Sopenharmony_ci/* Loopback modes for the PARAM command. */ 5118c2ecf20Sopenharmony_ci#define FZA_LOOP_NORMAL 0 5128c2ecf20Sopenharmony_ci#define FZA_LOOP_INTERN 1 5138c2ecf20Sopenharmony_ci#define FZA_LOOP_EXTERN 2 5148c2ecf20Sopenharmony_ci 5158c2ecf20Sopenharmony_ci/* MODPROM command buffer. */ 5168c2ecf20Sopenharmony_cistruct fza_cmd_modprom { 5178c2ecf20Sopenharmony_ci u32 llc_prom; /* LLC promiscuous enable */ 5188c2ecf20Sopenharmony_ci u32 smt_prom; /* SMT promiscuous enable */ 5198c2ecf20Sopenharmony_ci u32 llc_multi; /* LLC multicast promiscuous enable */ 5208c2ecf20Sopenharmony_ci u32 llc_bcast; /* LLC broadcast promiscuous enable */ 5218c2ecf20Sopenharmony_ci}; 5228c2ecf20Sopenharmony_ci 5238c2ecf20Sopenharmony_ci/* SETCHAR command buffer. 5248c2ecf20Sopenharmony_ci * 5258c2ecf20Sopenharmony_ci * Permitted ranges are as for the PARAM command. 5268c2ecf20Sopenharmony_ci */ 5278c2ecf20Sopenharmony_cistruct fza_cmd_setchar { 5288c2ecf20Sopenharmony_ci u32 t_max; /* Maximum TTRT (T_MAX) */ 5298c2ecf20Sopenharmony_ci u32 t_req; /* Requested TTRT (T_REQ) */ 5308c2ecf20Sopenharmony_ci u32 tvx; /* Valid Transmission Time (TVX) */ 5318c2ecf20Sopenharmony_ci u32 lem_threshold; /* LEM threshold */ 5328c2ecf20Sopenharmony_ci u32 rtoken_timeout; /* restricted token timeout */ 5338c2ecf20Sopenharmony_ci u32 ring_purger; /* ring purger enable */ 5348c2ecf20Sopenharmony_ci}; 5358c2ecf20Sopenharmony_ci 5368c2ecf20Sopenharmony_ci/* RDCNTR command buffer. */ 5378c2ecf20Sopenharmony_cistruct fza_cmd_rdcntr { 5388c2ecf20Sopenharmony_ci struct fza_counters counters; /* counters */ 5398c2ecf20Sopenharmony_ci}; 5408c2ecf20Sopenharmony_ci 5418c2ecf20Sopenharmony_ci/* STATUS command buffer. */ 5428c2ecf20Sopenharmony_cistruct fza_cmd_status { 5438c2ecf20Sopenharmony_ci u32 led_state; /* LED state */ 5448c2ecf20Sopenharmony_ci u32 rmt_state; /* ring management state */ 5458c2ecf20Sopenharmony_ci u32 link_state; /* link state */ 5468c2ecf20Sopenharmony_ci u32 dup_addr; /* duplicate address flag */ 5478c2ecf20Sopenharmony_ci u32 ring_purger; /* ring purger state */ 5488c2ecf20Sopenharmony_ci u32 t_neg; /* negotiated TTRT [80ns] */ 5498c2ecf20Sopenharmony_ci u32 una[2]; /* upstream neighbour address */ 5508c2ecf20Sopenharmony_ci u32 una_timeout; /* UNA timed out */ 5518c2ecf20Sopenharmony_ci u32 strip_mode; /* frame strip mode */ 5528c2ecf20Sopenharmony_ci u32 yield_mode; /* claim token yield mode */ 5538c2ecf20Sopenharmony_ci u32 phy_state; /* PHY state */ 5548c2ecf20Sopenharmony_ci u32 neigh_phy; /* neighbour PHY type */ 5558c2ecf20Sopenharmony_ci u32 reject; /* reject reason */ 5568c2ecf20Sopenharmony_ci u32 phy_lee; /* PHY link error estimate [-log10] */ 5578c2ecf20Sopenharmony_ci u32 una_old[2]; /* old upstream neighbour address */ 5588c2ecf20Sopenharmony_ci u32 rmt_mac; /* remote MAC indicated */ 5598c2ecf20Sopenharmony_ci u32 ring_err; /* ring error reason */ 5608c2ecf20Sopenharmony_ci u32 beac_rx[2]; /* sender of last directed beacon */ 5618c2ecf20Sopenharmony_ci u32 un_dup_addr; /* upstream neighbr dup address flag */ 5628c2ecf20Sopenharmony_ci u32 dna[2]; /* downstream neighbour address */ 5638c2ecf20Sopenharmony_ci u32 dna_old[2]; /* old downstream neighbour address */ 5648c2ecf20Sopenharmony_ci}; 5658c2ecf20Sopenharmony_ci 5668c2ecf20Sopenharmony_ci/* Common command buffer. */ 5678c2ecf20Sopenharmony_ciunion fza_cmd_buf { 5688c2ecf20Sopenharmony_ci struct fza_cmd_init init; 5698c2ecf20Sopenharmony_ci struct fza_cmd_cam cam; 5708c2ecf20Sopenharmony_ci struct fza_cmd_param param; 5718c2ecf20Sopenharmony_ci struct fza_cmd_modprom modprom; 5728c2ecf20Sopenharmony_ci struct fza_cmd_setchar setchar; 5738c2ecf20Sopenharmony_ci struct fza_cmd_rdcntr rdcntr; 5748c2ecf20Sopenharmony_ci struct fza_cmd_status status; 5758c2ecf20Sopenharmony_ci}; 5768c2ecf20Sopenharmony_ci 5778c2ecf20Sopenharmony_ci/* MAC (Media Access Controller) chip packet request header constants. */ 5788c2ecf20Sopenharmony_ci 5798c2ecf20Sopenharmony_ci/* Packet request header byte #0. */ 5808c2ecf20Sopenharmony_ci#define FZA_PRH0_FMT_TYPE_MASK 0xc0 /* type of packet, always zero */ 5818c2ecf20Sopenharmony_ci#define FZA_PRH0_TOK_TYPE_MASK 0x30 /* type of token required 5828c2ecf20Sopenharmony_ci * to send this frame 5838c2ecf20Sopenharmony_ci */ 5848c2ecf20Sopenharmony_ci#define FZA_PRH0_TKN_TYPE_ANY 0x30 /* use either token type */ 5858c2ecf20Sopenharmony_ci#define FZA_PRH0_TKN_TYPE_UNR 0x20 /* use an unrestricted token */ 5868c2ecf20Sopenharmony_ci#define FZA_PRH0_TKN_TYPE_RST 0x10 /* use a restricted token */ 5878c2ecf20Sopenharmony_ci#define FZA_PRH0_TKN_TYPE_IMM 0x00 /* send immediately, no token required 5888c2ecf20Sopenharmony_ci */ 5898c2ecf20Sopenharmony_ci#define FZA_PRH0_FRAME_MASK 0x08 /* type of frame to send */ 5908c2ecf20Sopenharmony_ci#define FZA_PRH0_FRAME_SYNC 0x08 /* send a synchronous frame */ 5918c2ecf20Sopenharmony_ci#define FZA_PRH0_FRAME_ASYNC 0x00 /* send an asynchronous frame */ 5928c2ecf20Sopenharmony_ci#define FZA_PRH0_MODE_MASK 0x04 /* send mode */ 5938c2ecf20Sopenharmony_ci#define FZA_PRH0_MODE_IMMED 0x04 /* an immediate mode, send regardless 5948c2ecf20Sopenharmony_ci * of the ring operational state 5958c2ecf20Sopenharmony_ci */ 5968c2ecf20Sopenharmony_ci#define FZA_PRH0_MODE_NORMAL 0x00 /* a normal mode, send only if ring 5978c2ecf20Sopenharmony_ci * operational 5988c2ecf20Sopenharmony_ci */ 5998c2ecf20Sopenharmony_ci#define FZA_PRH0_SF_MASK 0x02 /* send frame first */ 6008c2ecf20Sopenharmony_ci#define FZA_PRH0_SF_FIRST 0x02 /* send this frame first 6018c2ecf20Sopenharmony_ci * with this token capture 6028c2ecf20Sopenharmony_ci */ 6038c2ecf20Sopenharmony_ci#define FZA_PRH0_SF_NORMAL 0x00 /* treat this frame normally */ 6048c2ecf20Sopenharmony_ci#define FZA_PRH0_BCN_MASK 0x01 /* beacon frame */ 6058c2ecf20Sopenharmony_ci#define FZA_PRH0_BCN_BEACON 0x01 /* send the frame only 6068c2ecf20Sopenharmony_ci * if in the beacon state 6078c2ecf20Sopenharmony_ci */ 6088c2ecf20Sopenharmony_ci#define FZA_PRH0_BCN_DATA 0x01 /* send the frame only 6098c2ecf20Sopenharmony_ci * if in the data state 6108c2ecf20Sopenharmony_ci */ 6118c2ecf20Sopenharmony_ci/* Packet request header byte #1. */ 6128c2ecf20Sopenharmony_ci /* bit 7 always zero */ 6138c2ecf20Sopenharmony_ci#define FZA_PRH1_SL_MASK 0x40 /* send frame last */ 6148c2ecf20Sopenharmony_ci#define FZA_PRH1_SL_LAST 0x40 /* send this frame last, releasing 6158c2ecf20Sopenharmony_ci * the token afterwards 6168c2ecf20Sopenharmony_ci */ 6178c2ecf20Sopenharmony_ci#define FZA_PRH1_SL_NORMAL 0x00 /* treat this frame normally */ 6188c2ecf20Sopenharmony_ci#define FZA_PRH1_CRC_MASK 0x20 /* CRC append */ 6198c2ecf20Sopenharmony_ci#define FZA_PRH1_CRC_NORMAL 0x20 /* calculate the CRC and append it 6208c2ecf20Sopenharmony_ci * as the FCS field to the frame 6218c2ecf20Sopenharmony_ci */ 6228c2ecf20Sopenharmony_ci#define FZA_PRH1_CRC_SKIP 0x00 /* leave the frame as is */ 6238c2ecf20Sopenharmony_ci#define FZA_PRH1_TKN_SEND_MASK 0x18 /* type of token to send after the 6248c2ecf20Sopenharmony_ci * frame if this is the last frame 6258c2ecf20Sopenharmony_ci */ 6268c2ecf20Sopenharmony_ci#define FZA_PRH1_TKN_SEND_ORIG 0x18 /* send a token of the same type as the 6278c2ecf20Sopenharmony_ci * originally captured one 6288c2ecf20Sopenharmony_ci */ 6298c2ecf20Sopenharmony_ci#define FZA_PRH1_TKN_SEND_RST 0x10 /* send a restricted token */ 6308c2ecf20Sopenharmony_ci#define FZA_PRH1_TKN_SEND_UNR 0x08 /* send an unrestricted token */ 6318c2ecf20Sopenharmony_ci#define FZA_PRH1_TKN_SEND_NONE 0x00 /* send no token */ 6328c2ecf20Sopenharmony_ci#define FZA_PRH1_EXTRA_FS_MASK 0x07 /* send extra frame status indicators 6338c2ecf20Sopenharmony_ci */ 6348c2ecf20Sopenharmony_ci#define FZA_PRH1_EXTRA_FS_ST 0x07 /* TR RR ST II */ 6358c2ecf20Sopenharmony_ci#define FZA_PRH1_EXTRA_FS_SS 0x06 /* TR RR SS II */ 6368c2ecf20Sopenharmony_ci#define FZA_PRH1_EXTRA_FS_SR 0x05 /* TR RR SR II */ 6378c2ecf20Sopenharmony_ci#define FZA_PRH1_EXTRA_FS_NONE1 0x04 /* TR RR II II */ 6388c2ecf20Sopenharmony_ci#define FZA_PRH1_EXTRA_FS_RT 0x03 /* TR RR RT II */ 6398c2ecf20Sopenharmony_ci#define FZA_PRH1_EXTRA_FS_RS 0x02 /* TR RR RS II */ 6408c2ecf20Sopenharmony_ci#define FZA_PRH1_EXTRA_FS_RR 0x01 /* TR RR RR II */ 6418c2ecf20Sopenharmony_ci#define FZA_PRH1_EXTRA_FS_NONE 0x00 /* TR RR II II */ 6428c2ecf20Sopenharmony_ci/* Packet request header byte #2. */ 6438c2ecf20Sopenharmony_ci#define FZA_PRH2_NORMAL 0x00 /* always zero */ 6448c2ecf20Sopenharmony_ci 6458c2ecf20Sopenharmony_ci/* PRH used for LLC frames. */ 6468c2ecf20Sopenharmony_ci#define FZA_PRH0_LLC (FZA_PRH0_TKN_TYPE_UNR) 6478c2ecf20Sopenharmony_ci#define FZA_PRH1_LLC (FZA_PRH1_CRC_NORMAL | FZA_PRH1_TKN_SEND_UNR) 6488c2ecf20Sopenharmony_ci#define FZA_PRH2_LLC (FZA_PRH2_NORMAL) 6498c2ecf20Sopenharmony_ci 6508c2ecf20Sopenharmony_ci/* PRH used for SMT frames. */ 6518c2ecf20Sopenharmony_ci#define FZA_PRH0_SMT (FZA_PRH0_TKN_TYPE_UNR) 6528c2ecf20Sopenharmony_ci#define FZA_PRH1_SMT (FZA_PRH1_CRC_NORMAL | FZA_PRH1_TKN_SEND_UNR) 6538c2ecf20Sopenharmony_ci#define FZA_PRH2_SMT (FZA_PRH2_NORMAL) 6548c2ecf20Sopenharmony_ci 6558c2ecf20Sopenharmony_ci#if ((FZA_RING_RX_SIZE) < 2) || ((FZA_RING_RX_SIZE) > 256) 6568c2ecf20Sopenharmony_ci# error FZA_RING_RX_SIZE has to be from 2 up to 256 6578c2ecf20Sopenharmony_ci#endif 6588c2ecf20Sopenharmony_ci#if ((FZA_RING_TX_MODE) != 0) && ((FZA_RING_TX_MODE) != 1) 6598c2ecf20Sopenharmony_ci# error FZA_RING_TX_MODE has to be either 0 or 1 6608c2ecf20Sopenharmony_ci#endif 6618c2ecf20Sopenharmony_ci 6628c2ecf20Sopenharmony_ci#define FZA_RING_TX_SIZE (512 << (FZA_RING_TX_MODE)) 6638c2ecf20Sopenharmony_ci 6648c2ecf20Sopenharmony_cistruct fza_private { 6658c2ecf20Sopenharmony_ci struct device *bdev; /* pointer to the bus device */ 6668c2ecf20Sopenharmony_ci const char *name; /* printable device name */ 6678c2ecf20Sopenharmony_ci void __iomem *mmio; /* MMIO ioremap cookie */ 6688c2ecf20Sopenharmony_ci struct fza_regs __iomem *regs; /* pointer to FZA registers */ 6698c2ecf20Sopenharmony_ci 6708c2ecf20Sopenharmony_ci struct sk_buff *rx_skbuff[FZA_RING_RX_SIZE]; 6718c2ecf20Sopenharmony_ci /* all skbs assigned to the host 6728c2ecf20Sopenharmony_ci * receive descriptors 6738c2ecf20Sopenharmony_ci */ 6748c2ecf20Sopenharmony_ci dma_addr_t rx_dma[FZA_RING_RX_SIZE]; 6758c2ecf20Sopenharmony_ci /* their corresponding DMA addresses */ 6768c2ecf20Sopenharmony_ci 6778c2ecf20Sopenharmony_ci struct fza_ring_cmd __iomem *ring_cmd; 6788c2ecf20Sopenharmony_ci /* pointer to the command descriptor 6798c2ecf20Sopenharmony_ci * ring 6808c2ecf20Sopenharmony_ci */ 6818c2ecf20Sopenharmony_ci int ring_cmd_index; /* index to the command descriptor ring 6828c2ecf20Sopenharmony_ci * for the next command 6838c2ecf20Sopenharmony_ci */ 6848c2ecf20Sopenharmony_ci struct fza_ring_uns __iomem *ring_uns; 6858c2ecf20Sopenharmony_ci /* pointer to the unsolicited 6868c2ecf20Sopenharmony_ci * descriptor ring 6878c2ecf20Sopenharmony_ci */ 6888c2ecf20Sopenharmony_ci int ring_uns_index; /* index to the unsolicited descriptor 6898c2ecf20Sopenharmony_ci * ring for the next event 6908c2ecf20Sopenharmony_ci */ 6918c2ecf20Sopenharmony_ci 6928c2ecf20Sopenharmony_ci struct fza_ring_rmc_tx __iomem *ring_rmc_tx; 6938c2ecf20Sopenharmony_ci /* pointer to the RMC transmit 6948c2ecf20Sopenharmony_ci * descriptor ring (obtained from the 6958c2ecf20Sopenharmony_ci * INIT command) 6968c2ecf20Sopenharmony_ci */ 6978c2ecf20Sopenharmony_ci int ring_rmc_tx_size; /* number of entries in the RMC 6988c2ecf20Sopenharmony_ci * transmit descriptor ring (obtained 6998c2ecf20Sopenharmony_ci * from the INIT command) 7008c2ecf20Sopenharmony_ci */ 7018c2ecf20Sopenharmony_ci int ring_rmc_tx_index; /* index to the RMC transmit descriptor 7028c2ecf20Sopenharmony_ci * ring for the next transmission 7038c2ecf20Sopenharmony_ci */ 7048c2ecf20Sopenharmony_ci int ring_rmc_txd_index; /* index to the RMC transmit descriptor 7058c2ecf20Sopenharmony_ci * ring for the next transmit done 7068c2ecf20Sopenharmony_ci * acknowledge 7078c2ecf20Sopenharmony_ci */ 7088c2ecf20Sopenharmony_ci 7098c2ecf20Sopenharmony_ci struct fza_ring_hst_rx __iomem *ring_hst_rx; 7108c2ecf20Sopenharmony_ci /* pointer to the host receive 7118c2ecf20Sopenharmony_ci * descriptor ring (obtained from the 7128c2ecf20Sopenharmony_ci * INIT command) 7138c2ecf20Sopenharmony_ci */ 7148c2ecf20Sopenharmony_ci int ring_hst_rx_size; /* number of entries in the host 7158c2ecf20Sopenharmony_ci * receive descriptor ring (set by the 7168c2ecf20Sopenharmony_ci * INIT command) 7178c2ecf20Sopenharmony_ci */ 7188c2ecf20Sopenharmony_ci int ring_hst_rx_index; /* index to the host receive descriptor 7198c2ecf20Sopenharmony_ci * ring for the next transmission 7208c2ecf20Sopenharmony_ci */ 7218c2ecf20Sopenharmony_ci 7228c2ecf20Sopenharmony_ci struct fza_ring_smt __iomem *ring_smt_tx; 7238c2ecf20Sopenharmony_ci /* pointer to the SMT transmit 7248c2ecf20Sopenharmony_ci * descriptor ring (obtained from the 7258c2ecf20Sopenharmony_ci * INIT command) 7268c2ecf20Sopenharmony_ci */ 7278c2ecf20Sopenharmony_ci int ring_smt_tx_size; /* number of entries in the SMT 7288c2ecf20Sopenharmony_ci * transmit descriptor ring (obtained 7298c2ecf20Sopenharmony_ci * from the INIT command) 7308c2ecf20Sopenharmony_ci */ 7318c2ecf20Sopenharmony_ci int ring_smt_tx_index; /* index to the SMT transmit descriptor 7328c2ecf20Sopenharmony_ci * ring for the next transmission 7338c2ecf20Sopenharmony_ci */ 7348c2ecf20Sopenharmony_ci 7358c2ecf20Sopenharmony_ci struct fza_ring_smt __iomem *ring_smt_rx; 7368c2ecf20Sopenharmony_ci /* pointer to the SMT transmit 7378c2ecf20Sopenharmony_ci * descriptor ring (obtained from the 7388c2ecf20Sopenharmony_ci * INIT command) 7398c2ecf20Sopenharmony_ci */ 7408c2ecf20Sopenharmony_ci int ring_smt_rx_size; /* number of entries in the SMT 7418c2ecf20Sopenharmony_ci * receive descriptor ring (obtained 7428c2ecf20Sopenharmony_ci * from the INIT command) 7438c2ecf20Sopenharmony_ci */ 7448c2ecf20Sopenharmony_ci int ring_smt_rx_index; /* index to the SMT receive descriptor 7458c2ecf20Sopenharmony_ci * ring for the next transmission 7468c2ecf20Sopenharmony_ci */ 7478c2ecf20Sopenharmony_ci 7488c2ecf20Sopenharmony_ci struct fza_buffer_tx __iomem *buffer_tx; 7498c2ecf20Sopenharmony_ci /* pointer to the RMC transmit buffers 7508c2ecf20Sopenharmony_ci */ 7518c2ecf20Sopenharmony_ci 7528c2ecf20Sopenharmony_ci uint state; /* adapter expected state */ 7538c2ecf20Sopenharmony_ci 7548c2ecf20Sopenharmony_ci spinlock_t lock; /* for device & private data access */ 7558c2ecf20Sopenharmony_ci uint int_mask; /* interrupt source selector */ 7568c2ecf20Sopenharmony_ci 7578c2ecf20Sopenharmony_ci int cmd_done_flag; /* command completion trigger */ 7588c2ecf20Sopenharmony_ci wait_queue_head_t cmd_done_wait; 7598c2ecf20Sopenharmony_ci 7608c2ecf20Sopenharmony_ci int state_chg_flag; /* state change trigger */ 7618c2ecf20Sopenharmony_ci wait_queue_head_t state_chg_wait; 7628c2ecf20Sopenharmony_ci 7638c2ecf20Sopenharmony_ci struct timer_list reset_timer; /* RESET time-out trigger */ 7648c2ecf20Sopenharmony_ci int timer_state; /* RESET trigger state */ 7658c2ecf20Sopenharmony_ci 7668c2ecf20Sopenharmony_ci int queue_active; /* whether to enable queueing */ 7678c2ecf20Sopenharmony_ci 7688c2ecf20Sopenharmony_ci struct net_device_stats stats; 7698c2ecf20Sopenharmony_ci 7708c2ecf20Sopenharmony_ci uint irq_count_flush_tx; /* transmit flush irqs */ 7718c2ecf20Sopenharmony_ci uint irq_count_uns_poll; /* unsolicited event irqs */ 7728c2ecf20Sopenharmony_ci uint irq_count_smt_tx_poll; /* SMT transmit irqs */ 7738c2ecf20Sopenharmony_ci uint irq_count_rx_poll; /* host receive irqs */ 7748c2ecf20Sopenharmony_ci uint irq_count_tx_done; /* transmit done irqs */ 7758c2ecf20Sopenharmony_ci uint irq_count_cmd_done; /* command done irqs */ 7768c2ecf20Sopenharmony_ci uint irq_count_state_chg; /* state change irqs */ 7778c2ecf20Sopenharmony_ci uint irq_count_link_st_chg; /* link status change irqs */ 7788c2ecf20Sopenharmony_ci 7798c2ecf20Sopenharmony_ci uint t_max; /* T_MAX */ 7808c2ecf20Sopenharmony_ci uint t_req; /* T_REQ */ 7818c2ecf20Sopenharmony_ci uint tvx; /* TVX */ 7828c2ecf20Sopenharmony_ci uint lem_threshold; /* LEM threshold */ 7838c2ecf20Sopenharmony_ci uint station_id[2]; /* station ID */ 7848c2ecf20Sopenharmony_ci uint rtoken_timeout; /* restricted token timeout */ 7858c2ecf20Sopenharmony_ci uint ring_purger; /* ring purger enable flag */ 7868c2ecf20Sopenharmony_ci}; 7878c2ecf20Sopenharmony_ci 7888c2ecf20Sopenharmony_cistruct fza_fddihdr { 7898c2ecf20Sopenharmony_ci u8 pa[2]; /* preamble */ 7908c2ecf20Sopenharmony_ci u8 sd; /* starting delimiter */ 7918c2ecf20Sopenharmony_ci struct fddihdr hdr; 7928c2ecf20Sopenharmony_ci} __packed; 793