emlxs_fw.c (291a2b48) emlxs_fw.c (82527734)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 7 unchanged lines hidden (view full) ---

16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2009 Emulex. All rights reserved.
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE

--- 7 unchanged lines hidden (view full) ---

16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright 2009 Emulex. All rights reserved.
24 * Use is subject to License terms.
24 * Use is subject to license terms.
25 */
26
25 */
26
27
27#define EMLXS_FW_TABLE_DEF
28
29#include <sys/types.h>
30#include <sys/modctl.h>
31#include <emlxs_version.h>
32#include <emlxs_fw.h>
33
28#define EMLXS_FW_TABLE_DEF
29
30#include <sys/types.h>
31#include <sys/modctl.h>
32#include <emlxs_version.h>
33#include <emlxs_fw.h>
34
34char emlxs_fw_name[] = EMLXS_FW_NAME;
35emlxs_firmware_t emlxs_fw_mod_table[] = EMLXS_FW_TABLE;
36int emlxs_fw_mod_count = sizeof (emlxs_fw_mod_table) /
37 sizeof (emlxs_firmware_t);
38char emlxs_fw_mod_name[] = EMLXS_FW_NAME;
35
36static struct modlmisc emlxs_modlmisc = {
37 &mod_miscops,
39
40static struct modlmisc emlxs_modlmisc = {
41 &mod_miscops,
38 emlxs_fw_name
42 emlxs_fw_mod_name
39};
40
41static struct modlinkage emlxs_modlinkage = {
42 MODREV_1,
43 (void *)&emlxs_modlmisc,
44 NULL
45};
46
47int
48_init(void)
49{
50 int rval;
51
52 rval = mod_install(&emlxs_modlinkage);
53
54 return (rval);
55
43};
44
45static struct modlinkage emlxs_modlinkage = {
46 MODREV_1,
47 (void *)&emlxs_modlmisc,
48 NULL
49};
50
51int
52_init(void)
53{
54 int rval;
55
56 rval = mod_install(&emlxs_modlinkage);
57
58 return (rval);
59
56} /* _init() */
60} /* _init() */
57
58int
59_fini()
60{
61 int rval;
62
63 rval = mod_remove(&emlxs_modlinkage);
64
65 return (rval);
66
61
62int
63_fini()
64{
65 int rval;
66
67 rval = mod_remove(&emlxs_modlinkage);
68
69 return (rval);
70
67} /* _fini() */
71} /* _fini() */
68
69int
70_info(struct modinfo *modinfop)
71{
72 int rval;
73
74 rval = mod_info(&emlxs_modlinkage, modinfop);
75
76 return (rval);
77
72
73int
74_info(struct modinfo *modinfop)
75{
76 int rval;
77
78 rval = mod_info(&emlxs_modlinkage, modinfop);
79
80 return (rval);
81
78} /* _fini() */
82} /* _fini() */
79
80int
81emlxs_fw_get(emlxs_firmware_t *fw)
82{
83 uint32_t i;
84 emlxs_firmware_t *fw_table;
85
86 /* Find matching firmware table entry */
83
84int
85emlxs_fw_get(emlxs_firmware_t *fw)
86{
87 uint32_t i;
88 emlxs_firmware_t *fw_table;
89
90 /* Find matching firmware table entry */
87 fw_table = emlxs_fw_table;
88 for (i = 0; i < EMLXS_FW_COUNT; i++, fw_table++) {
91 fw_table = emlxs_fw_mod_table;
92 for (i = 0; i < emlxs_fw_mod_count; i++, fw_table++) {
89 /* Validate requested fw image */
90 if ((fw_table->id == fw->id) &&
91 (fw_table->kern == fw->kern) &&
92 (fw_table->stub == fw->stub) &&
93 (fw_table->sli1 == fw->sli1) &&
94 (fw_table->sli2 == fw->sli2) &&
95 (fw_table->sli3 == fw->sli3) &&
96 (fw_table->sli4 == fw->sli4)) {

--- 5 unchanged lines hidden (view full) ---

102 }
103 }
104
105 fw->image = NULL;
106 fw->size = 0;
107
108 return (1);
109
93 /* Validate requested fw image */
94 if ((fw_table->id == fw->id) &&
95 (fw_table->kern == fw->kern) &&
96 (fw_table->stub == fw->stub) &&
97 (fw_table->sli1 == fw->sli1) &&
98 (fw_table->sli2 == fw->sli2) &&
99 (fw_table->sli3 == fw->sli3) &&
100 (fw_table->sli4 == fw->sli4)) {

--- 5 unchanged lines hidden (view full) ---

106 }
107 }
108
109 fw->image = NULL;
110 fw->size = 0;
111
112 return (1);
113
110} /* emlxs_fw_get() */
114} /* emlxs_fw_get() */