diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 2005-04-01 10:40:50 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 2005-04-01 10:40:50 +0000 |
commit | 086e003dd29b7c42921a44eb7af336bacfc10d4d (patch) | |
tree | a901551a395f9d10ee4d44cef80ec86a4dd5ae0c /sys/arch/hppa64/include | |
parent | 4082d6812410636300be23e2010448febcf6e5d9 (diff) |
small batch early bottling hppa64 port
matured in mighty ukrainian oak for 23 months
Diffstat (limited to 'sys/arch/hppa64/include')
42 files changed, 3549 insertions, 0 deletions
diff --git a/sys/arch/hppa64/include/ansi.h b/sys/arch/hppa64/include/ansi.h new file mode 100644 index 00000000000..7e0df957749 --- /dev/null +++ b/sys/arch/hppa64/include/ansi.h @@ -0,0 +1,79 @@ +/* $OpenBSD: ansi.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ansi.h 8.2 (Berkeley) 1/4/94 + */ + +#ifndef _MACHINE_ANSI_H_ +#define _MACHINE_ANSI_H_ + +/* + * Types which are fundamental to the implementation and may appear in + * more than one standard header are defined here. Standard headers + * then use: + * #ifdef _BSD_SIZE_T_ + * typedef _BSD_SIZE_T_ size_t; + * #undef _BSD_SIZE_T_ + * #endif + */ +#define _BSD_CLOCK_T_ int /* clock() */ +#define _BSD_PTRDIFF_T_ long int /* ptr1 - ptr2 */ +#define _BSD_SIZE_T_ long unsigned int /* sizeof() */ +#define _BSD_SSIZE_T_ long int /* byte count or error */ +#define _BSD_TIME_T_ int /* time() */ +#define _BSD_VA_LIST_ __builtin_va_list +#define _BSD_CLOCKID_T_ int +#define _BSD_TIMER_T_ int + +/* + * Runes (wchar_t) is declared to be an ``int'' instead of the more natural + * ``unsigned long'' or ``long''. Two things are happening here. It is not + * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, + * it looks like 10646 will be a 31 bit standard. This means that if your + * ints cannot hold 32 bits, you will be in trouble. The reason an int was + * chosen over a long is that the is*() and to*() routines take ints (says + * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you + * lose a bit of ANSI conformance, but your programs will still work. + * + * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t + * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains + * defined for ctype.h. + */ +#define _BSD_WCHAR_T_ int /* wchar_t */ +#define _BSD_WINT_T_ int /* wint_t */ +#define _BSD_RUNE_T_ int /* rune_t */ + +/* + * We describe off_t here so its declaration can be visible to + * stdio without pulling in all of <sys/type.h>, thus appeasing ANSI. + */ +#define _BSD_OFF_T_ long long /* file offset */ + +#endif /* _MACHINE_ANSI_H_ */ diff --git a/sys/arch/hppa64/include/asm.h b/sys/arch/hppa64/include/asm.h new file mode 100644 index 00000000000..ed1ca9acafe --- /dev/null +++ b/sys/arch/hppa64/include/asm.h @@ -0,0 +1,70 @@ +/* $OpenBSD: asm.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 1990,1991,1994 The University of Utah and + * the Computer Systems Laboratory (CSL). All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Utah $Hdr: asm.h 1.8 94/12/14$ + */ + +#ifndef _MACHINE_ASM_H_ +#define _MACHINE_ASM_H_ + +/* + * hppa assembler definitions + */ + +arg7 .reg %r19 +arg6 .reg %r20 +arg5 .reg %r21 +arg4 .reg %r22 +ap .reg %r29 + +#ifdef __STDC__ +#define __CONCAT(a,b) a ## b +#else +#define __CONCAT(a,b) a/**/b +#endif + +#ifdef PROF +#define _PROF_PROLOGUE \ + stw %rp, HPPA_FRAME_CRP(%sr0,%sp) !\ + ldil L%_mcount,%r1 !\ + ble R%_mcount(%sr0,%r1) !\ + ldo HPPA_FRAME_SIZE(%sp),%sp !\ + ldw PPA_FRAME_CRP(%sr0,%sp),%rp +#else +#define _PROF_PROLOGUE +#endif + +#define LEAF_ENTRY(x) ! .text ! .align 4 !\ + .export x, entry ! .label x ! .proc !\ + .callinfo frame=0,no_calls,save_rp !\ + .entry ! _PROF_PROLOGUE + +#define ENTRY(x,n) ! .text ! .align 4 !\ + .export x, entry ! .label x ! .proc !\ + .callinfo frame=n,calls, save_rp, save_sp !\ + .entry ! _PROF_PROLOGUE + +#define ALTENTRY(x) ! .export x, entry ! .label x +#define EXIT(x) ! .exit ! .procend ! .size x, .-x + +#define BSS(n,s) ! .data ! .label n ! .comm s + +#endif /* _MACHINE_ASM_H_ */ diff --git a/sys/arch/hppa64/include/autoconf.h b/sys/arch/hppa64/include/autoconf.h new file mode 100644 index 00000000000..2d40eb5e236 --- /dev/null +++ b/sys/arch/hppa64/include/autoconf.h @@ -0,0 +1,53 @@ +/* $OpenBSD: autoconf.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include <machine/bus.h> +#include <machine/pdc.h> + +struct confargs { + const char *ca_name; /* device name/description */ + struct iodc_data ca_type; /* iodc-specific type descrition */ + bus_space_tag_t ca_iot; /* io tag */ + bus_dma_tag_t ca_dmatag; /* DMA tag */ + hppa_hpa_t ca_hpa; /* module HPA */ + u_int ca_hpasz; /* module HPA size (if avail) */ +}; + +/* this is used for hppa_knownmodules table + * describing known to this port modules, + * system boards, cpus, fpus and busses + */ +struct hppa_mod_info { + int mi_type; + int mi_sv; + const char *mi_name; +}; + +extern void (*cold_hook)(int); +#define HPPA_COLD_COLD 0 +#define HPPA_COLD_HOT 1 +#define HPPA_COLD_OFF 2 + +struct device; + +const char *hppa_mod_info(int, int); +void pdc_patscan(struct device *, struct confargs *, int); +int mbprint(void *, const char *); + +void dumpconf(void); diff --git a/sys/arch/hppa64/include/bus.h b/sys/arch/hppa64/include/bus.h new file mode 100644 index 00000000000..bfd7606dbaf --- /dev/null +++ b/sys/arch/hppa64/include/bus.h @@ -0,0 +1,410 @@ +/* $OpenBSD: bus.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_BUS_H_ +#define _MACHINE_BUS_H_ + +/* addresses in bus space */ +typedef u_long bus_addr_t; +typedef u_long bus_size_t; + +/* access methods for bus space */ +typedef u_long bus_space_handle_t; + +struct hppa64_bus_space_tag { + void *hbt_cookie; + + int (*hbt_map)(void *v, bus_addr_t addr, bus_size_t size, + int flags, bus_space_handle_t *bshp); + void (*hbt_unmap)(void *v, bus_space_handle_t bsh, bus_size_t size); + int (*hbt_subregion)(void *v, bus_space_handle_t bsh, + bus_size_t offset, bus_size_t size, + bus_space_handle_t *nbshp); + int (*hbt_alloc)(void *v, bus_addr_t rstart, bus_addr_t rend, + bus_size_t size, bus_size_t align, bus_size_t boundary, + int flags, bus_addr_t *addrp, bus_space_handle_t *bshp); + void (*hbt_free)(void *, bus_space_handle_t, bus_size_t); + void (*hbt_barrier)(void *v, bus_space_handle_t h, + bus_size_t o, bus_size_t l, int op); + u_int8_t (*hbt_r1)(void *, bus_space_handle_t, bus_size_t); + u_int16_t (*hbt_r2)(void *, bus_space_handle_t, bus_size_t); + u_int32_t (*hbt_r4)(void *, bus_space_handle_t, bus_size_t); + u_int64_t (*hbt_r8)(void *, bus_space_handle_t, bus_size_t); + + void (*hbt_w1)(void *, bus_space_handle_t, bus_size_t, u_int8_t); + void (*hbt_w2)(void *, bus_space_handle_t, bus_size_t, u_int16_t); + void (*hbt_w4)(void *, bus_space_handle_t, bus_size_t, u_int32_t); + void (*hbt_w8)(void *, bus_space_handle_t, bus_size_t, u_int64_t); + + void (*hbt_rm_1)(void *v, bus_space_handle_t h, + bus_size_t o, u_int8_t *a, bus_size_t c); + void (*hbt_rm_2)(void *v, bus_space_handle_t h, + bus_size_t o, u_int16_t *a, bus_size_t c); + void (*hbt_rm_4)(void *v, bus_space_handle_t h, + bus_size_t o, u_int32_t *a, bus_size_t c); + void (*hbt_rm_8)(void *v, bus_space_handle_t h, + bus_size_t o, u_int64_t *a, bus_size_t c); + + void (*hbt_wm_1)(void *v, bus_space_handle_t h, bus_size_t o, + const u_int8_t *a, bus_size_t c); + void (*hbt_wm_2)(void *v, bus_space_handle_t h, bus_size_t o, + const u_int16_t *a, bus_size_t c); + void (*hbt_wm_4)(void *v, bus_space_handle_t h, bus_size_t o, + const u_int32_t *a, bus_size_t c); + void (*hbt_wm_8)(void *v, bus_space_handle_t h, bus_size_t o, + const u_int64_t *a, bus_size_t c); + + void (*hbt_sm_1)(void *v, bus_space_handle_t h, bus_size_t o, + u_int8_t vv, bus_size_t c); + void (*hbt_sm_2)(void *v, bus_space_handle_t h, bus_size_t o, + u_int16_t vv, bus_size_t c); + void (*hbt_sm_4)(void *v, bus_space_handle_t h, bus_size_t o, + u_int32_t vv, bus_size_t c); + void (*hbt_sm_8)(void *v, bus_space_handle_t h, bus_size_t o, + u_int64_t vv, bus_size_t c); + + void (*hbt_rrm_2)(void *v, bus_space_handle_t h, + bus_size_t o, u_int8_t *a, bus_size_t c); + void (*hbt_rrm_4)(void *v, bus_space_handle_t h, + bus_size_t o, u_int8_t *a, bus_size_t c); + void (*hbt_rrm_8)(void *v, bus_space_handle_t h, + bus_size_t o, u_int8_t *a, bus_size_t c); + + void (*hbt_wrm_2)(void *v, bus_space_handle_t h, + bus_size_t o, const u_int8_t *a, bus_size_t c); + void (*hbt_wrm_4)(void *v, bus_space_handle_t h, + bus_size_t o, const u_int8_t *a, bus_size_t c); + void (*hbt_wrm_8)(void *v, bus_space_handle_t h, + bus_size_t o, const u_int8_t *a, bus_size_t c); + + void (*hbt_rr_1)(void *v, bus_space_handle_t h, + bus_size_t o, u_int8_t *a, bus_size_t c); + void (*hbt_rr_2)(void *v, bus_space_handle_t h, + bus_size_t o, u_int16_t *a, bus_size_t c); + void (*hbt_rr_4)(void *v, bus_space_handle_t h, + bus_size_t o, u_int32_t *a, bus_size_t c); + void (*hbt_rr_8)(void *v, bus_space_handle_t h, + bus_size_t o, u_int64_t *a, bus_size_t c); + + void (*hbt_wr_1)(void *v, bus_space_handle_t h, + bus_size_t o, const u_int8_t *a, bus_size_t c); + void (*hbt_wr_2)(void *v, bus_space_handle_t h, + bus_size_t o, const u_int16_t *a, bus_size_t c); + void (*hbt_wr_4)(void *v, bus_space_handle_t h, + bus_size_t o, const u_int32_t *a, bus_size_t c); + void (*hbt_wr_8)(void *v, bus_space_handle_t h, + bus_size_t o, const u_int64_t *a, bus_size_t c); + + void (*hbt_rrr_2)(void *v, bus_space_handle_t h, + bus_size_t o, u_int8_t *a, bus_size_t c); + void (*hbt_rrr_4)(void *v, bus_space_handle_t h, + bus_size_t o, u_int8_t *a, bus_size_t c); + void (*hbt_rrr_8)(void *v, bus_space_handle_t h, + bus_size_t o, u_int8_t *a, bus_size_t c); + + void (*hbt_wrr_2)(void *v, bus_space_handle_t h, + bus_size_t o, const u_int8_t *a, bus_size_t c); + void (*hbt_wrr_4)(void *v, bus_space_handle_t h, + bus_size_t o, const u_int8_t *a, bus_size_t c); + void (*hbt_wrr_8)(void *v, bus_space_handle_t h, + bus_size_t o, const u_int8_t *a, bus_size_t c); + + void (*hbt_sr_1)(void *v, bus_space_handle_t h, + bus_size_t o, u_int8_t vv, bus_size_t c); + void (*hbt_sr_2)(void *v, bus_space_handle_t h, + bus_size_t o, u_int16_t vv, bus_size_t c); + void (*hbt_sr_4)(void *v, bus_space_handle_t h, + bus_size_t o, u_int32_t vv, bus_size_t c); + void (*hbt_sr_8)(void *v, bus_space_handle_t h, + bus_size_t o, u_int64_t vv, bus_size_t c); + + void (*hbt_cp_1)(void *v, bus_space_handle_t h1, bus_size_t o1, + bus_space_handle_t h2, bus_size_t o2, bus_size_t c); + void (*hbt_cp_2)(void *v, bus_space_handle_t h1, bus_size_t o1, + bus_space_handle_t h2, bus_size_t o2, bus_size_t c); + void (*hbt_cp_4)(void *v, bus_space_handle_t h1, bus_size_t o1, + bus_space_handle_t h2, bus_size_t o2, bus_size_t c); + void (*hbt_cp_8)(void *v, bus_space_handle_t h1, bus_size_t o1, + bus_space_handle_t h2, bus_size_t o2, bus_size_t c); +}; +typedef struct hppa64_bus_space_tag *bus_space_tag_t; + +/* flags for bus space map functions */ +#define BUS_SPACE_MAP_CACHEABLE 0x0001 +#define BUS_SPACE_MAP_LINEAR 0x0002 +#define BUS_SPACE_MAP_READONLY 0x0004 +#define BUS_SPACE_MAP_PREFETCHABLE 0x0008 + +/* bus access routines */ + +#define bus_space_map(t,a,c,ca,hp) \ + (((t)->hbt_map)((t)->hbt_cookie,(a),(c),(ca),(hp))) +#define bus_space_unmap(t,h,c) \ + (((t)->hbt_unmap)((t)->hbt_cookie,(h),(c))) +#define bus_space_subregion(t,h,o,c,hp) \ + (((t)->hbt_subregion)((t)->hbt_cookie,(h),(o),(c),(hp))) +#define bus_space_alloc(t,b,e,c,al,bn,ca,ap,hp) \ + (((t)->hbt_alloc)((t)->hbt_cookie,(b),(e),(c),(al),(bn),(ca),(ap),(hp))) +#define bus_space_free(t,h,c) \ + (((t)->hbt_free)((t)->hbt_cookie,(h),(c))) + +#define BUS_SPACE_BARRIER_READ 0 +#define BUS_SPACE_BARRIER_WRITE 1 + +#define bus_space_barrier(t,h,o,l,op) \ + ((t)->hbt_barrier((t)->hbt_cookie, (h), (o), (l), (op))) +#define bus_space_vaddr(t,h) ((vaddr_t)(h)) + +#define bus_space_read_1(t,h,o) (((t)->hbt_r1)((t)->hbt_cookie,(h),(o))) +#define bus_space_read_2(t,h,o) (((t)->hbt_r2)((t)->hbt_cookie,(h),(o))) +#define bus_space_read_4(t,h,o) (((t)->hbt_r4)((t)->hbt_cookie,(h),(o))) +#define bus_space_read_8(t,h,o) (((t)->hbt_r8)((t)->hbt_cookie,(h),(o))) + +#define bus_space_write_1(t,h,o,v) (((t)->hbt_w1)((t)->hbt_cookie,(h),(o),(v))) +#define bus_space_write_2(t,h,o,v) (((t)->hbt_w2)((t)->hbt_cookie,(h),(o),(v))) +#define bus_space_write_4(t,h,o,v) (((t)->hbt_w4)((t)->hbt_cookie,(h),(o),(v))) +#define bus_space_write_8(t,h,o,v) (((t)->hbt_w8)((t)->hbt_cookie,(h),(o),(v))) + +#define bus_space_read_multi_1(t,h,o,a,c) \ + (((t)->hbt_rm_1)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_read_multi_2(t,h,o,a,c) \ + (((t)->hbt_rm_2)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_read_multi_4(t,h,o,a,c) \ + (((t)->hbt_rm_4)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_read_multi_8(t,h,o,a,c) \ + (((t)->hbt_rm_8)((t)->hbt_cookie, (h), (o), (a), (c))) + +#define bus_space_write_multi_1(t,h,o,a,c) \ + (((t)->hbt_wm_1)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_write_multi_2(t,h,o,a,c) \ + (((t)->hbt_wm_2)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_write_multi_4(t,h,o,a,c) \ + (((t)->hbt_wm_4)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_write_multi_8(t,h,o,a,c) \ + (((t)->hbt_wm_8)((t)->hbt_cookie, (h), (o), (a), (c))) + +#define bus_space_set_multi_1(t,h,o,v,c) \ + (((t)->hbt_sm_1)((t)->hbt_cookie, (h), (o), (v), (c))) +#define bus_space_set_multi_2(t,h,o,v,c) \ + (((t)->hbt_sm_2)((t)->hbt_cookie, (h), (o), (v), (c))) +#define bus_space_set_multi_4(t,h,o,v,c) \ + (((t)->hbt_sm_4)((t)->hbt_cookie, (h), (o), (v), (c))) +#define bus_space_set_multi_8(t,h,o,v,c) \ + (((t)->hbt_sm_8)((t)->hbt_cookie, (h), (o), (v), (c))) + +#define bus_space_read_raw_multi_2(t, h, o, a, c) \ + (((t)->hbt_rrm_2)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_read_raw_multi_4(t, h, o, a, c) \ + (((t)->hbt_rrm_4)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_read_raw_multi_8(t, h, o, a, c) \ + (((t)->hbt_rrm_8)((t)->hbt_cookie, (h), (o), (a), (c))) + +#define bus_space_write_raw_multi_2(t, h, o, a, c) \ + (((t)->hbt_wrm_2)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_write_raw_multi_4(t, h, o, a, c) \ + (((t)->hbt_wrm_4)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_write_raw_multi_8(t, h, o, a, c) \ + (((t)->hbt_wrm_8)((t)->hbt_cookie, (h), (o), (a), (c))) + +#define bus_space_read_region_1(t, h, o, a, c) \ + (((t)->hbt_rr_1)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_read_region_2(t, h, o, a, c) \ + (((t)->hbt_rr_2)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_read_region_4(t, h, o, a, c) \ + (((t)->hbt_rr_4)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_read_region_8(t, h, o, a, c) \ + (((t)->hbt_rr_8)((t)->hbt_cookie, (h), (o), (a), (c))) + +#define bus_space_write_region_1(t, h, o, a, c) \ + (((t)->hbt_wr_1)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_write_region_2(t, h, o, a, c) \ + (((t)->hbt_wr_2)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_write_region_4(t, h, o, a, c) \ + (((t)->hbt_wr_4)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_write_region_8(t, h, o, a, c) \ + (((t)->hbt_wr_8)((t)->hbt_cookie, (h), (o), (a), (c))) + +#define bus_space_read_raw_region_2(t, h, o, a, c) \ + (((t)->hbt_rrr_2)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_read_raw_region_4(t, h, o, a, c) \ + (((t)->hbt_rrr_4)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_read_raw_region_8(t, h, o, a, c) \ + (((t)->hbt_rrr_8)((t)->hbt_cookie, (h), (o), (a), (c))) + +#define bus_space_write_raw_region_2(t, h, o, a, c) \ + (((t)->hbt_wrr_2)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_write_raw_region_4(t, h, o, a, c) \ + (((t)->hbt_wrr_4)((t)->hbt_cookie, (h), (o), (a), (c))) +#define bus_space_write_raw_region_8(t, h, o, a, c) \ + (((t)->hbt_wrr_8)((t)->hbt_cookie, (h), (o), (a), (c))) + +#define bus_space_set_region_1(t, h, o, v, c) \ + (((t)->hbt_sr_1)((t)->hbt_cookie, (h), (o), (v), (c))) +#define bus_space_set_region_2(t, h, o, v, c) \ + (((t)->hbt_sr_2)((t)->hbt_cookie, (h), (o), (v), (c))) +#define bus_space_set_region_4(t, h, o, v, c) \ + (((t)->hbt_sr_4)((t)->hbt_cookie, (h), (o), (v), (c))) +#define bus_space_set_region_8(t, h, o, v, c) \ + (((t)->hbt_sr_8)((t)->hbt_cookie, (h), (o), (v), (c))) + +#define bus_space_copy_1(t, h1, o1, h2, o2, c) \ + (((t)->hbt_cp_1)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c))) +#define bus_space_copy_2(t, h1, o1, h2, o2, c) \ + (((t)->hbt_cp_2)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c))) +#define bus_space_copy_4(t, h1, o1, h2, o2, c) \ + (((t)->hbt_cp_4)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c))) +#define bus_space_copy_8(t, h1, o1, h2, o2, c) \ + (((t)->hbt_cp_8)((t)->hbt_cookie, (h1), (o1), (h2), (o2), (c))) +#define BUS_DMA_WAITOK 0x000 /* safe to sleep (pseudo-flag) */ +#define BUS_DMA_NOWAIT 0x001 /* not safe to sleep */ +#define BUS_DMA_ALLOCNOW 0x002 /* perform resource allocation now */ +#define BUS_DMA_COHERENT 0x004 /* hint: map memory DMA coherent */ +#define BUS_DMAMEM_NOSYNC 0x010 +#define BUS_DMA_BUS1 0x020 /* placeholders for bus functions... */ +#define BUS_DMA_BUS2 0x040 +#define BUS_DMA_BUS3 0x080 +#define BUS_DMA_BUS4 0x100 +#define BUS_DMA_STREAMING 0x200 /* hint: sequential, unidirectional */ +#define BUS_DMA_READ 0x400 /* mapping is device -> memory only */ +#define BUS_DMA_WRITE 0x800 /* mapping is memory -> device only */ + +/* Forwards needed by prototypes below. */ +struct mbuf; +struct proc; +struct uio; + +/* Operations performed by bus_dmamap_sync(). */ +#define BUS_DMASYNC_POSTREAD 0x01 +#define BUS_DMASYNC_POSTWRITE 0x02 +#define BUS_DMASYNC_PREREAD 0x04 +#define BUS_DMASYNC_PREWRITE 0x08 + +typedef const struct hppa64_bus_dma_tag *bus_dma_tag_t; +typedef struct hppa64_bus_dmamap *bus_dmamap_t; + +/* + * bus_dma_segment_t + * + * Describes a single contiguous DMA transaction. Values + * are suitable for programming into DMA registers. + */ +struct hppa64_bus_dma_segment { + vaddr_t _ds_va; /* needed for syncing */ + + bus_addr_t ds_addr; /* DMA address */ + bus_size_t ds_len; /* length of transfer */ +}; +typedef struct hppa64_bus_dma_segment bus_dma_segment_t; + +/* + * bus_dma_tag_t + * + * A machine-dependent opaque type describing the implementation of + * DMA for a given bus. + */ + +struct hppa64_bus_dma_tag { + void *_cookie; /* cookie used in the guts */ + + /* + * DMA mapping methods. + */ + int (*_dmamap_create)(void *, bus_size_t, int, + bus_size_t, bus_size_t, int, bus_dmamap_t *); + void (*_dmamap_destroy)(void *, bus_dmamap_t); + int (*_dmamap_load)(void *, bus_dmamap_t, void *, + bus_size_t, struct proc *, int); + int (*_dmamap_load_mbuf)(void *, bus_dmamap_t, + struct mbuf *, int); + int (*_dmamap_load_uio)(void *, bus_dmamap_t, + struct uio *, int); + int (*_dmamap_load_raw)(void *, bus_dmamap_t, + bus_dma_segment_t *, int, bus_size_t, int); + void (*_dmamap_unload)(void *, bus_dmamap_t); + void (*_dmamap_sync)(void *, bus_dmamap_t, bus_addr_t, + bus_size_t, int); + + /* + * DMA memory utility functions. + */ + int (*_dmamem_alloc)(void *, bus_size_t, bus_size_t, + bus_size_t, bus_dma_segment_t *, int, int *, int); + void (*_dmamem_free)(void *, bus_dma_segment_t *, int); + int (*_dmamem_map)(void *, bus_dma_segment_t *, + int, size_t, caddr_t *, int); + void (*_dmamem_unmap)(void *, caddr_t, size_t); + paddr_t (*_dmamem_mmap)(void *, bus_dma_segment_t *, + int, off_t, int, int); +}; + +#define bus_dmamap_create(t, s, n, m, b, f, p) \ + (*(t)->_dmamap_create)((t)->_cookie, (s), (n), (m), (b), (f), (p)) +#define bus_dmamap_destroy(t, p) \ + (*(t)->_dmamap_destroy)((t)->_cookie, (p)) +#define bus_dmamap_load(t, m, b, s, p, f) \ + (*(t)->_dmamap_load)((t)->_cookie, (m), (b), (s), (p), (f)) +#define bus_dmamap_load_mbuf(t, m, b, f) \ + (*(t)->_dmamap_load_mbuf)((t)->_cookie, (m), (b), (f)) +#define bus_dmamap_load_uio(t, m, u, f) \ + (*(t)->_dmamap_load_uio)((t)->_cookie, (m), (u), (f)) +#define bus_dmamap_load_raw(t, m, sg, n, s, f) \ + (*(t)->_dmamap_load_raw)((t)->_cookie, (m), (sg), (n), (s), (f)) +#define bus_dmamap_unload(t, p) \ + (*(t)->_dmamap_unload)((t)->_cookie, (p)) +#define bus_dmamap_sync(t, p, a, l, o) \ + (void)((t)->_dmamap_sync ? \ + (*(t)->_dmamap_sync)((t)->_cookie, (p), (a), (l), (o)) : (void)0) + +#define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ + (*(t)->_dmamem_alloc)((t)->_cookie, (s), (a), (b), (sg), (n), (r), (f)) +#define bus_dmamem_free(t, sg, n) \ + (*(t)->_dmamem_free)((t)->_cookie, (sg), (n)) +#define bus_dmamem_map(t, sg, n, s, k, f) \ + (*(t)->_dmamem_map)((t)->_cookie, (sg), (n), (s), (k), (f)) +#define bus_dmamem_unmap(t, k, s) \ + (*(t)->_dmamem_unmap)((t)->_cookie, (k), (s)) +#define bus_dmamem_mmap(t, sg, n, o, p, f) \ + (*(t)->_dmamem_mmap)((t)->_cookie, (sg), (n), (o), (p), (f)) + +/* + * bus_dmamap_t + * + * Describes a DMA mapping. + */ +struct hppa64_bus_dmamap { + /* + * PRIVATE MEMBERS: not for use by machine-independent code. + */ + bus_size_t _dm_size; /* largest DMA transfer mappable */ + int _dm_segcnt; /* number of segs this map can map */ + bus_size_t _dm_maxsegsz; /* largest possible segment */ + bus_size_t _dm_boundary; /* don't cross this */ + int _dm_flags; /* misc. flags */ + + void *_dm_cookie; /* cookie for bus-specific functions */ + + /* + * PUBLIC MEMBERS: these are used by machine-independent code. + */ + bus_size_t dm_mapsize; /* size of the mapping */ + int dm_nsegs; /* # valid segments in mapping */ + bus_dma_segment_t dm_segs[1]; /* segments; variable length */ +}; + +#endif /* _MACHINE_BUS_H_ */ diff --git a/sys/arch/hppa64/include/cdefs.h b/sys/arch/hppa64/include/cdefs.h new file mode 100644 index 00000000000..8e7e74a501b --- /dev/null +++ b/sys/arch/hppa64/include/cdefs.h @@ -0,0 +1,39 @@ +/* $OpenBSD: cdefs.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ +/* $NetBSD: cdefs.h,v 1.5 1996/10/12 18:08:12 cgd Exp $ */ + +/* + * Copyright (c) 1995, 1996 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Chris G. Demetriou + * + * Permission to use, copy, modify and distribute this software and + * its documentation is hereby granted, provided that both the copyright + * notice and this permission notice appear in all copies of the + * software, derivative works or modified versions, and any portions + * thereof, and that both notices appear in supporting documentation. + * + * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" + * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * Carnegie Mellon requests users of this software to return to + * + * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU + * School of Computer Science + * Carnegie Mellon University + * Pittsburgh PA 15213-3890 + * + * any improvements or extensions that they make and grant Carnegie the + * rights to redistribute these changes. + */ + +#ifndef _MACHINE_CDEFS_H_ +#define _MACHINE_CDEFS_H_ + +#define __weak_alias(alias,sym) \ + __asm__(".export " __STRING(alias) ", entry\n\t.weak " __STRING(alias) "\n\t" __STRING(alias) " = " __STRING(sym)) +#define __warn_references(sym,msg) \ + __asm__(".section .gnu.warning." __STRING(sym) "\n\t.ascii \"" msg "\"\n\t.text") + +#endif /* !_MACHINE_CDEFS_H_ */ diff --git a/sys/arch/hppa64/include/conf.h b/sys/arch/hppa64/include/conf.h new file mode 100644 index 00000000000..cbe367c02f5 --- /dev/null +++ b/sys/arch/hppa64/include/conf.h @@ -0,0 +1,38 @@ +/* $OpenBSD: conf.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_CONF_H_ +#define _MACHINE_CONF_H_ + +#include <sys/conf.h> +struct tty; +struct termios; + +cdev_decl(pdc); +int pdcparam(struct tty *, struct termios *); +void pdcstart(struct tty *); + +#define mmread mmrw +#define mmwrite mmrw +cdev_decl(mm); + +cdev_decl(fd); +bdev_decl(fd); + +#endif /* _MACHINE_CONF_H_ */ diff --git a/sys/arch/hppa64/include/cpu.h b/sys/arch/hppa64/include/cpu.h new file mode 100644 index 00000000000..41aec18205d --- /dev/null +++ b/sys/arch/hppa64/include/cpu.h @@ -0,0 +1,303 @@ +/* $OpenBSD: cpu.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +/* + * Copyright (c) 1988-1994, The University of Utah and + * the Computer Systems Laboratory at the University of Utah (CSL). + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Utah $Hdr: cpu.h 1.19 94/12/16$ + */ + +#ifndef _MACHINE_CPU_H_ +#define _MACHINE_CPU_H_ + +#include <machine/trap.h> +#include <machine/frame.h> + +/* + * COPR/SFUs + */ +#define HPPA_FPUS 0xc0 +#define HPPA_FPUVER(w) (((w) & 0x003ff800) >> 11) +#define HPPA_FPU_OP(w) ((w) >> 26) +#define HPPA_FPU_UNMPL 0x01 /* exception reg, the rest is << 1 */ +#define HPPA_FPU_ILL 0x80 /* software-only */ +#define HPPA_FPU_I 0x01 +#define HPPA_FPU_U 0x02 +#define HPPA_FPU_O 0x04 +#define HPPA_FPU_Z 0x08 +#define HPPA_FPU_V 0x10 +#define HPPA_FPU_D 0x20 +#define HPPA_FPU_T 0x40 +#define HPPA_FPU_XMASK 0x7f +#define HPPA_FPU_T_POS 25 /* 32bit reg! */ +#define HPPA_FPU_RM 0x00000600 +#define HPPA_FPU_CQ 0x00fff800 +#define HPPA_FPU_C 0x04000000 +#define HPPA_FPU_FLSH 27 +#define HPPA_FPU_INIT (0) +#define HPPA_FPU_FORK(s) ((s) & ~((u_int64_t)(HPPA_FPU_XMASK)<<32)) +#define HPPA_PMSFUS 0x20 /* ??? */ + +/* + * Interrupts stuff + */ +#define IPL_NONE 0 +#define IPL_SOFTCLOCK 1 +#define IPL_SOFTNET 2 +#define IPL_BIO 3 +#define IPL_NET 4 +#define IPL_SOFTTTY 5 +#define IPL_TTY 6 +#define IPL_VM 7 +#define IPL_AUDIO 8 +#define IPL_CLOCK 9 +#define IPL_SCHED 9 +#define IPL_STATCLOCK 10 +#define IPL_HIGH 11 + +#define NIPL 12 + +#define IST_NONE 0 +#define IST_PULSE 1 +#define IST_EDGE 2 +#define IST_LEVEL 3 + +#define spllowersoftclock() spllower(IPL_SOFTCLOCK) +#define splsoftclock() splraise(IPL_SOFTCLOCK) +#define splsoftnet() splraise(IPL_SOFTNET) +#define splbio() splraise(IPL_BIO) +#define splnet() splraise(IPL_NET) +#define splsofttty() splraise(IPL_SOFTTTY) +#define spltty() splraise(IPL_TTY) +#define splvm() splraise(IPL_VM) +#define splimp() splvm() +#define splaudio() splraise(IPL_AUDIO) +#define splclock() splraise(IPL_CLOCK) +#define splsched() splraise(IPL_SCHED) +#define splstatclock() splraise(IPL_STATCLOCK) +#define splhigh() splraise(IPL_HIGH) +#define spl0() spllower(IPL_NONE) +#define splx(c) spllower(c) + +#define setsoftast() (astpending = 1) +#define setsoftclock() /* TODO */ +#define setsoftnet() /* TODO */ +#define setsofttty() /* TODO */ + +#ifndef _LOCORE +#include <sys/time.h> +#include <sys/sched.h> + +struct cpu_info { + struct proc *ci_curproc; + struct pcb *ci_cpcb; + struct cpu_info *ci_next; + + struct proc *ci_fpproc; + int ci_number; + struct schedstate_percpu ci_schedstate; /* scheduler state */ + + /* DEBUG/DIAGNOSTIC stuff */ + u_long ci_spin_locks; /* # of spin locks held */ + u_long ci_simple_locks;/* # of simple locks held */ + + /* Spinning up the CPU */ + void (*ci_spinup)(void); /* spinup routine */ + void *ci_initstack; +}; + +struct cpu_info *curcpu(void); +#define cpu_number() (curcpu()->ci_number) +#define CPU_IS_PRIMARY(ci) ((ci)->ci_number == 0) +#define CPU_INFO_ITERATOR int +#define CPU_INFO_FOREACH(cii,ci) \ + cii = 0, ci = curcpu(); ci != NULL; ci = ci->ci_next +#define CPU_INFO_UNIT(ci) ((ci)->ci_number) + +#ifdef DIAGNOSTIC +void splassert_fail(int, int, const char *); +extern int splassert_ctl; +void splassert_check(int, const char *); +#define splassert(__wantipl) do { \ + if (__predict_false(splassert_ctl > 0)) { \ + splassert_check(__wantipl, __func__); \ + } \ +} while (0) +#else +#define splassert(__wantipl) do { /* nada */ } while (0) +#endif /* DIAGNOSTIC */ + +/* types */ +enum hppa_cpu_type { + hpcxu, hpcxu2, hpcxw +}; +extern enum hppa_cpu_type cpu_type; +extern const char *cpu_typename; +extern int cpu_hvers; +#endif + +/* + * Exported definitions unique to hp700/PA-RISC cpu support. + */ + +#define HPPA_PGALIAS 0x0000000000100000UL +#define HPPA_PGAMASK 0xfffffffffff00000UL +#define HPPA_PGAOFF 0x00000000000fffffUL + +#define HPPA_PHYSMAP 0x000001ffffffffffUL +#define HPPA_IOBEGIN 0xfffffff000000000UL +#define HPPA_IOLEN 0x0000001000000000UL +#define HPPA_PHYSEND 0xffffffffffffffffUL +#define HPPA_IOADDR 0xfffffff100000000UL +#define HPPA_IOBCAST 0xfffffffffffc0000UL +#define HPPA_LBCAST 0xfffffffffffc0000UL +#define HPPA_GBCAST 0xfffffffffffe0000UL +#define HPPA_FPADDR 0xfffffffffff80000UL +#define HPPA_FLEX_MASK 0xfffffffffffc0000UL +#define HPPA_DMA_ENABLE 0x00000001 +#define HPPA_SPA_ENABLE 0x00000020 +#define HPPA_NMODSPBUS 64 + +#define clockframe trapframe +#define CLKF_PC(framep) ((framep)->tf_iioq[0]) +#define CLKF_INTR(framep) ((framep)->tf_flags & TFF_INTR) +#define CLKF_USERMODE(framep) ((framep)->tf_flags & T_USER) +#define CLKF_SYSCALL(framep) ((framep)->tf_flags & TFF_SYS) + +#define signotify(p) (setsoftast()) +#define need_resched(ci) (want_resched = 1, setsoftast()) +#define need_proftick(p) ((p)->p_flag |= P_OWEUPC, setsoftast()) + +#ifndef _LOCORE +#ifdef _KERNEL + +extern int want_resched, astpending; + +#define DELAY(x) delay(x) + +int splraise(int cpl); +int spllower(int cpl); + +void delay(u_int us); +void hppa_init(paddr_t start); +void trap(int type, struct trapframe *frame); +int spcopy(pa_space_t ssp, const void *src, + pa_space_t dsp, void *dst, size_t size); +int spstrcpy(pa_space_t ssp, const void *src, + pa_space_t dsp, void *dst, size_t size, size_t *rsize); +int copy_on_fault(void); +void switch_trampoline(void); +int cpu_dumpsize(void); +int cpu_dump(void); + +#ifdef USELEDS +#define PALED_NETSND 0x01 +#define PALED_NETRCV 0x02 +#define PALED_DISK 0x04 +#define PALED_HEARTBEAT 0x08 +#define PALED_LOADMASK 0xf0 + +#define PALED_DATA 0x01 +#define PALED_STROBE 0x02 + +extern volatile u_int8_t *machine_ledaddr; +extern int machine_ledword, machine_leds; + +static __inline void +ledctl(int on, int off, int toggle) +{ + if (machine_ledaddr) { + int r; + + if (on) + machine_leds |= on; + if (off) + machine_leds &= ~off; + if (toggle) + machine_leds ^= toggle; + + r = ~machine_leds; /* it seems they should be reversed */ + + if (machine_ledword) + *machine_ledaddr = r; + else { + register int b; + for (b = 0x80; b; b >>= 1) { + *machine_ledaddr = (r & b)? PALED_DATA : 0; + DELAY(1); + *machine_ledaddr = ((r & b)? PALED_DATA : 0) | + PALED_STROBE; + } + } + } +} +#endif + +void fpu_save(vaddr_t va); +void fpu_exit(void); +void ficache(pa_space_t sp, vaddr_t va, vsize_t size); +void fdcache(pa_space_t sp, vaddr_t va, vsize_t size); +void pdcache(pa_space_t sp, vaddr_t va, vsize_t size); +void ficacheall(void); +void fdcacheall(void); +void pitlb(pa_space_t sp, vaddr_t va); +void pdtlb(pa_space_t sp, vaddr_t va); +void ptlball(void); +void mtctl(register_t val, int reg); +register_t mfctl(int reg); +hppa_hpa_t cpu_gethpa(int n); +void sync_caches(void); +#endif + +/* + * Boot arguments stuff + */ + +#define BOOTARG_LEN (NBPG) +#define BOOTARG_OFF (0x10000) + +/* + * CTL_MACHDEP definitions. + */ +#define CPU_CONSDEV 1 /* dev_t: console terminal device */ +#define CPU_MAXID 1 /* number of valid machdep ids */ + +#define CTL_MACHDEP_NAMES { \ + { 0, 0 }, \ + { "console_device", CTLTYPE_STRUCT }, \ +} +#endif + +#endif /* _MACHINE_CPU_H_ */ diff --git a/sys/arch/hppa64/include/db_machdep.h b/sys/arch/hppa64/include/db_machdep.h new file mode 100644 index 00000000000..9c90cab7611 --- /dev/null +++ b/sys/arch/hppa64/include/db_machdep.h @@ -0,0 +1,107 @@ +/* $OpenBSD: db_machdep.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_DB_MACHDEP_H_ +#define _MACHINE_DB_MACHDEP_H_ + +#include <uvm/uvm_extern.h> + +#define DB_ELF_SYMBOLS +#define DB_ELFSIZE 64 + +/* types the generic ddb module needs */ +typedef vaddr_t db_addr_t; +typedef long db_expr_t; + +typedef struct trapframe db_regs_t; +extern db_regs_t ddb_regs; +#define DDB_REGS (&ddb_regs) + +#define PC_REGS(regs) ((db_addr_t)(regs)->tf_iioq[0]) +#define SET_PC_REGS(r,pc) ((r)->tf_iioq[0] = (pc), (r)->tf_iioq[1] = (pc) + 4) + +/* Breakpoint related definitions */ +#define BKPT_INST 0x00010000 /* break 0,8 */ +#define BKPT_SIZE sizeof(int) +#define BKPT_SET(inst) BKPT_INST + +#define IS_BREAKPOINT_TRAP(type, code) ((type) == T_IBREAK) +#define IS_WATCHPOINT_TRAP(type, code) ((type) == T_DBREAK) + +#define FIXUP_PC_AFTER_BREAK(regs) ((regs)->tf_iioq[0] -= sizeof(int)) + +#define DB_VALID_BREAKPOINT(addr) db_valid_breakpoint(addr) + +/* TODO 64bit insns */ + +static __inline int inst_call(u_int ins) { + return (ins & 0xfc00e000) == 0xe8000000 || + (ins & 0xfc00e000) == 0xe8004000 || + (ins & 0xfc000000) == 0xe4000000; +} +static __inline int inst_branch(u_int ins) { + return (ins & 0xf0000000) == 0xe0000000 || + (ins & 0xf0000000) == 0xc0000000 || + (ins & 0xf0000000) == 0xa0000000 || + (ins & 0xf0000000) == 0x80000000; +} +static __inline int inst_load(u_int ins) { + return (ins & 0xf0000000) == 0x40000000 || + (ins & 0xf4000200) == 0x24000000 || + (ins & 0xfc000200) == 0x0c000000 || + (ins & 0xfc001fc0) != 0x0c0011c0; +} +static __inline int inst_store(u_int ins) { + return (ins & 0xf0000000) == 0x60000000 || /* st */ + (ins & 0xf4000200) == 0x24000200 || /* fst/cst */ + (ins & 0xfc000200) == 0x0c000200 || /* stby */ + (ins & 0xfc0003c0) == 0x0c0001c0; /* ldcw */ +} +static __inline int inst_return(u_int ins) { + return (ins & 0xfc00e000) == 0xe800c000 || + (ins & 0xfc000000) == 0xe0000000; +} +static __inline int inst_trap_return(u_int ins) { + return (ins & 0xfc001fc0) == 0x00000ca0; +} + +#if 0 +#define db_clear_single_step(r) ((r)->tf_flags &= ~(PSL_Z)) +#define db_set_single_step(r) ((r)->tf_flags |= (PSL_Z)) +#else +#define SOFTWARE_SSTEP 1 +#define SOFTWARE_SSTEP_EMUL 1 + +static __inline db_addr_t +next_instr_address(db_addr_t addr, int b) { + return (addr + 4); +} + +#define branch_taken(ins,pc,f,regs) branch_taken1(ins, pc, regs) +static __inline db_addr_t +branch_taken1(int ins, db_addr_t pc, db_regs_t *regs) { + return (pc); +} + +#endif + +int db_valid_breakpoint(db_addr_t); +int kdb_trap(int, int, db_regs_t *); + +#endif /* _MACHINE_DB_MACHDEP_H_ */ diff --git a/sys/arch/hppa64/include/disklabel.h b/sys/arch/hppa64/include/disklabel.h new file mode 100644 index 00000000000..423637e6644 --- /dev/null +++ b/sys/arch/hppa64/include/disklabel.h @@ -0,0 +1,375 @@ +/* $OpenBSD: disklabel.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ +/* $NetBSD: disklabel.h,v 1.1 1995/02/13 23:07:34 cgd Exp $ */ + +/* + * Copyright (c) 1994 Christopher G. Demetriou + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Christopher G. Demetriou. + * 4. The name of the author may not be used to endorse or promote products + * derived from this software without specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MACHINE_DISKLABEL_H_ +#define _MACHINE_DISKLABEL_H_ + +enum disklabel_tag { DLT_ALPHA, DLT_I386, DLT_AMIGA, DLT_HPPA }; + +/* + * What disklabels are we probing for, and in which order? + */ +#ifndef LABELPROBES +#define LABELPROBES DLT_ALPHA, DLT_I386, DLT_AMIGA, DLT_HPPA +#endif + +#define ALPHA_LABELSECTOR 0 /* sector containing label */ +#define ALPHA_LABELOFFSET 64 /* offset of label in sector */ +#define I386_LABELSECTOR 1 /* sector containing label */ +#define I386_LABELOFFSET 0 /* offset of label in sector */ +#define AMIGA_LABELSECTOR 0 /* sector containing label */ +#define AMIGA_LABELOFFSET 64 /* offset of label in sector */ +#define HPPA_LABELSECTOR 1 /* sector containing label */ +#define HPPA_LABELOFFSET 0 /* offset of label in sector */ + +#define LABELSECTOR HPPA_LABELSECTOR +#define LABELOFFSET HPPA_LABELOFFSET + +#define MAXPARTITIONS 16 /* number of partitions */ +#define RAW_PART 2 /* raw partition: xx?c */ + +/* DOS partition table -- located in boot block */ +#define DOSBBSECTOR 0 /* DOS boot block relative sector # */ +#define DOSPARTOFF 446 +#define DOSACTIVE 0x80 +#define NDOSPART 4 +#define DOSMBR_SIGNATURE 0xaa55 +#define DOSMBR_SIGNATURE_OFF 0x1fe + +struct dos_partition { + u_int8_t dp_flag; /* bootstrap flags */ + u_int8_t dp_shd; /* starting head */ + u_int8_t dp_ssect; /* starting sector */ + u_int8_t dp_scyl; /* starting cylinder */ + u_int8_t dp_typ; /* partition type (see below) */ + u_int8_t dp_ehd; /* end head */ + u_int8_t dp_esect; /* end sector */ + u_int8_t dp_ecyl; /* end cylinder */ + u_int32_t dp_start; /* absolute starting sector number */ + u_int32_t dp_size; /* partition size in sectors */ +}; + +/* Known DOS partition types. */ +#define DOSPTYP_UNUSED 0x00 /* Unused partition */ +#define DOSPTYP_FAT12 0x01 /* 12-bit FAT */ +#define DOSPTYP_FAT16S 0x04 /* 16-bit FAT, less than 32M */ +#define DOSPTYP_EXTEND 0x05 /* Extended; contains sub-partitions */ +#define DOSPTYP_FAT16B 0x06 /* 16-bit FAT, more than 32M */ +#define DOSPTYP_FAT32 0x0b /* 32-bit FAT */ +#define DOSPTYP_FAT32L 0x0c /* 32-bit FAT, LBA-mapped */ +#define DOSPTYP_FAT16L 0x0e /* 16-bit FAT, LBA-mapped */ +#define DOSPTYP_ONTRACK 0x54 +#define DOSPTYP_LINUX 0x83 /* That other thing */ +#define DOSPTYP_FREEBSD 0xa5 /* FreeBSD partition type */ +#define DOSPTYP_OPENBSD 0xa6 /* OpenBSD partition type */ +#define DOSPTYP_NETBSD 0xa9 /* NetBSD partition type */ + +/* Isolate the relevant bits to get sector and cylinder. */ +#define DPSECT(s) ((s) & 0x3f) +#define DPCYL(c, s) ((c) + (((s) & 0xc0) << 2)) + +/* + * describes ados Rigid Disk Blocks + * which are used to partition a drive + */ +#define RDBNULL ((u_int32_t)0xffffffff) + +/* + * you will find rdblock somewhere in [0, RDBMAXBLOCKS) + */ +#define RDB_MAXBLOCKS 16 + +struct rdblock { + u_int32_t id; /* 'RDSK' */ + u_int32_t nsumlong; /* number of longs in check sum */ + u_int32_t chksum; /* simple additive with wrap checksum */ + u_int32_t hostid; /* scsi target of host */ + u_int32_t nbytes; /* size of disk blocks */ + u_int32_t flags; + u_int32_t badbhead; /* linked list of badblocks */ + u_int32_t partbhead; /* linked list of partblocks */ + u_int32_t fsbhead; /* " " of fsblocks */ + u_int32_t driveinit; + u_int32_t resv1[6]; /* RDBNULL */ + u_int32_t ncylinders; /* number of cylinders on drive */ + u_int32_t nsectors; /* number of sectors per track */ + u_int32_t nheads; /* number of tracks per cylinder */ + u_int32_t interleave; + u_int32_t park; /* only used with st506 i.e. not */ + u_int32_t resv2[3]; + u_int32_t wprecomp; /* start cyl for write precomp */ + u_int32_t reducedwrite; /* start cyl for reduced write current */ + u_int32_t steprate; /* driver step rate in ?s */ + u_int32_t resv3[5]; + u_int32_t rdblowb; /* lowblock of range for rdb's */ + u_int32_t rdbhighb; /* high block of range for rdb's */ + u_int32_t lowcyl; /* low cylinder of partition area */ + u_int32_t highcyl; /* upper cylinder of partition area */ + u_int32_t secpercyl; /* number of sectors per cylinder */ + u_int32_t parkseconds; /* zero if no park needed */ + u_int32_t resv4[2]; + char diskvendor[8]; /* inquiry stuff */ + char diskproduct[16]; /* inquiry stuff */ + char diskrevision[4]; /* inquiry stuff */ + char contvendor[8]; /* inquiry stuff */ + char contproduct[16]; /* inquiry stuff */ + char contrevision[4]; /* inquiry stuff */ +#if never_use_secsize + u_int32_t resv5[0]; +#endif +}; + + +#define RDBF_LAST 0x1 /* last drive available */ +#define RDBF_LASTLUN 0x2 /* last LUN available */ +#define RDBF_LASTUNIT 0x4 /* last target available */ +#define RDBF_NORESELECT 0x8 /* do not use reselect */ +#define RDBF_DISKID 0x10 /* disk id is valid ?? */ +#define RDBF_CTRLID 0x20 /* ctrl id is valid ?? */ +#define RDBF_SYNC 0x40 /* drive supports SCSI synchronous mode */ + +struct ados_environ { + u_int32_t tabsize; /* 0: environ table size */ + u_int32_t sizeblock; /* 1: n long words in a block */ + u_int32_t secorg; /* 2: not used must be zero */ + u_int32_t numheads; /* 3: number of surfaces */ + u_int32_t secperblk; /* 4: must be 1 */ + u_int32_t secpertrk; /* 5: blocks per track */ + u_int32_t resvblocks; /* 6: reserved blocks at start */ + u_int32_t prefac; /* 7: must be 0 */ + u_int32_t interleave; /* 8: normally 1 */ + u_int32_t lowcyl; /* 9: low cylinder of partition */ + u_int32_t highcyl; /* 10: upper cylinder of partition */ + u_int32_t numbufs; /* 11: ados: number of buffers */ + u_int32_t membuftype; /* 12: ados: type of bufmem */ + u_int32_t maxtrans; /* 13: maxtrans the ctrlr supports */ + u_int32_t mask; /* 14: mask for valid address */ + u_int32_t bootpri; /* 15: boot priority for autoboot */ + u_int32_t dostype; /* 16: filesystem type */ + u_int32_t baud; /* 17: serial handler baud rate */ + u_int32_t control; /* 18: control word for fs */ + u_int32_t bootblocks; /* 19: blocks containing boot code */ + u_int32_t fsize; /* 20: file system block size */ + u_int32_t frag; /* 21: allowable frags per block */ + u_int32_t cpg; /* 22: cylinders per group */ +}; + +struct partblock { + u_int32_t id; /* 'PART' */ + u_int32_t nsumlong; /* number of longs in check sum */ + u_int32_t chksum; /* simple additive with wrap checksum */ + u_int32_t hostid; /* scsi target of host */ + u_int32_t next; /* next in chain */ + u_int32_t flags; /* see below */ + u_int32_t resv1[3]; + u_char partname[32]; /* (BCPL) part name (may not be unique) */ + u_int32_t resv2[15]; + struct ados_environ e; +#if never_use_secsize + u_int32_t extra[9]; /* 8 for extra added to environ */ +#endif +}; + +#define PBF_BOOTABLE 0x1 /* partition is bootable */ +#define PBF_NOMOUNT 0x2 /* partition should be mounted */ + +struct badblock { + u_int32_t id; /* 'BADB' */ + u_int32_t nsumlong; /* number of longs in check sum */ + u_int32_t chksum; /* simple additive with wrap checksum */ + u_int32_t hostid; /* scsi target of host */ + u_int32_t next; /* next in chain */ + u_int32_t resv; + struct badblockent { + u_int32_t badblock; + u_int32_t goodblock; + } badtab[0]; /* 61 for secsize == 512 */ +}; + +struct fsblock { + u_int32_t id; /* 'FSHD' */ + u_int32_t nsumlong; /* number of longs in check sum */ + u_int32_t chksum; /* simple additive with wrap checksum */ + u_int32_t hostid; /* scsi target of host */ + u_int32_t next; /* next in chain */ + u_int32_t flags; + u_int32_t resv1[2]; + u_int32_t dostype; /* this is a file system for this type */ + u_int32_t version; /* version of this fs */ + u_int32_t patchflags; /* describes which functions to replace */ + u_int32_t type; /* zero */ + u_int32_t task; /* zero */ + u_int32_t lock; /* zero */ + u_int32_t handler; /* zero */ + u_int32_t stacksize; /* to use when loading handler */ + u_int32_t priority; /* to run the fs at. */ + u_int32_t startup; /* zero */ + u_int32_t lsegblocks; /* linked list of lsegblocks of fs code */ + u_int32_t globalvec; /* bcpl vector not used mostly */ +#if never_use_secsize + u_int32_t resv2[44]; +#endif +}; + +struct lsegblock { + u_int32_t id; /* 'LSEG' */ + u_int32_t nsumlong; /* number of longs in check sum */ + u_int32_t chksum; /* simple additive with wrap checksum */ + u_int32_t hostid; /* scsi target of host */ + u_int32_t next; /* next in chain */ + u_int32_t loaddata[0]; /* load segment data, 123 for secsize == 512 */ +}; + +#define RDBLOCK_ID 0x5244534b /* 'RDSK' */ +#define PARTBLOCK_ID 0x50415254 /* 'PART' */ +#define BADBLOCK_ID 0x42414442 /* 'BADB' */ +#define FSBLOCK_ID 0x46534844 /* 'FSHD' */ +#define LSEGBLOCK_ID 0x4c534547 /* 'LSEG' */ + +/* + * volume header for "LIF" format volumes + */ +struct lifvol { + short vol_id; + char vol_label[6]; + u_int vol_addr; + short vol_oct; + short vol_dummy; + u_int vol_dirsize; + short vol_version; + short vol_zero; + u_int vol_number; + u_int vol_lastvol; + u_int vol_length; + char vol_toc[6]; + char vol_dummy1[198]; + + u_int ipl_addr; + u_int ipl_size; + u_int ipl_entry; + + u_int vol_dummy2; +}; + +struct lifdir { + char dir_name[10]; + u_short dir_type; + u_int dir_addr; + u_int dir_length; + char dir_toc[6]; + short dir_flag; + u_int dir_implement; +}; + +struct lif_load { + int address; + int count; +}; + +#define HPUX_MAGIC 0x8b7f6a3c +#define HPUX_MAXPART 16 +struct hpux_label { + int32_t hl_magic1; + u_int32_t hl_magic; + int32_t hl_version; + struct { + int32_t hlp_blah[2]; + int32_t hlp_start; + int32_t hlp_length; + } hl_parts[HPUX_MAXPART]; + u_int8_t hl_flags[HPUX_MAXPART]; +#define HPUX_PART_ROOT 0x10 +#define HPUX_PART_SWAP 0x14 +#define HPUX_PART_BOOT 0x32 + int32_t hl_blah[3*16]; + u_int16_t hl_boot; + u_int16_t hl_reserved; + int32_t hl_magic2; +}; + +#define LIF_VOL_ID -32768 +#define LIF_VOL_OCT 4096 +#define LIF_DIR_SWAP 0x5243 +#define LIF_DIR_HPLBL 0xa271 +#define LIF_DIR_FS 0xcd38 +#define LIF_DIR_IOMAP 0xcd60 +#define LIF_DIR_HPUX 0xcd80 +#define LIF_DIR_ISL 0xce00 +#define LIF_DIR_PAD 0xcffe +#define LIF_DIR_AUTO 0xcfff +#define LIF_DIR_EST 0xd001 +#define LIF_DIR_TYPE 0xe942 + +#define LIF_DIR_FLAG 0x8001 /* dont ask me! */ +#define LIF_SECTSIZE 256 + +#define LIF_NUMDIR 16 + +#define LIF_VOLSTART 0 +#define LIF_VOLSIZE sizeof(struct lifvol) +#define LIF_DIRSTART 2048 +#define LIF_DIRSIZE (LIF_NUMDIR * sizeof(struct lifdir)) +#define LIF_FILESTART 8192 + +#define btolifs(b) (((b) + (LIF_SECTSIZE - 1)) / LIF_SECTSIZE) +#define lifstob(s) ((s) * LIF_SECTSIZE) +#define lifstodb(s) ((s) * LIF_SECTSIZE / DEV_BSIZE) + +#include <sys/dkbad.h> +struct cpu_disklabel { + enum disklabel_tag labeltag; + int labelsector; + union { + struct { + } _alpha; + struct { + struct dos_partition dosparts[NDOSPART]; + struct dkbad bad; + } _i386; + struct { + u_int32_t rdblock; /* RDBNULL -> inval. */ + u_int32_t pblist[MAXPARTITIONS];/* pblock number */ + int pbindex[MAXPARTITIONS]; /* index of pblock */ + int valid; /* valid? */ + } _amiga; + struct { + struct lifvol lifvol; + struct lifdir lifdir[LIF_NUMDIR]; + struct hpux_label hplabel; + } _hppa; + } u; +}; + +#define DKBAD(x) ((x)->u._i386.bad) + +#endif /* _MACHINE_DISKLABEL_H_ */ diff --git a/sys/arch/hppa64/include/endian.h b/sys/arch/hppa64/include/endian.h new file mode 100644 index 00000000000..3138bcc84d8 --- /dev/null +++ b/sys/arch/hppa64/include/endian.h @@ -0,0 +1,28 @@ +/* $OpenBSD: endian.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _HPPA64_ENDIAN_H_ +#define _HPPA64_ENDIAN_H_ + +#define BYTE_ORDER BIG_ENDIAN +#include <sys/endian.h> + +#define __STRICT_ALIGNMENT + +#endif /* !_HPPA64_ENDIAN_H_ */ diff --git a/sys/arch/hppa64/include/exec.h b/sys/arch/hppa64/include/exec.h new file mode 100644 index 00000000000..3b2ccc70267 --- /dev/null +++ b/sys/arch/hppa64/include/exec.h @@ -0,0 +1,113 @@ +/* $OpenBSD: exec.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 1994, The University of Utah and + * the Computer Systems Laboratory at the University of Utah (CSL). + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Utah $Hdr: exec.h 1.3 94/12/16$ + */ + +#ifndef _MACHINE_EXEC_H_ +#define _MACHINE_EXEC_H_ + +#define cpu_exec_aout_makecmds(p, epp) ENOEXEC + +/* Size of a page in an object file. */ +#define __LDPGSZ 4096 + +#define ARCH_ELFSIZE 64 + +#define ELF_TARG_CLASS ELFCLASS64 +#define ELF_TARG_DATA ELFDATA2MSB +#define ELF_TARG_MACH EM_PARISC + +#define NATIVE_EXEC_ELF +#define _NLIST_DO_ELF +#define _KERN_DO_ELF + +/* + * the following MD ELF values defenitions are from the: + * "Processor-Specific ELF Supplement for PA-RISC. + * Including HP and HP-UX Extensions. Version 1.43. October 6, 1997" + * http://devrsrc1.external.hp.com/STK/partner/elf-pa.pdf + * + */ + +/* parisc-specific elf flags */ +#define EF_PARISC_TRAPNIL 0x00010000 /* trap on NULL derefs */ +#define EF_PARISC_EXT 0x00020000 /* program uses arch exts */ +#define EF_PARISC_LSB 0x00040000 /* program expects LSB mode */ +#define EF_PARISC_WIDE 0x00080000 /* program expects wide mode */ +#define EF_PARISC_NO_KABP 0x00100000 /* don't allow kernel assisted + branch prediction */ +#define EF_PARISC_LAZYSWAP 0x00200000 /* allow lazy swap allocation + for dynamically allocated + program segments */ +#define EF_PARISC_ARCH 0x0000ffff /* architecture version */ +#define EFA_PARISC_1_0 0x020B +#define EFA_PARISC_1_1 0x0210 +#define EFA_PARISC_2_0 0x0214 + +/* legend: 0 - pa7000, 1 - pa7100, 2 - pa7200, 3 - pa7100LC, 4 - pa8000 */ +#define PARISC_AE_QWSI 0x00000001 /* 0 : enable quadword stores */ +#define PARISC_AE_FPLSU 0x00000002 /* 1: fp load/store to I/O space */ +#define PARISC_AE_RSQRT 0x00000004 /* 0 : reciprocal sqrt */ +#define PARISC_AE_FDCG 0x00000008 /* 0,1: fdc includes graph flushes */ +#define PARISC_AE_HPAR 0x00000010 /* 3,4: half-word add/sub/av */ +#define PARISC_AE_BSW 0x00000020 /* 3,4: half-word shift-add */ +#define PARISC_AE_HPSA 0x00000040 /* 3 : byte-swapping stores */ +#define PARISC_AE_DPR0 0x00000080 /* 2,4: data prefetch via ld to r0 */ + +#define SHN_PARISC_ANSI_COMMON 0xff00 +#define SHN_PARISC_HUGE_COMMON 0xff01 + +/* sh_type */ +#define SHT_PARISC_EXT 0x70000000 /* contains product-specific + extension bits */ +#define SHT_PARISC_UNWIND 0x70000001 /* contains unwind table enries + sh_info contains index of + the code section to which + unwind entries apply */ +#define SHT_PARISC_DOC 0x70000002 /* contains debug info for -O */ +#define SHT_PARISC_ANNOT 0x70000003 /* contains code annotations */ + +/* sh_flags */ +#define SHF_PARISC_SBP 0x80000000 /* contains code compiled for + static branch prediction */ +#define SHF_PARISC_HUGE 0x40000000 /* should be allocated far from gp */ +#define SHF_PARISC_SHORT 0x20000000 /* should be allocated near from gp */ + +#define ELF_PARISC_ARCHEXT ".PARISC.archext" +#define ELF_PARISC_MILLI ".PARISC.milli" +#define ELF_PARISC_UNWIND ".PARISC.unwind" +#define ELF_PARISC_UNWIND_INFO ".PARISC.unwind_info" +#define ELF_PARISC_SDATA ".sdata" +#define ELF_PARISC_NOBITS ".sbss" + +#define STT_PARISC_MILLI 13 /* entry point of a millicode routine */ + +#define PT_PARISC_ARCHEXT 0x70000000 /* segment contains + .PARISC.archext section */ +#define PT_PARISC_UNWIND 0x70000001 /* segment contains + .unwind section */ + +#define PF_PARISC_SBP 0x08000000 /* segment contains code + compiled for static branch prediction */ + +#endif /* _MACHINE_EXEC_H_ */ diff --git a/sys/arch/hppa64/include/float.h b/sys/arch/hppa64/include/float.h new file mode 100644 index 00000000000..4260471309c --- /dev/null +++ b/sys/arch/hppa64/include/float.h @@ -0,0 +1,76 @@ +/* $OpenBSD: float.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)float.h 7.1 (Berkeley) 5/8/90 + */ + +#ifndef _HPPA_FLOAT_H_ +#define _HPPA_FLOAT_H_ + +#include <sys/cdefs.h> + +__BEGIN_DECLS +int __flt_rounds(void); +__END_DECLS + +#define FLT_RADIX 2 +#define FLT_ROUNDS __flt_rounds() + +#define FLT_MANT_DIG 24 +#define FLT_EPSILON 1.19209290E-07F +#define FLT_DIG 6 +#define FLT_MIN_EXP (-125) +#define FLT_MIN 1.17549435E-38F +#define FLT_MIN_10_EXP (-37) +#define FLT_MAX_EXP 128 +#define FLT_MAX 3.40282347E+38F +#define FLT_MAX_10_EXP 38 + +#define DBL_MANT_DIG 53 +#define DBL_EPSILON 2.2204460492503131E-16 +#define DBL_DIG 15 +#define DBL_MIN_EXP (-1021) +#define DBL_MIN 2.2250738585072014E-308 +#define DBL_MIN_10_EXP (-307) +#define DBL_MAX_EXP 1024 +#define DBL_MAX 1.7976931348623157E+308 +#define DBL_MAX_10_EXP 308 + +#define LDBL_MANT_DIG 113 +#define LDBL_EPSILON 1.9259299443872358530559779425849273E-34L +#define LDBL_DIG 33 +#define LDBL_MIN_EXP (-16381) +#define LDBL_MIN 3.3621031431120935062626778173217526026E-4932L +#define LDBL_MIN_10_EXP (-4931) +#define LDBL_MAX_EXP 16384 +#define LDBL_MAX 1.1897314953572317650857593266280070162E4932L +#define LDBL_MAX_10_EXP 4932 + +#endif /* _MACHINE_FLOAT_H_ */ diff --git a/sys/arch/hppa64/include/frame.h b/sys/arch/hppa64/include/frame.h new file mode 100644 index 00000000000..3be63ffa0a5 --- /dev/null +++ b/sys/arch/hppa64/include/frame.h @@ -0,0 +1,113 @@ +/* $OpenBSD: frame.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_FRAME_H_ +#define _MACHINE_FRAME_H_ + +/* + * Call frame definitions + */ +#define HPPA_FRAME_SIZE (128) +#define HPPA_FRAME_PSP (-8) +#define HPPA_FRAME_RP (-16) + +/* + * Macros to decode processor status word. + */ +#define HPPA_PC_PRIV_MASK 3 +#define HPPA_PC_PRIV_KERN 0 +#define HPPA_PC_PRIV_USER 3 +#define USERMODE(pc) ((((register_t)pc) & HPPA_PC_PRIV_MASK) != HPPA_PC_PRIV_KERN) +#define KERNMODE(pc) (((register_t)pc) & ~HPPA_PC_PRIV_MASK) + +/* + * + */ +#define HPPA_SID_MAX 0x7ffffe00 +#define HPPA_SID_KERNEL 0 +#define HPPA_PID_KERNEL 2 + +#ifndef _LOCORE +/* + * the trapframe is divided into two parts: + * one is saved while we are in the physical mode (beginning of the trap), + * and should be kept as small as possible, since all the interrupts will + * be lost during this phase, also it must be 64-bytes aligned, per + * pa-risc stack conventions, and its dependencies in the code (; + * the other part is filled out when we are already in the virtual mode, + * are able to catch interrupts (they are kept pending) and perform + * other trap activities (like tlb misses). + */ +struct trapframe { + unsigned long tf_flags; + unsigned long tf_r1; + unsigned long tf_rp; + unsigned long tf_r3; + unsigned long tf_r4; + unsigned long tf_r5; + unsigned long tf_r6; + unsigned long tf_r7; + unsigned long tf_r8; + unsigned long tf_r9; + unsigned long tf_r10; + unsigned long tf_r11; + unsigned long tf_r12; + unsigned long tf_r13; + unsigned long tf_r14; + unsigned long tf_r15; + unsigned long tf_r16; + unsigned long tf_r17; + unsigned long tf_r18; + unsigned long tf_args[8]; + unsigned long tf_dp; /* r27 */ + unsigned long tf_ret0; + unsigned long tf_ret1; + unsigned long tf_sp; + unsigned long tf_r31; + unsigned long tf_sr0; + unsigned long tf_sr1; + unsigned long tf_sr2; + unsigned long tf_sr3; + unsigned long tf_sr4; + unsigned long tf_sr5; + unsigned long tf_sr6; + unsigned long tf_sr7; + unsigned long tf_rctr; + unsigned long tf_ccr; /* cr10 */ + unsigned long tf_iioq[2]; + unsigned long tf_iisq[2]; + unsigned long tf_pidr1; + unsigned long tf_pidr2; + unsigned long tf_eiem; + unsigned long tf_eirr; + unsigned long tf_ior; + unsigned long tf_isr; + unsigned long tf_iir; + unsigned long tf_ipsw; + unsigned long tf_ci; /* cr24 */ + unsigned long tf_vtop; /* cr25 */ + unsigned long tf_cr30; /* pa(u) */ + unsigned long tf_cr27; /* user curthread */ + unsigned long tf_sar; + + unsigned long tf_pad[5]; +}; +#endif /* !_LOCORE */ + +#endif /* !_MACHINE_FRAME_H_ */ diff --git a/sys/arch/hppa64/include/ieee.h b/sys/arch/hppa64/include/ieee.h new file mode 100644 index 00000000000..dfd8044fd80 --- /dev/null +++ b/sys/arch/hppa64/include/ieee.h @@ -0,0 +1,137 @@ +/* $OpenBSD: ieee.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * This software was developed by the Computer Systems Engineering group + * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and + * contributed to Berkeley. + * + * All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Lawrence Berkeley Laboratory. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ieee.h 8.1 (Berkeley) 6/11/93 + */ + +/* + * ieee.h defines the machine-dependent layout of the machine's IEEE + * floating point. It does *not* define (yet?) any of the rounding + * mode bits, exceptions, and so forth. + */ + +/* + * Define the number of bits in each fraction and exponent. + * + * k k+1 + * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented + * + * (-exp_bias+1) + * as fractions that look like 0.fffff x 2 . This means that + * + * -126 + * the number 0.10000 x 2 , for instance, is the same as the normalized + * + * -127 -128 + * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero + * + * -129 + * in the fraction; to represent 2 , we need two, and so on. This + * + * (-exp_bias-fracbits+1) + * implies that the smallest denormalized number is 2 + * + * for whichever format we are talking about: for single precision, for + * + * -126 -149 + * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and + * + * -149 == -127 - 23 + 1. + */ +#define SNG_EXPBITS 8 +#define SNG_FRACBITS 23 + +#define DBL_EXPBITS 11 +#define DBL_FRACBITS 52 + +#ifdef notyet +#define E80_EXPBITS 15 +#define E80_FRACBITS 64 +#endif + +#define EXT_EXPBITS 15 +#define EXT_FRACBITS 112 + +struct ieee_single { + u_int sng_sign:1; + u_int sng_exp:8; + u_int sng_frac:23; +}; + +struct ieee_double { + u_int dbl_sign:1; + u_int dbl_exp:11; + u_int dbl_frach:20; + u_int dbl_fracl; +}; + +struct ieee_ext { + u_int ext_sign:1; + u_int ext_exp:15; + u_int ext_frach:16; + u_int ext_frachm; + u_int ext_fraclm; + u_int ext_fracl; +}; + +/* + * Floats whose exponent is in [1..INFNAN) (of whatever type) are + * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. + * Floats whose exponent is zero are either zero (iff all fraction + * bits are zero) or subnormal values. + * + * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its + * high fraction; if the bit is set, it is a `quiet NaN'. + */ +#define SNG_EXP_INFNAN 255 +#define DBL_EXP_INFNAN 2047 +#define EXT_EXP_INFNAN 32767 + +#if 0 +#define SNG_QUIETNAN (1 << 22) +#define DBL_QUIETNAN (1 << 19) +#define EXT_QUIETNAN (1 << 15) +#endif + +/* + * Exponent biases. + */ +#define SNG_EXP_BIAS 127 +#define DBL_EXP_BIAS 1023 +#define EXT_EXP_BIAS 16383 diff --git a/sys/arch/hppa64/include/ieeefp.h b/sys/arch/hppa64/include/ieeefp.h new file mode 100644 index 00000000000..d33f6ac542e --- /dev/null +++ b/sys/arch/hppa64/include/ieeefp.h @@ -0,0 +1,24 @@ +/* $OpenBSD: ieeefp.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Written by Miodrag Vallat. Public domain. + */ + +#ifndef _HPPA64_IEEEFP_H_ +#define _HPPA64_IEEEFP_H_ + +typedef int fp_except; +#define FP_X_INV 0x10 /* invalid operation exception */ +#define FP_X_DZ 0x08 /* divide-by-zero exception */ +#define FP_X_OFL 0x04 /* overflow exception */ +#define FP_X_UFL 0x02 /* underflow exception */ +#define FP_X_IMP 0x01 /* imprecise (loss of precision) */ + +typedef enum { + FP_RN=0, /* round to nearest representable number */ + FP_RZ=1, /* round to zero (truncate) */ + FP_RP=2, /* round toward positive infinity */ + FP_RM=3 /* round toward negative infinity */ +} fp_rnd; + +#endif /* _HPPA64_IEEEFP_H_ */ diff --git a/sys/arch/hppa64/include/internal_types.h b/sys/arch/hppa64/include/internal_types.h new file mode 100644 index 00000000000..2ceb6165937 --- /dev/null +++ b/sys/arch/hppa64/include/internal_types.h @@ -0,0 +1,7 @@ +/* $OpenBSD: internal_types.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ +/* Public domain */ + +#ifndef _MACHINE_INTERNAL_TYPES_H_ +#define _MACHINE_INTERNAL_TYPES_H_ + +#endif diff --git a/sys/arch/hppa64/include/iomod.h b/sys/arch/hppa64/include/iomod.h new file mode 100644 index 00000000000..04b20060d5f --- /dev/null +++ b/sys/arch/hppa64/include/iomod.h @@ -0,0 +1,3 @@ +/* $OpenBSD: iomod.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +#include <arch/hppa/include/iomod.h> diff --git a/sys/arch/hppa64/include/kcore.h b/sys/arch/hppa64/include/kcore.h new file mode 100644 index 00000000000..3f652493bee --- /dev/null +++ b/sys/arch/hppa64/include/kcore.h @@ -0,0 +1,28 @@ +/* $OpenBSD: kcore.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_KCORE_H_ +#define _MACHINE_KCORE_H_ + +typedef +struct cpu_kcore_hdr { + int dummy; +} cpu_kcore_hdr_t; + +#endif /* _MACHINE_KCORE_H_ */ diff --git a/sys/arch/hppa64/include/limits.h b/sys/arch/hppa64/include/limits.h new file mode 100644 index 00000000000..bc4736a98e1 --- /dev/null +++ b/sys/arch/hppa64/include/limits.h @@ -0,0 +1,55 @@ +/* $OpenBSD: limits.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)limits.h 8.3 (Berkeley) 1/4/94 + */ + +#ifndef _MACHINE_LIMITS_H_ +#define _MACHINE_LIMITS_H_ + +#define MB_LEN_MAX 32 /* Allow 31 bit UTF2 */ + +#if !defined(_ANSI_SOURCE) +#define SIZE_MAX ULONG_MAX /* max value for a size_t */ +#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */ + +#if !defined(_POSIX_SOURCE) +#define SIZE_T_MAX ULONG_MAX /* max value for a size_t */ + +/* GCC requires that quad constants be written as expressions. */ +#define UQUAD_MAX ((u_quad_t)0-1) /* max value for a uquad_t */ + /* max value for a quad_t */ +#define QUAD_MAX ((quad_t)(UQUAD_MAX >> 1)) +#define QUAD_MIN (-QUAD_MAX-1) /* min value for a quad_t */ + +#endif /* !_POSIX_SOURCE */ +#endif /* !_ANSI_SOURCE */ + +#endif /* _MACHINE_LIMITS_H_ */ diff --git a/sys/arch/hppa64/include/loadfile_machdep.h b/sys/arch/hppa64/include/loadfile_machdep.h new file mode 100644 index 00000000000..3ce4f899109 --- /dev/null +++ b/sys/arch/hppa64/include/loadfile_machdep.h @@ -0,0 +1,83 @@ +/* $OpenBSD: loadfile_machdep.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/*- + * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas and Jason R. Thorpe. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _HPPA64_LOADFILE_MACHDEP_H_ +#define _HPPA64_LOADFILE_MACHDEP_H_ + +#define BOOT_ELF +#define ELFSIZE 64 + +#define LOAD_KERNEL LOAD_ALL +#define COUNT_KERNEL COUNT_ALL + +#ifdef _STANDALONE + +#define LOADADDR(a) ((a) + offset) +#define ALIGNENTRY(a) 0 +#define READ(f, b, c) pread((f), (void *)LOADADDR(b), (c)) +#define BCOPY(s, d, c) vpbcopy((s), (void *)LOADADDR(d), (c)) +#define BZERO(d, c) pbzero((void *)LOADADDR(d), (c)) +#define WARN(a) (void)(printf a, \ + printf((errno ? ": %s\n" : "\n"), \ + strerror(errno))) +#define PROGRESS(a) (void) printf a +#define ALLOC(a) alloc(a) +#define FREE(a, b) free(a, b) + +#define vpbcopy bcopy +#define pbzero bzero +#define pread read + +#else + +#define LOADADDR(a) (((u_long)(a)) + offset) +#define ALIGNENTRY(a) ((u_long)(a)) +#define READ(f, b, c) read((f), (void *)LOADADDR(b), (c)) +#define BCOPY(s, d, c) memcpy((void *)LOADADDR(d), (void *)(s), (c)) +#define BZERO(d, c) memset((void *)LOADADDR(d), 0, (c)) +#define WARN(a) warn a +#define PROGRESS(a) /* nothing */ +#define ALLOC(a) malloc(a) +#define FREE(a, b) free(a) + +ssize_t vread(int, u_long, u_long *, size_t); +void vcopy(u_long, u_long, u_long *, size_t); +void vzero(u_long, u_long *, size_t); + +#endif +#endif /* ! _HPPA64_LOADFILE_MACHDEP_H_ */ diff --git a/sys/arch/hppa64/include/nvm.h b/sys/arch/hppa64/include/nvm.h new file mode 100644 index 00000000000..d050076e88b --- /dev/null +++ b/sys/arch/hppa64/include/nvm.h @@ -0,0 +1,74 @@ +/* $OpenBSD: nvm.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 1990, 1994 The University of Utah and + * the Computer Systems Laboratory at the University of Utah (CSL). + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Utah $Hdr: nvm.h 1.4 94/12/14$ + * Author: Jeff Forys, University of Utah CSL + */ + +#ifndef _MACHINE_NVM_H_ +#define _MACHINE_NVM_H_ + +/* + * The PDC provides access to Non-Volatile Memory (NVM). If this + * is implemented (it's HVERSION dependent), the first 256 bytes + * are formatted as follows: + * + * 0x000 +----------------------------+ + * | Implementation information | + * 0x024 +----------------------------+ + * | | + * | IPL information | + * | | + * 0x080 +----------------------------+ + * | | + * | | + * | OS Panic information | + * | | + * | | + * 0x100 +----------------------------+ + * + * It appears that there are at least 256 bytes of NVM, and only + * the "OS Panic information" is not architected. This means that + * we can use locations 0x80 - 0xFF for saving information across + * boots (e.g. boot flags and boot device). I think we should use + * the higher portions of this space first, to avoid conflicting + * with possible future HP-PA plans for the NVM. + * + * The PDC requires that NVM be read/written to in word multiples. + */ + +/* + * Boot flags and boot device (0xF4 - 0xFF). + */ + +#define NVM_BOOTDATA 0xF4 /* location of bootdata in NVM */ +#define NVM_BOOTMAGIC 0xACCEDE /* magic used for bootdata cksum */ +#define NVM_BOOTCKSUM(bd) \ + ((unsigned int) NVM_BOOTMAGIC + (bd).flags + (bd).device) + +struct bootdata { + unsigned int cksum; /* NVM_BOOTMAGIC + flags + device */ + unsigned int flags; /* boot flags */ + unsigned int device; /* boot device */ +}; + +#endif /* _MACHINE_NVM_H_ */ diff --git a/sys/arch/hppa64/include/param.h b/sys/arch/hppa64/include/param.h new file mode 100644 index 00000000000..a5a9b428918 --- /dev/null +++ b/sys/arch/hppa64/include/param.h @@ -0,0 +1,131 @@ +/* $OpenBSD: param.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 1988-1994, The University of Utah and + * the Computer Systems Laboratory at the University of Utah (CSL). + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Utah $Hdr: param.h 1.18 94/12/16$ + */ + +#include <machine/cpu.h> + +/* + * Machine dependent constants for PA-RISC. + */ + +#define _MACHINE hppa64 +#define MACHINE "hppa64" +#define _MACHINE_ARCH hppa64 +#define MACHINE_ARCH "hppa64" +#define MID_MACHINE MID_HPPA20 + +/* + * Round p (pointer or byte index) up to a correctly-aligned value for all + * data types (int, long, ...). The result is u_int and must be cast to + * any desired pointer type. + */ +#define ALIGNBYTES 7 +#define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES) +#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t) - 1)) == 0) + +#define PAGE_SIZE 4096 +#define PAGE_MASK (PAGE_SIZE-1) +#define PAGE_SHIFT 12 + +#define NBPG 4096 /* bytes/page */ +#define PGOFSET (NBPG-1) /* byte offset into page */ +#define PGSHIFT 12 /* LOG2(NBPG) */ + +#define KERNBASE 0x00000000 /* start of kernel virtual */ +#define BTOPKERNBASE ((u_long)KERNBASE >> PAGE_SHIFT) + +#define DEV_BSIZE 512 +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ +#define BLKDEV_IOSIZE 2048 +#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ + +#define MACHINE_STACK_GROWS_UP 1 /* stack grows to higher addresses */ + +#define SSIZE (4) /* initial stack size/NBPG */ +#define SINCR (1) /* increment of stack/NBPG */ + +#define USPACE (4 * NBPG) /* pages for user struct and kstack */ +#define USPACE_ALIGN (0) /* u-area alignment 0-none */ + +#ifndef MSGBUFSIZE +#define MSGBUFSIZE 2*NBPG /* default message buffer size */ +#endif + +/* + * Constants related to network buffer management. + * MCLBYTES must be no larger than the software page size, and, + * on machines that exchange pages of input or output buffers with mbuf + * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple + * of the hardware page size. + */ +#define MSIZE 256 /* size of an mbuf */ +#define MCLSHIFT 11 +#define MCLBYTES (1 << MCLSHIFT) /* large enough for ether MTU */ +#define MCLOFSET (MCLBYTES - 1) +#define NMBCLUSTERS 4096 /* map size, max cluster allocation */ + +/* + * Minimum and maximum sizes of the kernel malloc arena in PAGE_SIZE-sized + * logical pages. + */ +#define NKMEMPAGES_MIN_DEFAULT ((4 * 1024 * 1024) >> PAGE_SHIFT) +#define NKMEMPAGES_MAX_DEFAULT ((64 * 1024 * 1024) >> PAGE_SHIFT) + +/* pages ("clicks") (4096 bytes) to disk blocks */ +#define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT)) +#define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT)) + +/* pages to bytes */ +#define ctob(x) ((x) << PAGE_SHIFT) +#define btoc(x) (((x) + PAGE_MASK) >> PAGE_SHIFT) + +#define btodb(x) ((x) >> DEV_BSHIFT) +#define dbtob(x) ((x) << DEV_BSHIFT) + +/* + * Map a ``block device block'' to a file system block. + * This should be device dependent, and should use the bsize + * field from the disk label. + * For now though just use DEV_BSIZE. + */ +#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE)) + +/* + * Mach derived conversion macros + */ +#define hppa_round_page(x) ((((unsigned long)(x)) + NBPG - 1) & ~(NBPG-1)) +#define hppa_trunc_page(x) ((unsigned long)(x) & ~(NBPG-1)) + +#define btop(x) ((unsigned long)(x) >> PAGE_SHIFT) +#define ptob(x) ((unsigned long)(x) << PAGE_SHIFT) + +#ifndef _LOCORE +#define CONADDR conaddr +#define CONUNIT conunit +#define COM_FREQ 7372800 +extern hppa_hpa_t conaddr; +extern int conunit; +#endif + +#define __SWAP_BROKEN diff --git a/sys/arch/hppa64/include/pcb.h b/sys/arch/hppa64/include/pcb.h new file mode 100644 index 00000000000..ab366a4d14e --- /dev/null +++ b/sys/arch/hppa64/include/pcb.h @@ -0,0 +1,44 @@ +/* $OpenBSD: pcb.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_PCB_H_ +#define _MACHINE_PCB_H_ + +#include <machine/reg.h> + +struct pcb { + u_int64_t pcb_fpregs[HPPA_NFPREGS+1]; /* not in the trapframe */ + u_int64_t pcb_onfault; /* SW copy fault handler */ + vaddr_t pcb_uva; /* KVA for U-area */ + u_int64_t pcb_ksp; /* kernel sp for ctxsw */ + pa_space_t pcb_space; /* copy pmap_space, for asm's sake */ + +#if 0 /* imaginary part that is after user but in the same page */ + u_int32_t pcb_pad[53+768]; + u_int64_t pcb_frame[64]; /* the very end */ +#endif +}; + +struct md_coredump { + struct reg md_reg; + struct fpreg md_fpreg; +}; + + +#endif /* _MACHINE_PCB_H_ */ diff --git a/sys/arch/hppa64/include/pci_machdep.h b/sys/arch/hppa64/include/pci_machdep.h new file mode 100644 index 00000000000..9e122ad90ab --- /dev/null +++ b/sys/arch/hppa64/include/pci_machdep.h @@ -0,0 +1,82 @@ +/* $OpenBSD: pci_machdep.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_PCI_MACHDEP_H_ +#define _MACHINE_PCI_MACHDEP_H_ + +/* + * Types provided to machine-independent PCI code + */ +typedef struct hppa64_pci_chipset_tag *pci_chipset_tag_t; +typedef u_int pcitag_t; +typedef u_long pci_intr_handle_t; + +struct pci_attach_args; + +struct hppa64_pci_chipset_tag { + void *_cookie; + void (*pc_attach_hook)(struct device *, + struct device *, struct pcibus_attach_args *); + int (*pc_bus_maxdevs)(void *, int); + pcitag_t (*pc_make_tag)(void *, int, int, int); + void (*pc_decompose_tag)(void *, pcitag_t, int *, + int *, int *); + pcireg_t (*pc_conf_read)(void *, pcitag_t, int); + void (*pc_conf_write)(void *, pcitag_t, int, pcireg_t); + + int (*pc_intr_map)(struct pci_attach_args *, + pci_intr_handle_t *); + const char *(*pc_intr_string)(void *, pci_intr_handle_t); + void *(*pc_intr_establish)(void *, pci_intr_handle_t, + int, int (*)(void *), void *, char *); + void (*pc_intr_disestablish)(void *, void *); + + void *(*pc_alloc_parent)(struct device *, + struct pci_attach_args *, int); +}; + +/* + * Functions provided to machine-independent PCI code. + */ +#define pci_attach_hook(p, s, pba) \ + (*(pba)->pba_pc->pc_attach_hook)((p), (s), (pba)) +#define pci_bus_maxdevs(c, b) \ + (*(c)->pc_bus_maxdevs)((c)->_cookie, (b)) +#define pci_make_tag(c, b, d, f) \ + (*(c)->pc_make_tag)((c)->_cookie, (b), (d), (f)) +#define pci_decompose_tag(c, t, bp, dp, fp) \ + (*(c)->pc_decompose_tag)((c)->_cookie, (t), (bp), (dp), (fp)) +#define pci_conf_read(c, t, r) \ + (*(c)->pc_conf_read)((c)->_cookie, (t), (r)) +#define pci_conf_write(c, t, r, v) \ + (*(c)->pc_conf_write)((c)->_cookie, (t), (r), (v)) +#define pci_intr_map(p, ihp) \ + (*(p)->pa_pc->pc_intr_map)((p), (ihp)) +#define pci_intr_line(ih) (ih) +#define pci_intr_string(c, ih) \ + (*(c)->pc_intr_string)((c)->_cookie, (ih)) +#define pci_intr_establish(c, ih, l, h, a, nm) \ + (*(c)->pc_intr_establish)((c)->_cookie, (ih), (l), (h), (a), (nm)) +#define pci_intr_disestablish(c, iv) \ + (*(c)->pc_intr_disestablish)((c)->_cookie, (iv)) + +#define pciide_machdep_compat_intr_establish(a, b, c, d, e) (NULL) +#define pciide_machdep_compat_intr_disestablish(a, b) ((void)(a), (void)(b)) + +#endif /* _MACHINE_PCI_MACHDEP_H_ */ diff --git a/sys/arch/hppa64/include/pdc.h b/sys/arch/hppa64/include/pdc.h new file mode 100644 index 00000000000..89034c60e79 --- /dev/null +++ b/sys/arch/hppa64/include/pdc.h @@ -0,0 +1,3 @@ +/* $OpenBSD: pdc.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +#include <arch/hppa/include/pdc.h> diff --git a/sys/arch/hppa64/include/pmap.h b/sys/arch/hppa64/include/pmap.h new file mode 100644 index 00000000000..1014076b7e2 --- /dev/null +++ b/sys/arch/hppa64/include/pmap.h @@ -0,0 +1,117 @@ +/* $OpenBSD: pmap.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_PMAP_H_ +#define _MACHINE_PMAP_H_ + +#include <machine/pte.h> +#include <uvm/uvm_pglist.h> +#include <uvm/uvm_object.h> + +struct pmap { + simple_lock_data_t pm_lock; + int pm_refcount; + struct vm_page *pm_ptphint; + struct pglist pm_pglist; + volatile u_int32_t *pm_pdir; /* page dir (read-only after create) */ + pa_space_t pm_space; /* space id (read-only after create) */ + + struct pmap_statistics pm_stats; +}; +typedef struct pmap *pmap_t; + +struct pv_entry { /* locked by its list's pvh_lock */ + struct pv_entry *pv_next; + struct pmap *pv_pmap; /* the pmap */ + vaddr_t pv_va; /* the virtual address */ + struct vm_page *pv_ptp; /* the vm_page of the PTP */ +}; + +#ifdef _KERNEL + +extern struct pmap kernel_pmap_store; + +/* + * pool quickmaps + */ +#define pmap_map_direct(pg) ((vaddr_t)VM_PAGE_TO_PHYS(pg)) +#define pmap_unmap_direct(va) PHYS_TO_VM_PAGE((paddr_t)(va)) +#define __HAVE_PMAP_DIRECT + +/* + * according to the parisc manual aliased va's should be + * different by high 12 bits only. + */ +#define PMAP_PREFER(o,h) do { \ + vaddr_t pmap_prefer_hint; \ + pmap_prefer_hint = (*(h) & HPPA_PGAMASK) | ((o) & HPPA_PGAOFF); \ + if (pmap_prefer_hint < *(h)) \ + pmap_prefer_hint += HPPA_PGALIAS; \ + *(h) = pmap_prefer_hint; \ +} while(0) + +#define PMAP_GROWKERNEL +#define PMAP_STEAL_MEMORY + +#define pmap_sid2pid(s) (((s) + 1) << 1) +#define pmap_kernel() (&kernel_pmap_store) +#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) +#define pmap_update(pm) (void)(pm) +#define pmap_copy(dpmap,spmap,da,len,sa) + +#define pmap_clear_modify(pg) pmap_changebit(pg, 0, PTE_DIRTY) +#define pmap_clear_reference(pg) pmap_changebit(pg, PTE_REFTRAP, 0) +#define pmap_is_modified(pg) pmap_testbit(pg, PTE_DIRTY) +#define pmap_is_referenced(pg) pmap_testbit(pg, PTE_REFTRAP) +#define pmap_phys_address(ppn) ((ppn) << PAGE_SHIFT) + +#define pmap_proc_iflush(p,va,len) /* nothing */ +#define pmap_unuse_final(p) /* nothing */ + +void pmap_bootstrap(vaddr_t); +boolean_t pmap_changebit(struct vm_page *, pt_entry_t, pt_entry_t); +boolean_t pmap_testbit(struct vm_page *, pt_entry_t); +void pmap_write_protect(struct pmap *, vaddr_t, vaddr_t, vm_prot_t); +void pmap_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva); +void pmap_page_remove(struct vm_page *pg); + +static __inline void +pmap_page_protect(struct vm_page *pg, vm_prot_t prot) +{ + if ((prot & UVM_PROT_WRITE) == 0) { + if (prot & (UVM_PROT_RX)) + pmap_changebit(pg, 0, PTE_WRITE); + else + pmap_page_remove(pg); + } +} + +static __inline void +pmap_protect(struct pmap *pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot) +{ + if ((prot & UVM_PROT_WRITE) == 0) { + if (prot & (UVM_PROT_RX)) + pmap_write_protect(pmap, sva, eva, prot); + else + pmap_remove(pmap, sva, eva); + } +} + +#endif /* _KERNEL */ +#endif /* _MACHINE_PMAP_H_ */ diff --git a/sys/arch/hppa64/include/proc.h b/sys/arch/hppa64/include/proc.h new file mode 100644 index 00000000000..1197ef43208 --- /dev/null +++ b/sys/arch/hppa64/include/proc.h @@ -0,0 +1,43 @@ +/* $OpenBSD: proc.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)proc.h 7.1 (Berkeley) 5/15/91 + */ + +/* + * Machine-dependent part of the proc structure for hppa. + */ +struct mdproc { + struct trapframe *md_regs; /* registers on current frame */ + long md_flags; /* machine-dependent flags */ +}; + +/* md_flags */ + diff --git a/sys/arch/hppa64/include/profile.h b/sys/arch/hppa64/include/profile.h new file mode 100644 index 00000000000..36e8b335fe7 --- /dev/null +++ b/sys/arch/hppa64/include/profile.h @@ -0,0 +1,45 @@ +/* $OpenBSD: profile.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)profile.h 8.1 (Berkeley) 6/11/93 + */ + +#define _MCOUNT_DECL void _mcount + +#define MCOUNT + +#ifdef _KERNEL +/* + * Note that we assume splhigh() and splx() cannot call mcount() + * recursively. + */ +#define MCOUNT_ENTER s = splhigh() +#define MCOUNT_EXIT splx(s) +#endif /* _KERNEL */ diff --git a/sys/arch/hppa64/include/psl.h b/sys/arch/hppa64/include/psl.h new file mode 100644 index 00000000000..94be150eba0 --- /dev/null +++ b/sys/arch/hppa64/include/psl.h @@ -0,0 +1,94 @@ +/* $OpenBSD: psl.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_PSL_H_ +#define _MACHINE_PSL_H_ + +/* + * Rference: + * 1. PA-RISC 1.1 Architecture and Instruction Set Manual + * Hewlett Packard, 3rd Edition, February 1994; Part Number 09740-90039 + */ + +/* + * Processor Status Word Bit Positions (in PA-RISC bit order) + */ +#define PSL_Y_POS (0) +#define PSL_Z_POS (1) +#define PSL_W_POS (4) +#define PSL_E_POS (5) +#define PSL_S_POS (6) +#define PSL_T_POS (7) +#define PSL_H_POS (8) +#define PSL_L_POS (9) +#define PSL_N_POS (10) +#define PSL_X_POS (11) +#define PSL_B_POS (12) +#define PSL_C_POS (13) +#define PSL_V_POS (14) +#define PSL_M_POS (15) +#define PSL_CB_POS (16) +#define PSL_O_POS (24) +#define PSL_G_POS (25) +#define PSL_F_POS (26) +#define PSL_R_POS (27) +#define PSL_Q_POS (28) +#define PSL_P_POS (29) +#define PSL_D_POS (30) +#define PSL_I_POS (31) + +#define PSL_BITS "\020\001I\002D\003P\004Q\005R\006F\007G\010O" \ + "\021M\022V\023C\024B\025X\026N\027L\030H" \ + "\031T\032S\033E\034W\037Z\040Y" + +/* + * Processor Status Word Bit Values + */ +#define PSL_Y (1 << (31-PSL_Y_POS)) /* Data Debug Trap Disable */ +#define PSL_Z (1 << (31-PSL_Z_POS)) /* Instruction Debug Trap Disable */ +#define PSL_W (1 << (31-PSL_W_POS)) /* 64bit address decode enable */ +#define PSL_E (1 << (31-PSL_E_POS)) /* Little Endian Memory Access Enable */ +#define PSL_S (1 << (31-PSL_S_POS)) /* Secure Interval Timer */ +#define PSL_T (1 << (31-PSL_T_POS)) /* Taken Branch Trap Enable */ +#define PSL_H (1 << (31-PSL_H_POS)) /* Higher-privilege xfer Trap Enable */ +#define PSL_L (1 << (31-PSL_L_POS)) /* Lower-privilege xfer Trap Enable */ +#define PSL_N (1 << (31-PSL_N_POS)) /* Nullify */ +#define PSL_X (1 << (31-PSL_X_POS)) /* Data Memory Break Disable */ +#define PSL_B (1 << (31-PSL_B_POS)) /* Taken Branch */ +#define PSL_C (1 << (31-PSL_C_POS)) /* Instruction Address Translation */ +#define PSL_V (1 << (31-PSL_V_POS)) /* Divide Step Correction */ +#define PSL_M (1 << (31-PSL_M_POS)) /* High-priority Machine Check Mask */ +#define PSL_CB (1 << (31-PSL_CB_POS)) /* Carry/Borrow Bits */ +#define PSL_O (1 << (31-PSL_O_POS)) /* Force strong ordering (2.0) */ +#define PSL_G (1 << (31-PSL_G_POS)) /* Debug Trap Enable */ +#define PSL_F (1 << (31-PSL_F_POS)) /* Perfomance Monitor Interrupt */ +#define PSL_R (1 << (31-PSL_R_POS)) /* Recover Counter Enable */ +#define PSL_Q (1 << (31-PSL_Q_POS)) /* Interrupt State Collection Enable */ +#define PSL_P (1 << (31-PSL_P_POS)) /* Protection Identifier Validation */ +#define PSL_D (1 << (31-PSL_D_POS)) /* Data Address Translation Enable */ +#define PSL_I (1 << (31-PSL_I_POS)) /* External Interrupt, Power Failure + Interrupt, and Low-Priority Machine + Check Interrupt unmask */ + +/* + * Frequently Used PSW Values + */ +#define RESET_PSL (PSL_R | PSL_Q | PSL_P | PSL_D | PSL_I) + +#endif /* _MACHINE_PSL_H_ */ diff --git a/sys/arch/hppa64/include/pte.h b/sys/arch/hppa64/include/pte.h new file mode 100644 index 00000000000..4440b2da827 --- /dev/null +++ b/sys/arch/hppa64/include/pte.h @@ -0,0 +1,68 @@ +/* $OpenBSD: pte.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_PTE_H_ +#define _MACHINE_PTE_H_ + +#define SID_MASK (0x1ff) +#define SID_SHIFT (9) +#define PIE_MASK (0x1ff80000000UL) +#define PIE_SHIFT (PDE_SHIFT+10) +#define PDE_MASK (0x0007fe00000UL) +#define PDE_SHIFT (PTE_SHIFT+9) +#define PTE_MASK (0x000001ff000UL) +#define PTE_SHIFT PAGE_SHIFT +#define PTE_PAGE(pte) (((pte) & ~PTE_PGMASK) << 7) +#define TLB_PAGE(pg) (((pg) >> 7) & PTE_PGMASK) + +#define PTE_IFLUSH 0x8000000000000000UL /* software */ +#define PTE_DFLUSH 0x4000000000000000UL /* software */ +#define PTE_REFTRAP 0x2000000000000000UL /* used as a ref bit */ +#define PTE_DIRTY 0x1000000000000000UL +#define PTE_BREAK 0x0800000000000000UL +#define PTE_GATEWAY 0x04c0000000000000UL +#define PTE_EXEC 0x0200000000000000UL +#define PTE_WRITE 0x0100000000000000UL +#define PTE_READ 0x0000000000000000UL +#define PTE_USER 0x00f0000000000000UL +#define PTE_ACC_NONE 0x0730000000000000UL +#define PTE_ACC_MASK 0x07f0000000000000UL +#define PTE_UNCACHABLE 0x0008000000000000UL +#define PTE_ORDER 0x0004000000000000UL +#define PTE_PREDICT 0x0002000000000000UL +#define PTE_WIRED 0x0001000000000000UL /* software */ +#define PTE_PGMASK 0x0000001fffffffe0UL +#define PTE_PG4K 0x0000000000000000UL +#define PTE_PG16K 0x0000000000000001UL +#define PTE_PG64K 0x0000000000000002UL +#define PTE_PG256K 0x0000000000000003UL +#define PTE_PG1M 0x0000000000000004UL +#define PTE_PG4M 0x0000000000000005UL +#define PTE_PG16M 0x0000000000000006UL +#define PTE_PG64M 0x0000000000000007UL + +#define PTE_GETBITS(pte) ((pte) >> 48) +#define PTE_BITS \ + "\020\01H\02P\03O\04UC\05U\010W\11X\12G\014B\015D\016REF\017FD\020FI" + +#ifndef _LOCORE +typedef u_int64_t pt_entry_t; +#endif + +#endif /* _MACHINE_PTE_H_ */ diff --git a/sys/arch/hppa64/include/ptrace.h b/sys/arch/hppa64/include/ptrace.h new file mode 100644 index 00000000000..a48a429b5a1 --- /dev/null +++ b/sys/arch/hppa64/include/ptrace.h @@ -0,0 +1,27 @@ +/* $OpenBSD: ptrace.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * MD ptrace definitions + */ +#define PT_STEP (PT_FIRSTMACH + 0) +#define PT_GETREGS (PT_FIRSTMACH + 1) +#define PT_SETREGS (PT_FIRSTMACH + 2) +#define PT_GETFPREGS (PT_FIRSTMACH + 3) +#define PT_SETFPREGS (PT_FIRSTMACH + 4) diff --git a/sys/arch/hppa64/include/rbus_machdep.h b/sys/arch/hppa64/include/rbus_machdep.h new file mode 100644 index 00000000000..963e54b89ff --- /dev/null +++ b/sys/arch/hppa64/include/rbus_machdep.h @@ -0,0 +1,34 @@ +/* $OpenBSD: rbus_machdep.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +static __inline int +md_space_map(bus_space_tag_t t, bus_addr_t bpa, bus_size_t size, int flags, bus_space_handle_t *bshp) +{ + if (bshp) + *(bshp) = bpa; + + return (0); +} + +#define md_space_unmap(t,bsh,s,addrp) do { *(addrp) = (bsh); } while (0) + +struct pci_attach_args; + +#define rbus_pccbb_parent_mem(d, p) (*(p)->pa_pc->pc_alloc_parent)((d), (p), 0) +#define rbus_pccbb_parent_io(d, p) (*(p)->pa_pc->pc_alloc_parent)((d), (p), 1) diff --git a/sys/arch/hppa64/include/reg.h b/sys/arch/hppa64/include/reg.h new file mode 100644 index 00000000000..ce4cc5add6f --- /dev/null +++ b/sys/arch/hppa64/include/reg.h @@ -0,0 +1,93 @@ +/* $OpenBSD: reg.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ +/* + * Copyright (c) 1990,1994 The University of Utah and + * the Computer Systems Laboratory at the University of Utah (CSL). + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Utah $Hdr: regs.h 1.6 94/12/14$ + * Author: Bob Wheeler, University of Utah CSL + */ + +#ifndef _MACHINE_REG_H_ +#define _MACHINE_REG_H_ + +/* + * constants for registers for use with the following routines: + * + * void mtctl(reg, value) - move to control register + * int mfctl(reg) - move from control register + * int mtsp(sreg, value) - move to space register + * int mfsr(sreg) - move from space register + */ + +#define CR_RCTR 0 +#define CR_PIDR1 8 +#define CR_PIDR2 9 +#define CR_CCR 10 +#define CR_SAR 11 +#define CR_PIDR3 12 +#define CR_PIDR4 13 +#define CR_IVA 14 +#define CR_EIEM 15 +#define CR_ITMR 16 +#define CR_PCSQ 17 +#define CR_PCOQ 18 +#define CR_IIR 19 +#define CR_ISR 20 +#define CR_IOR 21 +#define CR_IPSW 22 +#define CR_EIRR 23 +#define CR_CPUINFO 24 +#define CR_VTOP 25 +#define CR_UPADDR 30 /* paddr of U-area of curproc */ +#define CR_TR7 31 + +#define HPPA_NREGS (32) +#define HPPA_NFPREGS (33) /* 33rd is used for r0 in fpemul */ + +#ifndef _LOCORE + +struct reg { + u_int64_t r_regs[HPPA_NREGS]; /* r0 is sar */ + u_int64_t r_pc; + u_int64_t r_npc; +}; + +struct fpreg { + u_int64_t fpr_regs[HPPA_NFPREGS]; +}; +#endif /* !_LOCORE */ + +#endif /* _MACHINE_REG_H_ */ diff --git a/sys/arch/hppa64/include/reloc.h b/sys/arch/hppa64/include/reloc.h new file mode 100644 index 00000000000..6c32cad2433 --- /dev/null +++ b/sys/arch/hppa64/include/reloc.h @@ -0,0 +1,123 @@ +/* $OpenBSD: reloc.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_RELOC_H_ +#define _MACHINE_RELOC_H_ + +/* pa1 compatibility */ +#define RELOC_DLTREL21L RELOC_GPREL21L +#define RELOC_DLTREL14R RELOC_GPREL14R +#define RELOC_DLTIND21L RELOC_LTOFF21L +#define RELOC_DLTIND14R RELOC_LTOFF14R +#define RELOC_DLTIND14F RELOC_LTOFF14F +#define RELOC_DLTREL14WR RELOC_GPREL14WR +#define RELOC_DLTREL14DR RELOC_GPREL14DR +#define RELOC_DLTIND14WR RELOC_LTOFF14WR +#define RELOC_DLTIND14DR RELOC_LTOFF14DR + + +enum reloc_type { + RELOC_NONE = 0, + RELOC_DIR32, /* symbol + addend*/ + RELOC_DIR21L, /* LR(symbol, addend) */ + RELOC_DIR17R, /* RR(symbol, addend) */ + RELOC_DIR17F, /* symbol + addend */ + RELOC_DIR14R = 6, /* RR(symbol, addend) */ + RELOC_PCREL32 = 9, /* pa2: symbol - PC - 8 + addend */ + RELOC_PCREL21L, /* L(symbol - PC - 8 + addend */ + RELOC_PCREL17R, /* R(symbol - PC - 8 + addend */ + RELOC_PCREL17F, /* symbol - PC - 8 + addend */ + RELOC_PCREL17C, /* pa1: symbol - PC - 8 + addend */ + RELOC_PCREL14R, /* R(symbol - PC - 8 + addend */ + RELOC_DPREL21L = 18, /* pa1: LR(symbol - GP, addend */ + RELOC_DPREL14WR, /* pa1: RR(symbol - GP, addend */ + RELOC_DPREL14DR, /* pa1: RR(symbol - GP, addend */ + RELOC_DPREL14R, /* pa1: RR(symbol - GP, addend */ + RELOC_GPREL21L = 26, /* LR(symbol - GP, addend */ + RELOC_GPREL14R = 30, /* RR(symbol - GP, addend */ + RELOC_LTOFF21L = 34, /* L(ltoff(symbol + addend)) */ + RELOC_LTOFF14R = 38, /* R(ltoff(symbol + addend)) */ + RELOC_LTOFF14F, /* pa1: ltoff(symbol + addend) */ + RELOC_SETBASE, /* no relocation; base = symbol */ + RELOC_SECREL32, /* symbol - SECT + addend */ + RELOC_BASEREL21L, /* pa1: LR(symbol - base, addend) */ + RELOC_BASEREL17R, /* pa1: RR(symbol - base, addend) */ + RELOC_BASEREL14R = 46, /* pa1: RR(symbol - base, addend) */ + RELOC_SEGBASE = 48, /* no relocation; SB = symbol */ + RELOC_SEGREL32, /* symbol - SB + addend */ + RELOC_PLTOFF21L, /* LR(pltoff(symbol), addend */ + RELOC_PLTOFF14R = 54, /* RR(pltoff(symbol), addend */ + RELOC_PLTOFF14F, /* pa1: pltoff(symbol) + addend */ + RELOC_LTOFF_FPTR32 = 57,/* pa2: ltoff(fptr(symbol + addend)) */ + RELOC_LTOFF_FPTR21L, /* pa2: L(ltoff(fptr(symbol + addend))) */ + RELOC_LTOFF_FPTR14R= 62,/* pa2: R(ltoff(fptr(symbol + addend))) */ + RELOC_FPTR64 = 64, /* pa2: fptr(symbol + addend) */ + RELOC_PLABEL32, /* pa1: fptr(symbol) */ + RELOC_PCREL64 = 72, /* pa2: symbol - PC - 8 + addend */ + RELOC_PCREL22C, /* pa1: symbol - PC - 8 + addend */ + RELOC_PCREL22F, /* symbol - PC - 8 + addend */ + RELOC_PCREL14WR, /* R(symbol - PC - 8 + addend) */ + RELOC_PCREL14DR, /* R(symbol - PC - 8 + addend) */ + RELOC_PCREL16F, /* pa2: symbol - PC - 8 + addend */ + RELOC_PCREL16WF, /* pa2: symbol - PC - 8 + addend */ + RELOC_PCREL16DF, /* pa2: symbol - PC - 8 + addend */ + RELOC_DIR64, /* pa2: symbol + addend */ + RELOC_DIR14WR = 83, /* RR(symbol, addend) */ + RELOC_DIR14DR, /* RR(symbol, addend) */ + RELOC_DIR16F, /* pa2: symbol + addend */ + RELOC_DIR16WF, /* pa2: symbol + addend */ + RELOC_DIR16DF, /* pa2: symbol + addend */ + RELOC_GPREL64, /* pa2: symbol - GP + addend */ + RELOC_GPREL14WR = 91, /* RR(symbol - GP, addend) */ + RELOC_GPREL14DR, /* RR(symbol - GP, addend) */ + RELOC_GPREL16F, /* pa2: symbol - GP + addend */ + RELOC_GPREL16WF, /* pa2: symbol - GP + addend */ + RELOC_GPREL16DF, /* pa2: symbol - GP + addend */ + RELOC_LTOFF64 = 96, /* pa2: ltoff(symbol + addend) */ + RELOC_LTOFF14WR = 99, /* R(ltoff(symbol + addend)) */ + RELOC_LTOFF14DR, /* R(ltoff(symbol + addend)) */ + RELOC_LTOFF16F, /* pa2: ltoff(symbol + addend) */ + RELOC_LTOFF16WF, /* pa2: ltoff(symbol + addend) */ + RELOC_LTOFF16DF, /* pa2: ltoff(symbol + addend) */ + RELOC_SECREL64, /* pa2: symbol - SECT + addend */ + RELOC_BASEREL14WR=107, /* pa1: RR(symbol - base, addend */ + RELOC_BASEREL14DR, /* pa1: RR(symbol - base, addend */ + RELOC_SEGREL64 = 112, /* pa2: symbol - SB + addend */ + RELOC_PLTOFF14WR =115, /* RR(pltoff(symbol) + addend) */ + RELOC_PLTOFF14DR, /* RR(pltoff(symbol) + addend) */ + RELOC_PLTOFF16F, /* pa2: pltoff(symbol) + addend */ + RELOC_PLTOFF16WF, /* pa2: pltoff(symbol) + addend */ + RELOC_PLTOFF16DF, /* pa2: pltoff(symbol) + addend */ + RELOC_LTOFF_FPTR64, /* pa2: ltoff(fptr(symbol + addend)) */ + RELOC_LTOFF_FPTR14WR=123,/* pa2: R(ltoff(fptr(symbol + addend) */ + RELOC_LTOFF_FPTR14DR, /* pa2: R(ltoff(fptr(symbol + addend) */ + RELOC_LTOFF_FPTR16F, /* pa2: ltoff(fptr(symbol + addend)) */ + RELOC_LTOFF_FPTR16WF, /* pa2: ltoff(fptr(symbol + addend)) */ + RELOC_LTOFF_FPTR16DF, /* pa2: ltoff(fptr(symbol + addend)) */ + RELOC_LORESERVE, /* reserved for environment-specific use */ + RELOC_COPY = 128, + RELOC_IPLT, + RELOC_EPLT, + RELOC_GDATA, + RELOC_JMPSLOT, + RELOC_RELATIVE, + RELOC_HIRESERVE = 255 +}; + +#endif /* _MACHINE_RELOC_H_ */ diff --git a/sys/arch/hppa64/include/setjmp.h b/sys/arch/hppa64/include/setjmp.h new file mode 100644 index 00000000000..aee122ff95e --- /dev/null +++ b/sys/arch/hppa64/include/setjmp.h @@ -0,0 +1,7 @@ +/* $OpenBSD: setjmp.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * machine/setjmp.h: machine dependent setjmp-related information. + */ + +#define _JBLEN 48 /* size, in longs, of a jmp_buf */ diff --git a/sys/arch/hppa64/include/signal.h b/sys/arch/hppa64/include/signal.h new file mode 100644 index 00000000000..c09fcd73ea1 --- /dev/null +++ b/sys/arch/hppa64/include/signal.h @@ -0,0 +1,57 @@ +/* $OpenBSD: signal.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 1994, The University of Utah and + * the Computer Systems Laboratory at the University of Utah (CSL). + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Utah $Hdr: signal.h 1.3 94/12/16$ + */ + +#ifndef _HPPA64_SIGNAL_H_ +#define _HPPA64_SIGNAL_H_ + +/* + * Machine-dependent signal definitions + */ + +typedef int sig_atomic_t; + +#ifndef _ANSI_SOURCE +#include <machine/trap.h> + +/* + * Information pushed on stack when a signal is delivered. + * This is used by the kernel to restore state following + * execution of the signal handler. It is also made available + * to the handler to allow it to restore state properly if + * a non-standard exit is performed. + */ +struct sigcontext { + unsigned long sc_onstack; /* sigstack state to restore */ + unsigned long sc_mask; /* signal mask to restore */ + unsigned long sc_ps; /* psl to restore */ + unsigned long sc_fp; /* fp to restore */ + unsigned long sc_pcoqh; /* pc offset queue (head) to restore */ + unsigned long sc_pcoqt; /* pc offset queue (tail) to restore */ + unsigned long sc_resv[2]; + unsigned long sc_regs[32]; + unsigned long sc_fpregs[64]; +}; +#endif /* !_ANSI_SOURCE */ +#endif /* !_HPPA64_SIGNAL_H_ */ diff --git a/sys/arch/hppa64/include/spinlock.h b/sys/arch/hppa64/include/spinlock.h new file mode 100644 index 00000000000..d9e362736c5 --- /dev/null +++ b/sys/arch/hppa64/include/spinlock.h @@ -0,0 +1,10 @@ +/* $OpenBSD: spinlock.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +#ifndef _MACHINE_SPINLOCK_H_ +#define _MACHINE_SPINLOCK_H_ + +#define _SPINLOCK_UNLOCKED (1) +#define _SPINLOCK_LOCKED (0) +typedef long _spinlock_lock_t; + +#endif diff --git a/sys/arch/hppa64/include/stdarg.h b/sys/arch/hppa64/include/stdarg.h new file mode 100644 index 00000000000..5d0e1a203d9 --- /dev/null +++ b/sys/arch/hppa64/include/stdarg.h @@ -0,0 +1,62 @@ +/* $OpenBSD: stdarg.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 + */ + +#ifndef _MACHINE_STDARG_H_ +#define _MACHINE_STDARG_H_ + +typedef double *va_list; + +#ifdef __GNUC__ +#define va_start(ap,lastarg) ((ap) = (va_list)__builtin_saveregs()) +#else +#define va_start(ap,lastarg) __builtin_va_start(ap, &lastarg) +#endif + +#define va_arg(ap,type) \ + (sizeof(type) > 8 ? \ + ((ap = (va_list) ((char *)ap - sizeof (int))), \ + (*((type *) (void *) (*((int *) (ap)))))): \ + ((ap = (va_list) ((long)((char *)ap - sizeof (type)) & \ + (sizeof(type) > 4 ? ~0x7 : ~0x3))),\ + (*((type *) (void *) ((char *)ap + ((8 - sizeof(type)) % 4)))))) + +#if !defined(_ANSI_SOURCE) && \ + (!defined(_POSIX_C_SOURCE) && !defined(_XOPEN_SOURCE) || \ + defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L) +#define va_copy(dest, src) \ + ((dest) = (src)) +#endif + +#define va_end(ap) + +#endif /* !_MACHINE_STDARG_H */ diff --git a/sys/arch/hppa64/include/trap.h b/sys/arch/hppa64/include/trap.h new file mode 100644 index 00000000000..16014a425b2 --- /dev/null +++ b/sys/arch/hppa64/include/trap.h @@ -0,0 +1,91 @@ +/* $OpenBSD: trap.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 2005 Michael Shalayeff + * All rights reserved. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN + * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _MACHINE_TRAP_H_ +#define _MACHINE_TRAP_H_ + +/* + * This is PA-RISC trap types per 1.1 specs, see .c files for references. + */ +#define T_NONEXIST 0 /* invalid interrupt vector */ +#define T_HPMC 1 /* high priority machine check */ +#define T_POWERFAIL 2 /* power failure */ +#define T_RECOVERY 3 /* recovery counter */ +#define T_INTERRUPT 4 /* external interrupt */ +#define T_LPMC 5 /* low-priority machine check */ +#define T_ITLBMISS 6 /* instruction TLB miss fault */ +#define T_IPROT 7 /* instruction protection */ +#define T_ILLEGAL 8 /* Illegal instruction */ +#define T_IBREAK 9 /* break instruction */ +#define T_PRIV_OP 10 /* privileged operation */ +#define T_PRIV_REG 11 /* privileged register */ +#define T_OVERFLOW 12 /* overflow */ +#define T_CONDITION 13 /* conditional */ +#define T_EXCEPTION 14 /* assist exception */ +#define T_DTLBMISS 15 /* data TLB miss */ +#define T_ITLBMISSNA 16 /* ITLB non-access miss */ +#define T_DTLBMISSNA 17 /* DTLB non-access miss */ +#define T_DPROT 18 /* data protection/rights/alignment <7100 */ +#define T_DBREAK 19 /* data break */ +#define T_TLB_DIRTY 20 /* TLB dirty bit */ +#define T_PAGEREF 21 /* page reference */ +#define T_EMULATION 22 /* assist emulation */ +#define T_HIGHERPL 23 /* higher-privelege transfer */ +#define T_LOWERPL 24 /* lower-privilege transfer */ +#define T_TAKENBR 25 /* taken branch */ +#define T_DATACC 26 /* data access rights >=7100 */ +#define T_DATAPID 27 /* data protection ID >=7100 */ +#define T_DATALIGN 28 /* unaligned data ref */ +#define T_PERFMON 29 /* performance monitor interrupt */ +#define T_IDEBUG 30 /* debug SFU interrupt */ +#define T_DDEBUG 31 /* debug SFU interrupt */ + +/* + * Reserved range for traps is 0-63, place user flag at 6th bit + */ +#define T_USER_POS 57 +#define T_USER (1 << (63 - T_USER_POS)) + +/* + * Various trap frame flags. + */ +#define TFF_LAST_POS 40 +#define TFF_SYS_POS 41 +#define TFF_INTR_POS 42 + +#define TFF_LAST (1 << (63 - TFF_LAST_POS)) +#define TFF_SYS (1 << (63 - TFF_SYS_POS)) +#define TFF_INTR (1 << (63 - TFF_INTR_POS)) + +/* + * Define this for pretty printings of trapflags. + */ +#define T_BITS "\020\07user\036intr\037itlb\040last" + +/* + * These are break instruction entry points. + */ +/* im5 */ +#define HPPA_BREAK_KERNEL 0 +/* im13 */ +#define HPPA_BREAK_KGDB 5 +#define HPPA_BREAK_GET_PSW 9 +#define HPPA_BREAK_SET_PSW 10 + +#endif /* _MACHINE_TRAP_H_ */ diff --git a/sys/arch/hppa64/include/types.h b/sys/arch/hppa64/include/types.h new file mode 100644 index 00000000000..b098db4f83c --- /dev/null +++ b/sys/arch/hppa64/include/types.h @@ -0,0 +1,81 @@ +/* $OpenBSD: types.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/*- + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)types.h 8.3 (Berkeley) 1/5/94 + */ + +#ifndef _MACHINE_TYPES_H_ +#define _MACHINE_TYPES_H_ + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +typedef struct label_t { + int lbl_rp; + int lbl_sp; + int lbl_s[17]; + int lbl_ss[1]; + double lbl_sf[10]; /* hp800:fr12-fr15, hp700:fr12-fr21 */ +} label_t; + +typedef unsigned long hppa_hpa_t; +typedef unsigned long hppa_spa_t; +typedef unsigned int pa_space_t; +typedef unsigned long vaddr_t; +typedef unsigned long vsize_t; +typedef unsigned long paddr_t; +typedef unsigned long psize_t; +#endif + +/* + * Basic integral types. Omit the typedef if + * not possible for a machine/compiler combination. + */ +#define __BIT_TYPES_DEFINED__ +typedef __signed char int8_t; +typedef unsigned char u_int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short u_int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int u_int32_t; +typedef unsigned int uint32_t; +typedef long int64_t; +typedef unsigned long u_int64_t; +typedef unsigned long uint64_t; + +typedef int64_t register_t; + +typedef long int __intptr_t; +typedef unsigned long int __uintptr_t; + +#define __HAVE_DEVICE_REGISTER +#define __HAVE_CPUINFO + +#endif /* _MACHINE_TYPES_H_ */ diff --git a/sys/arch/hppa64/include/varargs.h b/sys/arch/hppa64/include/varargs.h new file mode 100644 index 00000000000..f0ddb6d4709 --- /dev/null +++ b/sys/arch/hppa64/include/varargs.h @@ -0,0 +1,17 @@ +/* $OpenBSD: varargs.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +#ifndef _MACHINE_VARARGS_H_ +#define _MACHINE_VARARGS_H_ + +#include <machine/stdarg.h> + +#define __va_ellipsis ... + +#define va_alist __builtin_va_alist +#define va_dcl long __builtin_va_alist; __va_ellipsis + +#undef va_start +#define va_start(ap) \ + ((ap) = (va_list)&__builtin_va_alist) + +#endif /* !_MACHINE_VARARGS_H */ diff --git a/sys/arch/hppa64/include/vmparam.h b/sys/arch/hppa64/include/vmparam.h new file mode 100644 index 00000000000..88e16e672b4 --- /dev/null +++ b/sys/arch/hppa64/include/vmparam.h @@ -0,0 +1,105 @@ +/* $OpenBSD: vmparam.h,v 1.1 2005/04/01 10:40:48 mickey Exp $ */ + +/* + * Copyright (c) 1988-1994, The University of Utah and + * the Computer Systems Laboratory at the University of Utah (CSL). + * All rights reserved. + * + * Permission to use, copy, modify and distribute this software is hereby + * granted provided that (1) source code retains these copyright, permission, + * and disclaimer notices, and (2) redistributions including binaries + * reproduce the notices in supporting documentation, and (3) all advertising + * materials mentioning features or use of this software display the following + * acknowledgement: ``This product includes software developed by the + * Computer Systems Laboratory at the University of Utah.'' + * + * THE UNIVERSITY OF UTAH AND CSL ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS + * IS" CONDITION. THE UNIVERSITY OF UTAH AND CSL DISCLAIM ANY LIABILITY OF + * ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. + * + * CSL requests users of this software to return to csl-dist@cs.utah.edu any + * improvements that they make and grant CSL redistribution rights. + * + * Utah $Hdr: vmparam.h 1.16 94/12/16$ + */ + +#ifndef _MACHINE_VMPARAM_H_ +#define _MACHINE_VMPARAM_H_ + +/* + * Machine dependent constants for HP PA + */ +/* + * USRTEXT is the start of the user text/data space, while USRSTACK + * is the bottm (start) of the user stack. + */ +#define USRTEXT PAGE_SIZE /* Start of user .text */ +#define USRSTACK 0x68FF3000 /* Start of user stack */ +#define SYSCALLGATE 0xC0000000 /* syscall gateway page */ + +/* + * Virtual memory related constants, all in bytes + */ +#ifndef MAXTSIZ +#define MAXTSIZ (64*1024*1024) /* max text size */ +#endif +#ifndef DFLDSIZ +#define DFLDSIZ (16*1024*1024) /* initial data size limit */ +#endif +#ifndef MAXDSIZ +#define MAXDSIZ (1*1024*1024*1024) /* max data size */ +#endif +#ifndef DFLSSIZ +#define DFLSSIZ (512*1024) /* initial stack size limit */ +#endif +#ifndef MAXSSIZ +#define MAXSSIZ (32*1024*1024) /* max stack size */ +#endif + +#ifndef USRIOSIZE +#define USRIOSIZE ((2*HPPA_PGALIAS)/PAGE_SIZE) /* 2mb */ +#endif + +/* + * PTEs for system V style shared memory. + * This is basically slop for kmempt which we actually allocate (malloc) from. + */ +#ifndef SHMMAXPGS +#define SHMMAXPGS 8192 /* 32mb */ +#endif + +#define VM_MIN_ADDRESS (0UL) +#define VM_MAXUSER_ADDRESS (0x20000000000UL) +#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS +#define VM_MIN_KERNEL_ADDRESS (0x1000000000UL) +#define VM_MAX_KERNEL_ADDRESS (0x10f0000000UL) + +/* virtual sizes (bytes) for various kernel submaps */ +#define VM_PHYS_SIZE (USRIOSIZE*PAGE_SIZE) + +#define VM_PHYSSEG_MAX 8 /* this many physmem segments */ +#define VM_PHYSSEG_STRAT VM_PSTRAT_BIGFIRST + +#define VM_PHYSSEG_NOADD /* XXX until uvm code is fixed */ + +#define VM_NFREELIST 2 +#define VM_FREELIST_DEFAULT 0 +#define VM_FREELIST_ARCH 1 + +#if defined(_KERNEL) && !defined(_LOCORE) +#define __HAVE_VM_PAGE_MD +struct pv_entry; +struct vm_page_md { + struct simplelock pvh_lock; /* locks every pv on this list */ + struct pv_entry *pvh_list; /* head of list (locked by pvh_lock) */ + u_int pvh_attrs; /* to preserve ref/mod */ +}; + +#define VM_MDPAGE_INIT(pg) do { \ + simple_lock_init(&(pg)->mdpage.pvh_lock); \ + (pg)->mdpage.pvh_list = NULL; \ + (pg)->mdpage.pvh_attrs = 0; \ +} while (0) +#endif + +#endif /* _MACHINE_VMPARAM_H_ */ |