cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

event.c (2606B)


      1// SPDX-License-Identifier: GPL-2.0-only
      2/*
      3 * This file is part of wl12xx
      4 *
      5 * Copyright (C) 2012 Texas Instruments. All rights reserved.
      6 */
      7
      8#include "event.h"
      9#include "scan.h"
     10#include "../wlcore/cmd.h"
     11#include "../wlcore/debug.h"
     12
     13int wl12xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event,
     14			  bool *timeout)
     15{
     16	u32 local_event;
     17
     18	switch (event) {
     19	case WLCORE_EVENT_ROLE_STOP_COMPLETE:
     20		local_event = ROLE_STOP_COMPLETE_EVENT_ID;
     21		break;
     22
     23	case WLCORE_EVENT_PEER_REMOVE_COMPLETE:
     24		local_event = PEER_REMOVE_COMPLETE_EVENT_ID;
     25		break;
     26
     27	default:
     28		/* event not implemented */
     29		return 0;
     30	}
     31	return wlcore_cmd_wait_for_event_or_timeout(wl, local_event, timeout);
     32}
     33
     34int wl12xx_process_mailbox_events(struct wl1271 *wl)
     35{
     36	struct wl12xx_event_mailbox *mbox = wl->mbox;
     37	u32 vector;
     38
     39
     40	vector = le32_to_cpu(mbox->events_vector);
     41	vector &= ~(le32_to_cpu(mbox->events_mask));
     42
     43	wl1271_debug(DEBUG_EVENT, "MBOX vector: 0x%x", vector);
     44
     45	if (vector & SCAN_COMPLETE_EVENT_ID) {
     46		wl1271_debug(DEBUG_EVENT, "status: 0x%x",
     47			     mbox->scheduled_scan_status);
     48
     49		if (wl->scan_wlvif)
     50			wl12xx_scan_completed(wl, wl->scan_wlvif);
     51	}
     52
     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);
     57
     58		wlcore_scan_sched_scan_results(wl);
     59	}
     60
     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);
     67
     68	if (vector & BSS_LOSE_EVENT_ID)
     69		wlcore_event_beacon_loss(wl, 0xff);
     70
     71	if (vector & RSSI_SNR_TRIGGER_0_EVENT_ID)
     72		wlcore_event_rssi_trigger(wl, mbox->rssi_snr_trigger_metric);
     73
     74	if (vector & BA_SESSION_RX_CONSTRAINT_EVENT_ID)
     75		wlcore_event_ba_rx_constraint(wl,
     76					      BIT(mbox->role_id),
     77					      mbox->rx_ba_allowed);
     78
     79	if (vector & CHANNEL_SWITCH_COMPLETE_EVENT_ID)
     80		wlcore_event_channel_switch(wl, 0xff,
     81					    mbox->channel_switch_status);
     82
     83	if (vector & DUMMY_PACKET_EVENT_ID)
     84		wlcore_event_dummy_packet(wl);
     85
     86	/*
     87	 * "TX retries exceeded" has a different meaning according to mode.
     88	 * In AP mode the offending station is disconnected.
     89	 */
     90	if (vector & MAX_TX_RETRY_EVENT_ID)
     91		wlcore_event_max_tx_failure(wl,
     92				le16_to_cpu(mbox->sta_tx_retry_exceeded));
     93
     94	if (vector & INACTIVE_STA_EVENT_ID)
     95		wlcore_event_inactive_sta(wl,
     96					  le16_to_cpu(mbox->sta_aging_status));
     97
     98	if (vector & REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID)
     99		wlcore_event_roc_complete(wl);
    100
    101	return 0;
    102}