1202097Smarcel/*-
2202097Smarcel * Copyright (c) 2010 Marcel Moolenaar
3202097Smarcel * All rights reserved.
4202097Smarcel *
5202097Smarcel * Redistribution and use in source and binary forms, with or without
6202097Smarcel * modification, are permitted provided that the following conditions
7202097Smarcel * are met:
8202097Smarcel * 1. Redistributions of source code must retain the above copyright
9202097Smarcel *    notice, this list of conditions and the following disclaimer.
10202097Smarcel * 2. Redistributions in binary form must reproduce the above copyright
11202097Smarcel *    notice, this list of conditions and the following disclaimer in the
12202097Smarcel *    documentation and/or other materials provided with the distribution.
13202097Smarcel *
14202097Smarcel * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15202097Smarcel * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16202097Smarcel * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17202097Smarcel * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18202097Smarcel * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19202097Smarcel * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20202097Smarcel * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21202097Smarcel * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22202097Smarcel * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23202097Smarcel * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24202097Smarcel * SUCH DAMAGE.
25202097Smarcel *
26202097Smarcel * $FreeBSD$
27202097Smarcel */
28202097Smarcel
29202097Smarcel#ifndef _MACHINE_IODEV_H_
30202097Smarcel#define	_MACHINE_IODEV_H_
31202097Smarcel
32202273Smarcel#include <sys/uuid.h>
33202273Smarcel
34207329Sattilio#ifdef _KERNEL
35207329Sattilio#include <machine/bus.h>
36207329Sattilio#endif
37202097Smarcel
38207329Sattilio#define	IODEV_EFIVAR_GETVAR	0
39207329Sattilio#define	IODEV_EFIVAR_NEXTNAME	1
40207329Sattilio#define	IODEV_EFIVAR_SETVAR	2
41202097Smarcel
42202273Smarcelstruct iodev_efivar_req {
43202273Smarcel	u_int	access;
44202273Smarcel	u_int	result;			/* errno value */
45202273Smarcel	size_t	namesize;
46202273Smarcel	u_short	*name;			/* UCS-2 */
47202273Smarcel	struct uuid vendor;
48202273Smarcel	uint32_t attrib;
49202273Smarcel	size_t	datasize;
50202273Smarcel	void	*data;
51202273Smarcel};
52202273Smarcel
53202273Smarcel#define	IODEV_EFIVAR	_IOWR('I', 1, struct iodev_efivar_req)
54202273Smarcel
55202097Smarcel#ifdef _KERNEL
56207329Sattilio#define	iodev_read_1	bus_space_read_io_1
57207329Sattilio#define	iodev_read_2	bus_space_read_io_2
58207329Sattilio#define	iodev_read_4	bus_space_read_io_4
59207329Sattilio#define	iodev_write_1	bus_space_write_io_1
60207329Sattilio#define	iodev_write_2	bus_space_write_io_2
61207329Sattilio#define	iodev_write_4	bus_space_write_io_4
62202097Smarcel
63207329Sattilioint	 iodev_open(struct thread *td);
64207329Sattilioint	 iodev_close(struct thread *td);
65207329Sattilioint	 iodev_ioctl(u_long, caddr_t data);
66202097Smarcel
67207329Sattilio#endif /* _KERNEL */
68202097Smarcel#endif /* _MACHINE_IODEV_H_ */
69