Linux Audio

Check our new training course

Loading...
Note: File does not exist in v4.17.
 1/*
 2 * Linux network driver for Brocade Converged Network Adapter.
 3 *
 4 * This program is free software; you can redistribute it and/or modify it
 5 * under the terms of the GNU General Public License (GPL) Version 2 as
 6 * published by the Free Software Foundation
 7 *
 8 * This program is distributed in the hope that it will be useful, but
 9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 * General Public License for more details.
12 */
13/*
14 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
15 * All rights reserved
16 * www.brocade.com
17 */
18#include <linux/firmware.h>
19#include "cna.h"
20
21const struct firmware *bfi_fw;
22static u32 *bfi_image_ct_cna;
23static u32 bfi_image_ct_cna_size;
24
25static u32 *
26cna_read_firmware(struct pci_dev *pdev, u32 **bfi_image,
27			u32 *bfi_image_size, char *fw_name)
28{
29	const struct firmware *fw;
30
31	if (request_firmware(&fw, fw_name, &pdev->dev)) {
32		pr_alert("Can't locate firmware %s\n", fw_name);
33		goto error;
34	}
35
36	*bfi_image = (u32 *)fw->data;
37	*bfi_image_size = fw->size/sizeof(u32);
38	bfi_fw = fw;
39
40	return *bfi_image;
41error:
42	return NULL;
43}
44
45u32 *
46cna_get_firmware_buf(struct pci_dev *pdev)
47{
48	if (bfi_image_ct_cna_size == 0)
49		cna_read_firmware(pdev, &bfi_image_ct_cna,
50			&bfi_image_ct_cna_size, CNA_FW_FILE_CT);
51	return bfi_image_ct_cna;
52}
53
54u32 *
55bfa_cb_image_get_chunk(int type, u32 off)
56{
57	return (u32 *)(bfi_image_ct_cna + off);
58}
59
60u32
61bfa_cb_image_get_size(int type)
62{
63	return bfi_image_ct_cna_size;
64}