Commit 6bb986e9 authored by Kalle Valo's avatar Kalle Valo
Browse files

Merge tag 'iwlwifi-next-for-kalle-2020-05-29' of...

Merge tag 'iwlwifi-next-for-kalle-2020-05-29' of git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next

Third set of iwlwifi patches intended for v5.8

* Update range request API;
* Add ACPI DSM support;
* Support enabling 5.2GHz bands in Indonesia via ACPI;
* Bump FW API version to 56;
* TX queues refactoring started;
* Fix one memory leak;
* Some other small fixes and clean-ups;

# gpg: Signature made Fri 29 May 2020 10:38:28 AM EEST using RSA key ID 1A3CC5FA
# gpg: Good signature from "Luciano Roth Coelho (Luca) <luca@coelho.fi>"
# gpg:                 aka "Luciano Roth Coelho (Intel) <luciano.coelho@intel.com>"
parents 5cf2740f e6d4318c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@
#include "iwl-prph.h"

/* Highest firmware API version supported */
#define IWL_22000_UCODE_API_MAX	55
#define IWL_22000_UCODE_API_MAX	56

/* Lowest firmware API version supported */
#define IWL_22000_UCODE_API_MIN	39
+88 −11
Original line number Diff line number Diff line
@@ -58,44 +58,121 @@
 *
 *****************************************************************************/

#include <linux/uuid.h>
#include "iwl-drv.h"
#include "iwl-debug.h"
#include "acpi.h"
#include "fw/runtime.h"

void *iwl_acpi_get_object(struct device *dev, acpi_string method)
static const guid_t intel_wifi_guid = GUID_INIT(0xF21202BF, 0x8F78, 0x4DC6,
						0xA5, 0xB3, 0x1F, 0x73,
						0x8E, 0x28, 0x5A, 0xDE);

static int iwl_acpi_get_handle(struct device *dev, acpi_string method,
			       acpi_handle *ret_handle)
{
	acpi_handle root_handle;
	acpi_handle handle;
	struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL};
	acpi_status status;

	root_handle = ACPI_HANDLE(dev);
	if (!root_handle) {
		IWL_DEBUG_DEV_RADIO(dev,
				    "Could not retrieve root port ACPI handle\n");
		return ERR_PTR(-ENOENT);
				    "ACPI: Could not retrieve root port handle\n");
		return -ENOENT;
	}

	/* Get the method's handle */
	status = acpi_get_handle(root_handle, method, &handle);
	status = acpi_get_handle(root_handle, method, ret_handle);
	if (ACPI_FAILURE(status)) {
		IWL_DEBUG_DEV_RADIO(dev, "%s method not found\n", method);
		return ERR_PTR(-ENOENT);
		IWL_DEBUG_DEV_RADIO(dev,
				    "ACPI: %s method not found\n", method);
		return -ENOENT;
	}
	return 0;
}

