iwlwifi: move ucode loading related code to separated file
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-agn-ucode.c
CommitLineData
792bc3cb
WYG
1/******************************************************************************
2 *
3 * GPL LICENSE SUMMARY
4 *
5 * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
19 * USA
20 *
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
23 *
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
27 *
28 *****************************************************************************/
29
30#include <linux/kernel.h>
31#include <linux/module.h>
32#include <linux/init.h>
33
34#include "iwl-dev.h"
35#include "iwl-core.h"
36
37#define IWL_UCODE_GET(item) \
38static u32 iwlagn_ucode_get_##item(const struct iwl_ucode_header *ucode,\
39 u32 api_ver) \
40{ \
41 if (api_ver <= 2) \
42 return le32_to_cpu(ucode->u.v1.item); \
43 return le32_to_cpu(ucode->u.v2.item); \
44}
45
46static u32 iwlagn_ucode_get_header_size(u32 api_ver)
47{
48 if (api_ver <= 2)
49 return UCODE_HEADER_SIZE(1);
50 return UCODE_HEADER_SIZE(2);
51}
52
53static u32 iwlagn_ucode_get_build(const struct iwl_ucode_header *ucode,
54 u32 api_ver)
55{
56 if (api_ver <= 2)
57 return 0;
58 return le32_to_cpu(ucode->u.v2.build);
59}
60
61static u8 *iwlagn_ucode_get_data(const struct iwl_ucode_header *ucode,
62 u32 api_ver)
63{
64 if (api_ver <= 2)
65 return (u8 *) ucode->u.v1.data;
66 return (u8 *) ucode->u.v2.data;
67}
68
69IWL_UCODE_GET(inst_size);
70IWL_UCODE_GET(data_size);
71IWL_UCODE_GET(init_size);
72IWL_UCODE_GET(init_data_size);
73IWL_UCODE_GET(boot_size);
74
75struct iwl_ucode_ops iwlagn_ucode = {
76 .get_header_size = iwlagn_ucode_get_header_size,
77 .get_build = iwlagn_ucode_get_build,
78 .get_inst_size = iwlagn_ucode_get_inst_size,
79 .get_data_size = iwlagn_ucode_get_data_size,
80 .get_init_size = iwlagn_ucode_get_init_size,
81 .get_init_data_size = iwlagn_ucode_get_init_data_size,
82 .get_boot_size = iwlagn_ucode_get_boot_size,
83 .get_data = iwlagn_ucode_get_data,
84};
This page took 0.028917 seconds and 5 git commands to generate.