Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips/ralink KNF; indent, spaces and tabs.
details: https://anonhg.NetBSD.org/src/rev/2b9fba3982e1
branches: trunk
changeset: 348146:2b9fba3982e1
user: ryo <ryo%NetBSD.org@localhost>
date: Wed Oct 05 15:39:31 2016 +0000
description:
KNF; indent, spaces and tabs.
No functional change.
diffstat:
sys/arch/mips/ralink/ralink_eth.c | 476 +++++++------
sys/arch/mips/ralink/ralink_reg.h | 1256 ++++++++++++++++++------------------
2 files changed, 867 insertions(+), 865 deletions(-)
diffs (truncated from 2383 to 300 lines):
diff -r d6ef9154de25 -r 2b9fba3982e1 sys/arch/mips/ralink/ralink_eth.c
--- a/sys/arch/mips/ralink/ralink_eth.c Wed Oct 05 14:30:18 2016 +0000
+++ b/sys/arch/mips/ralink/ralink_eth.c Wed Oct 05 15:39:31 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ralink_eth.c,v 1.9 2016/06/10 13:27:12 ozaki-r Exp $ */
+/* $NetBSD: ralink_eth.c,v 1.10 2016/10/05 15:39:31 ryo Exp $ */
/*-
* Copyright (c) 2011 CradlePoint Technology, Inc.
* All rights reserved.
@@ -29,7 +29,7 @@
/* ralink_eth.c -- Ralink Ethernet Driver */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ralink_eth.c,v 1.9 2016/06/10 13:27:12 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ralink_eth.c,v 1.10 2016/10/05 15:39:31 ryo Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -63,12 +63,12 @@
#include <mips/ralink/ralink_reg.h>
#if 0
#define CPDEBUG /* XXX TMP DEBUG FIXME */
-#define RALINK_ETH_DEBUG /* XXX TMP DEBUG FIXME */
+#define RALINK_ETH_DEBUG /* XXX TMP DEBUG FIXME */
#define ENABLE_RALINK_DEBUG_ERROR 1
#define ENABLE_RALINK_DEBUG_MISC 1
#define ENABLE_RALINK_DEBUG_INFO 1
#define ENABLE_RALINK_DEBUG_FORCE 1
-#define ENABLE_RALINK_DEBUG_REG 1
+#define ENABLE_RALINK_DEBUG_REG 1
#endif
#include <mips/ralink/ralink_debug.h>
@@ -77,49 +77,49 @@
struct ralink_rx_desc {
uint32_t data_ptr;
uint32_t rxd_info1;
-#define RXD_LEN1(x) (((x) >> 0) & 0x3fff)
-#define RXD_LAST1 (1 << 14)
-#define RXD_LEN0(x) (((x) >> 16) & 0x3fff)
-#define RXD_LAST0 (1 << 30)
-#define RXD_DDONE (1 << 31)
+#define RXD_LEN1(x) (((x) >> 0) & 0x3fff)
+#define RXD_LAST1 (1 << 14)
+#define RXD_LEN0(x) (((x) >> 16) & 0x3fff)
+#define RXD_LAST0 (1 << 30)
+#define RXD_DDONE (1 << 31)
uint32_t unused;
uint32_t rxd_info2;
-#define RXD_FOE(x) (((x) >> 0) & 0x3fff)
-#define RXD_FVLD (1 << 14)
-#define RXD_INFO(x) (((x) >> 16) & 0xff)
-#define RXD_PORT(x) (((x) >> 24) & 0x7)
-#define RXD_INFO_CPU (1 << 27)
-#define RXD_L4_FAIL (1 << 28)
-#define RXD_IP_FAIL (1 << 29)
-#define RXD_L4_VLD (1 << 30)
-#define RXD_IP_VLD (1 << 31)
+#define RXD_FOE(x) (((x) >> 0) & 0x3fff)
+#define RXD_FVLD (1 << 14)
+#define RXD_INFO(x) (((x) >> 16) & 0xff)
+#define RXD_PORT(x) (((x) >> 24) & 0x7)
+#define RXD_INFO_CPU (1 << 27)
+#define RXD_L4_FAIL (1 << 28)
+#define RXD_IP_FAIL (1 << 29)
+#define RXD_L4_VLD (1 << 30)
+#define RXD_IP_VLD (1 << 31)
};
/* PDMA RX Descriptor Format */
struct ralink_tx_desc {
uint32_t data_ptr0;
uint32_t txd_info1;
-#define TXD_LEN1(x) (((x) & 0x3fff) << 0)
-#define TXD_LAST1 (1 << 14)
-#define TXD_BURST (1 << 15)
-#define TXD_LEN0(x) (((x) & 0x3fff) << 16)
-#define TXD_LAST0 (1 << 30)
-#define TXD_DDONE (1 << 31)
+#define TXD_LEN1(x) (((x) & 0x3fff) << 0)
+#define TXD_LAST1 (1 << 14)
+#define TXD_BURST (1 << 15)
+#define TXD_LEN0(x) (((x) & 0x3fff) << 16)
+#define TXD_LAST0 (1 << 30)
+#define TXD_DDONE (1 << 31)
uint32_t data_ptr1;
uint32_t txd_info2;
-#define TXD_VIDX(x) (((x) & 0xf) << 0)
-#define TXD_VPRI(x) (((x) & 0x7) << 4)
-#define TXD_VEN (1 << 7)
-#define TXD_SIDX(x) (((x) & 0xf) << 8)
-#define TXD_SEN(x) (1 << 13)
-#define TXD_QN(x) (((x) & 0x7) << 16)
-#define TXD_PN(x) (((x) & 0x7) << 24)
-#define TXD_PN_CPU 0
-#define TXD_PN_GDMA1 1
-#define TXD_PN_GDMA2 2
-#define TXD_TCP_EN (1 << 29)
-#define TXD_UDP_EN (1 << 30)
-#define TXD_IP_EN (1 << 31)
+#define TXD_VIDX(x) (((x) & 0xf) << 0)
+#define TXD_VPRI(x) (((x) & 0x7) << 4)
+#define TXD_VEN (1 << 7)
+#define TXD_SIDX(x) (((x) & 0xf) << 8)
+#define TXD_SEN(x) (1 << 13)
+#define TXD_QN(x) (((x) & 0x7) << 16)
+#define TXD_PN(x) (((x) & 0x7) << 24)
+#define TXD_PN_CPU 0
+#define TXD_PN_GDMA1 1
+#define TXD_PN_GDMA2 2
+#define TXD_TCP_EN (1 << 29)
+#define TXD_UDP_EN (1 << 30)
+#define TXD_IP_EN (1 << 31)
};
/* TODO:
@@ -255,7 +255,8 @@
static void ralink_eth_mii_write(device_t, int, int, int);
CFATTACH_DECL_NEW(reth, sizeof(struct ralink_eth_softc),
- ralink_eth_match, ralink_eth_attach, ralink_eth_detach, ralink_eth_activate);
+ ralink_eth_match, ralink_eth_attach, ralink_eth_detach,
+ ralink_eth_activate);
static inline uint32_t
sy_read(const ralink_eth_softc_t *sc, const bus_size_t off)
@@ -317,44 +318,44 @@
aprint_normal(": Ralink Ethernet\n");
evcnt_attach_dynamic(&sc->sc_evcnt_spurious_intr, EVCNT_TYPE_INTR, NULL,
- device_xname(self), "spurious intr");
+ device_xname(self), "spurious intr");
evcnt_attach_dynamic(&sc->sc_evcnt_rxintr, EVCNT_TYPE_INTR, NULL,
- device_xname(self), "rxintr");
+ device_xname(self), "rxintr");
evcnt_attach_dynamic(&sc->sc_evcnt_rxintr_skip_len,
- EVCNT_TYPE_INTR, &sc->sc_evcnt_rxintr,
- device_xname(self), "rxintr skip: no room for VLAN header");
+ EVCNT_TYPE_INTR, &sc->sc_evcnt_rxintr,
+ device_xname(self), "rxintr skip: no room for VLAN header");
evcnt_attach_dynamic(&sc->sc_evcnt_rxintr_skip_tag_none,
- EVCNT_TYPE_INTR, &sc->sc_evcnt_rxintr,
- device_xname(self), "rxintr skip: no VLAN tag");
+ EVCNT_TYPE_INTR, &sc->sc_evcnt_rxintr,
+ device_xname(self), "rxintr skip: no VLAN tag");
evcnt_attach_dynamic(&sc->sc_evcnt_rxintr_skip_tag_inval,
- EVCNT_TYPE_INTR, &sc->sc_evcnt_rxintr,
- device_xname(self), "rxintr skip: invalid VLAN tag");
+ EVCNT_TYPE_INTR, &sc->sc_evcnt_rxintr,
+ device_xname(self), "rxintr skip: invalid VLAN tag");
evcnt_attach_dynamic(&sc->sc_evcnt_rxintr_skip_inact,
- EVCNT_TYPE_INTR, &sc->sc_evcnt_rxintr,
- device_xname(self), "rxintr skip: partition inactive");
+ EVCNT_TYPE_INTR, &sc->sc_evcnt_rxintr,
+ device_xname(self), "rxintr skip: partition inactive");
evcnt_attach_dynamic(&sc->sc_evcnt_txintr, EVCNT_TYPE_INTR, NULL,
- device_xname(self), "txintr");
+ device_xname(self), "txintr");
evcnt_attach_dynamic(&sc->sc_evcnt_input, EVCNT_TYPE_INTR, NULL,
- device_xname(self), "input");
+ device_xname(self), "input");
evcnt_attach_dynamic(&sc->sc_evcnt_output, EVCNT_TYPE_INTR, NULL,
- device_xname(self), "output");
+ device_xname(self), "output");
evcnt_attach_dynamic(&sc->sc_evcnt_watchdog, EVCNT_TYPE_INTR, NULL,
- device_xname(self), "watchdog");
+ device_xname(self), "watchdog");
evcnt_attach_dynamic(&sc->sc_evcnt_wd_tx,
- EVCNT_TYPE_INTR, &sc->sc_evcnt_watchdog,
- device_xname(self), "watchdog TX timeout");
+ EVCNT_TYPE_INTR, &sc->sc_evcnt_watchdog,
+ device_xname(self), "watchdog TX timeout");
evcnt_attach_dynamic(&sc->sc_evcnt_wd_spurious,
- EVCNT_TYPE_INTR, &sc->sc_evcnt_watchdog,
- device_xname(self), "watchdog spurious");
+ EVCNT_TYPE_INTR, &sc->sc_evcnt_watchdog,
+ device_xname(self), "watchdog spurious");
evcnt_attach_dynamic(&sc->sc_evcnt_wd_reactivate,
- EVCNT_TYPE_INTR, &sc->sc_evcnt_watchdog,
- device_xname(self), "watchdog reactivate");
+ EVCNT_TYPE_INTR, &sc->sc_evcnt_watchdog,
+ device_xname(self), "watchdog reactivate");
evcnt_attach_dynamic(&sc->sc_evcnt_add_rxbuf_hdr_fail,
- EVCNT_TYPE_INTR, NULL,
- device_xname(self), "add rxbuf hdr fail");
+ EVCNT_TYPE_INTR, NULL,
+ device_xname(self), "add rxbuf hdr fail");
evcnt_attach_dynamic(&sc->sc_evcnt_add_rxbuf_mcl_fail,
- EVCNT_TYPE_INTR, NULL,
- device_xname(self), "add rxbuf mcl fail");
+ EVCNT_TYPE_INTR, NULL,
+ device_xname(self), "add rxbuf mcl fail");
/*
* In order to obtain unique initial Ethernet address on a host,
@@ -379,19 +380,19 @@
if ((error = bus_space_map(sc->sc_memt, RA_SYSCTL_BASE,
sc->sc_sy_size, 0, &sc->sc_sy_memh)) != 0) {
aprint_error_dev(self, "unable to map Sysctl registers, "
- "error=%d\n", error);
+ "error=%d\n", error);
goto fail_0a;
}
if ((error = bus_space_map(sc->sc_memt, RA_FRAME_ENGINE_BASE,
sc->sc_fe_size, 0, &sc->sc_fe_memh)) != 0) {
aprint_error_dev(self, "unable to map Frame Engine registers, "
- "error=%d\n", error);
+ "error=%d\n", error);
goto fail_0b;
}
if ((error = bus_space_map(sc->sc_memt, RA_ETH_SW_BASE,
sc->sc_sw_size, 0, &sc->sc_sw_memh)) != 0) {
aprint_error_dev(self, "unable to map Ether Switch registers, "
- "error=%d\n", error);
+ "error=%d\n", error);
goto fail_0c;
}
@@ -399,29 +400,29 @@
if ((error = bus_dmamem_alloc(sc->sc_dmat, sizeof(struct ralink_descs),
PAGE_SIZE, 0, &sc->sc_dseg, 1, &sc->sc_ndseg, 0)) != 0) {
aprint_error_dev(self, "unable to allocate transmit descs, "
- "error=%d\n", error);
+ "error=%d\n", error);
goto fail_1;
}
if ((error = bus_dmamem_map(sc->sc_dmat, &sc->sc_dseg, sc->sc_ndseg,
- sizeof(struct ralink_descs), (void **)&sc->sc_descs, BUS_DMA_COHERENT))
- != 0) {
+ sizeof(struct ralink_descs), (void **)&sc->sc_descs,
+ BUS_DMA_COHERENT)) != 0) {
aprint_error_dev(self, "unable to map control data, "
- "error=%d\n", error);
+ "error=%d\n", error);
goto fail_2;
}
- if ((error = bus_dmamap_create(sc->sc_dmat, sizeof(struct ralink_descs), 1,
- sizeof(struct ralink_descs), 0, 0, &sc->sc_pdmamap)) != 0) {
+ if ((error = bus_dmamap_create(sc->sc_dmat, sizeof(struct ralink_descs),
+ 1, sizeof(struct ralink_descs), 0, 0, &sc->sc_pdmamap)) != 0) {
aprint_error_dev(self, "unable to create control data DMA map, "
- "error=%d\n", error);
+ "error=%d\n", error);
goto fail_3;
}
if ((error = bus_dmamap_load(sc->sc_dmat, sc->sc_pdmamap, sc->sc_descs,
sizeof(struct ralink_descs), NULL, 0)) != 0) {
aprint_error_dev(self, "unable to load control data DMA map, "
- "error=%d\n", error);
+ "error=%d\n", error);
goto fail_4;
}
@@ -430,8 +431,9 @@
if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES,
RALINK_ETH_MAX_TX_SEGS, MCLBYTES, 0, 0,
&sc->sc_txstate[i].txs_dmamap)) != 0) {
- aprint_error_dev(self, "unable to create tx DMA map %d, "
- "error=%d\n", i, error);
+ aprint_error_dev(self,
+ "unable to create tx DMA map %d, error=%d\n",
+ i, error);
goto fail_5;
}
}
@@ -440,8 +442,9 @@
for (i = 0; i < RALINK_ETH_NUM_RX_DESC; i++) {
if ((error = bus_dmamap_create(sc->sc_dmat, MCLBYTES, 1,
MCLBYTES, 0, 0, &sc->sc_rxstate[i].rxs_dmamap)) != 0) {
- aprint_error_dev(self, "unable to create rx DMA map %d, "
- "error=%d\n", i, error);
+ aprint_error_dev(self,
+ "unable to create rx DMA map %d, error=%d\n",
+ i, error);
goto fail_6;
}
sc->sc_rxstate[i].rxs_mbuf = NULL;
@@ -452,10 +455,10 @@
/* setup some address in hardware */
fe_write(sc, RA_FE_GDMA1_MAC_LSB,
- (enaddr[5] | (enaddr[4] << 8) |
- (enaddr[3] << 16) | (enaddr[2] << 24)));
+ (enaddr[5] | (enaddr[4] << 8) |
+ (enaddr[3] << 16) | (enaddr[2] << 24)));
fe_write(sc, RA_FE_GDMA1_MAC_MSB,
- (enaddr[1] | (enaddr[0] << 8)));
+ (enaddr[1] | (enaddr[0] << 8)));
/*
* iterate through ports
@@ -476,23 +479,23 @@
sc->sc_mii.mii_statchg = ralink_eth_mii_statchg;
sc->sc_ethercom.ec_mii = &sc->sc_mii;
ifmedia_init(&sc->sc_mii.mii_media, 0, ether_mediachange,
- ether_mediastatus);
+ ether_mediastatus);
Home |
Main Index |
Thread Index |
Old Index