1 /******************************************************************************
5 * Copyright(c) 2008 - 2010 Intel Corporation. All rights reserved.
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.
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.
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,
21 * The full GNU General Public License is included in this distribution
22 * in the file called LICENSE.GPL.
24 * Contact Information:
25 * Intel Linux Wireless <ilw@linux.intel.com>
26 * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
28 *****************************************************************************/
30 #include <linux/kernel.h>
31 #include <linux/module.h>
32 #include <linux/init.h>
37 #define IWL_UCODE_GET(item) \
38 static u32 iwlagn_ucode_get_##item(const struct iwl_ucode_header *ucode,\
42 return le32_to_cpu(ucode->u.v1.item); \
43 return le32_to_cpu(ucode->u.v2.item); \
46 static u32
iwlagn_ucode_get_header_size(u32 api_ver
)
49 return UCODE_HEADER_SIZE(1);
50 return UCODE_HEADER_SIZE(2);
53 static u32
iwlagn_ucode_get_build(const struct iwl_ucode_header
*ucode
,
58 return le32_to_cpu(ucode
->u
.v2
.build
);
61 static u8
*iwlagn_ucode_get_data(const struct iwl_ucode_header
*ucode
,
65 return (u8
*) ucode
->u
.v1
.data
;
66 return (u8
*) ucode
->u
.v2
.data
;
69 IWL_UCODE_GET(inst_size
);
70 IWL_UCODE_GET(data_size
);
71 IWL_UCODE_GET(init_size
);
72 IWL_UCODE_GET(init_data_size
);
73 IWL_UCODE_GET(boot_size
);
75 struct 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
,