e500var.h revision 1.6 1 /* $NetBSD: e500var.h,v 1.6 2012/07/27 22:24:13 matt Exp $ */
2 /*-
3 * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
4 * All rights reserved.
5 *
6 * This code is derived from software contributed to The NetBSD Foundation
7 * by Raytheon BBN Technologies Corp and Defense Advanced Research Projects
8 * Agency and which was developed by Matt Thomas of 3am Software Foundry.
9 *
10 * This material is based upon work supported by the Defense Advanced Research
11 * Projects Agency and Space and Naval Warfare Systems Center, Pacific, under
12 * Contract No. N66001-09-C-2073.
13 * Approved for Public Release, Distribution Unlimited
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions
17 * are met:
18 * 1. Redistributions of source code must retain the above copyright
19 * notice, this list of conditions and the following disclaimer.
20 * 2. Redistributions in binary form must reproduce the above copyright
21 * notice, this list of conditions and the following disclaimer in the
22 * documentation and/or other materials provided with the distribution.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
25 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
26 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
28 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
30 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
31 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
32 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
33 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 */
36
37 #ifndef _POWERPC_BOOKE_E500VAR_H_
38 #define _POWERPC_BOOKE_E500VAR_H_
39
40 #ifdef _KERNEL
41
42 #include <sys/device.h>
43 #include <sys/extent.h>
44
45 #ifdef _KERNEL_OPT
46 #include "locators.h"
47 #endif
48
49 #define E500_CLOCK_TIMER 0 /* could be 0..3 */
50
51 extern const struct intrsw e500_intrsw;
52 extern struct extent *pcimem_ex;
53 extern struct extent *pciio_ex;
54 void e500_device_register(device_t, void *);
55 int e500_clock_intr(void *);
56 void e500_cpu_start(void);
57 void e500_tlb_init(vaddr_t, psize_t);
58 void e500_tlb_minimize(vaddr_t);
59 bool e500_device_disabled_p(uint32_t);
60
61 struct e500_truthtab {
62 uint16_t tt_svrhi;
63 uint16_t tt_instance;
64 uint32_t tt_mask;
65 uint32_t tt_value;
66 u_int tt_result;
67 };
68
69 #define TRUTH_ENCODE(svr, inst, mask, value, result) \
70 { \
71 .tt_svrhi = (svr) >> 16, \
72 .tt_instance = (inst), \
73 .tt_mask = (mask), \
74 .tt_value = (value), \
75 .tt_result = (result), \
76 }
77
78 u_int e500_truth_decode(u_int, uint32_t, const struct e500_truthtab *,
79 size_t, u_int);
80 uint16_t e500_get_svr(void);
81 #ifdef _KERNEL_OPT
82 int e500_cpunode_submatch(device_t, cfdata_t, const char *, void *);
83 #endif
84
85 /*
86 * Used by MP hatch code to fetch the TLB1 entries so they be setup on the
87 * just hatched CPU.
88 */
89 void * e500_tlb1_fetch(size_t);
90 void e500_tlb1_sync(void);
91 void e500_ipi_halt(void);
92 void e500_spinup_trampoline(void);
93 void e500_cpu_hatch(struct cpu_info *);
94
95 void pq3gpio_attach(device_t, device_t, void *);
96
97 /*
98 * For a lack of a better place, define this u-boot structure here.
99 */
100
101 struct uboot_spinup_entry {
102 uint32_t entry_addr_upper;
103 uint32_t entry_addr_lower;
104 uint32_t entry_r3_upper;
105 uint32_t entry_r3_lower;
106 uint32_t entry__rsvd;
107 uint32_t entry_pir;
108 uint32_t entry_r6_upper;
109 uint32_t entry_r6_lower;
110 };
111
112 #endif /* _KERNEL */
113
114 #endif /* !_POWERPC_BOOKE_E500VAR_H_ */
115