// SPDX-License-Identifier: ISC /* * Copyright (c) 2012 Broadcom Corporation */ #include <linux/netdevice.h> #include "brcmu_wifi.h" #include "brcmu_utils.h" #include "cfg80211.h" #include "core.h" #include "debug.h" #include "tracepoint.h" #include "fweh.h" #include "fwil.h" #include "proto.h" #include "bus.h" #include "fwvid.h" /** * struct brcmf_fweh_queue_item - event item on event queue. * * @q: list element for queuing. * @code: event code. * @ifidx: interface index related to this event. * @ifaddr: ethernet address for interface. * @emsg: common parameters of the firmware event message. * @datalen: length of the data array * @data: event specific data part of the firmware event. */ struct brcmf_fweh_queue_item { … }; /* * struct brcmf_fweh_event_name - code, name mapping entry. */ struct brcmf_fweh_event_name { … }; #ifdef DEBUG #define BRCMF_ENUM_DEF … /* array for mapping code to event name */ static struct brcmf_fweh_event_name fweh_event_names[] = …; #undef BRCMF_ENUM_DEF /** * brcmf_fweh_event_name() - returns name for given event code. * * @code: code to lookup. */ const char *brcmf_fweh_event_name(enum brcmf_fweh_event_code code) { … } #else const char *brcmf_fweh_event_name(enum brcmf_fweh_event_code code) { return "nodebug"; } #endif /** * brcmf_fweh_queue_event() - create and queue event. * * @fweh: firmware event handling info. * @event: event queue entry. */ static void brcmf_fweh_queue_event(struct brcmf_fweh_info *fweh, struct brcmf_fweh_queue_item *event) { … } static int brcmf_fweh_call_event_handler(struct brcmf_pub *drvr, struct brcmf_if *ifp, u32 fwcode, struct brcmf_event_msg *emsg, void *data) { … } /** * brcmf_fweh_handle_if_event() - handle IF event. * * @drvr: driver information object. * @emsg: event message object. * @data: event object. */ static void brcmf_fweh_handle_if_event(struct brcmf_pub *drvr, struct brcmf_event_msg *emsg, void *data) { … } static void brcmf_fweh_map_event_code(struct brcmf_fweh_info *fweh, enum brcmf_fweh_event_code code, u32 *fw_code) { … } static void brcmf_fweh_map_fwevt_code(struct brcmf_fweh_info *fweh, u32 fw_code, enum brcmf_fweh_event_code *code) { … } /** * brcmf_fweh_dequeue_event() - get event from the queue. * * @fweh: firmware event handling info. */ static struct brcmf_fweh_queue_item * brcmf_fweh_dequeue_event(struct brcmf_fweh_info *fweh) { … } /** * brcmf_fweh_event_worker() - firmware event worker. * * @work: worker object. */ static void brcmf_fweh_event_worker(struct work_struct *work) { … } /** * brcmf_fweh_p2pdev_setup() - P2P device setup ongoing (or not). * * @ifp: ifp on which setup is taking place or finished. * @ongoing: p2p device setup in progress (or not). */ void brcmf_fweh_p2pdev_setup(struct brcmf_if *ifp, bool ongoing) { … } /** * brcmf_fweh_attach() - initialize firmware event handling. * * @drvr: driver information object. */ int brcmf_fweh_attach(struct brcmf_pub *drvr) { … } /** * brcmf_fweh_detach() - cleanup firmware event handling. * * @drvr: driver information object. */ void brcmf_fweh_detach(struct brcmf_pub *drvr) { … } /** * brcmf_fweh_register() - register handler for given event code. * * @drvr: driver information object. * @code: event code. * @handler: handler for the given event code. */ int brcmf_fweh_register(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code, brcmf_fweh_handler_t handler) { … } /** * brcmf_fweh_unregister() - remove handler for given code. * * @drvr: driver information object. * @code: event code. */ void brcmf_fweh_unregister(struct brcmf_pub *drvr, enum brcmf_fweh_event_code code) { … } /** * brcmf_fweh_activate_events() - enables firmware events registered. * * @ifp: primary interface object. */ int brcmf_fweh_activate_events(struct brcmf_if *ifp) { … } /** * brcmf_fweh_process_event() - process skb as firmware event. * * @drvr: driver information object. * @event_packet: event packet to process. * @packet_len: length of the packet * @gfp: memory allocation flags. * * If the packet buffer contains a firmware event message it will * dispatch the event to a registered handler (using worker). */ void brcmf_fweh_process_event(struct brcmf_pub *drvr, struct brcmf_event *event_packet, u32 packet_len, gfp_t gfp) { … }