1 // SPDX-License-Identifier: GPL-2.0-only
3 * This file is part of wl12xx
5 * Copyright (C) 2012 Texas Instruments. All rights reserved.
10 #include "../wlcore/cmd.h"
11 #include "../wlcore/debug.h"
13 int wl12xx_wait_for_event(struct wl1271
*wl
, enum wlcore_wait_event event
,
19 case WLCORE_EVENT_ROLE_STOP_COMPLETE
:
20 local_event
= ROLE_STOP_COMPLETE_EVENT_ID
;
23 case WLCORE_EVENT_PEER_REMOVE_COMPLETE
:
24 local_event
= PEER_REMOVE_COMPLETE_EVENT_ID
;
28 /* event not implemented */
31 return wlcore_cmd_wait_for_event_or_timeout(wl
, local_event
, timeout
);
34 int wl12xx_process_mailbox_events(struct wl1271
*wl
)
36 struct wl12xx_event_mailbox
*mbox
= wl
->mbox
;
40 vector
= le32_to_cpu(mbox
->events_vector
);
41 vector
&= ~(le32_to_cpu(mbox
->events_mask
));
43 wl1271_debug(DEBUG_EVENT
, "MBOX vector: 0x%x", vector
);
45 if (vector
& SCAN_COMPLETE_EVENT_ID
) {
46 wl1271_debug(DEBUG_EVENT
, "status: 0x%x",
47 mbox
->scheduled_scan_status
);
50 wl12xx_scan_completed(wl
, wl
->scan_wlvif
);
53 if (vector
& PERIODIC_SCAN_REPORT_EVENT_ID
) {
54 wl1271_debug(DEBUG_EVENT
,
55 "PERIODIC_SCAN_REPORT_EVENT (status 0x%0x)",
56 mbox
->scheduled_scan_status
);
58 wlcore_scan_sched_scan_results(wl
);
61 if (vector
& PERIODIC_SCAN_COMPLETE_EVENT_ID
)
62 wlcore_event_sched_scan_completed(wl
,
63 mbox
->scheduled_scan_status
);
64 if (vector
& SOFT_GEMINI_SENSE_EVENT_ID
)
65 wlcore_event_soft_gemini_sense(wl
,
66 mbox
->soft_gemini_sense_info
);
68 if (vector
& BSS_LOSE_EVENT_ID
)
69 wlcore_event_beacon_loss(wl
, 0xff);
71 if (vector
& RSSI_SNR_TRIGGER_0_EVENT_ID
)
72 wlcore_event_rssi_trigger(wl
, mbox
->rssi_snr_trigger_metric
);
74 if (vector
& BA_SESSION_RX_CONSTRAINT_EVENT_ID
)
75 wlcore_event_ba_rx_constraint(wl
,
79 if (vector
& CHANNEL_SWITCH_COMPLETE_EVENT_ID
)
80 wlcore_event_channel_switch(wl
, 0xff,
81 mbox
->channel_switch_status
);
83 if (vector
& DUMMY_PACKET_EVENT_ID
)
84 wlcore_event_dummy_packet(wl
);
87 * "TX retries exceeded" has a different meaning according to mode.
88 * In AP mode the offending station is disconnected.
90 if (vector
& MAX_TX_RETRY_EVENT_ID
)
91 wlcore_event_max_tx_failure(wl
,
92 le16_to_cpu(mbox
->sta_tx_retry_exceeded
));
94 if (vector
& INACTIVE_STA_EVENT_ID
)
95 wlcore_event_inactive_sta(wl
,
96 le16_to_cpu(mbox
->sta_aging_status
));
98 if (vector
& REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID
)
99 wlcore_event_roc_complete(wl
);