1288522Sgrehan/*-
2336189Saraujo * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3336189Saraujo *
4288522Sgrehan * Copyright (c) 2015  Peter Grehan <grehan@freebsd.org>
5288522Sgrehan * All rights reserved.
6288522Sgrehan *
7288522Sgrehan * Redistribution and use in source and binary forms, with or without
8288522Sgrehan * modification, are permitted provided that the following conditions
9288522Sgrehan * are met:
10288522Sgrehan * 1. Redistributions of source code must retain the above copyright
11288522Sgrehan *    notice, this list of conditions and the following disclaimer.
12288522Sgrehan * 2. Redistributions in binary form must reproduce the above copyright
13288522Sgrehan *    notice, this list of conditions and the following disclaimer in the
14288522Sgrehan *    documentation and/or other materials provided with the distribution.
15288522Sgrehan *
16288522Sgrehan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
17288522Sgrehan * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18288522Sgrehan * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19288522Sgrehan * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20288522Sgrehan * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21288522Sgrehan * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22288522Sgrehan * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23288522Sgrehan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24288522Sgrehan * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25288522Sgrehan * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26288522Sgrehan * SUCH DAMAGE.
27288522Sgrehan *
28288522Sgrehan * $FreeBSD: stable/11/usr.sbin/bhyve/fwctl.h 336189 2018-07-11 07:16:13Z araujo $
29288522Sgrehan */
30288522Sgrehan
31288522Sgrehan#ifndef _FWCTL_H_
32288522Sgrehan#define _FWCTL_H_
33288522Sgrehan
34288522Sgrehan#include <sys/linker_set.h>
35288522Sgrehan
36288522Sgrehan/*
37288522Sgrehan * Linker set api for export of information to guest firmware via
38288522Sgrehan * a sysctl-like OID interface
39288522Sgrehan */
40288522Sgrehanstruct ctl {
41288522Sgrehan	const char *c_oid;
42288522Sgrehan	const void *c_data;
43288522Sgrehan	const int c_len;
44288522Sgrehan};
45288522Sgrehan
46288522Sgrehan#define CTL_NODE(oid, data, len)				\
47288522Sgrehan	static struct ctl __CONCAT(__ctl, __LINE__) = {		\
48288522Sgrehan		oid,						\
49288522Sgrehan		(data),						\
50288522Sgrehan		(len),						\
51288522Sgrehan	};							\
52288522Sgrehan	DATA_SET(ctl_set, __CONCAT(__ctl, __LINE__))
53288522Sgrehan
54288522Sgrehanvoid	fwctl_init(void);
55288522Sgrehan
56288522Sgrehan#endif /* _FWCTL_H_ */
57