113240Sprr/*-
213240Sprr * Copyright (c) 2013 Neel Natu <neel@freebsd.org>
313240Sprr * All rights reserved.
413240Sprr *
513240Sprr * Redistribution and use in source and binary forms, with or without
613240Sprr * modification, are permitted provided that the following conditions
713240Sprr * are met:
813240Sprr * 1. Redistributions of source code must retain the above copyright
913240Sprr *    notice, this list of conditions and the following disclaimer.
1013240Sprr * 2. Redistributions in binary form must reproduce the above copyright
1113240Sprr *    notice, this list of conditions and the following disclaimer in the
1213240Sprr *    documentation and/or other materials provided with the distribution.
1313240Sprr *
1413240Sprr * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND
1513240Sprr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1613240Sprr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1713240Sprr * ARE DISCLAIMED.  IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
1813240Sprr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1913240Sprr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2013240Sprr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2113240Sprr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2213240Sprr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2313240Sprr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2413240Sprr * SUCH DAMAGE.
2513240Sprr *
2613240Sprr * $FreeBSD$
2713240Sprr */
2813240Sprr
2913240Sprr#ifndef _LPC_H_
3013240Sprr#define	_LPC_H_
3113240Sprr
3213240Sprr#include <sys/linker_set.h>
3313240Sprr
3413240Sprrtypedef void (*lpc_write_dsdt_t)(void);
3513240Sprr
3613240Sprrstruct lpc_dsdt {
3713240Sprr	lpc_write_dsdt_t handler;
3813240Sprr};
3913240Sprr
4013240Sprr#define	LPC_DSDT(handler)						\
4113240Sprr	static struct lpc_dsdt __CONCAT(__lpc_dsdt, __LINE__) = {	\
4213240Sprr		(handler),						\
4313240Sprr	};								\
4413240Sprr	DATA_SET(lpc_dsdt_set, __CONCAT(__lpc_dsdt, __LINE__))
4513240Sprr
4613240Sprrenum lpc_sysres_type {
4715400Sprr	LPC_SYSRES_IO,
4815400Sprr	LPC_SYSRES_MEM
4915400Sprr};
5015400Sprr
5115400Sprrstruct lpc_sysres {
5215400Sprr	enum lpc_sysres_type type;
5315400Sprr	uint32_t base;
5415400Sprr	uint32_t length;
5515400Sprr};
5615400Sprr
5713240Sprr#define	LPC_SYSRES(type, base, length)					\
5813240Sprr	static struct lpc_sysres __CONCAT(__lpc_sysres, __LINE__) = {	\
5913240Sprr		(type),							\
6013240Sprr		(base),							\
6113240Sprr		(length)						\
62	};								\
63	DATA_SET(lpc_sysres_set, __CONCAT(__lpc_sysres, __LINE__))
64
65#define	SYSRES_IO(base, length)		LPC_SYSRES(LPC_SYSRES_IO, base, length)
66#define	SYSRES_MEM(base, length)	LPC_SYSRES(LPC_SYSRES_MEM, base, length)
67
68int	lpc_device_parse(const char *opt);
69char	*lpc_pirq_name(int pin);
70void	lpc_pirq_routed(void);
71const char *lpc_bootrom(void);
72
73#endif
74