void *iwl_acpi_get_object(struct device *dev, acpi_string method)
{
	struct acpi_buffer buf = {ACPI_ALLOCATE_BUFFER, NULL};
	acpi_handle handle;
	acpi_status status;
	int ret;

	ret = iwl_acpi_get_handle(dev, method, &handle);
	if (ret)
		return ERR_PTR(-ENOENT);

	/* Call the method with no arguments */
	status = acpi_evaluate_object(handle, NULL, NULL, &buf);
	if (ACPI_FAILURE(status)) {
		IWL_DEBUG_DEV_RADIO(dev, "%s invocation failed (0x%x)\n",
		IWL_DEBUG_DEV_RADIO(dev,
				    "ACPI: %s method invocation failed (status: 0x%x)\n",
				    method, status);
		return ERR_PTR(-ENOENT);
	}

	return buf.pointer;
}
IWL_EXPORT_SYMBOL(iwl_acpi_get_object);

/**
* Generic function for evaluating a method defined in the device specific
* method (DSM) interface. The returned acpi object must be freed by calling
* function.
*/
void *iwl_acpi_get_dsm_object(struct device *dev, int rev, int func,
			      union acpi_object *args)
{
	union acpi_object *obj;

	obj = acpi_evaluate_dsm(ACPI_HANDLE(dev), &intel_wifi_guid, rev, func,
				args);
	if (!obj) {
		IWL_DEBUG_DEV_RADIO(dev,
				    "ACPI: DSM method invocation failed (rev: %d, func:%d)\n",
				    rev, func);
		return ERR_PTR(-ENOENT);
	}
	return obj;
}

/**
 * Evaluate a DSM with no arguments and a single u8 return value (inside a
 * buffer object), verify and return that value.
 */
int iwl_acpi_get_dsm_u8(struct device *dev, int rev, int func)
{
	union acpi_object *obj;
	int ret;

	obj = iwl_acpi_get_dsm_object(dev, rev, func, NULL);
	if (IS_ERR(obj))
		return -ENOENT;

	if (obj->type != ACPI_TYPE_BUFFER) {
		IWL_DEBUG_DEV_RADIO(dev,
				    "ACPI: DSM method did not return a valid object, type=%d\n",
				    obj->type);
		ret = -EINVAL;
		goto out;
	}

	if (obj->buffer.length != sizeof(u8)) {
		IWL_DEBUG_DEV_RADIO(dev,
				    "ACPI: DSM method returned invalid buffer, length=%d\n",
				    obj->buffer.length);
		ret = -EINVAL;
		goto out;
	}

	ret = obj->buffer.pointer[0];
	IWL_DEBUG_DEV_RADIO(dev,
			    "ACPI: DSM method evaluated: func=%d, ret=%d\n",
			    func, ret);
out:
	ACPI_FREE(obj);
	return ret;
}
IWL_EXPORT_SYMBOL(iwl_acpi_get_dsm_u8);

union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
					 union acpi_object *data,
					 int data_size, int *tbl_rev)
+22 −0
Original line number Diff line number Diff line
@@ -127,12 +127,23 @@ struct iwl_geo_profile {
	u8 values[ACPI_GEO_TABLE_SIZE];
};

enum iwl_dsm_funcs_rev_0 {
	DSM_FUNC_QUERY = 0,
	DSM_FUNC_DISABLE_SRD = 1,
	DSM_FUNC_ENABLE_INDONESIA_5G2 = 2,
};

#ifdef CONFIG_ACPI

struct iwl_fw_runtime;

void *iwl_acpi_get_object(struct device *dev, acpi_string method);

void *iwl_acpi_get_dsm_object(struct device *dev, int rev, int func,
			      union acpi_object *args);

int iwl_acpi_get_dsm_u8(struct device *dev, int rev, int func);

union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
					 union acpi_object *data,
					 int data_size, int *tbl_rev);
@@ -192,6 +203,17 @@ static inline void *iwl_acpi_get_object(struct device *dev, acpi_string method)
	return ERR_PTR(-ENOENT);
}

static inline void *iwl_acpi_get_dsm_object(struct device *dev, int rev,
					    int func, union acpi_object *args)
{
	return ERR_PTR(-ENOENT);
}

static inline int iwl_acpi_get_dsm_u8(struct device *dev, int rev, int func)
{
	return -ENOENT;
}

