diff options
author | dfr <dfr@FreeBSD.org> | 1998-06-10 10:57:29 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 1998-06-10 10:57:29 +0000 |
commit | 224577d6cf4d0daf37dddd81b9f9c646ad2be083 (patch) | |
tree | 345e0ea224736af311f2e28c0acb268d809bff9c /sys/alpha/include | |
parent | 2e6fba7d51b32033eec1fc27efaa0f8e840825fe (diff) | |
download | FreeBSD-src-224577d6cf4d0daf37dddd81b9f9c646ad2be083.zip FreeBSD-src-224577d6cf4d0daf37dddd81b9f9c646ad2be083.tar.gz |
Add initial support for the FreeBSD/alpha kernel. This is very much a
work in progress and has never booted a real machine. Initial
development and testing was done using SimOS (see
http://simos.stanford.edu for details). On the SimOS simulator, this
port successfully reaches single-user mode and has been tested with
loads as high as one copy of /bin/ls :-).
Obtained from: partly from NetBSD/alpha
Diffstat (limited to 'sys/alpha/include')
27 files changed, 2208 insertions, 165 deletions
diff --git a/sys/alpha/include/alpha_cpu.h b/sys/alpha/include/alpha_cpu.h index 267b120..9bd97f4 100644 --- a/sys/alpha/include/alpha_cpu.h +++ b/sys/alpha/include/alpha_cpu.h @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: alpha_cpu.h,v 1.1 1998/01/10 10:13:13 jb Exp $ */ /* From: NetBSD: alpha_cpu.h,v 1.15 1997/09/20 19:02:34 mjacob Exp */ /* @@ -183,8 +183,12 @@ struct alpha_logout_area { * NOTE THAT THESE DEFINITIONS MAY CHANGE IN FUTURE ALPHA CPUS! */ -#define ALPHA_PGSHIFT 13 +#define ALPHA_PGSHIFT 13 /* bits that index within page */ +#define ALPHA_PTSHIFT 10 /* bits that index within page tables */ #define ALPHA_PGBYTES (1 << ALPHA_PGSHIFT) +#define ALPHA_L3SHIFT ALPHA_PGSHIFT +#define ALPHA_L2SHIFT (ALPHA_L3SHIFT+ALPHA_PTSHIFT) +#define ALPHA_L1SHIFT (ALPHA_L2SHIFT+ALPHA_PTSHIFT) #define ALPHA_USEG_BASE 0 /* virtual */ #define ALPHA_USEG_END 0x000003ffffffffff @@ -218,8 +222,8 @@ struct alpha_logout_area { #define ALPHA_PTE_PFN 0xffffffff00000000 -#define ALPHA_PTE_TO_PFN(pte) ((pte) >> 32) -#define ALPHA_PTE_FROM_PFN(pfn) ((pfn) << 32) +#define ALPHA_PTE_TO_PFN(pte) ((u_long)(pte) >> 32) +#define ALPHA_PTE_FROM_PFN(pfn) ((u_long)(pfn) << 32) typedef unsigned long alpha_pt_entry_t; @@ -280,6 +284,7 @@ typedef unsigned long alpha_pt_entry_t; #define ALPHA_IMPLVER_EV5 1 /* EV5/EV56/PCA56 */ #define ALPHA_IMPLVER_EV6 2 /* EV6 */ + /* * Stubs for Alpha instructions normally inaccessible from C. */ @@ -307,6 +312,7 @@ unsigned long alpha_pal_rdmces __P((void)); unsigned long alpha_pal_rdps __P((void)); unsigned long alpha_pal_rdusp __P((void)); unsigned long alpha_pal_rdval __P((void)); +unsigned long alpha_pal_swpctx __P((unsigned long)); unsigned long alpha_pal_swpipl __P((unsigned long)); unsigned long _alpha_pal_swpipl __P((unsigned long)); /* for profiling */ void alpha_pal_tbi __P((unsigned long, vm_offset_t)); diff --git a/sys/alpha/include/asm.h b/sys/alpha/include/asm.h index e68927f..f5044df 100644 --- a/sys/alpha/include/asm.h +++ b/sys/alpha/include/asm.h @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: asm.h,v 1.1 1998/01/10 22:09:52 jb Exp $ */ /* From: NetBSD: asm.h,v 1.18 1997/11/03 04:22:06 ross Exp */ /* @@ -474,7 +474,7 @@ _name_ = _value_ _name_:; \ .mask _i_mask_|IM_EXC,0; \ .frame sp,MSS_SIZE,ra; -/* .livereg _i_mask_|IM_EXC,0 +/* .livereg _i_mask_|IM_EXC,0 */ /* should have been .proc _name_,1; \ .frame MSS_SIZE,$31,_i_mask_,0; \ @@ -617,7 +617,7 @@ label: ASCIZ msg; \ * Kernel RCS ID tag and copyright macros */ -#ifdef _KERNEL +#ifdef KERNEL #ifdef __ELF__ #define __KERNEL_SECTIONSTRING(_sec, _str) \ diff --git a/sys/alpha/include/bootinfo.h b/sys/alpha/include/bootinfo.h new file mode 100644 index 0000000..36b3943 --- /dev/null +++ b/sys/alpha/include/bootinfo.h @@ -0,0 +1,21 @@ +/* + * Kernel-internal structure used to hold important bits of boot + * information. NOT to be used by boot blocks. + * + * Note that not all of the fields from the bootinfo struct(s) + * passed by the boot blocks aren't here (because they're not currently + * used by the kernel!). Fields here which aren't supplied by the + * bootinfo structure passed by the boot blocks are supposed to be + * filled in at startup with sane contents. + */ +struct bootinfo_kernel { + u_long ssym; /* start of syms */ + u_long esym; /* end of syms */ + u_long hwrpb_phys; /* hwrpb physical address */ + u_long hwrpb_size; /* size of hwrpb data */ + char boot_flags[64]; /* boot flags */ + char booted_kernel[64]; /* name of booted kernel */ + char booted_dev[64]; /* name of booted device */ +}; + +extern struct bootinfo_kernel bootinfo; diff --git a/sys/alpha/include/bus.h b/sys/alpha/include/bus.h new file mode 100644 index 0000000..dfb7cde --- /dev/null +++ b/sys/alpha/include/bus.h @@ -0,0 +1,620 @@ +/* $NetBSD: bus.h,v 1.22 1998/05/13 21:21:16 thorpej Exp $ */ + +/*- + * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + * NASA Ames Research Center. + * + * 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. + */ + +/* + * Copyright (c) 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 _ALPHA_BUS_H_ +#define _ALPHA_BUS_H_ + +#ifndef __BUS_SPACE_COMPAT_OLDDEFS +#define __BUS_SPACE_COMPAT_OLDDEFS +#endif + +/* + * Addresses (in bus space). + */ +typedef u_long bus_addr_t; +typedef u_long bus_size_t; + +/* + * Access methods for bus space. + */ +typedef struct alpha_bus_space *bus_space_tag_t; +typedef u_long bus_space_handle_t; + +struct alpha_bus_space { + /* cookie */ + void *abs_cookie; + + /* mapping/unmapping */ + int (*abs_map) __P((void *, bus_addr_t, bus_size_t, + int, bus_space_handle_t *)); + void (*abs_unmap) __P((void *, bus_space_handle_t, + bus_size_t)); + int (*abs_subregion) __P((void *, bus_space_handle_t, + bus_size_t, bus_size_t, bus_space_handle_t *)); + + /* allocation/deallocation */ + int (*abs_alloc) __P((void *, bus_addr_t, bus_addr_t, + bus_size_t, bus_size_t, bus_size_t, int, + bus_addr_t *, bus_space_handle_t *)); + void (*abs_free) __P((void *, bus_space_handle_t, + bus_size_t)); + + /* barrier */ + void (*abs_barrier) __P((void *, bus_space_handle_t, + bus_size_t, bus_size_t, int)); + + /* read (single) */ + u_int8_t (*abs_r_1) __P((void *, bus_space_handle_t, + bus_size_t)); + u_int16_t (*abs_r_2) __P((void *, bus_space_handle_t, + bus_size_t)); + u_int32_t (*abs_r_4) __P((void *, bus_space_handle_t, + bus_size_t)); + u_int64_t (*abs_r_8) __P((void *, bus_space_handle_t, + bus_size_t)); + + /* read multiple */ + void (*abs_rm_1) __P((void *, bus_space_handle_t, + bus_size_t, u_int8_t *, bus_size_t)); + void (*abs_rm_2) __P((void *, bus_space_handle_t, + bus_size_t, u_int16_t *, bus_size_t)); + void (*abs_rm_4) __P((void *, bus_space_handle_t, + bus_size_t, u_int32_t *, bus_size_t)); + void (*abs_rm_8) __P((void *, bus_space_handle_t, + bus_size_t, u_int64_t *, bus_size_t)); + + /* read region */ + void (*abs_rr_1) __P((void *, bus_space_handle_t, + bus_size_t, u_int8_t *, bus_size_t)); + void (*abs_rr_2) __P((void *, bus_space_handle_t, + bus_size_t, u_int16_t *, bus_size_t)); + void (*abs_rr_4) __P((void *, bus_space_handle_t, + bus_size_t, u_int32_t *, bus_size_t)); + void (*abs_rr_8) __P((void *, bus_space_handle_t, + bus_size_t, u_int64_t *, bus_size_t)); + + /* write (single) */ + void (*abs_w_1) __P((void *, bus_space_handle_t, + bus_size_t, u_int8_t)); + void (*abs_w_2) __P((void *, bus_space_handle_t, + bus_size_t, u_int16_t)); + void (*abs_w_4) __P((void *, bus_space_handle_t, + bus_size_t, u_int32_t)); + void (*abs_w_8) __P((void *, bus_space_handle_t, + bus_size_t, u_int64_t)); + + /* write multiple */ + void (*abs_wm_1) __P((void *, bus_space_handle_t, + bus_size_t, const u_int8_t *, bus_size_t)); + void (*abs_wm_2) __P((void *, bus_space_handle_t, + bus_size_t, const u_int16_t *, bus_size_t)); + void (*abs_wm_4) __P((void *, bus_space_handle_t, + bus_size_t, const u_int32_t *, bus_size_t)); + void (*abs_wm_8) __P((void *, bus_space_handle_t, + bus_size_t, const u_int64_t *, bus_size_t)); + + /* write region */ + void (*abs_wr_1) __P((void *, bus_space_handle_t, + bus_size_t, const u_int8_t *, bus_size_t)); + void (*abs_wr_2) __P((void *, bus_space_handle_t, + bus_size_t, const u_int16_t *, bus_size_t)); + void (*abs_wr_4) __P((void *, bus_space_handle_t, + bus_size_t, const u_int32_t *, bus_size_t)); + void (*abs_wr_8) __P((void *, bus_space_handle_t, + bus_size_t, const u_int64_t *, bus_size_t)); + + /* set multiple */ + void (*abs_sm_1) __P((void *, bus_space_handle_t, + bus_size_t, u_int8_t, bus_size_t)); + void (*abs_sm_2) __P((void *, bus_space_handle_t, + bus_size_t, u_int16_t, bus_size_t)); + void (*abs_sm_4) __P((void *, bus_space_handle_t, + bus_size_t, u_int32_t, bus_size_t)); + void (*abs_sm_8) __P((void *, bus_space_handle_t, + bus_size_t, u_int64_t, bus_size_t)); + + /* set region */ + void (*abs_sr_1) __P((void *, bus_space_handle_t, + bus_size_t, u_int8_t, bus_size_t)); + void (*abs_sr_2) __P((void *, bus_space_handle_t, + bus_size_t, u_int16_t, bus_size_t)); + void (*abs_sr_4) __P((void *, bus_space_handle_t, + bus_size_t, u_int32_t, bus_size_t)); + void (*abs_sr_8) __P((void *, bus_space_handle_t, + bus_size_t, u_int64_t, bus_size_t)); + + /* copy */ + void (*abs_c_1) __P((void *, bus_space_handle_t, bus_size_t, + bus_space_handle_t, bus_size_t, bus_size_t)); + void (*abs_c_2) __P((void *, bus_space_handle_t, bus_size_t, + bus_space_handle_t, bus_size_t, bus_size_t)); + void (*abs_c_4) __P((void *, bus_space_handle_t, bus_size_t, + bus_space_handle_t, bus_size_t, bus_size_t)); + void (*abs_c_8) __P((void *, bus_space_handle_t, bus_size_t, + bus_space_handle_t, bus_size_t, bus_size_t)); +}; + + +/* + * Utility macros; INTERNAL USE ONLY. + */ +#define __abs_c(a,b) __CONCAT(a,b) +#define __abs_opname(op,size) __abs_c(__abs_c(__abs_c(abs_,op),_),size) + +#define __abs_rs(sz, t, h, o) \ + (*(t)->__abs_opname(r,sz))((t)->abs_cookie, h, o) +#define __abs_ws(sz, t, h, o, v) \ + (*(t)->__abs_opname(w,sz))((t)->abs_cookie, h, o, v) +#ifndef DEBUG +#define __abs_nonsingle(type, sz, t, h, o, a, c) \ + (*(t)->__abs_opname(type,sz))((t)->abs_cookie, h, o, a, c) +#else +#define __abs_nonsingle(type, sz, t, h, o, a, c) \ + do { \ + if (((unsigned long)a & (sz - 1)) != 0) \ + panic("bus non-single %d-byte unaligned (to %p) at %s:%d", \ + sz, a, __FILE__, __LINE__); \ + (*(t)->__abs_opname(type,sz))((t)->abs_cookie, h, o, a, c); \ + } while (0) +#endif +#define __abs_set(type, sz, t, h, o, v, c) \ + (*(t)->__abs_opname(type,sz))((t)->abs_cookie, h, o, v, c) +#define __abs_copy(sz, t, h1, o1, h2, o2, cnt) \ + (*(t)->__abs_opname(c,sz))((t)->abs_cookie, h1, o1, h2, o2, cnt) + + +/* + * Mapping and unmapping operations. + */ +#define bus_space_map(t, a, s, f, hp) \ + (*(t)->abs_map)((t)->abs_cookie, (a), (s), (f), (hp)) +#define bus_space_unmap(t, h, s) \ + (*(t)->abs_unmap)((t)->abs_cookie, (h), (s)) +#define bus_space_subregion(t, h, o, s, hp) \ + (*(t)->abs_subregion)((t)->abs_cookie, (h), (o), (s), (hp)) + +#define BUS_SPACE_MAP_CACHEABLE 0x01 +#define BUS_SPACE_MAP_LINEAR 0x02 + +/* + * Allocation and deallocation operations. + */ +#define bus_space_alloc(t, rs, re, s, a, b, f, ap, hp) \ + (*(t)->abs_alloc)((t)->abs_cookie, (rs), (re), (s), (a), (b), \ + (f), (ap), (hp)) +#define bus_space_free(t, h, s) \ + (*(t)->abs_free)((t)->abs_cookie, (h), (s)) + + +/* + * Bus barrier operations. + */ +#define bus_space_barrier(t, h, o, l, f) \ + (*(t)->abs_barrier)((t)->abs_cookie, (h), (o), (l), (f)) + +#define BUS_SPACE_BARRIER_READ 0x01 +#define BUS_SPACE_BARRIER_WRITE 0x02 + +#ifdef __BUS_SPACE_COMPAT_OLDDEFS +/* compatibility definitions; deprecated */ +#define BUS_BARRIER_READ BUS_SPACE_BARRIER_READ +#define BUS_BARRIER_WRITE BUS_SPACE_BARRIER_WRITE +#endif + + +/* + * Bus read (single) operations. + */ +#define bus_space_read_1(t, h, o) __abs_rs(1,(t),(h),(o)) +#define bus_space_read_2(t, h, o) __abs_rs(2,(t),(h),(o)) +#define bus_space_read_4(t, h, o) __abs_rs(4,(t),(h),(o)) +#define bus_space_read_8(t, h, o) __abs_rs(8,(t),(h),(o)) + + +/* + * Bus read multiple operations. + */ +#define bus_space_read_multi_1(t, h, o, a, c) \ + __abs_nonsingle(rm,1,(t),(h),(o),(a),(c)) +#define bus_space_read_multi_2(t, h, o, a, c) \ + __abs_nonsingle(rm,2,(t),(h),(o),(a),(c)) +#define bus_space_read_multi_4(t, h, o, a, c) \ + __abs_nonsingle(rm,4,(t),(h),(o),(a),(c)) +#define bus_space_read_multi_8(t, h, o, a, c) \ + __abs_nonsingle(rm,8,(t),(h),(o),(a),(c)) + + +/* + * Bus read region operations. + */ +#define bus_space_read_region_1(t, h, o, a, c) \ + __abs_nonsingle(rr,1,(t),(h),(o),(a),(c)) +#define bus_space_read_region_2(t, h, o, a, c) \ + __abs_nonsingle(rr,2,(t),(h),(o),(a),(c)) +#define bus_space_read_region_4(t, h, o, a, c) \ + __abs_nonsingle(rr,4,(t),(h),(o),(a),(c)) +#define bus_space_read_region_8(t, h, o, a, c) \ + __abs_nonsingle(rr,8,(t),(h),(o),(a),(c)) + + +/* + * Bus write (single) operations. + */ +#define bus_space_write_1(t, h, o, v) __abs_ws(1,(t),(h),(o),(v)) +#define bus_space_write_2(t, h, o, v) __abs_ws(2,(t),(h),(o),(v)) +#define bus_space_write_4(t, h, o, v) __abs_ws(4,(t),(h),(o),(v)) +#define bus_space_write_8(t, h, o, v) __abs_ws(8,(t),(h),(o),(v)) + + +/* + * Bus write multiple operations. + */ +#define bus_space_write_multi_1(t, h, o, a, c) \ + __abs_nonsingle(wm,1,(t),(h),(o),(a),(c)) +#define bus_space_write_multi_2(t, h, o, a, c) \ + __abs_nonsingle(wm,2,(t),(h),(o),(a),(c)) +#define bus_space_write_multi_4(t, h, o, a, c) \ + __abs_nonsingle(wm,4,(t),(h),(o),(a),(c)) +#define bus_space_write_multi_8(t, h, o, a, c) \ + __abs_nonsingle(wm,8,(t),(h),(o),(a),(c)) + + +/* + * Bus write region operations. + */ +#define bus_space_write_region_1(t, h, o, a, c) \ + __abs_nonsingle(wr,1,(t),(h),(o),(a),(c)) +#define bus_space_write_region_2(t, h, o, a, c) \ + __abs_nonsingle(wr,2,(t),(h),(o),(a),(c)) +#define bus_space_write_region_4(t, h, o, a, c) \ + __abs_nonsingle(wr,4,(t),(h),(o),(a),(c)) +#define bus_space_write_region_8(t, h, o, a, c) \ + __abs_nonsingle(wr,8,(t),(h),(o),(a),(c)) + + +/* + * Set multiple operations. + */ +#define bus_space_set_multi_1(t, h, o, v, c) \ + __abs_set(sm,1,(t),(h),(o),(v),(c)) +#define bus_space_set_multi_2(t, h, o, v, c) \ + __abs_set(sm,2,(t),(h),(o),(v),(c)) +#define bus_space_set_multi_4(t, h, o, v, c) \ + __abs_set(sm,4,(t),(h),(o),(v),(c)) +#define bus_space_set_multi_8(t, h, o, v, c) \ + __abs_set(sm,8,(t),(h),(o),(v),(c)) + + +/* + * Set region operations. + */ +#define bus_space_set_region_1(t, h, o, v, c) \ + __abs_set(sr,1,(t),(h),(o),(v),(c)) +#define bus_space_set_region_2(t, h, o, v, c) \ + __abs_set(sr,2,(t),(h),(o),(v),(c)) +#define bus_space_set_region_4(t, h, o, v, c) \ + __abs_set(sr,4,(t),(h),(o),(v),(c)) +#define bus_space_set_region_8(t, h, o, v, c) \ + __abs_set(sr,8,(t),(h),(o),(v),(c)) + + +/* + * Copy region operations. + */ +#define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \ + __abs_copy(1, (t), (h1), (o1), (h2), (o2), (c)) +#define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \ + __abs_copy(2, (t), (h1), (o1), (h2), (o2), (c)) +#define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \ + __abs_copy(4, (t), (h1), (o1), (h2), (o2), (c)) +#define bus_space_copy_region_8(t, h1, o1, h2, o2, c) \ + __abs_copy(8, (t), (h1), (o1), (h2), (o2), (c)) + +#ifdef __BUS_SPACE_COMPAT_OLDDEFS +/* compatibility definitions; deprecated */ +#define bus_space_copy_1(t, h1, o1, h2, o2, c) \ + bus_space_copy_region_1((t), (h1), (o1), (h2), (o2), (c)) +#define bus_space_copy_2(t, h1, o1, h2, o2, c) \ + bus_space_copy_region_1((t), (h1), (o1), (h2), (o2), (c)) +#define bus_space_copy_4(t, h1, o1, h2, o2, c) \ + bus_space_copy_region_1((t), (h1), (o1), (h2), (o2), (c)) +#define bus_space_copy_8(t, h1, o1, h2, o2, c) \ + bus_space_copy_region_1((t), (h1), (o1), (h2), (o2), (c)) +#endif + + +/* + * Bus DMA methods. + */ + +/* + * Flags used in various bus DMA methods. + */ +#define BUS_DMA_WAITOK 0x00 /* safe to sleep (pseudo-flag) */ +#define BUS_DMA_NOWAIT 0x01 /* not safe to sleep */ +#define BUS_DMA_ALLOCNOW 0x02 /* perform resource allocation now */ +#define BUS_DMA_COHERENT 0x04 /* hint: map memory DMA coherent */ +#define BUS_DMA_BUS1 0x10 /* placeholders for bus functions... */ +#define BUS_DMA_BUS2 0x20 +#define BUS_DMA_BUS3 0x40 +#define BUS_DMA_BUS4 0x80 + +/* + * Private flags stored in the DMA map. + */ +#define DMAMAP_HAS_SGMAP 0x80000000 /* sgva/len are valid */ + +/* Forwards needed by prototypes below. */ +struct mbuf; +struct uio; +struct alpha_sgmap; + +/* + * Operations performed by bus_dmamap_sync(). + */ +#define BUS_DMASYNC_PREREAD 0x01 /* pre-read synchronization */ +#define BUS_DMASYNC_POSTREAD 0x02 /* post-read synchronization */ +#define BUS_DMASYNC_PREWRITE 0x04 /* pre-write synchronization */ +#define BUS_DMASYNC_POSTWRITE 0x08 /* post-write synchronization */ + +/* + * alpha_bus_t + * + * Busses supported by NetBSD/alpha, used by internal + * utility functions. NOT TO BE USED BY MACHINE-INDEPENDENT + * CODE! + */ +typedef enum { + ALPHA_BUS_TURBOCHANNEL, + ALPHA_BUS_PCI, + ALPHA_BUS_EISA, + ALPHA_BUS_ISA, + ALPHA_BUS_TLSB, +} alpha_bus_t; + +typedef struct alpha_bus_dma_tag *bus_dma_tag_t; +typedef struct alpha_bus_dmamap *bus_dmamap_t; + +/* + * bus_dma_segment_t + * + * Describes a single contiguous DMA transaction. Values + * are suitable for programming into DMA registers. + */ +struct alpha_bus_dma_segment { + bus_addr_t ds_addr; /* DMA address */ + bus_size_t ds_len; /* length of transfer */ +}; +typedef struct alpha_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 alpha_bus_dma_tag { + void *_cookie; /* cookie used in the guts */ + bus_addr_t _wbase; /* DMA window base */ + + /* + * The following two members are used to chain DMA windows + * together. If, during the course of a map load, the + * resulting physical memory address is too large to + * be addressed by the window, the next window will be + * attempted. These would be chained together like so: + * + * direct -> sgmap -> NULL + * or + * sgmap -> NULL + * or + * direct -> NULL + * + * If the window size is 0, it will not be checked (e.g. + * TurboChannel DMA). + */ + bus_size_t _wsize; + struct alpha_bus_dma_tag *_next_window; + + /* + * A chipset may have more than one SGMAP window, so SGMAP + * windows also get a pointer to their SGMAP state. + */ + struct alpha_sgmap *_sgmap; + + /* + * Internal-use only utility methods. NOT TO BE USED BY + * MACHINE-INDEPENDENT CODE! + */ + bus_dma_tag_t (*_get_tag) __P((bus_dma_tag_t, alpha_bus_t)); + + /* + * DMA mapping methods. + */ + int (*_dmamap_create) __P((bus_dma_tag_t, bus_size_t, int, + bus_size_t, bus_size_t, int, bus_dmamap_t *)); + void (*_dmamap_destroy) __P((bus_dma_tag_t, bus_dmamap_t)); + int (*_dmamap_load) __P((bus_dma_tag_t, bus_dmamap_t, void *, + bus_size_t, struct proc *, int)); + int (*_dmamap_load_mbuf) __P((bus_dma_tag_t, bus_dmamap_t, + struct mbuf *, int)); + int (*_dmamap_load_uio) __P((bus_dma_tag_t, bus_dmamap_t, + struct uio *, int)); + int (*_dmamap_load_raw) __P((bus_dma_tag_t, bus_dmamap_t, + bus_dma_segment_t *, int, bus_size_t, int)); + void (*_dmamap_unload) __P((bus_dma_tag_t, bus_dmamap_t)); + void (*_dmamap_sync) __P((bus_dma_tag_t, bus_dmamap_t, + bus_addr_t, bus_size_t, int)); + + /* + * DMA memory utility functions. + */ + int (*_dmamem_alloc) __P((bus_dma_tag_t, bus_size_t, bus_size_t, + bus_size_t, bus_dma_segment_t *, int, int *, int)); + void (*_dmamem_free) __P((bus_dma_tag_t, + bus_dma_segment_t *, int)); + int (*_dmamem_map) __P((bus_dma_tag_t, bus_dma_segment_t *, + int, size_t, caddr_t *, int)); + void (*_dmamem_unmap) __P((bus_dma_tag_t, caddr_t, size_t)); + int (*_dmamem_mmap) __P((bus_dma_tag_t, bus_dma_segment_t *, + int, int, int, int)); +}; + +#define alphabus_dma_get_tag(t, b) \ + (*(t)->_get_tag)(t, b) + +#define bus_dmamap_create(t, s, n, m, b, f, p) \ + (*(t)->_dmamap_create)((t), (s), (n), (m), (b), (f), (p)) +#define bus_dmamap_destroy(t, p) \ + (*(t)->_dmamap_destroy)((t), (p)) +#define bus_dmamap_load(t, m, b, s, p, f) \ + (*(t)->_dmamap_load)((t), (m), (b), (s), (p), (f)) +#define bus_dmamap_load_mbuf(t, m, b, f) \ + (*(t)->_dmamap_load_mbuf)((t), (m), (b), (f)) +#define bus_dmamap_load_uio(t, m, u, f) \ + (*(t)->_dmamap_load_uio)((t), (m), (u), (f)) +#define bus_dmamap_load_raw(t, m, sg, n, s, f) \ + (*(t)->_dmamap_load_raw)((t), (m), (sg), (n), (s), (f)) +#define bus_dmamap_unload(t, p) \ + (*(t)->_dmamap_unload)((t), (p)) +#define bus_dmamap_sync(t, p, o, l, ops) \ + (*(t)->_dmamap_sync)((t), (p), (o), (l), (ops)) +#define bus_dmamem_alloc(t, s, a, b, sg, n, r, f) \ + (*(t)->_dmamem_alloc)((t), (s), (a), (b), (sg), (n), (r), (f)) +#define bus_dmamem_free(t, sg, n) \ + (*(t)->_dmamem_free)((t), (sg), (n)) +#define bus_dmamem_map(t, sg, n, s, k, f) \ + (*(t)->_dmamem_map)((t), (sg), (n), (s), (k), (f)) +#define bus_dmamem_unmap(t, k, s) \ + (*(t)->_dmamem_unmap)((t), (k), (s)) +#define bus_dmamem_mmap(t, sg, n, o, p, f) \ + (*(t)->_dmamem_mmap)((t), (sg), (n), (o), (p), (f)) + +/* + * bus_dmamap_t + * + * Describes a DMA mapping. + */ +struct alpha_bus_dmamap { + /* + * PRIVATE MEMBERS: not for use my machine-independent code. + */ + vm_object_t _dm_obj; /* for allocating pages */ + 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 */ + + /* + * This is used only for SGMAP-mapped DMA, but we keep it + * here to avoid pointless indirection. + */ + int _dm_pteidx; /* PTE index */ + int _dm_ptecnt; /* PTE count */ + u_long _dm_sgva; /* allocated sgva */ + bus_size_t _dm_sgvalen; /* svga length */ + + /* + * 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 */ +}; + +#ifdef _ALPHA_BUS_DMA_PRIVATE +int _bus_dmamap_create __P((bus_dma_tag_t, bus_size_t, int, bus_size_t, + bus_size_t, int, bus_dmamap_t *)); +void _bus_dmamap_destroy __P((bus_dma_tag_t, bus_dmamap_t)); + +int _bus_dmamap_load_direct __P((bus_dma_tag_t, bus_dmamap_t, + void *, bus_size_t, struct proc *, int)); +int _bus_dmamap_load_mbuf_direct __P((bus_dma_tag_t, + bus_dmamap_t, struct mbuf *, int)); +int _bus_dmamap_load_uio_direct __P((bus_dma_tag_t, + bus_dmamap_t, struct uio *, int)); +int _bus_dmamap_load_raw_direct __P((bus_dma_tag_t, + bus_dmamap_t, bus_dma_segment_t *, int, bus_size_t, int)); + +void _bus_dmamap_unload __P((bus_dma_tag_t, bus_dmamap_t)); +void _bus_dmamap_sync __P((bus_dma_tag_t, bus_dmamap_t, bus_addr_t, + bus_size_t, int)); + +int _bus_dmamem_alloc __P((bus_dma_tag_t tag, bus_dmamap_t, bus_size_t size, + bus_size_t alignment, bus_size_t boundary, + bus_dma_segment_t *segs, int nsegs, int *rsegs, int flags)); +void _bus_dmamem_free __P((bus_dma_tag_t tag, bus_dma_segment_t *segs, + int nsegs)); +int _bus_dmamem_map __P((bus_dma_tag_t tag, bus_dma_segment_t *segs, + int nsegs, size_t size, caddr_t *kvap, int flags)); +void _bus_dmamem_unmap __P((bus_dma_tag_t tag, caddr_t kva, + size_t size)); +int _bus_dmamem_mmap __P((bus_dma_tag_t tag, bus_dma_segment_t *segs, + int nsegs, int off, int prot, int flags)); +#endif /* _ALPHA_BUS_DMA_PRIVATE */ + +#endif /* _ALPHA_BUS_H_ */ diff --git a/sys/alpha/include/chipset.h b/sys/alpha/include/chipset.h new file mode 100644 index 0000000..aa6f606 --- /dev/null +++ b/sys/alpha/include/chipset.h @@ -0,0 +1,76 @@ +/*- + * Copyright (c) 1998 Doug Rabson + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +#ifndef _MACHINE_CHIPSET_H_ +#define _MACHINE_CHIPSET_H_ + +typedef u_int8_t alpha_chipset_inb_t(u_int32_t port); +typedef u_int16_t alpha_chipset_inw_t(u_int32_t port); +typedef u_int32_t alpha_chipset_inl_t(u_int32_t port); +typedef void alpha_chipset_outb_t(u_int32_t port, u_int8_t data); +typedef void alpha_chipset_outw_t(u_int32_t port, u_int16_t data); +typedef void alpha_chipset_outl_t(u_int32_t port, u_int32_t data); + +typedef int alpha_chipset_maxdevs_t(u_int bus); +typedef u_int8_t alpha_chipset_cfgreadb_t(u_int, u_int, u_int, u_int); +typedef u_int16_t alpha_chipset_cfgreadw_t(u_int, u_int, u_int, u_int); +typedef u_int32_t alpha_chipset_cfgreadl_t(u_int, u_int, u_int, u_int); +typedef void alpha_chipset_cfgwriteb_t(u_int, u_int, u_int, u_int, + u_int8_t); +typedef void alpha_chipset_cfgwritew_t(u_int, u_int, u_int, u_int, + u_int16_t); +typedef void alpha_chipset_cfgwritel_t(u_int, u_int, u_int, u_int, + u_int32_t); + + +typedef struct alpha_chipset { + /* + * I/O port access + */ + alpha_chipset_inb_t* inb; + alpha_chipset_inw_t* inw; + alpha_chipset_inl_t* inl; + alpha_chipset_outb_t* outb; + alpha_chipset_outw_t* outw; + alpha_chipset_outl_t* outl; + + /* + * PCI configuration access + */ + alpha_chipset_maxdevs_t* maxdevs; + alpha_chipset_cfgreadb_t* cfgreadb; + alpha_chipset_cfgreadw_t* cfgreadw; + alpha_chipset_cfgreadl_t* cfgreadl; + alpha_chipset_cfgwriteb_t* cfgwriteb; + alpha_chipset_cfgwritew_t* cfgwritew; + alpha_chipset_cfgwritel_t* cfgwritel; +} alpha_chipset_t; + +extern alpha_chipset_t chipset; + +#endif /* !_MACHINE_CHIPSET_H_ */ diff --git a/sys/alpha/include/clock.h b/sys/alpha/include/clock.h new file mode 100644 index 0000000..95c160f --- /dev/null +++ b/sys/alpha/include/clock.h @@ -0,0 +1,22 @@ +/* + * Kernel interface to machine-dependent clock driver. + * Garrett Wollman, September 1994. + * This file is in the public domain. + * + * $Id: clock.h,v 1.34 1998/03/05 21:45:42 tegge Exp $ + */ + +#ifndef _MACHINE_CLOCK_H_ +#define _MACHINE_CLOCK_H_ + +#ifdef KERNEL + +extern int wall_cmos_clock; +extern int adjkerntz; + +void DELAY __P((int usec)); +int sysbeep __P((int pitch, int period)); + +#endif /* KERNEL */ + +#endif /* !_MACHINE_CLOCK_H_ */ diff --git a/sys/alpha/include/conf.h b/sys/alpha/include/conf.h new file mode 100644 index 0000000..ee6b603 --- /dev/null +++ b/sys/alpha/include/conf.h @@ -0,0 +1,11 @@ +#ifndef _MACHINE_CONF_H_ +#define _MACHINE_CONF_H_ + +#ifdef KERNEL +#ifndef ACTUALLY_LKM_NOT_KERNEL +#include "ioconf.h" +#endif + +#endif /* KERNEL */ + +#endif /* !_MACHINE_CONF_H_ */ diff --git a/sys/alpha/include/cons.h b/sys/alpha/include/cons.h new file mode 100644 index 0000000..df135cc --- /dev/null +++ b/sys/alpha/include/cons.h @@ -0,0 +1,110 @@ +/* + * Copyright (c) 1988 University of Utah. + * Copyright (c) 1991 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * the Systems Programming Group of the University of Utah Computer + * Science Department. + * + * 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 University of + * California, Berkeley and its contributors. + * 4. 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. + * + * from: @(#)cons.h 7.2 (Berkeley) 5/9/91 + * $Id: cons.h,v 1.17 1997/07/01 00:54:37 bde Exp $ + */ + +#ifndef _MACHINE_CONS_H_ +#define _MACHINE_CONS_H_ + +struct consdev; +typedef void cn_probe_t __P((struct consdev *)); +typedef void cn_init_t __P((struct consdev *)); +typedef int cn_getc_t __P((dev_t)); +typedef int cn_checkc_t __P((dev_t)); +typedef void cn_putc_t __P((dev_t, int)); + +#ifdef KERNEL +/* + * XXX public functions in drivers should be declared in headers produced + * by `config', not here. + */ +cn_probe_t pccnprobe; +cn_init_t pccninit; +cn_getc_t pccngetc; +cn_checkc_t pccncheckc; +cn_putc_t pccnputc; + +cn_probe_t sccnprobe; +cn_init_t sccninit; +cn_getc_t sccngetc; +cn_checkc_t sccncheckc; +cn_putc_t sccnputc; + +cn_probe_t siocnprobe; +cn_init_t siocninit; +cn_getc_t siocngetc; +cn_checkc_t siocncheckc; +cn_putc_t siocnputc; +#endif /* KERNEL */ + +struct consdev { + cn_probe_t *cn_probe; + /* probe hardware and fill in consdev info */ + cn_init_t *cn_init; + /* turn on as console */ + cn_getc_t *cn_getc; + /* kernel getchar interface */ + cn_checkc_t *cn_checkc; + /* kernel "return char if available" interface */ + cn_putc_t *cn_putc; + /* kernel putchar interface */ + struct tty *cn_tp; /* tty structure for console device */ + dev_t cn_dev; /* major/minor of device */ + short cn_pri; /* pecking order; the higher the better */ +}; + +/* values for cn_pri - reflect our policy for console selection */ +#define CN_DEAD 0 /* device doesn't exist */ +#define CN_NORMAL 1 /* device exists but is nothing special */ +#define CN_INTERNAL 2 /* "internal" bit-mapped display */ +#define CN_REMOTE 3 /* serial interface with remote bit set */ + +#ifdef KERNEL +extern int cons_unavail; + +/* Other kernel entry points. */ +int cncheckc __P((void)); +int cngetc __P((void)); +void cninit __P((void)); +void cninit_finish __P((void)); +void cnputc __P((int)); + +#endif /* KERNEL */ + +#endif /* !_MACHINE_CONS_H_ */ diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h index adf0eba..6b0c81f 100644 --- a/sys/alpha/include/cpu.h +++ b/sys/alpha/include/cpu.h @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: cpu.h,v 1.1 1998/01/10 10:13:14 jb Exp $ */ /* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */ /* @@ -53,12 +53,6 @@ #include <machine/frame.h> /* - * definitions of cpu-dependent requirements - * referenced in generic code - */ -#define cpu_wait(p) /* nothing */ - -/* * Arguments to hardclock and gatherstats encapsulate the previous * machine state in an opaque clockframe. One the Alpha, we use * what we push on an interrupt (a trapframe). @@ -98,7 +92,7 @@ struct clockframe { #define aston() (astpending = 1) -#ifdef _KERNEL +#ifdef KERNEL u_int64_t astpending; /* need to trap before returning to user mode */ u_int64_t want_resched; /* resched() was called */ #endif @@ -125,7 +119,7 @@ u_int64_t want_resched; /* resched() was called */ { "booted_kernel", CTLTYPE_STRING }, \ } -#ifdef _KERNEL +#ifdef KERNEL struct pcb; struct proc; @@ -133,7 +127,6 @@ struct reg; struct rpb; struct trapframe; -extern int cold; extern struct proc *fpcurproc; extern struct rpb *hwrpb; extern volatile int mc_expected, mc_received; @@ -145,19 +138,19 @@ void XentMM __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */ void XentRestart __P((void)); /* MAGIC */ void XentSys __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */ void XentUna __P((u_int64_t, u_int64_t, u_int64_t)); /* MAGIC */ -void alpha_init __P((u_long, u_long, u_long, u_long)); +void alpha_init __P((u_long, u_long, u_long, u_long, u_long)); +int alpha_pa_access __P((u_long)); void ast __P((struct trapframe *)); int badaddr __P((void *, size_t)); int badaddr_read __P((void *, size_t, void *)); void child_return __P((struct proc *p)); -void configure __P((void)); u_int64_t console_restart __P((u_int64_t, u_int64_t, u_int64_t)); void do_sir __P((void)); void dumpconf __P((void)); void exception_return __P((void)); /* MAGIC */ void frametoreg __P((struct trapframe *, struct reg *)); long fswintrberr __P((void)); /* MAGIC */ -void init_prom_interface __P((void)); +void init_prom_interface __P((struct rpb*)); void interrupt __P((unsigned long, unsigned long, unsigned long, struct trapframe *)); void machine_check @@ -173,6 +166,7 @@ void switch_trampoline __P((void)); /* MAGIC */ void syscall __P((u_int64_t, struct trapframe *)); void trap __P((unsigned long, unsigned long, unsigned long, unsigned long, struct trapframe *)); +void cpu_set_fork_handler __P((struct proc *, void (*pc)(void *), void *)); #endif /* _KERNEL */ diff --git a/sys/alpha/include/cpuconf.h b/sys/alpha/include/cpuconf.h new file mode 100644 index 0000000..30ef4c7 --- /dev/null +++ b/sys/alpha/include/cpuconf.h @@ -0,0 +1,118 @@ +/* $NetBSD: cpuconf.h,v 1.7 1997/11/06 00:42:03 thorpej Exp $ */ +#ifndef _ALPHA_CPUCONF_H +#define _ALPHA_CPUCONF_H +/* + * Copyright (c) 1996 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 + * for the NetBSD Project. + * 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. + */ +/* + * Additional reworking by Matthew Jacob for NASA/Ames Research Center. + * Copyright (c) 1997 + */ +#ifdef KERNEL +/* + * Platform Specific Information and Function Hooks. + * + * The tags family and model information are strings describing the platform. + * + * The tag iobus describes the primary iobus for the platform- primarily + * to give a hint as to where to start configuring. The likely choices + * are one of tcasic, lca, apecs, cia, or tlsb. + * + */ +struct device; /* XXX */ + +extern struct platform { + /* + * Platform Information. + */ + const char *family; /* Family Name */ + const char *model; /* Model (variant) Name */ + const char *iobus; /* Primary iobus name */ + + /* + * Platform Specific Function Hooks + * cons_init - console initialization + * device_register - boot configuration aid + * iointr - I/O interrupt handler + * clockintr - Clock Interrupt Handler + * mcheck_handler - Platform Specific Machine Check Handler + */ + void (*cons_init) __P((void)); + void (*device_register) __P((struct device *, void *)); + void (*iointr) __P((void *, unsigned long)); + void (*clockintr) __P((void *)); + void (*mcheck_handler) __P((unsigned long, struct trapframe *, + unsigned long, unsigned long)); +} platform; + +/* + * Lookup table entry for Alpha system variations. + */ +struct alpha_variation_table { + u_int64_t avt_variation; /* variation, from HWRPB */ + const char *avt_model; /* model string */ +}; + +/* + * There is an array of functions to initialize the platform structure. + * + * It's responsible for filling in the family, model_name and iobus + * tags. It may optionally fill in the cons_init, device_register and + * mcheck_handler tags. + * + * The iointr tag is filled in by set_iointr (in interrupt.c). + * The clockintr tag is filled in by cpu_initclocks (in clock.c). + * + * nocpu is function to call when you can't figure what platform you're on. + * There's no return from this function. + */ + +struct cpuinit { + void (*init) __P((int)); + const char *option; +}; + +#define cpu_notsupp(st) { platform_not_supported, st } +#define cpu_init(fn, opt) { fn, opt } + +/* + * Misc. support routines. + */ +const char *alpha_dsr_sysname __P((void)); +const char *alpha_variation_name __P((u_int64_t variation, + const struct alpha_variation_table *avtp)); +const char *alpha_unknown_sysname __P((void)); + +extern struct cpuinit cpuinit[]; +extern int ncpuinit; +extern void platform_not_configured __P((int)); +extern void platform_not_supported __P((int)); + +#endif /* KERNEL */ +#endif /* !_ALPHA_CPUCONF_H */ diff --git a/sys/alpha/include/cpufunc.h b/sys/alpha/include/cpufunc.h new file mode 100644 index 0000000..6125ba3 --- /dev/null +++ b/sys/alpha/include/cpufunc.h @@ -0,0 +1,46 @@ +/*- + * Copyright (c) 1998 Doug Rabson + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +#ifndef _MACHINE_CPUFUNC_H_ +#define _MACHINE_CPUFUNC_H_ + +#ifdef KERNEL + +#include <sys/types.h> +#include <machine/chipset.h> + +#define inb(port) chipset.inb(port) +#define inw(port) chipset.inw(port) +#define inl(port) chipset.inl(port) +#define outb(port, data) chipset.outb(port, data) +#define outw(port, data) chipset.outw(port, data) +#define outl(port, data) chipset.outl(port, data) + +#endif /* KERNEL */ + +#endif /* !_MACHINE_CPUFUNC_H_ */ diff --git a/sys/alpha/include/db_machdep.h b/sys/alpha/include/db_machdep.h new file mode 100644 index 0000000..3aa84d3 --- /dev/null +++ b/sys/alpha/include/db_machdep.h @@ -0,0 +1,112 @@ +/* $NetBSD: db_machdep.h,v 1.6 1997/09/06 02:02:25 thorpej Exp $ */ + +/* + * Copyright (c) 1995 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 _ALPHA_DB_MACHDEP_H_ +#define _ALPHA_DB_MACHDEP_H_ + +/* + * Machine-dependent defines for new kernel debugger. + */ + +#include <sys/param.h> +#include <vm/vm.h> +#include <machine/frame.h> + +typedef vm_offset_t db_addr_t; /* address - unsigned */ +typedef long db_expr_t; /* expression - signed */ + +typedef struct trapframe db_regs_t; +db_regs_t ddb_regs; /* register state */ +#define DDB_REGS (&ddb_regs) + +#define PC_REGS(regs) ((db_addr_t)(regs)->tf_regs[FRAME_PC]) + +#define BKPT_INST 0x00000080 /* breakpoint instruction */ +#define BKPT_SIZE (4) /* size of breakpoint inst */ +#define BKPT_SET(inst) (BKPT_INST) + +#if 0 +#define FIXUP_PC_AFTER_BREAK \ + (ddb_regs.tf_regs[FRAME_PC] -= BKPT_SIZE) +#endif + +#define SOFTWARE_SSTEP 1 /* no hardware support */ +#define IS_BREAKPOINT_TRAP(type, code) ((type) == ALPHA_KENTRY_IF && \ + (code) == ALPHA_IF_CODE_BPT) +#define IS_WATCHPOINT_TRAP(type, code) 0 + +/* + * Functions needed for software single-stepping. + */ + +boolean_t db_inst_trap_return __P((int inst)); +boolean_t db_inst_return __P((int inst)); +boolean_t db_inst_call __P((int inst)); +boolean_t db_inst_branch __P((int inst)); +boolean_t db_inst_load __P((int inst)); +boolean_t db_inst_store __P((int inst)); +boolean_t db_inst_unconditional_flow_transfer __P((int inst)); +db_addr_t db_branch_taken __P((int inst, db_addr_t pc, db_regs_t *regs)); + +#define inst_trap_return(ins) db_inst_trap_return(ins) +#define inst_return(ins) db_inst_return(ins) +#define inst_call(ins) db_inst_call(ins) +#define inst_branch(ins) db_inst_branch(ins) +#define inst_load(ins) db_inst_load(ins) +#define inst_store(ins) db_inst_store(ins) +#define inst_unconditional_flow_transfer(ins) \ + db_inst_unconditional_flow_transfer(ins) +#define branch_taken(ins, pc, regs) \ + db_branch_taken((ins), (pc), (regs)) + +/* No delay slots on Alpha. */ +#define next_instr_address(v, b) ((db_addr_t) ((b) ? (v) : ((v) + 4))) + +u_long db_register_value __P((db_regs_t *, int)); +int ddb_trap __P((unsigned long, unsigned long, unsigned long, + unsigned long, struct trapframe *)); + +/* + * Pretty arbitrary + */ +#define DB_SMALL_VALUE_MAX 0x7fffffff +#define DB_SMALL_VALUE_MIN (-0x400001) + +/* + * We define some of our own commands. + */ +#define DB_MACHINE_COMMANDS + +/* + * We use Elf64 symbols in DDB. + */ +#define DB_ELF_SYMBOLS +#define DB_ELFSIZE 64 + +#endif /* _ALPHA_DB_MACHDEP_H_ */ diff --git a/sys/alpha/include/elf.h b/sys/alpha/include/elf.h index ce2da56..e49a729 100644 --- a/sys/alpha/include/elf.h +++ b/sys/alpha/include/elf.h @@ -23,17 +23,17 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: elf.h,v 1.2 1997/08/30 18:59:48 peter Exp $ + * $Id: elf.h,v 1.1.1.1 1998/03/09 05:42:33 jb Exp $ */ #ifndef _MACHINE_ELF_H_ #define _MACHINE_ELF_H_ 1 /* - * ELF definitions for the i386 architecture. + * ELF definitions for the alpha architecture. */ -#include <sys/elf32.h> /* Definitions common to all 32 bit architectures. */ +#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */ /* * Auxiliary vector entries for passing information to the interpreter. @@ -43,13 +43,13 @@ */ typedef struct { /* Auxiliary vector entry on initial stack */ - int a_type; /* Entry type. */ + long a_type; /* Entry type. */ union { long a_val; /* Integer value. */ void *a_ptr; /* Address. */ void (*a_fcn)(void); /* Function pointer (not used). */ } a_un; -} Elf32_Auxinfo; +} Elf64_Auxinfo; /* Values for a_type. */ #define AT_NULL 0 /* Terminates the vector. */ @@ -89,24 +89,41 @@ typedef struct { /* Auxiliary vector entry on initial stack */ * Relocation types. */ -#define R_386_NONE 0 /* No relocation. */ -#define R_386_32 1 /* Add symbol value. */ -#define R_386_PC32 2 /* Add PC-relative symbol value. */ -#define R_386_GOT32 3 /* Add PC-relative GOT offset. */ -#define R_386_PLT32 4 /* Add PC-relative PLT offset. */ -#define R_386_COPY 5 /* Copy data from shared object. */ -#define R_386_GLOB_DAT 6 /* Set GOT entry to data address. */ -#define R_386_JMP_SLOT 7 /* Set GOT entry to code address. */ -#define R_386_RELATIVE 8 /* Add load address of shared object. */ -#define R_386_GOTOFF 9 /* Add GOT-relative symbol address. */ -#define R_386_GOTPC 10 /* Add PC-relative GOT table address. */ +#define R_ALPHA_NONE 0 /* No reloc */ +#define R_ALPHA_REFLONG 1 /* Direct 32 bit */ +#define R_ALPHA_REFQUAD 2 /* Direct 64 bit */ +#define R_ALPHA_GPREL32 3 /* GP relative 32 bit */ +#define R_ALPHA_LITERAL 4 /* GP relative 16 bit w/optimization */ +#define R_ALPHA_LITUSE 5 /* Optimization hint for LITERAL */ +#define R_ALPHA_GPDISP 6 /* Add displacement to GP */ +#define R_ALPHA_BRADDR 7 /* PC+4 relative 23 bit shifted */ +#define R_ALPHA_HINT 8 /* PC+4 relative 16 bit shifted */ +#define R_ALPHA_SREL16 9 /* PC relative 16 bit */ +#define R_ALPHA_SREL32 10 /* PC relative 32 bit */ +#define R_ALPHA_SREL64 11 /* PC relative 64 bit */ +#define R_ALPHA_OP_PUSH 12 /* OP stack push */ +#define R_ALPHA_OP_STORE 13 /* OP stack pop and store */ +#define R_ALPHA_OP_PSUB 14 /* OP stack subtract */ +#define R_ALPHA_OP_PRSHIFT 15 /* OP stack right shift */ +#define R_ALPHA_GPVALUE 16 +#define R_ALPHA_GPRELHIGH 17 +#define R_ALPHA_GPRELLOW 18 +#define R_ALPHA_IMMED_GP_16 19 +#define R_ALPHA_IMMED_GP_HI32 20 +#define R_ALPHA_IMMED_SCN_HI32 21 +#define R_ALPHA_IMMED_BR_HI32 22 +#define R_ALPHA_IMMED_LO32 23 +#define R_ALPHA_COPY 24 /* Copy symbol at runtime */ +#define R_ALPHA_GLOB_DAT 25 /* Create GOT entry */ +#define R_ALPHA_JMP_SLOT 26 /* Create PLT entry */ +#define R_ALPHA_RELATIVE 27 /* Adjust by program base */ -#define R_386_COUNT 11 /* Count of defined relocation types. */ +#define R_ALPHA_COUNT 28 /* Define "machine" characteristics */ -#define ELF_TARG_CLASS ELFCLASS32 +#define ELF_TARG_CLASS ELFCLASS64 #define ELF_TARG_DATA ELFDATA2LSB -#define ELF_TARG_MACH EM_386 +#define ELF_TARG_MACH EM_ALPHA #define ELF_TARG_VER 1 #endif /* !_MACHINE_ELF_H_ */ diff --git a/sys/alpha/include/in_cksum.h b/sys/alpha/include/in_cksum.h new file mode 100644 index 0000000..7e1c0f0 --- /dev/null +++ b/sys/alpha/include/in_cksum.h @@ -0,0 +1,78 @@ +/*- + * Copyright (c) 1990 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. 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, Berkeley and its contributors. + * 4. 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. + * + * from tahoe: in_cksum.c 1.2 86/01/05 + * from: @(#)in_cksum.c 1.3 (Berkeley) 1/19/91 + * from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp + * $Id: in_cksum.h,v 1.5 1997/08/16 19:14:55 wollman Exp $ + */ + +#ifndef _MACHINE_IN_CKSUM_H_ +#define _MACHINE_IN_CKSUM_H_ 1 + +#include <sys/cdefs.h> + +/* + * It it useful to have an Internet checksum routine which is inlineable + * and optimized specifically for the task of computing IP header checksums + * in the normal case (where there are no options and the header length is + * therefore always exactly five 32-bit words. + */ +#ifdef __GNUC__ + +static __inline void +in_cksum_update(struct ip *ip) +{ + int __tmpsum; + __tmpsum = (int)ntohs(ip->ip_sum) + 256; + ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); +} + +#else + +#define in_cksum_update(ip) \ + do { \ + int __tmpsum; \ + __tmpsum = (int)ntohs(ip->ip_sum) + 256; \ + ip->ip_sum = htons(__tmpsum + (__tmpsum >> 16)); \ + } while(0) + +#endif + +typedef unsigned in_psum_t; +#ifdef KERNEL +u_int in_cksum_hdr(const struct ip *ip); +in_psum_t in_cksum_partial(in_psum_t psum, const u_short *w, int len); +int in_cksum_finalize(in_psum_t psum); +#endif /* KERNEL */ + +#endif /* _MACHINE_IN_CKSUM_H_ */ diff --git a/sys/alpha/include/ipl.h b/sys/alpha/include/ipl.h new file mode 100644 index 0000000..d4ed20e --- /dev/null +++ b/sys/alpha/include/ipl.h @@ -0,0 +1,75 @@ +/*- + * Copyright (c) 1998 Doug Rabson + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +#ifndef _MACHINE_IPL_H_ +#define _MACHINE_IPL_H_ + +#include <machine/alpha_cpu.h> + +/* IPL-lowering/restoring macros */ +#define splx(s) \ + ((s) == ALPHA_PSL_IPL_0 ? spl0() : alpha_pal_swpipl(s)) +#define splsoft() alpha_pal_swpipl(ALPHA_PSL_IPL_SOFT) +#define splsoftclock() splsoft() +#define splsoftnet() splsoft() + +/* IPL-raising functions/macros */ +static __inline int _splraise __P((int)) __attribute__ ((unused)); +static __inline int +_splraise(s) + int s; +{ + int cur = alpha_pal_rdps() & ALPHA_PSL_IPL_MASK; + return (s > cur ? alpha_pal_swpipl(s) : cur); +} +#define splnet() _splraise(ALPHA_PSL_IPL_IO) +#define splbio() _splraise(ALPHA_PSL_IPL_IO) +#define splimp() _splraise(ALPHA_PSL_IPL_IO) +#define spltty() _splraise(ALPHA_PSL_IPL_IO) +#define splvm() _splraise(ALPHA_PSL_IPL_IO) +#define splclock() _splraise(ALPHA_PSL_IPL_CLOCK) +#define splstatclock() _splraise(ALPHA_PSL_IPL_CLOCK) +#define splhigh() _splraise(ALPHA_PSL_IPL_HIGH) + +/* + * simulated software interrupt register + */ +extern u_int64_t ssir; + +#define SIR_NET 0x1 +#define SIR_CLOCK 0x2 + +#define setsoftnet() ssir |= SIR_NET +#define setsoftclock() ssir |= SIR_CLOCK + +extern void spl0(void); + +/* XXX bogus */ +extern unsigned cpl; /* current priority level mask */ + +#endif /* !_MACHINE_MD_VAR_H_ */ diff --git a/sys/alpha/include/lock.h b/sys/alpha/include/lock.h index b5604e8..a00a1e3 100644 --- a/sys/alpha/include/lock.h +++ b/sys/alpha/include/lock.h @@ -22,7 +22,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: lock.h,v 1.5 1997/12/15 02:18:27 tegge Exp $ + * $Id: lock.h,v 1.1.1.1 1998/03/09 05:43:16 jb Exp $ */ @@ -38,5 +38,9 @@ struct simplelock { volatile int lock_data; }; +#define simple_lock_init(alp) +#define simple_lock(alp) +#define simple_lock_try(alp) 1 +#define simple_unlock(alp) #endif /* !_MACHINE_LOCK_H_ */ diff --git a/sys/alpha/include/md_var.h b/sys/alpha/include/md_var.h new file mode 100644 index 0000000..d70c1da --- /dev/null +++ b/sys/alpha/include/md_var.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 1998 Doug Rabson + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +#ifndef _MACHINE_MD_VAR_H_ +#define _MACHINE_MD_VAR_H_ + +/* + * Miscellaneous machine-dependent declarations. + */ + +extern char sigcode[]; +extern int szsigcode; +extern int Maxmem; +extern void (*netisrs[32]) __P((void)); + +void cpu_power_down __P((void)); +void cpu_halt __P((void)); +void cpu_reset __P((void)); +int is_physical_memory __P((vm_offset_t addr)); +void swi_vm __P((void)); +int vm_page_zero_idle __P((void)); +int fill_regs __P((struct proc *, struct reg *)); +int set_regs __P((struct proc *, struct reg *)); + +#endif /* !_MACHINE_MD_VAR_H_ */ diff --git a/sys/alpha/include/param.h b/sys/alpha/include/param.h index 92dbbc6..70101f0 100644 --- a/sys/alpha/include/param.h +++ b/sys/alpha/include/param.h @@ -1,4 +1,4 @@ -/* $Id: param.h,v 1.1 1998/01/10 10:13:15 jb Exp $ */ +/* $Id: param.h,v 1.2 1998/03/09 05:53:10 jb Exp $ */ /* From: NetBSD: param.h,v 1.20 1997/09/19 13:52:53 leo Exp */ /* @@ -70,25 +70,20 @@ #define ALIGN(p) (((u_long)(p) + ALIGNBYTES) &~ ALIGNBYTES) #define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) -#define NBPG (1 << ALPHA_PGSHIFT) /* bytes/page */ -#define PAGE_SIZE NBPG -#define PGOFSET (NBPG-1) /* byte off. into pg */ -#define PGSHIFT ALPHA_PGSHIFT /* LOG2(NBPG) */ -#define NPTEPG (1 << (PGSHIFT-PTESHIFT)) /* pte's/page */ - -#define SEGSHIFT (PGSHIFT + (PGSHIFT-PTESHIFT)) /* LOG2(NBSEG) */ -#define NBSEG (1 << SEGSHIFT) /* bytes/segment (8M) */ -#define SEGOFSET (NBSEG-1) /* byte off. into seg */ +#define PAGE_SIZE (1 << ALPHA_PGSHIFT) /* bytes/page */ +#define PAGE_SHIFT ALPHA_PGSHIFT +#define PAGE_MASK (PAGE_SIZE-1) +#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) #define KERNBASE 0xfffffc0000230000 /* start of kernel virtual */ #define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) -#define DEV_BSIZE 512 #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ -#define BLKDEV_IOSIZE 2048 -#ifndef MAXPHYS -#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ -#endif +#define DEV_BSIZE (1<<DEV_BSHIFT) + +#define BLKDEV_IOSIZE 2048 +#define DFLTPHYS (64 * 1024) /* default max raw I/O transfer size */ +#define MAXPHYS (128 * 1024) /* max raw I/O transfer size */ #define CLSIZE 1 #define CLSIZELOG2 0 @@ -97,11 +92,11 @@ #define SSIZE 1 /* initial stack size/NBPG */ #define SINCR 1 /* increment of stack/NBPG */ -#define UPAGES 2 /* pages of u-area */ -#define USPACE (UPAGES * NBPG) /* total size of u-area */ +#define UPAGES 2 /* pages of u-area */ +#define USPACE (UPAGES * PAGE_SIZE) /* total size of u-area */ #ifndef MSGBUFSIZE -#define MSGBUFSIZE NBPG /* default message buffer size */ +#define MSGBUFSIZE PAGE_SIZE /* default message buffer size */ #endif /* @@ -134,12 +129,12 @@ #endif /* pages ("clicks") to disk blocks */ -#define ctod(x) ((x) << (PGSHIFT - DEV_BSHIFT)) -#define dtoc(x) ((x) >> (PGSHIFT - DEV_BSHIFT)) +#define ctod(x) ((x) << (PAGE_SHIFT - DEV_BSHIFT)) +#define dtoc(x) ((x) >> (PAGE_SHIFT - DEV_BSHIFT)) /* pages to bytes */ -#define ctob(x) ((x) << PGSHIFT) -#define btoc(x) (((x) + PGOFSET) >> PGSHIFT) +#define ctob(x) ((x) << PAGE_SHIFT) +#define btoc(x) (((x) + PAGE_MASK) >> PAGE_SHIFT) /* bytes to disk blocks */ #define btodb(x) ((x) >> DEV_BSHIFT) @@ -156,10 +151,14 @@ /* * Mach derived conversion macros */ -#define alpha_round_page(x) ((((unsigned long)(x)) + NBPG - 1) & ~(NBPG-1)) -#define alpha_trunc_page(x) ((unsigned long)(x) & ~(NBPG-1)) -#define alpha_btop(x) ((unsigned long)(x) >> PGSHIFT) -#define alpha_ptob(x) ((unsigned long)(x) << PGSHIFT) +#define round_page(x) ((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) +#define trunc_page(x) ((unsigned long)(x) & ~(PAGE_MASK)) + +#define atop(x) ((unsigned long)(x) >> PAGE_SHIFT) +#define ptoa(x) ((unsigned long)(x) << PAGE_SHIFT) + +#define alpha_btop(x) ((unsigned long)(x) >> PAGE_SHIFT) +#define alpha_ptob(x) ((unsigned long)(x) << PAGE_SHIFT) #include <machine/intr.h> diff --git a/sys/alpha/include/pmap.h b/sys/alpha/include/pmap.h index 9f013ac..a928678 100644 --- a/sys/alpha/include/pmap.h +++ b/sys/alpha/include/pmap.h @@ -1,14 +1,10 @@ -/* $Id$ */ -/* From: NetBSD: pmap.old.h,v 1.16 1998/01/09 19:13:09 thorpej Exp */ - -/* - * Copyright (c) 1987 Carnegie-Mellon University - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. +/* + * Copyright (c) 1991 Regents of the University of California. + * All rights reserved. * * This code is derived from software contributed to Berkeley by * the Systems Programming Group of the University of Utah Computer - * Science Department. + * Science Department and William Jolitz of UUNET Technologies Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -38,103 +34,198 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * @(#)pmap.h 8.1 (Berkeley) 6/10/93 + * Derived from hp300 version by Mike Hibler, this version by William + * Jolitz uses a recursive map [a pde points to the page directory] to + * map the page tables using the pagetables themselves. This is done to + * reduce the impact on kernel virtual memory for lots of sparse address + * space, and to reduce the cost of memory to each process. + * + * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 + * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 + * from: i386 pmap.h,v 1.54 1997/11/20 19:30:35 bde Exp + * $Id$ */ -#ifndef _PMAP_MACHINE_ -#define _PMAP_MACHINE_ +#ifndef _MACHINE_PMAP_H_ +#define _MACHINE_PMAP_H_ -#include <machine/pte.h> -#include <machine/lock.h> - -extern vm_offset_t vtophys(vm_offset_t); - -#define ALPHA_PAGE_SIZE NBPG -#define ALPHA_SEG_SIZE NBSEG +/* + * Define meanings for a few software bits in the pte + */ +#define PG_V ALPHA_PTE_VALID +#define PG_FOR ALPHA_PTE_FAULT_ON_READ +#define PG_FOW ALPHA_PTE_FAULT_ON_WRITE +#define PG_FOE ALPHA_PTE_FAULT_ON_EXECUTE +#define PG_ASM ALPHA_PTE_ASM +#define PG_GH ALPHA_PTE_GRANULARITY +#define PG_KRE ALPHA_PTE_KR +#define PG_URE ALPHA_PTE_UR +#define PG_KWE ALPHA_PTE_KW +#define PG_UWE ALPHA_PTE_UW +#define PG_PROT ALPHA_PTE_PROT +#define PG_SHIFT 32 + +#define PG_W 0x00010000 /* software wired */ +#define PG_MANAGED 0x00020000 /* software managed */ -#define alpha_trunc_seg(x) (((u_long)(x)) & ~(ALPHA_SEG_SIZE-1)) -#define alpha_round_seg(x) alpha_trunc_seg((u_long)(x) + ALPHA_SEG_SIZE-1) +/* + * Pte related macros + */ +#define VADDR(l1, l2, l3) (((l1) << ALPHA_L1SHIFT) \ + + ((l2) << ALPHA_L2SHIFT) \ + + ((l3) << ALPHA_L3SHIFT) -typedef struct simplelock simple_lock_data_t; +#ifndef NKPT +#define NKPT 9 /* initial number of kernel page tables */ +#endif +#define NKLEV2MAPS 255 /* max number of lev2 page tables */ +#define NKLEV3MAPS (NKLEV2MAPS << ALPHA_PTSHIFT) /* max number of lev3 page tables */ /* - * Pmap stuff + * The *PTDI values control the layout of virtual memory + * + * XXX This works for now, but I am not real happy with it, I'll fix it + * right after I fix locore.s and the magic 28K hole + * + * SMP_PRIVPAGES: The per-cpu address space is 0xff80000 -> 0xffbfffff */ -struct pmap { - pt_entry_t *pm_ptab; /* KVA of page table */ - pt_entry_t *pm_stab; /* KVA of segment table */ - pt_entry_t pm_stpte; /* PTE mapping STE */ - short pm_sref; /* segment table ref count */ - short pm_count; /* pmap reference count */ - simple_lock_data_t pm_lock; /* lock on pmap */ - struct pmap_statistics pm_stats; /* pmap statistics */ - long pm_ptpages; /* more stats: PT pages */ -}; +#define PTLEV1I (NPTEPG-1) /* Lev0 entry that points to Lev0 */ +#define K0SEGLEV1I (NPTEPG/2) +#define K1SEGLEV1I (K0SEGLEV1I+(NPTEPG/4)) -typedef struct pmap *pmap_t; +#define NUSERLEV2MAPS (NPTEPG/2) +#define NUSERLEV3MAPS (NUSERLEV2MAPS << ALPHA_PTSHIFT) + +#ifndef LOCORE -extern struct pmap kernel_pmap_store; +#include <sys/queue.h> -#define pmap_kernel() (&kernel_pmap_store) -#define active_pmap(pm) \ - ((pm) == pmap_kernel() \ - || curproc == NULL \ - || (pm) == curproc->p_vmspace->vm_map.pmap) -#define active_user_pmap(pm) \ - (curproc && \ - (pm) != pmap_kernel() && (pm) == curproc->p_vmspace->vm_map.pmap) +typedef alpha_pt_entry_t pt_entry_t; + +#define PTESIZE sizeof(pt_entry_t) /* for assembly files */ /* - * For each vm_page_t, there is a list of all currently valid virtual - * mappings of that page. An entry is a pv_entry_t, the list is pv_table. + * Address of current address space page table maps */ -typedef struct pv_entry { - struct pv_entry *pv_next; /* next pv_entry */ - struct pmap *pv_pmap; /* pmap where mapping lies */ - vm_offset_t pv_va; /* virtual address for mapping */ - pt_entry_t *pv_ptpte; /* non-zero if VA maps a PT page */ - struct pmap *pv_ptpmap; /* if pv_ptpte, pmap for PT page */ - int pv_flags; /* flags */ -} *pv_entry_t; +#ifdef KERNEL +extern pt_entry_t PTmap[]; /* lev3 page tables */ +extern pt_entry_t PTlev2[]; /* lev2 page tables */ +extern pt_entry_t PTlev1[]; /* lev1 page table */ +extern pt_entry_t PTlev1pte; /* pte that maps lev1 page table */ +#endif -#define PV_PTPAGE 0x01 /* header: entry maps a page table page */ +#ifdef KERNEL +/* + * virtual address to page table entry and + * to physical address. + * Note: this work recursively, thus vtopte of a pte will give + * the corresponding lev1 that in turn maps it. + */ +#define vtopte(va) (PTmap + (alpha_btop(va) \ + & ((1 << 3*ALPHA_PTSHIFT)-1))) -struct pv_page_info { - TAILQ_ENTRY(pv_page) pgi_list; - struct pv_entry *pgi_freelist; - int pgi_nfree; -}; +/* + * Routine: pmap_kextract + * Function: + * Extract the physical page address associated + * kernel virtual address. + */ +static __inline vm_offset_t +pmap_kextract(vm_offset_t va) +{ + vm_offset_t pa; + if (va >= ALPHA_K0SEG_BASE && va <= ALPHA_K0SEG_END) + pa = ALPHA_K0SEG_TO_PHYS(va); + else + pa = alpha_ptob(ALPHA_PTE_TO_PFN(*vtopte(va))) + | (va & PAGE_MASK); + return pa; +} + +#define vtophys(va) pmap_kextract(((vm_offset_t) (va))) + +#endif /* KERNEL */ + +/* + * Pmap stuff + */ +struct pv_entry; +typedef struct { + int pv_list_count; + struct vm_page *pv_vm_page; + int pv_flags; + TAILQ_HEAD(,pv_entry) pv_list; +} pv_table_t; -#define NPVPPG ((NBPG - sizeof(struct pv_page_info)) / sizeof(struct pv_entry)) +#define PV_TABLE_MOD 0x01 /* modified */ +#define PV_TABLE_REF 0x02 /* referenced */ -struct pv_page { - struct pv_page_info pvp_pgi; - struct pv_entry pvp_pv[NPVPPG]; +struct pmap { + pt_entry_t *pm_lev1; /* KVA of lev0map */ + vm_object_t pm_pteobj; /* Container for pte's */ + TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */ + int pm_count; /* reference count */ + int pm_flags; /* pmap flags */ + struct pmap_statistics pm_stats; /* pmap statistics */ + struct vm_page *pm_ptphint; /* pmap ptp hint */ }; -/* - * Physical page attributes. - */ -typedef int pmap_attr_t; -#define PMAP_ATTR_MOD 0x01 /* modified */ -#define PMAP_ATTR_REF 0x02 /* referenced */ +#define pmap_resident_count(pmap) (pmap)->pm_stats.resident_count -#ifdef _KERNEL -#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count) -#define pmap_wired_count(pmap) ((pmap)->pm_stats.wired_count) +#define PM_FLAG_LOCKED 0x1 +#define PM_FLAG_WANTED 0x2 -extern pt_entry_t *Sysmap; -extern char *vmmap; /* map for mem, dumps, etc. */ +typedef struct pmap *pmap_t; -#if defined(MACHINE_NEW_NONCONTIG) -#define PMAP_STEAL_MEMORY /* enable pmap_steal_memory() */ +#ifdef KERNEL +extern pmap_t kernel_pmap; #endif -/* Machine-specific functions. */ -void pmap_bootstrap __P((vm_offset_t firstaddr, vm_offset_t ptaddr)); -void pmap_emulate_reference __P((struct proc *p, vm_offset_t v, - int user, int write)); -void pmap_unmap_prom __P((void)); -#endif /* _KERNEL */ +/* + * For each vm_page_t, there is a list of all currently valid virtual + * mappings of that page. An entry is a pv_entry_t, the list is pv_table. + */ +typedef struct pv_entry { + pmap_t pv_pmap; /* pmap where mapping lies */ + vm_offset_t pv_va; /* virtual address for mapping */ + TAILQ_ENTRY(pv_entry) pv_list; + TAILQ_ENTRY(pv_entry) pv_plist; + vm_page_t pv_ptem; /* VM page for pte */ +} *pv_entry_t; -#endif /* _PMAP_MACHINE_ */ +#define PV_ENTRY_NULL ((pv_entry_t) 0) + +#define PV_CI 0x01 /* all entries must be cache inhibited */ +#define PV_PTPAGE 0x02 /* entry maps a page table page */ + +#ifdef KERNEL + +extern caddr_t CADDR1; +extern pt_entry_t *CMAP1; +extern vm_offset_t avail_end; +extern vm_offset_t avail_start; +extern vm_offset_t clean_eva; +extern vm_offset_t clean_sva; +extern vm_offset_t phys_avail[]; +extern char *ptvmmap; /* poor name! */ +extern vm_offset_t virtual_avail; +extern vm_offset_t virtual_end; + +vm_offset_t pmap_steal_memory __P((vm_size_t)); +void pmap_bootstrap __P((vm_offset_t, u_int)); +void pmap_setdevram __P((unsigned long long basea, vm_offset_t sizea)); +int pmap_uses_prom_console __P((void)); +pmap_t pmap_kernel __P((void)); +void *pmap_mapdev __P((vm_offset_t, vm_size_t)); +unsigned *pmap_pte __P((pmap_t, vm_offset_t)) __pure2; +vm_page_t pmap_use_pt __P((pmap_t, vm_offset_t)); +void pmap_set_opt __P((unsigned *)); +void pmap_set_opt_bsp __P((void)); +void pmap_deactivate __P((struct proc *p)); +void pmap_emulate_reference __P((struct proc *p, vm_offset_t v, int user, int write)); + +#endif /* KERNEL */ + +#endif /* !LOCORE */ + +#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/alpha/include/proc.h b/sys/alpha/include/proc.h index 1f433c5..6cb6d1b 100644 --- a/sys/alpha/include/proc.h +++ b/sys/alpha/include/proc.h @@ -1,4 +1,4 @@ -/* $Id$ +/* $Id: proc.h,v 1.1.1.1 1998/03/09 05:43:16 jb Exp $ */ /* From: NetBSD: proc.h,v 1.3 1997/04/06 08:47:36 cgd Exp */ /* diff --git a/sys/alpha/include/prom.h b/sys/alpha/include/prom.h new file mode 100644 index 0000000..84f5f9c --- /dev/null +++ b/sys/alpha/include/prom.h @@ -0,0 +1,104 @@ +/* $NetBSD: prom.h,v 1.7 1997/04/06 08:47:37 cgd Exp $ */ + +/* + * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Keith Bostic, 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 ASSEMBLER +struct prom_vec { + u_int64_t routine; + void *routine_arg; +}; + +/* The return value from a prom call. */ +typedef union { + struct { + u_int64_t + retval : 32, /* return value. */ + unit : 8, + mbz : 8, + error : 13, + status : 3; + } u; + u_int64_t bits; +} prom_return_t; + +#ifdef STANDALONE +int getchar __P((void)); +int prom_open __P((char *, int)); +void putchar __P((int)); +#endif + +void prom_halt __P((int)) __attribute__((__noreturn__)); +int prom_getenv __P((int, char *, int)); + +#endif + +/* Prom operation values. */ +#define PROM_R_CLOSE 0x11 +#define PROM_R_GETC 0x01 +#define PROM_R_GETENV 0x22 +#define PROM_R_OPEN 0x10 +#define PROM_R_PUTS 0x02 +#define PROM_R_READ 0x13 +#define PROM_R_WRITE 0x14 + +/* Environment variable values. */ +#define PROM_E_BOOTED_DEV 0x4 +#define PROM_E_BOOTED_FILE 0x6 +#define PROM_E_BOOTED_OSFLAGS 0x8 +#define PROM_E_TTY_DEV 0xf + +/* + * There have to be stub routines to do the copying that ensures that the + * PROM doesn't get called with an address larger than 32 bits. Calls that + * either don't need to copy anything, or don't need the copy because it's + * already being done elsewhere, are defined here. + */ +#define prom_close(chan) \ + prom_dispatch(PROM_R_CLOSE, chan, 0, 0, 0) +#define prom_read(chan, len, buf, blkno) \ + prom_dispatch(PROM_R_READ, chan, len, (u_int64_t)buf, blkno) +#define prom_write(chan, len, buf, blkno) \ + prom_dispatch(PROM_R_WRITE, chan, len, (u_int64_t)buf, blkno) +#define prom_putstr(chan, str, len) \ + prom_dispatch(PROM_R_PUTS, chan, (u_int64_t)str, len, 0) +#define prom_getc(chan) \ + prom_dispatch(PROM_R_GETC, chan, 0, 0, 0) +#define prom_getenv_disp(id, buf, len) \ + prom_dispatch(PROM_R_GETENV, id, (u_int64_t)buf, len, 0) + +#ifndef ASSEMBLER +#ifdef KERNEL +void promcnputc __P((dev_t, int)); +int promcngetc __P((dev_t)); +int promcnlookc __P((dev_t, char *)); + +u_int64_t prom_dispatch __P((u_int64_t, u_int64_t, u_int64_t, u_int64_t, + u_int64_t)); +void init_bootstrap_console __P((void)); +#endif /* _KERNEL */ +#endif /* ASSEMBLER */ diff --git a/sys/alpha/include/psl.h b/sys/alpha/include/psl.h new file mode 100644 index 0000000..b54c48e --- /dev/null +++ b/sys/alpha/include/psl.h @@ -0,0 +1,32 @@ +/*- + * Copyright (c) 1998 Doug Rabson + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * $Id$ + */ + +/* + * XXX don't need this. + */ + diff --git a/sys/alpha/include/pte.h b/sys/alpha/include/pte.h index da211ca..4981272 100644 --- a/sys/alpha/include/pte.h +++ b/sys/alpha/include/pte.h @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: pte.h,v 1.1.1.1 1998/03/09 05:43:16 jb Exp $ */ /* From: NetBSD: pte.h,v 1.10 1997/09/02 19:07:22 thorpej Exp */ /* @@ -91,7 +91,7 @@ typedef alpha_pt_entry_t pt_entry_t; #define vatopa(va) \ ((PG_PFNUM(*kvtopte(va)) << PGSHIFT) | ((vm_offset_t)(va) & PGOFSET)) -#define ALPHA_STSIZE ((u_long)NBPG) /* 8k */ +#define ALPHA_STSIZE ((u_long)PAGE_SIZE) /* 8k */ #define ALPHA_MAX_PTSIZE ((u_long)(NPTEPG * NBPG)) /* 8M */ #ifdef _KERNEL diff --git a/sys/alpha/include/ptrace.h b/sys/alpha/include/ptrace.h new file mode 100644 index 0000000..2b4a9cb --- /dev/null +++ b/sys/alpha/include/ptrace.h @@ -0,0 +1,53 @@ +/* + * 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. 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, Berkeley and its contributors. + * 4. 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. + * + * @(#)ptrace.h 8.1 (Berkeley) 6/11/93 + * $Id: ptrace.h,v 1.6 1998/05/19 00:00:12 tegge Exp $ + */ + +#ifndef _MACHINE_PTRACE_H_ +#define _MACHINE_PTRACE_H_ + +/* + * Machine dependent trace commands. + */ +#define PT_GETREGS (PT_FIRSTMACH + 1) +#define PT_SETREGS (PT_FIRSTMACH + 2) +#define PT_GETFPREGS (PT_FIRSTMACH + 3) +#define PT_SETFPREGS (PT_FIRSTMACH + 4) + +#ifdef KERNEL +int ptrace_read_u_check __P((struct proc *p, vm_offset_t off, size_t len)); +#endif /* !KERNEL */ + +#endif + diff --git a/sys/alpha/include/reg.h b/sys/alpha/include/reg.h index d2d5ab9..3bbc69f 100644 --- a/sys/alpha/include/reg.h +++ b/sys/alpha/include/reg.h @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: reg.h,v 1.1.1.1 1998/03/09 05:43:16 jb Exp $ */ /* From: NetBSD: reg.h,v 1.3 1997/04/06 08:47:40 cgd Exp */ /* @@ -91,9 +91,10 @@ struct fpreg { u_int64_t fpr_cr; }; -#ifdef _KERNEL +#ifdef KERNEL void restorefpstate __P((struct fpreg *)); void savefpstate __P((struct fpreg *)); +void setregs __P((struct proc *, u_long, u_long)); #endif #endif /* _ALPHA_REG_H_ */ diff --git a/sys/alpha/include/rpb.h b/sys/alpha/include/rpb.h new file mode 100644 index 0000000..164127f --- /dev/null +++ b/sys/alpha/include/rpb.h @@ -0,0 +1,393 @@ +/* $NetBSD: rpb.h,v 1.20 1998/04/15 00:47:33 mjacob Exp $ */ + +/* + * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. + * All rights reserved. + * + * Author: Keith Bostic, 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. + */ + +/* + * From DEC 3000 300/400/500/600/700/800/900 System Programmer's Manual, + * EK-D3SYS-PM.B01. + */ + +/* + * HWRPB (Hardware Restart Parameter Block). + */ +#define HWRPB_ADDR 0x10000000 /* virtual address, at boot */ + +#ifndef ASSEMBLER +struct rpb { + u_int64_t rpb_phys; /* 0: HWRPB phys. address. */ + char rpb_magic[8]; /* 8: "HWRPB" (in ASCII) */ + u_int64_t rpb_version; /* 10 */ + u_int64_t rpb_size; /* 18: HWRPB size in bytes */ + u_int64_t rpb_primary_cpu_id; /* 20 */ + u_int64_t rpb_page_size; /* 28: (8192) */ + u_int64_t rpb_phys_addr_size; /* 30: (34) */ + u_int64_t rpb_max_asn; /* 38: (16) */ + char rpb_ssn[16]; /* 40: only first 10 valid */ + +#define ST_ADU 1 /* Alpha Demo. Unit (?) */ +#define ST_DEC_4000 2 /* "Cobra" (?) */ +#define ST_DEC_7000 3 /* "Ruby" (?) */ +#define ST_DEC_3000_500 4 /* "Flamingo" family (TC) */ +#define ST_DEC_2000_300 6 /* "Jensen" (EISA/ISA) */ +#define ST_DEC_3000_300 7 /* "Pelican" (TC) */ +#define ST_AVALON_A12 8 /* XXX Avalon Multicomputer */ +#define ST_DEC_2100_A500 9 /* "Sable" (?) */ +#define ST_DEC_APXVME_64 10 /* "AXPvme" (VME?) */ +#define ST_DEC_AXPPCI_33 11 /* "NoName" (PCI/ISA) */ +#define ST_DEC_21000 12 /* "TurboLaser" (PCI/EISA) */ +#define ST_DEC_2100_A50 13 /* "Avanti" (PCI/ISA) */ +#define ST_DEC_MUSTANG 14 /* "Mustang" (?) */ +#define ST_DEC_KN20AA 15 /* kn20aa (PCI/EISA) */ +#define ST_DEC_1000 17 /* "Mikasa" (PCI/ISA?) */ +#define ST_EB66 19 /* EB66 (PCI/ISA?) */ +#define ST_EB64P 20 /* EB64+ (PCI/ISA?) */ +#define ST_ALPHABOOK1 21 /* Alphabook (?) */ +#define ST_DEC_4100 22 /* "Rawhide" (PCI/EISA) */ +#define ST_DEC_EV45_PBP 23 /* "Lego" (?) */ +#define ST_DEC_2100A_A500 24 /* "Lynx" (?) */ +#define ST_EB164 26 /* EB164 (PCI/ISA) */ +#define ST_DEC_1000A 27 /* "Noritake" (?) */ +#define ST_DEC_ALPHAVME_224 28 /* "Cortex" (?) */ +#define ST_DEC_EV56_PBP 32 /* "Takara" (?) */ +#define ST_DEC_ALPHAVME_320 33 /* "Yukon" (VME?) */ + + u_int64_t rpb_type; /* 50: */ + +#define SV_MPCAP 0x00000001 /* multiprocessor capable */ + +#define SV_CONSOLE 0x0000001e /* console hardware mask */ +#define SV_CONSOLE_DETACHED 0x00000002 +#define SV_CONSOLE_EMBEDDED 0x00000004 + +#define SV_POWERFAIL 0x000000e0 /* powerfail mask */ +#define SV_PF_UNITED 0x00000020 +#define SV_PF_SEPARATE 0x00000040 +#define SV_PF_BBACKUP 0x00000060 +#define SV_PF_ACTION 0x00000100 /* powerfail restart */ + +#define SV_GRAPHICS 0x00000200 /* graphic engine present */ + +#define SV_ST_MASK 0x0000fc00 /* system type mask */ +#define SV_ST_RESERVED 0x00000000 /* RESERVED */ + +/* + * System types for the DEC 3000/500 (Flamingo) Family + */ +#define SV_ST_SANDPIPER 0x00000400 /* Sandpiper; 3000/400 */ +#define SV_ST_FLAMINGO 0x00000800 /* Flamingo; 3000/500 */ +#define SV_ST_HOTPINK 0x00000c00 /* "Hot Pink"; 3000/500X */ +#define SV_ST_FLAMINGOPLUS 0x00001000 /* Flamingo+; 3000/800 */ +#define SV_ST_ULTRA 0x00001400 /* "Ultra", aka Flamingo+ */ +#define SV_ST_SANDPLUS 0x00001800 /* Sandpiper+; 3000/600 */ +#define SV_ST_SANDPIPER45 0x00001c00 /* Sandpiper45; 3000/700 */ +#define SV_ST_FLAMINGO45 0x00002000 /* Flamingo45; 3000/900 */ + +/* + * System types for ??? + */ +#define SV_ST_SABLE 0x00000400 /* Sable (???) */ + +/* + * System types for the DEC 3000/300 (Pelican) Family + */ +#define SV_ST_PELICAN 0x00000000 /* Pelican; 3000/300 */ +#define SV_ST_PELICA 0x00000400 /* Pelica; 3000/300L */ +#define SV_ST_PELICANPLUS 0x00000800 /* Pelican+; 3000/300X */ +#define SV_ST_PELICAPLUS 0x00000c00 /* Pelica+; 3000/300LX */ + +/* + * System types for the AlphaStation Family + */ +#define SV_ST_AVANTI 0x00000000 /* Avanti; 400 4/233 */ +#define SV_ST_MUSTANG2_4_166 0x00000800 /* Mustang II; 200 4/166 */ +#define SV_ST_MUSTANG2_4_233 0x00001000 /* Mustang II; 200 4/233 */ +#define SV_ST_AVANTI_XXX 0x00001400 /* also Avanti; 400 4/233 */ +#define SV_ST_AVANTI_4_266 0x00002000 +#define SV_ST_MUSTANG2_4_100 0x00002400 /* Mustang II; 200 4/100 */ +#define SV_ST_AVANTI_4_233 0x0000a800 /* AlphaStation 255/233 */ + + u_int64_t rpb_variation; /* 58 */ + + char rpb_revision[8]; /* 60; only first 4 valid */ + u_int64_t rpb_intr_freq; /* 68; scaled by 4096 */ + u_int64_t rpb_cc_freq; /* 70: cycle cntr frequency */ + vm_offset_t rpb_vptb; /* 78: */ + u_int64_t rpb_reserved_arch; /* 80: */ + vm_offset_t rpb_tbhint_off; /* 88: */ + u_int64_t rpb_pcs_cnt; /* 90: */ + u_int64_t rpb_pcs_size; /* 98; pcs size in bytes */ + vm_offset_t rpb_pcs_off; /* A0: offset to pcs info */ + u_int64_t rpb_ctb_cnt; /* A8: console terminal */ + u_int64_t rpb_ctb_size; /* B0: ctb size in bytes */ + vm_offset_t rpb_ctb_off; /* B8: offset to ctb */ + vm_offset_t rpb_crb_off; /* C0: offset to crb */ + vm_offset_t rpb_memdat_off; /* C8: memory data offset */ + vm_offset_t rpb_condat_off; /* D0: config data offset */ + vm_offset_t rpb_fru_off; /* D8: FRU table offset */ + u_int64_t rpb_save_term; /* E0: terminal save */ + u_int64_t rpb_save_term_val; /* E8: */ + u_int64_t rpb_rest_term; /* F0: terminal restore */ + u_int64_t rpb_rest_term_val; /* F8: */ + u_int64_t rpb_restart; /* 100: restart */ + u_int64_t rpb_restart_val; /* 108: */ + u_int64_t rpb_reserve_os; /* 110: */ + u_int64_t rpb_reserve_hw; /* 118: */ + u_int64_t rpb_checksum; /* 120: HWRPB checksum */ + u_int64_t rpb_rxrdy; /* 128: receive ready */ + u_int64_t rpb_txrdy; /* 130: transmit ready */ + vm_offset_t rpb_dsrdb_off; /* 138: HWRPB + DSRDB offset */ + u_int64_t rpb_tbhint[8]; /* 149: TB hint block */ +}; + +/* + * PCS: Per-CPU information. + */ +struct pcs { + u_int8_t pcs_hwpcb[128]; /* 0: PAL dependent */ + +#define PCS_BIP 0x000001 /* boot in progress */ +#define PCS_RC 0x000002 /* restart possible */ +#define PCS_PA 0x000004 /* processor available */ +#define PCS_PP 0x000008 /* processor present */ +#define PCS_OH 0x000010 /* user halted */ +#define PCS_CV 0x000020 /* context valid */ +#define PCS_PV 0x000040 /* PALcode valid */ +#define PCS_PMV 0x000080 /* PALcode memory valid */ +#define PCS_PL 0x000100 /* PALcode loaded */ + +#define PCS_HALT_REQ 0xff0000 /* halt request mask */ +#define PCS_HALT_DEFAULT 0x000000 +#define PCS_HALT_SAVE_EXIT 0x010000 +#define PCS_HALT_COLD_BOOT 0x020000 +#define PCS_HALT_WARM_BOOT 0x030000 +#define PCS_HALT_STAY_HALTED 0x040000 +#define PCS_mbz 0xffffffffff000000 /* 24:63 -- must be zero */ + u_int64_t pcs_flags; /* 80: */ + + u_int64_t pcs_pal_memsize; /* 88: PAL memory size */ + u_int64_t pcs_pal_scrsize; /* 90: PAL scratch size */ + vm_offset_t pcs_pal_memaddr; /* 98: PAL memory addr */ + vm_offset_t pcs_pal_scraddr; /* A0: PAL scratch addr */ + struct { + u_int64_t + minorrev : 8, /* alphabetic char 'a' - 'z' */ + majorrev : 8, /* alphabetic char 'a' - 'z' */ +#define PAL_TYPE_STANDARD 0 +#define PAL_TYPE_VMS 1 +#define PAL_TYPE_OSF1 2 + pal_type : 8, /* PALcode type: + * 0 == standard + * 1 == OpenVMS + * 2 == OSF/1 + * 3-127 DIGITAL reserv. + * 128-255 non-DIGITAL reserv. + */ + sbz1 : 8, + compatibility : 16, /* Compatibility revision */ + proc_cnt : 16; /* Processor count */ + } pcs_pal_rev; /* A8: */ +#define pcs_minorrev pcs_pal_rev.minorrev +#define pcs_majorrev pcs_pal_rev.majorrev +#define pcs_pal_type pcs_pal_rev.pal_type +#define pcs_compatibility pcs_pal_rev.compatibility +#define pcs_proc_cnt pcs_pal_rev.proc_cnt + + u_int64_t pcs_proc_type; /* B0: processor type */ + +#define PCS_PROC_MAJOR 0x00000000ffffffff +#define PCS_PROC_MAJORSHIFT 0 + +#define PCS_PROC_EV3 1 /* EV3 */ +#define PCS_PROC_EV4 2 /* EV4: 21064 */ +#define PCS_PROC_SIMULATION 3 /* Simulation */ +#define PCS_PROC_LCA4 4 /* LCA4: 2106[68] */ +#define PCS_PROC_EV5 5 /* EV5: 21164 */ +#define PCS_PROC_EV45 6 /* EV45: 21064A */ +#define PCS_PROC_EV56 7 /* EV56: 21164A */ +#define PCS_PROC_EV6 8 /* EV6: 21264 */ +#define PCS_PROC_PCA56 9 /* PCA256: 21164PC */ + +#define PCS_PROC_MINOR 0xffffffff00000000 +#define PCS_PROC_MINORSHIFT 32 + + /* Minor number interpretation is processor specific. See cpu.c. */ + + u_int64_t pcs_proc_var; /* B8: processor variation. */ + +#define PCS_VAR_VAXFP 0x0000000000000001 /* VAX FP support */ +#define PCS_VAR_IEEEFP 0x0000000000000002 /* IEEE FP support */ +#define PCS_VAR_PE 0x0000000000000004 /* Primary Eligible */ +#define PCS_VAR_RESERVED 0xfffffffffffffff8 /* Reserved */ + + char pcs_proc_revision[8]; /* C0: only first 4 valid */ + char pcs_proc_sn[16]; /* C8: only first 10 valid */ + vm_offset_t pcs_machcheck; /* D8: mach chk phys addr. */ + u_int64_t pcs_machcheck_len; /* E0: length in bytes */ + vm_offset_t pcs_halt_pcbb; /* E8: phys addr of halt PCB */ + vm_offset_t pcs_halt_pc; /* F0: halt PC */ + u_int64_t pcs_halt_ps; /* F8: halt PS */ + u_int64_t pcs_halt_r25; /* 100: halt argument list */ + u_int64_t pcs_halt_r26; /* 108: halt return addr list */ + u_int64_t pcs_halt_r27; /* 110: halt procedure value */ + +#define PCS_HALT_RESERVED 0 +#define PCS_HALT_POWERUP 1 +#define PCS_HALT_CONSOLE_HALT 2 +#define PCS_HALT_CONSOLE_CRASH 3 +#define PCS_HALT_KERNEL_MODE 4 +#define PCS_HALT_KERNEL_STACK_INVALID 5 +#define PCS_HALT_DOUBLE_ERROR_ABORT 6 +#define PCS_HALT_SCBB 7 +#define PCS_HALT_PTBR 8 /* 9-FF: reserved */ + u_int64_t pcs_halt_reason; /* 118: */ + + u_int64_t pcs_reserved_soft; /* 120: preserved software */ + u_int64_t pcs_buffer[21]; /* 128: console buffers */ + +#define PALvar_reserved 0 +#define PALvar_OpenVMS 1 +#define PALvar_OSF1 2 + u_int64_t pcs_palrevisions[16]; /* 1D0: PALcode revisions */ + + u_int64_t pcs_reserved_arch[6]; /* 250: reserved arch */ +}; + +/* + * CTB: Console Terminal Block + */ +struct ctb { + u_int64_t ctb_type; /* 0: always 4 */ + u_int64_t ctb_unit; /* 8: */ + u_int64_t ctb_reserved; /* 16: */ + u_int64_t ctb_len; /* 24: bytes of info */ + u_int64_t ctb_ipl; /* 32: console ipl level */ + vm_offset_t ctb_tintr_vec; /* 40: transmit vec (0x800) */ + vm_offset_t ctb_rintr_vec; /* 48: receive vec (0x800) */ + +#define CTB_GRAPHICS 3 /* graphics device */ +#define CTB_NETWORK 0xC0 /* network device */ +#define CTB_PRINTERPORT 2 /* printer port on the SCC */ + u_int64_t ctb_term_type; /* 56: terminal type */ + + u_int64_t ctb_keybd_type; /* 64: keyboard nationality */ + vm_offset_t ctb_keybd_trans; /* 72: trans. table addr */ + vm_offset_t ctb_keybd_map; /* 80: map table addr */ + u_int64_t ctb_keybd_state; /* 88: keyboard flags */ + u_int64_t ctb_keybd_last; /* 96: last key entered */ + vm_offset_t ctb_font_us; /* 104: US font table addr */ + vm_offset_t ctb_font_mcs; /* 112: MCS font table addr */ + u_int64_t ctb_font_width; /* 120: font width, height */ + u_int64_t ctb_font_height; /* 128: in pixels */ + u_int64_t ctb_mon_width; /* 136: monitor width, height */ + u_int64_t ctb_mon_height; /* 144: in pixels */ + u_int64_t ctb_dpi; /* 152: monitor dots per inch */ + u_int64_t ctb_planes; /* 160: # of planes */ + u_int64_t ctb_cur_width; /* 168: cursor width, height */ + u_int64_t ctb_cur_height; /* 176: in pixels */ + u_int64_t ctb_head_cnt; /* 184: # of heads */ + u_int64_t ctb_opwindow; /* 192: opwindow on screen */ + vm_offset_t ctb_head_offset; /* 200: offset to head info */ + vm_offset_t ctb_putchar; /* 208: output char to TURBO */ + u_int64_t ctb_io_state; /* 216: I/O flags */ + u_int64_t ctb_listen_state; /* 224: listener flags */ + vm_offset_t ctb_xaddr; /* 232: extended info addr */ + u_int64_t ctb_turboslot; /* 248: TURBOchannel slot # */ + u_int64_t ctb_server_off; /* 256: offset to server info */ + u_int64_t ctb_line_off; /* 264: line parameter offset */ + u_int8_t ctb_csd; /* 272: console specific data */ +}; + +/* + * CRD: Console Routine Descriptor + */ +struct crd { + int64_t descriptor; + u_int64_t entry_va; +}; + +/* + * CRB: Console Routine Block + */ +struct crb { + struct crd *crb_v_dispatch; /* 0: virtual dispatch addr */ + vm_offset_t crb_p_dispatch; /* 8: phys dispatch addr */ + struct crd *crb_v_fixup; /* 10: virtual fixup addr */ + vm_offset_t crb_p_fixup; /* 18: phys fixup addr */ + u_int64_t crb_map_cnt; /* 20: phys/virt map entries */ + u_int64_t crb_page_cnt; /* 28: pages to be mapped */ +}; + +/* + * MDDT: Memory Data Descriptor Table + */ +struct mddt { + int64_t mddt_cksum; /* 0: 7-N checksum */ + vm_offset_t mddt_physaddr; /* 8: bank config addr + * IMPLEMENTATION SPECIFIC + */ + u_int64_t mddt_cluster_cnt; /* 10: memory cluster count */ + struct mddt_cluster { + vm_offset_t mddt_pfn; /* 0: starting PFN */ + u_int64_t mddt_pg_cnt; /* 8: 8KB page count */ + u_int64_t mddt_pg_test; /* 10: tested page count */ + vm_offset_t mddt_v_bitaddr; /* 18: bitmap virt addr */ + vm_offset_t mddt_p_bitaddr; /* 20: bitmap phys addr */ + int64_t mddt_bit_cksum; /* 28: bitmap checksum */ + +#define MDDT_NONVOLATILE 0x10 /* cluster is non-volatile */ +#define MDDT_PALCODE 0x01 /* console and PAL only */ +#define MDDT_SYSTEM 0x00 /* system software only */ +#define MDDT_mbz 0xfffffffffffffffc /* 2:63 -- must be zero */ + int64_t mddt_usage; /* 30: bitmap permissions */ + } mddt_clusters[1]; /* variable length array */ +}; + +/* + * DSR: Dynamic System Recognition. We're interested in the sysname + * offset. The data pointed to by sysname is: + * + * [8 bytes: length of system name][N bytes: system name string] + * + * The system name string is NUL-terminated. + */ +struct dsrdb { + int64_t dsr_smm; /* 0: SMM number */ + u_int64_t dsr_lurt_off; /* 8: LURT table offset */ + u_int64_t dsr_sysname_off; /* 16: offset to sysname */ +}; + +/* + * The DSR appeared in version 5 of the HWRPB. + */ +#define HWRPB_DSRDB_MINVERS 5 + +#ifdef _KERNEL +int cputype; +#endif + +#endif /* ASSEMBLER */ diff --git a/sys/alpha/include/vmparam.h b/sys/alpha/include/vmparam.h index bc543fd..612fe8e 100644 --- a/sys/alpha/include/vmparam.h +++ b/sys/alpha/include/vmparam.h @@ -1,4 +1,4 @@ -/* $Id$ */ +/* $Id: vmparam.h,v 1.1.1.1 1998/03/09 05:43:16 jb Exp $ */ /* From: NetBSD: vmparam.h,v 1.6 1997/09/23 23:23:23 mjacob Exp */ #ifndef _ALPHA_VMPARAM_H #define _ALPHA_VMPARAM_H @@ -74,6 +74,9 @@ #ifndef MAXSSIZ #define MAXSSIZ (1<<25) /* max stack size (32M) */ #endif +#ifndef SGROWSIZ +#define SGROWSIZ (128UL*1024) /* amount to grow stack */ +#endif /* * PTEs for mapping user space into the kernel for phyio operations. @@ -131,23 +134,30 @@ /* user/kernel map constants */ #define VM_MIN_ADDRESS ((vm_offset_t)ALPHA_USEG_BASE) /* 0 */ -#define VM_MAXUSER_ADDRESS ((vm_offset_t)0x0000000200000000) /* 8G XXX */ +#define VM_MAXUSER_ADDRESS ((vm_offset_t)(ALPHA_USEG_END + 1L)) #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS #define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)ALPHA_K1SEG_BASE) #define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)ALPHA_K1SEG_END) /* virtual sizes (bytes) for various kernel submaps */ -#ifndef _KERNEL -#define VM_MBUF_SIZE (NMBCLUSTERS*MCLBYTES) -#define VM_KMEM_SIZE (NKMEMCLUSTERS*CLBYTES) -#define VM_PHYS_SIZE (USRIOSIZE*CLBYTES) -#else -extern u_int32_t vm_mbuf_size, vm_kmem_size, vm_phys_size; -#define VM_MBUF_SIZE vm_mbuf_size -#define VM_KMEM_SIZE vm_kmem_size -#define VM_PHYS_SIZE vm_phys_size +#ifndef VM_KMEM_SIZE +#define VM_KMEM_SIZE (12 * 1024 * 1024) +#endif + +/* + * How many physical pages per KVA page allocated. + * min(max(VM_KMEM_SIZE, Physical memory/VM_KMEM_SIZE_SCALE), VM_KMEM_SIZE_MAX) + * is the total KVA space allocated for kmem_map. + */ +#ifndef VM_KMEM_SIZE_SCALE +#define VM_KMEM_SIZE_SCALE (4) /* XXX 8192 byte pages */ +#endif + +/* initial pagein size of beginning of executable file */ +#ifndef VM_INITIAL_PAGEIN +#define VM_INITIAL_PAGEIN 16 #endif /* some Alpha-specific constants */ -#define VPTBASE ((vm_offset_t)0xfffffffc00000000) /* Virt. pg table */ +#define VPTBASE ((vm_offset_t)0xfffffffe00000000) /* Virt. pg table */ #endif /* !_ALPHA_VMPARAM_H */ |