From 23e124c78bcb46ac78d9f06449c4454f43732805 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Thu, 7 Jan 2021 15:52:49 -0700 Subject: [PATCH] pccard: Remove bt3c(4) driver pccard is being removed, so remove bt3c driver since it only has PC Card attachment. Also remove bt3cfw(8) since it's the firmware for this driver. Relnotes: Yes --- ObsoleteFiles.inc | 5 +- share/man/man4/Makefile | 1 - share/man/man4/ng_bt3c.4 | 132 -- sys/conf/NOTES | 1 - sys/conf/files | 1 - sys/modules/netgraph/bluetooth/Makefile | 1 - sys/modules/netgraph/bluetooth/bt3c/Makefile | 12 - .../bluetooth/drivers/bt3c/ng_bt3c_pccard.c | 1227 ----------------- .../bluetooth/drivers/bt3c/ng_bt3c_var.h | 108 -- sys/netgraph/bluetooth/include/ng_bt3c.h | 112 -- usr.sbin/bluetooth/Makefile | 1 - usr.sbin/bluetooth/bt3cfw/Makefile | 11 - usr.sbin/bluetooth/bt3cfw/Makefile.depend | 18 - usr.sbin/bluetooth/bt3cfw/bt3cfw.8 | 73 - usr.sbin/bluetooth/bt3cfw/bt3cfw.c | 230 --- 15 files changed, 4 insertions(+), 1929 deletions(-) delete mode 100644 share/man/man4/ng_bt3c.4 delete mode 100644 sys/modules/netgraph/bluetooth/bt3c/Makefile delete mode 100644 sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c delete mode 100644 sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h delete mode 100644 sys/netgraph/bluetooth/include/ng_bt3c.h delete mode 100644 usr.sbin/bluetooth/bt3cfw/Makefile delete mode 100644 usr.sbin/bluetooth/bt3cfw/Makefile.depend delete mode 100644 usr.sbin/bluetooth/bt3cfw/bt3cfw.8 delete mode 100644 usr.sbin/bluetooth/bt3cfw/bt3cfw.c diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index d5b7e22ab9e2..85d6e3eecd43 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -36,8 +36,11 @@ # xargs -n1 | sort | uniq -d; # done -# 20210108: retire cmx driver +# 20210108: retire cmx, ng_bt3c drivers +OLD_FILES+=usr/sbin/bt3cfw OLD_FILES+=usr/share/man/man4/cmw.4.gz +OLD_FILES+=usr/share/man/man4/ng_bt3c.4.gz +OLD_FILES+=usr/share/man/man8/bt3cfw.8.gz # 20210107: retire a.out support OLD_DIRS+=usr/lib/aout diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index beb5d47c46b2..95f11ed3ca1b 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -337,7 +337,6 @@ MAN= aac.4 \ ng_atmllc.4 \ ng_bpf.4 \ ng_bridge.4 \ - ng_bt3c.4 \ ng_btsocket.4 \ ng_car.4 \ ng_ccatm.4 \ diff --git a/share/man/man4/ng_bt3c.4 b/share/man/man4/ng_bt3c.4 deleted file mode 100644 index d3942ea1d7fc..000000000000 --- a/share/man/man4/ng_bt3c.4 +++ /dev/null @@ -1,132 +0,0 @@ -.\" Copyright (c) 2001-2002 Maksim Yevmenkin -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: ng_bt3c.4,v 1.3 2003/09/14 23:28:51 max Exp $ -.\" $FreeBSD$ -.\" -.Dd December 17, 2004 -.Dt NG_BT3C 4 -.Os -.Sh NAME -.Nm ng_bt3c -.Nd Netgraph node type that is also a 3Com Bluetooth PC card driver -.Sh SYNOPSIS -.In sys/types.h -.In netgraph/bluetooth/include/ng_bt3c.h -.Sh DEPRECATION NOTICE -This driver is scheduled for removal prior to the release of -.Fx 13.0 -.Sh DESCRIPTION -The -.Nm btccc -node type is both a persistent Netgraph node type and a driver for the -3Com Bluetooth PC card (3CRWB6096-HP). -It implements a Bluetooth HCI -UART transport layer as per chapter H4 of the Bluetooth Specification -Book v1.1. -A new node is created when the card is plugged. -.Pp -In order to use the card one -.Em MUST -download the firmware first. -Due to copyright issues the firmware cannot be provided with this driver. -The firmware can be obtained -from the Windows driver package that can be downloaded from the 3Com web -site at no charge. -The firmware name is -.Pa BT3CPCC.BIN . -To load the firmware into the card, use -.Xr bt3cfw 8 . -I am using the original firmware that came with the card on CD-ROM. -.Pp -.Dl "MD5 (BT3CPCC.BIN) = 36170fda56ea9fdbf1702c966f8a97f1" -.Pp -The node has a single hook called -.Dv hook . -Incoming bytes received on the device are re-assembled into HCI frames -(according to the length). -Full HCI frames are sent out on the hook. -HCI frames received on -.Dv hook -are transmitted out. -No modification to the data is performed in either direction. -.Sh HARDWARE -The -.Nm -driver provides support for the 3Com/HP 3CRWB6096-A PCCARD bluetooth adapter. -.Sh HOOKS -This node type supports the following hooks: -.Bl -tag -width ".Va hook" -.It Va hook -single HCI frame contained in single -.Vt mbuf -structure. -.El -.Sh CONTROL MESSAGES -This node type supports the generic control messages, plus the following: -.Bl -tag -width foo -.It Dv NGM_BT3C_NODE_GET_STATE Pq Ic get_state -Returns the current receiving state for the node. -.It Dv NGM_BT3C_NODE_SET_DEBUG Pq Ic set_debug -This command takes an integer argument and sets the current debug level -for the node. -.It Dv NGM_BT3C_NODE_GET_DEBUG Pq Ic get_debug -Returns an integer containing the current debug level for the node. -.It Dv NGM_BT3C_NODE_GET_QLEN Pq Ic get_qlen -This command takes a parameter that specifies queue number and returns -the current length of the queue for the node. -.It Dv NGM_BT3C_NODE_SET_QLEN Pq Ic set_qlen -This command takes two parameters that specify the queue number and -the maximum length of the queue and sets the maximum length of the queue for -the node. -.It Dv NGM_BT3C_NODE_GET_STAT Pq Ic get_stat -Returns various statistic information for the node, such as: number of -bytes (frames) sent, number of bytes (frames) received and number of -input (output) errors. -.It Dv NGM_BT3C_NODE_RESET_STAT Pq Ic reset_stat -Reset all statistic counters to zero. -.It Dv NGM_BT3C_NODE_DOWNLOAD_FIRMWARE -Download card firmware. -.El -.Sh SHUTDOWN -This node shuts down when the corresponding card is un-plugged. -.Sh SEE ALSO -.Xr cardbus 4 , -.Xr netgraph 4 , -.Xr pccbb 4 , -.Xr pcic 4 , -.Xr pccard.conf 5 , -.Xr bt3cfw 8 , -.Xr ngctl 8 -.Sh HISTORY -The -.Nm btccc -node type was implemented in -.Fx 5.0 . -.Sh AUTHORS -.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com -.Sh BUGS -The driver is based on information obtained from -.An Jose Orlando Pereira Aq Mt jop@di.uminho.pt -and disassembled the W2K driver. diff --git a/sys/conf/NOTES b/sys/conf/NOTES index 103b0929a56c..c3a9c097dedb 100644 --- a/sys/conf/NOTES +++ b/sys/conf/NOTES @@ -769,7 +769,6 @@ options NETGRAPH_ASYNC options NETGRAPH_ATMLLC options NETGRAPH_ATM_ATMPIF options NETGRAPH_BLUETOOTH # ng_bluetooth(4) -options NETGRAPH_BLUETOOTH_BT3C # ng_bt3c(4) options NETGRAPH_BLUETOOTH_HCI # ng_hci(4) options NETGRAPH_BLUETOOTH_L2CAP # ng_l2cap(4) options NETGRAPH_BLUETOOTH_SOCKET # ng_btsocket(4) diff --git a/sys/conf/files b/sys/conf/files index d58d2e6c2e0d..370b67709ad6 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4259,7 +4259,6 @@ netgraph/atm/sscop/ng_sscop.c optional ngatm_sscop \ netgraph/atm/uni/ng_uni.c optional ngatm_uni \ compile-with "${NORMAL_C} -I$S/contrib/ngatm" netgraph/bluetooth/common/ng_bluetooth.c optional netgraph_bluetooth -netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c optional netgraph_bluetooth_bt3c netgraph/bluetooth/drivers/h4/ng_h4.c optional netgraph_bluetooth_h4 netgraph/bluetooth/drivers/ubt/ng_ubt.c optional netgraph_bluetooth_ubt usb netgraph/bluetooth/drivers/ubt/ng_ubt_intel.c optional netgraph_bluetooth_ubt usb diff --git a/sys/modules/netgraph/bluetooth/Makefile b/sys/modules/netgraph/bluetooth/Makefile index 9169cf113491..4d353fd94f4b 100644 --- a/sys/modules/netgraph/bluetooth/Makefile +++ b/sys/modules/netgraph/bluetooth/Makefile @@ -6,7 +6,6 @@ SUBDIR= \ hci \ l2cap \ socket \ - bt3c \ ubt \ ubtbcmfw diff --git a/sys/modules/netgraph/bluetooth/bt3c/Makefile b/sys/modules/netgraph/bluetooth/bt3c/Makefile deleted file mode 100644 index 47c4f7a0f140..000000000000 --- a/sys/modules/netgraph/bluetooth/bt3c/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $Id: Makefile,v 1.2 2002/11/24 20:50:56 max Exp $ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/netgraph/bluetooth/drivers/bt3c - -CFLAGS+= -I${SRCTOP}/sys/netgraph/bluetooth/include \ - -I${SRCTOP}/sys/netgraph/bluetooth/drivers/bt3c - -KMOD= ng_bt3c -SRCS= ng_bt3c_pccard.c bus_if.h card_if.h device_if.h pccarddevs.h - -.include diff --git a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c deleted file mode 100644 index c9045e84f256..000000000000 --- a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_pccard.c +++ /dev/null @@ -1,1227 +0,0 @@ -/* - * ng_bt3c_pccard.c - */ - -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001-2002 Maksim Yevmenkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: ng_bt3c_pccard.c,v 1.5 2003/04/01 18:15:21 max Exp $ - * $FreeBSD$ - * - * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX - * - * Based on information obrained from: Jose Orlando Pereira - * and disassembled w2k driver. - * - * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX - * - */ - -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include -#include "pccarddevs.h" - -#include -#include -#include -#include -#include -#include -#include - -/* Netgraph methods */ -static ng_constructor_t ng_bt3c_constructor; -static ng_shutdown_t ng_bt3c_shutdown; -static ng_newhook_t ng_bt3c_newhook; -static ng_connect_t ng_bt3c_connect; -static ng_disconnect_t ng_bt3c_disconnect; -static ng_rcvmsg_t ng_bt3c_rcvmsg; -static ng_rcvdata_t ng_bt3c_rcvdata; - -/* PCMCIA driver methods */ -static int bt3c_pccard_probe (device_t); -static int bt3c_pccard_attach (device_t); -static int bt3c_pccard_detach (device_t); - -static void bt3c_intr (void *); -static void bt3c_receive (bt3c_softc_p); - -static void bt3c_swi_intr (void *); -static void bt3c_forward (node_p, hook_p, void *, int); -static void bt3c_send (node_p, hook_p, void *, int); - -static void bt3c_download_firmware (bt3c_softc_p, char const *, int); - -#define bt3c_set_address(sc, address) \ -do { \ - bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_ADDR_L, ((address) & 0xff)); \ - bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_ADDR_H, (((address) >> 8) & 0xff)); \ -} while (0) - -#define bt3c_read_data(sc, data) \ -do { \ - (data) = bus_space_read_1((sc)->iot, (sc)->ioh, BT3C_DATA_L); \ - (data) |= ((bus_space_read_1((sc)->iot, (sc)->ioh, BT3C_DATA_H) & 0xff) << 8); \ -} while (0) - -#define bt3c_write_data(sc, data) \ -do { \ - bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_DATA_L, ((data) & 0xff)); \ - bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_DATA_H, (((data) >> 8) & 0xff)); \ -} while (0) - -#define bt3c_read_control(sc, data) \ -do { \ - (data) = bus_space_read_1((sc)->iot, (sc)->ioh, BT3C_CONTROL); \ -} while (0) - -#define bt3c_write_control(sc, data) \ -do { \ - bus_space_write_1((sc)->iot, (sc)->ioh, BT3C_CONTROL, (data)); \ -} while (0) - -#define bt3c_read(sc, address, data) \ -do { \ - bt3c_set_address((sc), (address)); \ - bt3c_read_data((sc), (data)); \ -} while(0) - -#define bt3c_write(sc, address, data) \ -do { \ - bt3c_set_address((sc), (address)); \ - bt3c_write_data((sc), (data)); \ -} while(0) - -static MALLOC_DEFINE(M_BT3C, "bt3c", "bt3c data structures"); - -/**************************************************************************** - **************************************************************************** - ** Netgraph specific - **************************************************************************** - ****************************************************************************/ - -/* - * Netgraph node type - */ - -/* Queue length */ -static const struct ng_parse_struct_field ng_bt3c_node_qlen_type_fields[] = -{ - { "queue", &ng_parse_int32_type, }, - { "qlen", &ng_parse_int32_type, }, - { NULL, } -}; -static const struct ng_parse_type ng_bt3c_node_qlen_type = { - &ng_parse_struct_type, - &ng_bt3c_node_qlen_type_fields -}; - -/* Stat info */ -static const struct ng_parse_struct_field ng_bt3c_node_stat_type_fields[] = -{ - { "pckts_recv", &ng_parse_uint32_type, }, - { "bytes_recv", &ng_parse_uint32_type, }, - { "pckts_sent", &ng_parse_uint32_type, }, - { "bytes_sent", &ng_parse_uint32_type, }, - { "oerrors", &ng_parse_uint32_type, }, - { "ierrors", &ng_parse_uint32_type, }, - { NULL, } -}; -static const struct ng_parse_type ng_bt3c_node_stat_type = { - &ng_parse_struct_type, - &ng_bt3c_node_stat_type_fields -}; - -static const struct ng_cmdlist ng_bt3c_cmdlist[] = { -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_GET_STATE, - "get_state", - NULL, - &ng_parse_uint16_type -}, -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_SET_DEBUG, - "set_debug", - &ng_parse_uint16_type, - NULL -}, -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_GET_DEBUG, - "get_debug", - NULL, - &ng_parse_uint16_type -}, -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_GET_QLEN, - "get_qlen", - NULL, - &ng_bt3c_node_qlen_type -}, -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_SET_QLEN, - "set_qlen", - &ng_bt3c_node_qlen_type, - NULL -}, -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_GET_STAT, - "get_stat", - NULL, - &ng_bt3c_node_stat_type -}, -{ - NGM_BT3C_COOKIE, - NGM_BT3C_NODE_RESET_STAT, - "reset_stat", - NULL, - NULL -}, -{ 0, } -}; - -static struct ng_type typestruct = { - .version = NG_ABI_VERSION, - .name = NG_BT3C_NODE_TYPE, - .constructor = ng_bt3c_constructor, - .rcvmsg = ng_bt3c_rcvmsg, - .shutdown = ng_bt3c_shutdown, - .newhook = ng_bt3c_newhook, - .connect = ng_bt3c_connect, - .rcvdata = ng_bt3c_rcvdata, - .disconnect = ng_bt3c_disconnect, - .cmdlist = ng_bt3c_cmdlist -}; - -/* - * Netgraph node constructor. Do not allow to create node of this type. - */ - -static int -ng_bt3c_constructor(node_p node) -{ - return (EINVAL); -} /* ng_bt3c_constructor */ - -/* - * Netgraph node destructor. Destroy node only when device has been detached - */ - -static int -ng_bt3c_shutdown(node_p node) -{ - bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); - - /* Let old node go */ - NG_NODE_SET_PRIVATE(node, NULL); - NG_NODE_UNREF(node); - - /* Create new fresh one if we are not going down */ - if (sc == NULL) - goto out; - - /* Create new Netgraph node */ - if (ng_make_node_common(&typestruct, &sc->node) != 0) { - device_printf(sc->dev, "Could not create Netgraph node\n"); - sc->node = NULL; - goto out; - } - - /* Name new Netgraph node */ - if (ng_name_node(sc->node, device_get_nameunit(sc->dev)) != 0) { - device_printf(sc->dev, "Could not name Netgraph node\n"); - NG_NODE_UNREF(sc->node); - sc->node = NULL; - goto out; - } - - NG_NODE_SET_PRIVATE(sc->node, sc); -out: - return (0); -} /* ng_bt3c_shutdown */ - -/* - * Create new hook. There can only be one. - */ - -static int -ng_bt3c_newhook(node_p node, hook_p hook, char const *name) -{ - bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); - - if (strcmp(name, NG_BT3C_HOOK) != 0) - return (EINVAL); - - if (sc->hook != NULL) - return (EISCONN); - - sc->hook = hook; - - return (0); -} /* ng_bt3c_newhook */ - -/* - * Connect hook. Say YEP, that's OK with me. - */ - -static int -ng_bt3c_connect(hook_p hook) -{ - bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); - - if (hook != sc->hook) { - sc->hook = NULL; - return (EINVAL); - } - - /* set the hook into queueing mode (for incoming (from wire) packets) */ - NG_HOOK_FORCE_QUEUE(NG_HOOK_PEER(hook)); - - return (0); -} /* ng_bt3c_connect */ - -/* - * Disconnect hook - */ - -static int -ng_bt3c_disconnect(hook_p hook) -{ - bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); - - /* - * We need to check for sc != NULL because we can be called from - * bt3c_pccard_detach() via ng_rmnode_self() - */ - - if (sc != NULL) { - if (hook != sc->hook) - return (EINVAL); - - IF_DRAIN(&sc->inq); - IF_DRAIN(&sc->outq); - - sc->hook = NULL; - } - - return (0); -} /* ng_bt3c_disconnect */ - -/* - * Process control message - */ - -static int -ng_bt3c_rcvmsg(node_p node, item_p item, hook_p lasthook) -{ - bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); - struct ng_mesg *msg = NULL, *rsp = NULL; - int error = 0; - - if (sc == NULL) { - NG_FREE_ITEM(item); - return (EHOSTDOWN); - } - - NGI_GET_MSG(item, msg); - - switch (msg->header.typecookie) { - case NGM_GENERIC_COOKIE: - switch (msg->header.cmd) { - case NGM_TEXT_STATUS: - NG_MKRESPONSE(rsp, msg, NG_TEXTRESPONSE, M_NOWAIT); - if (rsp == NULL) - error = ENOMEM; - else - snprintf(rsp->data, NG_TEXTRESPONSE, - "Hook: %s\n" \ - "Flags: %#x\n" \ - "Debug: %d\n" \ - "State: %d\n" \ - "IncmQ: [len:%d,max:%d]\n" \ - "OutgQ: [len:%d,max:%d]\n", - (sc->hook != NULL)? NG_BT3C_HOOK : "", - sc->flags, - sc->debug, - sc->state, - _IF_QLEN(&sc->inq), /* XXX */ - sc->inq.ifq_maxlen, /* XXX */ - _IF_QLEN(&sc->outq), /* XXX */ - sc->outq.ifq_maxlen /* XXX */ - ); - break; - - default: - error = EINVAL; - break; - } - break; - - case NGM_BT3C_COOKIE: - switch (msg->header.cmd) { - case NGM_BT3C_NODE_GET_STATE: - NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_state_ep), - M_NOWAIT); - if (rsp == NULL) - error = ENOMEM; - else - *((ng_bt3c_node_state_ep *)(rsp->data)) = - sc->state; - break; - - case NGM_BT3C_NODE_SET_DEBUG: - if (msg->header.arglen != sizeof(ng_bt3c_node_debug_ep)) - error = EMSGSIZE; - else - sc->debug = - *((ng_bt3c_node_debug_ep *)(msg->data)); - break; - - case NGM_BT3C_NODE_GET_DEBUG: - NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_debug_ep), - M_NOWAIT); - if (rsp == NULL) - error = ENOMEM; - else - *((ng_bt3c_node_debug_ep *)(rsp->data)) = - sc->debug; - break; - - case NGM_BT3C_NODE_GET_QLEN: - NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_qlen_ep), - M_NOWAIT); - if (rsp == NULL) { - error = ENOMEM; - break; - } - - switch (((ng_bt3c_node_qlen_ep *)(msg->data))->queue) { - case NGM_BT3C_NODE_IN_QUEUE: - ((ng_bt3c_node_qlen_ep *)(rsp->data))->queue = - NGM_BT3C_NODE_IN_QUEUE; - ((ng_bt3c_node_qlen_ep *)(rsp->data))->qlen = - sc->inq.ifq_maxlen; - break; - - case NGM_BT3C_NODE_OUT_QUEUE: - ((ng_bt3c_node_qlen_ep *)(rsp->data))->queue = - NGM_BT3C_NODE_OUT_QUEUE; - ((ng_bt3c_node_qlen_ep *)(rsp->data))->qlen = - sc->outq.ifq_maxlen; - break; - - default: - NG_FREE_MSG(rsp); - error = EINVAL; - break; - } - break; - - case NGM_BT3C_NODE_SET_QLEN: - if (msg->header.arglen != sizeof(ng_bt3c_node_qlen_ep)){ - error = EMSGSIZE; - break; - } - - if (((ng_bt3c_node_qlen_ep *)(msg->data))->qlen <= 0) { - error = EINVAL; - break; - } - - switch (((ng_bt3c_node_qlen_ep *)(msg->data))->queue) { - case NGM_BT3C_NODE_IN_QUEUE: - sc->inq.ifq_maxlen = ((ng_bt3c_node_qlen_ep *) - (msg->data))->qlen; /* XXX */ - break; - - case NGM_BT3C_NODE_OUT_QUEUE: - sc->outq.ifq_maxlen = ((ng_bt3c_node_qlen_ep *) - (msg->data))->qlen; /* XXX */ - break; - - default: - error = EINVAL; - break; - } - break; - - case NGM_BT3C_NODE_GET_STAT: - NG_MKRESPONSE(rsp, msg, sizeof(ng_bt3c_node_stat_ep), - M_NOWAIT); - if (rsp == NULL) - error = ENOMEM; - else - bcopy(&sc->stat, rsp->data, - sizeof(ng_bt3c_node_stat_ep)); - break; - - case NGM_BT3C_NODE_RESET_STAT: - NG_BT3C_STAT_RESET(sc->stat); - break; - - case NGM_BT3C_NODE_DOWNLOAD_FIRMWARE: - if (msg->header.arglen < - sizeof(ng_bt3c_firmware_block_ep)) - error = EMSGSIZE; - else - bt3c_download_firmware(sc, msg->data, - msg->header.arglen); - break; - - default: - error = EINVAL; - break; - } - break; - - default: - error = EINVAL; - break; - } - - NG_RESPOND_MSG(error, node, item, rsp); - NG_FREE_MSG(msg); - - return (error); -} /* ng_bt3c_rcvmsg */ - -/* - * Process data - */ - -static int -ng_bt3c_rcvdata(hook_p hook, item_p item) -{ - bt3c_softc_p sc = (bt3c_softc_p)NG_NODE_PRIVATE(NG_HOOK_NODE(hook)); - struct mbuf *m = NULL; - int error = 0; - - if (sc == NULL) { - error = EHOSTDOWN; - goto out; - } - - if (hook != sc->hook) { - error = EINVAL; - goto out; - } - - NGI_GET_M(item, m); - - IF_LOCK(&sc->outq); - if (_IF_QFULL(&sc->outq)) { - NG_BT3C_ERR(sc->dev, -"Outgoing queue is full. Dropping mbuf, len=%d\n", m->m_pkthdr.len); - - NG_BT3C_STAT_OERROR(sc->stat); - - NG_FREE_M(m); - } else - _IF_ENQUEUE(&sc->outq, m); - IF_UNLOCK(&sc->outq); - - error = ng_send_fn(sc->node, NULL, bt3c_send, NULL, 0 /* new send */); -out: - NG_FREE_ITEM(item); - - return (error); -} /* ng_bt3c_rcvdata */ - -/**************************************************************************** - **************************************************************************** - ** PCMCIA driver specific - **************************************************************************** - ****************************************************************************/ - -/* - * PC Card (PCMCIA) probe routine - */ - -static struct pccard_product const bt3c_pccard_products[] = { - PCMCIA_CARD(3COM, 3CRWB609), - { NULL, } -}; - -static int -bt3c_pccard_probe(device_t dev) -{ - struct pccard_product const *pp = NULL; - - pp = pccard_product_lookup(dev, bt3c_pccard_products, - sizeof(bt3c_pccard_products[0]), NULL); - if (pp == NULL) - return (ENXIO); - - device_set_desc(dev, pp->pp_name); - - return (0); -} /* bt3c_pccard_probe */ - -/* - * PC Card (PCMCIA) attach routine - */ - -static int -bt3c_pccard_attach(device_t dev) -{ - bt3c_softc_p sc = (bt3c_softc_p) device_get_softc(dev); - - /* Allocate I/O ports */ - sc->iobase_rid = 0; - sc->iobase = bus_alloc_resource_anywhere(dev, SYS_RES_IOPORT, - &sc->iobase_rid, 8, RF_ACTIVE); - if (sc->iobase == NULL) { - device_printf(dev, "Could not allocate I/O ports\n"); - goto bad; - } - sc->iot = rman_get_bustag(sc->iobase); - sc->ioh = rman_get_bushandle(sc->iobase); - - /* Allocate IRQ */ - sc->irq_rid = 0; - sc->irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid, - RF_ACTIVE); - if (sc->irq == NULL) { - device_printf(dev, "Could not allocate IRQ\n"); - goto bad; - } - - sc->irq_cookie = NULL; - if (bus_setup_intr(dev, sc->irq, INTR_TYPE_TTY, NULL, bt3c_intr, sc, - &sc->irq_cookie) != 0) { - device_printf(dev, "Could not setup ISR\n"); - goto bad; - } - - /* Attach handler to TTY SWI thread */ - sc->ith = NULL; - if (swi_add(&tty_intr_event, device_get_nameunit(dev), - bt3c_swi_intr, sc, SWI_TTY, 0, &sc->ith) < 0) { - device_printf(dev, "Could not setup SWI ISR\n"); - goto bad; - } - - /* Create Netgraph node */ - if (ng_make_node_common(&typestruct, &sc->node) != 0) { - device_printf(dev, "Could not create Netgraph node\n"); - sc->node = NULL; - goto bad; - } - - /* Name Netgraph node */ - if (ng_name_node(sc->node, device_get_nameunit(dev)) != 0) { - device_printf(dev, "Could not name Netgraph node\n"); - NG_NODE_UNREF(sc->node); - sc->node = NULL; - goto bad; - } - - sc->dev = dev; - sc->debug = NG_BT3C_WARN_LEVEL; - - sc->inq.ifq_maxlen = sc->outq.ifq_maxlen = BT3C_DEFAULTQLEN; - mtx_init(&sc->inq.ifq_mtx, "BT3C inq", NULL, MTX_DEF); - mtx_init(&sc->outq.ifq_mtx, "BT3C outq", NULL, MTX_DEF); - - sc->state = NG_BT3C_W4_PKT_IND; - sc->want = 1; - - NG_NODE_SET_PRIVATE(sc->node, sc); - - gone_in_dev(dev, 13, "pccard removed"); - - return (0); -bad: - if (sc->ith != NULL) { - swi_remove(sc->ith); - sc->ith = NULL; - } - - if (sc->irq != NULL) { - if (sc->irq_cookie != NULL) - bus_teardown_intr(dev, sc->irq, sc->irq_cookie); - - bus_release_resource(dev, SYS_RES_IRQ, - sc->irq_rid, sc->irq); - - sc->irq = NULL; - sc->irq_rid = 0; - } - - if (sc->iobase != NULL) { - bus_release_resource(dev, SYS_RES_IOPORT, - sc->iobase_rid, sc->iobase); - - sc->iobase = NULL; - sc->iobase_rid = 0; - } - - return (ENXIO); -} /* bt3c_pccacd_attach */ - -/* - * PC Card (PCMCIA) detach routine - */ - -static int -bt3c_pccard_detach(device_t dev) -{ - bt3c_softc_p sc = (bt3c_softc_p) device_get_softc(dev); - - if (sc == NULL) - return (0); - - swi_remove(sc->ith); - sc->ith = NULL; - - bus_teardown_intr(dev, sc->irq, sc->irq_cookie); - bus_release_resource(dev, SYS_RES_IRQ, sc->irq_rid, sc->irq); - sc->irq_cookie = NULL; - sc->irq = NULL; - sc->irq_rid = 0; - - bus_release_resource(dev, SYS_RES_IOPORT, sc->iobase_rid, sc->iobase); - sc->iobase = NULL; - sc->iobase_rid = 0; - - if (sc->node != NULL) { - NG_NODE_SET_PRIVATE(sc->node, NULL); - ng_rmnode_self(sc->node); - sc->node = NULL; - } - - NG_FREE_M(sc->m); - IF_DRAIN(&sc->inq); - IF_DRAIN(&sc->outq); - - mtx_destroy(&sc->inq.ifq_mtx); - mtx_destroy(&sc->outq.ifq_mtx); - - return (0); -} /* bt3c_pccacd_detach */ - -/* - * Interrupt service routine's - */ - -static void -bt3c_intr(void *context) -{ - bt3c_softc_p sc = (bt3c_softc_p) context; - u_int16_t control, status; - - if (sc == NULL || sc->ith == NULL) { - printf("%s: bogus interrupt\n", NG_BT3C_NODE_TYPE); - return; - } - - bt3c_read_control(sc, control); - if ((control & 0x80) == 0) - return; - - bt3c_read(sc, 0x7001, status); - NG_BT3C_INFO(sc->dev, "control=%#x, status=%#x\n", control, status); - - if ((status & 0xff) == 0x7f || (status & 0xff) == 0xff) { - NG_BT3C_WARN(sc->dev, "Strange status=%#x\n", status); - return; - } - - /* Receive complete */ - if (status & 0x0001) - bt3c_receive(sc); - - /* Record status and schedule SWI */ - sc->status |= status; - swi_sched(sc->ith, 0); - - /* Complete interrupt */ - bt3c_write(sc, 0x7001, 0x0000); - bt3c_write_control(sc, control); -} /* bt3c_intr */ - -/* - * Receive data - */ - -static void -bt3c_receive(bt3c_softc_p sc) -{ - u_int16_t i, count, c; - - /* Receive data from the card */ - bt3c_read(sc, 0x7006, count); - NG_BT3C_INFO(sc->dev, "The card has %d characters\n", count); - - bt3c_set_address(sc, 0x7480); - - for (i = 0; i < count; i++) { - /* Allocate new mbuf if needed */ - if (sc->m == NULL) { - sc->state = NG_BT3C_W4_PKT_IND; - sc->want = 1; - - MGETHDR(sc->m, M_NOWAIT, MT_DATA); - if (sc->m == NULL) { - NG_BT3C_ERR(sc->dev, "Could not get mbuf\n"); - NG_BT3C_STAT_IERROR(sc->stat); - - break; /* XXX lost of sync */ - } - - if (!(MCLGET(sc->m, M_NOWAIT))) { - NG_FREE_M(sc->m); - - NG_BT3C_ERR(sc->dev, "Could not get cluster\n"); - NG_BT3C_STAT_IERROR(sc->stat); - - break; /* XXX lost of sync */ - } - - sc->m->m_len = sc->m->m_pkthdr.len = 0; - } - - /* Read and append character to mbuf */ - bt3c_read_data(sc, c); - if (sc->m->m_pkthdr.len >= MCLBYTES) { - NG_BT3C_ERR(sc->dev, "Oversized frame\n"); - - NG_FREE_M(sc->m); - sc->state = NG_BT3C_W4_PKT_IND; - sc->want = 1; - - break; /* XXX lost of sync */ - } - - mtod(sc->m, u_int8_t *)[sc->m->m_len ++] = (u_int8_t) c; - sc->m->m_pkthdr.len ++; - - NG_BT3C_INFO(sc->dev, -"Got char %#x, want=%d, got=%d\n", c, sc->want, sc->m->m_pkthdr.len); - - if (sc->m->m_pkthdr.len < sc->want) - continue; /* wait for more */ - - switch (sc->state) { - /* Got packet indicator */ - case NG_BT3C_W4_PKT_IND: - NG_BT3C_INFO(sc->dev, -"Got packet indicator %#x\n", *mtod(sc->m, u_int8_t *)); - - sc->state = NG_BT3C_W4_PKT_HDR; - - /* - * Since packet indicator included in the packet - * header just set sc->want to sizeof(packet header). - */ - - switch (*mtod(sc->m, u_int8_t *)) { - case NG_HCI_ACL_DATA_PKT: - sc->want = sizeof(ng_hci_acldata_pkt_t); - break; - - case NG_HCI_SCO_DATA_PKT: - sc->want = sizeof(ng_hci_scodata_pkt_t); - break; - - case NG_HCI_EVENT_PKT: - sc->want = sizeof(ng_hci_event_pkt_t); - break; - - default: - NG_BT3C_ERR(sc->dev, -"Ignoring unknown packet type=%#x\n", *mtod(sc->m, u_int8_t *)); - - NG_BT3C_STAT_IERROR(sc->stat); - - NG_FREE_M(sc->m); - sc->state = NG_BT3C_W4_PKT_IND; - sc->want = 1; - break; - } - break; - - /* Got packet header */ - case NG_BT3C_W4_PKT_HDR: - sc->state = NG_BT3C_W4_PKT_DATA; - - switch (*mtod(sc->m, u_int8_t *)) { - case NG_HCI_ACL_DATA_PKT: - c = le16toh(mtod(sc->m, - ng_hci_acldata_pkt_t *)->length); - break; - - case NG_HCI_SCO_DATA_PKT: - c = mtod(sc->m, ng_hci_scodata_pkt_t*)->length; - break; - - case NG_HCI_EVENT_PKT: - c = mtod(sc->m, ng_hci_event_pkt_t *)->length; - break; - - default: - KASSERT(0, -("Invalid packet type=%#x\n", *mtod(sc->m, u_int8_t *))); - break; - } - - NG_BT3C_INFO(sc->dev, -"Got packet header, packet type=%#x, got so far %d, payload size=%d\n", - *mtod(sc->m, u_int8_t *), sc->m->m_pkthdr.len, - c); - - if (c > 0) { - sc->want += c; - break; - } - - /* else FALLTHROUGH and deliver frame */ - /* XXX is this true? should we deliver empty frame? */ - - /* Got packet data */ - case NG_BT3C_W4_PKT_DATA: - NG_BT3C_INFO(sc->dev, -"Got full packet, packet type=%#x, packet size=%d\n", - *mtod(sc->m, u_int8_t *), sc->m->m_pkthdr.len); - - NG_BT3C_STAT_BYTES_RECV(sc->stat, sc->m->m_pkthdr.len); - NG_BT3C_STAT_PCKTS_RECV(sc->stat); - - IF_LOCK(&sc->inq); - if (_IF_QFULL(&sc->inq)) { - NG_BT3C_ERR(sc->dev, -"Incoming queue is full. Dropping mbuf, len=%d\n", sc->m->m_pkthdr.len); - - NG_BT3C_STAT_IERROR(sc->stat); - - NG_FREE_M(sc->m); - } else { - _IF_ENQUEUE(&sc->inq, sc->m); - sc->m = NULL; - } - IF_UNLOCK(&sc->inq); - - sc->state = NG_BT3C_W4_PKT_IND; - sc->want = 1; - break; - - default: - KASSERT(0, -("Invalid node state=%d", sc->state)); - break; - } - } - - bt3c_write(sc, 0x7006, 0x0000); -} /* bt3c_receive */ - -/* - * SWI interrupt handler - * Netgraph part is handled via ng_send_fn() to avoid race with hook - * connection/disconnection - */ - -static void -bt3c_swi_intr(void *context) -{ - bt3c_softc_p sc = (bt3c_softc_p) context; - u_int16_t data; - - /* Receive complete */ - if (sc->status & 0x0001) { - sc->status &= ~0x0001; /* XXX is it safe? */ - - if (ng_send_fn(sc->node, NULL, &bt3c_forward, NULL, 0) != 0) - NG_BT3C_ALERT(sc->dev, "Could not forward frames!\n"); - } - - /* Send complete */ - if (sc->status & 0x0002) { - sc->status &= ~0x0002; /* XXX is it safe */ - - if (ng_send_fn(sc->node, NULL, &bt3c_send, NULL, 1) != 0) - NG_BT3C_ALERT(sc->dev, "Could not send frames!\n"); - } - - /* Antenna position */ - if (sc->status & 0x0020) { - sc->status &= ~0x0020; /* XXX is it safe */ - - bt3c_read(sc, 0x7002, data); - data &= 0x10; - - if (data) - sc->flags |= BT3C_ANTENNA_OUT; - else - sc->flags &= ~BT3C_ANTENNA_OUT; - - NG_BT3C_INFO(sc->dev, "Antenna %s\n", data? "OUT" : "IN"); - } -} /* bt3c_swi_intr */ - -/* - * Send all incoming frames to the upper layer - */ - -static void -bt3c_forward(node_p node, hook_p hook, void *arg1, int arg2) -{ - bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); - struct mbuf *m = NULL; - int error; - - if (sc == NULL) - return; - - if (sc->hook != NULL && NG_HOOK_IS_VALID(sc->hook)) { - for (;;) { - IF_DEQUEUE(&sc->inq, m); - if (m == NULL) - break; - - NG_SEND_DATA_ONLY(error, sc->hook, m); - if (error != 0) - NG_BT3C_STAT_IERROR(sc->stat); - } - } else { - IF_LOCK(&sc->inq); - for (;;) { - _IF_DEQUEUE(&sc->inq, m); - if (m == NULL) - break; - - NG_BT3C_STAT_IERROR(sc->stat); - NG_FREE_M(m); - } - IF_UNLOCK(&sc->inq); - } -} /* bt3c_forward */ - -/* - * Send more data to the device. Must be called when node is locked - */ - -static void -bt3c_send(node_p node, hook_p hook, void *arg, int completed) -{ - bt3c_softc_p sc = (bt3c_softc_p) NG_NODE_PRIVATE(node); - struct mbuf *m = NULL; - int i, wrote, len; - - if (sc == NULL) - return; - - if (completed) - sc->flags &= ~BT3C_XMIT; - - if (sc->flags & BT3C_XMIT) - return; - - bt3c_set_address(sc, 0x7080); - - for (wrote = 0; wrote < BT3C_FIFO_SIZE; ) { - IF_DEQUEUE(&sc->outq, m); - if (m == NULL) - break; - - while (m != NULL) { - len = min((BT3C_FIFO_SIZE - wrote), m->m_len); - - for (i = 0; i < len; i++) - bt3c_write_data(sc, m->m_data[i]); - - wrote += len; - m->m_data += len; - m->m_len -= len; - - if (m->m_len > 0) - break; - - m = m_free(m); - } - - if (m != NULL) { - IF_PREPEND(&sc->outq, m); - break; - } - - NG_BT3C_STAT_PCKTS_SENT(sc->stat); - } - - if (wrote > 0) { - NG_BT3C_INFO(sc->dev, "Wrote %d bytes\n", wrote); - NG_BT3C_STAT_BYTES_SENT(sc->stat, wrote); - - bt3c_write(sc, 0x7005, wrote); - sc->flags |= BT3C_XMIT; - } -} /* bt3c_send */ - -/* - * Download chip firmware - */ - -static void -bt3c_download_firmware(bt3c_softc_p sc, char const *firmware, int firmware_size) -{ - ng_bt3c_firmware_block_ep const *block = NULL; - u_int16_t const *data = NULL; - int i, size; - u_int8_t c; - - /* Reset */ - device_printf(sc->dev, "Reseting the card...\n"); - bt3c_write(sc, 0x8040, 0x0404); - bt3c_write(sc, 0x8040, 0x0400); - DELAY(1); - - bt3c_write(sc, 0x8040, 0x0404); - DELAY(17); - - /* Download firmware */ - device_printf(sc->dev, "Starting firmware download process...\n"); - - for (size = 0; size < firmware_size; ) { - block = (ng_bt3c_firmware_block_ep const *)(firmware + size); - data = (u_int16_t const *)(block + 1); - - if (bootverbose) - device_printf(sc->dev, "Download firmware block, " \ - "address=%#08x, size=%d words, aligment=%d\n", - block->block_address, block->block_size, - block->block_alignment); - - bt3c_set_address(sc, block->block_address); - for (i = 0; i < block->block_size; i++) - bt3c_write_data(sc, data[i]); - - size += (sizeof(*block) + (block->block_size * 2) + - block->block_alignment); - } - - DELAY(17); - device_printf(sc->dev, "Firmware download process complete\n"); - - /* Boot */ - device_printf(sc->dev, "Starting the card...\n"); - bt3c_set_address(sc, 0x3000); - bt3c_read_control(sc, c); - bt3c_write_control(sc, (c | 0x40)); - DELAY(17); - - /* Clear registers */ - device_printf(sc->dev, "Clearing card registers...\n"); - bt3c_write(sc, 0x7006, 0x0000); - bt3c_write(sc, 0x7005, 0x0000); - bt3c_write(sc, 0x7001, 0x0000); - DELAY(1000); -} /* bt3c_download_firmware */ - -/**************************************************************************** - **************************************************************************** - ** Driver module - **************************************************************************** - ****************************************************************************/ - -/* - * PC Card (PCMCIA) driver - */ - -static device_method_t bt3c_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, bt3c_pccard_probe), - DEVMETHOD(device_attach, bt3c_pccard_attach), - DEVMETHOD(device_detach, bt3c_pccard_detach), - { 0, 0 } -}; - -static driver_t bt3c_pccard_driver = { - NG_BT3C_NODE_TYPE, - bt3c_pccard_methods, - sizeof(bt3c_softc_t) -}; - -static devclass_t bt3c_devclass; - -/* - * Load/Unload the driver module - */ - -static int -bt3c_modevent(module_t mod, int event, void *data) -{ - int error; - - switch (event) { - case MOD_LOAD: - error = ng_newtype(&typestruct); - if (error != 0) - printf("%s: Could not register Netgraph node type, " \ - "error=%d\n", NG_BT3C_NODE_TYPE, error); - break; - - case MOD_UNLOAD: - error = ng_rmtype(&typestruct); - break; - - default: - error = EOPNOTSUPP; - break; - } - - return (error); -} /* bt3c_modevent */ - -DRIVER_MODULE(bt3c, pccard, bt3c_pccard_driver, bt3c_devclass, bt3c_modevent,0); -MODULE_VERSION(ng_bt3c, NG_BLUETOOTH_VERSION); -MODULE_DEPEND(ng_bt3c, netgraph, NG_ABI_VERSION, NG_ABI_VERSION,NG_ABI_VERSION); -PCCARD_PNP_INFO(bt3c_pccard_products); diff --git a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h b/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h deleted file mode 100644 index 9dfd90795ab7..000000000000 --- a/sys/netgraph/bluetooth/drivers/bt3c/ng_bt3c_var.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * ng_bt3c_var.h - */ - -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001-2002 Maksim Yevmenkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: ng_bt3c_var.h,v 1.1 2002/11/24 19:46:54 max Exp $ - * $FreeBSD$ - * - * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX - * - * Based on information obrained from: Jose Orlando Pereira - * and disassembled w2k driver. - * - * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX - * - */ - -#ifndef _NG_BT3C_VAR_H_ -#define _NG_BT3C_VAR_H_ - -/* Debug printf's */ -#define NG_BT3C_ALERT if (sc->debug >= NG_BT3C_ALERT_LEVEL) device_printf -#define NG_BT3C_ERR if (sc->debug >= NG_BT3C_ERR_LEVEL) device_printf -#define NG_BT3C_WARN if (sc->debug >= NG_BT3C_WARN_LEVEL) device_printf -#define NG_BT3C_INFO if (sc->debug >= NG_BT3C_INFO_LEVEL) device_printf - -/* Device registers */ -#define BT3C_DATA_L 0x00 /* data low byte */ -#define BT3C_DATA_H 0x01 /* high byte */ -#define BT3C_ADDR_L 0x02 /* address low byte */ -#define BT3C_ADDR_H 0x03 /* high byte */ -#define BT3C_CONTROL 0x04 /* control */ - -#define BT3C_FIFO_SIZE 256 - -/* Device softc structure */ -struct bt3c_softc { - /* Device specific */ - device_t dev; /* pointer back to device */ - int iobase_rid; /* iobase RID */ - struct resource *iobase; /* iobase */ - bus_space_tag_t iot; /* I/O tag */ - bus_space_handle_t ioh; /* I/O handle */ - int irq_rid; /* irq RID */ - struct resource *irq; /* irq */ - void *irq_cookie; /* irq cookie */ - - /* Netgraph specific */ - node_p node; /* pointer back to node */ - hook_p hook; /* hook */ - - ng_bt3c_node_debug_ep debug; /* debug level */ - u_int16_t flags; /* device flags */ -#define BT3C_ANTENNA_OUT (1 << 0) /* antena is out */ -#define BT3C_XMIT (1 << 1) /* xmit in progress */ - - ng_bt3c_node_state_ep state; /* receiving state */ - - ng_bt3c_node_stat_ep stat; /* statistic */ -#define NG_BT3C_STAT_PCKTS_SENT(s) (s).pckts_sent ++ -#define NG_BT3C_STAT_BYTES_SENT(s, n) (s).bytes_sent += (n) -#define NG_BT3C_STAT_PCKTS_RECV(s) (s).pckts_recv ++ -#define NG_BT3C_STAT_BYTES_RECV(s, n) (s).bytes_recv += (n) -#define NG_BT3C_STAT_OERROR(s) (s).oerrors ++ -#define NG_BT3C_STAT_IERROR(s) (s).ierrors ++ -#define NG_BT3C_STAT_RESET(s) bzero(&(s), sizeof((s))) - - u_int32_t status; /* from ISR */ - void *ith; /* ithread handler */ - - struct mbuf *m; /* current frame */ - u_int32_t want; /* # of chars we want */ - - struct ifqueue inq; /* queue of incoming mbuf's */ - struct ifqueue outq; /* queue of outgoing mbuf's */ -#define BT3C_DEFAULTQLEN 12 /* XXX max. size of out queue */ -}; - -typedef struct bt3c_softc bt3c_softc_t; -typedef struct bt3c_softc * bt3c_softc_p; - -#endif /* ndef _NG_BT3C_VAR_H_ */ diff --git a/sys/netgraph/bluetooth/include/ng_bt3c.h b/sys/netgraph/bluetooth/include/ng_bt3c.h deleted file mode 100644 index 59cc7c7dba84..000000000000 --- a/sys/netgraph/bluetooth/include/ng_bt3c.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * ng_bt3c.h - */ - -/*- - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001-2002 Maksim Yevmenkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: ng_bt3c.h,v 1.1 2002/11/24 19:47:05 max Exp $ - * $FreeBSD$ - * - * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX - * - * Based on information obrained from: Jose Orlando Pereira - * and disassembled w2k driver. - * - * XXX XXX XX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX - * - */ - -#ifndef _NG_BT3C_H_ -#define _NG_BT3C_H_ - -/************************************************************************** - ************************************************************************** - ** Netgraph node hook name, type name and type cookie and commands - ************************************************************************** - **************************************************************************/ - -#define NG_BT3C_NODE_TYPE "btccc" /* XXX can't use bt3c in pccard.conf */ -#define NG_BT3C_HOOK "hook" - -#define NGM_BT3C_COOKIE 1014752016 - -/* Debug levels */ -#define NG_BT3C_ALERT_LEVEL 1 -#define NG_BT3C_ERR_LEVEL 2 -#define NG_BT3C_WARN_LEVEL 3 -#define NG_BT3C_INFO_LEVEL 4 - -/* Node states */ -#define NG_BT3C_W4_PKT_IND 1 /* wait for packet indicator */ -#define NG_BT3C_W4_PKT_HDR 2 /* wait for packet header */ -#define NG_BT3C_W4_PKT_DATA 3 /* wait for packet data */ - -/************************************************************************** - ************************************************************************** - ** BT3C node command/event parameters - ************************************************************************** - **************************************************************************/ - -#define NGM_BT3C_NODE_GET_STATE 1 /* get node state */ -typedef u_int16_t ng_bt3c_node_state_ep; - -#define NGM_BT3C_NODE_SET_DEBUG 2 /* set debug level */ -#define NGM_BT3C_NODE_GET_DEBUG 3 /* get debug level */ -typedef u_int16_t ng_bt3c_node_debug_ep; - -#define NGM_BT3C_NODE_GET_QLEN 4 /* get queue length */ -#define NGM_BT3C_NODE_SET_QLEN 5 /* set queue length */ -typedef struct { - int32_t queue; /* queue index */ -#define NGM_BT3C_NODE_IN_QUEUE 1 /* incoming queue */ -#define NGM_BT3C_NODE_OUT_QUEUE 2 /* outgoing queue */ - - int32_t qlen; /* queue length */ -} ng_bt3c_node_qlen_ep; - -#define NGM_BT3C_NODE_GET_STAT 6 /* get statistic */ -typedef struct { - u_int32_t pckts_recv; /* # of packets received */ - u_int32_t bytes_recv; /* # of bytes received */ - u_int32_t pckts_sent; /* # of packets sent */ - u_int32_t bytes_sent; /* # of bytes sent */ - u_int32_t oerrors; /* # of output errors */ - u_int32_t ierrors; /* # of input errors */ -} ng_bt3c_node_stat_ep; - -#define NGM_BT3C_NODE_RESET_STAT 7 /* reset statistic */ - -#define NGM_BT3C_NODE_DOWNLOAD_FIRMWARE 8 /* download firmware */ - -typedef struct { - u_int32_t block_address; - u_int16_t block_size; /* in words */ - u_int16_t block_alignment; /* in bytes */ -} ng_bt3c_firmware_block_ep; - -#endif /* ndef _NG_BT3C_H_ */ diff --git a/usr.sbin/bluetooth/Makefile b/usr.sbin/bluetooth/Makefile index c380fc77d6ec..5868ffe90747 100644 --- a/usr.sbin/bluetooth/Makefile +++ b/usr.sbin/bluetooth/Makefile @@ -5,7 +5,6 @@ SUBDIR= \ bluetooth-config \ - bt3cfw \ btpand \ hccontrol \ hcsecd \ diff --git a/usr.sbin/bluetooth/bt3cfw/Makefile b/usr.sbin/bluetooth/bt3cfw/Makefile deleted file mode 100644 index f2665b4308f7..000000000000 --- a/usr.sbin/bluetooth/bt3cfw/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $Id: Makefile,v 1.5 2003/08/14 20:06:00 max Exp $ -# $FreeBSD$ - -PACKAGE= bluetooth -PROG= bt3cfw -MAN= bt3cfw.8 -WARNS?= 2 - -LIBADD+= netgraph - -.include diff --git a/usr.sbin/bluetooth/bt3cfw/Makefile.depend b/usr.sbin/bluetooth/bt3cfw/Makefile.depend deleted file mode 100644 index 3f4cb50e1709..000000000000 --- a/usr.sbin/bluetooth/bt3cfw/Makefile.depend +++ /dev/null @@ -1,18 +0,0 @@ -# $FreeBSD$ -# Autogenerated - do NOT edit! - -DIRDEPS = \ - gnu/lib/csu \ - include \ - include/xlocale \ - lib/${CSU_DIR} \ - lib/libc \ - lib/libcompiler_rt \ - lib/libnetgraph \ - - -.include - -.if ${DEP_RELDIR} == ${_DEP_RELDIR} -# local dependencies - needed for -jN in clean tree -.endif diff --git a/usr.sbin/bluetooth/bt3cfw/bt3cfw.8 b/usr.sbin/bluetooth/bt3cfw/bt3cfw.8 deleted file mode 100644 index ec1ef341aea7..000000000000 --- a/usr.sbin/bluetooth/bt3cfw/bt3cfw.8 +++ /dev/null @@ -1,73 +0,0 @@ -.\" Copyright (c) 2001-2002 Maksim Yevmenkin -.\" All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" $Id: bt3cfw.8,v 1.4 2003/05/21 00:34:51 max Exp $ -.\" $FreeBSD$ -.\" -.Dd November 11, 2002 -.Dt BT3CFW 8 -.Os -.Sh NAME -.Nm bt3cfw -.Nd firmware download utility for 3Com Bluetooth PC card driver -.Sh SYNOPSIS -.Nm -.Op Fl h -.Fl f Ar Firmware_file_name -.Fl n Ar Netgraph_node_name -.Sh DESCRIPTION -The -.Nm -utility connects to the specified Netgraph driver node of type -.Dv BTCCC -and downloads the specified firmware file. -.Pp -Due to copyright issues, I will no longer provide firmware with the card -driver. -The firmware can be obtained from the Windows driver package that -can be downloaded from the 3COM web site at no charge. -The firmware name is -.Pa BT3CPCC.BIN . -I am using the original firmware that came with the card on CD-ROM. -.Pp -.Dl "MD5 (BT3CPCC.BIN) = 36170fda56ea9fdbf1702c966f8a97f1" -.Pp -The options are as follows: -.Bl -tag -width indent -.It Fl f Ar Firmware_file_name -Specify firmware file name for download. -.It Fl h -Display usage message and exit. -.It Fl n Ar Netgraph_node_name -Connect to the specified Netgraph driver node of type -.Dv BTCCC . -.El -.Sh EXIT STATUS -.Ex -std -.Sh SEE ALSO -.Xr ng_bt3c 4 -.Sh AUTHORS -.An Maksim Yevmenkin Aq Mt m_evmenkin@yahoo.com -.Sh BUGS -Please report if found. diff --git a/usr.sbin/bluetooth/bt3cfw/bt3cfw.c b/usr.sbin/bluetooth/bt3cfw/bt3cfw.c deleted file mode 100644 index a446b693a642..000000000000 --- a/usr.sbin/bluetooth/bt3cfw/bt3cfw.c +++ /dev/null @@ -1,230 +0,0 @@ -/*- - * bt3cfw.c - * - * SPDX-License-Identifier: BSD-2-Clause-FreeBSD - * - * Copyright (c) 2001 Maksim Yevmenkin - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: bt3cfw.c,v 1.2 2003/05/21 22:40:29 max Exp $ - * $FreeBSD$ - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define BT3CFW_IDENT "bt3cfw" -#define BT3CFW_MAX_FIRMWARE_SIZE 0xffff - -/* Convert hex ASCII to int4 */ -static int -hexa2int4(const char *a) -{ - if ('0' <= *a && *a <= '9') - return (*a - '0'); - - if ('A' <= *a && *a <= 'F') - return (*a - 'A' + 0xa); - - if ('a' <= *a && *a <= 'f') - return (*a - 'a' + 0xa); - - syslog(LOG_ERR, "Invalid hex character: '%c' (%#x)", *a, *a); - exit(255); -} - -/* Convert hex ASCII to int8 */ -static int -hexa2int8(const char *a) -{ - return ((hexa2int4(a) << 4) | hexa2int4(a + 1)); -} - -/* Convert hex ASCII to int16 */ -static int -hexa2int16(const char *a) -{ - return ((hexa2int8(a) << 8) | hexa2int8(a + 2)); -} - -/* Convert hex ASCII to int32 */ -static int -hexa2int32(const char *a) -{ - return ((hexa2int16(a) << 16) | hexa2int16(a + 4)); -} - -/* Display usage() and exit */ -static void -usage(void) -{ - syslog(LOG_ERR, "Usage: %s -f FirmwareFile -n NodeName", BT3CFW_IDENT); - exit(255); -} - -/* Main */ -int -main(int argc, char *argv[]) -{ - FILE *firmware_file = NULL; - char buffer[80], path[NG_PATHSIZ], - *firmware_filename = NULL; - uint8_t *firmware = NULL; - int firmware_size, opt, cs, ds; - - memset(path, 0, sizeof(path)); - openlog(BT3CFW_IDENT, LOG_NDELAY|LOG_PID|LOG_PERROR, LOG_USER); - - while ((opt = getopt(argc, argv, "f:hn:")) != -1) { - switch (opt) { - case 'f': - firmware_filename = optarg; - break; - - case 'n': - snprintf(path, sizeof(path), "%s:", optarg); - break; - - case 'h': - default: - usage(); - /* NOT REACHED */ - } - } - - if (firmware_filename == NULL || path[0] == 0) - usage(); - /* NOT REACHED */ - - firmware = (uint8_t *) calloc(BT3CFW_MAX_FIRMWARE_SIZE, - sizeof(uint8_t)); - if (firmware == NULL) { - syslog(LOG_ERR, "Could not allocate firmware buffer"); - exit(255); - } - - if ((firmware_file = fopen(firmware_filename, "r")) == NULL) { - syslog(LOG_ERR, "Could not open BT3C firmware file %s. %s (%d)", - firmware_filename, strerror(errno), errno); - exit(255); - } - - firmware_size = 0; - - while (fgets(buffer, sizeof(buffer), firmware_file)) { - int i, size, address, cs, fcs; - - size = hexa2int8(buffer + 2); - address = hexa2int32(buffer + 4); - fcs = hexa2int8(buffer + 2 + size * 2); - - if (buffer[1] == '3') { - ng_bt3c_firmware_block_ep *block = NULL; - uint16_t *data = NULL; - - block = (ng_bt3c_firmware_block_ep *) - (firmware + firmware_size); - - firmware_size += sizeof(*block); - if (firmware_size >= BT3CFW_MAX_FIRMWARE_SIZE) { - syslog(LOG_ERR, "Could not add new firmware " \ - "block. Firmware file %s is " \ - "too big, firmware_size=%d", - firmware_filename, - firmware_size); - exit(255); - } - - block->block_address = address; - block->block_size = (size - 4) / 2; - block->block_alignment = (block->block_size * 2) % 3; - if (block->block_alignment != 0) - block->block_alignment = 3 - block->block_alignment; - - firmware_size += (block->block_size * 2); - firmware_size += block->block_alignment; - if (firmware_size >= BT3CFW_MAX_FIRMWARE_SIZE) { - syslog(LOG_ERR, "Could not add new firmware " \ - "data. Firmware file %s is " \ - "too big, firmware_size=%d", - firmware_filename, - firmware_size); - exit(255); - } - - /* First part of the cheksum: size and address */ - cs = 0; - for (i = 0; i < 5; i++) - cs += hexa2int8(buffer + 2 + i * 2); - - /* Data + second part of the cheksum: data */ - data = (uint16_t *)(block + 1); - for (i = 0; i < block->block_size; i++) { - data[i] = hexa2int16(buffer + (i * 4) + 12); - cs += (((data[i] & 0xff00) >> 8) & 0xff); - cs += (data[i] & 0x00ff); - } - } else - for (cs = 0, i = 0; i < size; i++) - cs += hexa2int8(buffer + 2 + i * 2); - - if (((cs + fcs) & 0xff) != 0xff) { - syslog(LOG_ERR, "Invalid firmware file %s. Checksum " \ - "error, cs=%#x, fcs=%#x, checksum=%#x", - firmware_filename, (cs & 0xff), fcs, - ((cs + fcs) & 0xff)); - exit(255); - } - } - - /* Send firmware to the card */ - if (NgMkSockNode(NULL, &cs, &ds) < 0) { - syslog(LOG_ERR, "Could not create Netgraph socket. %s (%d)", - strerror(errno), errno); - exit(255); - } - - if (NgSendMsg(cs, path, NGM_BT3C_COOKIE, - NGM_BT3C_NODE_DOWNLOAD_FIRMWARE, - (void const *) firmware, firmware_size) < 0) { - syslog(LOG_ERR, "Could not send Netgraph message. %s (%d)", - strerror(errno), errno); - exit(255); - } - - free(firmware); - firmware = NULL; - fclose(firmware_file); - - return (0); -} -