fwctl.h revision 288522
1213238Sgonzo/*-
2213238Sgonzo * Copyright (c) 2015  Peter Grehan <grehan@freebsd.org>
3213238Sgonzo * All rights reserved.
4213238Sgonzo *
5213238Sgonzo * Redistribution and use in source and binary forms, with or without
6213238Sgonzo * modification, are permitted provided that the following conditions
7213238Sgonzo * are met:
8213238Sgonzo * 1. Redistributions of source code must retain the above copyright
9213238Sgonzo *    notice, this list of conditions and the following disclaimer.
10213238Sgonzo * 2. Redistributions in binary form must reproduce the above copyright
11213238Sgonzo *    notice, this list of conditions and the following disclaimer in the
12213238Sgonzo *    documentation and/or other materials provided with the distribution.
13213238Sgonzo *
14213238Sgonzo * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
15213238Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16213238Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17213238Sgonzo * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18213238Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19213238Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20213238Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21213238Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22213238Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23213238Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24213238Sgonzo * SUCH DAMAGE.
25213238Sgonzo *
26213238Sgonzo * $FreeBSD: head/usr.sbin/bhyve/fwctl.h 288522 2015-10-02 21:09:49Z grehan $
27213238Sgonzo */
28213238Sgonzo
29213238Sgonzo#ifndef _FWCTL_H_
30266096Sloos#define _FWCTL_H_
31213238Sgonzo
32213238Sgonzo#include <sys/linker_set.h>
33213238Sgonzo
34213238Sgonzo/*
35213238Sgonzo * Linker set api for export of information to guest firmware via
36213238Sgonzo * a sysctl-like OID interface
37213238Sgonzo */
38233648Seadlerstruct ctl {
39255629Ssbruno	const char *c_oid;
40213238Sgonzo	const void *c_data;
41213238Sgonzo	const int c_len;
42233648Seadler};
43255629Ssbruno
44213238Sgonzo#define CTL_NODE(oid, data, len)				\
45213238Sgonzo	static struct ctl __CONCAT(__ctl, __LINE__) = {		\
46233648Seadler		oid,						\
47255629Ssbruno		(data),						\
48213238Sgonzo		(len),						\
49233648Seadler	};							\
50213238Sgonzo	DATA_SET(ctl_set, __CONCAT(__ctl, __LINE__))
51213238Sgonzo
52255629Ssbrunovoid	fwctl_init(void);
53213238Sgonzo
54213238Sgonzo#endif /* _FWCTL_H_ */
55213238Sgonzo