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