Path: blob/main/sys/contrib/dev/broadcom/brcm80211/brcmfmac/firmware.h
178665 views
// SPDX-License-Identifier: ISC1/*2* Copyright (c) 2013 Broadcom Corporation3*/4#ifndef BRCMFMAC_FIRMWARE_H5#define BRCMFMAC_FIRMWARE_H67#define BRCMF_FW_REQF_OPTIONAL 0x000189#define BRCMF_FW_NAME_LEN 3201011#define BRCMF_FW_DEFAULT_PATH "brcm/"1213#define BRCMF_FW_MAX_BOARD_TYPES 81415/**16* struct brcmf_firmware_mapping - Used to map chipid/revmask to firmware17* filename and nvram filename. Each bus type implementation should create18* a table of firmware mappings (using the macros defined below).19*20* @chipid: ID of chip.21* @revmask: bitmask of revisions, e.g. 0x10 means rev 4 only, 0xf means rev 0-322* @fw: name of the firmware file.23* @nvram: name of nvram file.24*/25struct brcmf_firmware_mapping {26u32 chipid;27u32 revmask;28const char *fw_base;29};3031#define BRCMF_FW_DEF(fw_name, fw_base) \32static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \33BRCMF_FW_DEFAULT_PATH fw_base; \34MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw_base ".bin")3536/* Firmware and Country Local Matrix files */37#define BRCMF_FW_CLM_DEF(fw_name, fw_base) \38static const char BRCM_ ## fw_name ## _FIRMWARE_BASENAME[] = \39BRCMF_FW_DEFAULT_PATH fw_base; \40MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw_base ".bin"); \41MODULE_FIRMWARE(BRCMF_FW_DEFAULT_PATH fw_base ".clm_blob")4243#define BRCMF_FW_ENTRY(chipid, mask, name) \44{ chipid, mask, BRCM_ ## name ## _FIRMWARE_BASENAME }4546void brcmf_fw_nvram_free(void *nvram);4748enum brcmf_fw_type {49BRCMF_FW_TYPE_BINARY,50BRCMF_FW_TYPE_NVRAM51};5253struct brcmf_fw_item {54const char *path;55enum brcmf_fw_type type;56u16 flags;57union {58const struct firmware *binary;59struct {60void *data;61u32 len;62} nv_data;63};64};6566struct brcmf_fw_request {67u16 domain_nr;68u16 bus_nr;69u32 n_items;70const char *board_types[BRCMF_FW_MAX_BOARD_TYPES];71struct brcmf_fw_item items[] __counted_by(n_items);72};7374struct brcmf_fw_name {75const char *extension;76char *path;77};7879struct brcmf_fw_request *80brcmf_fw_alloc_request(u32 chip, u32 chiprev,81const struct brcmf_firmware_mapping mapping_table[],82u32 table_size, struct brcmf_fw_name *fwnames,83u32 n_fwnames);8485/*86* Request firmware(s) asynchronously. When the asynchronous request87* fails it will not use the callback, but call device_release_driver()88* instead which will call the driver .remove() callback.89*/90int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req,91void (*fw_cb)(struct device *dev, int err,92struct brcmf_fw_request *req));9394#endif /* BRCMFMAC_FIRMWARE_H */959697