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.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
30 #include <sys/types.h>
31 #include <sys/sysmacros.h>
33 #include <sys/condvar.h>
37 #include <sys/byteorder.h>
39 #include <libintl.h> /* for gettext(3c) */
40 #include <fwflash/fwflash.h>
42 char vendor
[] = "GENERIC \0";
44 /* MAXIMGSIZE = 1.4 * 1024 * 1024 bytes */
45 /* Currently the largest firmware image size is 1.4 MB */
46 /* 1468006 = 1.4 * 1024 * 1024 */
47 #define MAXIMGSIZE ((unsigned int)(1468006))
49 extern struct vrfyplugin
*verifier
;
51 /* required functions for this plugin */
52 int vendorvrfy(struct devicelist
*devicenode
);
55 * Important information about how this verification plugin works
57 * Direct-attached disks (sd instances) which support firmware
58 * download accept image files up to 1.4 * 1024 * 1024 bytes in
59 * size, and do their own verification of the image, rejecting the
60 * file if it is not appropriate for them.
62 * All that we need to do here is set the various verifier fields
63 * correctly, and check that the filesize as read from the filesystem
64 * is less than 1.4 * 1024 * 1024 bytes.
68 vendorvrfy(struct devicelist
*devicenode
)
70 if (verifier
->imgsize
> MAXIMGSIZE
) {
72 gettext("\nsd-GENERIC firmware image verifier: "
73 "supplied filename %s exceeds maximum allowable "
74 "size of %d bytes\n"),
75 verifier
->imgfile
, MAXIMGSIZE
);
76 return (FWFLASH_FAILURE
);
80 "sd-GENERIC verifier for device\n"
81 "vid %s, pid %s, rev %s\npath %s\n",
82 devicenode
->ident
->vid
,
83 devicenode
->ident
->pid
,
84 devicenode
->ident
->revid
,
85 devicenode
->addresses
[0]);
86 verifier
->flashbuf
= 0;
88 return (FWFLASH_SUCCESS
);