1bf21cd93STycho Nightingale /*- 2*32640292SAndy Fiddaman * SPDX-License-Identifier: BSD-2-Clause 34c87aefeSPatrick Mooney * 4bf21cd93STycho Nightingale * Copyright (c) 2013 Neel Natu <neel@freebsd.org> 5bf21cd93STycho Nightingale * All rights reserved. 6bf21cd93STycho Nightingale * 7bf21cd93STycho Nightingale * Redistribution and use in source and binary forms, with or without 8bf21cd93STycho Nightingale * modification, are permitted provided that the following conditions 9bf21cd93STycho Nightingale * are met: 10bf21cd93STycho Nightingale * 1. Redistributions of source code must retain the above copyright 11bf21cd93STycho Nightingale * notice, this list of conditions and the following disclaimer. 12bf21cd93STycho Nightingale * 2. Redistributions in binary form must reproduce the above copyright 13bf21cd93STycho Nightingale * notice, this list of conditions and the following disclaimer in the 14bf21cd93STycho Nightingale * documentation and/or other materials provided with the distribution. 15bf21cd93STycho Nightingale * 16bf21cd93STycho Nightingale * THIS SOFTWARE IS PROVIDED BY NETAPP, INC ``AS IS'' AND 17bf21cd93STycho Nightingale * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18bf21cd93STycho Nightingale * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19bf21cd93STycho Nightingale * ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE 20bf21cd93STycho Nightingale * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21bf21cd93STycho Nightingale * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22bf21cd93STycho Nightingale * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23bf21cd93STycho Nightingale * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24bf21cd93STycho Nightingale * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25bf21cd93STycho Nightingale * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26bf21cd93STycho Nightingale * SUCH DAMAGE. 27bf21cd93STycho Nightingale */ 28bf21cd93STycho Nightingale 29bf21cd93STycho Nightingale #ifndef _LPC_H_ 30bf21cd93STycho Nightingale #define _LPC_H_ 31bf21cd93STycho Nightingale 32bf21cd93STycho Nightingale #include <sys/linker_set.h> 33bf21cd93STycho Nightingale 34bf21cd93STycho Nightingale typedef void (*lpc_write_dsdt_t)(void); 35bf21cd93STycho Nightingale 36bf21cd93STycho Nightingale struct lpc_dsdt { 37bf21cd93STycho Nightingale lpc_write_dsdt_t handler; 38bf21cd93STycho Nightingale }; 39bf21cd93STycho Nightingale 40bf21cd93STycho Nightingale #define LPC_DSDT(handler) \ 41bf21cd93STycho Nightingale static struct lpc_dsdt __CONCAT(__lpc_dsdt, __LINE__) = { \ 42bf21cd93STycho Nightingale (handler), \ 43bf21cd93STycho Nightingale }; \ 44bf21cd93STycho Nightingale DATA_SET(lpc_dsdt_set, __CONCAT(__lpc_dsdt, __LINE__)) 45bf21cd93STycho Nightingale 46bf21cd93STycho Nightingale enum lpc_sysres_type { 47bf21cd93STycho Nightingale LPC_SYSRES_IO, 48bf21cd93STycho Nightingale LPC_SYSRES_MEM 49bf21cd93STycho Nightingale }; 50bf21cd93STycho Nightingale 51bf21cd93STycho Nightingale struct lpc_sysres { 52bf21cd93STycho Nightingale enum lpc_sysres_type type; 53bf21cd93STycho Nightingale uint32_t base; 54bf21cd93STycho Nightingale uint32_t length; 55bf21cd93STycho Nightingale }; 56bf21cd93STycho Nightingale 57bf21cd93STycho Nightingale #define LPC_SYSRES(type, base, length) \ 58bf21cd93STycho Nightingale static struct lpc_sysres __CONCAT(__lpc_sysres, __LINE__) = { \ 59bf21cd93STycho Nightingale (type), \ 60bf21cd93STycho Nightingale (base), \ 61bf21cd93STycho Nightingale (length) \ 62bf21cd93STycho Nightingale }; \ 63bf21cd93STycho Nightingale DATA_SET(lpc_sysres_set, __CONCAT(__lpc_sysres, __LINE__)) 64bf21cd93STycho Nightingale 65bf21cd93STycho Nightingale #define SYSRES_IO(base, length) LPC_SYSRES(LPC_SYSRES_IO, base, length) 66bf21cd93STycho Nightingale #define SYSRES_MEM(base, length) LPC_SYSRES(LPC_SYSRES_MEM, base, length) 67bf21cd93STycho Nightingale 68bf21cd93STycho Nightingale int lpc_device_parse(const char *opt); 694f3f3e9aSAndy Fiddaman void lpc_print_supported_devices(void); 70bf21cd93STycho Nightingale char *lpc_pirq_name(int pin); 71bf21cd93STycho Nightingale void lpc_pirq_routed(void); 724c87aefeSPatrick Mooney const char *lpc_bootrom(void); 73*32640292SAndy Fiddaman const char *lpc_fwcfg(void); 74bf21cd93STycho Nightingale 75bf21cd93STycho Nightingale #endif 76