1244197Sgonzo/*-
2244197Sgonzo * Copyright (C) 2008-2011 MARVELL INTERNATIONAL LTD.
3244197Sgonzo * All rights reserved.
4244197Sgonzo *
5244197Sgonzo * Developed by Semihalf.
6244197Sgonzo *
7244197Sgonzo * Redistribution and use in source and binary forms, with or without
8244197Sgonzo * modification, are permitted provided that the following conditions
9244197Sgonzo * are met:
10244197Sgonzo * 1. Redistributions of source code must retain the above copyright
11244197Sgonzo *    notice, this list of conditions and the following disclaimer.
12244197Sgonzo * 2. Redistributions in binary form must reproduce the above copyright
13244197Sgonzo *    notice, this list of conditions and the following disclaimer in the
14244197Sgonzo *    documentation and/or other materials provided with the distribution.
15244197Sgonzo * 3. Neither the name of MARVELL nor the names of contributors
16244197Sgonzo *    may be used to endorse or promote products derived from this software
17244197Sgonzo *    without specific prior written permission.
18244197Sgonzo *
19244197Sgonzo * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20244197Sgonzo * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21244197Sgonzo * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22244197Sgonzo * ARE DISCLAIMED.  IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
23244197Sgonzo * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24244197Sgonzo * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25244197Sgonzo * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26244197Sgonzo * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27244197Sgonzo * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28244197Sgonzo * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29244197Sgonzo * SUCH DAMAGE.
30244197Sgonzo */
31244197Sgonzo
32244197Sgonzo#include "opt_global.h"
33244197Sgonzo
34244197Sgonzo#include <sys/cdefs.h>
35244197Sgonzo__FBSDID("$FreeBSD$");
36244197Sgonzo
37244197Sgonzo#include <sys/param.h>
38244197Sgonzo#include <sys/systm.h>
39244197Sgonzo#include <sys/bus.h>
40244197Sgonzo#include <sys/kernel.h>
41244197Sgonzo#include <sys/malloc.h>
42244197Sgonzo#include <sys/kdb.h>
43244197Sgonzo#include <sys/reboot.h>
44244197Sgonzo
45244197Sgonzo#include <dev/fdt/fdt_common.h>
46244197Sgonzo#include <dev/ofw/openfirm.h>
47244197Sgonzo
48244197Sgonzo#include <machine/bus.h>
49244197Sgonzo#include <machine/fdt.h>
50244197Sgonzo#include <machine/vmparam.h>
51244197Sgonzo
52244197Sgonzostruct fdt_fixup_entry fdt_fixup_table[] = {
53244197Sgonzo	{ NULL, NULL }
54244197Sgonzo};
55244197Sgonzo
56244197Sgonzostatic int
57244197Sgonzofdt_intc_decode_ic(phandle_t node, pcell_t *intr, int *interrupt, int *trig,
58244197Sgonzo    int *pol)
59244197Sgonzo{
60244197Sgonzo
61244197Sgonzo	if (!fdt_is_compatible(node, "arm,versatile-vic"))
62244197Sgonzo		return (ENXIO);
63244197Sgonzo
64244197Sgonzo	*interrupt = fdt32_to_cpu(intr[0]);
65244197Sgonzo	*trig = INTR_TRIGGER_CONFORM;
66244197Sgonzo	*pol = INTR_POLARITY_CONFORM;
67244197Sgonzo
68244197Sgonzo	return (0);
69244197Sgonzo}
70244197Sgonzo
71244197Sgonzo
72244197Sgonzofdt_pic_decode_t fdt_pic_table[] = {
73244197Sgonzo	&fdt_intc_decode_ic,
74244197Sgonzo	NULL
75244197Sgonzo};
76