md_var.h revision 310508
1251843Sbapt/*-
2251843Sbapt * Copyright (c) 1998 Doug Rabson
3217309Snwhitehorn * All rights reserved.
4217309Snwhitehorn *
5217309Snwhitehorn * Redistribution and use in source and binary forms, with or without
6217309Snwhitehorn * modification, are permitted provided that the following conditions
7217309Snwhitehorn * are met:
8217309Snwhitehorn * 1. Redistributions of source code must retain the above copyright
9217309Snwhitehorn *    notice, this list of conditions and the following disclaimer.
10217309Snwhitehorn * 2. Redistributions in binary form must reproduce the above copyright
11217309Snwhitehorn *    notice, this list of conditions and the following disclaimer in the
12217309Snwhitehorn *    documentation and/or other materials provided with the distribution.
13217309Snwhitehorn *
14217309Snwhitehorn * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15217309Snwhitehorn * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16217309Snwhitehorn * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17217309Snwhitehorn * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18217309Snwhitehorn * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19217309Snwhitehorn * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20217309Snwhitehorn * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21217309Snwhitehorn * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22217309Snwhitehorn * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23217309Snwhitehorn * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24217309Snwhitehorn * SUCH DAMAGE.
25217309Snwhitehorn *
26217309Snwhitehorn * $FreeBSD: stable/10/sys/ia64/include/md_var.h 310508 2016-12-24 13:28:39Z avg $
27217309Snwhitehorn */
28217309Snwhitehorn
29217309Snwhitehorn#ifndef _MACHINE_MD_VAR_H_
30217309Snwhitehorn#define	_MACHINE_MD_VAR_H_
31217309Snwhitehorn
32217309Snwhitehorn/*
33217309Snwhitehorn * Miscellaneous machine-dependent declarations.
34217309Snwhitehorn */
35217309Snwhitehorn
36217309Snwhitehornstruct ia64_fdesc {
37217309Snwhitehorn	uint64_t	func;
38217309Snwhitehorn	uint64_t	gp;
39217309Snwhitehorn};
40217309Snwhitehorn
41217309Snwhitehorn#define FDESC_FUNC(fn)  (((struct ia64_fdesc *) fn)->func)
42217309Snwhitehorn#define FDESC_GP(fn)    (((struct ia64_fdesc *) fn)->gp)
43217309Snwhitehorn
44217309Snwhitehorn/* Convenience macros to decompose CFM & ar.pfs. */
45217309Snwhitehorn#define	IA64_CFM_SOF(x)		((x) & 0x7f)
46217309Snwhitehorn#define	IA64_CFM_SOL(x)		(((x) >> 7) & 0x7f)
47217309Snwhitehorn#define	IA64_CFM_SOR(x)		(((x) >> 14) & 0x0f)
48217309Snwhitehorn#define	IA64_CFM_RRB_GR(x)	(((x) >> 18) & 0x7f)
49217309Snwhitehorn#define	IA64_CFM_RRB_FR(x)	(((x) >> 25) & 0x7f)
50217309Snwhitehorn#define	IA64_CFM_RRB_PR(x)	(((x) >> 32) & 0x3f)
51217309Snwhitehorn
52217309Snwhitehorn/* Convenience function (inline) to adjust backingstore pointers. */
53217309Snwhitehornstatic __inline uint64_t
54217309Snwhitehornia64_bsp_adjust(uint64_t bsp, int nslots)
55217309Snwhitehorn{
56217309Snwhitehorn	int bias = ((unsigned int)bsp & 0x1f8) >> 3;
57217309Snwhitehorn	nslots += (nslots + bias + 63*8) / 63 - 8;
58217309Snwhitehorn	return bsp + (nslots << 3);
59217309Snwhitehorn}
60217309Snwhitehorn
61217309Snwhitehorn#ifdef _KERNEL
62217309Snwhitehorn
63217309Snwhitehornstruct _special;
64217309Snwhitehornstruct pcpu;
65217309Snwhitehornstruct thread;
66217309Snwhitehornstruct trapframe;
67217309Snwhitehorn
68217309Snwhitehorn/*
69217309Snwhitehorn * Return value from ia64_init. Describes stack to switch to.
70217309Snwhitehorn */
71217309Snwhitehornstruct ia64_init_return {
72217309Snwhitehorn	uint64_t	bspstore;
73217309Snwhitehorn	uint64_t	sp;
74217309Snwhitehorn};
75217309Snwhitehorn
76217309Snwhitehornextern uint64_t ia64_lapic_addr;
77217309Snwhitehornextern vm_paddr_t paddr_max;
78217309Snwhitehornextern long Maxmem;
79217309Snwhitehornextern u_int busdma_swi_pending;
80217309Snwhitehorn
81217309Snwhitehornvoid	*acpi_find_table(const char *sig);
82217309Snwhitehornvoid	busdma_swi(void);
83217309Snwhitehornint	copyout_regstack(struct thread *, uint64_t *, uint64_t *);
84217309Snwhitehornvoid	cpu_mp_add(u_int, u_int, u_int);
85217309Snwhitehornvoid	cpu_pcpu_setup(struct pcpu *, u_int, u_int);
86217309Snwhitehornint	do_ast(struct trapframe *);
87217309Snwhitehornvoid	ia32_trap(int, struct trapframe *);
88217309Snwhitehornint	ia64_count_cpus(void);
89217309Snwhitehornint	ia64_emulate(struct trapframe *, struct thread *);
90217309Snwhitehornint	ia64_flush_dirty(struct thread *, struct _special *);
91217309Snwhitehornuint64_t ia64_get_hcdp(void);
92217309Snwhitehornint	ia64_highfp_drop(struct thread *);
93217309Snwhitehornint	ia64_highfp_enable(struct thread *, struct trapframe *);
94217309Snwhitehornint	ia64_highfp_save(struct thread *);
95217309Snwhitehornint	ia64_highfp_save_ipi(void);
96217309Snwhitehornstruct ia64_init_return ia64_init(void);
97217309Snwhitehornu_int	ia64_itc_freq(void);
98217309Snwhitehornint	ia64_physmem_add(vm_paddr_t, vm_size_t);
99217309Snwhitehornvoid	*ia64_physmem_alloc(vm_size_t, vm_size_t);
100217309Snwhitehornint	ia64_physmem_delete(vm_paddr_t, vm_size_t);
101217309Snwhitehornint	ia64_physmem_fini(void);
102217309Snwhitehornint	ia64_physmem_init(void);
103217309Snwhitehornint	ia64_physmem_track(vm_paddr_t, vm_size_t);
104217309Snwhitehornvoid	ia64_probe_sapics(void);
105217309Snwhitehornvoid	ia64_sync_icache(vm_offset_t, vm_size_t);
106217309Snwhitehornvoid	*ia64_xtrace_alloc(void);
107217309Snwhitehornvoid	ia64_xtrace_init_ap(void *);
108217309Snwhitehornvoid	ia64_xtrace_init_bsp(void);
109217309Snwhitehornvoid	ia64_xtrace_save(void);
110217309Snwhitehornvoid	ia64_xtrace_stop(void);
111217309Snwhitehornvoid	interrupt(struct trapframe *);
112217309Snwhitehornvoid	map_gateway_page(void);
113217309Snwhitehornvoid	map_pal_code(void);
114217309Snwhitehornvoid	map_vhpt(uintptr_t);
115217309Snwhitehornvoid	os_boot_rendez(void);
116217309Snwhitehornvoid	os_mca(void);
117217309Snwhitehornint	syscall(struct trapframe *);
118217309Snwhitehornvoid	trap(int, struct trapframe *);
119217309Snwhitehornvoid	trap_panic(int, struct trapframe *);
120217309Snwhitehornint	unaligned_fixup(struct trapframe *, struct thread *);
121217309Snwhitehorn
122217309Snwhitehorn#endif	/* _KERNEL */
123217309Snwhitehorn
124217309Snwhitehorn#endif /* !_MACHINE_MD_VAR_H_ */
125217309Snwhitehorn