15 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
17 #include <linux/types.h>
18 #include <linux/netdevice.h>
19 #include <linux/module.h>
20 #include <linux/hdlc.h>
21 #include <linux/if_arp.h>
23 #include <asm/uaccess.h>
24 #include <linux/rtnetlink.h>
45 #if (__GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 2)
46 #error Sorry, your GCC is too old. It builds incorrect kernels.
49 #if __GNUC__ == 4 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ == 0
50 #warning gcc-4.1.0 is known to miscompile the kernel. A different compiler version is recommended.
55 #ifdef SBE_INCLUDE_SYMBOLS
61 #define CHANNAME "hdlc"
73 #ifdef CONFIG_SBE_PMCC4_NCOMM
94 #if defined(CONFIG_SBE_HDLC_V7) || defined(CONFIG_SBE_WAN256T3_HDLC_V7) || \
95 defined(CONFIG_SBE_HDLC_V7_MODULE) || defined(CONFIG_SBE_WAN256T3_HDLC_V7_MODULE)
102 #define V7(x) (x ## _v7)
104 extern int register_hdlc_device_v7 (
hdlc_device *);
105 extern int unregister_hdlc_device_v7 (
hdlc_device *);
142 return ch ? ch->
user : 0;
192 #ifdef RLD_RESTART_DEBUG
193 pr_info(
">> %s: queueing Port %d Chan %d, mch_t @ %p\n",
234 #ifdef RLD_RESTART_DEBUG
235 pr_info(
">> %s: creating workqueue <%s> for Port %d.\n",
269 #ifdef CONFIG_SBE_PMCC4_NCOMM
271 c4_ebus_interrupt (
int irq,
void *dev_instance)
275 return c4_ebus_intr_th_handler(netdev_priv(ndev));
283 pr_info(
"%s: trying to open master device !\n", ndev->
name);
297 pr_info(
"hdlc_open failure, err %d.\n", ret);
303 netif_start_queue (ndev);
314 netif_stop_queue (ndev);
348 priv = (
struct c4_priv *) dev_to_hdlc (ndev)->priv;
356 nstats = &ndev->
stats;
393 return (
ci_t *)(netdev_priv(ndev));
435 priv = OS_kmalloc (
sizeof (
struct c4_priv));
452 hdlc = dev_to_hdlc (dev);
502 pr_info(
"%s: create_chan[%d] registration error = %d.\n",
521 if (pp.
portnum >= MUSYCC_NPORTS)
523 ci = get_ci_by_dev (ndev);
545 if (pp.
portnum >= MUSYCC_NPORTS)
547 ci = get_ci_by_dev (ndev);
567 ci = get_ci_by_dev (ndev);
583 ci = get_ci_by_dev (ndev);
604 ci = get_ci_by_dev (ndev);
625 ci = get_ci_by_dev (ndev);
663 ci = get_ci_by_dev (ndev);
685 ci = get_ci_by_dev (ndev);
746 priv = (
struct c4_priv *) dev_to_hdlc (ndev)->priv;
793 for (i = 0; i < 128; i++)
801 priv = dev_to_hdlc (ndev)->priv;
803 if ((
unsigned long) (priv->
ci) ==
804 (
unsigned long) (netdev_priv(musycc_dev)))
808 netif_stop_queue (ndev);
857 if (!(ci = get_ci_by_dev (ndev)))
859 if (ci->
state != C_RUNNING)
869 pr_info(
"c4_ioctl: iocmd %x, dir %x type %x nr %x iolen %d.\n", iocmd,
874 data = ifr->ifr_data +
sizeof (iocmd);
943 .ndo_open = void_open,
968 ci = (
ci_t *)(netdev_priv(ndev));
984 #if defined(SBE_ISR_TASKLET)
989 if (
atomic_read (&ci->ci_musycc_isr_tasklet.count) == 0)
990 tasklet_disable_nosync (&ci->ci_musycc_isr_tasklet);
991 #elif defined(SBE_ISR_IMMEDIATE)
993 ci->ci_musycc_isr_tq.data = ci;
1000 OS_kfree (netdev_priv(ndev));
1024 pr_warning(
"%s: MUSYCC could not get irq: %d\n", ndev->
name, irq0);
1026 OS_kfree (netdev_priv(ndev));
1031 #ifdef CONFIG_SBE_PMCC4_NCOMM
1037 OS_kfree (netdev_priv(ndev));
1080 #ifdef CONFIG_PROC_FS
1083 #if defined(SBE_ISR_TASKLET)
1084 tasklet_enable (&ci->ci_musycc_isr_tasklet);
1090 #ifdef CONFIG_PROC_FS
1096 OS_kfree (netdev_priv(ndev));
1114 pr_info(
"NOTE: driver parameter <cxt1e1_log_level> changed from default %d to %d.\n",
1117 pr_info(
"NOTE: driver parameter <cxt1e1_max_mru> changed from default %d to %d.\n",
1120 pr_info(
"NOTE: driver parameter <cxt1e1_max_mtu> changed from default %d to %d.\n",
1126 pr_info(
"NOTE: driver parameter <max_rxdesc_used> changed from default %d to %d.\n",
1133 pr_info(
"NOTE: driver parameter <max_txdesc_used> changed from default %d to %d.\n",
1157 ci = (
ci_t *)(netdev_priv(hi->
ndev));
1176 pr_info(
"SBE - driver removed.\n");
1184 #ifdef MODULE_LICENSE