md_var.h revision 268200
1/*-
2 * Copyright (c) 1998 Doug Rabson
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: stable/10/sys/ia64/include/md_var.h 268200 2014-07-02 23:47:43Z marcel $
27 */
28
29#ifndef _MACHINE_MD_VAR_H_
30#define	_MACHINE_MD_VAR_H_
31
32/*
33 * Miscellaneous machine-dependent declarations.
34 */
35
36struct ia64_fdesc {
37	uint64_t	func;
38	uint64_t	gp;
39};
40
41#define FDESC_FUNC(fn)  (((struct ia64_fdesc *) fn)->func)
42#define FDESC_GP(fn)    (((struct ia64_fdesc *) fn)->gp)
43
44/* Convenience macros to decompose CFM & ar.pfs. */
45#define	IA64_CFM_SOF(x)		((x) & 0x7f)
46#define	IA64_CFM_SOL(x)		(((x) >> 7) & 0x7f)
47#define	IA64_CFM_SOR(x)		(((x) >> 14) & 0x0f)
48#define	IA64_CFM_RRB_GR(x)	(((x) >> 18) & 0x7f)
49#define	IA64_CFM_RRB_FR(x)	(((x) >> 25) & 0x7f)
50#define	IA64_CFM_RRB_PR(x)	(((x) >> 32) & 0x3f)
51
52/* Convenience function (inline) to adjust backingstore pointers. */
53static __inline uint64_t
54ia64_bsp_adjust(uint64_t bsp, int nslots)
55{
56	int bias = ((unsigned int)bsp & 0x1f8) >> 3;
57	nslots += (nslots + bias + 63*8) / 63 - 8;
58	return bsp + (nslots << 3);
59}
60
61#ifdef _KERNEL
62
63struct _special;
64struct pcpu;
65struct thread;
66struct trapframe;
67
68/*
69 * Return value from ia64_init. Describes stack to switch to.
70 */
71struct ia64_init_return {
72	uint64_t	bspstore;
73	uint64_t	sp;
74};
75
76extern uint64_t ia64_lapic_addr;
77extern vm_paddr_t paddr_max;
78extern u_int busdma_swi_pending;
79
80void	*acpi_find_table(const char *sig);
81void	busdma_swi(void);
82int	copyout_regstack(struct thread *, uint64_t *, uint64_t *);
83void	cpu_mp_add(u_int, u_int, u_int);
84void	cpu_pcpu_setup(struct pcpu *, u_int, u_int);
85int	do_ast(struct trapframe *);
86void	ia32_trap(int, struct trapframe *);
87int	ia64_count_cpus(void);
88int	ia64_emulate(struct trapframe *, struct thread *);
89int	ia64_flush_dirty(struct thread *, struct _special *);
90uint64_t ia64_get_hcdp(void);
91int	ia64_highfp_drop(struct thread *);
92int	ia64_highfp_enable(struct thread *, struct trapframe *);
93int	ia64_highfp_save(struct thread *);
94int	ia64_highfp_save_ipi(void);
95struct ia64_init_return ia64_init(void);
96u_int	ia64_itc_freq(void);
97int	ia64_physmem_add(vm_paddr_t, vm_size_t);
98void	*ia64_physmem_alloc(vm_size_t, vm_size_t);
99int	ia64_physmem_delete(vm_paddr_t, vm_size_t);
100int	ia64_physmem_fini(void);
101int	ia64_physmem_init(void);
102int	ia64_physmem_track(vm_paddr_t, vm_size_t);
103void	ia64_probe_sapics(void);
104void	ia64_sync_icache(vm_offset_t, vm_size_t);
105void	*ia64_xtrace_alloc(void);
106void	ia64_xtrace_init_ap(void *);
107void	ia64_xtrace_init_bsp(void);
108void	ia64_xtrace_save(void);
109void	ia64_xtrace_stop(void);
110void	interrupt(struct trapframe *);
111void	map_gateway_page(void);
112void	map_pal_code(void);
113void	map_vhpt(uintptr_t);
114void	os_boot_rendez(void);
115void	os_mca(void);
116int	syscall(struct trapframe *);
117void	trap(int, struct trapframe *);
118void	trap_panic(int, struct trapframe *);
119int	unaligned_fixup(struct trapframe *, struct thread *);
120
121#endif	/* _KERNEL */
122
123#endif /* !_MACHINE_MD_VAR_H_ */
124