static inline union acpi_object *iwl_acpi_get_wifi_pkg(struct device *dev,
						       union acpi_object *data,
						       int data_size,
+7 −7
Original line number Diff line number Diff line
@@ -550,13 +550,11 @@ struct iwl_tof_range_req_ap_entry_v4 {
/**
 * enum iwl_location_cipher - location cipher selection
 * @IWL_LOCATION_CIPHER_CCMP_128: CCMP 128
 * @IWL_LOCATION_CIPHER_CCMP_256: CCMP 256
 * @IWL_LOCATION_CIPHER_GCMP_128: GCMP 128
 * @IWL_LOCATION_CIPHER_GCMP_256: GCMP 256
 */
enum iwl_location_cipher {
	IWL_LOCATION_CIPHER_CCMP_128,
	IWL_LOCATION_CIPHER_CCMP_256,
	IWL_LOCATION_CIPHER_GCMP_128,
	IWL_LOCATION_CIPHER_GCMP_256,
};
@@ -577,7 +575,8 @@ enum iwl_location_cipher {
 * @samples_per_burst: the number of FTMs pairs in single Burst (1-31);
 * @num_of_bursts: Recommended value to be sent to the AP. 2s Exponent of
 *	the number of measurement iterations (min 2^0 = 1, max 2^14)
 * @reserved: For alignment and future use
 * @sta_id: the station id of the AP. Only relevant when associated to the AP,
 *	otherwise should be set to &IWL_MVM_INVALID_STA.
 * @cipher: pairwise cipher suite for secured measurement.
 *          &enum iwl_location_cipher.
 * @hltk: HLTK to be used for secured 11az measurement
@@ -586,7 +585,8 @@ enum iwl_location_cipher {
 *         If &IWL_INITIATOR_AP_FLAGS_USE_CALIB is set, the fw will use the
 *         calibration value that corresponds to the rx bandwidth of the FTM
 *         frame.
 * @reserved2: For alignment and future use.
 * @beacon_interval: beacon interval of the AP in TUs. Only required if
 *	&IWL_INITIATOR_AP_FLAGS_TB is set.
 */
struct iwl_tof_range_req_ap_entry {
	__le32 initiator_ap_flags;
@@ -598,13 +598,13 @@ struct iwl_tof_range_req_ap_entry {
	__le16 burst_period;
	u8 samples_per_burst;
	u8 num_of_bursts;
	u8 reserved;
	u8 sta_id;
	u8 cipher;
	u8 hltk[HLTK_11AZ_LEN];
	u8 tk[TK_11AZ_LEN];
	__le16 calib[IWL_TOF_BW_NUM];
	__le16 reserved2;
} __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_5 */
	__le16 beacon_interval;
} __packed; /* LOCATION_RANGE_REQ_AP_ENTRY_CMD_API_S_VER_6 */

/**
 * enum iwl_tof_response_mode
+32 −2
Original line number Diff line number Diff line
@@ -8,7 +8,7 @@
 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
 * Copyright(C) 2018 - 2019 Intel Corporation
 * Copyright(C) 2018 - 2020 Intel Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
 * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
 * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
 * Copyright(C) 2018 - 2019 Intel Corporation
 * Copyright(C) 2018 - 2020 Intel Corporation
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
@@ -74,6 +74,11 @@ enum iwl_regulatory_and_nvm_subcmd_ids {
	 */
	NVM_ACCESS_COMPLETE = 0x0,

	/**
	 * @LARI_CONFIG_CHANGE: &struct iwl_lari_config_change_cmd
	 */
	LARI_CONFIG_CHANGE = 0x1,

	/**
	 * @NVM_GET_INFO:
	 * Command is &struct iwl_nvm_get_info,
@@ -446,4 +451,29 @@ struct iwl_tas_config_cmd {
	__le32 black_list_size;
	__le32 black_list_array[IWL_TAS_BLACK_LIST_MAX];
} __packed; /* TAS_CONFIG_CMD_API_S_VER_2 */

/**
 * enum iwl_lari_configs - bit masks for the various LARI config operations
 * @LARI_CONFIG_DISABLE_11AC_UKRAINE_MSK: disable 11ac in ukraine
 * @LARI_CONFIG_CHANGE_ETSI_TO_PASSIVE_MSK: ETSI 5.8GHz SRD passive scan
 * @LARI_CONFIG_CHANGE_ETSI_TO_DISABLED_MSK: ETSI 5.8GHz SRD disabled
 * @LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK: enable 5.15/5.35GHz bands in
 * 	Indonesia
 */
enum iwl_lari_config_masks {
	LARI_CONFIG_DISABLE_11AC_UKRAINE_MSK		= BIT(0),
	LARI_CONFIG_CHANGE_ETSI_TO_PASSIVE_MSK		= BIT(1),
	LARI_CONFIG_CHANGE_ETSI_TO_DISABLED_MSK		= BIT(2),
	LARI_CONFIG_ENABLE_5G2_IN_INDONESIA_MSK		= BIT(3),
};

/**
 * struct iwl_lari_config_change_cmd - change LARI configuration
 * @config_bitmap: bit map of the config commands. each bit will trigger a
 * different predefined FW config operation
 */
struct iwl_lari_config_change_cmd {
	__le32 config_bitmap;
} __packed; /* LARI_CHANGE_CONF_CMD_S_VER_1 */

#endif /* __iwl_fw_api_nvm_reg_h__ */
Loading