xref: /openbsd/share/man/man9/loadfirmware.9 (revision 73471bf0)
1.\"	$OpenBSD: loadfirmware.9,v 1.4 2013/06/04 19:27:08 schwarze Exp $
2.\"
3.\" Copyright (c) 2004 Theo de Raadt
4.\" All rights reserved.
5.\"
6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\"
18.Dd $Mdocdate: June 4 2013 $
19.Dt LOADFIRMWARE 9
20.Os
21.Sh NAME
22.Nm loadfirmware
23.Nd load a firmware file from the filesystem
24.Sh SYNOPSIS
25.In sys/device.h
26.Ft int
27.Fn loadfirmware "const char *filename" "u_char **buf" "size_t *buflen"
28.Sh DESCRIPTION
29The
30.Fn loadfirmware
31function loads a firmware from the file specified by
32.Ar filename
33in the directory
34.Pa /etc/firmware .
35Memory for the firmware is allocated using
36.Xr malloc 9
37with type
38.Va M_DEVBUF
39as need be, within a reasonable size limit.
40.Pp
41If no longer needed, the firmware buffer
42.Va buf
43can be freed using
44.Xr free 9
45with type
46.Va M_DEVBUF .
47.Sh RETURN VALUES
48If successful,
49.Ar buf
50is set to point to the allocation and
51.Ar buflen
52is set to the size of the firmware.
53Then
54.Fn loadfirmware
55returns 0.
56Otherwise, it returns an
57.Va errno
58style error.
59