diff options
author | jhb <jhb@FreeBSD.org> | 2006-05-11 22:25:28 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2006-05-11 22:25:28 +0000 |
commit | 495a1b1a3b1290a8bf8b212746e1754e006c9359 (patch) | |
tree | 6bbfedee6e27e3fe509c804c4418b1bccbdea4a7 /sys/alpha | |
parent | 215bc87cc3d08e895798b17897efe450255327b5 (diff) | |
download | FreeBSD-src-495a1b1a3b1290a8bf8b212746e1754e006c9359.zip FreeBSD-src-495a1b1a3b1290a8bf8b212746e1754e006c9359.tar.gz |
First pass at removing Alpha kernel support.
Diffstat (limited to 'sys/alpha')
212 files changed, 0 insertions, 49541 deletions
diff --git a/sys/alpha/Makefile b/sys/alpha/Makefile deleted file mode 100644 index 4df175d..0000000 --- a/sys/alpha/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# $FreeBSD$ - -# Makefile for alpha tags file - -# SYS is normally set in Make.tags.inc -# SYS=/sys - -TAGDIR= alpha - -.include "../kern/Make.tags.inc" - -all: - @echo "make tags only" - -SALPHA= ${SYS}/alpha/mcbus/*.[ch] ${SYS}/alpha/tlsb/*.[ch] \ - ${SYS}/alpha/alpha/*.[ch] ${SYS}/alpha/pci/*.[ch] \ - ${SYS}/alpha/include/*.[ch] ${SYS}/alpha/isa/*.[ch] \ - ${SYS}/alpha/tc/*.[ch] ${SYS}/alpha/osf1/*.[ch] -AALPHA= ${SYS}/alpha/alpha/*.s - -tags:: - @rm -f tags - -ctags -wdt ${COMM} ${SALPHA} - egrep "^ENTRY(.*)|^ALTENTRY(.*)" ${AALPHA} | \ - sed "s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3 \1 /^\2(\3\4$$/;" \ - >> tags - sort -o tags tags - chmod 444 tags diff --git a/sys/alpha/alpha/api_up1000.c b/sys/alpha/alpha/api_up1000.c deleted file mode 100644 index b2577b0..0000000 --- a/sys/alpha/alpha/api_up1000.c +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * Copyright (c) 2000 Andrew Gallatin - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/termios.h> - -#include <machine/clock.h> -#include <machine/cpuconf.h> -#include <machine/intr.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <alpha/pci/irongatereg.h> -#include <alpha/pci/irongatevar.h> - -void api_up1000_init(void); -static void api_up1000_cons_init(void); - -void -api_up1000_init() -{ - platform.family = "UP1000"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - /* XXX Don't know the system variations, yet. */ - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "irongate"; - platform.cons_init = api_up1000_cons_init; -} - -static void -api_up1000_cons_init() -{ - struct ctb *ctb; - - irongate_init(); - - ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); - - switch (ctb->ctb_term_type) { - case 2: - boothowto |= RB_SERIAL; - break; - - case 3: - boothowto &= ~RB_SERIAL; - break; - - default: - printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); - printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot); - - panic("consinit: unknown console type %ld\n", - ctb->ctb_term_type); - } -} diff --git a/sys/alpha/alpha/atomic.s b/sys/alpha/alpha/atomic.s deleted file mode 100644 index 03b866f..0000000 --- a/sys/alpha/alpha/atomic.s +++ /dev/null @@ -1,143 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#include <machine/asm.h> - - .text - -LEAF(atomic_set_8, 2) - bic a0, 7, t1 -0: ldq_l t2, 0(t1) - extbl t2, a0, t0 - bis t0, a1, t0 - insbl t0, a0, t0 - mskbl t2, a0, t2 - or t2, t0, t0 - stq_c t0, 0(t1) - beq t0, 1f - RET -1: br 0b - END(atomic_set_8) - -LEAF(atomic_clear_8, 2) - bic a0, 7, t1 -0: ldq_l t2, 0(t1) - extbl t2, a0, t0 - bic t0, a1, t0 - insbl t0, a0, t0 - mskbl t2, a0, t2 - or t2, t0, t0 - stq_c t0, 0(t1) - beq t0, 1f - RET -1: br 0b - END(atomic_clear_8) - -LEAF(atomic_add_8, 2) - bic a0, 7, t1 -0: ldq_l t2, 0(t1) - extbl t2, a0, t0 - addl t0, a1, t0 - insbl t0, a0, t0 - mskbl t2, a0, t2 - or t2, t0, t0 - stq_c t0, 0(t1) - beq t0, 1f - RET -1: br 0b - END(atomic_add_8) - -LEAF(atomic_subtract_8, 2) - bic a0, 7, t1 -0: ldq_l t2, 0(t1) - extbl t2, a0, t0 - subl t0, a1, t0 - insbl t0, a0, t0 - mskbl t2, a0, t2 - or t2, t0, t0 - stq_c t0, 0(t1) - beq t0, 1f - RET -1: br 0b - END(atomic_subtract_8) - -LEAF(atomic_set_16, 2) - bic a0, 7, t1 -0: ldq_l t2, 0(t1) - extwl t2, a0, t0 - bis t0, a1, t0 - inswl t0, a0, t0 - mskwl t2, a0, t2 - or t2, t0, t0 - stq_c t0, 0(t1) - beq t0, 1f - RET -1: br 0b - END(atomic_set_16) - -LEAF(atomic_clear_16, 2) - bic a0, 7, t1 -0: ldq_l t2, 0(t1) - extwl t2, a0, t0 - bic t0, a1, t0 - inswl t0, a0, t0 - mskwl t2, a0, t2 - or t2, t0, t0 - stq_c t0, 0(t1) - beq t0, 1f - RET -1: br 0b - END(atomic_clear_16) - -LEAF(atomic_add_16, 2) - bic a0, 7, t1 -0: ldq_l t2, 0(t1) - extwl t2, a0, t0 - addl t0, a1, t0 - inswl t0, a0, t0 - mskwl t2, a0, t2 - or t2, t0, t0 - stq_c t0, 0(t1) - beq t0, 1f - RET -1: br 0b - END(atomic_add_16) - -LEAF(atomic_subtract_16, 2) - bic a0, 7, t1 -0: ldq_l t2, 0(t1) - extwl t2, a0, t0 - subl t0, a1, t0 - inswl t0, a0, t0 - mskwl t2, a0, t2 - or t2, t0, t0 - stq_c t0, 0(t1) - beq t0, 1f - RET -1: br 0b - END(atomic_subtract_16) diff --git a/sys/alpha/alpha/autoconf.c b/sys/alpha/alpha/autoconf.c deleted file mode 100644 index bae5277..0000000 --- a/sys/alpha/alpha/autoconf.c +++ /dev/null @@ -1,108 +0,0 @@ -/*- - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_bootp.h" -#include "opt_isa.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/reboot.h> -#include <sys/kernel.h> - -#include <sys/mount.h> -#include <sys/sysctl.h> -#include <sys/bus.h> -#include <sys/cons.h> - -#include <machine/md_var.h> -#include <machine/cpuconf.h> -#include <machine/rpb.h> -#include <machine/bootinfo.h> - -#include <cam/cam.h> -#include <cam/cam_ccb.h> -#include <cam/cam_sim.h> -#include <cam/cam_periph.h> -#include <cam/cam_xpt_sim.h> -#include <cam/cam_debug.h> - -static void configure_first(void *); -static void configure(void *); -static void configure_final(void *); - -SYSINIT(configure1, SI_SUB_CONFIGURE, SI_ORDER_FIRST, configure_first, NULL); -/* SI_ORDER_SECOND is hookable */ -SYSINIT(configure2, SI_SUB_CONFIGURE, SI_ORDER_THIRD, configure, NULL); -/* SI_ORDER_MIDDLE is hookable */ -SYSINIT(configure3, SI_SUB_CONFIGURE, SI_ORDER_ANY, configure_final, NULL); - -#ifdef DEV_ISA -#include <isa/isavar.h> -device_t isa_bus_device = 0; -#endif - -/* - * Determine i/o configuration for a machine. - */ -static void -configure_first(void *dummy) -{ - - device_add_child(root_bus, platform.iobus, 0); -} - -static void -configure(void *dummy) -{ - - root_bus_configure(); - - /* - * Probe ISA devices after everything. - */ -#ifdef DEV_ISA - if (isa_bus_device) - isa_probe_children(isa_bus_device); -#endif -} - -static void -configure_final(void *dummy) -{ - - /* - * Now we're ready to handle (pending) interrupts. - * XXX this is slightly misplaced. - */ - alpha_pal_swpipl(ALPHA_PSL_IPL_0); - - cninit_finish(); - cold = 0; -} diff --git a/sys/alpha/alpha/busdma_machdep.c b/sys/alpha/alpha/busdma_machdep.c deleted file mode 100644 index 4a3bd6d..0000000 --- a/sys/alpha/alpha/busdma_machdep.c +++ /dev/null @@ -1,1037 +0,0 @@ -/*- - * Copyright (c) 1997 Justin T. Gibbs. - * 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, - * without modification, immediately at the beginning of the file. - * 2. 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 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/bus.h> -#include <sys/systm.h> -#include <sys/interrupt.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/mbuf.h> -#include <sys/mutex.h> -#include <sys/proc.h> -#include <sys/uio.h> - -#include <vm/vm.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> - -#include <machine/atomic.h> -#include <machine/bus.h> -#include <machine/sgmap.h> -#include <machine/md_var.h> - -#define MAX_BPAGES 128 - -struct bus_dma_tag { - bus_dma_tag_t parent; - bus_size_t alignment; - bus_size_t boundary; - bus_addr_t lowaddr; - bus_addr_t highaddr; - bus_dma_filter_t *filter; - void *filterarg; - bus_size_t maxsize; - u_int nsegments; - bus_size_t maxsegsz; - int flags; - int ref_count; - int map_count; - bus_dma_lock_t *lockfunc; - void *lockfuncarg; - bus_dma_segment_t *segments; -}; - -struct bounce_page { - vm_offset_t vaddr; /* kva of bounce buffer */ - bus_addr_t busaddr; /* Physical address */ - vm_offset_t datavaddr; /* kva of client data */ - bus_size_t datacount; /* client data count */ - STAILQ_ENTRY(bounce_page) links; -}; - -int busdma_swi_pending; - -static struct mtx bounce_lock; -static STAILQ_HEAD(bp_list, bounce_page) bounce_page_list; -static int free_bpages; -static int reserved_bpages; -static int active_bpages; -static int total_bpages; - -struct bus_dmamap { - struct bp_list bpages; - int pagesneeded; - int pagesreserved; - bus_dma_tag_t dmat; - void *buf; /* unmapped buffer pointer */ - bus_size_t buflen; /* unmapped buffer length */ - vm_offset_t busaddress; /* address in bus space */ - bus_dmamap_callback_t *callback; - void *callback_arg; - void *sgmaphandle; /* handle into sgmap */ - STAILQ_ENTRY(bus_dmamap) links; -}; - -static STAILQ_HEAD(, bus_dmamap) bounce_map_waitinglist; -static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist; -static struct bus_dmamap nobounce_dmamap; - -static void init_bounce_pages(void *dummy); -static int alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages); -static int reserve_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map, - int commit); -static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, - vm_offset_t vaddr, bus_size_t size); -static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage); -static __inline int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr); - -/* - * Return true if a match is made. - * - * To find a match walk the chain of bus_dma_tag_t's looking for 'paddr'. - * - * If paddr is within the bounds of the dma tag then call the filter callback - * to check for a match, if there is no filter callback then assume a match. - */ -static __inline int -run_filter(bus_dma_tag_t dmat, bus_addr_t paddr) -{ - int retval; - - retval = 0; - do { - if (paddr > dmat->lowaddr - && paddr <= dmat->highaddr - && (dmat->filter == NULL - || (*dmat->filter)(dmat->filterarg, paddr) != 0)) - retval = 1; - - dmat = dmat->parent; - } while (retval == 0 && dmat != NULL); - return (retval); -} - -/* - * Convenience function for manipulating driver locks from busdma (during - * busdma_swi, for example). Drivers that don't provide their own locks - * should specify &Giant to dmat->lockfuncarg. Drivers that use their own - * non-mutex locking scheme don't have to use this at all. - */ -void -busdma_lock_mutex(void *arg, bus_dma_lock_op_t op) -{ - struct mtx *dmtx; - - dmtx = (struct mtx *)arg; - switch (op) { - case BUS_DMA_LOCK: - mtx_lock(dmtx); - break; - case BUS_DMA_UNLOCK: - mtx_unlock(dmtx); - break; - default: - panic("Unknown operation 0x%x for busdma_lock_mutex!", op); - } -} - -/* - * dflt_lock should never get called. It gets put into the dma tag when - * lockfunc == NULL, which is only valid if the maps that are associated - * with the tag are meant to never be defered. - * XXX Should have a way to identify which driver is responsible here. - */ -static void -dflt_lock(void *arg, bus_dma_lock_op_t op) -{ -#ifdef INVARIANTS - panic("driver error: busdma dflt_lock called"); -#else - printf("DRIVER_ERROR: busdma dflt_lock called\n"); -#endif -} - -#define BUS_DMA_MIN_ALLOC_COMP BUS_DMA_BUS4 -/* - * Allocate a device specific dma_tag. - */ -int -bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment, - bus_size_t boundary, bus_addr_t lowaddr, - bus_addr_t highaddr, bus_dma_filter_t *filter, - void *filterarg, bus_size_t maxsize, int nsegments, - bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, - void *lockfuncarg, bus_dma_tag_t *dmat) -{ - bus_dma_tag_t newtag; - int error = 0; - - /* Return a NULL tag on failure */ - *dmat = NULL; - - newtag = (bus_dma_tag_t)malloc(sizeof(*newtag), M_DEVBUF, M_NOWAIT); - if (newtag == NULL) - return (ENOMEM); - - newtag->parent = parent; - newtag->alignment = alignment; - newtag->boundary = boundary; - newtag->lowaddr = trunc_page(lowaddr) + (PAGE_SIZE - 1); - newtag->highaddr = trunc_page(highaddr) + (PAGE_SIZE - 1); - newtag->filter = filter; - newtag->filterarg = filterarg; - newtag->maxsize = maxsize; - newtag->nsegments = nsegments; - newtag->maxsegsz = maxsegsz; - newtag->flags = flags; - newtag->ref_count = 1; /* Count ourself */ - newtag->map_count = 0; - if (lockfunc != NULL) { - newtag->lockfunc = lockfunc; - newtag->lockfuncarg = lockfuncarg; - } else { - newtag->lockfunc = dflt_lock; - newtag->lockfuncarg = NULL; - } - - newtag->segments = NULL; - - /* Take into account any restrictions imposed by our parent tag */ - if (parent != NULL) { - newtag->lowaddr = MIN(parent->lowaddr, newtag->lowaddr); - newtag->highaddr = MAX(parent->highaddr, newtag->highaddr); - if (newtag->boundary == 0) - newtag->boundary = parent->boundary; - else if (parent->boundary != 0) - newtag->boundary = MIN(parent->boundary, - newtag->boundary); - if (newtag->filter == NULL) { - /* - * Short circuit looking at our parent directly - * since we have encapsulated all of its information - */ - newtag->filter = parent->filter; - newtag->filterarg = parent->filterarg; - newtag->parent = parent->parent; - } - if (newtag->parent != NULL) - atomic_add_int(&parent->ref_count, 1); - } - - if (newtag->lowaddr < ptoa(Maxmem) && (flags & BUS_DMA_ALLOCNOW) != 0) { - /* Must bounce */ - - if (ptoa(total_bpages) < maxsize) { - int pages; - - pages = atop(maxsize) - total_bpages; - - /* Add pages to our bounce pool */ - if (alloc_bounce_pages(newtag, pages) < pages) - error = ENOMEM; - } - /* Performed initial allocation */ - newtag->flags |= BUS_DMA_MIN_ALLOC_COMP; - } - - if (error != 0) { - free(newtag, M_DEVBUF); - } else { - *dmat = newtag; - } - return (error); -} - -int -bus_dma_tag_destroy(bus_dma_tag_t dmat) -{ - if (dmat != NULL) { - - if (dmat->map_count != 0) - return (EBUSY); - - while (dmat != NULL) { - bus_dma_tag_t parent; - - parent = dmat->parent; - atomic_subtract_int(&dmat->ref_count, 1); - if (dmat->ref_count == 0) { - if (dmat->segments != NULL) - free(dmat->segments, M_DEVBUF); - free(dmat, M_DEVBUF); - /* - * Last reference count, so - * release our reference - * count on our parent. - */ - dmat = parent; - } else - dmat = NULL; - } - } - return (0); -} - -/* - * Allocate a handle for mapping from kva/uva/physical - * address space into bus device space. - */ -int -bus_dmamap_create(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp) -{ - int error; - - error = 0; - - if ((dmat->flags & BUS_DMA_ISA) && chipset.sgmap != NULL) { - bus_dmamap_t map; - map = (bus_dmamap_t)malloc(sizeof(*map), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (map == NULL) - return (ENOMEM); - - map->busaddress = - sgmap_alloc_region(chipset.sgmap, - dmat->maxsize, - dmat->boundary, - &map->sgmaphandle); - dmat->map_count++; - *mapp = map; - return (0); - } - - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - M_NOWAIT); - if (dmat->segments == NULL) - return (ENOMEM); - } - - if (dmat->lowaddr < ptoa(Maxmem)) { - /* Must bounce */ - int maxpages; - - *mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF, - M_NOWAIT | M_ZERO); - if (*mapp == NULL) - return (ENOMEM); - - /* Initialize the new map */ - STAILQ_INIT(&((*mapp)->bpages)); - - /* - * Attempt to add pages to our pool on a per-instance - * basis up to a sane limit. - */ - maxpages = MIN(MAX_BPAGES, Maxmem - atop(dmat->lowaddr)); - if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0 - || (dmat->map_count > 0 - && total_bpages < maxpages)) { - int pages; - - pages = atop(dmat->maxsize) + 1; - pages = MIN(maxpages - total_bpages, pages); - - if (alloc_bounce_pages(dmat, pages) < pages) - error = ENOMEM; - - if ((dmat->flags & BUS_DMA_MIN_ALLOC_COMP) == 0) { - if (error == 0) - dmat->flags |= BUS_DMA_MIN_ALLOC_COMP; - } else { - error = 0; - } - } - } else { - *mapp = &nobounce_dmamap; - } - if (error == 0) - dmat->map_count++; - return (error); -} - -/* - * Destroy a handle for mapping from kva/uva/physical - * address space into bus device space. - */ -int -bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap_t map) -{ - if ((dmat->flags & BUS_DMA_ISA) && chipset.sgmap != NULL) { - sgmap_free_region(chipset.sgmap, map->sgmaphandle); - } - - if (map != NULL && map != &nobounce_dmamap) { - if (STAILQ_FIRST(&map->bpages) != NULL) - return (EBUSY); - free(map, M_DEVBUF); - } - dmat->map_count--; - return (0); -} - - -/* - * Allocate a piece of memory that can be efficiently mapped into - * bus device space based on the constraints lited in the dma tag. - * A dmamap to for use with dmamap_load is also allocated. - */ -int -bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, - bus_dmamap_t *mapp) -{ - int mflags; - - if (flags & BUS_DMA_NOWAIT) - mflags = M_NOWAIT; - else - mflags = M_WAITOK; - if (flags & BUS_DMA_ZERO) - mflags |= M_ZERO; - - /* If we succeed, no mapping/bouncing will be required */ - *mapp = &nobounce_dmamap; - - if (dmat->segments == NULL) { - dmat->segments = (bus_dma_segment_t *)malloc( - sizeof(bus_dma_segment_t) * dmat->nsegments, M_DEVBUF, - M_NOWAIT); - if (dmat->segments == NULL) - return (ENOMEM); - } - - if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) { - *vaddr = malloc(dmat->maxsize, M_DEVBUF, mflags); - } else { - /* - * XXX Use Contigmalloc until it is merged into this facility - * and handles multi-seg allocations. Nobody is doing - * multi-seg allocations yet though. - */ - *vaddr = contigmalloc(dmat->maxsize, M_DEVBUF, mflags, - 0ul, dmat->lowaddr, dmat->alignment? dmat->alignment : 1ul, - dmat->boundary); - } - if (*vaddr == NULL) - return (ENOMEM); - return (0); -} - -/* - * Free a piece of memory and it's allociated dmamap, that was allocated - * via bus_dmamem_alloc. Make the same choice for free/contigfree. - */ -void -bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) -{ - /* - * dmamem does not need to be bounced, so the map should be - * NULL - */ - if (map != &nobounce_dmamap) - panic("bus_dmamem_free: Invalid map freed\n"); - if ((dmat->maxsize <= PAGE_SIZE) && dmat->lowaddr >= ptoa(Maxmem)) - free(vaddr, M_DEVBUF); - else { - contigfree(vaddr, dmat->maxsize, M_DEVBUF); - } -} - -#define BUS_DMAMAP_NSEGS ((64 * 1024 / PAGE_SIZE) + 1) - -/* - * Map the buffer buf into bus space using the dmamap map. - */ - -int -bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf, - bus_size_t buflen, bus_dmamap_callback_t *callback, - void *callback_arg, int flags) -{ - bus_dma_segment_t segment; - vm_offset_t vaddr; - vm_offset_t paddr; - bus_dma_segment_t *sg; - int seg; - int error; - vm_offset_t nextpaddr; - - error = 0; - - if ((dmat->flags & BUS_DMA_ISA) && chipset.sgmap != NULL) { - /* - * For ISA dma, we use the chipset's scatter-gather - * map to map the tranfer into the ISA reachable range - * of the bus address space. - */ - vaddr = trunc_page((vm_offset_t) buf); - dmat->segments = &segment; - dmat->segments[0].ds_addr = - map->busaddress + (vm_offset_t) buf - vaddr; - dmat->segments[0].ds_len = buflen; - buflen = round_page((vm_offset_t) buf + buflen) - vaddr; - sgmap_load_region(chipset.sgmap, - map->busaddress, - vaddr, - buflen); - map->buflen = buflen; - (*callback)(callback_arg, dmat->segments, 1, error); - dmat->segments = NULL; - - return (0); - } - - /* - * If we are being called during a callback, pagesneeded will - * be non-zero, so we can avoid doing the work twice. - */ - if (dmat->lowaddr < ptoa(Maxmem) && map->pagesneeded == 0) { - vm_offset_t vendaddr; - - /* - * Count the number of bounce pages - * needed in order to complete this transfer - */ - vaddr = trunc_page(buf); - vendaddr = (vm_offset_t)buf + buflen; - - while (vaddr < vendaddr) { - paddr = pmap_kextract(vaddr); - if (run_filter(dmat, paddr) != 0) { - - map->pagesneeded++; - } - vaddr += PAGE_SIZE; - } - } - - /* Reserve Necessary Bounce Pages */ - if (map->pagesneeded != 0) { - mtx_lock(&bounce_lock); - if (flags & BUS_DMA_NOWAIT) { - if (reserve_bounce_pages(dmat, map, 0) != 0) { - mtx_unlock(&bounce_lock); - return (ENOMEM); - } - } else { - if (reserve_bounce_pages(dmat, map, 1) != 0) { - /* Queue us for resources */ - map->dmat = dmat; - map->buf = buf; - map->buflen = buflen; - map->callback = callback; - map->callback_arg = callback_arg; - STAILQ_INSERT_TAIL(&bounce_map_waitinglist, - map, links); - mtx_unlock(&bounce_lock); - return (EINPROGRESS); - } - } - mtx_unlock(&bounce_lock); - } - - vaddr = (vm_offset_t)buf; - sg = &dmat->segments[0]; - seg = 1; - sg->ds_len = 0; - - nextpaddr = 0; - - do { - bus_size_t size; - - paddr = pmap_kextract(vaddr); - size = PAGE_SIZE - (paddr & PAGE_MASK); - if (size > buflen) - size = buflen; - - if (map->pagesneeded != 0 && run_filter(dmat, paddr)) { - paddr = add_bounce_page(dmat, map, vaddr, size); - } - - if (sg->ds_len == 0) { - sg->ds_addr = paddr + chipset.dmoffset; - sg->ds_len = size; - } else if (paddr == nextpaddr) { - sg->ds_len += size; - } else { - /* Go to the next segment */ - sg++; - seg++; - if (seg > dmat->nsegments) - break; - sg->ds_addr = paddr + chipset.dmoffset; - sg->ds_len = size; - } - vaddr += size; - nextpaddr = paddr + size; - buflen -= size; - - } while (buflen > 0); - - if (buflen != 0) { - printf("bus_dmamap_load: Too many segs! buf_len = 0x%lx\n", - buflen); - error = EFBIG; - } - - (*callback)(callback_arg, dmat->segments, seg, error); - - return (0); -} - -/* - * Utility function to load a linear buffer. lastaddrp holds state - * between invocations (for multiple-buffer loads). segp contains - * the starting segment on entrace, and the ending segment on exit. - * first indicates if this is the first invocation of this function. - */ -static int -_bus_dmamap_load_buffer(bus_dma_tag_t dmat, - void *buf, bus_size_t buflen, - struct thread *td, - int flags, - vm_offset_t *lastaddrp, - bus_dma_segment_t *segs, - int *segp, - int first) -{ - bus_size_t sgsize; - bus_addr_t curaddr, lastaddr, baddr, bmask; - vm_offset_t vaddr = (vm_offset_t)buf; - int seg; - pmap_t pmap; - - if (td != NULL) - pmap = vmspace_pmap(td->td_proc->p_vmspace); - else - pmap = NULL; - - lastaddr = *lastaddrp; - bmask = ~(dmat->boundary - 1); - - for (seg = *segp; buflen > 0 ; ) { - /* - * Get the physical address for this segment. - */ - if (pmap) - curaddr = pmap_extract(pmap, vaddr); - else - curaddr = pmap_kextract(vaddr); - - /* - * Compute the segment size, and adjust counts. - */ - sgsize = PAGE_SIZE - ((u_long)curaddr & PAGE_MASK); - if (buflen < sgsize) - sgsize = buflen; - - /* - * Make sure we don't cross any boundaries. - */ - if (dmat->boundary > 0) { - baddr = (curaddr + dmat->boundary) & bmask; - if (sgsize > (baddr - curaddr)) - sgsize = (baddr - curaddr); - } - - /* - * Insert chunk into a segment, coalescing with - * previous segment if possible. - */ - if (first) { - segs[seg].ds_addr = curaddr + chipset.dmoffset; - segs[seg].ds_len = sgsize; - first = 0; - } else { - if (curaddr == lastaddr && - (segs[seg].ds_len + sgsize) <= dmat->maxsegsz && - (dmat->boundary == 0 || - (segs[seg].ds_addr & bmask) == (curaddr & bmask))) - segs[seg].ds_len += sgsize; - else { - if (++seg >= dmat->nsegments) - break; - segs[seg].ds_addr = curaddr + chipset.dmoffset;; - segs[seg].ds_len = sgsize; - } - } - - lastaddr = curaddr + sgsize; - vaddr += sgsize; - buflen -= sgsize; - } - - *segp = seg; - *lastaddrp = lastaddr; - - /* - * Did we fit? - */ - return (buflen != 0 ? EFBIG : 0); /* XXX better return value here? */ -} - -/* - * Like _bus_dmamap_load(), but for mbufs. - */ -int -bus_dmamap_load_mbuf(bus_dma_tag_t dmat, bus_dmamap_t map, - struct mbuf *m0, - bus_dmamap_callback2_t *callback, void *callback_arg, - int flags) -{ - int nsegs, error; - - KASSERT(dmat->lowaddr >= ptoa(Maxmem) || map != NULL, - ("bus_dmamap_load_mbuf: No support for bounce pages!")); - M_ASSERTPKTHDR(m0); - - nsegs = 0; - error = 0; - if (m0->m_pkthdr.len <= dmat->maxsize) { - int first = 1; - bus_addr_t lastaddr = 0; - struct mbuf *m; - - for (m = m0; m != NULL && error == 0; m = m->m_next) { - if (m->m_len > 0) { - error = _bus_dmamap_load_buffer(dmat, - m->m_data, m->m_len, - NULL, flags, &lastaddr, - dmat->segments, &nsegs, first); - first = 0; - } - } - } else { - error = EINVAL; - } - - if (error) { - /* force "no valid mappings" in callback */ - (*callback)(callback_arg, dmat->segments, 0, 0, error); - } else { - (*callback)(callback_arg, dmat->segments, - nsegs+1, m0->m_pkthdr.len, error); - } - return (error); -} - -int -bus_dmamap_load_mbuf_sg(bus_dma_tag_t dmat, bus_dmamap_t map, - struct mbuf *m0, bus_dma_segment_t *segs, - int *nsegs, int flags) -{ - int error; - - KASSERT(dmat->lowaddr >= ptoa(Maxmem) || map != NULL, - ("bus_dmamap_load_mbuf: No support for bounce pages!")); - M_ASSERTPKTHDR(m0); - - *nsegs = 0; - error = 0; - if (m0->m_pkthdr.len <= dmat->maxsize) { - int first = 1; - bus_addr_t lastaddr = 0; - struct mbuf *m; - - for (m = m0; m != NULL && error == 0; m = m->m_next) { - if (m->m_len > 0) { - error = _bus_dmamap_load_buffer(dmat, - m->m_data, m->m_len, - NULL, flags, &lastaddr, - segs, nsegs, first); - first = 0; - } - } - ++*nsegs; - } else { - error = EINVAL; - } - - return (error); -} - -/* - * Like _bus_dmamap_load(), but for uios. - */ -int -bus_dmamap_load_uio(bus_dma_tag_t dmat, bus_dmamap_t map, - struct uio *uio, - bus_dmamap_callback2_t *callback, void *callback_arg, - int flags) -{ - bus_addr_t lastaddr; - int nsegs, error, first, i; - bus_size_t resid; - struct iovec *iov; - struct thread *td = NULL; - - KASSERT(dmat->lowaddr >= ptoa(Maxmem) || map != NULL, - ("bus_dmamap_load_uio: No support for bounce pages!")); - - resid = uio->uio_resid; - iov = uio->uio_iov; - - if (uio->uio_segflg == UIO_USERSPACE) { - td = uio->uio_td; - KASSERT(td != NULL, - ("bus_dmamap_load_uio: USERSPACE but no proc")); - } - - nsegs = 0; - error = 0; - first = 1; - for (i = 0; i < uio->uio_iovcnt && resid != 0 && !error; i++) { - /* - * Now at the first iovec to load. Load each iovec - * until we have exhausted the residual count. - */ - bus_size_t minlen = - resid < iov[i].iov_len ? resid : iov[i].iov_len; - caddr_t addr = (caddr_t) iov[i].iov_base; - - if (minlen > 0) { - error = _bus_dmamap_load_buffer(dmat, addr, minlen, - td, flags, &lastaddr, dmat->segments, - &nsegs, first); - first = 0; - - resid -= minlen; - } - } - - if (error) { - /* force "no valid mappings" in callback */ - (*callback)(callback_arg, dmat->segments, 0, 0, error); - } else { - (*callback)(callback_arg, dmat->segments, - nsegs+1, uio->uio_resid, error); - } - return (error); -} - -/* - * Release the mapping held by map. - */ -void -_bus_dmamap_unload(bus_dma_tag_t dmat, bus_dmamap_t map) -{ - struct bounce_page *bpage; - - if ((dmat->flags & BUS_DMA_ISA) && chipset.sgmap != NULL) { - sgmap_unload_region(chipset.sgmap, - map->busaddress, - map->buflen); - return; - } - - while ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) { - STAILQ_REMOVE_HEAD(&map->bpages, links); - free_bounce_page(dmat, bpage); - } -} - -void -_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, bus_dmasync_op_t op) -{ - struct bounce_page *bpage; - - if ((bpage = STAILQ_FIRST(&map->bpages)) != NULL) { - /* - * Handle data bouncing. We might also - * want to add support for invalidating - * the caches on broken hardware - */ - if (op & BUS_DMASYNC_PREWRITE) { - while (bpage != NULL) { - bcopy((void *)bpage->datavaddr, - (void *)bpage->vaddr, - bpage->datacount); - bpage = STAILQ_NEXT(bpage, links); - } - } - - if (op & BUS_DMASYNC_POSTREAD) { - while (bpage != NULL) { - bcopy((void *)bpage->vaddr, - (void *)bpage->datavaddr, - bpage->datacount); - bpage = STAILQ_NEXT(bpage, links); - } - } - } - - /* Ensure any pending writes have drained. */ - if (op & (BUS_DMASYNC_PREWRITE)) - alpha_mb(); -} - -static void -init_bounce_pages(void *dummy __unused) -{ - - free_bpages = 0; - reserved_bpages = 0; - active_bpages = 0; - total_bpages = 0; - STAILQ_INIT(&bounce_page_list); - STAILQ_INIT(&bounce_map_waitinglist); - STAILQ_INIT(&bounce_map_callbacklist); - mtx_init(&bounce_lock, "bounce pages lock", NULL, MTX_DEF); -} -SYSINIT(bpages, SI_SUB_LOCK, SI_ORDER_ANY, init_bounce_pages, NULL); - -static int -alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages) -{ - int count; - - count = 0; - while (numpages > 0) { - struct bounce_page *bpage; - - bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF, - M_NOWAIT | M_ZERO); - - if (bpage == NULL) - break; - bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF, - M_NOWAIT, 0ul, - dmat->lowaddr, - PAGE_SIZE, - dmat->boundary); - if (bpage->vaddr == 0) { - free(bpage, M_DEVBUF); - break; - } - bpage->busaddr = pmap_kextract(bpage->vaddr); - mtx_lock(&bounce_lock); - STAILQ_INSERT_TAIL(&bounce_page_list, bpage, links); - total_bpages++; - free_bpages++; - mtx_unlock(&bounce_lock); - count++; - numpages--; - } - return (count); -} - -static int -reserve_bounce_pages(bus_dma_tag_t dmat, bus_dmamap_t map, int commit) -{ - int pages; - - mtx_assert(&bounce_lock, MA_OWNED); - pages = MIN(free_bpages, map->pagesneeded - map->pagesreserved); - if (commit == 0 && map->pagesneeded > (map->pagesreserved + pages)) - return (map->pagesneeded - (map->pagesreserved + pages)); - free_bpages -= pages; - reserved_bpages += pages; - map->pagesreserved += pages; - pages = map->pagesneeded - map->pagesreserved; - - return (pages); -} - -static bus_addr_t -add_bounce_page(bus_dma_tag_t dmat, bus_dmamap_t map, vm_offset_t vaddr, - bus_size_t size) -{ - struct bounce_page *bpage; - - if (map->pagesneeded == 0) - panic("add_bounce_page: map doesn't need any pages"); - map->pagesneeded--; - - if (map->pagesreserved == 0) - panic("add_bounce_page: map doesn't need any pages"); - map->pagesreserved--; - - mtx_lock(&bounce_lock); - bpage = STAILQ_FIRST(&bounce_page_list); - if (bpage == NULL) - panic("add_bounce_page: free page list is empty"); - - STAILQ_REMOVE_HEAD(&bounce_page_list, links); - reserved_bpages--; - active_bpages++; - mtx_unlock(&bounce_lock); - - bpage->datavaddr = vaddr; - bpage->datacount = size; - STAILQ_INSERT_TAIL(&(map->bpages), bpage, links); - return (bpage->busaddr); -} - -static void -free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage) -{ - struct bus_dmamap *map; - - bpage->datavaddr = 0; - bpage->datacount = 0; - - mtx_lock(&bounce_lock); - STAILQ_INSERT_HEAD(&bounce_page_list, bpage, links); - free_bpages++; - active_bpages--; - if ((map = STAILQ_FIRST(&bounce_map_waitinglist)) != NULL) { - if (reserve_bounce_pages(map->dmat, map, 1) == 0) { - STAILQ_REMOVE_HEAD(&bounce_map_waitinglist, links); - STAILQ_INSERT_TAIL(&bounce_map_callbacklist, - map, links); - busdma_swi_pending = 1; - swi_sched(vm_ih, 0); - } - } - mtx_unlock(&bounce_lock); -} - -void -busdma_swi(void) -{ - bus_dma_tag_t dmat; - struct bus_dmamap *map; - - mtx_lock(&bounce_lock); - while ((map = STAILQ_FIRST(&bounce_map_callbacklist)) != NULL) { - STAILQ_REMOVE_HEAD(&bounce_map_callbacklist, links); - mtx_unlock(&bounce_lock); - dmat = map->dmat; - (dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_LOCK); - bus_dmamap_load(map->dmat, map, map->buf, map->buflen, - map->callback, map->callback_arg, /*flags*/0); - (dmat->lockfunc)(dmat->lockfuncarg, BUS_DMA_UNLOCK); - mtx_lock(&bounce_lock); - } - mtx_unlock(&bounce_lock); -} diff --git a/sys/alpha/alpha/busspace.c b/sys/alpha/alpha/busspace.c deleted file mode 100644 index bd9e52b..0000000 --- a/sys/alpha/alpha/busspace.c +++ /dev/null @@ -1,289 +0,0 @@ -/*- - * Copyright (c) 2000 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/kobj.h> - -#include <machine/bus.h> - -void -busspace_generic_read_multi_1(struct alpha_busspace *space, size_t offset, - u_int8_t *addr, size_t count) -{ - while (count--) { - *addr++ = space->ab_ops->abo_read_1(space, offset); - } -} - -void -busspace_generic_read_multi_2(struct alpha_busspace *space, size_t offset, - u_int16_t *addr, size_t count) -{ - while (count--) { - *addr++ = space->ab_ops->abo_read_2(space, offset); - } -} - -void -busspace_generic_read_multi_4(struct alpha_busspace *space, size_t offset, - u_int32_t *addr, size_t count) -{ - while (count--) { - *addr++ = space->ab_ops->abo_read_4(space, offset); - } -} - -void -busspace_generic_read_region_1(struct alpha_busspace *space, size_t offset, - u_int8_t *addr, size_t count) -{ - while (count--) { - *addr++ = space->ab_ops->abo_read_1(space, offset); - offset += 1; - } -} - -void -busspace_generic_read_region_2(struct alpha_busspace *space, size_t offset, - u_int16_t *addr, size_t count) -{ - while (count--) { - *addr++ = space->ab_ops->abo_read_2(space, offset); - offset += 2; - } -} - -void -busspace_generic_read_region_4(struct alpha_busspace *space, size_t offset, - u_int32_t *addr, size_t count) -{ - while (count--) { - *addr++ = space->ab_ops->abo_read_4(space, offset); - offset += 4; - } -} - -void -busspace_generic_write_multi_1(struct alpha_busspace *space, size_t offset, - const u_int8_t *addr, size_t count) -{ - while (count--) { - space->ab_ops->abo_write_1(space, offset, *addr++); - } -} - -void -busspace_generic_write_multi_2(struct alpha_busspace *space, size_t offset, - const u_int16_t *addr, size_t count) -{ - while (count--) { - space->ab_ops->abo_write_2(space, offset, *addr++); - } -} - -void -busspace_generic_write_multi_4(struct alpha_busspace *space, size_t offset, - const u_int32_t *addr, size_t count) -{ - while (count--) { - space->ab_ops->abo_write_4(space, offset, *addr++); - } -} - -void -busspace_generic_write_region_1(struct alpha_busspace *space, size_t offset, - const u_int8_t *addr, size_t count) -{ - while (count--) { - space->ab_ops->abo_write_1(space, offset, *addr++); - offset += 1; - } -} - -void -busspace_generic_write_region_2(struct alpha_busspace *space, size_t offset, - const u_int16_t *addr, size_t count) -{ - while (count--) { - space->ab_ops->abo_write_2(space, offset, *addr++); - offset += 2; - } -} - -void -busspace_generic_write_region_4(struct alpha_busspace *space, size_t offset, - const u_int32_t *addr, size_t count) -{ - while (count--) { - space->ab_ops->abo_write_4(space, offset, *addr++); - offset += 4; - } -} - -void -busspace_generic_set_multi_1(struct alpha_busspace *space, size_t offset, - u_int8_t value, size_t count) -{ - while (count--) { - space->ab_ops->abo_write_1(space, offset, value); - } -} - -void -busspace_generic_set_multi_2(struct alpha_busspace *space, size_t offset, - u_int16_t value, size_t count) -{ - while (count--) { - space->ab_ops->abo_write_2(space, offset, value); - } -} - -void -busspace_generic_set_multi_4(struct alpha_busspace *space, size_t offset, - u_int32_t value, size_t count) -{ - while (count--) { - space->ab_ops->abo_write_4(space, offset, value); - } -} - -void -busspace_generic_set_region_1(struct alpha_busspace *space, size_t offset, - u_int8_t value, size_t count) -{ - while (count--) { - space->ab_ops->abo_write_1(space, offset, value); - offset += 1; - } -} - -void -busspace_generic_set_region_2(struct alpha_busspace *space, size_t offset, - u_int16_t value, size_t count) -{ - while (count--) { - space->ab_ops->abo_write_2(space, offset, value); - offset += 2; - } -} - -void -busspace_generic_set_region_4(struct alpha_busspace *space, size_t offset, - u_int32_t value, size_t count) -{ - while (count--) { - space->ab_ops->abo_write_4(space, offset, value); - offset += 4; - } -} - -void -busspace_generic_copy_region_1(struct alpha_busspace *space, - size_t offset1, size_t offset2, size_t count) -{ - u_int8_t value; - if (offset1 > offset2) { - while (count--) { - value = space->ab_ops->abo_read_1(space, offset1); - space->ab_ops->abo_write_1(space, offset2, value); - offset1 += 1; - offset2 += 1; - } - } else { - offset1 += count - 1; - offset2 += count - 1; - while (count--) { - value = space->ab_ops->abo_read_1(space, offset1); - space->ab_ops->abo_write_1(space, offset2, value); - offset1 -= 1; - offset2 -= 1; - } - } -} - -void -busspace_generic_copy_region_2(struct alpha_busspace *space, - size_t offset1, size_t offset2, size_t count) -{ - u_int16_t value; - if (offset1 > offset2) { - while (count--) { - value = space->ab_ops->abo_read_1(space, offset1); - space->ab_ops->abo_write_1(space, offset2, value); - offset1 += 2; - offset2 += 2; - } - } else { - offset1 += 2*(count - 1); - offset2 += 2*(count - 1); - while (count--) { - value = space->ab_ops->abo_read_2(space, offset1); - space->ab_ops->abo_write_2(space, offset2, value); - offset1 -= 2; - offset2 -= 2; - } - } -} - -void -busspace_generic_copy_region_4(struct alpha_busspace *space, - size_t offset1, size_t offset2, size_t count) -{ - u_int32_t value; - if (offset1 > offset2) { - while (count--) { - value = space->ab_ops->abo_read_4(space, offset1); - space->ab_ops->abo_write_4(space, offset2, value); - offset1 += 4; - offset2 += 4; - } - } else { - offset1 += 4*(count - 1); - offset2 += 4*(count - 1); - while (count--) { - value = space->ab_ops->abo_read_4(space, offset1); - space->ab_ops->abo_write_4(space, offset2, value); - offset1 -= 4; - offset2 -= 4; - } - } -} - -void -busspace_generic_barrier(struct alpha_busspace *space, size_t offset, size_t len, int flags) -{ - if (flags & BUS_SPACE_BARRIER_READ) - alpha_mb(); - else - alpha_wmb(); -} diff --git a/sys/alpha/alpha/clock.c b/sys/alpha/alpha/clock.c deleted file mode 100644 index 500dde2..0000000 --- a/sys/alpha/alpha/clock.c +++ /dev/null @@ -1,671 +0,0 @@ -/*- - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * 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 and Ralph Campbell. - * - * 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. - * 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: Utah Hdr: clock.c 1.18 91/01/21 - * - * @(#)clock.c 8.1 (Berkeley) 6/10/93 - * $NetBSD: clock.c,v 1.20 1998/01/31 10:32:47 ross Exp $ - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_clock.h" - -#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/queue.h> -#include <sys/smp.h> -#include <sys/sysctl.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/timetc.h> - -#include <machine/bus.h> -#include <machine/clock.h> -#include <machine/clockvar.h> -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> /* for CPU definitions, etc */ -#include <machine/ppireg.h> -#include <machine/timerreg.h> - -#include <isa/isareg.h> - -#define SECMIN ((unsigned)60) /* seconds per minute */ -#define SECHOUR ((unsigned)(60*SECMIN)) /* seconds per hour */ -#define SECDAY ((unsigned)(24*SECHOUR)) /* seconds per day */ -#define SECYR ((unsigned)(365*SECDAY)) /* seconds per common year */ - -/* - * According to OSF/1's /usr/sys/include/arch/alpha/clock.h, - * the console adjusts the RTC years 13..19 to 93..99 and - * 20..40 to 00..20. (historical reasons?) - * DEC Unix uses an offset to the year to stay outside - * the dangerous area for the next couple of years. - */ -#define UNIX_YEAR_OFFSET 52 /* 41=>1993, 12=>2064 */ - -static int clock_year_offset = 0; - -/* - * 32-bit time_t's can't reach leap years before 1904 or after 2036, so we - * can use a simple formula for leap years. - */ -#define LEAPYEAR(y) (((y) % 4) == 0) - -device_t clockdev; -int clockinitted; -int adjkerntz; /* local offset from GMT in seconds */ -int disable_rtc_set; /* disable resettodr() if != 0 */ -int wall_cmos_clock; /* wall CMOS clock assumed if != 0 */ -struct mtx clock_lock; -static int beeping = 0; - -#define TIMER_DIV(x) ((timer_freq + (x) / 2) / (x)) - -#ifndef TIMER_FREQ -#define TIMER_FREQ 1193182 -#endif -u_int32_t timer_freq = TIMER_FREQ; - -extern int cycles_per_sec; - -static timecounter_get_t i8254_get_timecount; -static timecounter_get_t alpha_get_timecount; - -static struct timecounter alpha_timecounter = { - alpha_get_timecount, /* get_timecount */ - 0, /* no poll_pps */ - ~0u, /* counter_mask */ - 0, /* frequency */ - "alpha", /* name */ - 800, /* quality */ -}; - -static struct timecounter i8254_timecounter = { - i8254_get_timecount, /* get_timecount */ - 0, /* no poll_pps */ - 0xffff, /* counter_mask */ - 0, /* frequency */ - "i8254" /* name */ -}; - -/* Values for timerX_state: */ -#define RELEASED 0 -#define RELEASE_PENDING 1 -#define ACQUIRED 2 -#define ACQUIRE_PENDING 3 - -/* static u_char timer0_state; */ -static u_char timer2_state; - -static void calibrate_clocks(u_int32_t firmware_freq, u_int32_t *pcc, - u_int32_t *timer); -static void set_timer_freq(u_int freq, int intr_freq); - -void -clockattach(device_t dev) -{ - u_int32_t pcc, freq, delta; - - /* - * Just bookkeeping. - */ - if (clockdev) - panic("clockattach: multiple clocks"); - clockdev = dev; - - calibrate_clocks(cycles_per_sec, &pcc, &freq); - cycles_per_sec = pcc; - set_cputicker(read_cycle_count, cycles_per_sec, 0); - - /* - * XXX: TurboLaser doesn't have an i8254 counter. - * XXX: A replacement is needed, and another method - * XXX: of determining this would be nice. - */ - if (hwrpb->rpb_type == ST_DEC_21000) { - goto out; - } - /* - * Use the calibrated i8254 frequency if it seems reasonable. - * Otherwise use the default, and don't use the calibrated i586 - * frequency. - */ - delta = freq > timer_freq ? freq - timer_freq : timer_freq - freq; - if (delta < timer_freq / 100) { -#ifndef CLK_USE_I8254_CALIBRATION - if (bootverbose) - printf( -"CLK_USE_I8254_CALIBRATION not specified - using default frequency\n"); - freq = timer_freq; -#endif - timer_freq = freq; - } else { - if (bootverbose) - printf( - "%d Hz differs from default of %d Hz by more than 1%%\n", - freq, timer_freq); - } - set_timer_freq(timer_freq, hz); - -out: -#ifdef EVCNT_COUNTERS - evcnt_attach(dev, "intr", &clock_intr_evcnt); -#else - /* nothing */ ; -#endif -} - -/* - * Machine-dependent clock routines. - * - * Startrtclock restarts the real-time clock, which provides - * hardclock interrupts to kern_clock.c. - * - * Inittodr initializes the time of day hardware which provides - * date functions. Its primary function is to use some file - * system information in case the hardare clock lost state. - * - * Resettodr restores the time of day hardware after a time change. - */ - -/* - * Start the real-time and statistics clocks. - */ -void -cpu_initclocks() -{ - - if (clockdev == NULL) - panic("cpu_initclocks: no clock attached"); - - tick = 1000000 / hz; /* number of microseconds between interrupts */ - - /* - * Establish the clock interrupt; it's a special case. - * - * We establish the clock interrupt this late because if - * we do it at clock attach time, we may have never been at - * spl0() since taking over the system. Some versions of - * PALcode save a clock interrupt, which would get delivered - * when we spl0() in autoconf.c. If established the clock - * interrupt handler earlier, that interrupt would go to - * hardclock, which would then fall over because p->p_stats - * isn't set at that time. - */ - - /* - * XXX: TurboLaser doesn't have an i8254 counter. - * XXX: A replacement is needed, and another method - * XXX: of determining this would be nice. - */ - if (hwrpb->rpb_type != ST_DEC_21000) - tc_init(&i8254_timecounter); - platform.clockintr = hardclock; - - if (mp_ncpus == 1) { - alpha_timecounter.tc_frequency = cycles_per_sec; - tc_init(&alpha_timecounter); - } - - stathz = hz / 8; - profhz = hz; - - /* - * Get the clock started. - */ - CLOCK_INIT(clockdev); -} - -static __inline int get_8254_ctr(void); - -static __inline int -get_8254_ctr(void) -{ - int high, low; - - mtx_lock_spin(&clock_lock); - - /* Select timer0 and latch counter value. */ - outb(TIMER_MODE, TIMER_SEL0 | TIMER_LATCH); - - low = inb(TIMER_CNTR0); - high = inb(TIMER_CNTR0); - - mtx_unlock_spin(&clock_lock); - return ((high << 8) | low); -} - -static void -calibrate_clocks(u_int32_t firmware_freq, u_int32_t *pcc, u_int32_t *timer) -{ - u_int32_t start_pcc, stop_pcc; - u_int count, prev_count, tot_count; - int sec, start_sec; - - /* - * XXX: TurboLaser doesn't have an i8254 counter. - * XXX: A replacement is needed, and another method - * XXX: of determining this would be nice. - */ - if (hwrpb->rpb_type == ST_DEC_21000) { - if (bootverbose) - printf("Using firmware default frequency of %u Hz\n", - firmware_freq); - *pcc = firmware_freq; - *timer = 0; - return; - } - if (bootverbose) - printf("Calibrating clock(s) ... "); - - set_timer_freq(timer_freq, hz); - - /* Read the mc146818A seconds counter. */ - if (CLOCK_GETSECS(clockdev, &sec)) - goto fail; - - /* Wait for the mC146818A seconds counter to change. */ - start_sec = sec; - for (;;) { - if (CLOCK_GETSECS(clockdev, &sec)) - goto fail; - if (sec != start_sec) - break; - } - - /* Start keeping track of the PCC and i8254. */ - prev_count = get_8254_ctr(); - if (prev_count == 0) - goto fail; - tot_count = 0; - - start_pcc = alpha_rpcc(); - - /* - * Wait for the mc146818A seconds counter to change. Read the i8254 - * counter for each iteration since this is convenient and only - * costs a few usec of inaccuracy. The timing of the final reads - * of the counters almost matches the timing of the initial reads, - * so the main cause of inaccuracy is the varying latency from - * inside get_8254_ctr() or rtcin(RTC_STATUSA) to the beginning of the - * rtcin(RTC_SEC) that returns a changed seconds count. The - * maximum inaccuracy from this cause is < 10 usec on 486's. - */ - start_sec = sec; - for (;;) { - if (CLOCK_GETSECS(clockdev, &sec)) - goto fail; - count = get_8254_ctr(); - if (count == 0) - goto fail; - if (count > prev_count) - tot_count += prev_count - (count - 0xffff); - else - tot_count += prev_count - count; - prev_count = count; - if (sec != start_sec) - break; - } - - /* - * Read the PCC again to work out frequency. - */ - stop_pcc = alpha_rpcc(); - - if (bootverbose) { - printf("PCC clock: %u Hz (firmware %u Hz)\n", - stop_pcc - start_pcc, firmware_freq); - printf("i8254 clock: %u Hz\n", tot_count); - } - *pcc = stop_pcc - start_pcc; - *timer = tot_count; - return; - -fail: - if (bootverbose) - printf("failed, using firmware default of %u Hz\n", - firmware_freq); - - *pcc = firmware_freq; - *timer = 0; - return; -} - -static void -set_timer_freq(u_int freq, int intr_freq) -{ - - mtx_lock_spin(&clock_lock); - timer_freq = freq; - i8254_timecounter.tc_frequency = timer_freq; - outb(TIMER_MODE, TIMER_SEL0 | TIMER_RATEGEN | TIMER_16BIT); - outb(TIMER_CNTR0, 0); - outb(TIMER_CNTR0, 0); - mtx_unlock_spin(&clock_lock); -} - -void -cpu_startprofclock(void) -{ - - /* nothing to do */ -} - -void -cpu_stopprofclock(void) -{ - - /* nothing to do */ -} - -/* - * This code is defunct after 2099. - * Will Unix still be here then?? - */ -static short dayyr[12] = { - 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 -}; - -/* - * Initialze the time of day register, based on the time base which is, e.g. - * from a filesystem. Base provides the time to within six months, - * and the time of year clock (if any) provides the rest. - */ -void -inittodr(time_t base) -{ - struct clocktime ct; - struct timespec ts; - int clock_compat_osf1, todr_unreliable; - int days, yr; - - if (getenv_int("clock_compat_osf1", &clock_compat_osf1)) { - if (clock_compat_osf1) - clock_year_offset = UNIX_YEAR_OFFSET; - } - - todr_unreliable = 0; - CLOCK_GET(clockdev, base, &ct); - -#ifdef DEBUG - printf("readclock: %d/%d/%d/%d/%d/%d\n", ct.year, ct.mon, ct.day, - ct.hour, ct.min, ct.sec); -#endif - ct.year += clock_year_offset; - if (ct.year < 70) - ct.year += 100; - - /* simple sanity checks */ - if (ct.year < 70 || ct.mon < 1 || ct.mon > 12 || ct.day < 1 || - ct.day > 31 || ct.hour > 23 || ct.min > 59 || ct.sec > 59) { - /* - * Believe the time in the filesystem for lack of - * anything better, resetting the TODR. - */ - ts.tv_sec = base; - printf("WARNING: preposterous real-time clock"); - todr_unreliable = 1; - } else { - days = 0; - for (yr = 70; yr < ct.year; yr++) - days += LEAPYEAR(yr) ? 366 : 365; - days += dayyr[ct.mon - 1] + ct.day - 1; - if (LEAPYEAR(yr) && ct.mon > 2) - days++; - /* now have days since Jan 1, 1970; the rest is easy... */ - ts.tv_sec = days * SECDAY + ct.hour * SECHOUR + - ct.min * SECMIN + ct.sec; - if (wall_cmos_clock) - ts.tv_sec += adjkerntz; - /* - * The time base comes from a saved time, whereas the real- - * time clock is supposed to represent the current time. - * It is logically not possible for a saved time to be - * larger than the current time, so if that happens, assume - * the real-time clock is off. Warn when the real-time - * clock is off by two or more days. - */ - if (ts.tv_sec < base) { - ts.tv_sec = base; - days = (base - ts.tv_sec) / (60L * 60L * 24L); - if (days >= 2) { - printf("WARNING: real-time clock lost %d days", - days); - todr_unreliable = 1; - } - } - } - ts.tv_nsec = 0; - tc_setclock(&ts); - clockinitted = 1; - - if (todr_unreliable) { - printf(" -- CHECK AND RESET THE DATE!\n"); - resettodr(); - } -} - -/* - * Reset the TODR based on the time value; used when the TODR - * has a preposterous value and also when the time is reset - * by the stime system call. Also called when the TODR goes past - * TODRZERO + 100*(SECYEAR+2*SECDAY) (e.g. on Jan 2 just after midnight) - * to wrap the TODR around. - */ -void -resettodr() -{ - register int t, t2, s; - struct clocktime ct; - unsigned long tm; - - if (disable_rtc_set) - return; - - s = splclock(); - tm = time_second; - splx(s); - - if (!clockinitted) - return; - - /* Calculate local time to put in RTC */ - tm -= (wall_cmos_clock ? adjkerntz : 0); - - /* compute the day of week. */ - t2 = tm / SECDAY; - ct.dow = (t2 + 4) % 7; /* 1/1/1970 was thursday */ - - /* compute the year */ - ct.year = 69; - t = t2; /* XXX ? */ - while (t2 >= 0) { /* whittle off years */ - t = t2; - ct.year++; - t2 -= LEAPYEAR(ct.year) ? 366 : 365; - } - - /* t = month + day; separate */ - t2 = LEAPYEAR(ct.year); - for (ct.mon = 1; ct.mon < 12; ct.mon++) - if (t < dayyr[ct.mon] + (t2 && ct.mon > 1)) - break; - - ct.day = t - dayyr[ct.mon - 1] + 1; - if (t2 && ct.mon > 2) - ct.day--; - - /* the rest is easy */ - t = tm % SECDAY; - ct.hour = t / SECHOUR; - t %= 3600; - ct.min = t / SECMIN; - ct.sec = t % SECMIN; - - ct.year = (ct.year - clock_year_offset) % 100; - CLOCK_SET(clockdev, &ct); -} - -static unsigned -i8254_get_timecount(struct timecounter *tc) -{ - - return (0xffff - get_8254_ctr()); -} - -static unsigned -alpha_get_timecount(struct timecounter* tc) -{ - return alpha_rpcc(); -} - -/* - * The RPCC register actually consists of two halves. The lower half - * is a raw 32-bit counter that wraps. The upper half is defined in - * the Digital UNIX PAL as being a raw per-process cycle count mod 2^32 - * that is updated on each call to swpctx. In order to produce a 64-bit - * counter, we just use the lower half and simulate the upper 32-bits. - * The architecture guarantees that there will always be at least one - * clock interrupt in between overlaps in the lower half, so as long as - * we call this function every clock interrupt we should not miss any - * overlaps. - */ -uint64_t -read_cycle_count(void) -{ - unsigned pcc_cnt; - - /* Assert a critical section? */ - pcc_cnt = alpha_rpcc() & 0xffffffff; - if (pcc_cnt < PCPU_GET(last_pcc_cnt)) - PCPU_SET(pcc_base, PCPU_GET(pcc_base) + 1); - PCPU_SET(last_pcc_cnt, pcc_cnt); - return (pcc_cnt | ((uint64_t)PCPU_GET(pcc_base) << 32)); -} - -int -acquire_timer2(int mode) -{ - /* - * XXX: TurboLaser doesn't have an i8254 counter. - * XXX: A replacement is needed, and another method - * XXX: of determining this would be nice. - */ - if (hwrpb->rpb_type == ST_DEC_21000) { - return (0); - } - - if (timer2_state != RELEASED) - return (-1); - timer2_state = ACQUIRED; - - /* - * This access to the timer registers is as atomic as possible - * because it is a single instruction. We could do better if we - * knew the rate. Use of splclock() limits glitches to 10-100us, - * and this is probably good enough for timer2, so we aren't as - * careful with it as with timer0. - */ - outb(TIMER_MODE, TIMER_SEL2 | (mode & 0x3f)); - - return (0); -} - -int -release_timer2(void) -{ - /* - * XXX: TurboLaser doesn't have an i8254 counter. - * XXX: A replacement is needed, and another method - * XXX: of determining this would be nice. - */ - if (hwrpb->rpb_type == ST_DEC_21000) { - return (0); - } - - if (timer2_state != ACQUIRED) - return (-1); - timer2_state = RELEASED; - outb(TIMER_MODE, TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT); - return (0); -} - -static void -sysbeepstop(void *chan) -{ - ppi_spkr_off(); /* disable counter2 output to speaker */ - timer_spkr_release(); - beeping = 0; -} - -int -sysbeep(int pitch, int period) -{ - /* - * XXX: TurboLaser doesn't have an i8254 counter. - * XXX: A replacement is needed, and another method - * XXX: of determining this would be nice. - */ - if (hwrpb->rpb_type == ST_DEC_21000) { - return (0); - } - - mtx_lock_spin(&clock_lock); - - if (timer_spkr_acquire()) - if (!beeping) { - /* Something else owns it. */ - mtx_unlock_spin(&clock_lock); - return (-1); /* XXX Should be EBUSY, but nobody cares anyway. */ - } - - if (pitch) pitch = TIMER_DIV(pitch); - - spkr_set_pitch(pitch); - mtx_unlock_spin(&clock_lock); - if (!beeping) { - /* enable counter2 output to speaker */ - if (pitch) ppi_spkr_on(); - beeping = period; - timeout(sysbeepstop, (void *)NULL, period); - } - return (0); -} - diff --git a/sys/alpha/alpha/clock_if.m b/sys/alpha/alpha/clock_if.m deleted file mode 100644 index d0584b6..0000000 --- a/sys/alpha/alpha/clock_if.m +++ /dev/null @@ -1,52 +0,0 @@ -#- -# 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. -# -# $FreeBSD$ -# - -#include <sys/bus.h> -#include <machine/clockvar.h> - -INTERFACE clock; - -METHOD void init { - device_t dev; -}; - -METHOD void get { - device_t dev; - time_t base; - struct clocktime *ct; -}; - -METHOD void set { - device_t dev; - struct clocktime *ct; -}; - -METHOD int getsecs { - device_t dev; - int *secp; -}; diff --git a/sys/alpha/alpha/cpuconf.c b/sys/alpha/alpha/cpuconf.c deleted file mode 100644 index e6bef54..0000000 --- a/sys/alpha/alpha/cpuconf.c +++ /dev/null @@ -1,230 +0,0 @@ -/*- - * 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. - * - * $NetBSD: cpuconf.c,v 1.10 1998/03/20 21:48:21 thorpej Exp $ - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_cpu.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> - -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#ifdef DEC_AXPPCI_33 -extern void dec_axppci_33_init(int); -#else -#define dec_axppci_33_init platform_not_configured -#endif - -#ifdef DEC_KN8AE -extern void dec_kn8ae_init(int); -#else -#define dec_kn8ae_init platform_not_configured -#endif - -#ifdef DEC_2100_A50 -extern void dec_2100_a50_init(int); -#else -#define dec_2100_a50_init platform_not_configured -#endif - -#ifdef DEC_KN20AA -extern void dec_kn20aa_init(int); -#else -#define dec_kn20aa_init platform_not_configured -#endif - -#ifdef DEC_EB64PLUS -extern void dec_eb64plus_init(int); -#else -#define dec_eb64plus_init platform_not_configured -#endif - -#ifdef DEC_EB164 -extern void dec_eb164_init(int); -#else -#define dec_eb164_init platform_not_configured -#endif - -#ifdef DEC_KN300 -extern void dec_kn300_init(int); -#else -#define dec_kn300_init platform_not_configured -#endif - -#ifdef AVALON_A12 -extern void avalon_a12_init(int); -#else -#define avalon_a12_init platform_not_configured -#endif - -#ifdef DEC_ST550 -extern void st550_init(int); -#else -#define st550_init platform_not_configured -#endif - -#ifdef DEC_ST6600 -extern void st6600_init(int); -#else -#define st6600_init platform_not_configured -#endif - -#ifdef DEC_1000A -extern void dec_1000a_init(int); -#else -#define dec_1000a_init platform_not_configured -#endif - -#ifdef DEC_2100_A500 -extern void dec_2100_a500_init(int); -#else -#define dec_2100_a500_init platform_not_configured -#endif - -#ifdef API_UP1000 -extern void api_up1000_init(int); -#else -#define api_up1000_init platform_not_configured -#endif - -struct cpuinit cpuinit[] = { - cpu_notsupp("???"), /* 0: ??? */ - cpu_notsupp("ST_ADU"), /* 1: ADU */ - cpu_notsupp("ST_DEC_4000"), /* 2: Cobra */ - cpu_notsupp("ST_DEC_7000"), /* 3: Ruby */ - cpu_notsupp("DEC_3000_500"), /* 4: Flamingo */ - cpu_notsupp("???"), /* 5: simulator */ - cpu_notsupp("ST_DEC_2000_300"), /* 6: Jensen */ - cpu_notsupp("DEC_3000_300"), /* 7: Pelican */ - cpu_init(avalon_a12_init,"ST_AVALON_A12"), /* 8: AVALON */ - cpu_init(dec_2100_a500_init, "ST_DEC_2100_A500"), /* 9: Sable */ - cpu_notsupp("ST_DEC_APXVME_64"), /* 10: AXPvme */ - cpu_init(dec_axppci_33_init,"DEC_AXPPCI_33"), /* 11: NoName */ - cpu_init(dec_kn8ae_init,"DEC_KN8AE"), /* 12: Turbolaser */ - cpu_init(dec_2100_a50_init,"DEC_2100_A50"), /* 13: Avanti */ - cpu_notsupp("ST_DEC_MUSTANG"), /* 14: Mustang */ - cpu_init(dec_kn20aa_init,"DEC_KN20AA"), /* 15: Alcor */ - cpu_notsupp("cancelled"), /* 16: cancelled */ - cpu_init(dec_1000a_init, "ST_DEC_1000"), /* 17: Mikasa */ - cpu_notsupp("ST_DEC_EB64"), /* 18: EB64 */ - cpu_notsupp("ST_EB66"), /* 19: EB66 */ - cpu_init(dec_eb64plus_init,"DEC_EB64PLUS"), /* 20: EB64+ */ - cpu_notsupp("ST_ALPHABOOK1"), /* 21: AlphaBook */ - cpu_init(dec_kn300_init,"DEC_KN300"), /* 22: Rawhide */ - cpu_notsupp("ST_DEC_EV45_PBP"), /* 23: K2 */ - cpu_init(dec_2100_a500_init, "ST_DEC_2100A_A500"), /* 24: Lynx */ - cpu_notsupp("ST_DEC_ALPHAXL"), /* 25: AlphaXL */ - cpu_init(dec_eb164_init,"DEC_EB164"), /* 26: EB164 */ - cpu_init(dec_1000a_init,"ST_DEC_1000A"), /* 27: Noritake */ - cpu_notsupp("ST_DEC_ALPHAVME_224"), /* 28: Cortex */ - cpu_notsupp("unused"), /* 29: unused */ - cpu_init(st550_init,"DEC_ST550"), /* 30: Miata */ - cpu_notsupp("ST_DEC_XXM"), /* 31: XXM */ - cpu_notsupp("ST_DEC_EV56_PBP"), /* 32: Takara */ - cpu_notsupp("ST_DEC_ALPHAVME_320"), /* 33: Yukon */ - cpu_init(st6600_init, "ST_DEC_ST6600"), /* 34: Tsunami */ - cpu_notsupp("ST_DEC_WILDFIRE"), /* 35: Wildfire */ - cpu_notsupp("ST_DEC_CUSCO"), /* 36: Cusco */ - cpu_notsupp("ST_DEC_EIGER"), /* 37: Eiger */ - cpu_notsupp("ST_DEC_TITAN"), /* 38: Titan */ - cpu_notsupp("ST_DEC_MARVEL") /* 39: Marvel */ -}; -int ncpuinit = (sizeof(cpuinit) / sizeof(cpuinit[0])); - -struct cpuinit api_cpuinit[] = { - cpu_notsupp("???"), /* 0: ??? */ - cpu_init(api_up1000_init,"API_UP1000"), /* 1: ST_API_UP1000 */ -}; -int napi_cpuinit = (sizeof(api_cpuinit) / sizeof(api_cpuinit[0])); - -void setPQL2(int *const size, int *const ways); - -void -setPQL2(int *const size, int *const ways) -{ - return; -} - -void -platform_not_configured(int cputype) -{ - struct cpuinit *cpu; - int cpuidx; - - cputype = hwrpb->rpb_type; - - if (cputype < 1) - cputype *= -1; - - if (cputype >= API_ST_BASE) { - cpuidx = cputype - API_ST_BASE; - cpu = api_cpuinit; - } else { - cpuidx = cputype; - cpu = cpuinit; - } - - printf("\n"); - printf("Support for system type %d is not present in this kernel.\n", - cputype); - printf("Please build a kernel with \"options %s\" and reboot.\n", - cpu[cpuidx].option); - printf("\n"); - panic("platform not configured\n"); -} - -void -platform_not_supported(int cputype) -{ - const char *typestr; - - cputype = hwrpb->rpb_type; - - if (cputype < 1) - cputype *= -1; - - if (cputype >= ncpuinit) - typestr = "???"; - else - typestr = cpuinit[cputype].option; - - printf("\n"); - printf("FreeBSD does not yet support system type %d (%s).\n", cputype, - typestr); - printf("\n"); - panic("platform not supported"); -} diff --git a/sys/alpha/alpha/db_disasm.c b/sys/alpha/alpha/db_disasm.c deleted file mode 100644 index dd91ddb..0000000 --- a/sys/alpha/alpha/db_disasm.c +++ /dev/null @@ -1,1089 +0,0 @@ -/*- - * Mach Operating System - * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University - * All Rights Reserved. - * - * 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 Mellon - * the rights to redistribute these changes. - */ - -/* - * File: db_disasm.c - * Author: Alessandro Forin, Carnegie Mellon University - * Date: 11/91 - * - * Disassembler for Alpha - * - * Modified for NetBSD/alpha by: - * - * Christopher G. Demetriou, Carnegie Mellon University - * - * Jason R. Thorpe, Numerical Aerospace Simulation Facility, - * NASA Ames Research Center - * - * This code was derived exclusively from information available in - * "Alpha Architecture Reference Manual", Richard L. Sites ed. - * Digital Press, Burlington, MA 01803 - * ISBN 1-55558-098-X, Order no. EY-L520E-DP - */ - -#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -/* __KERNEL_RCSID(0, "$NetBSD: db_disasm.c,v 1.4 1997/09/16 22:52:40 thorpej Exp $"); */ -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <machine/db_machdep.h> -#include <alpha/alpha/db_instruction.h> - -#include <machine/pal.h> - -#include <ddb/ddb.h> -#include <ddb/db_access.h> -#include <ddb/db_sym.h> -#include <ddb/db_output.h> - -/* - * This would belong in a header file, except noone else needs it - */ -typedef union { - /* - * All instructions are 32 bits wide, PAL included - */ - unsigned int bits; - - /* - * Internal processor register access instrs - * specify the IPR index, doubly specify the - * (same) GP register as src/dest, and qualifiers - * for the IPR set involved (abox/ibox/tmp) - */ - struct { - unsigned index : 5, - regset : 3, /* a,i,p */ - xxx : 8, - rs : 5, - rd : 5, - opcode : 6; - } mXpr_format; - - /* - * Load/store instructions have a 12 bit displacement, - * and two register specifiers just as normal ld/st. - * Four bits have special meanings: - * phy: bypass the MMU (physical access) - * alt: use mode in ALT register for checks, - * or if PHY is also on locked/linked access - * rwc: read-with-write-check (probew) - * qw: quadword access - */ - struct { - signed int displacement : 12; - unsigned qw : 1, - qualif : 3, - rs : 5, - rd : 5, - opcode : 6; - } mem_format; - - /* - * Return from exception or interrupt has - * a branch-like encoding, but only one - * instantiation is actually usable. - */ - struct { - unsigned xxx : 14, - zero : 1, /* branch prediction! */ - one : 1, - rb : 5, /* r31 or stall */ - ra : 5, /* r31 or stall */ - opcode : 6; - } rei_format; - -} pal_instruction; - - -/* - * Major opcodes - */ -static char *op_name[64] = { -/* 0 */ "call_pal", "op1", "op2", "op3", "op4", "op5", "op6", "op7", -/* 8 */ "lda", "ldah", "ldbu", "ldq_u","ldwu", "stw", "stb", "stq_u", -/*16 */ "arit", "logical","bit","mul", "op20", "vaxf", "ieeef","anyf", -/*24 */ "spec", "hw_mfpr","jump","hw_ld","intmisc","hw_mtpr","hw_rei","hw_st", -/*32 */ "ldf", "ldg", "lds", "ldt", "stf", "stg", "sts", "stt", -/*40 */ "ldl", "ldq", "ldl_l","ldq_l","stl", "stq", "stl_c","stq_c", -/*48 */ "br", "fbeq", "fblt", "fble", "bsr", "fbne", "fbge", "fbgt", -/*56 */ "blbc", "beq", "blt", "ble", "blbs", "bne", "bge", "bgt" -}; - -/* - * The function field is too big (7 or 11 bits), so the sub-tables - * are addressed in a somewhat complicated manner to save - * space. After all, alu operations is what RISCs are good at. - */ - -struct tbl { - const char *name; - int code; -}; - -static const struct tbl pal_op_tbl[] = { - /* Common PAL function codes. */ - { "halt", PAL_halt }, - { "cflush", PAL_cflush }, - { "draina", PAL_draina }, - { "cserve", PAL_cserve, }, - { "swppal", PAL_swppal }, - { "ipir", PAL_ipir }, - { "bpt", PAL_bpt }, - { "bugchk", PAL_bugchk }, - { "imb", PAL_imb }, - { "rdunique", PAL_rdunique }, - { "wrunique", PAL_wrunique }, - { "gentrap", PAL_gentrap }, - - /* OSF/1 PAL function codes. */ - { "osf1_rdmces", PAL_OSF1_rdmces }, - { "osf1_wrmces", PAL_OSF1_wrmces }, - { "osf1_wrfen", PAL_OSF1_wrfen }, - { "osf1_wrvptptr", PAL_OSF1_wrvptptr }, - { "osf1_swpctx", PAL_OSF1_swpctx }, - { "osf1_wrval", PAL_OSF1_wrval }, - { "osf1_rdval", PAL_OSF1_rdval }, - { "osf1_tbi", PAL_OSF1_tbi }, - { "osf1_wrent", PAL_OSF1_wrent }, - { "osf1_swpipl", PAL_OSF1_swpipl }, - { "osf1_rdps", PAL_OSF1_rdps }, - { "osf1_wrkgp", PAL_OSF1_wrkgp }, - { "osf1_wrusp", PAL_OSF1_wrusp }, - { "osf1_wrperfmon", PAL_OSF1_wrperfmon }, - { "osf1_rdusp", PAL_OSF1_rdusp }, - { "osf1_whami", PAL_OSF1_whami }, - { "osf1_retsys", PAL_OSF1_retsys }, - { "osf1_rti", PAL_OSF1_rti }, - { "osf1_callsys", PAL_OSF1_callsys }, - - { NULL, -1 }, -}; - -static const char *pal_opname(int); - -static const char * -pal_opname(op) - int op; -{ - static char unk[8]; - int i; - - for (i = 0; pal_op_tbl[i].name != NULL; i++) { - if (pal_op_tbl[i].code == op) - return (pal_op_tbl[i].name); - } - - snprintf(unk, sizeof(unk), "0x%x", op); - return (unk); -} - -/* HW (PAL) instruction qualifiers, stright tables */ -static const char *mXpr_name[8] = { - "", "/i", "/a", "/ai", "/p", "/pi", "/pa", "/pai" -}; -static const char *hwlds_name[8] = { - "", "/r", "/a", "/ar", "/p", "/p?r", "_l-c", "_l-c/?r" -}; - -/* - * For this one we take the low nibble (valid values 0/2/9/b/d) - * and shift it down one to get the row index. Within a row - * we can just take the high nibble deprived of the high bit - * (valid values 0/1/2/3/4/6). We could have used a flat 64 - * entry array, but in this way we use just 48 pointers. - * BUGFIX: the 'cmpbge 0x0f' opcode fits in here too - */ -static const char *arit_c0[8] = { - "addl", 0, "addq", 0, "addl/v", 0, "addq/v", -}; -static const char *arit_c2[8] = { - "s4addl", "s8addl", "s4addq", "s8addq", -}; -static const char *arit_c9[8] = { - "subl", 0, "subq", 0, "subl/v", 0, "subq/v", -}; -static const char *arit_cB[8] = { - "s4subl", "s8subl", "s4subq", "s8subq", -}; -static const char *arit_cD[8] = { - 0, "cmpult", "cmpeq", "cmpule", "cmplt", 0, "cmple", -}; -static const char *arit_cF[1] = { - "cmpbge" -}; -static const char **arit_opname[8] = { - arit_c0, arit_c2, 0, 0, arit_c9, arit_cB, arit_cD, arit_cF -}; - -static __inline const char *arit_name(int); -static __inline const char * -arit_name(op) - int op; -{ - static char unk[32]; - const char *name = NULL; - - if (arit_opname[((op)&0xe)>>1]) - name = arit_opname[((op)&0xe)>>1][((op)&0x70)>>4]; - - if (name != NULL) - return (name); - - snprintf(unk, sizeof(unk), "?arit 0x%x?", op); - return (unk); -} - -/* - * Something similar for this one, except there are only - * 16 entries so the row indexing is done by enumeration - * of the low nibble (valid values 0/4/6/8). Then we can - * just shift the high nibble to index inside the row - * (valid values are 0/2/4 or 1/2/4/6) - * - * There are two functions that don't play by these simple rules, - * so we special-case them. - */ -static const char *logical_c0[4] = { - "and", "or", "xor", 0 -}; -static const char *logical_c4[4] = { - "cmovlbs", "cmoveq", "cmovlt", "cmovle" -}; -static const char *logical_c6[4] = { - "cmovlbc", "cmovne", "cmovge", "cmovgt" -}; -static const char *logical_c8[4] = { - "andnot", "ornot", "xornot", 0 -}; - -static __inline const char *logical_name(int); -static __inline const char * -logical_name(op) - int op; -{ - static char unk[32]; - const char *name = NULL; - - if (op == op_amask) - return ("amask"); - else if (op == op_implver) - return ("implver"); - - switch (op & 0xf) { - case 0: name = logical_c0[((op)>>5)&3]; break; - case 4: name = logical_c4[((op)>>5)&3]; break; - case 6: name = logical_c6[((op)>>5)&3]; break; - case 8: name = logical_c8[((op)>>5)&3]; break; - } - - if (name != NULL) - return (name); - - snprintf(unk, sizeof(unk), "?logical 0x%x?", op); - return (unk); -} - -/* - * This is the messy one. First, we single out the dense - * case of a 3 in the high nibble (valid values 0/1/2/4/6/9/b/c). - * Then the case of a 2 in the low nibble (valid values 0/1/2/5/6/7). - * For the remaining codes (6/7/a/b) we do as above: high - * nibble has valid values 0/1/2 or 5/6/7. The low nibble - * can be used as row index picking bits 0 and 2, for the - * high one just the lower two bits. - */ -static const char *bitop_c3[8] = { - "zapnot", "mskql", "srl", "extql", "sll", "insql", "sra", 0 -}; -static const char *bitop_c2[8] = { - "mskbl", "mskwl", "mskll", 0/*mskql*/, 0, "mskwh", "msklh", "mskqh" -}; -static const char *bitop_c67ab[4][4] = { -/* a */ { 0, "extwh", "extlh", "extqh"}, -/* b */ { "insbl", "inswl", "insll", 0 }, -/* 6 */ { "extbl", "extwl", "extll", 0 }, -/* 7 */ { 0, "inswh", "inslh", "insqh" }, -}; - -static __inline const char *bitop_name(int); -static __inline const char * -bitop_name(op) - int op; -{ - static char unk[32]; - const char *name = NULL; - - if ((op & 0x70) == 0x30) - name = (op == op_zap) ? "zap" : bitop_c3[((op)&0xe)>>1]; - else if ((op & 0xf) == 0x02) - name = bitop_c2[(op)>>4]; - else - name = - bitop_c67ab[(((op)&1)|(((op)&0x4)>>1))][(((op)&0x30)>>4)]; - - if (name != NULL) - return (name); - - snprintf(unk, sizeof(unk), "?bit 0x%x?", op); - return (unk); -} - -/* - * Only 5 entries in this one - */ -static const char *mul_opname[4] = { - "mull", "mulq", "mull/v", "mulq/v" -}; - -static __inline const char *mul_name(int); -static __inline const char * -mul_name(op) - int op; -{ - static char unk[32]; - const char *name = NULL; - - name = (op == op_umulh) ? "umulh" : mul_opname[((op)>>5)&3]; - - if (name != NULL) - return (name); - - snprintf(unk, sizeof(unk), "?mul 0x%x?", op); - return (unk); -} - -/* - * These are few, the high nibble is enough to dispatch. - * We single out the "f" case to halve the table size. - */ -static const char *special_opname[8] = { - "drain_t", 0, "mb", 0, "fetch", "fetch_m", "rpcc", "rc" -}; - -static __inline const char *special_name(int); -static __inline const char * -special_name(op) - int op; -{ - static char unk[32]; - const char *name; - - name = (op == op_rs) ? "rs" : special_opname[(op)>>13]; - - if (name != NULL) - return (name); - - snprintf(unk, sizeof(unk), "?special 0x%x?", op); - return (unk); -} - -/* - * This is trivial - */ -static const char *jump_opname[4] = { - "jmp", "jsr", "ret", "jcr" -}; -#define jump_name(ix) jump_opname[ix] - -/* - * For all but 4 of these, we can dispatch on the lower nibble of - * the "function". - */ -static const char *intmisc_opname_3x[16] = { - "ctpop", "perr", "ctlz", "cttz", "unpkbw", "unpkbl", "pkwb", - "pklb", "minsb8", "minsw4", "minub8", "minuw4", "maxub8", - "maxuw4", "maxsb8", "maxsw4", -}; - -static __inline const char *intmisc_name(int); -static __inline const char * -intmisc_name(op) - int op; -{ - static char unk[32]; - - if ((op & 0xf0) == 0x30) - return (intmisc_opname_3x[op & 0x0f]); - - switch (op) { - case op_sextb: return ("sextb"); - case op_sextw: return ("sextw"); - case op_ftoit: return ("ftoit"); - case op_ftois: return ("ftois"); - } - - snprintf(unk, sizeof(unk), "?intmisc 0x%x?", op); - return (unk); -} - -static const char *float_name(const struct tbl[], int, const char *type); - -static const char * -float_name(tbl, op, type) - const struct tbl tbl[]; - int op; - const char *type; -{ - static char unk[32]; - int i; - - for (i = 0; tbl[i].name != NULL; i++) { - if (tbl[i].code == op) - return (tbl[i].name); - } - - snprintf(unk, sizeof(unk), "?%s 0x%x?", type, op); - return (unk); -} - -#define vaxf_name(op) float_name(vaxf_tbl, op, "vaxfl") -#define ieeef_name(op) float_name(ieeef_tbl, op, "ieeefl") -#define anyf_name(op) float_name(anyf_tbl, op, "anyfl") - -static const struct tbl anyf_tbl[] = { - { "cvtlq", 0x010}, - { "cpys", 0x020}, - { "cpysn", 0x021}, - { "cpyse", 0x022}, - { "mt_fpcr", 0x024}, - { "mf_fpcr", 0x025}, - { "fcmoveq", 0x02a}, - { "fcmovne", 0x02b}, - { "fcmovlt", 0x02c}, - { "fcmovge", 0x02d}, - { "fcmovle", 0x02e}, - { "fcmovgt", 0x02f}, - { "cvtql", 0x030}, - { "cvtql/v", 0x130}, - { "cvtql/sv", 0x330}, - { 0, 0}, -}; - -static const struct tbl ieeef_tbl[] = { - { "adds/c", 0x000}, - { "subs/c", 0x001}, - { "muls/c", 0x002}, - { "divs/c", 0x003}, - { "addt/c", 0x020}, - { "subt/c", 0x021}, - { "mult/c", 0x022}, - { "divt/c", 0x023}, - { "cvtts/c", 0x02c}, - { "cvttq/c", 0x02f}, - { "cvtqs/c", 0x03c}, - { "cvtqt/c", 0x03e}, - { "adds/m", 0x040}, - { "subs/m", 0x041}, - { "muls/m", 0x042}, - { "divs/m", 0x043}, - { "addt/m", 0x060}, - { "subt/m", 0x061}, - { "mult/m", 0x062}, - { "divt/m", 0x063}, - { "cvtts/m", 0x06c}, - { "cvtqs/m", 0x07c}, - { "cvtqt/m", 0x07e}, - { "adds", 0x080}, - { "subs", 0x081}, - { "muls", 0x082}, - { "divs", 0x083}, - { "addt", 0x0a0}, - { "subt", 0x0a1}, - { "mult", 0x0a2}, - { "divt", 0x0a3}, - { "cmptun", 0x0a4}, - { "cmpteq", 0x0a5}, - { "cmptlt", 0x0a6}, - { "cmptle", 0x0a7}, - { "cvtts", 0x0ac}, - { "cvttq", 0x0af}, - { "cvtqs", 0x0bc}, - { "cvtqt", 0x0be}, - { "adds/d", 0x0c0}, - { "subs/d", 0x0c1}, - { "muls/d", 0x0c2}, - { "divs/d", 0x0c3}, - { "addt/d", 0x0e0}, - { "subt/d", 0x0e1}, - { "mult/d", 0x0e2}, - { "divt/d", 0x0e3}, - { "cvtts/d", 0x0ec}, - { "cvtqs/d", 0x0fc}, - { "cvtqt/d", 0x0fe}, - { "adds/uc", 0x100}, - { "subs/uc", 0x101}, - { "muls/uc", 0x102}, - { "divs/uc", 0x103}, - { "addt/uc", 0x120}, - { "subt/uc", 0x121}, - { "mult/uc", 0x122}, - { "divt/uc", 0x123}, - { "cvtts/uc", 0x12c}, - { "cvttq/vc", 0x12f}, - { "adds/um", 0x140}, - { "subs/um", 0x141}, - { "muls/um", 0x142}, - { "divs/um", 0x143}, - { "addt/um", 0x160}, - { "subt/um", 0x161}, - { "mult/um", 0x162}, - { "divt/um", 0x163}, - { "cvtts/um", 0x16c}, - { "adds/u", 0x180}, - { "subs/u", 0x181}, - { "muls/u", 0x182}, - { "divs/u", 0x183}, - { "addt/u", 0x1a0}, - { "subt/u", 0x1a1}, - { "mult/u", 0x1a2}, - { "divt/u", 0x1a3}, - { "cvtts/u", 0x1ac}, - { "cvttq/v", 0x1af}, - { "adds/ud", 0x1c0}, - { "subs/ud", 0x1c1}, - { "muls/ud", 0x1c2}, - { "divs/ud", 0x1c3}, - { "addt/ud", 0x1e0}, - { "subt/ud", 0x1e1}, - { "mult/ud", 0x1e2}, - { "divt/ud", 0x1e3}, - { "cvtts/ud", 0x1ec}, - { "adds/suc", 0x500}, - { "subs/suc", 0x501}, - { "muls/suc", 0x502}, - { "divs/suc", 0x503}, - { "addt/suc", 0x520}, - { "subt/suc", 0x521}, - { "mult/suc", 0x522}, - { "divt/suc", 0x523}, - { "cvtts/suc", 0x52c}, - { "cvttq/svc", 0x52f}, - { "adds/sum", 0x540}, - { "subs/sum", 0x541}, - { "muls/sum", 0x542}, - { "divs/sum", 0x543}, - { "addt/sum", 0x560}, - { "subt/sum", 0x561}, - { "mult/sum", 0x562}, - { "divt/sum", 0x563}, - { "cvtts/sum", 0x56c}, - { "adds/su", 0x580}, - { "subs/su", 0x581}, - { "muls/su", 0x582}, - { "divs/su", 0x583}, - { "addt/su", 0x5a0}, - { "subt/su", 0x5a1}, - { "mult/su", 0x5a2}, - { "divt/su", 0x5a3}, - { "cmptun/su", 0x5a4}, - { "cmpteq/su", 0x5a5}, - { "cmptlt/su", 0x5a6}, - { "cmptle/su", 0x5a7}, - { "cvtts/su", 0x5ac}, - { "cvttq/sv", 0x5af}, - { "adds/sud", 0x5c0}, - { "subs/sud", 0x5c1}, - { "muls/sud", 0x5c2}, - { "divs/sud", 0x5c3}, - { "addt/sud", 0x5e0}, - { "subt/sud", 0x5e1}, - { "mult/sud", 0x5e2}, - { "divt/sud", 0x5e3}, - { "cvtts/sud", 0x5ec}, - { "adds/suic", 0x700}, - { "subs/suic", 0x701}, - { "muls/suic", 0x702}, - { "divs/suic", 0x703}, - { "addt/suic", 0x720}, - { "subt/suic", 0x721}, - { "mult/suic", 0x722}, - { "divt/suic", 0x723}, - { "cvtts/suic", 0x72c}, - { "cvttq/svic", 0x72f}, - { "cvtqs/suic", 0x73c}, - { "cvtqt/suic", 0x73e}, - { "adds/suim", 0x740}, - { "subs/suim", 0x741}, - { "muls/suim", 0x742}, - { "divs/suim", 0x743}, - { "addt/suim", 0x760}, - { "subt/suim", 0x761}, - { "mult/suim", 0x762}, - { "divt/suim", 0x763}, - { "cvtts/suim", 0x76c}, - { "cvtqs/suim", 0x77c}, - { "cvtqt/suim", 0x77e}, - { "adds/sui", 0x780}, - { "subs/sui", 0x781}, - { "muls/sui", 0x782}, - { "divs/sui", 0x783}, - { "addt/sui", 0x7a0}, - { "subt/sui", 0x7a1}, - { "mult/sui", 0x7a2}, - { "divt/sui", 0x7a3}, - { "cvtts/sui", 0x7ac}, - { "cvttq/svi", 0x7af}, - { "cvtqs/sui", 0x7bc}, - { "cvtqt/sui", 0x7be}, - { "adds/suid", 0x7c0}, - { "subs/suid", 0x7c1}, - { "muls/suid", 0x7c2}, - { "divs/suid", 0x7c3}, - { "addt/suid", 0x7e0}, - { "subt/suid", 0x7e1}, - { "mult/suid", 0x7e2}, - { "divt/suid", 0x7e3}, - { "cvtts/suid", 0x7ec}, - { "cvtqs/suid", 0x7fc}, - { "cvtqt/suid", 0x7fe}, - { 0, 0} -}; - -static const struct tbl vaxf_tbl[] = { - { "addf/c", 0x000}, - { "subf/c", 0x001}, - { "mulf/c", 0x002}, - { "divf/c", 0x003}, - { "cvtdg/c", 0x01e}, - { "addg/c", 0x020}, - { "subg/c", 0x021}, - { "mulg/c", 0x022}, - { "divg/c", 0x023}, - { "cvtgf/c", 0x02c}, - { "cvtgd/c", 0x02d}, - { "cvtgq/c", 0x02f}, - { "cvtqf/c", 0x03c}, - { "cvtqg/c", 0x03e}, - { "addf", 0x080}, - { "subf", 0x081}, - { "mulf", 0x082}, - { "divf", 0x083}, - { "cvtdg", 0x09e}, - { "addg", 0x0a0}, - { "subg", 0x0a1}, - { "mulg", 0x0a2}, - { "divg", 0x0a3}, - { "cmpgeq", 0x0a5}, - { "cmpglt", 0x0a6}, - { "cmpgle", 0x0a7}, - { "cvtgf", 0x0ac}, - { "cvtgd", 0x0ad}, - { "cvtgq", 0x0af}, - { "cvtqf", 0x0bc}, - { "cvtqg", 0x0be}, - { "addf/uc", 0x100}, - { "subf/uc", 0x101}, - { "mulf/uc", 0x102}, - { "divf/uc", 0x103}, - { "cvtdg/uc", 0x11e}, - { "addg/uc", 0x120}, - { "subg/uc", 0x121}, - { "mulg/uc", 0x122}, - { "divg/uc", 0x123}, - { "cvtgf/uc", 0x12c}, - { "cvtgd/uc", 0x12d}, - { "cvtgq/vc", 0x12f}, - { "addf/u", 0x180}, - { "subf/u", 0x181}, - { "mulf/u", 0x182}, - { "divf/u", 0x183}, - { "cvtdg/u", 0x19e}, - { "addg/u", 0x1a0}, - { "subg/u", 0x1a1}, - { "mulg/u", 0x1a2}, - { "divg/u", 0x1a3}, - { "cvtgf/u", 0x1ac}, - { "cvtgd/u", 0x1ad}, - { "cvtgq/v", 0x1af}, - { "addf/sc", 0x400}, - { "subf/sc", 0x401}, - { "mulf/sc", 0x402}, - { "divf/sc", 0x403}, - { "cvtdg/sc", 0x41e}, - { "addg/sc", 0x420}, - { "subg/sc", 0x421}, - { "mulg/sc", 0x422}, - { "divg/sc", 0x423}, - { "cvtgf/sc", 0x42c}, - { "cvtgd/sc", 0x42d}, - { "cvtgq/sc", 0x42f}, - { "cvtqf/sc", 0x43c}, - { "cvtqg/sc", 0x43e}, - { "addf/s", 0x480}, - { "subf/s", 0x481}, - { "mulf/s", 0x482}, - { "divf/s", 0x483}, - { "cvtdg/s", 0x49e}, - { "addg/s", 0x4a0}, - { "subg/s", 0x4a1}, - { "mulg/s", 0x4a2}, - { "divg/s", 0x4a3}, - { "cmpgeq/s", 0x4a5}, - { "cmpglt/s", 0x4a6}, - { "cmpgle/s", 0x4a7}, - { "cvtgf/s", 0x4ac}, - { "cvtgd/s", 0x4ad}, - { "cvtgq/s", 0x4af}, - { "cvtqf/s", 0x4bc}, - { "cvtqg/s", 0x4be}, - { "addf/suc", 0x500}, - { "subf/suc", 0x501}, - { "mulf/suc", 0x502}, - { "divf/suc", 0x503}, - { "cvtdg/suc", 0x51e}, - { "addg/suc", 0x520}, - { "subg/suc", 0x521}, - { "mulg/suc", 0x522}, - { "divg/suc", 0x523}, - { "cvtgf/suc", 0x52c}, - { "cvtgd/suc", 0x52d}, - { "cvtgq/svc", 0x52f}, - { "addf/su", 0x580}, - { "subf/su", 0x581}, - { "mulf/su", 0x582}, - { "divf/su", 0x583}, - { "cvtdg/su", 0x59e}, - { "addg/su", 0x5a0}, - { "subg/su", 0x5a1}, - { "mulg/su", 0x5a2}, - { "divg/su", 0x5a3}, - { "cvtgf/su", 0x5ac}, - { "cvtgd/su", 0x5ad}, - { "cvtgq/sv", 0x5af}, - { 0, 0} -}; - -/* - * General purpose registers - */ -static const char *name_of_register[32] = { - "v0", "t0", "t1", "t2", "t3", "t4", "t5", "t6", - "t7", "s0", "s1", "s2", "s3", "s4", "s5", "s6", - "a0", "a1", "a2", "a3", "a4", "a5", "t8", "t9", - "t10", "t11", "ra", "pv", "at", "gp", "sp", "zero" -}; - -static int regcount; /* how many regs used in this inst */ -static int regnum[3]; /* which regs used in this inst */ - -static const char *register_name(int); - -static const char * -register_name (ireg) - int ireg; -{ - int i; - - for (i = 0; i < regcount; i++) - if (regnum[i] == ireg) - break; - if (i >= regcount) - regnum[regcount++] = ireg; - return (name_of_register[ireg]); -} - -/* - * Disassemble instruction at 'loc'. 'altfmt' specifies an - * (optional) alternate format. Return address of start of - * next instruction. - */ - -static int -alpha_print_instr(db_addr_t iadr, alpha_instruction i, boolean_t showregs) -{ - const char *opcode; - int ireg; - long signed_immediate; - boolean_t fstore; - pal_instruction p; - - regcount = 0; - fstore = FALSE; - opcode = op_name[i.mem_format.opcode]; - - /* - * Dispatch directly on the opcode, save code - * duplication sometimes via "harmless gotos". - */ - switch (i.mem_format.opcode) { - case op_pal: - /* "call_pal" is a long string; just use a space. */ - db_printf("%s %s", opcode, pal_opname(i.pal_format.function)); - break; - case op_lda: - case op_ldah: - case op_ldbu: - case op_ldq_u: - case op_ldwu: - case op_stw: - case op_stb: - case op_stq_u: - /* - * These loadstores are here to make compiling the - * switch a bit easier. Could embellish the output - * someday, too. - */ - goto loadstore; - break; - case op_arit: - /* - * For this and the following three groups we - * just need different opcode strings - */ - opcode = arit_name(i.operate_lit_format.function); - goto operate; - break; - case op_logical: - opcode = logical_name(i.operate_lit_format.function); - goto operate; - break; - case op_bit: - opcode = bitop_name(i.operate_lit_format.function); - goto operate; - break; - case op_mul: - opcode = mul_name(i.operate_lit_format.function); -operate: - /* - * Nice and uniform, just check for literals - */ - db_printf("%s\t%s,", opcode, - register_name(i.operate_lit_format.rs)); - if (i.operate_lit_format.one) - db_printf("#0x%x", i.operate_lit_format.literal); - else - db_printf("%s", register_name(i.operate_reg_format.rt)); - db_printf(",%s", register_name(i.operate_lit_format.rd)); - break; - case op_vax_float: - /* - * The three floating point groups are even simpler - */ - opcode = vaxf_name(i.float_format.function); - goto foperate; - break; - case op_ieee_float: - opcode = ieeef_name(i.float_format.function); - goto foperate; - break; - case op_any_float: - opcode = anyf_name(i.float_format.function); -foperate: - db_printf("%s\tf%d,f%d,f%d", opcode, - i.float_format.fs, - i.float_format.ft, - i.float_format.fd); - break; - case op_special: - /* - * Miscellaneous. - */ - { - register unsigned int code; - - code = (i.mem_format.displacement)&0xffff; - opcode = special_name(code); - - switch (code) { - case op_fetch: - case op_fetch_m: - db_printf("%s\t0(%s)", opcode, - register_name(i.mem_format.rs)); - break; - case op_rpcc: - case op_rc: - case op_rs: - db_printf("%s\t%s", opcode, - register_name(i.mem_format.rd)); - break; - case op_draint: - case op_mb: - default: - db_printf("%s", opcode); - break; - } - } - break; - case op_j: - /* - * Jump instructions really are of two sorts, - * depending on the use of the hint info. - */ - opcode = jump_name(i.jump_format.action); - switch (i.jump_format.action) { - case op_jmp: - case op_jsr: - db_printf("%s\t%s,(%s),", opcode, - register_name(i.jump_format.rd), - register_name(i.jump_format.rs)); - signed_immediate = i.jump_format.hint; - goto branch_displacement; - break; - case op_ret: - case op_jcr: - db_printf("%s\t%s,(%s)", opcode, - register_name(i.jump_format.rd), - register_name(i.jump_format.rs)); - break; - } - break; - case op_intmisc: - /* - * These are just in "operate" format. - */ - opcode = intmisc_name(i.operate_lit_format.function); - goto operate; - break; - /* HW instructions, possibly chip-specific XXXX */ - case op_pal19: /* "hw_mfpr" */ - case op_pal1d: /* "hw_mtpr" */ - p.bits = i.bits; - db_printf("\t%s%s\t%s, %d", opcode, - mXpr_name[p.mXpr_format.regset], - register_name(p.mXpr_format.rd), - p.mXpr_format.index); - break; - case op_pal1b: /* "hw_ld" */ - case op_pal1f: /* "hw_st" */ - p.bits = i.bits; - db_printf("\t%s%c%s\t%s,", opcode, - (p.mem_format.qw) ? 'q' : 'l', - hwlds_name[p.mem_format.qualif], - register_name(p.mem_format.rd)); - signed_immediate = (long)p.mem_format.displacement; - goto loadstore_address; - - case op_pal1e: /* "hw_rei" */ - db_printf("\t%s", opcode); - break; - - case op_ldf: - case op_ldg: - case op_lds: - case op_ldt: - case op_stf: - case op_stg: - case op_sts: - case op_stt: - fstore = TRUE; - /* FALLTHROUGH */ - case op_ldl: - case op_ldq: - case op_ldl_l: - case op_ldq_l: - case op_stl: - case op_stq: - case op_stl_c: - case op_stq_c: - /* - * Memory operations, including floats - */ -loadstore: - if (fstore) - db_printf("%s\tf%d,", opcode, i.mem_format.rd); - else - db_printf("%s\t%s,", opcode, - register_name(i.mem_format.rd)); - signed_immediate = (long)i.mem_format.displacement; -loadstore_address: - db_printf("%#lx(%s)", signed_immediate, - register_name(i.mem_format.rs)); - /* - * For convenience, do the address computation - */ - if (showregs) { - if (i.mem_format.opcode == op_ldah) - signed_immediate <<= 16; - db_printf(" <0x%lx>", signed_immediate + - db_register_value(i.mem_format.rs)); - } - break; - case op_br: - case op_fbeq: - case op_fblt: - case op_fble: - case op_bsr: - case op_fbne: - case op_fbge: - case op_fbgt: - case op_blbc: - case op_beq: - case op_blt: - case op_ble: - case op_blbs: - case op_bne: - case op_bge: - case op_bgt: - /* - * We want to know where we are branching to - */ - signed_immediate = (long)i.branch_format.displacement; - db_printf("%s\t%s,", opcode, - register_name(i.branch_format.rd)); -branch_displacement: - db_printsym(iadr + sizeof(alpha_instruction) + - (signed_immediate << 2), DB_STGY_PROC); - break; - default: - /* - * Shouldn't happen - */ - db_printf("? 0x%x ?", i.bits); - } - - /* - * Print out the registers used in this instruction - */ - if (showregs && regcount > 0) { - db_printf("\t<"); - for (ireg = 0; ireg < regcount; ireg++) { - if (ireg != 0) - db_printf(","); - db_printf("%s=0x%lx", - name_of_register[regnum[ireg]], - db_register_value(regnum[ireg])); - } - db_printf(">"); - } - db_printf("\n"); - return (sizeof(alpha_instruction)); -} - -db_addr_t -db_disasm(loc, altfmt) - db_addr_t loc; - boolean_t altfmt; -{ - alpha_instruction inst; - - inst.bits = db_get_value(loc, 4, 0); - - loc += alpha_print_instr(loc, inst, altfmt); - return (loc); -} diff --git a/sys/alpha/alpha/db_instruction.h b/sys/alpha/alpha/db_instruction.h deleted file mode 100644 index 65e38ba..0000000 --- a/sys/alpha/alpha/db_instruction.h +++ /dev/null @@ -1,700 +0,0 @@ -/* $NetBSD: db_instruction.h,v 1.4 1997/09/16 22:53:32 thorpej Exp $ */ - -/*- - * Mach Operating System - * Copyright (c) 1993,1992 Carnegie Mellon University - * All Rights Reserved. - * - * 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 Mellon - * the rights to redistribute these changes. - * - * $FreeBSD$ - */ - -/* - * File: alpha_instruction.h - * Author: Alessandro Forin, Carnegie Mellon University - * Date: 11/91 - * - * Alpha Instruction set definition - * - * Reference: "Alpha System Reference Manual", V4.0, April 1991 - * - */ - -#ifndef _ALPHA_INSTRUCTION_H_ -#define _ALPHA_INSTRUCTION_H_ 1 - -#if !defined(ASSEMBLER) - -/* - * All instructions are in one of five formats: - * Memory, Branch, Operate, Floating-point Operate, PAL - * - * One minor departure from DEC's conventions is we use names - * for registers that are more akin their software use, e.g. - * rather then bluntly call them Ra/Rb/Rc we make clear which - * one is a source (Rs) and which one is a destination (Rd). - * When a second source register is defined we call it Rt. - */ - - -typedef union { - /* - * All instructions are 32 bits wide - */ - unsigned int bits; - - /* - * Generic instruction pseudo format; look at - * opcode to see how to interpret the rest. - */ - struct { - unsigned bits : 26, - opcode : 6; - } generic_format; - - /* - * Memory instructions contain a 16 bit - * signed immediate value and two register - * specifiers - */ - struct { - signed short displacement; - unsigned rs : 5, - rd : 5, - opcode : 6; - } mem_format; - - /* - * Branch instruction contain a 21 bit offset, - * which is sign-extended, shifted and combined - * with the PC to form a 64 bit destination address. - * - * In computed jump instructions the opcode is further - * specified in the offset field, the rest of it is - * used as branch target hint. The destination of the - * jump is the source register. - */ - struct { - signed int displacement : 21; - unsigned rd : 5, - opcode : 6; - } branch_format; - - struct { - signed int hint : 14; - unsigned action : 2, - rs : 5, - rd : 5, - opcode : 6; - } jump_format; - - - struct { - signed int offset : 16; - unsigned rb : 5; - unsigned ra : 5; - unsigned opcode : 6; - } memory_format; - - /* - * Operate instructions are of two types, with - * a second source register or with a literal - * specifier. Bit 12 sez which is which. - */ - struct { - unsigned rc : 5, - function : 7, - is_lit : 1, - sbz_or_litlo : 3, - rb_or_lithi : 5, - ra : 5, - opcode : 6; - } operate_generic_format; - - struct { - unsigned rd : 5, - function : 7, - sbz : 4, - rt : 5, - rs : 5, - opcode : 6; - } operate_reg_format; - - struct { - unsigned rd : 5, - function : 7, - one : 1, - literal : 8, - rs : 5, - opcode : 6; - } operate_lit_format; - - - /* - * Floating point operate instruction are quite - * uniform in the encoding. As for the semantics.. - */ - struct { - unsigned fd : 5, - function : 11, - ft : 5, - fs : 5, - opcode : 6; - } float_format; - - - /* - * PAL instructions just define the major opcode - */ - - struct { - unsigned function : 26, - opcode : 6; - } pal_format; - -} alpha_instruction; - -#endif /* !defined(ASSEMBLER) */ - -/* - * - * Encoding of regular instructions (Appendix C op cit) - * - */ - - /* OPCODE, bits 26..31 */ - -#define op_pal 0x00 /* see PAL sub-table */ - /* 1..7 reserved */ -#define op_lda 0x08 -#define op_ldah 0x09 -#define op_ldbu 0x0a -#define op_ldq_u 0x0b -#define op_ldwu 0x0c -#define op_stw 0x0d -#define op_stb 0x0e -#define op_stq_u 0x0f - -#define op_arit 0x10 /* see ARIT sub-table */ -#define op_logical 0x11 /* see LOGICAL sub-table */ -#define op_bit 0x12 /* see BIT sub-table */ -#define op_mul 0x13 /* see MUL sub-table */ - /* reserved */ -#define op_vax_float 0x15 /* see FLOAT sub-table */ -#define op_ieee_float 0x16 /* see FLOAT sub-table */ -#define op_any_float 0x17 /* see FLOAT sub-table */ - -#define op_special 0x18 /* see SPECIAL sub-table */ -#define op_pal19 0x19 /* reserved for pal code */ -#define op_j 0x1a /* see JUMP sub-table */ -#define op_pal1b 0x1b /* reserved for pal code */ -#define op_intmisc 0x1c /* see INTMISC sub-table */ -#define op_pal1d 0x1d /* reserved for pal code */ -#define op_pal1e 0x1e /* reserved for pal code */ -#define op_pal1f 0x1f /* reserved for pal code */ - -#define op_ldf 0x20 -#define op_ldg 0x21 -#define op_lds 0x22 -#define op_ldt 0x23 -#define op_stf 0x24 -#define op_stg 0x25 -#define op_sts 0x26 -#define op_stt 0x27 -#define op_ldl 0x28 -#define op_ldq 0x29 -#define op_ldl_l 0x2a -#define op_ldq_l 0x2b -#define op_stl 0x2c -#define op_stq 0x2d -#define op_stl_c 0x2e -#define op_stq_c 0x2f -#define op_br 0x30 -#define op_fbeq 0x31 -#define op_fblt 0x32 -#define op_fble 0x33 -#define op_bsr 0x34 -#define op_fbne 0x35 -#define op_fbge 0x36 -#define op_fbgt 0x37 -#define op_blbc 0x38 -#define op_beq 0x39 -#define op_blt 0x3a -#define op_ble 0x3b -#define op_blbs 0x3c -#define op_bne 0x3d -#define op_bge 0x3e -#define op_bgt 0x3f - - - /* PAL, "function" opcodes (bits 0..25) */ -/* - * What we will implement is TBD. These are the unprivileged ones - * that we probably have to support for compat reasons. - */ - -/* See <machine/pal.h> */ - - /* ARIT, "function" opcodes (bits 5..11) */ - -#define op_addl 0x00 -#define op_s4addl 0x02 -#define op_subl 0x09 -#define op_s4subl 0x0b -#define op_cmpbge 0x0f -#define op_s8addl 0x12 -#define op_s8subl 0x1b -#define op_cmpult 0x1d -#define op_addq 0x20 -#define op_s4addq 0x22 -#define op_subq 0x29 -#define op_s4subq 0x2b -#define op_cmpeq 0x2d -#define op_s8addq 0x32 -#define op_s8subq 0x3b -#define op_cmpule 0x3d -#define op_addl_v 0x40 -#define op_subl_v 0x49 -#define op_cmplt 0x4d -#define op_addq_v 0x60 -#define op_subq_v 0x69 -#define op_cmple 0x6d - - - /* LOGICAL, "function" opcodes (bits 5..11) */ - -#define op_and 0x00 -#define op_andnot 0x08 /* bic */ -#define op_cmovlbs 0x14 -#define op_cmovlbc 0x16 -#define op_or 0x20 /* bis */ -#define op_cmoveq 0x24 -#define op_cmovne 0x26 -#define op_ornot 0x28 -#define op_xor 0x40 -#define op_cmovlt 0x44 -#define op_cmovge 0x46 -#define op_xornot 0x48 /* eqv */ -#define op_amask 0x61 -#define op_cmovle 0x64 -#define op_cmovgt 0x66 -#define op_implver 0x6c - - /* BIT, "function" opcodes (bits 5..11) */ - -#define op_mskbl 0x02 -#define op_extbl 0x06 -#define op_insbl 0x0b -#define op_mskwl 0x12 -#define op_extwl 0x16 -#define op_inswl 0x1b -#define op_mskll 0x22 -#define op_extll 0x26 -#define op_insll 0x2b -#define op_zap 0x30 -#define op_zapnot 0x31 -#define op_mskql 0x32 -#define op_srl 0x34 -#define op_extql 0x36 -#define op_sll 0x39 -#define op_insql 0x3b -#define op_sra 0x3c -#define op_mskwh 0x52 -#define op_inswh 0x57 -#define op_extwh 0x5a -#define op_msklh 0x62 -#define op_inslh 0x67 -#define op_extlh 0x6a -#define op_extqh 0x7a -#define op_insqh 0x77 -#define op_mskqh 0x72 - - /* MUL, "function" opcodes (bits 5..11) */ - -#define op_mull 0x00 -#define op_mulq_v 0x60 -#define op_mull_v 0x40 -#define op_umulh 0x30 -#define op_mulq 0x20 - - - /* SPECIAL, "displacement" opcodes (bits 0..15) */ - -#define op_draint 0x0000 -#define op_mb 0x4000 -#define op_fetch 0x8000 -#define op_fetch_m 0xa000 -#define op_rpcc 0xc000 -#define op_rc 0xe000 -#define op_rs 0xf000 - - /* JUMP, "action" opcodes (bits 14..15) */ - -#define op_jmp 0x0 -#define op_jsr 0x1 -#define op_ret 0x2 -#define op_jcr 0x3 - - /* INTMISC, "function" opcodes (operate format) */ - -#define op_sextb 0x00 -#define op_sextw 0x01 -#define op_ctpop 0x30 -#define op_perr 0x31 -#define op_ctlz 0x32 -#define op_cttz 0x33 -#define op_unpkbw 0x34 -#define op_unpkbl 0x35 -#define op_pkwb 0x36 -#define op_pklb 0x37 -#define op_minsb8 0x38 -#define op_minsw4 0x39 -#define op_minub8 0x3a -#define op_minuw4 0x3b -#define op_maxub8 0x3c -#define op_maxuw4 0x3d -#define op_maxsb8 0x3e -#define op_maxsw4 0x3f -#define op_ftoit 0x70 -#define op_ftois 0x78 - -/* - * - * Encoding of floating point instructions (pagg. C-5..6 op cit) - * - * Load and store operations use opcodes op_ldf..op_stt - */ - - /* any FLOAT, "function" opcodes (bits 5..11) */ - -#define op_cvtlq 0x010 -#define op_cpys 0x020 -#define op_cpysn 0x021 -#define op_cpyse 0x022 -#define op_mt_fpcr 0x024 -#define op_mf_fpcr 0x025 -#define op_fcmoveq 0x02a -#define op_fcmovne 0x02b -#define op_fcmovlt 0x02c -#define op_fcmovge 0x02d -#define op_fcmovle 0x02e -#define op_fcmovgt 0x02f -#define op_cvtql 0x030 -#define op_cvtql_v 0x130 -#define op_cvtql_sv 0x330 - - - /* ieee FLOAT, "function" opcodes (bits 5..11) */ - -#define op_adds_c 0x000 -#define op_subs_c 0x001 -#define op_muls_c 0x002 -#define op_divs_c 0x003 -#define op_addt_c 0x020 -#define op_subt_c 0x021 -#define op_mult_c 0x022 -#define op_divt_c 0x023 -#define op_cvtts_c 0x02c -#define op_cvttq_c 0x02f -#define op_cvtqs_c 0x03c -#define op_cvtqt_c 0x03e -#define op_adds_m 0x040 -#define op_subs_m 0x041 -#define op_muls_m 0x042 -#define op_divs_m 0x043 -#define op_addt_m 0x060 -#define op_subt_m 0x061 -#define op_mult_m 0x062 -#define op_divt_m 0x063 -#define op_cvtts_m 0x06c -#define op_cvtqs_m 0x07c -#define op_cvtqt_m 0x07e -#define op_adds 0x080 -#define op_subs 0x081 -#define op_muls 0x082 -#define op_divs 0x083 -#define op_addt 0x0a0 -#define op_subt 0x0a1 -#define op_mult 0x0a2 -#define op_divt 0x0a3 -#define op_cmptun 0x0a4 -#define op_cmpteq 0x0a5 -#define op_cmptlt 0x0a6 -#define op_cmptle 0x0a7 -#define op_cvtts 0x0ac -#define op_cvttq 0x0af -#define op_cvtqs 0x0bc -#define op_cvtqt 0x0be -#define op_adds_d 0x0c0 -#define op_subs_d 0x0c1 -#define op_muls_d 0x0c2 -#define op_divs_d 0x0c3 -#define op_addt_d 0x0e0 -#define op_subt_d 0x0e1 -#define op_mult_d 0x0e2 -#define op_divt_d 0x0e3 -#define op_cvtts_d 0x0ec -#define op_cvtqs_d 0x0fc -#define op_cvtqt_d 0x0fe -#define op_adds_uc 0x100 -#define op_subs_uc 0x101 -#define op_muls_uc 0x102 -#define op_divs_uc 0x103 -#define op_addt_uc 0x120 -#define op_subt_uc 0x121 -#define op_mult_uc 0x122 -#define op_divt_uc 0x123 -#define op_cvtts_uc 0x12c -#define op_cvttq_vc 0x12f -#define op_adds_um 0x140 -#define op_subs_um 0x141 -#define op_muls_um 0x142 -#define op_divs_um 0x143 -#define op_addt_um 0x160 -#define op_subt_um 0x161 -#define op_mult_um 0x162 -#define op_divt_um 0x163 -#define op_cvtts_um 0x16c -#define op_adds_u 0x180 -#define op_subs_u 0x181 -#define op_muls_u 0x182 -#define op_divs_u 0x183 -#define op_addt_u 0x1a0 -#define op_subt_u 0x1a1 -#define op_mult_u 0x1a2 -#define op_divt_u 0x1a3 -#define op_cvtts_u 0x1ac -#define op_cvttq_v 0x1af -#define op_adds_ud 0x1c0 -#define op_subs_ud 0x1c1 -#define op_muls_ud 0x1c2 -#define op_divs_ud 0x1c3 -#define op_addt_ud 0x1e0 -#define op_subt_ud 0x1e1 -#define op_mult_ud 0x1e2 -#define op_divt_ud 0x1e3 -#define op_cvtts_ud 0x1ec -#define op_adds_suc 0x500 -#define op_subs_suc 0x501 -#define op_muls_suc 0x502 -#define op_divs_suc 0x503 -#define op_addt_suc 0x520 -#define op_subt_suc 0x521 -#define op_mult_suc 0x522 -#define op_divt_suc 0x523 -#define op_cvtts_suc 0x52c -#define op_cvttq_svc 0x52f -#define op_adds_sum 0x540 -#define op_subs_sum 0x541 -#define op_muls_sum 0x542 -#define op_divs_sum 0x543 -#define op_addt_sum 0x560 -#define op_subt_sum 0x561 -#define op_mult_sum 0x562 -#define op_divt_sum 0x563 -#define op_cvtts_sum 0x56c -#define op_adds_su 0x580 -#define op_subs_su 0x581 -#define op_muls_su 0x582 -#define op_divs_su 0x583 -#define op_addt_su 0x5a0 -#define op_subt_su 0x5a1 -#define op_mult_su 0x5a2 -#define op_divt_su 0x5a3 -#define op_cmptun_su 0x5a4 -#define op_cmpteq_su 0x5a5 -#define op_cmptlt_su 0x5a6 -#define op_cmptle_su 0x5a7 -#define op_cvtts_su 0x5ac -#define op_cvttq_sv 0x5af -#define op_adds_sud 0x5c0 -#define op_subs_sud 0x5c1 -#define op_muls_sud 0x5c2 -#define op_divs_sud 0x5c3 -#define op_addt_sud 0x5e0 -#define op_subt_sud 0x5e1 -#define op_mult_sud 0x5e2 -#define op_divt_sud 0x5e3 -#define op_cvtts_sud 0x5ec -#define op_adds_suic 0x700 -#define op_subs_suic 0x701 -#define op_muls_suic 0x702 -#define op_divs_suic 0x703 -#define op_addt_suic 0x720 -#define op_subt_suic 0x721 -#define op_mult_suic 0x722 -#define op_divt_suic 0x723 -#define op_cvtts_suic 0x72c -#define op_cvttq_svic 0x72f -#define op_cvtqs_suic 0x73c -#define op_cvtqt_suic 0x73e -#define op_adds_suim 0x740 -#define op_subs_suim 0x741 -#define op_muls_suim 0x742 -#define op_divs_suim 0x743 -#define op_addt_suim 0x760 -#define op_subt_suim 0x761 -#define op_mult_suim 0x762 -#define op_divt_suim 0x763 -#define op_cvtts_suim 0x76c -#define op_cvtqs_suim 0x77c -#define op_cvtqt_suim 0x77e -#define op_adds_sui 0x780 -#define op_subs_sui 0x781 -#define op_muls_sui 0x782 -#define op_divs_sui 0x783 -#define op_addt_sui 0x7a0 -#define op_subt_sui 0x7a1 -#define op_mult_sui 0x7a2 -#define op_divt_sui 0x7a3 -#define op_cvtts_sui 0x7ac -#define op_cvttq_svi 0x7af -#define op_cvtqs_sui 0x7bc -#define op_cvtqt_sui 0x7be -#define op_adds_suid 0x7c0 -#define op_subs_suid 0x7c1 -#define op_muls_suid 0x7c2 -#define op_divs_suid 0x7c3 -#define op_addt_suid 0x7e0 -#define op_subt_suid 0x7e1 -#define op_mult_suid 0x7e2 -#define op_divt_suid 0x7e3 -#define op_cvtts_suid 0x7ec -#define op_cvtqs_suid 0x7fc -#define op_cvtqt_suid 0x7fe - - - /* vax FLOAT, "function" opcodes (bits 5..11) */ - -#define op_addf_c 0x000 -#define op_subf_c 0x001 -#define op_mulf_c 0x002 -#define op_divf_c 0x003 -#define op_cvtdg_c 0x01e -#define op_addg_c 0x020 -#define op_subg_c 0x021 -#define op_mulg_c 0x022 -#define op_divg_c 0x023 -#define op_cvtgf_c 0x02c -#define op_cvtgd_c 0x02d -#define op_cvtgqg_c 0x02f -#define op_cvtqf_c 0x03c -#define op_cvtqg_c 0x03e -#define op_addf 0x080 -#define op_subf 0x081 -#define op_mulf 0x082 -#define op_divf 0x083 -#define op_cvtdg 0x09e -#define op_addg 0x0a0 -#define op_subg 0x0a1 -#define op_mulg 0x0a2 -#define op_divg 0x0a3 -#define op_cmpgeq 0x0a5 -#define op_cmpglt 0x0a6 -#define op_cmpgle 0x0a7 -#define op_cvtgf 0x0ac -#define op_cvtgd 0x0ad -#define op_cvtgq 0x0af -#define op_cvtqf 0x0bc -#define op_cvtqg 0x0be -#define op_addf_uc 0x100 -#define op_subf_uc 0x101 -#define op_mulf_uc 0x102 -#define op_divf_uc 0x103 -#define op_cvtdg_uc 0x11e -#define op_addg_uc 0x120 -#define op_subg_uc 0x121 -#define op_mulg_uc 0x122 -#define op_divg_uc 0x123 -#define op_cvtgf_uc 0x12c -#define op_cvtgd_uc 0x12d -#define op_cvtgqg_vc 0x12f -#define op_addf_u 0x180 -#define op_subf_u 0x181 -#define op_mulf_u 0x182 -#define op_divf_u 0x183 -#define op_cvtdg_u 0x19e -#define op_addg_u 0x1a0 -#define op_subg_u 0x1a1 -#define op_mulg_u 0x1a2 -#define op_divg_u 0x1a3 -#define op_cvtgf_u 0x1ac -#define op_cvtgd_u 0x1ad -#define op_cvtgqg_v 0x1af -#define op_addf_sc 0x400 -#define op_subf_sc 0x401 -#define op_mulf_sc 0x402 -#define op_divf_sc 0x403 -#define op_cvtdg_sc 0x41e -#define op_addg_sc 0x420 -#define op_subg_sc 0x421 -#define op_mulg_sc 0x422 -#define op_divg_sc 0x423 -#define op_cvtgf_sc 0x42c -#define op_cvtgd_sc 0x42d -#define op_cvtgqg_sc 0x42f -#define op_cvtqf_sc 0x43c -#define op_cvtqg_sc 0x43e -#define op_addf_s 0x480 -#define op_subf_s 0x481 -#define op_mulf_s 0x482 -#define op_divf_s 0x483 -#define op_cvtdg_s 0x49e -#define op_addg_s 0x4a0 -#define op_subg_s 0x4a1 -#define op_mulg_s 0x4a2 -#define op_divg_s 0x4a3 -#define op_cmpgeq_s 0x4a5 -#define op_cmpglt_s 0x4a6 -#define op_cmpgle_s 0x4a7 -#define op_cvtgf_s 0x4ac -#define op_cvtgd_s 0x4ad -#define op_cvtgqg_s 0x4af -#define op_cvtqf_s 0x4bc -#define op_cvtqg_s 0x4be -#define op_addf_suc 0x500 -#define op_subf_suc 0x501 -#define op_mulf_suc 0x502 -#define op_divf_suc 0x503 -#define op_cvtdg_suc 0x51e -#define op_addg_suc 0x520 -#define op_subg_suc 0x521 -#define op_mulg_suc 0x522 -#define op_divg_suc 0x523 -#define op_cvtgf_suc 0x52c -#define op_cvtgd_suc 0x52d -#define op_cvtgqg_svc 0x52f -#define op_addf_su 0x580 -#define op_subf_su 0x581 -#define op_mulf_su 0x582 -#define op_divf_su 0x583 -#define op_cvtdg_su 0x59e -#define op_addg_su 0x5a0 -#define op_subg_su 0x5a1 -#define op_mulg_su 0x5a2 -#define op_divg_su 0x5a3 -#define op_cvtgf_su 0x5ac -#define op_cvtgd_su 0x5ad -#define op_cvtgqg_sv 0x5af - - -#endif /* _ALPHA_INSTRUCTION_H_ */ diff --git a/sys/alpha/alpha/db_interface.c b/sys/alpha/alpha/db_interface.c deleted file mode 100644 index 12e6877..0000000 --- a/sys/alpha/alpha/db_interface.c +++ /dev/null @@ -1,452 +0,0 @@ -/*- - * Mach Operating System - * Copyright (c) 1992,1991,1990 Carnegie Mellon University - * All Rights Reserved. - * - * 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 - * 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. - * - * db_interface.c,v 2.4 1991/02/05 17:11:13 mrt (CMU) - */ - -/* - * Parts of this file are derived from Mach 3: - * - * File: alpha_instruction.c - * Author: Alessandro Forin, Carnegie Mellon University - * Date: 6/92 - */ - -/* - * Interface to DDB. - * - * Modified for NetBSD/alpha by: - * - * Christopher G. Demetriou, Carnegie Mellon University - * - * Jason R. Thorpe, Numerical Aerospace Simulation Facility, - * NASA Ames Research Center - */ - -#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -/* __KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.2 1997/09/16 19:07:19 thorpej Exp $"); */ -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/cons.h> -#include <sys/kdb.h> -#include <sys/kernel.h> -#include <sys/pcpu.h> -#include <sys/proc.h> -#include <sys/smp.h> - -#include <vm/vm.h> - -#include <machine/db_machdep.h> -#include <machine/pal.h> -#include <machine/prom.h> - -#include <alpha/alpha/db_instruction.h> - -#include <ddb/ddb.h> - -#include <ddb/db_access.h> -#include <ddb/db_sym.h> -#include <ddb/db_variables.h> - -static db_varfcn_t db_frame; - -struct db_variable db_regs[] = { - { "v0", (db_expr_t *)FRAME_V0, db_frame }, - { "t0", (db_expr_t *)FRAME_T0, db_frame }, - { "t1", (db_expr_t *)FRAME_T1, db_frame }, - { "t2", (db_expr_t *)FRAME_T2, db_frame }, - { "t3", (db_expr_t *)FRAME_T3, db_frame }, - { "t4", (db_expr_t *)FRAME_T4, db_frame }, - { "t5", (db_expr_t *)FRAME_T5, db_frame }, - { "t6", (db_expr_t *)FRAME_T6, db_frame }, - { "t7", (db_expr_t *)FRAME_T7, db_frame }, - { "s0", (db_expr_t *)FRAME_S0, db_frame }, - { "s1", (db_expr_t *)FRAME_S1, db_frame }, - { "s2", (db_expr_t *)FRAME_S2, db_frame }, - { "s3", (db_expr_t *)FRAME_S3, db_frame }, - { "s4", (db_expr_t *)FRAME_S4, db_frame }, - { "s5", (db_expr_t *)FRAME_S5, db_frame }, - { "s6", (db_expr_t *)FRAME_S6, db_frame }, - { "a0", (db_expr_t *)FRAME_A0, db_frame }, - { "a1", (db_expr_t *)FRAME_A1, db_frame }, - { "a2", (db_expr_t *)FRAME_A2, db_frame }, - { "a3", (db_expr_t *)FRAME_A3, db_frame }, - { "a4", (db_expr_t *)FRAME_A4, db_frame }, - { "a5", (db_expr_t *)FRAME_A5, db_frame }, - { "t8", (db_expr_t *)FRAME_T8, db_frame }, - { "t9", (db_expr_t *)FRAME_T9, db_frame }, - { "t10", (db_expr_t *)FRAME_T10, db_frame }, - { "t11", (db_expr_t *)FRAME_T11, db_frame }, - { "ra", (db_expr_t *)FRAME_RA, db_frame }, - { "t12", (db_expr_t *)FRAME_T12, db_frame }, - { "at", (db_expr_t *)FRAME_AT, db_frame }, - { "gp", (db_expr_t *)FRAME_GP, db_frame }, - { "sp", (db_expr_t *)FRAME_SP, db_frame }, - { "pc", (db_expr_t *)FRAME_PC, db_frame }, - { "ps", (db_expr_t *)FRAME_PS, db_frame }, - { "ai", (db_expr_t *)FRAME_T11, db_frame }, - { "pv", (db_expr_t *)FRAME_T12, db_frame }, -}; -struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); - -static int -db_frame(struct db_variable *vp, db_expr_t *valuep, int op) -{ - - if (kdb_frame == NULL) - return (0); - if (op == DB_VAR_GET) - *valuep = kdb_frame->tf_regs[(uintptr_t)vp->valuep]; - else - kdb_frame->tf_regs[(uintptr_t)vp->valuep] = *valuep; - return (1); -} - -/* - * Read bytes from kernel address space for debugger. - */ -int -db_read_bytes(vm_offset_t addr, size_t size, char *data) -{ - jmp_buf jb; - void *prev_jb; - char *src; - int ret; - - prev_jb = kdb_jmpbuf(jb); - ret = setjmp(jb); - if (ret == 0) { - src = (char *)addr; - while (size-- > 0) - *data++ = *src++; - } - (void)kdb_jmpbuf(prev_jb); - return (ret); -} - -/* - * Write bytes to kernel address space for debugger. - */ -int -db_write_bytes(vm_offset_t addr, size_t size, char *data) -{ - jmp_buf jb; - void *prev_jb; - char *dst; - int ret; - - prev_jb = kdb_jmpbuf(jb); - ret = setjmp(jb); - if (ret == 0) { - dst = (char *)addr; - while (size-- > 0) - *dst++ = *data++; - alpha_pal_imb(); - } - (void)kdb_jmpbuf(prev_jb); - return (ret); -} - -/* - * Alpha-specific ddb commands: - * - * halt set halt bit in rpb and halt - * reboot set reboot bit in rpb and halt - */ - -DB_COMMAND(halt, db_mach_halt) -{ - - prom_halt(1); -} - -DB_COMMAND(reboot, db_mach_reboot) -{ - prom_halt(0); -} - -/* - * Map Alpha register numbers to trapframe/db_regs_t offsets. - */ -static int reg_to_frame[32] = { - FRAME_V0, - FRAME_T0, - FRAME_T1, - FRAME_T2, - FRAME_T3, - FRAME_T4, - FRAME_T5, - FRAME_T6, - FRAME_T7, - - FRAME_S0, - FRAME_S1, - FRAME_S2, - FRAME_S3, - FRAME_S4, - FRAME_S5, - FRAME_S6, - - FRAME_A0, - FRAME_A1, - FRAME_A2, - FRAME_A3, - FRAME_A4, - FRAME_A5, - - FRAME_T8, - FRAME_T9, - FRAME_T10, - FRAME_T11, - FRAME_RA, - FRAME_T12, - FRAME_AT, - FRAME_GP, - FRAME_SP, - -1, /* zero */ -}; - -u_long -db_register_value(int regno) -{ - - if (regno > 31 || regno < 0) { - db_printf(" **** STRANGE REGISTER NUMBER %d **** ", regno); - return (0); - } - - if (regno == 31) - return (0); - - return (kdb_frame->tf_regs[reg_to_frame[regno]]); -} - -/* - * Support functions for software single-step. - */ - -boolean_t -db_inst_call(ins) - int ins; -{ - alpha_instruction insn; - - insn.bits = ins; - return ((insn.branch_format.opcode == op_bsr) || - ((insn.jump_format.opcode == op_j) && - (insn.jump_format.action & 1))); -} - -boolean_t -db_inst_return(ins) - int ins; -{ - alpha_instruction insn; - - insn.bits = ins; - return ((insn.jump_format.opcode == op_j) && - (insn.jump_format.action == op_ret)); -} - -boolean_t -db_inst_trap_return(ins) - int ins; -{ - alpha_instruction insn; - - insn.bits = ins; - return ((insn.pal_format.opcode == op_pal) && - (insn.pal_format.function == PAL_OSF1_rti)); -} - -boolean_t -db_inst_branch(ins) - int ins; -{ - alpha_instruction insn; - - insn.bits = ins; - switch (insn.branch_format.opcode) { - case op_j: - case op_br: - case op_fbeq: - case op_fblt: - case op_fble: - case op_fbne: - case op_fbge: - case op_fbgt: - case op_blbc: - case op_beq: - case op_blt: - case op_ble: - case op_blbs: - case op_bne: - case op_bge: - case op_bgt: - return (TRUE); - } - - return (FALSE); -} - -boolean_t -db_inst_unconditional_flow_transfer(ins) - int ins; -{ - alpha_instruction insn; - - insn.bits = ins; - switch (insn.branch_format.opcode) { - case op_j: - case op_br: - return (TRUE); - - case op_pal: - switch (insn.pal_format.function) { - case PAL_OSF1_retsys: - case PAL_OSF1_rti: - case PAL_OSF1_callsys: - return (TRUE); - } - } - - return (FALSE); -} - -boolean_t -db_inst_load(ins) - int ins; -{ - alpha_instruction insn; - - insn.bits = ins; - - /* Loads. */ - if (insn.mem_format.opcode == op_ldbu || - insn.mem_format.opcode == op_ldq_u || - insn.mem_format.opcode == op_ldwu) - return (TRUE); - if ((insn.mem_format.opcode >= op_ldf) && - (insn.mem_format.opcode <= op_ldt)) - return (TRUE); - if ((insn.mem_format.opcode >= op_ldl) && - (insn.mem_format.opcode <= op_ldq_l)) - return (TRUE); - - /* Prefetches. */ - if (insn.mem_format.opcode == op_special) { - /* Note: MB is treated as a store. */ - if ((insn.mem_format.displacement == (short)op_fetch) || - (insn.mem_format.displacement == (short)op_fetch_m)) - return (TRUE); - } - - return (FALSE); -} - -boolean_t -db_inst_store(ins) - int ins; -{ - alpha_instruction insn; - - insn.bits = ins; - - /* Stores. */ - if (insn.mem_format.opcode == op_stw || - insn.mem_format.opcode == op_stb || - insn.mem_format.opcode == op_stq_u) - return (TRUE); - if ((insn.mem_format.opcode >= op_stf) && - (insn.mem_format.opcode <= op_stt)) - return (TRUE); - if ((insn.mem_format.opcode >= op_stl) && - (insn.mem_format.opcode <= op_stq_c)) - return (TRUE); - - /* Barriers. */ - if (insn.mem_format.opcode == op_special) { - if (insn.mem_format.displacement == op_mb) - return (TRUE); - } - - return (FALSE); -} - -db_addr_t -db_branch_taken(int ins, db_addr_t pc) -{ - alpha_instruction insn; - db_addr_t newpc; - - insn.bits = ins; - switch (insn.branch_format.opcode) { - /* - * Jump format: target PC is (contents of instruction's "RB") & ~3. - */ - case op_j: - newpc = db_register_value(insn.jump_format.rs) & ~3; - break; - - /* - * Branch format: target PC is - * (new PC) + (4 * sign-ext(displacement)). - */ - case op_br: - case op_fbeq: - case op_fblt: - case op_fble: - case op_bsr: - case op_fbne: - case op_fbge: - case op_fbgt: - case op_blbc: - case op_beq: - case op_blt: - case op_ble: - case op_blbs: - case op_bne: - case op_bge: - case op_bgt: - newpc = (insn.branch_format.displacement << 2) + (pc + 4); - break; - - default: - printf("DDB: db_inst_branch_taken on non-branch!\n"); - newpc = pc; /* XXX */ - } - - return (newpc); -} - -void -db_show_mdpcpu(struct pcpu *pc) -{ - - db_printf("ipis = 0x%lx\n", pc->pc_pending_ipis); - db_printf("next ASN = %d\n", pc->pc_next_asn); -} diff --git a/sys/alpha/alpha/db_trace.c b/sys/alpha/alpha/db_trace.c deleted file mode 100644 index be59a22..0000000 --- a/sys/alpha/alpha/db_trace.c +++ /dev/null @@ -1,410 +0,0 @@ -/* $NetBSD: db_trace.c,v 1.9 2000/12/13 03:16:36 mycroft Exp $ */ - -/*- - * Copyright (c) 1999 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. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Ross Harvey. - * - * 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. - */ - -#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -/*__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.9 2000/12/13 03:16:36 mycroft Exp $");*/ -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kdb.h> -#include <sys/linker.h> -#include <sys/proc.h> -#include <sys/stack.h> -#include <sys/sysent.h> - -#include <machine/db_machdep.h> -#include <machine/md_var.h> -#include <machine/pcb.h> - -#include <ddb/ddb.h> -#include <ddb/db_sym.h> -#include <ddb/db_access.h> -#include <ddb/db_variables.h> -#include <ddb/db_output.h> -#include <alpha/alpha/db_instruction.h> - -/* - * Information about the `standard' Alpha function prologue. - */ -struct prologue_info { - int pi_reg_offset[32]; /* offset of registers in stack frame */ - u_int32_t pi_regmask; /* which registers are in frame */ - int pi_frame_size; /* frame size */ -}; - -/* - * We use several symbols to take special action: - * - * Trap vectors, which use a different (fixed-size) stack frame: - * - * XentArith - * XentIF - * XentInt - * XentMM - * XentSys - * XentUna - */ - -static struct special_symbol { - uintptr_t ss_val; - const char *ss_note; -} special_symbols[] = { - { (uintptr_t)&XentArith, "arithmetic trap" }, - { (uintptr_t)&XentIF, "instruction fault" }, - { (uintptr_t)&XentInt, "interrupt" }, - { (uintptr_t)&XentMM, "memory management fault" }, - { (uintptr_t)&XentSys, "syscall" }, - { (uintptr_t)&XentUna, "unaligned access fault" }, - { (uintptr_t)&XentRestart, "console restart" }, - { 0, NULL } -}; - - -/* - * Decode the function prologue for the function we're in, and note - * which registers are stored where, and how large the stack frame is. - */ -static int -decode_prologue(db_addr_t callpc, db_addr_t func, - struct prologue_info *pi) -{ - long signed_immediate; - alpha_instruction ins; - db_expr_t pc; - - pi->pi_regmask = 0; - pi->pi_frame_size = 0; - -#define CHECK_FRAMESIZE \ -do { \ - if (pi->pi_frame_size != 0) { \ - db_printf("frame size botch: adjust register offsets?\n"); \ - return (1); \ - } \ -} while (0) - - for (pc = func; pc < callpc; pc += sizeof(alpha_instruction)) { - ins.bits = *(unsigned int *)pc; - - if (ins.memory_format.opcode == op_lda && - ins.memory_format.ra == 30 && - ins.memory_format.rb == 30) { - /* - * GCC 2.7-style stack adjust: - * - * lda sp, -64(sp) - */ - signed_immediate = (long)ins.mem_format.displacement; -#if 1 - if (signed_immediate > 0) { - db_printf("prologue botch: displacement %ld\n", - signed_immediate); - return (1); - } -#endif - CHECK_FRAMESIZE; - pi->pi_frame_size += -signed_immediate; - } else if (ins.operate_lit_format.opcode == op_arit && - ins.operate_lit_format.function == op_subq && - ins.operate_lit_format.rs == 30 && - ins.operate_lit_format.rd == 30) { - /* - * EGCS-style stack adjust: - * - * subq sp, 64, sp - */ - CHECK_FRAMESIZE; - pi->pi_frame_size += ins.operate_lit_format.literal; - } else if (ins.mem_format.opcode == op_stq && - ins.mem_format.rs == 30 && - ins.mem_format.rd != 31) { - /* Store of (non-zero) register onto the stack. */ - signed_immediate = (long)ins.mem_format.displacement; - pi->pi_regmask |= 1 << ins.mem_format.rd; - pi->pi_reg_offset[ins.mem_format.rd] = signed_immediate; - } - } - return (0); -} - -static int -sym_is_trapsymbol(uintptr_t v) -{ - int i; - - for (i = 0; special_symbols[i].ss_val != 0; ++i) - if (v == special_symbols[i].ss_val) - return 1; - return 0; -} - -static void -decode_syscall(int number, struct thread *td) -{ - struct proc *p; - c_db_sym_t sym; - db_expr_t diff; - sy_call_t *f; - const char *symname; - - p = (td != NULL) ? td->td_proc : NULL; - db_printf(" (%d", number); - if (p != NULL && 0 <= number && number < p->p_sysent->sv_size) { - f = p->p_sysent->sv_table[number].sy_call; - sym = db_search_symbol((db_addr_t)f, DB_STGY_ANY, &diff); - if (sym != DB_SYM_NULL && diff == 0) { - db_symbol_values(sym, &symname, NULL); - db_printf(", %s, %s", p->p_sysent->sv_name, symname); - } - } - db_printf(")"); -} - -static int -db_backtrace(struct thread *td, db_addr_t frame, db_addr_t pc, int count) -{ - struct prologue_info pi; - struct trapframe *tf; - const char *symname; - c_db_sym_t sym; - db_expr_t diff; - db_addr_t symval; - u_long last_ipl, tfps; - int i, quit; - - if (count == -1) - count = 1024; - - last_ipl = ~0L; - tf = NULL; - quit = 0; - db_setup_paging(db_simple_pager, &quit, db_lines_per_page); - while (count-- && !quit) { - sym = db_search_symbol(pc, DB_STGY_ANY, &diff); - if (sym == DB_SYM_NULL) - return (ENOENT); - - db_symbol_values(sym, &symname, (db_expr_t *)&symval); - - if (pc < symval) { - db_printf("symbol botch: pc 0x%lx < " - "func 0x%lx (%s)\n", pc, symval, symname); - return (0); - } - - /* - * XXX Printing out arguments is Hard. We'd have to - * keep lots of state as we traverse the frame, figuring - * out where the arguments to the function are stored - * on the stack. - * - * Even worse, they may be stored to the stack _after_ - * being modified in place; arguments are passed in - * registers. - * - * So, in order for this to work reliably, we pretty much - * have to have a kernel built with `cc -g': - * - * - The debugging symbols would tell us where the - * arguments are, how many there are, if there were - * any passed on the stack, etc. - * - * - Presumably, the compiler would be careful to - * store the argument registers on the stack before - * modifying the registers, so that a debugger could - * know what those values were upon procedure entry. - * - * Because of this, we don't bother. We've got most of the - * benefit of back tracking without the arguments, and we - * could get the arguments if we use a remote source-level - * debugger (for serious debugging). - */ - db_printf("%s() at ", symname); - db_printsym(pc, DB_STGY_PROC); - db_printf("\n"); - - /* - * If we are in a trap vector, frame points to a - * trapframe. - */ - if (sym_is_trapsymbol(symval)) { - tf = (struct trapframe *)frame; - for (i = 0; special_symbols[i].ss_val != 0; ++i) - if (symval == special_symbols[i].ss_val) - db_printf("--- %s", - special_symbols[i].ss_note); - - tfps = tf->tf_regs[FRAME_PS]; - if (symval == (uintptr_t)&XentSys) - decode_syscall(tf->tf_regs[FRAME_V0], td); - if ((tfps & ALPHA_PSL_IPL_MASK) != last_ipl) { - last_ipl = tfps & ALPHA_PSL_IPL_MASK; - if (symval != (uintptr_t)&XentSys) - db_printf(" (from ipl %ld)", last_ipl); - } - db_printf(" ---\n"); - if (tfps & ALPHA_PSL_USERMODE) { - db_printf("--- user mode ---\n"); - break; /* Terminate search. */ - } - frame = (db_addr_t)(tf + 1); - pc = tf->tf_regs[FRAME_PC]; - continue; - } - - /* - * This is a bit trickier; we must decode the function - * prologue to find the saved RA. - * - * XXX How does this interact w/ alloca()?! - */ - if (decode_prologue(pc, symval, &pi)) - return (0); - if ((pi.pi_regmask & (1 << 26)) == 0) { - /* - * No saved RA found. We might have RA from - * the trap frame, however (e.g trap occurred - * in a leaf call). If not, we've found the - * root of the call graph. - */ - if (tf) - pc = tf->tf_regs[FRAME_RA]; - else { - db_printf("--- root of call graph ---\n"); - break; - } - } else - pc = *(u_long *)(frame + pi.pi_reg_offset[26]); - frame += pi.pi_frame_size; - tf = NULL; - } - - return (0); -} - -void -db_trace_self(void) -{ - register_t pc, sp; - - __asm __volatile( - " mov $30,%0 \n" - " lda %1,1f \n" - "1:\n" - : "=r" (sp), "=r" (pc)); - db_backtrace(curthread, sp, pc, -1); -} - -int -db_trace_thread(struct thread *thr, int count) -{ - struct pcb *ctx; - - ctx = kdb_thr_ctx(thr); - return (db_backtrace(thr, ctx->pcb_hw.apcb_ksp, ctx->pcb_context[7], - count)); -} - -void -stack_save(struct stack *st) -{ - struct prologue_info pi; - linker_symval_t symval; - c_linker_sym_t sym; - vm_offset_t callpc, frame; - long offset; - register_t pc, sp; - - stack_zero(st); - __asm __volatile( - " mov $30,%0 \n" - " lda %1,1f \n" - "1:\n" - : "=r" (sp), "=r" (pc)); - callpc = (vm_offset_t)pc; - frame = (vm_offset_t)sp; - while (1) { - /* - * search_symbol/symbol_values are slow - */ - if (linker_ddb_search_symbol((caddr_t)callpc, &sym, &offset) != 0) - break; - if (linker_ddb_symbol_values(sym, &symval) != 0) - break; - if (callpc < (vm_offset_t)symval.value) - break; - if (stack_put(st, callpc) == -1) - break; - if (decode_prologue(callpc, (db_addr_t)symval.value, &pi)) - break; - if ((pi.pi_regmask & (1 << 26)) == 0) - break; - callpc = *(vm_offset_t *)(frame + pi.pi_reg_offset[26]); - frame += pi.pi_frame_size; - } -} - -int -db_md_set_watchpoint(addr, size) - db_expr_t addr; - db_expr_t size; -{ - return (-1); -} - - -int -db_md_clr_watchpoint(addr, size) - db_expr_t addr; - db_expr_t size; -{ - return (-1); -} - - -void -db_md_list_watchpoints() -{ - return; -} - diff --git a/sys/alpha/alpha/dec_1000a.c b/sys/alpha/alpha/dec_1000a.c deleted file mode 100644 index 0521af2..0000000 --- a/sys/alpha/alpha/dec_1000a.c +++ /dev/null @@ -1,366 +0,0 @@ -/* $NetBSD: dec_1000a.c,v 1.5 1999/04/15 22:06:47 thorpej Exp $ */ -/*- - * Copyright (c) 1998 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is based on dec_kn20aa.c, written by Chris G. Demetriou at - * Carnegie-Mellon University. Platform support for Noritake, Pintake, and - * Corelle by Ross Harvey with copyright assignment by permission of Avalon - * Computer Systems, Inc. - * - * 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) 1995, 1996, 1997 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. - */ -/*- - * Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center - */ -/*- - * Additional Copyright (c) 1999 by Andrew Gallatin - * - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/systm.h> -#include <sys/termios.h> -#include <sys/bus.h> - -#include <machine/bus.h> -#include <machine/clock.h> -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <alpha/pci/apecsvar.h> -#include <alpha/pci/ciavar.h> - -#include <dev/pci/pcivar.h> - -void dec_1000a_init(int); -static void dec_1000a_cons_init(void); - -static void dec_1000_intr_map(void *); -static void dec_1000_intr_disable(int); -static void dec_1000_intr_enable(int); -static void dec_1000_intr_init(void); - -static void dec_1000a_intr_map(void *); -static void dec_1000a_intr_disable(int); -static void dec_1000a_intr_enable(int); -static void dec_1000a_intr_init(void); - -static const struct alpha_variation_table dec_1000_variations[] = { - { 0, "AlphaServer 1000" }, - { 0, NULL }, -}; - -static const struct alpha_variation_table dec_1000a_variations[] = { - { 0, "AlphaServer 1000A" }, - { 0, NULL }, -}; - -void -dec_1000a_init(int cputype) -{ - u_int64_t variation; - - platform.family = "AlphaServer 1000/1000A"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - variation = hwrpb->rpb_variation & SV_ST_MASK; - if ((platform.model = alpha_variation_name(variation, - cputype == ST_DEC_1000 ? dec_1000_variations - : dec_1000a_variations)) == NULL) - platform.model = alpha_unknown_sysname(); - } - - switch(LOCATE_PCS(hwrpb, 0)->pcs_proc_type & PCS_PROC_MAJOR) { - case PCS_PROC_EV4: - case PCS_PROC_EV45: - platform.iobus = "apecs"; - break; - - default: - platform.iobus = "cia"; - break; - } - platform.cons_init = dec_1000a_cons_init; - switch (cputype) { - case ST_DEC_1000: - platform.pci_intr_map = dec_1000_intr_map; - platform.pci_intr_disable = dec_1000_intr_disable; - platform.pci_intr_enable = dec_1000_intr_enable; - platform.pci_intr_init = dec_1000_intr_init; - break; - - default: - platform.pci_intr_map = dec_1000a_intr_map; - platform.pci_intr_disable = dec_1000a_intr_disable; - platform.pci_intr_enable = dec_1000a_intr_enable; - platform.pci_intr_init = dec_1000a_intr_init; - break; - } - -} - - -static void -dec_1000a_cons_init() -{ - struct ctb *ctb; - - if(strcmp(platform.iobus, "cia") == 0) { - cia_init(); - } else { - apecs_init(); - } - - ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); - - switch (ctb->ctb_term_type) { - case 2: - boothowto |= RB_SERIAL; - break; - - case 3: - boothowto &= ~RB_SERIAL; - break; - - default: - printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); - printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot); - - panic("consinit: unknown console type %d\n", - (int)ctb->ctb_term_type); - } -} - - -static void -dec_1000_intr_map(arg) - void *arg; -{ - pcicfgregs *cfg; - - cfg = (pcicfgregs *)arg; - if (cfg->intpin == 0) /* No IRQ used. */ - return; - if (!(1 <= cfg->intpin && cfg->intpin <= 4)) - goto bad; - - switch(cfg->slot) { - case 6: - if(cfg->intpin != 1) - break; - cfg->intline = 0xc; /* integrated ncr scsi */ - return; - break; - case 11: - case 12: - case 13: - cfg->intline = (cfg->slot - 11) * 4 + cfg->intpin - 1; - return; - break; - } -bad: printf("dec_1000_intr_map: can't map dev %d pin %d\n", - cfg->slot, cfg->intpin); -} - -/* - * Read and write the mystery ICU IMR registers - * on the AlphaServer 1000. - */ - -#define IR() inw(0x536) -#define IW(x) outw(0x536, (x)) - -/* - * Enable and disable interrupts at the ICU level. - */ - -static void -dec_1000_intr_enable(irq) - int irq; -{ - - IW(IR() | 1 << irq); -} - -static void -dec_1000_intr_disable(irq) - int irq; -{ - - IW(IR() & ~(1 << irq)); -} - - -static void -dec_1000_intr_init() -{ - /* - * Initialize mystery ICU. - */ - IW(0); /* XXX ?? */ - - /* - * Enable cascade interrupt. - */ - dec_1000_intr_enable(2); -} - -/* - * Read and write the mystery ICU IMR registers - * on the AlphaServer 1000a. - */ - -#define IRA(o) inw(0x54a + 2*(o)) -#define IWA(o, v) outw(0x54a + 2*(o), (v)) -#define IMR2IRQ(bn) ((bn) - 1) -#define IRQ2IMR(irq) ((irq) + 1) - -static void -dec_1000a_intr_map(arg) - void *arg; -{ - pcicfgregs *cfg; - int device, imrbit; - /* - * Get bit number in mystery ICU imr. - */ - static const signed char imrmap[][4] = { -# define IRQSPLIT(o) { (o), (o)+1, (o)+16, (o)+16+1 } -# define IRQNONE { 0, 0, 0, 0 } - /* 0 */ { 1, 0, 0, 0 }, /* Noritake and Pintake */ - /* 1 */ IRQSPLIT(8), - /* 2 */ IRQSPLIT(10), - /* 3 */ IRQSPLIT(12), - /* 4 */ IRQSPLIT(14), - /* 5 */ { 1, 0, 0, 0 }, /* Corelle */ - /* 6 */ { 10, 0, 0, 0 }, /* Corelle */ - /* 7 */ IRQNONE, - /* 8 */ { 1, 0, 0, 0 }, /* isp behind ppb */ - /* 9 */ IRQNONE, - /* 10 */ IRQNONE, - /* 11 */ IRQSPLIT(2), - /* 12 */ IRQSPLIT(4), - /* 13 */ IRQSPLIT(6), - /* 14 */ IRQSPLIT(8) /* Corelle */ - }; - - cfg = (pcicfgregs *)arg; - device = cfg->slot; - - if (cfg->intpin == 0) /* No IRQ used. */ - return; - if (!(1 <= cfg->intpin && cfg->intpin <= 4)) - goto bad; - - if (0 <= device && device < sizeof imrmap / sizeof imrmap[0]) { - imrbit = imrmap[device][cfg->intpin - 1]; - if (imrbit) { - cfg->intline = IMR2IRQ(imrbit); - return; - } - } -bad: printf("dec_1000a_intr_map: can't map dev %d pin %d\n", - device, cfg->intpin); -} - - -static void -dec_1000a_intr_enable(irq) - int irq; -{ - int imrval, i; - - imrval = IRQ2IMR(irq); - i = imrval >= 16; - - IWA(i, IRA(i) | 1 << (imrval & 0xf)); -} - - - -static void -dec_1000a_intr_disable(irq) - int irq; -{ - int imrval, i; - - imrval = IRQ2IMR(irq); - i = imrval >= 16; - - IWA(i, IRA(i) & ~(1 << (imrval & 0xf))); -} - -static void -dec_1000a_intr_init() -{ - -/* - * Initialize mystery ICU. - */ - IWA(0, IRA(0) & 1); - IWA(1, IRA(0) & 3); - -/* - * Enable cascade interrupt. - */ - dec_1000a_intr_enable(2); -} diff --git a/sys/alpha/alpha/dec_2100_a50.c b/sys/alpha/alpha/dec_2100_a50.c deleted file mode 100644 index 51486d2..0000000 --- a/sys/alpha/alpha/dec_2100_a50.c +++ /dev/null @@ -1,217 +0,0 @@ -/* $NetBSD: dec_2100_a50.c,v 1.39 1998/04/17 02:45:19 mjacob Exp $ */ -/*- - * Copyright (c) 1995, 1996, 1997 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. - */ -/*- - * Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center - */ -/*- - * Additional Copyright (c) 1998 by Andrew Gallatin for Duke University. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/systm.h> -#include <sys/termios.h> -#include <sys/bus.h> - -#include <machine/clock.h> -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <alpha/pci/apecsreg.h> -#include <alpha/pci/apecsvar.h> - -void dec_2100_a50_init(void); -static void dec_2100_a50_cons_init(void); -static void dec_2100_a50_intr_map(void *); - -const struct alpha_variation_table dec_2100_a50_variations[] = { - { SV_ST_AVANTI, "AlphaStation 400 4/233 (\"Avanti\")" }, - { SV_ST_MUSTANG2_4_166, "AlphaStation 200 4/166 (\"Mustang II\")" }, - { SV_ST_MUSTANG2_4_233, "AlphaStation 200 4/233 (\"Mustang II\")" }, - { SV_ST_AVANTI_4_266, "AlphaStation 250 4/266" }, - { SV_ST_MUSTANG2_4_100, "AlphaStation 200 4/100 (\"Mustang II\")" }, - { SV_ST_AVANTI_4_233, "AlphaStation 255/233" }, - { 0, NULL }, -}; - -void -dec_2100_a50_init() -{ - u_int64_t variation; - - platform.family = "AlphaStation 200/400 (\"Avanti\")"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - variation = hwrpb->rpb_variation & SV_ST_MASK; - if (variation == SV_ST_AVANTI_XXX) { - /* XXX apparently the same? */ - variation = SV_ST_AVANTI; - } - if ((platform.model = alpha_variation_name(variation, - dec_2100_a50_variations)) == NULL) - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "apecs"; - platform.cons_init = dec_2100_a50_cons_init; - platform.pci_intr_map = dec_2100_a50_intr_map; -} - -static void -dec_2100_a50_cons_init() -{ - struct ctb *ctb; - - apecs_init(); - - ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); - - switch (ctb->ctb_term_type) { - case 2: - boothowto |= RB_SERIAL; - break; - - case 3: - boothowto &= ~RB_SERIAL; - break; - - default: - printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); - printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot); - - panic("consinit: unknown console type %ld\n", - ctb->ctb_term_type); - } -} - -#define SIO_PCIREG_PIRQ_RTCTRL 0x60 /* PIRQ0 Route Control */ - -void -dec_2100_a50_intr_map(void *arg) -{ - u_int8_t pirqline; - u_int32_t pirqreg; - int pirq; - pcicfgregs *cfg; - - pirq = 0; /* gcc -Wuninitialized XXX */ - cfg = (pcicfgregs *)arg; - - /* - * Slot->interrupt translation. Taken from NetBSD. - */ - - if(cfg->intpin == 0) - return; - - if(cfg->intpin > 4) - panic("dec_2100_a50_intr_map: bad intpin %d",cfg->intpin); - - switch (cfg->slot) { - case 6: /* NCR SCSI */ - pirq = 3; - break; - - case 11: /* slot 1 */ - case 14: /* slot 3 */ - switch(cfg->intpin) { - case 1: - case 4: - pirq = 0; - break; - case 2: - pirq = 2; - break; - case 3: - pirq = 1; - break; - default: - panic("dec_2100_a50_intr_map: bogus PCI pin %d\n", - cfg->intpin); - - } - break; - case 12: /* slot 2 */ - switch (cfg->intpin) { - case 1: - case 4: - pirq = 1; - break; - case 2: - pirq = 0; - break; - case 3: - pirq = 2; - break; - default: - panic("dec_2100_a50_intr_map: bogus PCI pin %d\n", - cfg->intpin); - - }; - break; - - case 13: /* slot 3 */ - switch (cfg->intpin) { - case 1: - case 4: - pirq = 2; - break; - case 2: - pirq = 1; - break; - case 3: - pirq = 0; - break; - }; - break; -default: - printf("dec_2100_a50_intr_map: weird slot %d\n", - cfg->slot); - - /* return; */ - } - - /* - * Read the SIO IRQ routing register to determine where the - * interrupt will actually be routed. Thank you, NetBSD. - */ - - pirqreg = apecs_pcib_read_config(0, 0, 7, 0, - SIO_PCIREG_PIRQ_RTCTRL, 4); - pirqline = (pirqreg >> (pirq * 8)) & 0xff; - if ((pirqline & 0x80) != 0) - panic("bad pirqline %d",pirqline); - pirqline &= 0xf; - cfg->intline = pirqline; -} diff --git a/sys/alpha/alpha/dec_2100_a500.c b/sys/alpha/alpha/dec_2100_a500.c deleted file mode 100644 index 10d5df7..0000000 --- a/sys/alpha/alpha/dec_2100_a500.c +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * Copyright (c) 2000 Andrew Gallatin - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/systm.h> -#include <sys/termios.h> -#include <sys/bus.h> - -#include <machine/bus.h> -#include <machine/clock.h> -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <alpha/pci/t2var.h> -#include <alpha/pci/t2reg.h> - -void dec_2100_a500_init(int); -static void dec_2100_a500_cons_init(void); -static void dec_2100_a500_intr_init(void); - -void -dec_2100_a500_init(int cputype) -{ - /* - * See if we're a `Sable' or a `Lynx'. - */ - if (cputype == ST_DEC_2100_A500) { - if (alpha_implver() == ALPHA_IMPLVER_EV5) - sable_lynx_base = LYNX_BASE; - else - sable_lynx_base = SABLE_BASE; - platform.family = "DEC AlphaServer 2100"; - } else if (cputype == ST_DEC_2100A_A500) { - sable_lynx_base = LYNX_BASE; - platform.family = "DEC AlphaServer 2100A"; - } else { - sable_lynx_base = SABLE_BASE; - platform.family = "DEC AlphaServer 2100?????"; - } - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "t2"; - platform.cons_init = dec_2100_a500_cons_init; - platform.pci_intr_init = dec_2100_a500_intr_init; - - t2_init(); -} - - -static void -dec_2100_a500_cons_init() -{ - struct ctb *ctb; - t2_init(); - - ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); - - switch (ctb->ctb_term_type) { - case 2: - boothowto |= RB_SERIAL; - break; - - case 3: - boothowto &= ~RB_SERIAL; - break; - - default: - printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); - panic("consinit: unknown console type"); - } -} - - -void -dec_2100_a500_intr_init(void) -{ - - outb(SLAVE0_ICU, 0); - outb(SLAVE1_ICU, 0); - outb(SLAVE2_ICU, 0); - outb(MASTER_ICU, 0x44); -} diff --git a/sys/alpha/alpha/dec_3000_300.c b/sys/alpha/alpha/dec_3000_300.c deleted file mode 100644 index d367111..0000000 --- a/sys/alpha/alpha/dec_3000_300.c +++ /dev/null @@ -1,87 +0,0 @@ -/*- - * Copyright (c) 1997 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. 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 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_cpu.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/termios.h> -#include <sys/bus.h> - -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <alpha/tlsb/tlsbreg.h> -#include <alpha/tlsb/gbusreg.h> -#include <alpha/tlsb/zsvar.h> - -void dec_3000_300_init(int); -static void dec_3000_300_cons_init(void); - -static const struct alpha_variation_table dec_3000_300_variations[] = { - { SV_ST_PELICAN, "DEC 3000/300 (\"Pelican\")" }, - { SV_ST_PELICA, "DEC 3000/300L (\"Pelica\")" }, - { SV_ST_PELICANPLUS, "DEC 3000/300X (\"Pelican+\")" }, - { SV_ST_PELICAPLUS, "DEC 3000/300LX (\"Pelica+\")" }, - { 0, NULL }, -}; - -void -dec_3000_300_init(int cputype) -{ - u_int64_t variation; - - platform.family = "DEC 3000/300 (\"Pelican\")"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - variation = hwrpb->rpb_variation & SV_ST_MASK; - if ((platform.model = alpha_variation_name(variation, - dec_3000_300_variations)) == NULL) - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "tcasic"; - platform.cons_init = dec_3000_300_cons_init; -} - -/* - * dec_3000_300_cons_init- not needed right now. - * - */ -static void -dec_3000_300_cons_init(void) -{ - - return; -} diff --git a/sys/alpha/alpha/dec_3000_500.c b/sys/alpha/alpha/dec_3000_500.c deleted file mode 100644 index eb144a7..0000000 --- a/sys/alpha/alpha/dec_3000_500.c +++ /dev/null @@ -1,107 +0,0 @@ -/*- - * Copyright (c) 1997 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. 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 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_cpu.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/termios.h> -#include <sys/bus.h> - -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <alpha/tlsb/tlsbreg.h> -#include <alpha/tlsb/gbusreg.h> -#include <alpha/tlsb/zsvar.h> - -void dec_3000_500_init(int); -static void dec_3000_500_cons_init(void); - -static const char dec_3000_500_sp[] = "DEC 3000/400 (\"Sandpiper\")"; -static const char dec_3000_500_sf[] = "DEC 3000/500 (\"Flamingo\")"; - -const struct alpha_variation_table dec_3000_500_variations[] = { - { SV_ST_SANDPIPER, dec_3000_500_sp }, - { SV_ST_FLAMINGO, dec_3000_500_sf }, - { SV_ST_HOTPINK, "DEC 3000/500X (\"Hot Pink\")" }, - { SV_ST_FLAMINGOPLUS, "DEC 3000/800 (\"Flamingo+\")" }, - { SV_ST_SANDPLUS, "DEC 3000/600 (\"Sandpiper+\")" }, - { SV_ST_SANDPIPER45, "DEC 3000/700 (\"Sandpiper45\")" }, - { SV_ST_FLAMINGO45, "DEC 3000/900 (\"Flamingo45\")" }, - { 0, NULL }, -}; - -void -dec_3000_500_init(int cputype) -{ - u_int64_t variation; - - platform.family = "DEC 3000/500 (\"Flamingo\")"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - variation = hwrpb->rpb_variation & SV_ST_MASK; - if (variation == SV_ST_ULTRA) { - /* These are really the same. */ - variation = SV_ST_FLAMINGOPLUS; - } - if ((platform.model = alpha_variation_name(variation, - dec_3000_500_variations)) == NULL) { - /* - * This is how things used to be done. - */ - if (variation == SV_ST_RESERVED) { - if (hwrpb->rpb_variation & SV_GRAPHICS) - platform.model = dec_3000_500_sf; - else - platform.model = dec_3000_500_sp; - } else - platform.model = alpha_unknown_sysname(); - } - } - - platform.iobus = "tcasic"; - platform.cons_init = dec_3000_500_cons_init; -} - -/* - * dec_3000_500_cons_init- not needed right now. - * - */ -static void -dec_3000_500_cons_init(void) -{ - - return; -} diff --git a/sys/alpha/alpha/dec_axppci_33.c b/sys/alpha/alpha/dec_axppci_33.c deleted file mode 100644 index b19226d..0000000 --- a/sys/alpha/alpha/dec_axppci_33.c +++ /dev/null @@ -1,237 +0,0 @@ -/* $NetBSD: dec_axppci_33.c,v 1.38 1998/07/07 08:49:12 ross Exp $ */ -/*- - * Copyright (c) 1995, 1996, 1997 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. - */ -/*- - * Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/systm.h> -#include <sys/termios.h> -#include <sys/bus.h> - -#include <machine/bus.h> -#include <machine/clock.h> -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <alpha/pci/lcavar.h> - -void dec_axppci_33_init(void); -static void dec_axppci_33_cons_init(void); -static int dec_axppci_33_intr_route (device_t, device_t, int); - -const struct alpha_variation_table dec_axppci_33_variations[] = { - { 0, "Alpha PC AXPpci33 (\"NoName\")" }, - { 0, NULL }, -}; - -#define NSIO_PORT 0x26e /* Hardware enabled option: 0x398 */ -#define NSIO_BASE 0 -#define NSIO_INDEX NSIO_BASE -#define NSIO_DATA 1 -#define NSIO_SIZE 2 -#define NSIO_CFG0 0 -#define NSIO_CFG1 1 -#define NSIO_CFG2 2 -#define NSIO_IDE_ENABLE 0x40 - -void -dec_axppci_33_init() -{ - int cfg0val; - u_int64_t variation; - - platform.family = "DEC AXPpci"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - variation = hwrpb->rpb_variation & SV_ST_MASK; - if ((platform.model = alpha_variation_name(variation, - dec_axppci_33_variations)) == NULL) - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "lca"; - platform.cons_init = dec_axppci_33_cons_init; - platform.pci_intr_route = dec_axppci_33_intr_route; - platform.pci_intr_map = NULL; - - lca_init(); - - outb(NSIO_PORT + NSIO_INDEX, NSIO_CFG0); - alpha_mb(); - cfg0val = inb(NSIO_PORT + NSIO_DATA); - - cfg0val |= NSIO_IDE_ENABLE; - - outb(NSIO_PORT + NSIO_INDEX, NSIO_CFG0); - alpha_mb(); - outb(NSIO_PORT + NSIO_DATA, cfg0val); - alpha_mb(); - outb(NSIO_PORT + NSIO_DATA, cfg0val); -} - - -static void -dec_axppci_33_cons_init() -{ - struct ctb *ctb; - - lca_init(); - - ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); - - switch (ctb->ctb_term_type) { - case 2: - boothowto |= RB_SERIAL; - break; - - case 3: - boothowto &= ~RB_SERIAL; - break; - - default: - printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); - printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot); - - panic("consinit: unknown console type"); - } -} - -#define SIO_PCIREG_PIRQ_RTCTRL 0x60 /* PIRQ0 Route Control */ - -static int -dec_axppci_33_intr_route(device_t pcib, device_t dev, int pin) -{ - int pirq; - u_int32_t pirqreg; - u_int8_t pirqline; - -#ifndef DIAGNOSTIC - pirq = 0; /* XXX gcc -Wuninitialized */ -#endif - - /* - * Slot->interrupt translation. Taken from NetBSD. - */ - - if (pin == 0) { - /* No IRQ used. */ - return -1; - } - if (pin > 4) { - printf("dec_axppci_33_intr_route: bad interrupt pin %d\n", pin); - return -1; - } - - switch (pci_get_slot(dev)) { - case 6: /* NCR SCSI */ - pirq = 3; - break; - - case 11: /* slot 1 */ - switch (pin) { - case 1: - case 4: - pirq = 0; - break; - case 2: - pirq = 2; - break; - case 3: - pirq = 1; - break; -#ifdef DIAGNOSTIC - default: /* XXX gcc -Wuninitialized */ - panic("dec_axppci_33_intr_route: bogus PCI pin %d\n", - pin); -#endif - }; - break; - - case 12: /* slot 2 */ - switch (pin) { - case 1: - case 4: - pirq = 1; - break; - case 2: - pirq = 0; - break; - case 3: - pirq = 2; - break; -#ifdef DIAGNOSTIC - default: /* XXX gcc -Wuninitialized */ - panic("dec_axppci_33_intr_route: bogus PCI pin %d\n", - pin); -#endif - }; - break; - - case 8: /* slot 3 */ - switch (pin) { - case 1: - case 4: - pirq = 2; - break; - case 2: - pirq = 1; - break; - case 3: - pirq = 0; - break; -#ifdef DIAGNOSTIC - default: /* XXX gcc -Wuninitialized */ - panic("dec_axppci_33_intr_route: bogus PCI pin %d\n", - pin); -#endif - }; - break; - - default: - printf("dec_axppci_33_intr_route: weird device number %d\n", - pci_get_slot(dev)); - return -1; - } - - pirqreg = lca_pcib_read_config(0, 0, 7, 0, - SIO_PCIREG_PIRQ_RTCTRL, 4); - pirqline = (pirqreg >> (pirq * 8)) & 0xff; - if ((pirqline & 0x80) != 0) - panic("bad pirqline %d",pirqline); - pirqline &= 0xf; - - return(pirqline); -} diff --git a/sys/alpha/alpha/dec_eb164.c b/sys/alpha/alpha/dec_eb164.c deleted file mode 100644 index e174001..0000000 --- a/sys/alpha/alpha/dec_eb164.c +++ /dev/null @@ -1,113 +0,0 @@ -/* $NetBSD: dec_eb164.c,v 1.26 1998/04/17 02:45:19 mjacob Exp $ */ -/*- - * Copyright (c) 1995, 1996, 1997 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. - */ -/*- - * Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/systm.h> -#include <sys/termios.h> -#include <sys/bus.h> - -#include <machine/clock.h> -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <alpha/pci/ciavar.h> - -void dec_eb164_init(void); -static void dec_eb164_cons_init(void); -static void eb164_intr_init(void); -extern void eb164_intr_enable(int irq); -extern void eb164_intr_disable(int irq); -extern void eb164_intr_enable_icsr(int irq); -extern void eb164_intr_disable_icsr(int irq); - -void -dec_eb164_init() -{ - platform.family = "EB164"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - /* XXX Don't know the system variations, yet. */ - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "cia"; - platform.cons_init = dec_eb164_cons_init; - platform.pci_intr_init = eb164_intr_init; - platform.pci_intr_map = NULL; - if (strncmp(platform.model, "Digital AlphaPC 164 ", 20) == 0) { - platform.pci_intr_disable = eb164_intr_disable_icsr; - platform.pci_intr_enable = eb164_intr_enable_icsr; - } else { - platform.pci_intr_disable = eb164_intr_disable; - platform.pci_intr_enable = eb164_intr_enable; - } -} - -static void -dec_eb164_cons_init() -{ - struct ctb *ctb; - - cia_init(); - - ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); - - switch (ctb->ctb_term_type) { - case 2: - boothowto |= RB_SERIAL; - break; - - case 3: - boothowto &= ~RB_SERIAL; - break; - - default: - printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); - printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot); - - panic("consinit: unknown console type %d\n", - (int)ctb->ctb_term_type); - } -} - -static void -eb164_intr_init() -{ - /* - * Enable ISA-PCI cascade interrupt. - */ - eb164_intr_enable(4); -} diff --git a/sys/alpha/alpha/dec_eb64plus.c b/sys/alpha/alpha/dec_eb64plus.c deleted file mode 100644 index f16a395..0000000 --- a/sys/alpha/alpha/dec_eb64plus.c +++ /dev/null @@ -1,152 +0,0 @@ -/*- - * Copyright (c) 1995, 1996, 1997 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. - */ -/*- - * Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center - */ - -/* - * FreeBSD version based on: - * NetBSD: dec_eb64plus.c,v 1.15 1998/11/19 02:20:07 ross Exp - * - * Some info on the Aspen Alpine which might be hard to come by: - * - Hardware is close enough to the DEC EB64+ design to allow it to run - * the EB64+ SRM console firmware - * - 3 PCI slots, closest to the SIMMs: Alpine calls this one slot C - * the middle one Alpine calls slot B - * the 3rd one Alpine calls slot A - * (A, B, C are silkscreened on the PCB) - * - embedded NCR810, located at PCI slot 5 - * - 3 ISA slots, hanging off an Intel 82378IB PCI-ISA bridge at PCI slot 8 - * - embedded floppy, PC keyboard interface, PS/2 mouse interface, 2 serial - * ports and a parallel port. All of this hanging off the ISA bridge - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/systm.h> -#include <sys/termios.h> -#include <sys/bus.h> - -#include <machine/clock.h> -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> - -#include <alpha/pci/apecsreg.h> -#include <alpha/pci/apecsvar.h> - -void dec_eb64plus_init(void); -static void dec_eb64plus_cons_init(void); -static void dec_eb64plus_intr_init(void); - -extern void eb64plus_intr_enable(int irq); /* ../pci/pci_eb64plus_intr.s */ -extern void eb64plus_intr_disable(int irq); /* ../pci/pci_eb64plus_intr.s */ - -extern const char * bootdev_protocol(void); -extern int bootdev_boot_dev_type(void); - -const struct alpha_variation_table dec_eb64plus_variations[] = { - { 0, "DEC EB64-plus" }, - { 0, NULL }, -}; - -void -dec_eb64plus_init() -{ - u_int64_t variation; - - platform.family = "EB64+"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - variation = hwrpb->rpb_variation & SV_ST_MASK; - if ((platform.model = alpha_variation_name(variation, - dec_eb64plus_variations)) == NULL) - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "apecs"; - platform.cons_init = dec_eb64plus_cons_init; - platform.pci_intr_init = dec_eb64plus_intr_init; - /* SRM handles PCI interrupt mapping */ - platform.pci_intr_map = NULL; - /* see ../pci/pci_eb64plus_intr.s for intr. dis/enable */ - platform.pci_intr_disable = eb64plus_intr_disable; - platform.pci_intr_enable = eb64plus_intr_enable; - -} - - -/* init the console, serial or graphics */ -static void -dec_eb64plus_cons_init() -{ - struct ctb *ctb; - - apecs_init(); - - ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); - - switch (ctb->ctb_term_type) { - case 2: - boothowto |= RB_SERIAL; - break; - - case 3: - boothowto &= ~RB_SERIAL; - break; - - default: - printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); - printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot); - - panic("consinit: unknown console type %d\n", - (int)ctb->ctb_term_type); - } -} - -/* - * The SRM console may have left some some interrupts enabled. - */ -static void -dec_eb64plus_intr_init() -{ - int i; - - /* disable all PCI interrupts */ - for(i = 0; i <= 32; i++) /* 32 ?? NetBSD sez so */ - eb64plus_intr_disable(i); - - /* Enable ISA-PCI cascade interrupt */ - eb64plus_intr_enable(4); - -} diff --git a/sys/alpha/alpha/dec_kn20aa.c b/sys/alpha/alpha/dec_kn20aa.c deleted file mode 100644 index d4d01d0..0000000 --- a/sys/alpha/alpha/dec_kn20aa.c +++ /dev/null @@ -1,310 +0,0 @@ -/* $NetBSD: dec_kn20aa.c,v 1.38 1998/04/17 02:45:19 mjacob Exp $ */ -/*- - * Copyright (c) 1995, 1996, 1997 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. - */ -/*- - * Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/systm.h> -#include <sys/termios.h> -#include <sys/bus.h> - -#include <machine/clock.h> -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <alpha/pci/ciareg.h> -#include <alpha/pci/ciavar.h> - -void dec_kn20aa_init(void); -static void dec_kn20aa_cons_init(void); -static void dec_kn20aa_intr_init(void); -static int dec_kn20aa_intr_route(device_t pcib, device_t dev, int pin); -static void dec_kn20aa_intr_disable(int); -static void dec_kn20aa_intr_enable(int); - -#if 0 -static void dec_kn20aa_device_register(struct device *, void *); -#endif - -const struct alpha_variation_table dec_kn20aa_variations[] = { - { 0, "AlphaStation 500 or 600 (KN20AA)" }, - { 0, NULL }, -}; - -void -dec_kn20aa_init() -{ - u_int64_t variation; - - platform.family = "AlphaStation 500 or 600 (KN20AA)"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - variation = hwrpb->rpb_variation & SV_ST_MASK; - if ((platform.model = alpha_variation_name(variation, - dec_kn20aa_variations)) == NULL) - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "cia"; - platform.cons_init = dec_kn20aa_cons_init; - platform.pci_intr_init = dec_kn20aa_intr_init; - platform.pci_intr_route = dec_kn20aa_intr_route; - platform.pci_intr_disable = dec_kn20aa_intr_disable; - platform.pci_intr_enable = dec_kn20aa_intr_enable; -} - -static void -dec_kn20aa_cons_init() -{ - struct ctb *ctb; - - cia_init(); - - ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); - - switch (ctb->ctb_term_type) { - case 2: - boothowto |= RB_SERIAL; - break; - - case 3: - boothowto &= ~RB_SERIAL; - break; - - default: - printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); - printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot); - - panic("consinit: unknown console type %d\n", - (int)ctb->ctb_term_type); - } -} -#if 0 -static void -dec_kn20aa_device_register(dev, aux) - struct device *dev; - void *aux; -{ - static int found, initted, scsiboot, netboot; - static struct device *pcidev, *scsidev; - struct bootdev_data *b = bootdev_data; - struct device *parent = dev->dv_parent; - struct cfdata *cf = dev->dv_cfdata; - struct cfdriver *cd = cf->cf_driver; - - if (found) - return; - - if (!initted) { - scsiboot = (strcmp(b->protocol, "SCSI") == 0); - netboot = (strcmp(b->protocol, "BOOTP") == 0); -#if 0 - printf("scsiboot = %d, netboot = %d\n", scsiboot, netboot); -#endif - initted =1; - } - - if (pcidev == NULL) { - if (strcmp(cd->cd_name, "pci")) - return; - else { - struct pcibus_attach_args *pba = aux; - - if ((b->slot / 1000) != pba->pba_bus) - return; - - pcidev = dev; -#if 0 - printf("\npcidev = %s\n", pcidev->dv_xname); -#endif - return; - } - } - - if (scsiboot && (scsidev == NULL)) { - if (parent != pcidev) - return; - else { - struct pci_attach_args *pa = aux; - - if ((b->slot % 1000) != pa->pa_device) - return; - - /* XXX function? */ - - scsidev = dev; -#if 0 - printf("\nscsidev = %s\n", scsidev->dv_xname); -#endif - return; - } - } - - if (scsiboot && - (!strcmp(cd->cd_name, "sd") || - !strcmp(cd->cd_name, "st") || - !strcmp(cd->cd_name, "cd"))) { - struct scsipibus_attach_args *sa = aux; - - if (parent->dv_parent != scsidev) - return; - - if (b->unit / 100 != sa->sa_sc_link->scsipi_scsi.target) - return; - - /* XXX LUN! */ - - switch (b->boot_dev_type) { - case 0: - if (strcmp(cd->cd_name, "sd") && - strcmp(cd->cd_name, "cd")) - return; - break; - case 1: - if (strcmp(cd->cd_name, "st")) - return; - break; - default: - return; - } - - /* we've found it! */ - booted_device = dev; -#if 0 - printf("\nbooted_device = %s\n", booted_device->dv_xname); -#endif - found = 1; - } - - if (netboot) { - if (parent != pcidev) - return; - else { - struct pci_attach_args *pa = aux; - - if ((b->slot % 1000) != pa->pa_device) - return; - - /* XXX function? */ - - booted_device = dev; -#if 0 - printf("\nbooted_device = %s\n", booted_device->dv_xname); -#endif - found = 1; - return; - } - } -} -#endif - -#define KN20AA_MAX_IRQ 32 -void -dec_kn20aa_intr_init() -{ - - /* - * Enable ISA-PCI cascade interrupt. - */ - dec_kn20aa_intr_enable(31); -} - -static int -dec_kn20aa_intr_route(device_t pcib, device_t dev, int pin) -{ - int irq = 255; - int slot = pci_get_slot(dev); - - switch (slot) { - case 11: - irq = pin - 1; - break; - - case 12: - irq = 4 + pin - 1; - break; - - case 7: - irq = 8 + pin - 1; - break; - - case 9: /* slot on AlphaStation 600 only */ - irq = 12 + pin - 1; - break; - - case 8: - irq = 16 + pin - 1; - break; - - case 6: /* 21040 on AlphaStation 500 */ - if (pin == 1) - irq = 13; - break; - - case 10: /* 8275EB on AlphaStation 500 */ - break; - - default: - printf("dec_kn20aa_intr_route: weird slot %d\n", slot); - } - return (irq); -} - -void -dec_kn20aa_intr_enable(irq) - int irq; -{ - - /* - * From disassembling small bits of the OSF/1 kernel: - * the following appears to enable a given interrupt request. - * "blech." I'd give valuable body parts for better docs or - * for a good decompiler. - */ - alpha_mb(); - REGVAL(0x8780000000L + 0x40L) |= (1 << irq); /* XXX */ - alpha_mb(); -} - -void -dec_kn20aa_intr_disable(irq) - int irq; -{ - - alpha_mb(); - REGVAL(0x8780000000L + 0x40L) &= ~(1 << irq); /* XXX */ - alpha_mb(); -} diff --git a/sys/alpha/alpha/dec_kn300.c b/sys/alpha/alpha/dec_kn300.c deleted file mode 100644 index 70b1133..0000000 --- a/sys/alpha/alpha/dec_kn300.c +++ /dev/null @@ -1,106 +0,0 @@ -/*- - * Copyright (c) 2000 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. 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 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/termios.h> - -#include <machine/clock.h> -#include <machine/cpuconf.h> -#include <machine/intr.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> - -#include <alpha/mcbus/mcbusreg.h> -#include <alpha/mcbus/mcbusvar.h> - -void dec_kn300_init(void); -void dec_kn300_cons_init(void); - -#define ALPHASERVER_4100 "AlphaServer 4100" - -const struct alpha_variation_table dec_kn300_variations[] = { - { 0, ALPHASERVER_4100 }, - { 0, NULL }, -}; - - -void -dec_kn300_init() -{ - u_int64_t variation; - - platform.family = ALPHASERVER_4100; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - variation = hwrpb->rpb_variation & SV_ST_MASK; - if ((platform.model = alpha_variation_name(variation, - dec_kn300_variations)) == NULL) - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "mcbus"; - platform.cons_init = dec_kn300_cons_init; -} - -void -dec_kn300_cons_init() -{ - struct ctb *ctb; - - mcbus_init(); - - ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); - - switch (ctb->ctb_term_type) { - case 2: - boothowto |= RB_SERIAL; - break; - - case 3: - boothowto &= ~RB_SERIAL; - break; - - default: - printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); - printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot); - panic("consinit: unknown cons type %ld\n", ctb->ctb_term_type); - } -} diff --git a/sys/alpha/alpha/dec_kn8ae.c b/sys/alpha/alpha/dec_kn8ae.c deleted file mode 100644 index fbc9840..0000000 --- a/sys/alpha/alpha/dec_kn8ae.c +++ /dev/null @@ -1,89 +0,0 @@ -/* $NetBSD: dec_kn8ae.c,v 1.15 1998/02/13 00:12:50 thorpej Exp $ */ -/*- - * Copyright (c) 1997 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. 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 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/termios.h> -#include <sys/cons.h> -#include <sys/reboot.h> -#include <sys/bus.h> - -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <alpha/tlsb/tlsbreg.h> -#include <alpha/tlsb/gbusreg.h> -#include <alpha/tlsb/zsvar.h> - -void dec_kn8ae_init(int); -static void dec_kn8ae_cons_init(void); - -static const struct alpha_variation_table dec_kn8ae_variations[] = { - { 0, "AlphaServer 8400" }, - { 0, NULL }, -}; - -void -dec_kn8ae_init(int cputype) -{ - u_int64_t variation; - - platform.family = "AlphaServer 8400"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - variation = hwrpb->rpb_variation & SV_ST_MASK; - if ((platform.model = alpha_variation_name(variation, - dec_kn8ae_variations)) == NULL) - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "tlsb"; - platform.cons_init = dec_kn8ae_cons_init; -} - -/* - * Info to retain: - * - * The AXP 8X00 seems to encode the - * type of console in the ctb_type field, - * not the ctb_term_type field. - */ -static void -dec_kn8ae_cons_init(void) -{ - - boothowto |= RB_SERIAL; - zs_cnattach(TLSB_GBUS_BASE, GBUS_DUART0_OFFSET); -} diff --git a/sys/alpha/alpha/dec_st550.c b/sys/alpha/alpha/dec_st550.c deleted file mode 100644 index f664b29..0000000 --- a/sys/alpha/alpha/dec_st550.c +++ /dev/null @@ -1,240 +0,0 @@ -/*- - * Copyright (c) 1995, 1996, 1997 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. - */ -/*- - * Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center - */ -/*- - * Additional Copyright (c) 1998 by Andrew Gallatin for Duke University - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/termios.h> - -#include <machine/clock.h> -#include <machine/cpuconf.h> -#include <machine/intr.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <alpha/pci/ciareg.h> -#include <alpha/pci/ciavar.h> - -void st550_init(void); -static void st550_cons_init(void); -static void st550_intr_init(void); -static void pyxis_intr_enable(int); -static void pyxis_intr_disable(int); -static void st550_intr_enable(int); -static void st550_intr_disable(int); -static void st550_intr_map(void *); -#define ST550_PCI_IRQ_BEGIN 8 -#define ST550_PCI_MAX_IRQ 47 - -void -st550_init() -{ - - platform.family = "Digital Personal Workstation (Miata)"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - /* XXX Don't know the system variations, yet. */ - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "cia"; - platform.cons_init = st550_cons_init; - platform.pci_intr_init = st550_intr_init; - platform.pci_intr_map = st550_intr_map; - platform.pci_intr_disable = st550_intr_disable; - platform.pci_intr_enable = st550_intr_enable; -} - -static void -st550_cons_init() -{ - struct ctb *ctb; - - cia_init(); - - ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); - - switch (ctb->ctb_term_type) { - case 2: - boothowto |= RB_SERIAL; - break; - - case 3: - boothowto &= ~RB_SERIAL; - break; - - default: - printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); - printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot); - - panic("consinit: unknown console type %ld\n", - ctb->ctb_term_type); - } -} - -static void -st550_intr_init() -{ - - /* This is here because we need to disable extraneous pci interrupts. */ - int i; - for(i = ST550_PCI_IRQ_BEGIN; i <= ST550_PCI_MAX_IRQ; i++) - pyxis_intr_disable(i); - /* From Linux... */ - pyxis_intr_enable(2); /* enable HALT switch */ - pyxis_intr_enable(6); /* enable timer */ - pyxis_intr_enable(7); /* enable ISA PIC cascade */ -} - -static void -st550_intr_map(void *arg) -{ - pcicfgregs *cfg; - - cfg = (pcicfgregs *)arg; - - /* There are two main variants of Miata: Miata 1 (Intel SIO) - * and Miata {1.5,2} (Cypress). - * - * The Miata 1 has a CMD PCI IDE wired to compatibility mode at - * slot 4 of bus 0. This variant has the Pyxis DMA bug. - * - * On the Miata 1.5 and Miata 2, the Cypress PCI-ISA bridge lives - * on device 7 of bus 0. This device has PCI IDE wired to - * compatibility mode on functions 1 and 2. - * - * There will be no interrupt mapping for these devices, so just - * bail out now. - */ - if(cfg->bus == 0) { - if ((hwrpb->rpb_variation & SV_ST_MASK) < SV_ST_MIATA_1_5) { - /* Miata 1 */ - if (cfg->slot == 7) - return; - else if (cfg->func == 4) - return; - } else { - /* Miata 1.5 or Miata 2 */ - if (cfg->slot == 7) { - if (cfg->func == 0) - return; - return; - } - } - } - /* Account for the PCI interrupt offset. */ - /* cfg->intline += ST550_PCI_IRQ_BEGIN; */ - return; -} - -/* - * The functions below were written based on a draft copy of the - * 21174 TRM. - */ -static void -pyxis_intr_enable(irq) - int irq; -{ - volatile u_int64_t temp; - - alpha_mb(); - temp = REGVAL64(PYXIS_INT_MASK); - alpha_mb(); - - temp |= ( 1L << irq ); - REGVAL64(PYXIS_INT_MASK) = temp; - alpha_mb(); - temp = REGVAL64(PYXIS_INT_MASK); -#if 0 - printf("pyxis_intr_enable: enabling %d, current mask= ", irq); - { - int i; - for ( i = 0; i < 61; i++) - if (temp & (1 << i)) { - printf("%d " , i); - } - printf("\n"); - } -#endif - -} - -static void -pyxis_intr_disable(irq) - int irq; -{ - volatile u_int64_t temp; - - alpha_mb(); - temp = REGVAL64(PYXIS_INT_MASK); - temp &= ~(1L << irq ); - REGVAL64(PYXIS_INT_MASK) = temp; - alpha_mb(); - temp = REGVAL64(PYXIS_INT_MASK); -#if 0 - printf("pyxis_intr_disable: disabled %d, current mask ", irq); - { - int i; - for ( i = 0; i < 61; i++) - if (temp & (1 << i)) { - printf("%d ", i); - } - printf("\n"); - } -#endif - -} - -static void -st550_intr_enable(irq) - int irq; -{ - - pyxis_intr_enable(irq + ST550_PCI_IRQ_BEGIN); -} - -static void -st550_intr_disable(irq) - int irq; -{ - - pyxis_intr_disable(irq + ST550_PCI_IRQ_BEGIN); -} diff --git a/sys/alpha/alpha/dec_st6600.c b/sys/alpha/alpha/dec_st6600.c deleted file mode 100644 index 2750946..0000000 --- a/sys/alpha/alpha/dec_st6600.c +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * Copyright (c) 1999 Andrew Gallatin - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/reboot.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/termios.h> - -#include <machine/clock.h> -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/intr.h> -#include <machine/rpb.h> - -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <alpha/pci/tsunamivar.h> - -void st6600_init(void); -static void st6600_cons_init(void); -static void st6600_intr_init(void); - -#define ST6600_PCI_IRQ_BEGIN 8 -#define ST6600_PCI_MAX_IRQ 63 - -void -st6600_init() -{ - platform.family = "ST6600"; - - if ((platform.model = alpha_dsr_sysname()) == NULL) { - /* XXX Don't know the system variations, yet. */ - platform.model = alpha_unknown_sysname(); - } - - platform.iobus = "tsunami"; - platform.cons_init = st6600_cons_init; - platform.pci_intr_init = st6600_intr_init; -} - -static void -st6600_cons_init() -{ - struct ctb *ctb; - - tsunami_init(); - - ctb = (struct ctb *)(((caddr_t)hwrpb) + hwrpb->rpb_ctb_off); - - switch (ctb->ctb_term_type) { - case 2: - boothowto |= RB_SERIAL; - break; - - case 3: - boothowto &= ~RB_SERIAL; - break; - - default: - printf("ctb->ctb_term_type = 0x%lx\n", ctb->ctb_term_type); - printf("ctb->ctb_turboslot = 0x%lx\n", ctb->ctb_turboslot); - - panic("consinit: unknown console type %ld\n", - ctb->ctb_term_type); - } -} - -static void -st6600_intr_init() -{ - int i; - - for(i = ST6600_PCI_IRQ_BEGIN; i <= ST6600_PCI_MAX_IRQ; i++) - platform.pci_intr_disable(i); - /* From Linux... */ - - platform.pci_intr_enable(55); - platform.pci_intr_enable(2); -} - - diff --git a/sys/alpha/alpha/divrem.m4 b/sys/alpha/alpha/divrem.m4 deleted file mode 100644 index c8a5d54..0000000 --- a/sys/alpha/alpha/divrem.m4 +++ /dev/null @@ -1,198 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: divrem.m4,v 1.5 1996/10/17 04:26:25 cgd Exp $ */ - -/*- - * Copyright (c) 1994, 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. - */ - -/* - * Division and remainder. - * - * The use of m4 is modeled after the sparc code, but the algorithm is - * simple binary long division. - * - * Note that the loops could probably benefit from unrolling. - */ - -/* - * M4 Parameters - * NAME name of function to generate - * OP OP=div: t10 / t11 -> t12; OP=rem: t10 % t11 -> t12 - * S S=true: signed; S=false: unsigned - * WORDSIZE total number of bits - */ - -define(A, `t10') -define(B, `t11') -define(RESULT, `t12') - -define(BIT, `t0') -define(I, `t1') -define(CC, `t2') -define(T_0, `t3') -ifelse(S, `true', `define(NEG, `t4')') - -#include <machine/asm.h> - -NESTED(NAME, 0, 0, t9, 0, 0) /* Get the right ra */ - lda sp, -64(sp) - stq BIT, 0(sp) - stq I, 8(sp) - stq CC, 16(sp) - stq T_0, 24(sp) -ifelse(S, `true', -` stq NEG, 32(sp)') - stq A, 40(sp) - stq B, 48(sp) - mov zero, RESULT /* Initialize result to zero */ - -ifelse(S, `true', -` - /* Compute sign of result. If either is negative, this is easy. */ - or A, B, NEG /* not the sign, but... */ - srl NEG, WORDSIZE - 1, NEG /* rather, or of high bits */ - blbc NEG, Ldoit /* neither negative? do it! */ - -ifelse(OP, `div', -` xor A, B, NEG /* THIS is the sign! */ -', ` mov A, NEG /* sign follows A. */ -') - srl NEG, WORDSIZE - 1, NEG /* make negation the low bit. */ - - srl A, WORDSIZE - 1, I /* is A negative? */ - blbc I, LnegB /* no. */ - /* A is negative; flip it. */ -ifelse(WORDSIZE, `32', ` - /* top 32 bits may be random junk */ - zap A, 0xf0, A -') - subq zero, A, A - srl B, WORDSIZE - 1, I /* is B negative? */ - blbc I, Ldoit /* no. */ -LnegB: - /* B is definitely negative, no matter how we got here. */ -ifelse(WORDSIZE, `32', ` - /* top 32 bits may be random junk */ - zap B, 0xf0, B -') - subq zero, B, B -Ldoit: -') -ifelse(WORDSIZE, `32', ` - /* - * Clear the top 32 bits of each operand, as they may - * sign extension (if negated above), or random junk. - */ - zap A, 0xf0, A - zap B, 0xf0, B -') - - /* kill the special cases. */ - beq B, Ldotrap /* division by zero! */ - - cmpult A, B, CC /* A < B? */ - /* RESULT is already zero, from above. A is untouched. */ - bne CC, Lret_result - - cmpeq A, B, CC /* A == B? */ - cmovne CC, 1, RESULT - cmovne CC, zero, A - bne CC, Lret_result - - /* - * Find out how many bits of zeros are at the beginning of the divisor. - */ -LBbits: - ldiq T_0, 1 /* I = 0; BIT = 1<<WORDSIZE-1 */ - mov zero, I - sll T_0, WORDSIZE-1, BIT -LBloop: - and B, BIT, CC /* if bit in B is set, done. */ - bne CC, LAbits - addq I, 1, I /* increment I, shift bit */ - srl BIT, 1, BIT - cmplt I, WORDSIZE-1, CC /* if I leaves one bit, done. */ - bne CC, LBloop - -LAbits: - beq I, Ldodiv /* If I = 0, divide now. */ - ldiq T_0, 1 /* BIT = 1<<WORDSIZE-1 */ - sll T_0, WORDSIZE-1, BIT - -LAloop: - and A, BIT, CC /* if bit in A is set, done. */ - bne CC, Ldodiv - subq I, 1, I /* decrement I, shift bit */ - srl BIT, 1, BIT - bne I, LAloop /* If I != 0, loop again */ - -Ldodiv: - sll B, I, B /* B <<= i */ - ldiq T_0, 1 - sll T_0, I, BIT - -Ldivloop: - cmpult A, B, CC - or RESULT, BIT, T_0 - cmoveq CC, T_0, RESULT - subq A, B, T_0 - cmoveq CC, T_0, A - srl BIT, 1, BIT - srl B, 1, B - beq A, Lret_result - bne BIT, Ldivloop - -Lret_result: -ifelse(OP, `div', -`', ` mov A, RESULT -') -ifelse(S, `true', -` - /* Check to see if we should negate it. */ - subq zero, RESULT, T_0 - cmovlbs NEG, T_0, RESULT -') - - ldq BIT, 0(sp) - ldq I, 8(sp) - ldq CC, 16(sp) - ldq T_0, 24(sp) -ifelse(S, `true', -` ldq NEG, 32(sp)') - ldq A, 40(sp) - ldq B, 48(sp) - lda sp, 64(sp) - ret zero, (t9), 1 - -Ldotrap: - ldiq a0, -2 /* This is the signal to SIGFPE! */ - call_pal PAL_gentrap -ifelse(OP, `div', -`', ` mov zero, A /* so that zero will be returned */ -') - br zero, Lret_result - -END(NAME) diff --git a/sys/alpha/alpha/dump_machdep.c b/sys/alpha/alpha/dump_machdep.c deleted file mode 100644 index 42523d7..0000000 --- a/sys/alpha/alpha/dump_machdep.c +++ /dev/null @@ -1,129 +0,0 @@ -/*- - * Copyright (c) 2002 Poul-Henning Kamp - * Copyright (c) 2002 Networks Associates Technology, Inc. - * All rights reserved. - * - * This software was developed for the FreeBSD Project by Poul-Henning Kamp - * and NAI Labs, the Security Research Division of Network Associates, Inc. - * under DARPA/SPAWAR contract N66001-01-C-8035 ("CBOSS"), as part of the - * DARPA CHATS research program. - * - * 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. The names of the authors 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 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/kernel.h> -#include <sys/kerneldump.h> -#include <vm/vm.h> -#include <vm/pmap.h> -#include <machine/md_var.h> - -CTASSERT(sizeof(struct kerneldumpheader) == 512); - -static struct kerneldumpheader kdh; - -void -dumpsys(struct dumperinfo *di) -{ - off_t dumplo; - vm_offset_t a, addr; - u_int count, left, u; - void *va; - int i, mb; - - printf("Dumping %ld MB\n", Maxmem / (1024*1024 / PAGE_SIZE)); - - /* Fill in the kernel dump header */ - strcpy(kdh.magic, KERNELDUMPMAGIC); - strcpy(kdh.architecture, "alpha"); - kdh.version = htod32(KERNELDUMPVERSION); - kdh.architectureversion = htod32(KERNELDUMP_ALPHA_VERSION); - kdh.dumplength = htod64(Maxmem * (off_t)PAGE_SIZE); - kdh.dumptime = htod64(time_second); - kdh.blocksize = htod32(di->blocksize); - strncpy(kdh.hostname, hostname, sizeof kdh.hostname); - strncpy(kdh.versionstring, version, sizeof kdh.versionstring); - if (panicstr != NULL) - strncpy(kdh.panicstring, panicstr, sizeof kdh.panicstring); - kdh.parity = kerneldump_parity(&kdh); - - /* - * Check if we will have enough room to save the coredump. - * The partition size needed is the sum of: - * Memory to save + header + trailer + Room to leave untouched - * at partition head. (an arbitrary amount). - */ - if (di->mediasize < - Maxmem * (off_t)PAGE_SIZE + sizeof kdh * 2 + 64*1024) { - printf("\nDump failed. Partition too small.\n"); - return; - } - - dumplo = di->mediaoffset + di->mediasize - Maxmem * (off_t)PAGE_SIZE; - dumplo -= sizeof kdh * 2; - i = di->dumper(di->priv, &kdh, 0, dumplo, sizeof kdh); - if (i) - printf("\nDump failed writing header (%d)\n", i); - dumplo += sizeof kdh; - i = 0; - addr = 0; - va = 0; - mb = 0; - for (count = 0; count < Maxmem;) { - left = Maxmem - count; - if (left > MAXDUMPPGS) - left = MAXDUMPPGS; - for (u = 0; u < left; u++) { - a = addr + u * PAGE_SIZE; - if (!is_physical_memory(a)) - a = 0; - va = pmap_kenter_temporary(trunc_page(a), u); - } - i = count / (16*1024*1024 / PAGE_SIZE); - if (i != mb) { - printf(" %d", count / (1024 * 1024 / PAGE_SIZE)); - mb = i; - } - i = di->dumper(di->priv, va, 0, dumplo, left * PAGE_SIZE); - if (i) - break; - count += left; - dumplo += left * PAGE_SIZE; - addr += left * PAGE_SIZE; - } - if (i) - printf("\nDump failed writing data (%d)\n", i); - i = di->dumper(di->priv, &kdh, 0, dumplo, sizeof kdh); - if (i) - printf("\nDump failed writing trailer (%d)\n", i); - di->dumper(di->priv, NULL, 0, 0, 0); /* tell them we are done */ - printf("\nDump complete\n"); - return; -} diff --git a/sys/alpha/alpha/elf_machdep.c b/sys/alpha/alpha/elf_machdep.c deleted file mode 100644 index 88b665a..0000000 --- a/sys/alpha/alpha/elf_machdep.c +++ /dev/null @@ -1,237 +0,0 @@ -/*- - * Copyright 1996-1998 John D. Polstra. - * 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 ``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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/exec.h> -#include <sys/imgact.h> -#include <sys/malloc.h> -#include <sys/proc.h> -#include <sys/namei.h> -#include <sys/fcntl.h> -#include <sys/sysent.h> -#include <sys/imgact_elf.h> -#include <sys/syscall.h> -#include <sys/signalvar.h> -#include <sys/vnode.h> -#include <sys/linker.h> - -#include <vm/vm.h> -#include <vm/vm_param.h> - -#include <machine/elf.h> -#include <machine/md_var.h> - -struct sysentvec elf64_freebsd_sysvec = { - SYS_MAXSYSCALL, - sysent, - 0, - 0, - NULL, - 0, - NULL, - NULL, - __elfN(freebsd_fixup), - sendsig, - sigcode, - &szsigcode, - 0, - "FreeBSD ELF64", - __elfN(coredump), - NULL, - MINSIGSTKSZ, - PAGE_SIZE, - VM_MIN_ADDRESS, - VM_MAXUSER_ADDRESS, - USRSTACK, - PS_STRINGS, - VM_PROT_ALL, - exec_copyout_strings, - exec_setregs, - NULL -}; - -static Elf64_Brandinfo freebsd_brand_info = { - ELFOSABI_FREEBSD, - EM_ALPHA, - "FreeBSD", - NULL, - "/libexec/ld-elf.so.1", - &elf64_freebsd_sysvec, - NULL, - 0, - }; - -SYSINIT(elf64, SI_SUB_EXEC, SI_ORDER_ANY, - (sysinit_cfunc_t) elf64_insert_brand_entry, - &freebsd_brand_info); - -static Elf64_Brandinfo freebsd_brand_oinfo = { - ELFOSABI_FREEBSD, - EM_ALPHA, - "FreeBSD", - NULL, - "/usr/libexec/ld-elf.so.1", - &elf64_freebsd_sysvec, - NULL, - 0, - }; - -SYSINIT(oelf64, SI_SUB_EXEC, SI_ORDER_ANY, - (sysinit_cfunc_t) elf64_insert_brand_entry, - &freebsd_brand_oinfo); - - -void -elf64_dump_thread(struct thread *td __unused, void *dst __unused, - size_t *off __unused) -{ -} - - -/* Process one elf relocation with addend. */ -static int -elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data, - int type, int local, elf_lookup_fn lookup) -{ - Elf_Addr *where; - Elf_Addr addr; - Elf_Addr addend; - Elf_Size rtype, symidx; - const Elf_Rel *rel; - const Elf_Rela *rela; - - switch (type) { - case ELF_RELOC_REL: - rel = (const Elf_Rel *)data; - where = (Elf_Addr *) (relocbase + rel->r_offset); - addend = *where; - rtype = ELF_R_TYPE(rel->r_info); - symidx = ELF_R_SYM(rel->r_info); - break; - case ELF_RELOC_RELA: - rela = (const Elf_Rela *)data; - where = (Elf_Addr *) (relocbase + rela->r_offset); - addend = rela->r_addend; - rtype = ELF_R_TYPE(rela->r_info); - symidx = ELF_R_SYM(rela->r_info); - break; - default: - panic("elf_reloc: unknown relocation mode %d\n", type); - } - - if (local) { - if (rtype == R_ALPHA_RELATIVE) { - addr = relocbase + addend; - if (*where != addr) - *where = addr; - } - return (0); - } - - switch (rtype) { - - case R_ALPHA_NONE: - break; - - case R_ALPHA_REFQUAD: - addr = lookup(lf, symidx, 1); - if (addr == 0) - return -1; - addr += addend; - if (*where != addr) - *where = addr; - break; - - case R_ALPHA_GLOB_DAT: - addr = lookup(lf, symidx, 1); - if (addr == 0) - return -1; - addr += addend; - if (*where != addr) - *where = addr; - break; - - case R_ALPHA_JMP_SLOT: - /* No point in lazy binding for kernel modules. */ - addr = lookup(lf, symidx, 1); - if (addr == 0) - return -1; - if (*where != addr) - *where = addr; - break; - - case R_ALPHA_RELATIVE: - break; - - case R_ALPHA_COPY: - /* - * There shouldn't be copy relocations in kernel - * objects. - */ - printf("kldload: unexpected R_COPY relocation\n"); - return -1; - - default: - printf("kldload: unexpected relocation type %d\n", - (int) rtype); - return -1; - } - return(0); -} - -int -elf_reloc(linker_file_t lf, Elf_Addr relocbase, const void *data, int type, - elf_lookup_fn lookup) -{ - - return (elf_reloc_internal(lf, relocbase, data, type, 0, lookup)); -} - -int -elf_reloc_local(linker_file_t lf, Elf_Addr relocbase, const void *data, - int type, elf_lookup_fn lookup) -{ - - return (elf_reloc_internal(lf, relocbase, data, type, 1, lookup)); -} - -int -elf_cpu_load_file(linker_file_t lf __unused) -{ - - return (0); -} - -int -elf_cpu_unload_file(linker_file_t lf __unused) -{ - - return (0); -} diff --git a/sys/alpha/alpha/exception.s b/sys/alpha/alpha/exception.s deleted file mode 100644 index 39159b1..0000000 --- a/sys/alpha/alpha/exception.s +++ /dev/null @@ -1,384 +0,0 @@ -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - * $NetBSD: locore.s,v 1.47 1998/03/22 07:26:32 thorpej Exp $ - * $FreeBSD$ - */ - -#include <machine/asm.h> -#include <assym.s> - -/**************************************************************************/ - -/* - * XentArith: - * System arithmetic trap entry point. - */ - - PALVECT(XentArith) /* setup frame, save registers */ - - /* a0, a1, & a2 already set up */ - ldiq a3, ALPHA_KENTRY_ARITH - mov sp, a4 ; .loc 1 __LINE__ - CALL(trap) - - jmp zero, exception_return - END(XentArith) - -/**************************************************************************/ - -/* - * XentIF: - * System instruction fault trap entry point. - */ - - PALVECT(XentIF) /* setup frame, save registers */ - - /* a0, a1, & a2 already set up */ - ldiq a3, ALPHA_KENTRY_IF - mov sp, a4 ; .loc 1 __LINE__ - CALL(trap) - jmp zero, exception_return - END(XentIF) - -/**************************************************************************/ - -/* - * XentInt: - * System interrupt entry point. - */ - - PALVECT(XentInt) /* setup frame, save registers */ - - /* a0, a1, & a2 already set up */ - mov sp, a3 ; .loc 1 __LINE__ - CALL(interrupt) - jmp zero, exception_return - END(XentInt) - -/**************************************************************************/ - -/* - * XentMM: - * System memory management fault entry point. - */ - - PALVECT(XentMM) /* setup frame, save registers */ - - /* a0, a1, & a2 already set up */ - ldiq a3, ALPHA_KENTRY_MM - mov sp, a4 ; .loc 1 __LINE__ - CALL(trap) - - jmp zero, exception_return - END(XentMM) - -/**************************************************************************/ - -/* - * XentSys: - * System call entry point. - */ - - ESETUP(XentSys) ; .loc 1 __LINE__ - - stq v0,(FRAME_V0*8)(sp) /* in case we need to restart */ - stq s0,(FRAME_S0*8)(sp) - stq s1,(FRAME_S1*8)(sp) - stq s2,(FRAME_S2*8)(sp) - stq s3,(FRAME_S3*8)(sp) - stq s4,(FRAME_S4*8)(sp) - stq s5,(FRAME_S5*8)(sp) - stq s6,(FRAME_S6*8)(sp) - stq a3,(FRAME_A3*8)(sp) - stq a4,(FRAME_A4*8)(sp) - stq a5,(FRAME_A5*8)(sp) - stq ra,(FRAME_RA*8)(sp) - stq a0,(FRAME_A0*8)(sp) - stq a1,(FRAME_A1*8)(sp) - stq a2,(FRAME_A2*8)(sp) - ldiq t1,FRAME_FLAGS_SYSCALL - stq t1,(FRAME_FLAGS*8)(sp) - - /* syscall number, passed in v0, is first arg, frame pointer second */ - mov v0,a0 - mov sp,a1 ; .loc 1 __LINE__ - br pv,1f -1: LDGP(pv) - CALL(syscall) - - /* Handle any AST's. */ -2: ldiq a0, ALPHA_PSL_IPL_HIGH /* disable all interrupts */ - call_pal PAL_OSF1_swpipl - ldq s0, PC_CURTHREAD(pcpup) /* checking for pending asts */ - ldl s1, TD_FLAGS(s0) - ldiq s2, TDF_ASTPENDING | TDF_NEEDRESCHED - and s1, s2 - beq s1, 3f - ldiq a0, ALPHA_PSL_IPL_0 /* reenable interrupts */ - call_pal PAL_OSF1_swpipl - mov sp, a0 /* only arg is frame */ - CALL(ast) - jmp zero, 2b - - /* see if we need a full exception_return */ -3: ldq t1, (FRAME_FLAGS*8)(sp) - and t1, FRAME_FLAGS_SYSCALL - beq t1, exception_return - - /* set the hae register if this process has specified a value */ - ldq t1, TD_MD_FLAGS(s0) - and t1, MDTD_HAEUSED - beq t1, 3f - ldq a0, TD_MD_HAE(s0) - ldq pv, chipset + CHIPSET_WRITE_HAE - CALL((pv)) -3: -#ifdef SMP - /* leave the kernel */ - stl zero, TD_MD_KERNNEST(s0) -#endif - - /* restore the registers, and return */ - ldq v0,(FRAME_V0*8)(sp) - ldq s0,(FRAME_S0*8)(sp) - ldq s1,(FRAME_S1*8)(sp) - ldq s2,(FRAME_S2*8)(sp) - ldq s3,(FRAME_S3*8)(sp) - ldq s4,(FRAME_S4*8)(sp) - ldq s5,(FRAME_S5*8)(sp) - ldq s6,(FRAME_S6*8)(sp) - ldq a3,(FRAME_A3*8)(sp) - ldq a4,(FRAME_A4*8)(sp) - ldq a5,(FRAME_A5*8)(sp) - ldq ra,(FRAME_RA*8)(sp) - ldq a0,(FRAME_A0*8)(sp) - ldq a1,(FRAME_A1*8)(sp) - ldq a2,(FRAME_A2*8)(sp) - - lda sp,(FRAME_SW_SIZE*8)(sp) - call_pal PAL_OSF1_retsys - - END(XentSys) - -/**************************************************************************/ - -/* - * XentUna: - * System unaligned access entry point. - */ - -LEAF(XentUna, 3) /* XXX should be NESTED */ - .set noat - lda sp,-(FRAME_SW_SIZE*8)(sp) - stq at_reg,(FRAME_AT*8)(sp) - .set at - stq ra,(FRAME_RA*8)(sp) - bsr ra, exception_save_regs /* jmp/CALL trashes pv/t12 */ - - /* a0, a1, & a2 already set up */ - ldiq a3, ALPHA_KENTRY_UNA - mov sp, a4 ; .loc 1 __LINE__ - br pv, 1f -1: LDGP(pv) - CALL(trap) - - jmp zero, exception_return - END(XentUna) - - -/**************************************************************************/ - -/* - * console 'restart' routine to be placed in HWRPB. - */ -LEAF(XentRestart, 1) /* XXX should be NESTED */ - .set noat - lda sp,-(FRAME_SIZE*8)(sp) - stq at_reg,(FRAME_AT*8)(sp) - .set at - stq v0,(FRAME_V0*8)(sp) - stq a3,(FRAME_A3*8)(sp) - stq a4,(FRAME_A4*8)(sp) - stq a5,(FRAME_A5*8)(sp) - stq s0,(FRAME_S0*8)(sp) - stq s1,(FRAME_S1*8)(sp) - stq s2,(FRAME_S2*8)(sp) - stq s3,(FRAME_S3*8)(sp) - stq s4,(FRAME_S4*8)(sp) - stq s5,(FRAME_S5*8)(sp) - stq s6,(FRAME_S6*8)(sp) - stq t0,(FRAME_T0*8)(sp) - stq t1,(FRAME_T1*8)(sp) - stq t2,(FRAME_T2*8)(sp) - stq t3,(FRAME_T3*8)(sp) - stq t4,(FRAME_T4*8)(sp) - stq t5,(FRAME_T5*8)(sp) - stq t6,(FRAME_T6*8)(sp) - stq t7,(FRAME_T7*8)(sp) - stq t8,(FRAME_T8*8)(sp) - stq t9,(FRAME_T9*8)(sp) - stq t10,(FRAME_T10*8)(sp) - stq t11,(FRAME_T11*8)(sp) - stq t12,(FRAME_T12*8)(sp) - stq ra,(FRAME_RA*8)(sp) - - br pv,1f -1: LDGP(pv) - - ldq a0,(FRAME_RA*8)(sp) /* a0 = ra */ - ldq a1,(FRAME_T11*8)(sp) /* a1 = ai */ - ldq a2,(FRAME_T12*8)(sp) /* a2 = pv */ - CALL(console_restart) - - call_pal PAL_halt - END(XentRestart) - -/* - * exception_return: return from trap, exception, or syscall - */ - -LEAF(exception_return, 1) /* XXX should be NESTED */ - br pv, Ler1 -Ler1: LDGP(pv) - - ldq s0, PC_CURTHREAD(pcpup) /* save curthread in s0 */ -#ifdef SMP - ldl s1, TD_MD_KERNNEST(s0) - subl s1, 1, s1 /* decrement nesting level */ -#endif - - ldq t1, (FRAME_PS * 8)(sp) /* get the saved PS */ - and t1, ALPHA_PSL_USERMODE, t0 /* are we returning to user? */ - beq t0, Lkernelret /* no: kernel return */ - - /* Handle any AST's or resched's. */ -1: ldiq a0, ALPHA_PSL_IPL_HIGH /* disable all interrupts */ - call_pal PAL_OSF1_swpipl - ldl s2, TD_FLAGS(s0) /* atomically with returning */ - ldiq s3, TDF_ASTPENDING | TDF_NEEDRESCHED - and s2, s3 - beq s2, 2f - ldiq a0, ALPHA_PSL_IPL_0 /* reenable interrupts */ - call_pal PAL_OSF1_swpipl - mov sp, a0 /* only arg is frame */ - CALL(ast) - jmp zero, 1b -2: -#ifdef SMP - br Lrestoreregs -#endif - -Lkernelret: -#ifdef SMP - beq s1, Lrestoreregs - stq pcpup, (FRAME_T7*8)(sp) /* fixup pcpup */ -#endif - -Lrestoreregs: - /* set the hae register if this process has specified a value */ - ldq t1, TD_MD_FLAGS(s0) - and t1, MDTD_HAEUSED - beq t1, Lnohae - ldq a0, TD_MD_HAE(t0) - ldq pv, chipset + CHIPSET_WRITE_HAE - CALL((pv)) -Lnohae: -#ifdef SMP - /* leave the kernel */ - stl s1, TD_MD_KERNNEST(s0) -#endif - - /* restore the registers, and return */ - bsr ra, exception_restore_regs /* jmp/CALL trashes pv/t12 */ - ldq ra,(FRAME_RA*8)(sp) - .set noat - ldq at_reg,(FRAME_AT*8)(sp) - - lda sp,(FRAME_SW_SIZE*8)(sp) - call_pal PAL_OSF1_rti - .set at - END(exception_return) - -LEAF(exception_save_regs, 0) - stq v0,(FRAME_V0*8)(sp) - stq a3,(FRAME_A3*8)(sp) - stq a4,(FRAME_A4*8)(sp) - stq a5,(FRAME_A5*8)(sp) - stq s0,(FRAME_S0*8)(sp) - stq s1,(FRAME_S1*8)(sp) - stq s2,(FRAME_S2*8)(sp) - stq s3,(FRAME_S3*8)(sp) - stq s4,(FRAME_S4*8)(sp) - stq s5,(FRAME_S5*8)(sp) - stq s6,(FRAME_S6*8)(sp) - stq t0,(FRAME_T0*8)(sp) - stq t1,(FRAME_T1*8)(sp) - stq t2,(FRAME_T2*8)(sp) - stq t3,(FRAME_T3*8)(sp) - stq t4,(FRAME_T4*8)(sp) - stq t5,(FRAME_T5*8)(sp) - stq t6,(FRAME_T6*8)(sp) - stq t7,(FRAME_T7*8)(sp) - stq t8,(FRAME_T8*8)(sp) - stq t9,(FRAME_T9*8)(sp) - stq t10,(FRAME_T10*8)(sp) - stq t11,(FRAME_T11*8)(sp) - stq t12,(FRAME_T12*8)(sp) - .set noat - lda at_reg,(FRAME_SIZE*8)(sp) - stq at_reg,(FRAME_SP*8)(sp) - .set at - stq zero,(FRAME_FLAGS*8)(sp) - RET - END(exception_save_regs) - -LEAF(exception_restore_regs, 0) - ldq v0,(FRAME_V0*8)(sp) - ldq a3,(FRAME_A3*8)(sp) - ldq a4,(FRAME_A4*8)(sp) - ldq a5,(FRAME_A5*8)(sp) - ldq s0,(FRAME_S0*8)(sp) - ldq s1,(FRAME_S1*8)(sp) - ldq s2,(FRAME_S2*8)(sp) - ldq s3,(FRAME_S3*8)(sp) - ldq s4,(FRAME_S4*8)(sp) - ldq s5,(FRAME_S5*8)(sp) - ldq s6,(FRAME_S6*8)(sp) - ldq t0,(FRAME_T0*8)(sp) - ldq t1,(FRAME_T1*8)(sp) - ldq t2,(FRAME_T2*8)(sp) - ldq t3,(FRAME_T3*8)(sp) - ldq t4,(FRAME_T4*8)(sp) - ldq t5,(FRAME_T5*8)(sp) - ldq t6,(FRAME_T6*8)(sp) - ldq t7,(FRAME_T7*8)(sp) - ldq t8,(FRAME_T8*8)(sp) - ldq t9,(FRAME_T9*8)(sp) - ldq t10,(FRAME_T10*8)(sp) - ldq t11,(FRAME_T11*8)(sp) - ldq t12,(FRAME_T12*8)(sp) - RET - END(exception_restore_regs) diff --git a/sys/alpha/alpha/fp_emulate.c b/sys/alpha/alpha/fp_emulate.c deleted file mode 100644 index 7e8aa5e..0000000 --- a/sys/alpha/alpha/fp_emulate.c +++ /dev/null @@ -1,415 +0,0 @@ -/*- - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sysproto.h> -#include <sys/sysent.h> -#include <sys/proc.h> -#include <sys/lock.h> -#include <sys/mutex.h> - -#include <vm/vm.h> -#include <vm/vm_kern.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> -#include <vm/vm_extern.h> -#include <vm/vm_object.h> -#include <vm/vm_pager.h> - -#include <machine/fpu.h> -#include <machine/inst.h> -#include <machine/md_var.h> -#include <machine/pcb.h> -#include <machine/reg.h> - -#include <alpha/alpha/ieee_float.h> - -#define GETREG(regs, i) (*(fp_register_t*) ®s->fpr_regs[i]) -#define PUTREG(regs, i, v) (*(fp_register_t*) ®s->fpr_regs[i] = v) - -typedef fp_register_t fp_opcode_handler(union alpha_instruction ins, - int src, int rnd, - u_int64_t fp_control, - u_int64_t *status, - struct fpreg *fpregs); - -static fp_register_t fp_add(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_add(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - src, rnd, control, status); -} - -static fp_register_t fp_sub(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_sub(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - src, rnd, control, status); -} - -static fp_register_t fp_mul(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_mul(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - src, rnd, control, status); -} - -static fp_register_t fp_div(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_div(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - src, rnd, control, status); -} - -static fp_register_t fp_cmpun(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_cmpun(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - status); -} - -static fp_register_t fp_cmpeq(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_cmpeq(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - status); -} - -static fp_register_t fp_cmplt(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_cmplt(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - status); -} - -static fp_register_t fp_cmple(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - return ieee_cmple(GETREG(fpregs, ins.f_format.fa), - GETREG(fpregs, ins.f_format.fb), - status); -} - -static fp_register_t fp_cvts(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - switch (src) { - case T_FORMAT: - return ieee_convert_T_S(GETREG(fpregs, ins.f_format.fb), - rnd, control, status); - - case Q_FORMAT: - return ieee_convert_Q_S(GETREG(fpregs, ins.f_format.fb), - rnd, control, status); - - default: - *status |= FPCR_INV; - return GETREG(fpregs, ins.f_format.fc); - } -} - -static fp_register_t fp_cvtt(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - switch (src) { - case S_FORMAT: - return ieee_convert_S_T(GETREG(fpregs, ins.f_format.fb), - rnd, control, status); - break; - - case Q_FORMAT: - return ieee_convert_Q_T(GETREG(fpregs, ins.f_format.fb), - rnd, control, status); - break; - - default: - *status |= FPCR_INV; - return GETREG(fpregs, ins.f_format.fc); - } -} - -static fp_register_t fp_cvtq(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - switch (src) { - case S_FORMAT: - return ieee_convert_S_Q(GETREG(fpregs, ins.f_format.fb), - rnd, control, status); - break; - - case T_FORMAT: - return ieee_convert_T_Q(GETREG(fpregs, ins.f_format.fb), - rnd, control, status); - break; - - default: - *status |= FPCR_INV; - return GETREG(fpregs, ins.f_format.fc); - } -} - -static fp_register_t fp_reserved(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) -{ - *status |= FPCR_INV; - return GETREG(fpregs, ins.f_format.fc); -} - -static fp_register_t fp_cvtql(union alpha_instruction ins, - int src, int rnd, - u_int64_t control, u_int64_t *status, - struct fpreg *fpregs) - -{ - fp_register_t fb = GETREG(fpregs, ins.f_format.fb); - fp_register_t ret; - *status |= FPCR_INV; - ret.q = ((fb.q & 0xc0000000) << 32 | (fb.q & 0x3fffffff) << 29); - return ret; -} - -static int fp_emulate(union alpha_instruction ins, struct thread *td) -{ - u_int64_t control = td->td_pcb->pcb_fp_control; - struct fpreg *fpregs = &td->td_pcb->pcb_fp; - static fp_opcode_handler *ops[16] = { - fp_add, /* 0 */ - fp_sub, /* 1 */ - fp_mul, /* 2 */ - fp_div, /* 3 */ - fp_cmpun, /* 4 */ - fp_cmpeq, /* 5 */ - fp_cmplt, /* 6 */ - fp_cmple, /* 7 */ - fp_reserved, /* 8 */ - fp_reserved, /* 9 */ - fp_reserved, /* 10 */ - fp_reserved, /* 11 */ - fp_cvts, /* 12 */ - fp_reserved, /* 13 */ - fp_cvtt, /* 14 */ - fp_cvtq, /* 15 */ - }; - int src, rnd; - fp_register_t result; - u_int64_t status; - - /* - * Only attempt to emulate ieee instructions & integer overflow - */ - if ((ins.common.opcode != op_flti) && - (ins.f_format.function != fltl_cvtqlsv)){ - printf("fp_emulate: unhandled opcode = 0x%x, fun = 0x%x\n",ins.common.opcode,ins.f_format.function); - return 0; - } - - /* - * Dump the float registers into the pcb so we can get at - * them. We are potentially going to modify the fp state, so - * cancel fpcurproc too. - */ - alpha_fpstate_save(td, 1); - - /* - * Decode and execute the instruction. - */ - src = (ins.f_format.function >> 4) & 3; - rnd = (ins.f_format.function >> 6) & 3; - if (rnd == 3) - rnd = (fpregs->fpr_cr >> FPCR_DYN_SHIFT) & 3; - status = 0; - if (ins.common.opcode == op_fltl - && ins.f_format.function == fltl_cvtqlsv) - result = fp_cvtql(ins, src, rnd, control, &status, - fpregs); - else - result = ops[ins.f_format.function & 0xf](ins, src, rnd, - control, &status, - fpregs); - - /* - * Handle exceptions. - */ - if (status) { - u_int64_t fpcr; - - /* Record the exception in the software control word. */ - control |= (status >> IEEE_STATUS_TO_FPCR_SHIFT); - td->td_pcb->pcb_fp_control = control; - - /* Regenerate the control register */ - fpcr = fpregs->fpr_cr & (FPCR_DYN_MASK | FPCR_STATUS_MASK); - fpcr |= ((control & IEEE_STATUS_MASK) - << IEEE_STATUS_TO_FPCR_SHIFT); - if (!(control & IEEE_TRAP_ENABLE_INV)) - fpcr |= FPCR_INVD; - if (!(control & IEEE_TRAP_ENABLE_DZE)) - fpcr |= FPCR_DZED; - if (!(control & IEEE_TRAP_ENABLE_OVF)) - fpcr |= FPCR_OVFD; - if (!(control & IEEE_TRAP_ENABLE_UNF)) - fpcr |= FPCR_UNFD; - if (!(control & IEEE_TRAP_ENABLE_INE)) - fpcr |= FPCR_INED; - if (control & IEEE_STATUS_MASK) - fpcr |= FPCR_SUM; - fpregs->fpr_cr = fpcr; - - /* Check the trap enable */ - if ((control >> IEEE_STATUS_TO_EXCSUM_SHIFT) - & (control & IEEE_TRAP_ENABLE_MASK)) - return 0; - } - - PUTREG(fpregs, ins.f_format.fc, result); - return 1; -} - -/* - * Attempt to complete a floating point instruction which trapped by - * emulating it in software. Return non-zero if the completion was - * successful, otherwise zero. - */ -int fp_software_completion(u_int64_t regmask, struct thread *td) -{ - struct trapframe *frame = td->td_frame; - u_int64_t pc = frame->tf_regs[FRAME_PC]; - int error; - - /* - * First we must search back through the trap shadow to find which - * instruction was responsible for generating the trap. - */ - pc -= 4; - while (regmask) { - union alpha_instruction ins; - - /* - * Read the instruction and figure out the destination - * register and opcode. - */ - error = copyin((caddr_t) pc, &ins, sizeof(ins)); - if (error) - return 0; - - switch (ins.common.opcode) { - case op_call_pal: - case op_jsr: - case op_br ... op_bgt: - /* - * Condition 6: the trap shadow may not - * include any branch instructions. Also, - * the trap shadow is bounded by EXCB, TRAPB - * and CALL_PAL. - */ - return 0; - - case op_misc: - switch (ins.memory_format.function) { - case misc_trapb: - case misc_excb: - return 0; - } - break; - - case op_inta: - case op_intl: - case op_ints: - /* - * The first 32 bits of the register mask - * represents integer registers which were - * modified in the trap shadow. - */ - regmask &= ~(1LL << ins.o_format.rc); - break; - - case op_fltv: - case op_flti: - case op_fltl: - /* - * The second 32 bits of the register mask - * represents float registers which were - * modified in the trap shadow. - */ - regmask &= ~(1LL << (ins.f_format.fc + 32)); - break; - } - - if (regmask == 0) { - /* - * We have traced back through all the - * instructions in the trap shadow, so this - * must be the one which generated the trap. - */ - if (fp_emulate(ins, td)) { - /* - * Restore pc to the first instruction - * in the trap shadow. - */ - frame->tf_regs[FRAME_PC] = pc + 4; - return 1; - } else - return 0; - } - pc -= 4; - } - return 0; -} diff --git a/sys/alpha/alpha/gdb_machdep.c b/sys/alpha/alpha/gdb_machdep.c deleted file mode 100644 index 410aab6..0000000 --- a/sys/alpha/alpha/gdb_machdep.c +++ /dev/null @@ -1,101 +0,0 @@ -/*- - * Copyright (c) 2004 Marcel Moolenaar - * 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 AUTHORS ``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 AUTHORS 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kdb.h> -#include <sys/kernel.h> -#include <sys/signal.h> - -#include <machine/gdb_machdep.h> -#include <machine/pcb.h> -#include <machine/reg.h> - -#include <gdb/gdb.h> - -void * -gdb_cpu_getreg(int regnum, size_t *regsz) -{ - - *regsz = gdb_cpu_regsz(regnum); - switch (regnum) { - case 9: return (&kdb_thrctx->pcb_context[0]); - case 10: return (&kdb_thrctx->pcb_context[1]); - case 11: return (&kdb_thrctx->pcb_context[2]); - case 12: return (&kdb_thrctx->pcb_context[3]); - case 13: return (&kdb_thrctx->pcb_context[4]); - case 14: return (&kdb_thrctx->pcb_context[5]); - case 15: return (&kdb_thrctx->pcb_context[6]); - case 30: return (&kdb_thrctx->pcb_hw.apcb_ksp); - case 64: return (&kdb_thrctx->pcb_context[7]); - } - return (NULL); -} - -void -gdb_cpu_setreg(int regnum, void *val) -{ - switch (regnum) { - } -} - -int -gdb_cpu_signal(int entry, int code) -{ - switch (entry) { - case ALPHA_KENTRY_INT: - case ALPHA_KENTRY_ARITH: - return (SIGILL); /* Can this happen? */ - case ALPHA_KENTRY_MM: - switch (code) { - case ALPHA_MMCSR_INVALTRANS: - return (SIGSEGV); - case ALPHA_MMCSR_ACCESS: - case ALPHA_MMCSR_FOR: - case ALPHA_MMCSR_FOE: - case ALPHA_MMCSR_FOW: - return (SIGBUS); - } - case ALPHA_KENTRY_IF: - switch (code) { - case ALPHA_IF_CODE_BUGCHK: - case ALPHA_IF_CODE_BPT: - return (SIGTRAP); - case ALPHA_IF_CODE_GENTRAP: - case ALPHA_IF_CODE_FEN: - case ALPHA_IF_CODE_OPDEC: - return (SIGILL); - } - case ALPHA_KENTRY_UNA: - return (SIGSEGV); - case ALPHA_KENTRY_SYS: - return (SIGILL); - } - return (SIGILL); -} diff --git a/sys/alpha/alpha/genassym.c b/sys/alpha/alpha/genassym.c deleted file mode 100644 index b8cf171..0000000 --- a/sys/alpha/alpha/genassym.c +++ /dev/null @@ -1,178 +0,0 @@ -/*- - * Copyright (c) 1982, 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * 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. - * 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: @(#)genassym.c 5.11 (Berkeley) 5/10/91 - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/assym.h> -#include <sys/proc.h> -#include <sys/bio.h> -#include <sys/buf.h> -#include <sys/errno.h> - -#include <sys/proc.h> -#include <sys/mount.h> -#include <sys/mutex.h> -#include <sys/socket.h> -#include <sys/resource.h> -#include <sys/resourcevar.h> -#include <sys/ktr.h> -#include <machine/frame.h> -#include <machine/chipset.h> -#include <machine/pcb.h> -#include <sys/vmmeter.h> -#include <vm/vm.h> -#include <vm/vm_param.h> -#include <vm/pmap.h> -#include <vm/vm_map.h> -#include <net/if.h> -#include <netinet/in.h> -#include <nfs/nfsproto.h> -#include <nfs/rpcv2.h> -#include <nfsclient/nfs.h> -#include <nfsclient/nfsdiskless.h> - -ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); -ASSYM(PC_FPCURTHREAD, offsetof(struct pcpu, pc_fpcurthread)); -ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); -ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); -ASSYM(PC_IDLEPCBPHYS, offsetof(struct pcpu, pc_idlepcbphys)); - -ASSYM(MTX_LOCK, offsetof(struct mtx, mtx_lock)); -ASSYM(MTX_RECURSE, offsetof(struct mtx, mtx_recurse)); -ASSYM(MTX_UNOWNED, MTX_UNOWNED); - -ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); -ASSYM(TD_PROC, offsetof(struct thread, td_proc)); - -ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); - -ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); -ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); - -ASSYM(TD_MD_FLAGS, offsetof(struct thread, td_md.md_flags)); -ASSYM(TD_MD_PCBPADDR, offsetof(struct thread, td_md.md_pcbpaddr)); -ASSYM(TD_MD_HAE, offsetof(struct thread, td_md.md_hae)); -#ifdef SMP -ASSYM(TD_MD_KERNNEST, offsetof(struct thread, td_md.md_kernnest)); -#endif -ASSYM(MDTD_HAEUSED, MDTD_HAEUSED); - -ASSYM(CHIPSET_WRITE_HAE, offsetof(struct alpha_chipset, write_hae)); - -ASSYM(VM_MAXUSER_ADDRESS, VM_MAXUSER_ADDRESS); -ASSYM(PTLEV1I, PTLEV1I); -ASSYM(PTESIZE, PTESIZE); - -ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); -ASSYM(PCB_HWPCB_KSP, offsetof(struct pcb, pcb_hw.apcb_ksp)); -ASSYM(PCB_CONTEXT, offsetof(struct pcb, pcb_context)); -ASSYM(PCB_HW, offsetof(struct pcb, pcb_hw)); - -ASSYM(FPREG_FPR_REGS, offsetof(struct fpreg, fpr_regs)); -ASSYM(FPREG_FPR_CR, offsetof(struct fpreg, fpr_cr)); - -ASSYM(EFAULT, EFAULT); -ASSYM(ENAMETOOLONG, ENAMETOOLONG); - -/* Register offsets, for stack frames. */ -ASSYM(FRAME_V0, FRAME_V0); -ASSYM(FRAME_T0, FRAME_T0); -ASSYM(FRAME_T1, FRAME_T1); -ASSYM(FRAME_T2, FRAME_T2); -ASSYM(FRAME_T3, FRAME_T3); -ASSYM(FRAME_T4, FRAME_T4); -ASSYM(FRAME_T5, FRAME_T5); -ASSYM(FRAME_T6, FRAME_T6); -ASSYM(FRAME_T7, FRAME_T7); -ASSYM(FRAME_S0, FRAME_S0); -ASSYM(FRAME_S1, FRAME_S1); -ASSYM(FRAME_S2, FRAME_S2); -ASSYM(FRAME_S3, FRAME_S3); -ASSYM(FRAME_S4, FRAME_S4); -ASSYM(FRAME_S5, FRAME_S5); -ASSYM(FRAME_S6, FRAME_S6); -ASSYM(FRAME_A3, FRAME_A3); -ASSYM(FRAME_A4, FRAME_A4); -ASSYM(FRAME_A5, FRAME_A5); -ASSYM(FRAME_T8, FRAME_T8); -ASSYM(FRAME_T9, FRAME_T9); -ASSYM(FRAME_T10, FRAME_T10); -ASSYM(FRAME_T11, FRAME_T11); -ASSYM(FRAME_RA, FRAME_RA); -ASSYM(FRAME_T12, FRAME_T12); -ASSYM(FRAME_AT, FRAME_AT); -ASSYM(FRAME_SP, FRAME_SP); -ASSYM(FRAME_FLAGS, FRAME_FLAGS); -ASSYM(FRAME_FLAGS_SYSCALL, FRAME_FLAGS_SYSCALL); - -ASSYM(FRAME_SW_SIZE, FRAME_SW_SIZE); - -ASSYM(FRAME_PS, FRAME_PS); -ASSYM(FRAME_PC, FRAME_PC); -ASSYM(FRAME_GP, FRAME_GP); -ASSYM(FRAME_A0, FRAME_A0); -ASSYM(FRAME_A1, FRAME_A1); -ASSYM(FRAME_A2, FRAME_A2); - -ASSYM(FRAME_SIZE, FRAME_SIZE); - -/* bits of the PS register */ -ASSYM(ALPHA_PSL_USERMODE, ALPHA_PSL_USERMODE); -ASSYM(ALPHA_PSL_IPL_MASK, ALPHA_PSL_IPL_MASK); -ASSYM(ALPHA_PSL_IPL_0, ALPHA_PSL_IPL_0); -ASSYM(ALPHA_PSL_IPL_SOFT, ALPHA_PSL_IPL_SOFT); -ASSYM(ALPHA_PSL_IPL_HIGH, ALPHA_PSL_IPL_HIGH); - -/* pte bits */ -ASSYM(ALPHA_L1SHIFT, ALPHA_L1SHIFT); -ASSYM(ALPHA_L2SHIFT, ALPHA_L2SHIFT); -ASSYM(ALPHA_L3SHIFT, ALPHA_L3SHIFT); -ASSYM(ALPHA_K1SEG_BASE, ALPHA_K1SEG_BASE); -ASSYM(ALPHA_PTE_VALID, ALPHA_PTE_VALID); -ASSYM(ALPHA_PTE_ASM, ALPHA_PTE_ASM); -ASSYM(ALPHA_PTE_KR, ALPHA_PTE_KR); -ASSYM(ALPHA_PTE_KW, ALPHA_PTE_KW); - -/* Kernel entries */ -ASSYM(ALPHA_KENTRY_ARITH, ALPHA_KENTRY_ARITH); -ASSYM(ALPHA_KENTRY_MM, ALPHA_KENTRY_MM); - -ASSYM(ALPHA_KENTRY_IF, ALPHA_KENTRY_IF); -ASSYM(ALPHA_KENTRY_UNA, ALPHA_KENTRY_UNA); - -ASSYM(VPTBASE, VPTBASE); -ASSYM(KERNBASE, KERNBASE); diff --git a/sys/alpha/alpha/ieee_float.c b/sys/alpha/alpha/ieee_float.c deleted file mode 100644 index 003068b..0000000 --- a/sys/alpha/alpha/ieee_float.c +++ /dev/null @@ -1,1525 +0,0 @@ -/*- - * 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. - * - */ - -/* - * An implementation of IEEE 754 floating point arithmetic supporting - * multiply, divide, addition, subtraction and conversion to and from - * integer. Probably not the fastest floating point code in the world - * but it should be pretty accurate. - * - * A special thanks to John Polstra for pointing out some problems - * with an earlier version of this code and for educating me as to the - * correct use of sticky bits. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#ifdef TEST -#include "../include/fpu.h" -#include "ieee_float.h" -#else -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sysproto.h> -#include <sys/sysent.h> -#include <sys/proc.h> -#include <machine/fpu.h> -#include <alpha/alpha/ieee_float.h> -#endif - -/* - * The number of fraction bits in a T format float. - */ -#define T_FRACBITS 52 - -/* - * The number of fraction bits in a S format float. - */ -#define S_FRACBITS 23 - -/* - * Mask the fraction part of a float to contain only those bits which - * should be in single precision number. - */ -#define S_FRACMASK ((1ULL << 52) - (1ULL << 29)) - -/* - * The number of extra zero bits we shift into the fraction part - * to gain accuracy. Two guard bits and one sticky bit are required - * to ensure accurate rounding. - */ -#define FRAC_SHIFT 3 - -/* - * Values for 1.0 and 2.0 fractions (including the extra FRAC_SHIFT - * bits). - */ -#define ONE (1ULL << (T_FRACBITS + FRAC_SHIFT)) -#define TWO (ONE + ONE) - -/* - * The maximum and minimum values for S and T format exponents. - */ -#define T_MAXEXP 0x3ff -#define T_MINEXP -0x3fe -#define S_MAXEXP 0x7f -#define S_MINEXP -0x7e - -/* - * Exponent values in registers are biased by adding this value. - */ -#define BIAS_EXP 0x3ff - -/* - * Exponent value for INF and NaN. - */ -#define NAN_EXP 0x7ff - -/* - * If this bit is set in the fraction part of a NaN, then the number - * is a quiet NaN, i.e. no traps are generated. - */ -#define QNAN_BIT (1ULL << 51) - -/* - * Return true if the number is any kind of NaN. - */ -static __inline int -isNaN(fp_register_t f) -{ - return f.t.exponent == NAN_EXP && f.t.fraction != 0; -} - -/* - * Return true if the number is a quiet NaN. - */ -static __inline int -isQNaN(fp_register_t f) -{ - return f.t.exponent == NAN_EXP && (f.t.fraction & QNAN_BIT); -} - -/* - * Return true if the number is a signalling NaN. - */ -static __inline int -isSNaN(fp_register_t f) -{ - return isNaN(f) && !isQNaN(f); -} - -/* - * Return true if the number is +/- INF. - */ -static __inline int -isINF(fp_register_t f) -{ - return f.t.exponent == NAN_EXP && f.t.fraction == 0; -} - -/* - * Return true if the number is +/- 0. - */ -static __inline int -isZERO(fp_register_t f) -{ - return f.t.exponent == 0 && f.t.fraction == 0; -} - -/* - * Return true if the number is denormalised. - */ -static __inline int -isDENORM(fp_register_t f) -{ - return f.t.exponent == 0 && f.t.fraction != 0; -} - -/* - * Extract the exponent part of a float register. If the exponent is - * zero, the number may be denormalised (if the fraction is nonzero). - * If so, return the minimum exponent for the source datatype. - */ -static __inline int -getexp(fp_register_t f, int src) -{ - int minexp[] = { S_MINEXP, 0, T_MINEXP, 0 }; - if (f.t.exponent == 0) { - if (f.t.fraction) - return minexp[src]; - else - return 0; - } - return f.t.exponent - BIAS_EXP; -} - -/* - * Extract the fraction part of a float register, shift it up a bit - * to give extra accuracy and add in the implicit 1 bit. Must be - * careful to handle denormalised numbers and zero correctly. - */ -static __inline u_int64_t -getfrac(fp_register_t f) -{ - if (f.t.exponent == 0) - return f.t.fraction << FRAC_SHIFT; - else - return (f.t.fraction << FRAC_SHIFT) | ONE; -} - -/* - * Make a float (in register format) from a sign, exponent and - * fraction, normalising and rounding as necessary. - * Return the float and set *status if any traps are generated. - */ -static fp_register_t -makefloat(int sign, int exp, u_int64_t frac, - int src, int rnd, - u_int64_t control, u_int64_t *status) -{ - fp_register_t f; - int minexp = 0, maxexp = 0, alpha = 0; - u_int64_t epsilon = 0, max = 0; - - if (frac == 0) { - f.t.sign = sign; - f.t.exponent = 0; - f.t.fraction = 0; - return f; - } - - if (frac >= TWO) { - /* - * Fraction is >= 2.0. - * Shift the fraction down, preserving the 'sticky' - * bit. - */ - while (frac >= TWO) { - frac = (frac >> 1) | (frac & 1); - exp++; - } - } else if (frac < ONE) { - /* - * Fraction is < 1.0. Shift it up. - */ - while (frac < ONE) { - frac = (frac << 1) | (frac & 1); - exp--; - } - } - - switch (src) { - case S_FORMAT: - minexp = S_MINEXP; - maxexp = S_MAXEXP; - alpha = 0xc0; - epsilon = (1ULL << (T_FRACBITS - S_FRACBITS + FRAC_SHIFT)); - max = TWO - epsilon; - break; - - case T_FORMAT: - minexp = T_MINEXP; - maxexp = T_MAXEXP; - alpha = 0x600; - epsilon = (1ULL << FRAC_SHIFT); - max = TWO - epsilon; - break; - } - - /* - * Handle underflow before rounding so that denormalised - * numbers are rounded correctly. - */ - if (exp < minexp) { - *status |= FPCR_INE; - if (control & IEEE_TRAP_ENABLE_UNF) { - *status |= FPCR_UNF; - exp += alpha; - } else { - /* denormalise */ - while (exp < minexp) { - exp++; - frac = (frac >> 1) | (frac & 1); - } - exp = minexp - 1; - } - } - - /* - * Round the fraction according to the rounding mode. - */ - if (frac & (epsilon - 1)) { - u_int64_t fraclo, frachi; - u_int64_t difflo, diffhi; - - fraclo = frac & max; - frachi = fraclo + epsilon; - switch (rnd) { - case ROUND_CHOP: - frac = fraclo; - break; - case ROUND_MINUS_INF: - if (f.t.sign) - frac = frachi; - else - frac = fraclo; - break; - case ROUND_NORMAL: - difflo = frac - fraclo; - diffhi = frachi - frac; - if (difflo < diffhi) - frac = fraclo; - else if (diffhi < difflo) - frac = frachi; - else - /* round to even */ - if (fraclo & epsilon) - frac = frachi; - else - frac = fraclo; - break; - case ROUND_PLUS_INF: - if (f.t.sign) - frac = fraclo; - else - frac = frachi; - break; - } - - if (frac == 0) - *status |= FPCR_UNF; - - /* - * Rounding up may take us to TWO if - * fraclo == (TWO - epsilon). Also If fraclo has been - * denormalised to (ONE - epsilon) then there is a - * possibility that we will round to ONE exactly. - */ - if (frac >= TWO) { - frac = (frac >> 1) & ~(epsilon - 1); - exp++; - } else if (exp == minexp - 1 && frac == ONE) { - /* Renormalise to ONE * 2^minexp */ - exp = minexp; - } - - *status |= FPCR_INE; - } - - /* - * Check for overflow and round to the correct INF as needed. - */ - if (exp > maxexp) { - *status |= FPCR_OVF | FPCR_INE; - if (control & IEEE_TRAP_ENABLE_OVF) { - exp -= alpha; - } else { - switch (rnd) { - case ROUND_CHOP: - exp = maxexp; - frac = max; - break; - case ROUND_MINUS_INF: - if (sign) { - exp = maxexp + 1; /* INF */ - frac = 0; - } else { - exp = maxexp; - frac = max; - } - break; - case ROUND_NORMAL: - exp = maxexp + 1; /* INF */ - frac = 0; - break; - case ROUND_PLUS_INF: - if (sign) { - exp = maxexp; - frac = max; - } else { - exp = maxexp + 1; /* INF */ - frac = 0; - } - break; - } - } - } - - f.t.sign = sign; - if (exp > maxexp) /* NaN, INF */ - f.t.exponent = NAN_EXP; - else if (exp < minexp) /* denorm, zero */ - f.t.exponent = 0; - else - f.t.exponent = exp + BIAS_EXP; - f.t.fraction = (frac & ~ONE) >> FRAC_SHIFT; - return f; -} - -/* - * Return the canonical quiet NaN in register format. - */ -static fp_register_t -makeQNaN(void) -{ - fp_register_t f; - f.t.sign = 0; - f.t.exponent = NAN_EXP; - f.t.fraction = QNAN_BIT; - return f; -} - -/* - * Return +/- INF. - */ -static fp_register_t -makeINF(int sign) -{ - fp_register_t f; - f.t.sign = sign; - f.t.exponent = NAN_EXP; - f.t.fraction = 0; - return f; -} - -/* - * Return +/- 0. - */ -static fp_register_t -makeZERO(int sign) -{ - fp_register_t f; - f.t.sign = sign; - f.t.exponent = 0; - f.t.fraction = 0; - return f; -} - -fp_register_t -ieee_add(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status) -{ - int shift; - int expa, expb, exp; - u_int64_t fraca, fracb, frac; - int sign, sticky; - - /* First handle NaNs */ - if (isNaN(fa) || isNaN(fb)) { - fp_register_t result; - - /* Instructions Descriptions (I) section 4.7.10.4 */ - if (isQNaN(fb)) - result = fb; - else if (isSNaN(fb)) { - result = fb; - result.t.fraction |= QNAN_BIT; - } else if (isQNaN(fa)) - result = fa; - else if (isSNaN(fa)) { - result = fa; - result.t.fraction |= QNAN_BIT; - } - - /* If either operand is a signalling NaN, trap. */ - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - - return result; - } - - /* Handle +/- INF */ - if (isINF(fa)) - if (isINF(fb)) - if (fa.t.sign != fb.t.sign) { - /* If adding -INF to +INF, generate a trap. */ - *status |= FPCR_INV; - return makeQNaN(); - } else - return fa; - else - return fa; - else if (isINF(fb)) - return fb; - - /* - * Unpack the registers. - */ - expa = getexp(fa, src); - expb = getexp(fb, src); - fraca = getfrac(fa); - fracb = getfrac(fb); - shift = expa - expb; - if (shift < 0) { - shift = -shift; - exp = expb; - sticky = (fraca & ((1ULL << shift) - 1)) != 0; - if (shift >= 64) - fraca = sticky; - else - fraca = (fraca >> shift) | sticky; - } else if (shift > 0) { - exp = expa; - sticky = (fracb & ((1ULL << shift) - 1)) != 0; - if (shift >= 64) - fracb = sticky; - else - fracb = (fracb >> shift) | sticky; - } else - exp = expa; - if (fa.t.sign) fraca = -fraca; - if (fb.t.sign) fracb = -fracb; - frac = fraca + fracb; - if (frac >> 63) { - sign = 1; - frac = -frac; - } else - sign = 0; - - /* -0 + -0 = -0 */ - if (fa.t.exponent == 0 && fa.t.fraction == 0 - && fb.t.exponent == 0 && fb.t.fraction == 0) - sign = fa.t.sign && fb.t.sign; - - return makefloat(sign, exp, frac, src, rnd, control, status); -} - -fp_register_t -ieee_sub(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status) -{ - fb.t.sign = !fb.t.sign; - return ieee_add(fa, fb, src, rnd, control, status); -} - -typedef struct { - u_int64_t lo; - u_int64_t hi; -} u_int128_t; - -#define SRL128(x, b) \ -do { \ - x.lo >>= b; \ - x.lo |= x.hi << (64 - b); \ - x.hi >>= b; \ -} while (0) - -#define SLL128(x, b) \ -do { \ - if (b >= 64) { \ - x.hi = x.lo << (b - 64); \ - x.lo = 0; \ - } else { \ - x.hi <<= b; \ - x.hi |= x.lo >> (64 - b); \ - x.lo <<= b; \ - } \ -} while (0) - -#define SUB128(a, b) \ -do { \ - int borrow = a.lo < b.lo; \ - a.lo = a.lo - b.lo; \ - a.hi = a.hi - b.hi - borrow; \ -} while (0) - -#define LESS128(a, b) (a.hi < b.hi || (a.hi == b.hi && a.lo < b.lo)) - -fp_register_t -ieee_mul(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status) -{ - int expa, expb, exp; - u_int64_t fraca, fracb, tmp; - u_int128_t frac; - int sign; - - /* First handle NaNs */ - if (isNaN(fa) || isNaN(fb)) { - fp_register_t result; - - /* Instructions Descriptions (I) section 4.7.10.4 */ - if (isQNaN(fb)) - result = fb; - else if (isSNaN(fb)) { - result = fb; - result.t.fraction |= QNAN_BIT; - } else if (isQNaN(fa)) - result = fa; - else if (isSNaN(fa)) { - result = fa; - result.t.fraction |= QNAN_BIT; - } - - /* If either operand is a signalling NaN, trap. */ - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - - return result; - } - - /* Handle INF and 0 */ - if ((isINF(fa) && isZERO(fb)) || (isZERO(fa) && isINF(fb))) { - /* INF * 0 = NaN */ - *status |= FPCR_INV; - return makeQNaN(); - } else - /* If either is INF or zero, get the sign right */ - if (isINF(fa) || isINF(fb)) - return makeINF(fa.t.sign ^ fb.t.sign); - else if (isZERO(fa) || isZERO(fb)) - return makeZERO(fa.t.sign ^ fb.t.sign); - - /* - * Unpack the registers. - */ - expa = getexp(fa, src); - expb = getexp(fb, src); - fraca = getfrac(fa); - fracb = getfrac(fb); - sign = fa.t.sign ^ fb.t.sign; - -#define LO32(x) ((x) & ((1ULL << 32) - 1)) -#define HI32(x) ((x) >> 32) - - /* - * Calculate the 128bit result of multiplying fraca and fracb. - */ - frac.lo = fraca * fracb; -#ifdef __alpha__ - /* - * The alpha has a handy instruction to find the high word. - */ - __asm__ __volatile__ ("umulh %1,%2,%0" - : "=r"(tmp) - : "r"(fraca), "r"(fracb)); - frac.hi = tmp; -#else - /* - * Do the multiply longhand otherwise. - */ - frac.hi = HI32(LO32(fraca) * HI32(fracb) - + HI32(fraca) * LO32(fracb) - + HI32(LO32(fraca) * LO32(fracb))) - + HI32(fraca) * HI32(fracb); -#endif - exp = expa + expb - (T_FRACBITS + FRAC_SHIFT); - - while (frac.hi > 0) { - int sticky; - exp++; - sticky = frac.lo & 1; - SRL128(frac, 1); - frac.lo |= sticky; - } - - return makefloat(sign, exp, frac.lo, src, rnd, control, status); -} - -static u_int128_t -divide_128(u_int128_t a, u_int128_t b) -{ - u_int128_t result; - u_int64_t bit; - int i; - - /* - * Make a couple of assumptions on the numbers passed in. The - * value in 'a' will have bits set in the upper 64 bits only - * and the number in 'b' will have zeros in the upper 64 bits. - * Also, 'b' will not be zero. - */ -#ifdef TEST - if (a.hi == 0 || b.hi != 0 || b.lo == 0) - abort(); -#endif - - /* - * Find out how many bits of zeros are at the beginning of the divisor. - */ - i = 64; - bit = 1ULL << 63; - while (i < 127) { - if (b.lo & bit) - break; - i++; - bit >>= 1; - } - - /* - * Find out how much to shift the divisor so that its msb - * matches the msb of the dividend. - */ - bit = 1ULL << 63; - while (i) { - if (a.hi & bit) - break; - i--; - bit >>= 1; - } - - result.lo = 0; - result.hi = 0; - SLL128(b, i); - - /* - * Calculate the result in two parts to avoid keeping a 128bit - * value for the result bit. - */ - if (i >= 64) { - bit = 1ULL << (i - 64); - while (bit) { - if (!LESS128(a, b)) { - result.hi |= bit; - SUB128(a, b); - if (!a.lo && !a.hi) - return result; - } - bit >>= 1; - SRL128(b, 1); - } - i = 63; - } - bit = 1ULL << i; - while (bit) { - if (!LESS128(a, b)) { - result.lo |= bit; - SUB128(a, b); - if (!a.lo && !a.hi) - return result; - } - bit >>= 1; - SRL128(b, 1); - } - - return result; -} - -fp_register_t -ieee_div(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status) -{ - int expa, expb, exp; - u_int128_t fraca, fracb, frac; - int sign; - - /* First handle NaNs, INFs and ZEROs */ - if (isNaN(fa) || isNaN(fb)) { - fp_register_t result; - - /* Instructions Descriptions (I) section 4.7.10.4 */ - if (isQNaN(fb)) - result = fb; - else if (isSNaN(fb)) { - result = fb; - result.t.fraction |= QNAN_BIT; - } else if (isQNaN(fa)) - result = fa; - else if (isSNaN(fa)) { - result = fa; - result.t.fraction |= QNAN_BIT; - } - - /* If either operand is a signalling NaN, trap. */ - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - - return result; - } - - /* Handle INF and 0 */ - if (isINF(fa) && isINF(fb)) { - *status |= FPCR_INV; - return makeQNaN(); - } else if (isZERO(fb)) - if (isZERO(fa)) { - *status |= FPCR_INV; - return makeQNaN(); - } else { - *status |= FPCR_DZE; - return makeINF(fa.t.sign ^ fb.t.sign); - } - else if (isZERO(fa)) - return makeZERO(fa.t.sign ^ fb.t.sign); - - /* - * Unpack the registers. - */ - expa = getexp(fa, src); - expb = getexp(fb, src); - fraca.hi = getfrac(fa); - fraca.lo = 0; - fracb.lo = getfrac(fb); - fracb.hi = 0; - sign = fa.t.sign ^ fb.t.sign; - - frac = divide_128(fraca, fracb); - - exp = expa - expb - (64 - T_FRACBITS - FRAC_SHIFT); - while (frac.hi > 0) { - int sticky; - exp++; - sticky = frac.lo & 1; - SRL128(frac, 1); - frac.lo |= sticky; - } - frac.lo |= 1; - - return makefloat(sign, exp, frac.lo, src, rnd, control, status); -} - -#define IEEE_TRUE 0x4000000000000000ULL -#define IEEE_FALSE 0 - -fp_register_t -ieee_cmpun(fp_register_t fa, fp_register_t fb, u_int64_t *status) -{ - fp_register_t result; - if (isNaN(fa) || isNaN(fb)) { - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - result.q = IEEE_TRUE; - } else - result.q = IEEE_FALSE; - - return result; -} - -fp_register_t -ieee_cmpeq(fp_register_t fa, fp_register_t fb, u_int64_t *status) -{ - fp_register_t result; - if (isNaN(fa) || isNaN(fb)) { - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - result.q = IEEE_FALSE; - } else { - if (isZERO(fa) && isZERO(fb)) - result.q = IEEE_TRUE; - else if (fa.q == fb.q) - result.q = IEEE_TRUE; - else - result.q = IEEE_FALSE; - } - - return result; -} - -fp_register_t -ieee_cmplt(fp_register_t fa, fp_register_t fb, u_int64_t *status) -{ - fp_register_t result; - if (isNaN(fa) || isNaN(fb)) { - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - result.q = IEEE_FALSE; - } else { - if (isZERO(fa) && isZERO(fb)) - result.q = IEEE_FALSE; - else if (fa.t.sign) { - /* fa is negative */ - if (!fb.t.sign) - /* fb is positive, return true */ - result.q = IEEE_TRUE; - else if (fa.t.exponent > fb.t.exponent) - /* fa has a larger exponent, return true */ - result.q = IEEE_TRUE; - else if (fa.t.exponent == fb.t.exponent - && fa.t.fraction > fb.t.fraction) - /* compare fractions */ - result.q = IEEE_TRUE; - else - result.q = IEEE_FALSE; - } else { - /* fa is positive */ - if (fb.t.sign) - /* fb is negative, return false */ - result.q = IEEE_FALSE; - else if (fb.t.exponent > fa.t.exponent) - /* fb has a larger exponent, return true */ - result.q = IEEE_TRUE; - else if (fa.t.exponent == fb.t.exponent - && fa.t.fraction < fb.t.fraction) - /* compare fractions */ - result.q = IEEE_TRUE; - else - result.q = IEEE_FALSE; - } - } - - return result; -} - -fp_register_t -ieee_cmple(fp_register_t fa, fp_register_t fb, u_int64_t *status) -{ - fp_register_t result; - if (isNaN(fa) || isNaN(fb)) { - if (isSNaN(fa) || isSNaN(fb)) - *status |= FPCR_INV; - result.q = IEEE_FALSE; - } else { - if (isZERO(fa) && isZERO(fb)) - result.q = IEEE_TRUE; - else if (fa.t.sign) { - /* fa is negative */ - if (!fb.t.sign) - /* fb is positive, return true */ - result.q = IEEE_TRUE; - else if (fa.t.exponent > fb.t.exponent) - /* fa has a larger exponent, return true */ - result.q = IEEE_TRUE; - else if (fa.t.exponent == fb.t.exponent - && fa.t.fraction >= fb.t.fraction) - /* compare fractions */ - result.q = IEEE_TRUE; - else - result.q = IEEE_FALSE; - } else { - /* fa is positive */ - if (fb.t.sign) - /* fb is negative, return false */ - result.q = IEEE_FALSE; - else if (fb.t.exponent > fa.t.exponent) - /* fb has a larger exponent, return true */ - result.q = IEEE_TRUE; - else if (fa.t.exponent == fb.t.exponent - && fa.t.fraction <= fb.t.fraction) - /* compare fractions */ - result.q = IEEE_TRUE; - else - result.q = IEEE_FALSE; - } - } - - return result; -} - -fp_register_t -ieee_convert_S_T(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status) -{ - /* - * Handle exceptional values. - */ - if (isNaN(f)) { - /* Instructions Descriptions (I) section 4.7.10.1 */ - f.t.fraction |= QNAN_BIT; - *status |= FPCR_INV; - } - if (isQNaN(f) || isINF(f)) - return f; - - /* - * If the number is a denormalised float, renormalise. - */ - if (isDENORM(f)) - return makefloat(f.t.sign, - getexp(f, S_FORMAT), - getfrac(f), - T_FORMAT, rnd, control, status); - else - return f; -} - -fp_register_t -ieee_convert_T_S(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status) -{ - /* - * Handle exceptional values. - */ - if (isNaN(f)) { - /* Instructions Descriptions (I) section 4.7.10.1 */ - f.t.fraction |= QNAN_BIT; - f.t.fraction &= ~S_FRACMASK; - *status |= FPCR_INV; - } - if (isQNaN(f) || isINF(f)) - return f; - - return makefloat(f.t.sign, - getexp(f, T_FORMAT), - getfrac(f), - S_FORMAT, rnd, control, status); -} - -fp_register_t -ieee_convert_Q_S(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status) -{ - u_int64_t frac = f.q; - int sign, exponent; - - if (frac >> 63) { - sign = 1; - frac = -frac; - } else - sign = 0; - - /* - * We shift up one bit to leave the sticky bit clear. This is - * possible unless frac == (1<<63), in which case the sticky - * bit is already clear. - */ - exponent = T_FRACBITS + FRAC_SHIFT; - if (frac < (1ULL << 63)) { - frac <<= 1; - exponent--; - } - - return makefloat(sign, exponent, frac, S_FORMAT, rnd, - control, status); -} - -fp_register_t -ieee_convert_Q_T(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status) -{ - u_int64_t frac = f.q; - int sign, exponent; - - if (frac >> 63) { - sign = 1; - frac = -frac; - } else - sign = 0; - - /* - * We shift up one bit to leave the sticky bit clear. This is - * possible unless frac == (1<<63), in which case the sticky - * bit is already clear. - */ - exponent = T_FRACBITS + FRAC_SHIFT; - if (frac < (1ULL << 63)) { - frac <<= 1; - exponent--; - } - - return makefloat(sign, exponent, frac, T_FORMAT, rnd, - control, status); -} - -fp_register_t -ieee_convert_T_Q(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status) -{ - u_int64_t frac; - int exp; - - /* - * Handle exceptional values. - */ - if (isNaN(f)) { - /* Instructions Descriptions (I) section 4.7.10.1 */ - if (isSNaN(f)) - *status |= FPCR_INV; - f.q = 0; - return f; - } - if (isINF(f)) { - /* Instructions Descriptions (I) section 4.7.10.1 */ - *status |= FPCR_INV; - f.q = 0; - return f; - } - - exp = getexp(f, T_FORMAT) - (T_FRACBITS + FRAC_SHIFT); - frac = getfrac(f); - - if (exp > 0) { - if (exp > 64 || frac >= (1 << (64 - exp))) - *status |= FPCR_IOV | FPCR_INE; - if (exp < 64) - frac <<= exp; - else - frac = 0; - } else if (exp < 0) { - u_int64_t mask; - u_int64_t fraclo, frachi; - u_int64_t diffhi, difflo; - exp = -exp; - if (exp > 64) { - fraclo = 0; - diffhi = 0; - difflo = 0; - if (frac) { - frachi = 1; - *status |= FPCR_INE; - } else - frachi = 0; - } else if (exp == 64) { - fraclo = 0; - if (frac) { - frachi = 1; - difflo = frac; - diffhi = -frac; - *status |= FPCR_INE; - } else { - frachi = 0; - difflo = 0; - diffhi = 0; - } - } else { - mask = (1 << exp) - 1; - fraclo = frac >> exp; - if (frac & mask) { - frachi = fraclo + 1; - difflo = frac - (fraclo << exp); - diffhi = (frachi << exp) - frac; - *status |= FPCR_INE; - } else { - frachi = fraclo; - difflo = 0; - diffhi = 0; - } - } - switch (rnd) { - case ROUND_CHOP: - frac = fraclo; - break; - case ROUND_MINUS_INF: - if (f.t.sign) - frac = frachi; - else - frac = fraclo; - break; - case ROUND_NORMAL: -#if 0 - /* - * Round to nearest. - */ - if (difflo < diffhi) - frac = fraclo; - else if (diffhi > difflo) - frac = frachi; - else if (fraclo & 1) - frac = frachi; - else - frac = fraclo; -#else - /* - * Round to zero. - */ - frac = fraclo; -#endif - break; - case ROUND_PLUS_INF: - if (f.t.sign) - frac = fraclo; - else - frac = frachi; - break; - } - } - - if (f.t.sign) { - if (frac > (1ULL << 63)) - *status |= FPCR_IOV | FPCR_INE; - frac = -frac; - } else { - if (frac > (1ULL << 63) - 1) - *status |= FPCR_IOV | FPCR_INE; - } - - f.q = frac; - return f; -} - -fp_register_t -ieee_convert_S_Q(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status) -{ - f = ieee_convert_S_T(f, rnd, control, status); - return ieee_convert_T_Q(f, rnd, control, status); -} - -#ifndef _KERNEL - -#include <stdio.h> -#include <math.h> -#include <stdlib.h> - -union value { - double d; - fp_register_t r; -}; - - -static double -random_double() -{ - union value a; - int exp; - - a.r.t.fraction = ((long long)random() & (1ULL << 20) - 1) << 32 - | random(); - exp = random() & 0x7ff; -#if 1 - if (exp == 0) - exp = 1; /* no denorms */ - else if (exp == 0x7ff) - exp = 0x7fe; /* no NaNs and INFs */ -#endif - - a.r.t.exponent = exp; - a.r.t.sign = random() & 1; - return a.d; -} - -static float -random_float() -{ - union value a; - int exp; - - a.r.t.fraction = ((long)random() & (1ULL << 23) - 1) << 29; - exp = random() & 0xff; -#if 1 - if (exp == 0) - exp = 1; /* no denorms */ - else if (exp == 0xff) - exp = 0xfe; /* no NaNs and INFs */ -#endif - - /* map exponent from S to T format */ - if (exp == 255) - a.r.t.exponent = 0x7ff; - else if (exp & 0x80) - a.r.t.exponent = 0x400 + (exp & 0x7f); - else if (exp) - a.r.t.exponent = 0x380 + exp; - else - a.r.t.exponent = 0; - a.r.t.sign = random() & 1; - - return a.d; -} - -/* - * Ignore epsilon errors - */ -int -equal_T(union value a, union value b) -{ - if (isZERO(a.r) && isZERO(b.r)) - return 1; - if (a.r.t.sign != b.r.t.sign) - return 0; - if (a.r.t.exponent != b.r.t.exponent) - return 0; - - return a.r.t.fraction == b.r.t.fraction; -} - -int -equal_S(union value a, union value b) -{ - int64_t epsilon = 1ULL << 29; - - if (isZERO(a.r) && isZERO(b.r)) - return 1; - if (a.r.t.sign != b.r.t.sign) - return 0; - if (a.r.t.exponent != b.r.t.exponent) - return 0; - - return ((a.r.t.fraction & ~(epsilon-1)) - == (b.r.t.fraction & ~(epsilon-1))); -} - -#define ITER 1000000 - -static void -test_double_add() -{ - union value a, b, c, x; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.d = random_double(); - b.d = random_double(); - status = 0; - c.r = ieee_add(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r) || isDENORM(c.r)) - continue; - x.d = a.d + b.d; - if (!equal_T(c, x)) { - printf("bad double add, %g + %g = %g (should be %g)\n", - a.d, b.d, c.d, x.d); - c.r = ieee_add(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - } - } -} - -static void -test_single_add() -{ - union value a, b, c, x, t; - float xf; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { -#if 0 - if (i == 0) { - a.r.q = 0xb33acf292ca49700ULL; - b.r.q = 0xcad3191058a693aeULL; - } -#endif - a.d = random_float(); - b.d = random_float(); - status = 0; - c.r = ieee_add(a.r, b.r, S_FORMAT, ROUND_NORMAL, - 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r) || isDENORM(c.r)) - continue; - xf = a.d + b.d; - x.d = xf; - t.r = ieee_convert_S_T(c.r, ROUND_NORMAL, 0, &status); - if (!equal_S(t, x)) { - printf("bad single add, %g + %g = %g (should be %g)\n", - a.d, b.d, t.d, x.d); - c.r = ieee_add(a.r, b.r, S_FORMAT, ROUND_NORMAL, - 0, &status); - } - } -} - -static void -test_double_mul() -{ - union value a, b, c, x; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.d = random_double(); - b.d = random_double(); - status = 0; - c.r = ieee_mul(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r) || isDENORM(c.r)) - continue; - x.d = a.d * b.d; - if (!equal_T(c, x)) { - printf("bad double mul, %g * %g = %g (should be %g)\n", - a.d, b.d, c.d, x.d); - c.r = ieee_mul(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - } - } -} - -static void -test_single_mul() -{ - union value a, b, c, x, t; - float xf; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.d = random_double(); - b.d = random_double(); - status = 0; - c.r = ieee_mul(a.r, b.r, S_FORMAT, ROUND_NORMAL, - 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r) || isDENORM(c.r)) - continue; - xf = a.d * b.d; - x.d = xf; - t.r = ieee_convert_S_T(c.r, ROUND_NORMAL, 0, &status); - if (!equal_S(t, x)) { - printf("bad single mul, %g * %g = %g (should be %g)\n", - a.d, b.d, t.d, x.d); - c.r = ieee_mul(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - } - } -} - -static void -test_double_div() -{ - union value a, b, c, x; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.d = random_double(); - b.d = random_double(); - status = 0; - c.r = ieee_div(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r) || isDENORM(c.r)) - continue; - x.d = a.d / b.d; - if (!equal_T(c, x) && !isZERO(x.r)) { - printf("bad double div, %g / %g = %g (should be %g)\n", - a.d, b.d, c.d, x.d); - c.r = ieee_div(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - } - } -} - -static void -test_single_div() -{ - union value a, b, c, x, t; - float xf; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.d = random_double(); - b.d = random_double(); - status = 0; - c.r = ieee_div(a.r, b.r, S_FORMAT, ROUND_NORMAL, - 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r) || isDENORM(c.r)) - continue; - xf = a.d / b.d; - x.d = xf; - t.r = ieee_convert_S_T(c.r, ROUND_NORMAL, 0, &status); - if (!equal_S(t, x)) { - printf("bad single div, %g / %g = %g (should be %g)\n", - a.d, b.d, t.d, x.d); - c.r = ieee_mul(a.r, b.r, T_FORMAT, ROUND_NORMAL, - 0, &status); - } - } -} - -static void -test_convert_int_to_double() -{ - union value a, c, x; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.r.q = (u_int64_t)random() << 32 - | random(); - status = 0; - c.r = ieee_convert_Q_T(a.r, ROUND_NORMAL, 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r)) - continue; - x.d = (double) a.r.q; - if (c.d != x.d) { - printf("bad convert double, (double)%qx = %g (should be %g)\n", - a.r.q, c.d, x.d); - c.r = ieee_convert_Q_T(a.r, ROUND_NORMAL, 0, &status); - } - } -} - -static void -test_convert_int_to_single() -{ - union value a, c, x, t; - float xf; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.r.q = (unsigned long long)random() << 32 - | random(); - status = 0; - c.r = ieee_convert_Q_S(a.r, ROUND_NORMAL, 0, &status); - /* ignore NaN and INF */ - if (isNaN(c.r) || isINF(c.r)) - continue; - xf = (float) a.r.q; - x.d = xf; - t.r = ieee_convert_S_T(c.r, ROUND_NORMAL, 0, &status); - if (t.d != x.d) { - printf("bad convert single, (double)%qx = %g (should be %g)\n", - a.r.q, c.d, x.d); - c.r = ieee_convert_Q_S(a.r, ROUND_NORMAL, 0, &status); - } - } -} - -static void -test_convert_double_to_int() -{ - union value a, c; - u_int64_t status = 0; - int i; - - for (i = 0; i < ITER; i++) { - a.d = random_double(); - status = 0; - c.r = ieee_convert_T_Q(a.r, ROUND_NORMAL, 0, &status); - if ((int)c.r.q != (int)a.d) { - printf("bad convert double, (int)%g = %d (should be %d)\n", - a.d, (int)c.r.q, (int)a.d); - c.r = ieee_convert_T_Q(a.r, ROUND_NORMAL, 0, &status); - } - } -} - -int -main(int argc, char* argv[]) -{ - srandom(0); - - test_double_div(); - test_single_div(); - test_double_add(); - test_single_add(); - test_double_mul(); - test_single_mul(); - test_convert_int_to_double(); - test_convert_int_to_single(); -#if 0 - /* x86 generates SIGFPE on overflows. */ - test_convert_double_to_int(); -#endif - - return 0; -} - -#endif diff --git a/sys/alpha/alpha/ieee_float.h b/sys/alpha/alpha/ieee_float.h deleted file mode 100644 index ae5b870..0000000 --- a/sys/alpha/alpha/ieee_float.h +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#define S_FORMAT 0 /* IEEE single */ -#define T_FORMAT 2 /* IEEE double */ -#define Q_FORMAT 3 /* 64 bit fixed */ - -#define ROUND_CHOP 0 /* truncate fraction */ -#define ROUND_MINUS_INF 1 /* round to -INF */ -#define ROUND_NORMAL 2 /* round to nearest */ -#define ROUND_PLUS_INF 3 /* round to +INF */ - -typedef union fp_register { - struct { - u_int64_t fraction: 52; - u_int64_t exponent: 11; - u_int64_t sign: 1; - } t; - u_int64_t q; -} fp_register_t; - -fp_register_t -ieee_add(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_sub(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_mul(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_div(fp_register_t fa, fp_register_t fb, - int src, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_cmpun(fp_register_t fa, fp_register_t fb, u_int64_t *status); - -fp_register_t -ieee_cmpeq(fp_register_t fa, fp_register_t fb, u_int64_t *status); - -fp_register_t -ieee_cmplt(fp_register_t fa, fp_register_t fb, u_int64_t *status); - -fp_register_t -ieee_cmple(fp_register_t fa, fp_register_t fb, u_int64_t *status); - -fp_register_t -ieee_convert_S_T(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_convert_T_S(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_convert_Q_T(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_convert_Q_S(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_convert_T_Q(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status); - -fp_register_t -ieee_convert_S_Q(fp_register_t f, int rnd, - u_int64_t control, u_int64_t *status); - diff --git a/sys/alpha/alpha/in_cksum.c b/sys/alpha/alpha/in_cksum.c deleted file mode 100644 index aa9d939..0000000 --- a/sys/alpha/alpha/in_cksum.c +++ /dev/null @@ -1,240 +0,0 @@ -/* $NetBSD: in_cksum.c,v 1.7 1997/09/02 13:18:15 thorpej Exp $ */ -/*- - * Copyright (c) 1988, 1992, 1993 - * The Regents of the University of California. All rights reserved. - * Copyright (c) 1996 - * Matt Thomas <matt@3am-software.com> - * - * 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. - * - * @(#)in_cksum.c 8.1 (Berkeley) 6/10/93 - */ - -#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/mbuf.h> -#include <sys/systm.h> -#include <netinet/in_systm.h> -#include <netinet/in.h> -#include <netinet/ip.h> -#include <machine/in_cksum.h> - -/* - * Checksum routine for Internet Protocol family headers - * (Portable Alpha version). - * - * This routine is very heavily used in the network - * code and should be modified for each CPU to be as fast as possible. - */ - -#define ADDCARRY(x) (x > 65535 ? x -= 65535 : x) -#define REDUCE32 \ - { \ - q_util.q = sum; \ - sum = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ - } -#define REDUCE16 \ - { \ - q_util.q = sum; \ - l_util.l = q_util.s[0] + q_util.s[1] + q_util.s[2] + q_util.s[3]; \ - sum = l_util.s[0] + l_util.s[1]; \ - ADDCARRY(sum); \ - } - -static const u_int32_t in_masks[] = { - /*0 bytes*/ /*1 byte*/ /*2 bytes*/ /*3 bytes*/ - 0x00000000, 0x000000FF, 0x0000FFFF, 0x00FFFFFF, /* offset 0 */ - 0x00000000, 0x0000FF00, 0x00FFFF00, 0xFFFFFF00, /* offset 1 */ - 0x00000000, 0x00FF0000, 0xFFFF0000, 0xFFFF0000, /* offset 2 */ - 0x00000000, 0xFF000000, 0xFF000000, 0xFF000000, /* offset 3 */ -}; - -union l_util { - u_int16_t s[2]; - u_int32_t l; -}; -union q_util { - u_int16_t s[4]; - u_int32_t l[2]; - u_int64_t q; -}; - -static u_int64_t -in_cksumdata(const u_int32_t *lw, int len) -{ - u_int64_t sum = 0; - u_int64_t prefilled; - int offset; - union q_util q_util; - - if ((3 & (long) lw) == 0 && len == 20) { - sum = (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3] + lw[4]; - REDUCE32; - return sum; - } - - if ((offset = 3 & (long) lw) != 0) { - const u_int32_t *masks = in_masks + (offset << 2); - lw = (u_int32_t *) (((long) lw) - offset); - sum = *lw++ & masks[len >= 3 ? 3 : len]; - len -= 4 - offset; - if (len <= 0) { - REDUCE32; - return sum; - } - } -#if 0 - /* - * Force to cache line boundary. - */ - offset = 32 - (0x1f & (long) lw); - if (offset < 32 && len > offset) { - len -= offset; - if (4 & offset) { - sum += (u_int64_t) lw[0]; - lw += 1; - } - if (8 & offset) { - sum += (u_int64_t) lw[0] + lw[1]; - lw += 2; - } - if (16 & offset) { - sum += (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3]; - lw += 4; - } - } -#endif - /* - * access prefilling to start load of next cache line. - * then add current cache line - * save result of prefilling for loop iteration. - */ - prefilled = lw[0]; - while ((len -= 32) >= 4) { - u_int64_t prefilling = lw[8]; - sum += prefilled + lw[1] + lw[2] + lw[3] - + lw[4] + lw[5] + lw[6] + lw[7]; - lw += 8; - prefilled = prefilling; - } - if (len >= 0) { - sum += prefilled + lw[1] + lw[2] + lw[3] - + lw[4] + lw[5] + lw[6] + lw[7]; - lw += 8; - } else { - len += 32; - } - while ((len -= 16) >= 0) { - sum += (u_int64_t) lw[0] + lw[1] + lw[2] + lw[3]; - lw += 4; - } - len += 16; - while ((len -= 4) >= 0) { - sum += (u_int64_t) *lw++; - } - len += 4; - if (len > 0) - sum += (u_int64_t) (in_masks[len] & *lw); - REDUCE32; - return sum; -} - -u_short -in_addword(u_short a, u_short b) -{ - u_int64_t sum = a + b; - - ADDCARRY(sum); - return (sum); -} - -u_short -in_pseudo(u_int32_t a, u_int32_t b, u_int32_t c) -{ - u_int64_t sum; - union q_util q_util; - union l_util l_util; - - sum = (u_int64_t) a + b + c; - REDUCE16; - return (sum); -} - -u_short -in_cksum_skip(struct mbuf *m, int len, int skip) -{ - u_int64_t sum = 0; - int mlen = 0; - int clen = 0; - caddr_t addr; - union q_util q_util; - union l_util l_util; - - len -= skip; - for (; skip && m; m = m->m_next) { - if (m->m_len > skip) { - mlen = m->m_len - skip; - addr = mtod(m, caddr_t) + skip; - goto skip_start; - } else { - skip -= m->m_len; - } - } - - for (; m && len; m = m->m_next) { - if (m->m_len == 0) - continue; - mlen = m->m_len; - addr = mtod(m, caddr_t); -skip_start: - if (len < mlen) - mlen = len; - if ((clen ^ (long) addr) & 1) - sum += in_cksumdata((const u_int32_t *)addr, mlen) << 8; - else - sum += in_cksumdata((const u_int32_t *)addr, mlen); - - clen += mlen; - len -= mlen; - } - REDUCE16; - return (~sum & 0xffff); -} - -u_int in_cksum_hdr(const struct ip *ip) -{ - u_int64_t sum = in_cksumdata((const u_int32_t *)ip, sizeof(struct ip)); - union q_util q_util; - union l_util l_util; - - REDUCE16; - return (~sum & 0xffff); -} diff --git a/sys/alpha/alpha/interrupt.c b/sys/alpha/alpha/interrupt.c deleted file mode 100644 index 0f5ff82..0000000 --- a/sys/alpha/alpha/interrupt.c +++ /dev/null @@ -1,509 +0,0 @@ -/* $NetBSD: interrupt.c,v 1.23 1998/02/24 07:38:01 thorpej Exp $ */ -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Authors: 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. - */ -/*- - * Additional Copyright (c) 1997 by Matthew Jacob for NASA/Ames Research Center. - * Redistribute and modify at will, leaving only this additional copyright - * notice. - */ - -#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -/* __KERNEL_RCSID(0, "$NetBSD: interrupt.c,v 1.23 1998/02/24 07:38:01 thorpej Exp $");*/ -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/interrupt.h> -#include <sys/kdb.h> -#include <sys/kernel.h> -#include <sys/ktr.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/mutex.h> -#include <sys/proc.h> -#include <sys/sched.h> -#include <sys/smp.h> -#include <sys/unistd.h> -#include <sys/vmmeter.h> - -#include <machine/bwx.h> -#include <machine/cpuconf.h> -#include <machine/frame.h> -#include <machine/intr.h> -#include <machine/md_var.h> -#include <machine/reg.h> -#include <machine/rpb.h> -#include <machine/smp.h> - -#ifdef EVCNT_COUNTERS -struct evcnt clock_intr_evcnt; /* event counter for clock intrs. */ -#else -#include <machine/intrcnt.h> -#endif - -volatile int mc_expected, mc_received; - -static void -dummy_perf(unsigned long vector, struct trapframe *framep) -{ - printf("performance interrupt!\n"); -} - -void (*perf_irq)(unsigned long, struct trapframe *) = dummy_perf; - - -static u_int schedclk2; -static void alpha_clock_interrupt(struct trapframe *framep); - -void -interrupt(a0, a1, a2, framep) - unsigned long a0, a1, a2; - struct trapframe *framep; -{ - struct thread *td; -#ifdef SMP - register_t s; -#endif - - /* - * Find our per-cpu globals. - */ -#ifdef SMP - s = intr_disable(); -#endif - pcpup = (struct pcpu *) alpha_pal_rdval(); - td = curthread; -#ifdef SMP - td->td_md.md_kernnest++; - intr_restore(s); -#endif - atomic_add_int(&td->td_intr_nesting_level, 1); - -#if KSTACK_GUARD_PAGES == 0 -#ifndef SMP - { - if ((caddr_t) framep < (caddr_t) td->td_pcb + 1024) { - panic("possible stack overflow\n"); - } - } -#endif -#endif - - framep->tf_regs[FRAME_TRAPARG_A0] = a0; - framep->tf_regs[FRAME_TRAPARG_A1] = a1; - framep->tf_regs[FRAME_TRAPARG_A2] = a2; - switch (a0) { -#ifdef SMP - case ALPHA_INTR_XPROC: /* interprocessor interrupt */ - CTR0(KTR_INTR|KTR_SMP, "interprocessor interrupt"); - smp_handle_ipi(framep); /* note: lock not taken */ - break; -#endif - - case ALPHA_INTR_CLOCK: /* clock interrupt */ - CTR0(KTR_INTR, "clock interrupt"); - alpha_clock_interrupt(framep); - break; - - case ALPHA_INTR_ERROR: /* Machine Check or Correctable Error */ - a0 = alpha_pal_rdmces(); - if (platform.mcheck_handler) - (*platform.mcheck_handler)(a0, framep, a1, a2); - else - machine_check(a0, framep, a1, a2); - break; - - case ALPHA_INTR_DEVICE: /* I/O device interrupt */ - PCPU_LAZY_INC(cnt.v_intr); - if (platform.iointr) - (*platform.iointr)(framep, a1); - break; - - case ALPHA_INTR_PERF: /* interprocessor interrupt */ - perf_irq(a1, framep); - break; - - case ALPHA_INTR_PASSIVE: -#if 0 - printf("passive release interrupt vec 0x%lx (ignoring)\n", a1); -#endif - break; - - default: - panic("unexpected interrupt: type 0x%lx vec 0x%lx a2 0x%lx\n", - a0, a1, a2); - /* NOTREACHED */ - } - atomic_subtract_int(&td->td_intr_nesting_level, 1); -} - -void -set_iointr(niointr) - void (*niointr)(void *, unsigned long); -{ - if (platform.iointr) - panic("set iointr twice"); - platform.iointr = niointr; -} - - -void -machine_check(mces, framep, vector, param) - unsigned long mces; - struct trapframe *framep; - unsigned long vector, param; -{ - const char *type; - - /* Make sure it's an error we know about. */ - if ((mces & (ALPHA_MCES_MIP|ALPHA_MCES_SCE|ALPHA_MCES_PCE)) == 0) { - type = "fatal machine check or error (unknown type)"; - goto fatal; - } - - /* Machine checks. */ - if (mces & ALPHA_MCES_MIP) { - /* If we weren't expecting it, then we punt. */ - if (!mc_expected) { - type = "unexpected machine check"; - goto fatal; - } - - mc_expected = 0; - mc_received = 1; - } - - /* System correctable errors. */ - if (mces & ALPHA_MCES_SCE) - printf("Warning: received system correctable error.\n"); - - /* Processor correctable errors. */ - if (mces & ALPHA_MCES_PCE) - printf("Warning: received processor correctable error.\n"); - - /* Clear pending machine checks and correctable errors */ - alpha_pal_wrmces(mces); - return; - -fatal: - /* Clear pending machine checks and correctable errors */ - alpha_pal_wrmces(mces); - - printf("\n"); - printf("%s:\n", type); - printf("\n"); - printf(" mces = 0x%lx\n", mces); - printf(" vector = 0x%lx\n", vector); - printf(" param = 0x%lx\n", param); - printf(" pc = 0x%lx\n", framep->tf_regs[FRAME_PC]); - printf(" ra = 0x%lx\n", framep->tf_regs[FRAME_RA]); - printf(" curproc = %p\n", curproc); - if (curproc != NULL) - printf(" pid = %d, comm = %s\n", curproc->p_pid, - curproc->p_comm); - printf("\n"); -#ifdef KDB - kdb_trap(ALPHA_KENTRY_MM, mces, framep); -#endif - panic("machine check"); -} - -int -badaddr(addr, size) - void *addr; - size_t size; -{ - return(badaddr_read(addr, size, NULL)); -} - -int -badaddr_read(addr, size, rptr) - void *addr; - size_t size; - void *rptr; -{ - long rcpt; - - /* Get rid of any stale machine checks that have been waiting. */ - alpha_pal_draina(); - - /* Tell the trap code to expect a machine check. */ - mc_received = 0; - mc_expected = 1; - - /* Read from the test address, and make sure the read happens. */ - alpha_mb(); - switch (size) { - case sizeof (u_int8_t): - if (alpha_implver() >= ALPHA_IMPLVER_EV5 - && alpha_amask(ALPHA_AMASK_BWX) == 0) - rcpt = ldbu((vm_offset_t)addr); - else - rcpt = *(volatile u_int8_t *)addr; - break; - - case sizeof (u_int16_t): - if (alpha_implver() >= ALPHA_IMPLVER_EV5 - && alpha_amask(ALPHA_AMASK_BWX) == 0) - rcpt = ldwu((vm_offset_t)addr); - else - rcpt = *(volatile u_int16_t *)addr; - break; - - case sizeof (u_int32_t): - rcpt = *(volatile u_int32_t *)addr; - break; - - case sizeof (u_int64_t): - rcpt = *(volatile u_int64_t *)addr; - break; - - default: - panic("badaddr: invalid size (%ld)\n", size); - } - alpha_mb(); - alpha_mb(); /* magic for ev5 2100A & maybe more */ - - /* Make sure we took the machine check, if we caused one. */ - alpha_pal_draina(); - - /* disallow further machine checks */ - mc_expected = 0; - - if (rptr && mc_received == 0) { - switch (size) { - case sizeof (u_int8_t): - *(volatile u_int8_t *)rptr = rcpt; - break; - - case sizeof (u_int16_t): - *(volatile u_int16_t *)rptr = rcpt; - break; - - case sizeof (u_int32_t): - *(volatile u_int32_t *)rptr = rcpt; - break; - - case sizeof (u_int64_t): - *(volatile u_int64_t *)rptr = rcpt; - break; - } - } - /* Return non-zero (i.e. true) if it's a bad address. */ - return (mc_received); -} - -#define HASHVEC(vector) ((vector) % 31) - -LIST_HEAD(alpha_intr_list, alpha_intr); - -struct alpha_intr { - LIST_ENTRY(alpha_intr) list; /* chain handlers in this hash bucket */ - uintptr_t vector; /* vector to match */ - struct intr_event *ie; /* interrupt event structure */ - volatile long *cntp; /* interrupt counter */ - void (*disable)(uintptr_t); -}; - -static struct mtx alpha_intr_hash_lock; -static struct alpha_intr_list alpha_intr_hash[31]; - -static void ithds_init(void *dummy); - -static void -ithds_init(void *dummy) -{ - - mtx_init(&alpha_intr_hash_lock, "intr table", NULL, MTX_SPIN); -} -SYSINIT(ithds_init, SI_SUB_INTR, SI_ORDER_SECOND, ithds_init, NULL); - -int -alpha_setup_intr(const char *name, uintptr_t vector, driver_intr_t handler, void *arg, - enum intr_type flags, void **cookiep, volatile long *cntp, - void (*disable)(uintptr_t), void (*enable)(uintptr_t)) -{ - int h = HASHVEC(vector); - struct alpha_intr *i; - int errcode; - - /* - * XXX - Can we have more than one device on a vector? If so, we have - * a race condition here that needs to be worked around similar to - * the fashion done in the i386 inthand_add() function. - */ - - /* First, check for an existing hash table entry for this vector. */ - mtx_lock_spin(&alpha_intr_hash_lock); - for (i = LIST_FIRST(&alpha_intr_hash[h]); i && i->vector != vector; - i = LIST_NEXT(i, list)) - ; /* nothing */ - mtx_unlock_spin(&alpha_intr_hash_lock); - - if (i == NULL) { - /* None was found, so create an entry. */ - i = malloc(sizeof(struct alpha_intr), M_DEVBUF, M_NOWAIT); - if (i == NULL) - return ENOMEM; - i->vector = vector; - i->cntp = cntp; - i->disable = disable; - errcode = intr_event_create(&i->ie, (void *)vector, 0, - (void (*)(void *))enable, "intr:"); - if (errcode) { - free(i, M_DEVBUF); - return errcode; - } - - mtx_lock_spin(&alpha_intr_hash_lock); - LIST_INSERT_HEAD(&alpha_intr_hash[h], i, list); - mtx_unlock_spin(&alpha_intr_hash_lock); - } - - /* Second, add this handler. */ - return (intr_event_add_handler(i->ie, name, handler, arg, - intr_priority(flags), flags, cookiep)); -} - -int -alpha_teardown_intr(void *cookie) -{ - - return (intr_event_remove_handler(cookie)); -} - -/* - * XXX: Alpha doesn't count stray interrupts like some of the other archs. - */ -void -alpha_dispatch_intr(void *frame, unsigned long vector) -{ - int h = HASHVEC(vector); - struct alpha_intr *i; - struct intr_event *ie; - struct intr_handler *ih; - int error, thread; - - /* - * Walk the hash bucket for this vector looking for this vector's - * interrupt structure. - */ - for (i = LIST_FIRST(&alpha_intr_hash[h]); i && i->vector != vector; - i = LIST_NEXT(i, list)) - ; /* nothing */ - - /* No interrupt structure for this vector. */ - if (i == NULL) - return; - - ie = i->ie; - KASSERT(ie != NULL, ("interrupt structure without an event")); - - /* - * As an optimization, if an event has no handlers, don't - * schedule it to run. - */ - if (TAILQ_EMPTY(&ie->ie_handlers)) - return; - - atomic_add_long(i->cntp, 1); - - /* - * It seems that we need to return from an interrupt back to PAL - * on the same CPU that received the interrupt, so pin the interrupted - * thread to the current CPU until we return from the interrupt. - */ - sched_pin(); - - /* Execute all fast interrupt handlers directly. */ - thread = 0; - critical_enter(); - TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) { - if (!(ih->ih_flags & IH_FAST)) { - thread = 1; - continue; - } - CTR4(KTR_INTR, "%s: exec %p(%p) for %s", __func__, - ih->ih_handler, ih->ih_argument, ih->ih_name); - ih->ih_handler(ih->ih_argument); - } - critical_exit(); - - /* - * If the ithread needs to run, disable the source and schedule the - * thread. - */ - if (thread) { - if (i->disable) { - CTR1(KTR_INTR, - "alpha_dispatch_intr: disabling vector 0x%x", - i->vector); - i->disable(i->vector); - } - error = intr_event_schedule_thread(ie); - KASSERT(error == 0, ("got an impossible stray interrupt")); - } - sched_unpin(); -} - -static void -alpha_clock_interrupt(struct trapframe *framep) -{ - - PCPU_LAZY_INC(cnt.v_intr); -#ifdef EVCNT_COUNTERS - clock_intr_evcnt.ev_count++; -#else - intrcnt[INTRCNT_CLOCK]++; -#endif - if (platform.clockintr) { - critical_enter(); -#ifdef SMP - /* - * Only one processor drives the actual timer. - */ - if (PCPU_GET(cpuid) == 0) { -#endif - (*platform.clockintr)(TRAPF_USERMODE(framep), - TRAPF_PC(framep)); - - /* Bump stathz divider. */ - schedclk2++; -#ifdef SMP - } else - hardclock_cpu(TRAPF_USERMODE(framep)); -#endif - if (profprocs != 0) - profclock(TRAPF_USERMODE(framep), TRAPF_PC(framep)); - - /* divide hz (1024) by 8 to get stathz (128) */ - if ((schedclk2 & 0x7) == 0) - statclock(TRAPF_USERMODE(framep)); - critical_exit(); - } -} diff --git a/sys/alpha/alpha/locore.s b/sys/alpha/alpha/locore.s deleted file mode 100644 index d96777a..0000000 --- a/sys/alpha/alpha/locore.s +++ /dev/null @@ -1,372 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include "opt_compat.h" - -#include <machine/asm.h> -#include <sys/syscall.h> -#include <assym.s> - -#ifndef EVCNT_COUNTERS -#define _LOCORE -#include <machine/intrcnt.h> -#endif - -/* - * PTmap is recursive pagemap at top of virtual address space. - * Within PTmap, the lev1 and lev0 page tables can be found. - */ - .globl PTmap,PTlev2,PTlev1,PTlev1pte - .equ PTmap,VPTBASE - .equ PTlev2,PTmap + (PTLEV1I << ALPHA_L2SHIFT) - .equ PTlev1,PTlev2 + (PTLEV1I << ALPHA_L3SHIFT) - .equ PTlev1pte,PTlev1 + (PTLEV1I * PTESIZE) - - .globl kernbase - .equ kernbase,KERNBASE - -/* - * Perform actions necessary to switch to a new context. The - * hwpcb should be in a0. - */ -#define SWITCH_CONTEXT \ - /* Make a note of the context we're running on. */ \ - stq a0, PC_CURPCB(pcpup); \ - \ - /* Swap in the new context. */ \ - call_pal PAL_OSF1_swpctx - - .text - - NESTED(locorestart, 1, 0, ra, 0, 0) - - br pv,1f -1: LDGP(pv) - - /* Load KGP with current GP. */ - or a0,zero,s0 /* save pfn */ - or gp,zero,a0 - call_pal PAL_OSF1_wrkgp /* clobbers a0, t0, t8-t11 */ - or s0,zero,a0 /* restore pfn */ - - /* - * Call alpha_init() to do pre-main initialization. - * alpha_init() gets the arguments we were called with, - * which are already in a0, a1, a2, a3, and a4. - */ - CALL(alpha_init) - - /* Set up the virtual page table pointer. */ - ldiq a0, VPTBASE - call_pal PAL_OSF1_wrvptptr /* clobbers a0, t0, t8-t11 */ - - /* - * Initialise pcpup. - */ - call_pal PAL_OSF1_rdval /* clobbers t0, t8-t11 */ - mov v0, pcpup - - /* - * Switch to proc0's PCB. - */ - lda t0,thread0 /* get phys addr of pcb */ - ldq a0,TD_MD_PCBPADDR(t0) - SWITCH_CONTEXT - - /* - * We've switched to a new page table base, so invalidate the TLB - * and I-stream. This happens automatically everywhere but here. - */ - ldiq a0, -2 /* TBIA */ - call_pal PAL_OSF1_tbi - call_pal PAL_imb - - CALL(mi_startup) /* go to mi_startup()! */ - - /* NOTREACHED */ - - END(locorestart) - -#ifdef SMP - /* - * Secondary processors start executing here. They will have their - * unique value set to point at the per-cpu structure and will - * be executing on their private idle stack. - */ - NESTED(smp_init_secondary_glue, 1, 0, ra, 0, 0) - - br pv, 1f -1: LDGP(pv) - - call_pal PAL_rdunique /* initialise pcpup */ - mov v0, pcpup - - ldq a0, PC_IDLEPCBPHYS(pcpup) /* switch to idle ctx */ - call_pal PAL_OSF1_swpctx - - /* Load KGP with current GP. */ - or gp,zero,a0 - call_pal PAL_OSF1_wrkgp /* clobbers a0, t0, t8-t11 */ - - CALL(smp_init_secondary) /* never returns */ - - /* NOTREACHED */ - - call_pal PAL_halt - - END(smp_init_secondary_glue) -#endif - -/**************************************************************************/ - -/* - * Signal "trampoline" code. Invoked from RTE setup by sendsig(). - * - * On entry, stack & registers look like: - * - * a0 signal number - * a1 pointer to siginfo_t - * a2 pointer to signal context frame (scp) - * a3 address of handler - * sp+0 saved hardware state - * . - * . - * scp+0 beginning of signal context frame - */ - -NESTED(sigcode,0,0,ra,0,0) - lda sp, -16(sp) /* save the sigcontext pointer */ - stq a2, 0(sp) - jsr ra, (t12) /* call the signal handler (t12==pv) */ - ldq a0, 0(sp) /* get the sigcontext pointer */ - lda sp, 16(sp) - ldiq v0, SYS_sigreturn - call_pal PAL_OSF1_callsys /* and call sigreturn() with it. */ - mov v0, a0 /* if that failed, get error code */ - ldiq v0, SYS_exit - call_pal PAL_OSF1_callsys /* and call exit() with it. */ - END(sigcode) - -#ifdef COMPAT_43 -NESTED(osigcode,0,0,ra,0,0) - lda sp, -16(sp) /* save the sigcontext pointer */ - stq a2, 0(sp) - jsr ra, (t12) /* call the signal handler (t12==pv) */ - ldq a0, 0(sp) /* get the sigcontext pointer */ - lda sp, 16(sp) - ldiq v0, 103 /* Old 3.x SYS_sigreturn */ - call_pal PAL_OSF1_callsys /* and call sigreturn() with it. */ - mov v0, a0 /* if that failed, get error code */ - ldiq v0, SYS_exit - call_pal PAL_OSF1_callsys /* and call exit() with it. */ - END(osigcode) -#endif - -#ifdef COMPAT_FREEBSD4 -NESTED(freebsd4_sigcode,0,0,ra,0,0) - lda sp, -16(sp) /* save the sigcontext pointer */ - stq a2, 0(sp) - jsr ra, (t12) /* call the signal handler (t12==pv) */ - ldq a0, 0(sp) /* get the sigcontext pointer */ - lda sp, 16(sp) - ldiq v0, 344 /* Old 4.x SYS_sigreturn */ - call_pal PAL_OSF1_callsys /* and call sigreturn() with it. */ - mov v0, a0 /* if that failed, get error code */ - ldiq v0, SYS_exit - call_pal PAL_OSF1_callsys /* and call exit() with it. */ - END(freebsd4_sigcode) -#endif -EXPORT(esigcode) /* end of all sigcode */ - - .data -EXPORT(szsigcode) - .long esigcode-sigcode -#ifdef COMPAT_43 -EXPORT(szosigcode) - .long esigcode-osigcode -#endif -#ifdef COMPAT_FREEBSD4 -EXPORT(szfreebsd4_sigcode) - .long esigcode-freebsd4_sigcode -#endif - .text - -/**************************************************************************/ - -/* - * savefpstate: Save a process's floating point state. - * - * Arguments: - * a0 'struct fpstate *' to save into - */ - -LEAF(savefpstate, 1) - LDGP(pv) - /* save all of the FP registers */ - lda t1, FPREG_FPR_REGS(a0) /* get address of FP reg. save area */ - stt $f0, (0 * 8)(t1) /* save first register, using hw name */ - stt $f1, (1 * 8)(t1) /* etc. */ - stt $f2, (2 * 8)(t1) - stt $f3, (3 * 8)(t1) - stt $f4, (4 * 8)(t1) - stt $f5, (5 * 8)(t1) - stt $f6, (6 * 8)(t1) - stt $f7, (7 * 8)(t1) - stt $f8, (8 * 8)(t1) - stt $f9, (9 * 8)(t1) - stt $f10, (10 * 8)(t1) - stt $f11, (11 * 8)(t1) - stt $f12, (12 * 8)(t1) - stt $f13, (13 * 8)(t1) - stt $f14, (14 * 8)(t1) - stt $f15, (15 * 8)(t1) - stt $f16, (16 * 8)(t1) - stt $f17, (17 * 8)(t1) - stt $f18, (18 * 8)(t1) - stt $f19, (19 * 8)(t1) - stt $f20, (20 * 8)(t1) - stt $f21, (21 * 8)(t1) - stt $f22, (22 * 8)(t1) - stt $f23, (23 * 8)(t1) - stt $f24, (24 * 8)(t1) - stt $f25, (25 * 8)(t1) - stt $f26, (26 * 8)(t1) - stt $f27, (27 * 8)(t1) - stt $f28, (28 * 8)(t1) - stt $f29, (29 * 8)(t1) - stt $f30, (30 * 8)(t1) - - /* - * Then save the FPCR; note that the necessary 'trapb's are taken - * care of on kernel entry and exit. - */ - mf_fpcr ft0 - stt ft0, FPREG_FPR_CR(a0) /* store to FPCR save area */ - - RET - END(savefpstate) - -/**************************************************************************/ - -/* - * restorefpstate: Restore a process's floating point state. - * - * Arguments: - * a0 'struct fpstate *' to restore from - */ - -LEAF(restorefpstate, 1) - LDGP(pv) - /* - * Restore the FPCR; note that the necessary 'trapb's are taken care of - * on kernel entry and exit. - */ - ldt ft0, FPREG_FPR_CR(a0) /* load from FPCR save area */ - mt_fpcr ft0 - - /* Restore all of the FP registers. */ - lda t1, FPREG_FPR_REGS(a0) /* get address of FP reg. save area */ - ldt $f0, (0 * 8)(t1) /* restore first reg., using hw name */ - ldt $f1, (1 * 8)(t1) /* etc. */ - ldt $f2, (2 * 8)(t1) - ldt $f3, (3 * 8)(t1) - ldt $f4, (4 * 8)(t1) - ldt $f5, (5 * 8)(t1) - ldt $f6, (6 * 8)(t1) - ldt $f7, (7 * 8)(t1) - ldt $f8, (8 * 8)(t1) - ldt $f9, (9 * 8)(t1) - ldt $f10, (10 * 8)(t1) - ldt $f11, (11 * 8)(t1) - ldt $f12, (12 * 8)(t1) - ldt $f13, (13 * 8)(t1) - ldt $f14, (14 * 8)(t1) - ldt $f15, (15 * 8)(t1) - ldt $f16, (16 * 8)(t1) - ldt $f17, (17 * 8)(t1) - ldt $f18, (18 * 8)(t1) - ldt $f19, (19 * 8)(t1) - ldt $f20, (20 * 8)(t1) - ldt $f21, (21 * 8)(t1) - ldt $f22, (22 * 8)(t1) - ldt $f23, (23 * 8)(t1) - ldt $f24, (24 * 8)(t1) - ldt $f25, (25 * 8)(t1) - ldt $f26, (26 * 8)(t1) - ldt $f27, (27 * 8)(t1) - ldt $f28, (28 * 8)(t1) - ldt $f29, (29 * 8)(t1) - ldt $f30, (30 * 8)(t1) - - RET - END(restorefpstate) - -/* XXX: make systat/vmstat happy */ - .data -EXPORT(intrnames) - .asciz "clock" -intr_n = 0 -.rept INTRCNT_COUNT - .ascii "intr " - .byte intr_n / 10 + '0, intr_n % 10 + '0 - .asciz " " # space for platform-specific rewrite - intr_n = intr_n + 1 -.endr -EXPORT(eintrnames) - .align 3 -EXPORT(intrcnt) - .fill INTRCNT_COUNT + 1, 8, 0 -EXPORT(eintrcnt) - .text diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c deleted file mode 100644 index 14c6ce3..0000000 --- a/sys/alpha/alpha/machdep.c +++ /dev/null @@ -1,2432 +0,0 @@ -/*- - * 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. - * - */ -/*- - * Copyright (c) 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 and by Chris G. Demetriou. - * - * 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) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_compat.h" -#include "opt_ddb.h" -#include "opt_kstack_pages.h" -#include "opt_msgbuf.h" -#include "opt_maxmem.h" - -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/bio.h> -#include <sys/buf.h> -#include <sys/bus.h> -#include <sys/cons.h> -#include <sys/cpu.h> -#include <sys/eventhandler.h> -#include <sys/exec.h> -#include <sys/imgact.h> -#include <sys/kdb.h> -#include <sys/kernel.h> -#include <sys/ktr.h> -#include <sys/linker.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/mbuf.h> -#include <sys/msgbuf.h> -#include <sys/mutex.h> -#include <sys/pcpu.h> -#include <sys/ptrace.h> -#include <sys/reboot.h> -#include <sys/signalvar.h> -#include <sys/smp.h> -#include <sys/sysctl.h> -#include <sys/sysproto.h> -#include <sys/ucontext.h> -#include <sys/uio.h> -#include <sys/vmmeter.h> -#include <sys/vnode.h> - -#include <net/netisr.h> - -#include <vm/vm.h> -#include <vm/vm_extern.h> -#include <vm/vm_kern.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> -#include <vm/vm_object.h> -#include <vm/vm_pager.h> - -#include <machine/bootinfo.h> -#include <machine/chipset.h> -#include <machine/clock.h> -#include <machine/cpuconf.h> -#include <machine/elf.h> -#include <machine/fpu.h> -#include <machine/md_var.h> -#include <machine/pal.h> -#include <machine/pcb.h> -#include <machine/prom.h> -#include <machine/rpb.h> -#include <machine/sigframe.h> -#include <machine/vmparam.h> - -#include <alpha/alpha/db_instruction.h> - -u_int64_t cycles_per_usec; -u_int32_t cycles_per_sec; -int cold = 1; -struct platform platform; -alpha_chipset_t chipset; -struct bootinfo_kernel bootinfo; - -struct mtx icu_lock; - -vm_offset_t proc0kstack; - -char machine[] = "alpha"; -SYSCTL_STRING(_hw, HW_MACHINE, machine, CTLFLAG_RD, machine, 0, ""); - -static char cpu_model[128]; -SYSCTL_STRING(_hw, HW_MODEL, model, CTLFLAG_RD, cpu_model, 0, ""); - -#ifdef DDB -extern vm_offset_t ksym_start, ksym_end; -#endif - -int alpha_unaligned_print = 1; /* warn about unaligned accesses */ -int alpha_unaligned_fix = 1; /* fix up unaligned accesses */ -int alpha_unaligned_sigbus = 0; /* don't SIGBUS on fixed-up accesses */ - -SYSCTL_INT(_machdep, CPU_UNALIGNED_PRINT, unaligned_print, - CTLFLAG_RW, &alpha_unaligned_print, 0, ""); - -SYSCTL_INT(_machdep, CPU_UNALIGNED_FIX, unaligned_fix, - CTLFLAG_RW, &alpha_unaligned_fix, 0, ""); - -SYSCTL_INT(_machdep, CPU_UNALIGNED_SIGBUS, unaligned_sigbus, - CTLFLAG_RW, &alpha_unaligned_sigbus, 0, ""); - -static void cpu_startup(void *); -SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL) - -struct msgbuf *msgbufp=0; - -long Maxmem = 0; -long realmem = 0; - -long totalphysmem; /* total amount of physical memory in system */ -long resvmem; /* amount of memory reserved for PROM */ -long unusedmem; /* amount of memory for OS that we don't use */ -long unknownmem; /* amount of memory with an unknown use */ -int ncpus; /* number of cpus */ - -int promcons_dly_mkdev = 1; /* need to delay call to make_dev() */ -void promcons_delayed_makedev(void); - -vm_offset_t phys_avail[10]; - -/* must be 2 less so 0 0 can signal end of chunks */ -#define PHYS_AVAIL_ARRAY_END ((sizeof(phys_avail) / sizeof(vm_offset_t)) - 2) - -#ifdef COMPAT_43 -void osendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); -#endif -#ifdef COMPAT_FREEBSD4 -static void freebsd4_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); -#endif - -static void get_fpcontext(struct thread *td, mcontext_t *mcp); -static void identifycpu(void); -static int set_fpcontext(struct thread *td, const mcontext_t *mcp); - -struct kva_md_info kmi; - -/* - * Hooked into the shutdown chain; if the system is to be halted, - * unconditionally drop back to the SRM console. - */ -static void -alpha_srm_shutdown(void *junk, int howto) -{ - if (howto & RB_HALT) { - cpu_halt(); - } -} - -static void -cpu_startup(dummy) - void *dummy; -{ - /* - * Good {morning,afternoon,evening,night}. - */ - identifycpu(); - - /* startrtclock(); */ -#ifdef PERFMON - perfmon_init(); -#endif - printf("real memory = %ld (%ld MB)\n", alpha_ptob(Maxmem), - alpha_ptob(Maxmem) / 1048576); - realmem = Maxmem; - - /* - * Display any holes after the first chunk of extended memory. - */ - if (bootverbose) { - int indx; - - printf("Physical memory chunk(s):\n"); - for (indx = 0; phys_avail[indx + 1] != 0; indx += 2) { - int size1 = phys_avail[indx + 1] - phys_avail[indx]; - - printf("0x%08lx - 0x%08lx, %d bytes (%d pages)\n", phys_avail[indx], - phys_avail[indx + 1] - 1, size1, size1 / PAGE_SIZE); - } - } - - vm_ksubmap_init(&kmi); - - printf("avail memory = %ld (%ld MB)\n", ptoa(cnt.v_free_count), - ptoa(cnt.v_free_count) / 1048576); - - /* - * Set up buffers, so they can be used to read disk labels. - */ - bufinit(); - vm_pager_bufferinit(); - EVENTHANDLER_REGISTER(shutdown_final, alpha_srm_shutdown, 0, - SHUTDOWN_PRI_LAST); -} - -/* - * Retrieve the platform name from the DSR. - */ -const char * -alpha_dsr_sysname() -{ - struct dsrdb *dsr; - const char *sysname; - - /* - * DSR does not exist on early HWRPB versions. - */ - if (hwrpb->rpb_version < HWRPB_DSRDB_MINVERS) - return (NULL); - - dsr = (struct dsrdb *)(((caddr_t)hwrpb) + hwrpb->rpb_dsrdb_off); - sysname = (const char *)((caddr_t)dsr + (dsr->dsr_sysname_off + - sizeof(u_int64_t))); - return (sysname); -} - -/* - * Lookup the system specified system variation in the provided table, - * returning the model string on match. - */ -const char * -alpha_variation_name(u_int64_t variation, - const struct alpha_variation_table *avtp) -{ - int i; - - for (i = 0; avtp[i].avt_model != NULL; i++) - if (avtp[i].avt_variation == variation) - return (avtp[i].avt_model); - return (NULL); -} - -/* - * Generate a default platform name based for unknown system variations. - */ -const char * -alpha_unknown_sysname() -{ - static char s[128]; /* safe size */ - - snprintf(s, sizeof(s), "%s family, unknown model variation 0x%lx", - platform.family, hwrpb->rpb_variation & SV_ST_MASK); - return ((const char *)s); -} - -static void -identifycpu(void) -{ - u_int64_t type, major, minor; - u_int64_t amask; - struct pcs *pcsp; - char *cpuname[] = { - "unknown", /* 0 */ - "EV3", /* 1 */ - "EV4 (21064)", /* 2 */ - "Simulation", /* 3 */ - "LCA (21066/21068)", /* 4 */ - "EV5 (21164)", /* 5 */ - "EV45 (21064A)", /* 6 */ - "EV56 (21164A)", /* 7 */ - "EV6 (21264)", /* 8 */ - "PCA56 (21164PC)", /* 9 */ - "PCA57 (21164PC)", /* 10 */ - "EV67 (21264A)", /* 11 */ - "EV68CB (21264C)" /* 12 */ - "EV68AL (21264B)", /* 13 */ - "EV68CX (21264D)", /* 14 */ - "EV7 (21364)" /* 15 */ - }; - - /* - * print out CPU identification information. - */ - printf("%s\n%s, %ldMHz\n", platform.family, platform.model, - hwrpb->rpb_cc_freq / 1000000); /* XXX true for 21164? */ - printf("%ld byte page size, %d processor%s.\n", - hwrpb->rpb_page_size, ncpus, ncpus == 1 ? "" : "s"); -#if 0 - /* this isn't defined for any systems that we run on? */ - printf("serial number 0x%lx 0x%lx\n", - ((long *)hwrpb->rpb_ssn)[0], ((long *)hwrpb->rpb_ssn)[1]); - - /* and these aren't particularly useful! */ - printf("variation: 0x%lx, revision 0x%lx\n", - hwrpb->rpb_variation, *(long *)hwrpb->rpb_revision); -#endif - pcsp = LOCATE_PCS(hwrpb, hwrpb->rpb_primary_cpu_id); - /* cpu type */ - type = pcsp->pcs_proc_type; - major = (type & PCS_PROC_MAJOR) >> PCS_PROC_MAJORSHIFT; - minor = (type & PCS_PROC_MINOR) >> PCS_PROC_MINORSHIFT; - if (major < sizeof(cpuname)/sizeof(char *)) - printf("CPU: %s major=%lu minor=%lu", - cpuname[major], major, minor); - else - printf("CPU: major=%lu minor=%lu\n", major, minor); - /* amask */ - if (major >= PCS_PROC_EV56) { - amask = 0xffffffff; /* 32 bit for printf */ - amask = (~alpha_amask(amask)) & amask; - printf(" extensions=0x%b\n", (u_int32_t) amask, - "\020" - "\001BWX" - "\002FIX" - "\003CIX" - "\011MVI" - "\012PRECISE" - ); - } else - printf("\n"); - /* PAL code */ - printf("OSF PAL rev: 0x%lx\n", pcsp->pcs_palrevisions[PALvar_OSF1]); -} - -extern char kernel_text[], _end[]; - -void -alpha_init(pfn, ptb, bim, bip, biv) - u_long pfn; /* first free PFN number */ - u_long ptb; /* PFN of current level 1 page table */ - u_long bim; /* bootinfo magic */ - u_long bip; /* bootinfo pointer */ - u_long biv; /* bootinfo version */ -{ - int phys_avail_cnt; - char *bootinfo_msg, *bootinfo_booted_kernel; - vm_offset_t kernstart, kernend; - vm_offset_t kernstartpfn, kernendpfn, pfn0, pfn1; - u_long physmem_tunable; - struct mddt *mddtp; - struct mddt_cluster *memc; - int i, mddtweird; - int cputype; - char *p; - - /* NO OUTPUT ALLOWED UNTIL FURTHER NOTICE */ - - /* - * Turn off interrupts (not mchecks) and floating point. - * Make sure the instruction and data streams are consistent. - */ - (void)alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH); - /* alpha_pal_wrfen(0); */ - ALPHA_TBIA(); - alpha_pal_imb(); - - /* - * Get critical system information (if possible, from the - * information provided by the boot program). - */ - bootinfo_msg = NULL; - bootinfo_booted_kernel = NULL; - if (bim == BOOTINFO_MAGIC) { - if (biv == 0) { /* backward compat */ - biv = *(u_long *)bip; - bip += 8; - } - switch (biv) { - case 1: { - struct bootinfo_v1 *v1p = (struct bootinfo_v1 *)bip; - - bootinfo.ssym = v1p->ssym; - bootinfo.esym = v1p->esym; - bootinfo.kernend = v1p->kernend; - bootinfo.modptr = v1p->modptr; - bootinfo.envp = v1p->envp; - /* hwrpb may not be provided by boot block in v1 */ - if (v1p->hwrpb != NULL) { - bootinfo.hwrpb_phys = - ((struct rpb *)v1p->hwrpb)->rpb_phys; - bootinfo.hwrpb_size = v1p->hwrpbsize; - } else { - bootinfo.hwrpb_phys = - ((struct rpb *)HWRPB_ADDR)->rpb_phys; - bootinfo.hwrpb_size = - ((struct rpb *)HWRPB_ADDR)->rpb_size; - } - bcopy(v1p->boot_flags, bootinfo.boot_flags, - min(sizeof v1p->boot_flags, - sizeof bootinfo.boot_flags)); - bcopy(v1p->booted_kernel, bootinfo.booted_kernel, - min(sizeof v1p->booted_kernel, - sizeof bootinfo.booted_kernel)); - bootinfo_booted_kernel = bootinfo.booted_kernel; - /* booted dev not provided in bootinfo */ - init_prom_interface((struct rpb *) - ALPHA_PHYS_TO_K0SEG(bootinfo.hwrpb_phys)); - prom_getenv(PROM_E_BOOTED_DEV, bootinfo.booted_dev, - sizeof bootinfo.booted_dev); - break; - } - default: - bootinfo_msg = "unknown bootinfo version"; - goto nobootinfo; - } - } else { - bootinfo_msg = "boot program did not pass bootinfo"; - nobootinfo: - bootinfo.ssym = (u_long)&_end; - bootinfo.esym = (u_long)&_end; - bootinfo.hwrpb_phys = ((struct rpb *)HWRPB_ADDR)->rpb_phys; - bootinfo.hwrpb_size = ((struct rpb *)HWRPB_ADDR)->rpb_size; - init_prom_interface((struct rpb *)HWRPB_ADDR); - prom_getenv(PROM_E_BOOTED_OSFLAGS, bootinfo.boot_flags, - sizeof bootinfo.boot_flags); - prom_getenv(PROM_E_BOOTED_FILE, bootinfo.booted_kernel, - sizeof bootinfo.booted_kernel); - prom_getenv(PROM_E_BOOTED_DEV, bootinfo.booted_dev, - sizeof bootinfo.booted_dev); - } - - /* - * Initialize the kernel's mapping of the RPB. It's needed for - * lots of things. - */ - hwrpb = (struct rpb *)ALPHA_PHYS_TO_K0SEG(bootinfo.hwrpb_phys); - - /* - * Remember how many cycles there are per microsecond, - * so that we can use delay(). Round up, for safety. - */ - cycles_per_usec = (hwrpb->rpb_cc_freq + 999999) / 1000000; - - /* - * Remember how many cycles per closk for coping with missed - * clock interrupts. - */ - cycles_per_sec = hwrpb->rpb_cc_freq; - - /* Get the loader(8) metadata */ - preload_metadata = (caddr_t)bootinfo.modptr; - if (envmode == 1) - kern_envp = static_env; - else - kern_envp = bootinfo.envp; - - /* Do basic tuning, hz etc */ - init_param1(); - - /* - * Initalize the (temporary) bootstrap console interface, so - * we can use printf until the VM system starts being setup. - * The real console is initialized before then. - */ - init_bootstrap_console(); - - /* OUTPUT NOW ALLOWED */ - - /* delayed from above */ - if (bootinfo_msg) - printf("WARNING: %s (0x%lx, 0x%lx, 0x%lx)\n", - bootinfo_msg, bim, bip, biv); - - /* - * Point interrupt/exception vectors to our own. - */ - alpha_pal_wrent(XentInt, ALPHA_KENTRY_INT); - alpha_pal_wrent(XentArith, ALPHA_KENTRY_ARITH); - alpha_pal_wrent(XentMM, ALPHA_KENTRY_MM); - alpha_pal_wrent(XentIF, ALPHA_KENTRY_IF); - alpha_pal_wrent(XentUna, ALPHA_KENTRY_UNA); - alpha_pal_wrent(XentSys, ALPHA_KENTRY_SYS); - - /* - * Clear pending machine checks and error reports, and enable - * system- and processor-correctable error reporting. - */ - alpha_pal_wrmces(alpha_pal_rdmces() & - ~(ALPHA_MCES_DSC|ALPHA_MCES_DPC)); - - /* Clear userland thread pointer */ - alpha_pal_wrunique(0); - - /* - * Find out what hardware we're on, and do basic initialization. - */ - cputype = hwrpb->rpb_type; - if (cputype < 0) { - /* - * At least some white-box (NT) systems have SRM which - * reports a systype that's the negative of their - * blue-box (UNIX/OVMS) counterpart. - */ - cputype = -cputype; - } - - if (cputype >= API_ST_BASE) { - if (cputype >= napi_cpuinit + API_ST_BASE) { - platform_not_supported(cputype); - /* NOTREACHED */ - } - cputype -= API_ST_BASE; - api_cpuinit[cputype].init(cputype); - } else { - if (cputype >= ncpuinit) { - platform_not_supported(cputype); - /* NOTREACHED */ - } - cpuinit[cputype].init(cputype); - } - snprintf(cpu_model, sizeof(cpu_model), "%s", platform.model); - - /* NO MORE FIRMWARE ACCESS ALLOWED */ -#ifdef _PMAP_MAY_USE_PROM_CONSOLE - /* - * XXX (unless _PMAP_MAY_USE_PROM_CONSOLE is defined and - * XXX pmap_uses_prom_console() evaluates to non-zero.) - */ -#endif - - /* - * find out this system's page size - */ - if (hwrpb->rpb_page_size != PAGE_SIZE) - panic("page size %ld != 8192?!", hwrpb->rpb_page_size); - - - /* - * Find the beginning and end of the kernel (and leave a - * bit of space before the beginning for the bootstrap - * stack). - */ - kernstart = trunc_page(kernel_text) - 2 * PAGE_SIZE; -#ifdef DDB - ksym_start = bootinfo.ssym; - ksym_end = bootinfo.esym; - kernend = (vm_offset_t)round_page(ksym_end); -#else - kernend = (vm_offset_t)round_page(_end); -#endif - /* But if the bootstrap tells us otherwise, believe it! */ - if (bootinfo.kernend) - kernend = round_page(bootinfo.kernend); - if (preload_metadata == NULL) - printf("WARNING: loader(8) metadata is missing!\n"); - - kernstartpfn = atop(ALPHA_K0SEG_TO_PHYS(kernstart)); - kernendpfn = atop(ALPHA_K0SEG_TO_PHYS(kernend)); - - /* - * Find out how much memory is available, by looking at - * the memory cluster descriptors. This also tries to do - * its best to detect things things that have never been seen - * before... - */ - mddtp = (struct mddt *)(((caddr_t)hwrpb) + hwrpb->rpb_memdat_off); - - /* MDDT SANITY CHECKING */ - mddtweird = 0; - if (mddtp->mddt_cluster_cnt < 2) { - mddtweird = 1; - printf("WARNING: weird number of mem clusters: %ld\n", - mddtp->mddt_cluster_cnt); - } - -#ifdef DEBUG_CLUSTER - printf("Memory cluster count: %d\n", mddtp->mddt_cluster_cnt); -#endif - - phys_avail_cnt = 0; - for (i = 0; i < mddtp->mddt_cluster_cnt; i++) { - memc = &mddtp->mddt_clusters[i]; -#ifdef DEBUG_CLUSTER - printf("MEMC %d: pfn 0x%lx cnt 0x%lx usage 0x%lx\n", i, - memc->mddt_pfn, memc->mddt_pg_cnt, memc->mddt_usage); -#endif - totalphysmem += memc->mddt_pg_cnt; - - if (memc->mddt_usage & MDDT_mbz) { - mddtweird = 1; - printf("WARNING: mem cluster %d has weird " - "usage 0x%lx\n", i, memc->mddt_usage); - unknownmem += memc->mddt_pg_cnt; - continue; - } - if (memc->mddt_usage & MDDT_NONVOLATILE) { - /* XXX should handle these... */ - printf("WARNING: skipping non-volatile mem " - "cluster %d\n", i); - unusedmem += memc->mddt_pg_cnt; - continue; - } - if (memc->mddt_usage & MDDT_PALCODE) { - resvmem += memc->mddt_pg_cnt; - continue; - } - - /* - * We have a memory cluster available for system - * software use. We must determine if this cluster - * holds the kernel. - */ - /* - * XXX If the kernel uses the PROM console, we only use the - * XXX memory after the kernel in the first system segment, - * XXX to avoid clobbering prom mapping, data, etc. - */ - physmem += memc->mddt_pg_cnt; - pfn0 = memc->mddt_pfn; - pfn1 = memc->mddt_pfn + memc->mddt_pg_cnt; - if (pfn0 <= kernendpfn && kernstartpfn <= pfn1) { - /* - * Must compute the location of the kernel - * within the segment. - */ -#ifdef DEBUG_CLUSTER - printf("Cluster %d contains kernel\n", i); -#endif - if (!pmap_uses_prom_console()) { - if (pfn0 < kernstartpfn) { - /* - * There is a chunk before the kernel. - */ -#ifdef DEBUG_CLUSTER - printf("Loading chunk before kernel: " - "0x%lx / 0x%lx\n", pfn0, kernstartpfn); -#endif - phys_avail[phys_avail_cnt] = alpha_ptob(pfn0); - phys_avail[phys_avail_cnt+1] = alpha_ptob(kernstartpfn); - phys_avail_cnt += 2; - } - } - if (kernendpfn < pfn1) { - /* - * There is a chunk after the kernel. - */ -#ifdef DEBUG_CLUSTER - printf("Loading chunk after kernel: " - "0x%lx / 0x%lx\n", kernendpfn, pfn1); -#endif - phys_avail[phys_avail_cnt] = alpha_ptob(kernendpfn); - phys_avail[phys_avail_cnt+1] = alpha_ptob(pfn1); - phys_avail_cnt += 2; - } - } else { - /* - * Just load this cluster as one chunk. - */ -#ifdef DEBUG_CLUSTER - printf("Loading cluster %d: 0x%lx / 0x%lx\n", i, - pfn0, pfn1); -#endif - phys_avail[phys_avail_cnt] = alpha_ptob(pfn0); - phys_avail[phys_avail_cnt+1] = alpha_ptob(pfn1); - phys_avail_cnt += 2; - - } - } - phys_avail[phys_avail_cnt] = 0; - - /* - * Dump out the MDDT if it looks odd... - */ - if (mddtweird) { - printf("\n"); - printf("complete memory cluster information:\n"); - for (i = 0; i < mddtp->mddt_cluster_cnt; i++) { - printf("mddt %d:\n", i); - printf("\tpfn %lx\n", - mddtp->mddt_clusters[i].mddt_pfn); - printf("\tcnt %lx\n", - mddtp->mddt_clusters[i].mddt_pg_cnt); - printf("\ttest %lx\n", - mddtp->mddt_clusters[i].mddt_pg_test); - printf("\tbva %lx\n", - mddtp->mddt_clusters[i].mddt_v_bitaddr); - printf("\tbpa %lx\n", - mddtp->mddt_clusters[i].mddt_p_bitaddr); - printf("\tbcksum %lx\n", - mddtp->mddt_clusters[i].mddt_bit_cksum); - printf("\tusage %lx\n", - mddtp->mddt_clusters[i].mddt_usage); - } - printf("\n"); - } - - Maxmem = physmem; - -#ifdef MAXMEM - /* - * MAXMEM define is in kilobytes. - */ - Maxmem = alpha_btop(MAXMEM * 1024); -#endif - - if (TUNABLE_ULONG_FETCH("hw.physmem", &physmem_tunable)) - Maxmem = alpha_btop(physmem_tunable); - - while (physmem > Maxmem) { - int i = phys_avail_cnt - 2; - size_t sz = alpha_btop(phys_avail[i+1] - phys_avail[i]); - size_t nsz; - if (physmem - sz > Maxmem) { - phys_avail[i] = 0; - phys_avail[i+1] = 0; - phys_avail_cnt -= 2; - physmem -= sz; - } else { - nsz = sz - (physmem - Maxmem); - phys_avail[i+1] = phys_avail[i] + alpha_ptob(nsz); - physmem -= (sz - nsz); - } - } - init_param2(physmem); - - /* - * Initialize error message buffer (at end of core). - */ - { - size_t sz = round_page(MSGBUF_SIZE); - int i = phys_avail_cnt - 2; - - /* shrink so that it'll fit in the last segment */ - if (phys_avail[i+1] - phys_avail[i] < sz) - sz = phys_avail[i+1] - phys_avail[i]; - - phys_avail[i+1] -= sz; - msgbufp = (struct msgbuf*) ALPHA_PHYS_TO_K0SEG(phys_avail[i+1]); - - msgbufinit(msgbufp, sz); - - /* Remove the last segment if it now has no pages. */ - if (phys_avail[i] == phys_avail[i+1]) { - phys_avail[i] = 0; - phys_avail[i+1] = 0; - } - - /* warn if the message buffer had to be shrunk */ - if (sz != round_page(MSGBUF_SIZE)) - printf("WARNING: %ld bytes not available for msgbuf in last cluster (%ld used)\n", - round_page(MSGBUF_SIZE), sz); - - } - - proc_linkup(&proc0, &ksegrp0, &thread0); - /* - * Init mapping for kernel stack for proc 0 - */ - proc0kstack = pmap_steal_memory(KSTACK_PAGES * PAGE_SIZE); - thread0.td_kstack = proc0kstack; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + KSTACK_PAGES * PAGE_SIZE) - 1; - - /* - * Setup the per-CPU data for the bootstrap cpu. - */ - { - size_t sz = round_page(KSTACK_PAGES * PAGE_SIZE); - pcpup = (struct pcpu *) pmap_steal_memory(sz); - pcpu_init(pcpup, 0, sz); - pcpup->pc_pal_id = alpha_pal_whami(); - alpha_pal_wrval((u_int64_t) pcpup); - PCPU_GET(next_asn) = 1; /* 0 used for proc0 pmap */ - PCPU_SET(curthread, &thread0); -#ifdef SMP - thread0.td_md.md_kernnest = 1; -#endif - } - - /* - * Initalize the real console, so the the bootstrap console is - * no longer necessary. Note this now involves mutexes as part - * of some operations so needs to be after proc0/thread0/curthread - * become valid. - */ - if (platform.cons_init) - platform.cons_init(); - promcndetach(); - cninit(); - - /* - * Check to see if promcons needs to make_dev() now, - * doing it before now crashes with kernel stack issues. - */ - if (promcons_dly_mkdev > 1) - promcons_delayed_makedev(); - promcons_dly_mkdev = 0; - - /* - * Initialize the virtual memory system, and set the - * page table base register in proc 0's PCB. - */ - pmap_bootstrap(ALPHA_PHYS_TO_K0SEG(alpha_ptob(ptb)), - hwrpb->rpb_max_asn); - hwrpb->rpb_vptb = VPTBASE; - hwrpb->rpb_checksum = hwrpb_checksum(); - - - /* - * Initialize the rest of proc 0's PCB, and cache its physical - * address. - */ - thread0.td_md.md_pcbpaddr = - (struct pcb *)ALPHA_K0SEG_TO_PHYS((vm_offset_t)thread0.td_pcb); - - /* - * Set the kernel sp, reserving space for an (empty) trapframe, - * and make proc0's trapframe pointer point to it for sanity. - */ - thread0.td_frame = (struct trapframe *)thread0.td_pcb - 1; - thread0.td_pcb->pcb_hw.apcb_ksp = (u_int64_t)thread0.td_frame; - - mutex_init(); - mtx_init(&clock_lock, "clk", NULL, MTX_SPIN | MTX_RECURSE); - mtx_init(&icu_lock, "icu", NULL, MTX_SPIN); - - /* - * Look at arguments passed to us and compute boothowto. - */ - for (p = bootinfo.boot_flags; p && *p != '\0'; p++) { - /* - * Note that we'd really like to differentiate case here, - * but the Alpha AXP Architecture Reference Manual - * says that we shouldn't. - */ - switch (*p) { - case 'a': /* autoboot */ - case 'A': - boothowto &= ~RB_SINGLE; - break; - -#ifdef DEBUG - case 'c': /* crash dump immediately after autoconfig */ - case 'C': - boothowto |= RB_DUMP; - break; -#endif - - case 'd': /* break into the kernel debugger ASAP */ - case 'D': - boothowto |= RB_KDB; - break; - case 'g': /* use kernel gdb */ - case 'G': - boothowto |= RB_GDB; - break; - - case 'h': /* always halt, never reboot */ - case 'H': - boothowto |= RB_HALT; - break; - -#if 0 - case 'm': /* mini root present in memory */ - case 'M': - boothowto |= RB_MINIROOT; - break; -#endif - - case 'n': /* askname */ - case 'N': - boothowto |= RB_ASKNAME; - break; - - case 's': /* single-user (default, supported for sanity) */ - case 'S': - boothowto |= RB_SINGLE; - break; - - case 'v': - case 'V': - boothowto |= RB_VERBOSE; - bootverbose = 1; - break; - - default: - printf("Unrecognized boot flag '%c'.\n", *p); - break; - } - } - - /* - * Catch case of boot_verbose set in environment. - */ - if ((p = getenv("boot_verbose")) != NULL) { - if (strcmp(p, "yes") == 0 || strcmp(p, "YES") == 0) { - boothowto |= RB_VERBOSE; - bootverbose = 1; - } - freeenv(p); - } - - /* - * Pick up kernelname. - */ - if (bootinfo_booted_kernel) { - strncpy(kernelname, bootinfo_booted_kernel, - min(sizeof(kernelname), sizeof bootinfo.booted_kernel) - 1); - } else if ((p = getenv("kernelname")) != NULL) { - strncpy(kernelname, p, sizeof(kernelname) - 1); - freeenv(p); - } - - /* - * Initialize debuggers, and break into them if appropriate. - */ - if (getenv("boot_gdb") != NULL) - boothowto |= RB_GDB; - kdb_init(); - -#ifdef KDB - if (boothowto & RB_KDB) - kdb_enter("Boot flags requested debugger\n"); -#endif - - /* - * Figure out the number of cpus in the box, from RPB fields. - * Really. We mean it. - */ - for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) { - struct pcs *pcsp; - - pcsp = (struct pcs *)((char *)hwrpb + hwrpb->rpb_pcs_off + - (i * hwrpb->rpb_pcs_size)); - if ((pcsp->pcs_flags & PCS_PP) != 0) - ncpus++; - } - - /* - * Figure out our clock frequency, from RPB fields. - */ - hz = hwrpb->rpb_intr_freq >> 12; - if (!(60 <= hz && hz <= 10240)) { - hz = 1024; -#ifdef DIAGNOSTIC - printf("WARNING: unbelievable rpb_intr_freq: %ld (%d hz)\n", - hwrpb->rpb_intr_freq, hz); -#endif - } - - hwrpb_restart_setup(); - - alpha_pal_wrfen(0); -} - -void -bzero(void *buf, size_t len) -{ - caddr_t p = buf; - - while (((vm_offset_t) p & (sizeof(u_long) - 1)) && len) { - *p++ = 0; - len--; - } - while (len >= sizeof(u_long) * 8) { - *(u_long*) p = 0; - *((u_long*) p + 1) = 0; - *((u_long*) p + 2) = 0; - *((u_long*) p + 3) = 0; - len -= sizeof(u_long) * 8; - *((u_long*) p + 4) = 0; - *((u_long*) p + 5) = 0; - *((u_long*) p + 6) = 0; - *((u_long*) p + 7) = 0; - p += sizeof(u_long) * 8; - } - while (len >= sizeof(u_long)) { - *(u_long*) p = 0; - len -= sizeof(u_long); - p += sizeof(u_long); - } - while (len) { - *p++ = 0; - len--; - } -} - -void -DELAY(int n) -{ - unsigned long pcc0, pcc1, curcycle, cycles; - int usec; - - if (n == 0) - return; - - pcc0 = alpha_rpcc() & 0xffffffffUL; - cycles = 0; - usec = 0; - - while (usec <= n) { - /* - * Get the next CPU cycle count. The assumption here - * is that we can't have wrapped twice past 32 bits worth - * of CPU cycles since we last checked. - */ - pcc1 = alpha_rpcc() & 0xffffffffUL; - if (pcc1 < pcc0) { - curcycle = (pcc1 + 0x100000000UL) - pcc0; - } else { - curcycle = pcc1 - pcc0; - } - - /* - * We now have the number of processor cycles since we - * last checked. Add the current cycle count to the - * running total. If it's over cycles_per_usec, increment - * the usec counter. - */ - cycles += curcycle; - while (cycles > cycles_per_usec) { - usec++; - cycles -= cycles_per_usec; - } - pcc0 = pcc1; - } -} - -/* - * Send an interrupt to process. - * - * Stack is set up to allow sigcode stored - * at top to call routine, followed by kcall - * to sigreturn routine below. After sigreturn - * resets the signal mask, the stack, and the - * frame pointer, it returns to the user - * specified pc, psl. - */ -#ifdef COMPAT_43 -void -osendsig(sig_t catcher, ksiginfo_t *kp, sigset_t *mask) -{ - struct proc *p; - struct thread *td; - osiginfo_t *sip, ksi; - struct trapframe *frame; - struct sigacts *psp; - int oonstack, fsize, rndfsize; - int sig; - int code; - - td = curthread; - p = td->td_proc; - PROC_LOCK_ASSERT(p, MA_OWNED); - sig = kp->ksi_signo; - code = kp->ksi_code; - psp = p->p_sigacts; - mtx_assert(&psp->ps_mtx, MA_OWNED); - - frame = td->td_frame; - fsize = sizeof ksi; - rndfsize = ((fsize + 15) / 16) * 16; - oonstack = sigonstack(alpha_pal_rdusp()); - - /* - * Allocate and validate space for the signal handler - * context. Note that if the stack is in P0 space, the - * call to grow() is a nop, and the useracc() check - * will fail if the process has not already allocated - * the space with a `brk'. - */ - if ((td->td_pflags & TDP_ALTSTACK) && !oonstack && - SIGISMEMBER(psp->ps_sigonstack, sig)) { - sip = (osiginfo_t *)((caddr_t)td->td_sigstk.ss_sp + - td->td_sigstk.ss_size - rndfsize); -#if defined(COMPAT_43) - td->td_sigstk.ss_flags |= SS_ONSTACK; -#endif - } else - sip = (osiginfo_t *)(alpha_pal_rdusp() - rndfsize); - mtx_unlock(&psp->ps_mtx); - PROC_UNLOCK(p); - - /* - * Build the signal context to be used by sigreturn. - */ - ksi.si_sc.sc_onstack = (oonstack) ? 1 : 0; - SIG2OSIG(*mask, ksi.si_sc.sc_mask); - ksi.si_sc.sc_pc = frame->tf_regs[FRAME_PC]; - ksi.si_sc.sc_ps = frame->tf_regs[FRAME_PS]; - - /* copy the registers. */ - fill_regs(td, (struct reg *)ksi.si_sc.sc_regs); - ksi.si_sc.sc_regs[R_ZERO] = 0xACEDBADE; /* magic number */ - ksi.si_sc.sc_regs[R_SP] = alpha_pal_rdusp(); - - /* save the floating-point state, if necessary, then copy it. */ - alpha_fpstate_save(td, 1); /* XXX maybe write=0 */ - ksi.si_sc.sc_ownedfp = td->td_md.md_flags & MDTD_FPUSED; - bcopy(&td->td_pcb->pcb_fp, (struct fpreg *)ksi.si_sc.sc_fpregs, - sizeof(struct fpreg)); - ksi.si_sc.sc_fp_control = td->td_pcb->pcb_fp_control; - bzero(ksi.si_sc.sc_reserved, sizeof ksi.si_sc.sc_reserved); /* XXX */ - ksi.si_sc.sc_xxx1[0] = 0; /* XXX */ - ksi.si_sc.sc_xxx1[1] = 0; /* XXX */ - ksi.si_sc.sc_traparg_a0 = frame->tf_regs[FRAME_TRAPARG_A0]; - ksi.si_sc.sc_traparg_a1 = frame->tf_regs[FRAME_TRAPARG_A1]; - ksi.si_sc.sc_traparg_a2 = frame->tf_regs[FRAME_TRAPARG_A2]; - ksi.si_sc.sc_xxx2[0] = 0; /* XXX */ - ksi.si_sc.sc_xxx2[1] = 0; /* XXX */ - ksi.si_sc.sc_xxx2[2] = 0; /* XXX */ - /* Fill in POSIX parts */ - ksi.si_signo = sig; - ksi.si_code = code; - ksi.si_value = kp->ksi_value; - - /* - * copy the frame out to userland. - */ - if (copyout((caddr_t)&ksi, (caddr_t)sip, fsize) != 0) { - /* - * Process has trashed its stack; give it an illegal - * instruction to halt it in its tracks. - */ - PROC_LOCK(p); - sigexit(td, SIGILL); - return; - } - - /* - * Set up the registers to return to sigcode. - */ - frame->tf_regs[FRAME_PC] = PS_STRINGS - szosigcode; - frame->tf_regs[FRAME_A0] = sig; - frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */ - PROC_LOCK(p); - mtx_lock(&psp->ps_mtx); - if (SIGISMEMBER(psp->ps_siginfo, sig)) - frame->tf_regs[FRAME_A1] = (u_int64_t)sip; - else - frame->tf_regs[FRAME_A1] = code; - frame->tf_regs[FRAME_A2] = (u_int64_t)&sip->si_sc; - frame->tf_regs[FRAME_T12] = (u_int64_t)catcher; /* t12 is pv */ - alpha_pal_wrusp((unsigned long)sip); -} -#endif - -#ifdef COMPAT_FREEBSD4 -static void -freebsd4_sendsig(sig_t catcher, ksiginfo_t *kp, sigset_t *mask) -{ - struct proc *p; - struct thread *td; - struct trapframe *frame; - struct sigacts *psp; - struct sigframe4 sf, *sfp; - int oonstack, rndfsize; - int sig; - int code; - - td = curthread; - p = td->td_proc; - PROC_LOCK_ASSERT(p, MA_OWNED); - sig = kp->ksi_signo; - code = kp->ksi_code; - psp = p->p_sigacts; - mtx_assert(&psp->ps_mtx, MA_OWNED); - - frame = td->td_frame; - oonstack = sigonstack(alpha_pal_rdusp()); - rndfsize = ((sizeof(sf) + 15) / 16) * 16; - - /* save user context */ - bzero(&sf, sizeof(sf)); - sf.sf_uc.uc_sigmask = *mask; - sf.sf_uc.uc_stack = td->td_sigstk; - sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) - ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE; - sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; - - fill_regs(td, (struct reg *)sf.sf_uc.uc_mcontext.mc_regs); - sf.sf_uc.uc_mcontext.mc_regs[R_SP] = alpha_pal_rdusp(); - sf.sf_uc.uc_mcontext.mc_regs[R_ZERO] = 0xACEDBADE; /* magic number */ - sf.sf_uc.uc_mcontext.mc_regs[R_PS] = frame->tf_regs[FRAME_PS]; - sf.sf_uc.uc_mcontext.mc_regs[R_PC] = frame->tf_regs[FRAME_PC]; - sf.sf_uc.uc_mcontext.mc_regs[R_TRAPARG_A0] = - frame->tf_regs[FRAME_TRAPARG_A0]; - sf.sf_uc.uc_mcontext.mc_regs[R_TRAPARG_A1] = - frame->tf_regs[FRAME_TRAPARG_A1]; - sf.sf_uc.uc_mcontext.mc_regs[R_TRAPARG_A2] = - frame->tf_regs[FRAME_TRAPARG_A2]; - - /* - * Allocate and validate space for the signal handler - * context. Note that if the stack is in P0 space, the - * call to grow() is a nop, and the useracc() check - * will fail if the process has not already allocated - * the space with a `brk'. - */ - if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && - SIGISMEMBER(psp->ps_sigonstack, sig)) { - sfp = (struct sigframe4 *)((caddr_t)td->td_sigstk.ss_sp + - td->td_sigstk.ss_size - rndfsize); -#if defined(COMPAT_43) - td->td_sigstk.ss_flags |= SS_ONSTACK; -#endif - } else - sfp = (struct sigframe4 *)(alpha_pal_rdusp() - rndfsize); - mtx_unlock(&psp->ps_mtx); - PROC_UNLOCK(p); - - /* save the floating-point state, if necessary, then copy it. */ - alpha_fpstate_save(td, 1); - sf.sf_uc.uc_mcontext.mc_ownedfp = td->td_md.md_flags & MDTD_FPUSED; - bcopy(&td->td_pcb->pcb_fp, - (struct fpreg *)sf.sf_uc.uc_mcontext.mc_fpregs, - sizeof(struct fpreg)); - sf.sf_uc.uc_mcontext.mc_fp_control = td->td_pcb->pcb_fp_control; - -#ifdef COMPAT_OSF1 - /* - * XXX Create an OSF/1-style sigcontext and associated goo. - */ -#endif - - /* - * copy the frame out to userland. - */ - if (copyout((caddr_t)&sf, (caddr_t)sfp, sizeof(sf)) != 0) { - /* - * Process has trashed its stack; give it an illegal - * instruction to halt it in its tracks. - */ - PROC_LOCK(p); - sigexit(td, SIGILL); - return; - } - - /* - * Set up the registers to return to sigcode. - */ - frame->tf_regs[FRAME_PC] = PS_STRINGS - szfreebsd4_sigcode; - frame->tf_regs[FRAME_A0] = sig; - PROC_LOCK(p); - mtx_lock(&psp->ps_mtx); - if (SIGISMEMBER(psp->ps_siginfo, sig)) { - frame->tf_regs[FRAME_A1] = (u_int64_t)&(sfp->sf_si); - - /* Fill in POSIX parts */ - sf.sf_si = kp->ksi_info; - } - else - frame->tf_regs[FRAME_A1] = code; - - frame->tf_regs[FRAME_A2] = (u_int64_t)&(sfp->sf_uc); - frame->tf_regs[FRAME_T12] = (u_int64_t)catcher; /* t12 is pv */ - frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */ - alpha_pal_wrusp((unsigned long)sfp); -} -#endif /* COMPAT_FREEBSD4 */ - -void -sendsig(sig_t catcher, ksiginfo_t *kp, sigset_t *mask) -{ - struct proc *p; - struct thread *td; - struct trapframe *frame; - struct sigacts *psp; - struct sigframe sf, *sfp; - int oonstack, rndfsize; - int sig; - int code; - - td = curthread; - p = td->td_proc; - PROC_LOCK_ASSERT(p, MA_OWNED); - sig = kp->ksi_signo; - code = kp->ksi_code; - psp = p->p_sigacts; - mtx_assert(&psp->ps_mtx, MA_OWNED); -#ifdef COMPAT_FREEBSD4 - if (SIGISMEMBER(psp->ps_freebsd4, sig)) { - freebsd4_sendsig(catcher, kp, mask); - return; - } -#endif -#ifdef COMPAT_43 - if (SIGISMEMBER(psp->ps_osigset, sig)) { - osendsig(catcher, kp, mask); - return; - } -#endif - - frame = td->td_frame; - oonstack = sigonstack(alpha_pal_rdusp()); - rndfsize = ((sizeof(sf) + 15) / 16) * 16; - - /* save user context */ - bzero(&sf, sizeof(struct sigframe)); - sf.sf_uc.uc_sigmask = *mask; - sf.sf_uc.uc_stack = td->td_sigstk; - sf.sf_uc.uc_stack.ss_flags = (td->td_pflags & TDP_ALTSTACK) - ? ((oonstack) ? SS_ONSTACK : 0) : SS_DISABLE; - sf.sf_uc.uc_mcontext.mc_onstack = (oonstack) ? 1 : 0; - - fill_regs(td, (struct reg *)sf.sf_uc.uc_mcontext.mc_regs); - sf.sf_uc.uc_mcontext.mc_regs[R_SP] = alpha_pal_rdusp(); - sf.sf_uc.uc_mcontext.mc_regs[R_ZERO] = 0xACEDBADE; /* magic number */ - sf.sf_uc.uc_mcontext.mc_regs[R_PS] = frame->tf_regs[FRAME_PS]; - sf.sf_uc.uc_mcontext.mc_regs[R_PC] = frame->tf_regs[FRAME_PC]; - sf.sf_uc.uc_mcontext.mc_regs[R_TRAPARG_A0] = - frame->tf_regs[FRAME_TRAPARG_A0]; - sf.sf_uc.uc_mcontext.mc_regs[R_TRAPARG_A1] = - frame->tf_regs[FRAME_TRAPARG_A1]; - sf.sf_uc.uc_mcontext.mc_regs[R_TRAPARG_A2] = - frame->tf_regs[FRAME_TRAPARG_A2]; - sf.sf_uc.uc_mcontext.mc_format = _MC_REV0_SIGFRAME; - - /* - * Allocate and validate space for the signal handler - * context. Note that if the stack is in P0 space, the - * call to grow() is a nop, and the useracc() check - * will fail if the process has not already allocated - * the space with a `brk'. - */ - if ((td->td_pflags & TDP_ALTSTACK) != 0 && !oonstack && - SIGISMEMBER(psp->ps_sigonstack, sig)) { - sfp = (struct sigframe *)((caddr_t)td->td_sigstk.ss_sp + - td->td_sigstk.ss_size - rndfsize); -#if defined(COMPAT_43) - td->td_sigstk.ss_flags |= SS_ONSTACK; -#endif - } else - sfp = (struct sigframe *)(alpha_pal_rdusp() - rndfsize); - mtx_unlock(&psp->ps_mtx); - PROC_UNLOCK(p); - - /* save the floating-point state, if necessary, then copy it. */ - alpha_fpstate_save(td, 1); - sf.sf_uc.uc_mcontext.mc_ownedfp = td->td_md.md_flags & MDTD_FPUSED; - bcopy(&td->td_pcb->pcb_fp, - (struct fpreg *)sf.sf_uc.uc_mcontext.mc_fpregs, - sizeof(struct fpreg)); - sf.sf_uc.uc_mcontext.mc_fp_control = td->td_pcb->pcb_fp_control; - -#ifdef COMPAT_OSF1 - /* - * XXX Create an OSF/1-style sigcontext and associated goo. - */ -#endif - - /* - * copy the frame out to userland. - */ - if (copyout((caddr_t)&sf, (caddr_t)sfp, sizeof(sf)) != 0) { - /* - * Process has trashed its stack; give it an illegal - * instruction to halt it in its tracks. - */ - PROC_LOCK(p); - sigexit(td, SIGILL); - return; - } - - /* - * Set up the registers to return to sigcode. - */ - frame->tf_regs[FRAME_PC] = PS_STRINGS - szsigcode; - frame->tf_regs[FRAME_A0] = sig; - PROC_LOCK(p); - mtx_lock(&psp->ps_mtx); - if (SIGISMEMBER(psp->ps_siginfo, sig)) { - frame->tf_regs[FRAME_A1] = (u_int64_t)&(sfp->sf_si); - - /* Fill in POSIX parts */ - sf.sf_si = kp->ksi_info; - } - else - frame->tf_regs[FRAME_A1] = code; - - frame->tf_regs[FRAME_A2] = (u_int64_t)&(sfp->sf_uc); - frame->tf_regs[FRAME_T12] = (u_int64_t)catcher; /* t12 is pv */ - frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */ - alpha_pal_wrusp((unsigned long)sfp); -} - -/* - * System call to cleanup state after a signal - * has been taken. Reset signal mask and - * stack state from context left by sendsig (above). - * Return to previous pc and psl as specified by - * context left by sendsig. Check carefully to - * make sure that the user has not modified the - * state to gain improper privileges. - * - * MPSAFE - */ -#ifdef COMPAT_43 -int -osigreturn(struct thread *td, - struct osigreturn_args /* { - struct osigcontext *sigcntxp; - } */ *uap) -{ - struct osigcontext *scp, ksc; - struct proc *p = td->td_proc; - - scp = uap->sigcntxp; - - /* - * Fetch the entire context structure at once for speed. - */ - if (copyin((caddr_t)scp, (caddr_t)&ksc, sizeof ksc)) - return (EFAULT); - - /* - * XXX - Should we do this. What if we get a "handcrafted" - * but valid sigcontext that hasn't the magic number? - */ - if (ksc.sc_regs[R_ZERO] != 0xACEDBADE) /* magic number */ - return (EINVAL); - - PROC_LOCK(p); -#if defined(COMPAT_43) - /* - * Restore the user-supplied information - */ - if (ksc.sc_onstack) - td->td_sigstk.ss_flags |= SS_ONSTACK; - else - td->td_sigstk.ss_flags &= ~SS_ONSTACK; -#endif - - /* - * longjmp is still implemented by calling osigreturn. The new - * sigmask is stored in sc_reserved, sc_mask is only used for - * backward compatibility. - */ - SIGSETOLD(td->td_sigmask, ksc.sc_mask); - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); - - set_regs(td, (struct reg *)ksc.sc_regs); - td->td_frame->tf_regs[FRAME_PC] = ksc.sc_pc; - td->td_frame->tf_regs[FRAME_PS] = - (ksc.sc_ps | ALPHA_PSL_USERSET) & ~ALPHA_PSL_USERCLR; - td->td_frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */ - - alpha_pal_wrusp(ksc.sc_regs[R_SP]); - - /* XXX ksc.sc_ownedfp ? */ - alpha_fpstate_drop(td); - bcopy((struct fpreg *)ksc.sc_fpregs, &td->td_pcb->pcb_fp, - sizeof(struct fpreg)); - td->td_pcb->pcb_fp_control = ksc.sc_fp_control; - return (EJUSTRETURN); -} -#endif /* COMPAT_43 */ - -#ifdef COMPAT_FREEBSD4 -/* - * MPSAFE - */ -int -freebsd4_sigreturn(struct thread *td, - struct freebsd4_sigreturn_args /* { - const struct ucontext4 *sigcntxp; - } */ *uap) -{ - struct ucontext4 uc; - const struct ucontext4 *ucp; - struct pcb *pcb; - unsigned long val; - struct proc *p; - int error; - - ucp = uap->sigcntxp; - pcb = td->td_pcb; - p = td->td_proc; - - /* - * Fetch the entire context structure at once for speed. - * Note that struct osigcontext is smaller than a ucontext_t, - * so even if copyin() faults, we may have actually gotten a complete - * struct osigcontext. - */ - error = copyin(ucp, &uc, sizeof(ucontext_t)); - if (error != 0) { -#ifdef COMPAT_43 - if (((struct osigcontext*)&uc)->sc_regs[R_ZERO] == 0xACEDBADE) - return osigreturn(td, (struct osigreturn_args *)uap); -#endif - return (error); - } - -#ifdef COMPAT_43 - if (((struct osigcontext*)&uc)->sc_regs[R_ZERO] == 0xACEDBADE) - return osigreturn(td, (struct osigreturn_args *)uap); -#endif - - /* - * Restore the user-supplied information - */ - set_regs(td, (struct reg *)uc.uc_mcontext.mc_regs); - val = (uc.uc_mcontext.mc_regs[R_PS] | ALPHA_PSL_USERSET) & - ~ALPHA_PSL_USERCLR; - td->td_frame->tf_regs[FRAME_PS] = val; - td->td_frame->tf_regs[FRAME_PC] = uc.uc_mcontext.mc_regs[R_PC]; - td->td_frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */ - alpha_pal_wrusp(uc.uc_mcontext.mc_regs[R_SP]); - - PROC_LOCK(p); -#if defined(COMPAT_43) - if (uc.uc_mcontext.mc_onstack & 1) - td->td_sigstk.ss_flags |= SS_ONSTACK; - else - td->td_sigstk.ss_flags &= ~SS_ONSTACK; -#endif - - td->td_sigmask = uc.uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); - - /* XXX ksc.sc_ownedfp ? */ - alpha_fpstate_drop(td); - bcopy((struct fpreg *)uc.uc_mcontext.mc_fpregs, - &td->td_pcb->pcb_fp, sizeof(struct fpreg)); - td->td_pcb->pcb_fp_control = uc.uc_mcontext.mc_fp_control; - return (EJUSTRETURN); -} -#endif /* COMPAT_FREEBSD4 */ - -/* - * MPSAFE - */ -int -sigreturn(struct thread *td, - struct sigreturn_args /* { - const struct __ucontext *sigcntxp; - } */ *uap) -{ - ucontext_t uc; - const ucontext_t *ucp; - struct pcb *pcb; - unsigned long val; - struct proc *p; - int error; - - ucp = uap->sigcntxp; - pcb = td->td_pcb; - p = td->td_proc; - - /* - * Fetch the entire context structure at once for speed. - * Note that struct osigcontext is smaller than a ucontext_t, - * so even if copyin() faults, we may have actually gotten a complete - * struct osigcontext. - * XXX we'll *still* be getting osigcontext's here due to longjmp(3) - * brain damage. - */ - error = copyin(ucp, &uc, sizeof(ucontext_t)); - if (error != 0) { -#ifdef COMPAT_43 - if (((struct osigcontext*)&uc)->sc_regs[R_ZERO] == 0xACEDBADE) - return osigreturn(td, (struct osigreturn_args *)uap); -#endif - return (error); - } -#ifdef COMPAT_43 - if (((struct osigcontext*)&uc)->sc_regs[R_ZERO] == 0xACEDBADE) - return osigreturn(td, (struct osigreturn_args *)uap); -#endif - - /* - * Restore the user-supplied information - */ - if ((error = set_fpcontext(td, &uc.uc_mcontext)) != 0) - return (error); - set_regs(td, (struct reg *)uc.uc_mcontext.mc_regs); - val = (uc.uc_mcontext.mc_regs[R_PS] | ALPHA_PSL_USERSET) & - ~ALPHA_PSL_USERCLR; - td->td_frame->tf_regs[FRAME_PS] = val; - td->td_frame->tf_regs[FRAME_PC] = uc.uc_mcontext.mc_regs[R_PC]; - td->td_frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */ - alpha_pal_wrusp(uc.uc_mcontext.mc_regs[R_SP]); - - PROC_LOCK(p); -#if defined(COMPAT_43) - if (uc.uc_mcontext.mc_onstack & 1) - td->td_sigstk.ss_flags |= SS_ONSTACK; - else - td->td_sigstk.ss_flags &= ~SS_ONSTACK; -#endif - - td->td_sigmask = uc.uc_sigmask; - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); - - return (EJUSTRETURN); -} - -/* - * Machine dependent boot() routine - * - * I haven't seen anything to put here yet - * Possibly some stuff might be grafted back here from boot() - */ -void -cpu_boot(int howto) -{ -} - -/* Get current clock frequency for the given cpu id. */ -int -cpu_est_clockrate(int cpu_id, uint64_t *rate) -{ - - return (ENXIO); -} - -/* - * Shutdown the CPU as much as possible - */ -void -cpu_halt(void) -{ - prom_halt(1); -} - -static int cpu_idle_hlt = 1; -SYSCTL_INT(_machdep, OID_AUTO, cpu_idle_hlt, CTLFLAG_RW, - &cpu_idle_hlt, 0, "Idle loop HLT enable"); - -/* - * call platform specific code to halt (until next interrupt) for the idle loop - */ -void -cpu_idle(void) -{ - if (cpu_idle_hlt && platform.cpu_idle != NULL) - platform.cpu_idle(); -} - -/* - * Clear registers on exec - */ -void -exec_setregs(struct thread *td, u_long entry, u_long stack, u_long ps_strings) -{ - struct trapframe *tfp = td->td_frame; - - bzero(tfp->tf_regs, FRAME_SIZE * sizeof tfp->tf_regs[0]); - bzero(&td->td_pcb->pcb_fp, sizeof td->td_pcb->pcb_fp); - td->td_pcb->pcb_fp_control = 0; - td->td_pcb->pcb_fp.fpr_cr = (FPCR_DYN_NORMAL - | FPCR_INVD | FPCR_DZED - | FPCR_OVFD | FPCR_INED - | FPCR_UNFD); - - alpha_pal_wrusp(stack); - tfp->tf_regs[FRAME_PS] = ALPHA_PSL_USERSET; - tfp->tf_regs[FRAME_PC] = entry & ~3; - - tfp->tf_regs[FRAME_A0] = stack; /* a0 = sp */ - tfp->tf_regs[FRAME_A1] = 0; /* a1 = rtld cleanup */ - tfp->tf_regs[FRAME_A2] = 0; /* a2 = rtld object */ - tfp->tf_regs[FRAME_A3] = PS_STRINGS; /* a3 = ps_strings */ - tfp->tf_regs[FRAME_T12] = tfp->tf_regs[FRAME_PC]; /* a.k.a. PV */ - tfp->tf_regs[FRAME_FLAGS] = 0; /* full restore */ - - td->td_md.md_flags &= ~MDTD_FPUSED; - alpha_fpstate_drop(td); -} - -int -ptrace_set_pc(struct thread *td, unsigned long addr) -{ - struct trapframe *tp = td->td_frame; - tp->tf_regs[FRAME_PC] = addr; - return 0; -} - -static int -ptrace_read_int(struct thread *td, vm_offset_t addr, u_int32_t *v) -{ - struct iovec iov; - struct uio uio; - - PROC_LOCK_ASSERT(td->td_proc, MA_NOTOWNED); - iov.iov_base = (caddr_t) v; - iov.iov_len = sizeof(u_int32_t); - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = (off_t)addr; - uio.uio_resid = sizeof(u_int32_t); - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_rw = UIO_READ; - uio.uio_td = td; - return proc_rwmem(td->td_proc, &uio); -} - -static int -ptrace_write_int(struct thread *td, vm_offset_t addr, u_int32_t v) -{ - struct iovec iov; - struct uio uio; - - PROC_LOCK_ASSERT(td->td_proc, MA_NOTOWNED); - iov.iov_base = (caddr_t) &v; - iov.iov_len = sizeof(u_int32_t); - uio.uio_iov = &iov; - uio.uio_iovcnt = 1; - uio.uio_offset = (off_t)addr; - uio.uio_resid = sizeof(u_int32_t); - uio.uio_segflg = UIO_SYSSPACE; - uio.uio_rw = UIO_WRITE; - uio.uio_td = td; - return proc_rwmem(td->td_proc, &uio); -} - -static u_int64_t -ptrace_read_register(struct thread *td, int regno) -{ - static int reg_to_frame[32] = { - FRAME_V0, - FRAME_T0, - FRAME_T1, - FRAME_T2, - FRAME_T3, - FRAME_T4, - FRAME_T5, - FRAME_T6, - FRAME_T7, - - FRAME_S0, - FRAME_S1, - FRAME_S2, - FRAME_S3, - FRAME_S4, - FRAME_S5, - FRAME_S6, - - FRAME_A0, - FRAME_A1, - FRAME_A2, - FRAME_A3, - FRAME_A4, - FRAME_A5, - - FRAME_T8, - FRAME_T9, - FRAME_T10, - FRAME_T11, - FRAME_RA, - FRAME_T12, - FRAME_AT, - FRAME_GP, - FRAME_SP, - -1, /* zero */ - }; - - if (regno == R_ZERO) - return 0; - - return td->td_frame->tf_regs[reg_to_frame[regno]]; -} - - -static int -ptrace_clear_bpt(struct thread *td, struct mdbpt *bpt) -{ - - PROC_LOCK_ASSERT(td->td_proc, MA_NOTOWNED); - return ptrace_write_int(td, bpt->addr, bpt->contents); -} - -static int -ptrace_set_bpt(struct thread *td, struct mdbpt *bpt) -{ - int error; - u_int32_t bpins = 0x00000080; - - PROC_LOCK_ASSERT(td->td_proc, MA_NOTOWNED); - error = ptrace_read_int(td, bpt->addr, &bpt->contents); - if (error) - return error; - return ptrace_write_int(td, bpt->addr, bpins); -} - -int -ptrace_clear_single_step(struct thread *td) -{ - struct proc *p; - - p = td->td_proc; - PROC_LOCK_ASSERT(p, MA_OWNED); - if (td->td_md.md_flags & MDTD_STEP2) { - PROC_UNLOCK(p); - ptrace_clear_bpt(td, &td->td_md.md_sstep[1]); - ptrace_clear_bpt(td, &td->td_md.md_sstep[0]); - PROC_LOCK(p); - td->td_md.md_flags &= ~MDTD_STEP2; - } else if (td->td_md.md_flags & MDTD_STEP1) { - PROC_UNLOCK(p); - ptrace_clear_bpt(td, &td->td_md.md_sstep[0]); - PROC_LOCK(p); - td->td_md.md_flags &= ~MDTD_STEP1; - } - return 0; -} - -int -ptrace_single_step(struct thread *td) -{ - struct proc *p; - int error; - vm_offset_t pc = td->td_frame->tf_regs[FRAME_PC]; - alpha_instruction ins; - vm_offset_t addr[2]; /* places to set breakpoints */ - int count = 0; /* count of breakpoints */ - - if (td->td_md.md_flags & (MDTD_STEP1|MDTD_STEP2)) - panic("ptrace_single_step: step breakpoints not removed"); - - p = td->td_proc; - PROC_UNLOCK(p); - error = ptrace_read_int(td, pc, &ins.bits); - if (error) - goto out; - - switch (ins.branch_format.opcode) { - - case op_j: - /* Jump: target is register value */ - addr[0] = ptrace_read_register(td, ins.jump_format.rs) & ~3; - count = 1; - break; - - case op_br: - case op_fbeq: - case op_fblt: - case op_fble: - case op_bsr: - case op_fbne: - case op_fbge: - case op_fbgt: - case op_blbc: - case op_beq: - case op_blt: - case op_ble: - case op_blbs: - case op_bne: - case op_bge: - case op_bgt: - /* Branch: target is pc+4+4*displacement */ - addr[0] = pc + 4; - addr[1] = pc + 4 + 4 * ins.branch_format.displacement; - count = 2; - break; - - default: - addr[0] = pc + 4; - count = 1; - } - - td->td_md.md_sstep[0].addr = addr[0]; - error = ptrace_set_bpt(td, &td->td_md.md_sstep[0]); - if (error) - goto out; - if (count == 2) { - td->td_md.md_sstep[1].addr = addr[1]; - error = ptrace_set_bpt(td, &td->td_md.md_sstep[1]); - if (error) { - ptrace_clear_bpt(td, &td->td_md.md_sstep[0]); - goto out; - } - td->td_md.md_flags |= MDTD_STEP2; - } else - td->td_md.md_flags |= MDTD_STEP1; - -out: - PROC_LOCK(p); - return (error); -} - -int -alpha_pa_access(vm_offset_t pa) -{ -#if 0 - int i; - - for (i = 0; phys_avail[i] != 0; i += 2) { - if (pa < phys_avail[i]) - continue; - if (pa < phys_avail[i+1]) - return VM_PROT_READ|VM_PROT_WRITE; - } - return 0; -#else - return VM_PROT_READ|VM_PROT_WRITE; -#endif -} - -/* - * Construct a PCB from a trapframe. This is called from kdb_trap() where - * we want to start a backtrace from the function that caused us to enter - * the debugger. We have the context in the trapframe, but base the trace - * on the PCB. The PCB doesn't have to be perfect, as long as it contains - * enough for a backtrace. - */ -void -makectx(struct trapframe *tf, struct pcb *pcb) -{ - - pcb->pcb_context[0] = tf->tf_regs[FRAME_S0]; - pcb->pcb_context[1] = tf->tf_regs[FRAME_S1]; - pcb->pcb_context[2] = tf->tf_regs[FRAME_S2]; - pcb->pcb_context[3] = tf->tf_regs[FRAME_S3]; - pcb->pcb_context[4] = tf->tf_regs[FRAME_S4]; - pcb->pcb_context[5] = tf->tf_regs[FRAME_S5]; - pcb->pcb_context[6] = tf->tf_regs[FRAME_S6]; - pcb->pcb_context[7] = tf->tf_regs[FRAME_PC]; - pcb->pcb_context[8] = tf->tf_regs[FRAME_PS]; - pcb->pcb_hw.apcb_ksp = tf->tf_regs[FRAME_SP]; -} - -int -fill_regs(td, regs) - struct thread *td; - struct reg *regs; -{ - struct pcb *pcb = td->td_pcb; - struct trapframe *tp = td->td_frame; - -#define C(r) regs->r_regs[R_ ## r] = tp->tf_regs[FRAME_ ## r] - - C(V0); - C(T0); C(T1); C(T2); C(T3); C(T4); C(T5); C(T6); C(T7); - C(S0); C(S1); C(S2); C(S3); C(S4); C(S5); C(S6); - C(A0); C(A1); C(A2); C(A3); C(A4); C(A5); - C(T8); C(T9); C(T10); C(T11); - C(RA); C(T12); C(AT); C(GP); - -#undef C - - regs->r_regs[R_ZERO] = tp->tf_regs[FRAME_PC]; - regs->r_regs[R_SP] = pcb->pcb_hw.apcb_usp; - - return (0); -} - -int -set_regs(td, regs) - struct thread *td; - struct reg *regs; -{ - struct pcb *pcb = td->td_pcb; - struct trapframe *tp = td->td_frame; - -#define C(r) tp->tf_regs[FRAME_ ## r] = regs->r_regs[R_ ## r] - - C(V0); - C(T0); C(T1); C(T2); C(T3); C(T4); C(T5); C(T6); C(T7); - C(S0); C(S1); C(S2); C(S3); C(S4); C(S5); C(S6); - C(A0); C(A1); C(A2); C(A3); C(A4); C(A5); - C(T8); C(T9); C(T10); C(T11); - C(RA); C(T12); C(AT); C(GP); - -#undef C - - tp->tf_regs[FRAME_PC] = regs->r_regs[R_ZERO]; - pcb->pcb_hw.apcb_usp = regs->r_regs[R_SP]; - - return (0); -} - -int -get_mcontext(struct thread *td, mcontext_t *mcp, int flags) -{ - /* - * Use a trapframe for getsetcontext, so just copy the - * threads trapframe. - */ - bcopy(td->td_frame, &mcp->mc_regs, sizeof(struct trapframe)); - if (flags & GET_MC_CLEAR_RET) { - mcp->mc_regs[FRAME_V0] = 0; - mcp->mc_regs[FRAME_A4] = 0; - mcp->mc_regs[FRAME_A3] = 0; - } - - /* - * When the thread is the current thread, the user stack pointer - * is not in the PCB; it must be read from the PAL. - */ - if (td == curthread) { - mcp->mc_regs[FRAME_SP] = alpha_pal_rdusp(); - mcp->mc_thrptr = alpha_pal_rdunique(); - } else - mcp->mc_thrptr = 0; - - mcp->mc_format = _MC_REV0_TRAPFRAME; - PROC_LOCK(curthread->td_proc); - mcp->mc_onstack = sigonstack(alpha_pal_rdusp()) ? 1 : 0; - PROC_UNLOCK(curthread->td_proc); - get_fpcontext(td, mcp); - return (0); -} - -int -set_mcontext(struct thread *td, const mcontext_t *mcp) -{ - int ret; - unsigned long val; - - if ((mcp->mc_format != _MC_REV0_TRAPFRAME) && - (mcp->mc_format != _MC_REV0_SIGFRAME)) - return (EINVAL); - else if ((ret = set_fpcontext(td, mcp)) != 0) - return (ret); - - /* - * NOTE: We only need to restore mc_thrptr when the ucontext format - * is _MC_REV0_TRAPFRAME. Only get_mcontext() above creates such - * contexts and that's also the only place where we save the thread - * pointer in the context. - */ - if (mcp->mc_format == _MC_REV0_SIGFRAME) { - set_regs(td, (struct reg *)&mcp->mc_regs); - val = (mcp->mc_regs[R_PS] | ALPHA_PSL_USERSET) & - ~ALPHA_PSL_USERCLR; - td->td_frame->tf_regs[FRAME_PS] = val; - td->td_frame->tf_regs[FRAME_PC] = mcp->mc_regs[R_PC]; - td->td_frame->tf_regs[FRAME_FLAGS] = 0; - if (td == curthread) - alpha_pal_wrusp(mcp->mc_regs[R_SP]); - } else { - if (td == curthread) { - alpha_pal_wrusp(mcp->mc_regs[FRAME_SP]); - alpha_pal_wrunique(mcp->mc_thrptr); - } else { - td->td_pcb->pcb_hw.apcb_usp = mcp->mc_regs[FRAME_SP]; - td->td_pcb->pcb_hw.apcb_unique = mcp->mc_thrptr; - } - - /* - * The context is a trapframe, so just copy it over the - * threads frame. - */ - bcopy(&mcp->mc_regs, td->td_frame, sizeof(struct trapframe)); - } - return (0); -} - -static void -get_fpcontext(struct thread *td, mcontext_t *mcp) -{ - register_t s; - - s = intr_disable(); - if ((td->td_md.md_flags & MDTD_FPUSED) == 0) { - intr_restore(s); - mcp->mc_ownedfp = _MC_FPOWNED_NONE; - } else if (PCPU_GET(fpcurthread) == td) { - /* See comments in alpha_fpstate_save() regarding FEN. */ - if (td != curthread) - alpha_pal_wrfen(1); - /* - * The last field (fpr_cr) of struct fpreg isn't - * included in mc_fpregs, but it immediately follows - * it in mcontext_t. - */ - savefpstate((struct fpreg *)&mcp->mc_fpregs); - if (td != curthread) - alpha_pal_wrfen(0); - intr_restore(s); - mcp->mc_ownedfp = _MC_FPOWNED_FPU; - } else { - /* - * The thread doesn't own the FPU so get the state from - * the PCB. - */ - intr_restore(s); - bcopy(&td->td_pcb->pcb_fp, &mcp->mc_fpregs, - sizeof(td->td_pcb->pcb_fp)); - mcp->mc_ownedfp = _MC_FPOWNED_PCB; - } - /* There's no harm in always doing the following. */ - mcp->mc_fp_control = td->td_pcb->pcb_fp_control; -} - -static int -set_fpcontext(struct thread *td, const mcontext_t *mcp) -{ - register_t s; - - if (mcp->mc_ownedfp == _MC_FPOWNED_NONE) { - /* XXX - Drop fpu state so we get a clean state? */ - alpha_fpstate_drop(td); - } - else if ((mcp->mc_ownedfp != _MC_FPOWNED_FPU) && - (mcp->mc_ownedfp != _MC_FPOWNED_PCB)) - return (EINVAL); - else { - s = intr_disable(); - if (PCPU_GET(fpcurthread) == td) { - /* - * The last field (fpr_cr) of struct fpreg isn't - * included in mc_fpregs, but it immediately follows - * it in mcontext_t. - */ - restorefpstate((struct fpreg *)&mcp->mc_fpregs); - intr_restore(s); - } - else { - /* Just save the state in the PCB. */ - intr_restore(s); - bcopy(&mcp->mc_fpregs, &td->td_pcb->pcb_fp, - sizeof (td->td_pcb->pcb_fp)); - } - td->td_pcb->pcb_fp_control = mcp->mc_fp_control; - } - return (0); -} - -int -fill_dbregs(struct thread *td, struct dbreg *dbregs) -{ - - return (ENOSYS); -} - -int -set_dbregs(struct thread *td, struct dbreg *dbregs) -{ - - return (ENOSYS); -} - -int -fill_fpregs(td, fpregs) - struct thread *td; - struct fpreg *fpregs; -{ - alpha_fpstate_save(td, 0); - - bcopy(&td->td_pcb->pcb_fp, fpregs, sizeof *fpregs); - return (0); -} - -int -set_fpregs(td, fpregs) - struct thread *td; - struct fpreg *fpregs; -{ - alpha_fpstate_drop(td); - - bcopy(fpregs, &td->td_pcb->pcb_fp, sizeof *fpregs); - return (0); -} - -static int -sysctl_machdep_adjkerntz(SYSCTL_HANDLER_ARGS) -{ - int error; - error = sysctl_handle_int(oidp, oidp->oid_arg1, oidp->oid_arg2, - req); - if (!error && req->newptr) - resettodr(); - return (error); -} - -SYSCTL_PROC(_machdep, OID_AUTO, adjkerntz, CTLTYPE_INT|CTLFLAG_RW, - &adjkerntz, 0, sysctl_machdep_adjkerntz, "I", ""); - -SYSCTL_INT(_machdep, OID_AUTO, disable_rtc_set, - CTLFLAG_RW, &disable_rtc_set, 0, ""); - -SYSCTL_INT(_machdep, OID_AUTO, wall_cmos_clock, - CTLFLAG_RW, &wall_cmos_clock, 0, ""); - -void -alpha_fpstate_check(struct thread *td) -{ - /* - * For SMP, we should check the fpcurthread of each cpu. - */ -#ifndef SMP - register_t s; - - s = intr_disable(); - if (td->td_pcb->pcb_hw.apcb_flags & ALPHA_PCB_FLAGS_FEN) - if (td != PCPU_GET(fpcurthread)) - panic("alpha_check_fpcurthread: bogus"); - intr_restore(s); -#endif -} - -#define SET_FEN(td) \ - (td)->td_pcb->pcb_hw.apcb_flags |= ALPHA_PCB_FLAGS_FEN - -#define CLEAR_FEN(td) \ - (td)->td_pcb->pcb_hw.apcb_flags &= ~ALPHA_PCB_FLAGS_FEN - -/* - * Save the floating point state in the pcb. Use this to get read-only - * access to the floating point state. If write is true, the current - * fp process is cleared so that fp state can safely be modified. The - * process will automatically reload the changed state by generating a - * FEN trap. - */ -void -alpha_fpstate_save(struct thread *td, int write) -{ - register_t s; - - s = intr_disable(); - if (td != NULL && td == PCPU_GET(fpcurthread)) { - /* - * If curthread != fpcurthread, then we need to enable FEN - * so that we can dump the fp state. - */ - alpha_pal_wrfen(1); - - /* - * Save the state in the pcb. - */ - savefpstate(&td->td_pcb->pcb_fp); - - if (write) { - /* - * If fpcurthread == curthread, just ask the - * PALcode to disable FEN, otherwise we must - * clear the FEN bit in fpcurthread's pcb. - */ - if (PCPU_GET(fpcurthread) == curthread) - alpha_pal_wrfen(0); - else - CLEAR_FEN(PCPU_GET(fpcurthread)); - PCPU_SET(fpcurthread, NULL); - } else { - /* - * Make sure that we leave FEN enabled if - * curthread == fpcurthread. We must have at most - * one process with FEN enabled. Note that FEN - * must already be set in fpcurthread's pcb. - */ - if (curthread != PCPU_GET(fpcurthread)) - alpha_pal_wrfen(0); - } - } - intr_restore(s); -} - -/* - * Relinquish ownership of the FP state. This is called instead of - * alpha_save_fpstate() if the entire FP state is being changed - * (e.g. on sigreturn). - */ -void -alpha_fpstate_drop(struct thread *td) -{ - register_t s; - - s = intr_disable(); - if (td == PCPU_GET(fpcurthread)) { - if (td == curthread) { - /* - * Disable FEN via the PALcode. This will - * clear the bit in the pcb as well. - */ - alpha_pal_wrfen(0); - } else { - /* - * Clear the FEN bit of the pcb. - */ - CLEAR_FEN(td); - } - PCPU_SET(fpcurthread, NULL); - } - intr_restore(s); -} - -/* - * Switch the current owner of the fp state to p, reloading the state - * from the pcb. - */ -void -alpha_fpstate_switch(struct thread *td) -{ - register_t s; - - /* - * Enable FEN so that we can access the fp registers. - */ - s = intr_disable(); - alpha_pal_wrfen(1); - if (PCPU_GET(fpcurthread)) { - /* - * Dump the old fp state if its valid. - */ - savefpstate(&PCPU_GET(fpcurthread)->td_pcb->pcb_fp); - CLEAR_FEN(PCPU_GET(fpcurthread)); - } - - /* - * Remember the new FP owner and reload its state. - */ - PCPU_SET(fpcurthread, td); - restorefpstate(&PCPU_GET(fpcurthread)->td_pcb->pcb_fp); - - /* - * If the new owner is curthread, leave FEN enabled, otherwise - * mark its PCB so that it gets FEN when we context switch to - * it later. - */ - if (td != curthread) { - alpha_pal_wrfen(0); - SET_FEN(td); - } - - td->td_md.md_flags |= MDTD_FPUSED; - intr_restore(s); -} - -/* - * Initialise a struct pcpu. - */ -void -cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t sz) -{ - - pcpu->pc_idlepcbphys = vtophys((vm_offset_t) &pcpu->pc_idlepcb); - pcpu->pc_idlepcb.apcb_ksp = (u_int64_t) - ((caddr_t) pcpu + sz - sizeof(struct trapframe)); - pcpu->pc_idlepcb.apcb_ptbr = thread0.td_pcb->pcb_hw.apcb_ptbr; - pcpu->pc_current_asngen = 1; -} - -void -spinlock_enter(void) -{ - struct thread *td; - - td = curthread; - if (td->td_md.md_spinlock_count == 0) - td->td_md.md_saved_ipl = intr_disable(); - td->td_md.md_spinlock_count++; - critical_enter(); -} - -void -spinlock_exit(void) -{ - struct thread *td; - - td = curthread; - critical_exit(); - td->td_md.md_spinlock_count--; - if (td->td_md.md_spinlock_count == 0) - intr_restore(td->td_md.md_saved_ipl); -} diff --git a/sys/alpha/alpha/mem.c b/sys/alpha/alpha/mem.c deleted file mode 100644 index fdc59ca..0000000 --- a/sys/alpha/alpha/mem.c +++ /dev/null @@ -1,170 +0,0 @@ -/*- - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1982, 1986, 1990 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, and code derived from software contributed to - * Berkeley by William Jolitz. - * - * 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. - * 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: Utah $Hdr: mem.c 1.13 89/10/08$ - * from: @(#)mem.c 7.2 (Berkeley) 5/9/91 - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -/* - * Memory special file - */ - -#include <sys/param.h> -#include <sys/conf.h> -#include <sys/fcntl.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/memrange.h> -#include <sys/module.h> -#include <sys/mutex.h> -#include <sys/proc.h> -#include <sys/msgbuf.h> -#include <sys/systm.h> -#include <sys/signalvar.h> -#include <sys/uio.h> - -#include <machine/md_var.h> - -#include <vm/vm.h> -#include <vm/pmap.h> -#include <vm/vm_extern.h> - -#include <machine/memdev.h> - -struct mem_range_softc mem_range_softc; - -/* ARGSUSED */ -int -memrw(struct cdev *dev, struct uio *uio, int flags) -{ - vm_offset_t o, v; - int c = 0; - struct iovec *iov; - int error = 0, rw; - vm_offset_t addr, eaddr; - - GIANT_REQUIRED; - - while (uio->uio_resid > 0 && !error) { - iov = uio->uio_iov; - if (iov->iov_len == 0) { - uio->uio_iov++; - uio->uio_iovcnt--; - if (uio->uio_iovcnt < 0) - panic("memrw"); - continue; - } - if (minor(dev) == CDEV_MINOR_MEM) { - v = uio->uio_offset; -kmemphys: - /* Allow reads only in RAM. */ - rw = (uio->uio_rw == UIO_READ) ? VM_PROT_READ : VM_PROT_WRITE; - if ((alpha_pa_access(v) & rw) != rw) { - error = EFAULT; - c = 0; - break; - } - - o = uio->uio_offset & PAGE_MASK; - c = min(uio->uio_resid, (int)(PAGE_SIZE - o)); - error = - uiomove((caddr_t)ALPHA_PHYS_TO_K0SEG(v), c, uio); - continue; - } - else if (minor(dev) == CDEV_MINOR_KMEM) { - v = uio->uio_offset; - - if (v >= ALPHA_K0SEG_BASE && v <= ALPHA_K0SEG_END) { - v = ALPHA_K0SEG_TO_PHYS(v); - goto kmemphys; - } - - c = min(iov->iov_len, MAXPHYS); - /* - * Make sure that all of the pages are currently - * resident so that we don't create any zero-fill - * pages. - */ - addr = trunc_page(v); - eaddr = round_page(v + c); - for (; addr < eaddr; addr += PAGE_SIZE) - if (pmap_extract(kernel_pmap, addr) == 0) { - return EFAULT; - } - if (!kernacc((caddr_t)v, c, - uio->uio_rw == UIO_READ ? - VM_PROT_READ : VM_PROT_WRITE)) { - return (EFAULT); - } - error = uiomove((caddr_t)v, c, uio); - continue; - } - /* else panic! */ - } - return (error); -} - -/* - * allow user processes to MMAP some memory sections - * instead of going through read/write - */ -int -memmmap(struct cdev *dev, vm_offset_t offset, vm_paddr_t *paddr, int prot) -{ - /* - * /dev/mem is the only one that makes sense through this - * interface. For /dev/kmem any physaddr we return here - * could be transient and hence incorrect or invalid at - * a later time. - */ - if (minor(dev) != CDEV_MINOR_MEM) - return (-1); - - /* - * Allow access only in RAM. - */ - if ((prot & alpha_pa_access(atop((vm_offset_t)offset))) != prot) - return (-1); - *paddr = ALPHA_PHYS_TO_K0SEG(offset); - return (0); -} - -void -dev_mem_md_init(void) -{ -} diff --git a/sys/alpha/alpha/mp_machdep.c b/sys/alpha/alpha/mp_machdep.c deleted file mode 100644 index 9d6cdc5..0000000 --- a/sys/alpha/alpha/mp_machdep.c +++ /dev/null @@ -1,599 +0,0 @@ -/*- - * Copyright (c) 2000 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_kstack_pages.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/ktr.h> -#include <sys/proc.h> -#include <sys/cons.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/mutex.h> -#include <sys/kernel.h> -#include <sys/pcpu.h> -#include <sys/smp.h> -#include <sys/sysctl.h> -#include <sys/bus.h> - -#include <vm/vm.h> -#include <vm/pmap.h> -#include <vm/vm_map.h> - -#include <machine/atomic.h> -#include <machine/clock.h> -#include <machine/md_var.h> -#include <machine/pcb.h> -#include <machine/pmap.h> -#include <machine/prom.h> -#include <machine/rpb.h> -#include <machine/smp.h> - -/* Set to 1 once we're ready to let the APs out of the pen. */ -static volatile int aps_ready = 0; - -static struct mtx ap_boot_mtx; - -u_int64_t boot_cpu_id; -struct pcb stoppcbs[MAXCPU]; - -static void release_aps(void *dummy); -static int smp_cpu_enabled(struct pcs *pcsp); -extern void smp_init_secondary_glue(void); -static int smp_send_secondary_command(const char *command, int pal_id); -static int smp_start_secondary(int pal_id, int cpuid); - -/* - * Communicate with a console running on a secondary processor. - * Return 1 on failure. - */ -static int -smp_send_secondary_command(const char *command, int pal_id) -{ - u_int64_t mask = 1L << pal_id; - struct pcs *cpu = LOCATE_PCS(hwrpb, pal_id); - int i, len; - - /* - * Sanity check. - */ - len = strlen(command); - if (len > sizeof(cpu->pcs_buffer.rxbuf)) { - printf("smp_send_secondary_command: command '%s' too long\n", - command); - return 0; - } - - /* - * Wait for the rx bit to clear. - */ - for (i = 0; i < 100000; i++) { - if (!(hwrpb->rpb_rxrdy & mask)) - break; - DELAY(10); - } - if (hwrpb->rpb_rxrdy & mask) - return 0; - - /* - * Write the command into the processor's buffer. - */ - bcopy(command, cpu->pcs_buffer.rxbuf, len); - cpu->pcs_buffer.rxlen = len; - - /* - * Set the bit in the rxrdy mask and let the secondary try to - * handle the command. - */ - atomic_set_64(&hwrpb->rpb_rxrdy, mask); - - /* - * Wait for the rx bit to clear. - */ - for (i = 0; i < 100000; i++) { - if (!(hwrpb->rpb_rxrdy & mask)) - break; - DELAY(10); - } - if (hwrpb->rpb_rxrdy & mask) - return 0; - - return 1; -} - -void -smp_init_secondary(void) -{ - struct pcs *cpu; - - /* spin until all the AP's are ready */ - while (!aps_ready) - /*spin*/ ; - - /* - * Record the pcpu pointer in the per-cpu system value. - */ - alpha_pal_wrval((u_int64_t) pcpup); - - /* Clear userland thread pointer. */ - alpha_pal_wrunique(0); - - /* Initialize curthread. */ - KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); - PCPU_SET(curthread, PCPU_GET(idlethread)); - - /* - * Point interrupt/exception vectors to our own. - */ - alpha_pal_wrent(XentInt, ALPHA_KENTRY_INT); - alpha_pal_wrent(XentArith, ALPHA_KENTRY_ARITH); - alpha_pal_wrent(XentMM, ALPHA_KENTRY_MM); - alpha_pal_wrent(XentIF, ALPHA_KENTRY_IF); - alpha_pal_wrent(XentUna, ALPHA_KENTRY_UNA); - alpha_pal_wrent(XentSys, ALPHA_KENTRY_SYS); - - - /* lower the ipl and take any pending machine check */ - mc_expected = 1; - alpha_mb(); alpha_mb(); - alpha_pal_wrmces(7); - (void)alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH); - mc_expected = 0; - - /* - * Set flags in our per-CPU slot in the HWRPB. - */ - cpu = LOCATE_PCS(hwrpb, PCPU_GET(pal_id)); - cpu->pcs_flags &= ~PCS_BIP; - cpu->pcs_flags |= PCS_RC; - alpha_mb(); - - /* - * XXX: doesn't idleproc already have a pcb from when it was - * kthread_create'd? - * - * cache idleproc's physical address. - */ - curthread->td_md.md_pcbpaddr = (struct pcb *)PCPU_GET(idlepcbphys); - /* - * and make idleproc's trapframe pointer point to its - * stack pointer for sanity. - */ - curthread->td_frame = - (struct trapframe *)PCPU_PTR(idlepcb)->apcb_ksp; - - mtx_lock_spin(&ap_boot_mtx); - - smp_cpus++; - - CTR1(KTR_SMP, "SMP: AP CPU #%d Launched", PCPU_GET(cpuid)); - - /* Build our map of 'other' CPUs. */ - PCPU_SET(other_cpus, all_cpus & ~PCPU_GET(cpumask)); - - printf("SMP: AP CPU #%d Launched!\n", PCPU_GET(cpuid)); - - if (smp_cpus == mp_ncpus) { - smp_started = 1; - smp_active = 1; - } - - mtx_unlock_spin(&ap_boot_mtx); - - while (smp_started == 0) - ; /* nothing */ - - /* ok, now grab sched_lock and enter the scheduler */ - mtx_lock_spin(&sched_lock); - - /* - * Correct spinlock nesting. The idle thread context that we are - * borrowing was created so that it would start out with a single - * spin lock (sched_lock) held in fork_trampoline(). Since we've - * explicitly acquired locks in this function, the nesting count - * is now 2 rather than 1. Since we are nested, calling - * spinlock_exit() will simply adjust the counts without allowing - * spin lock using code to interrupt us. - */ - spinlock_exit(); - KASSERT(curthread->td_md.md_spinlock_count == 1, ("invalid count")); - - PCPU_SET(switchtime, cpu_ticks()); - PCPU_SET(switchticks, ticks); - - cpu_throw(NULL, choosethread()); /* doesn't return */ - - panic("scheduler returned us to %s", __func__); -} - -static int -smp_start_secondary(int pal_id, int cpuid) -{ - struct pcs *cpu = LOCATE_PCS(hwrpb, pal_id); - struct pcs *bootcpu = LOCATE_PCS(hwrpb, boot_cpu_id); - struct alpha_pcb *pcb = (struct alpha_pcb *) cpu->pcs_hwpcb; - struct pcpu *pcpu; - int i; - size_t sz; - - if ((cpu->pcs_flags & PCS_PV) == 0) { - printf("smp_start_secondary: cpu %d PALcode invalid\n", pal_id); - return 0; - } - - if (bootverbose) - printf("smp_start_secondary: starting cpu %d\n", pal_id); - - sz = KSTACK_PAGES * PAGE_SIZE; - pcpu = malloc(sz, M_TEMP, M_NOWAIT); - if (!pcpu) { - printf("smp_start_secondary: can't allocate memory\n"); - return 0; - } - - pcpu_init(pcpu, cpuid, sz); - pcpu->pc_pal_id = pal_id; - - /* - * Copy the idle pcb and setup the address to start executing. - * Use the pcb unique value to point the secondary at its pcpu - * structure. - */ - *pcb = pcpu->pc_idlepcb; - pcb->apcb_unique = (u_int64_t)pcpu; - hwrpb->rpb_restart = (u_int64_t) smp_init_secondary_glue; - hwrpb->rpb_restart_val = (u_int64_t) smp_init_secondary_glue; - hwrpb->rpb_checksum = hwrpb_checksum(); - - /* - * Tell the cpu to start with the same PALcode as us. - */ - bcopy(&bootcpu->pcs_pal_rev, &cpu->pcs_pal_rev, - sizeof cpu->pcs_pal_rev); - - /* - * Set flags in cpu structure and push out write buffers to - * make sure the secondary sees it. - */ - cpu->pcs_flags |= PCS_CV|PCS_RC; - cpu->pcs_flags &= ~PCS_BIP; - alpha_mb(); - - /* - * Fire it up and hope for the best. - */ - if (!smp_send_secondary_command("START\r\n", pal_id)) { - printf("smp_start_secondary: can't send START command\n"); - pcpu_destroy(pcpu); - free(pcpu, M_TEMP); - return 0; - } - - /* - * Wait for the secondary to set the BIP flag in its structure. - */ - for (i = 0; i < 100000; i++) { - if (cpu->pcs_flags & PCS_BIP) - break; - DELAY(10); - } - if (!(cpu->pcs_flags & PCS_BIP)) { - printf("smp_start_secondary: secondary did not respond\n"); - pcpu_destroy(pcpu); - free(pcpu, M_TEMP); - return 0; - } - - /* - * It worked (I think). - */ - if (bootverbose) - printf("smp_start_secondary: cpu %d started\n", pal_id); - return 1; -} - -/* Other stuff */ - -static int -smp_cpu_enabled(struct pcs *pcsp) -{ - - /* Is this CPU present? */ - if ((pcsp->pcs_flags & PCS_PP) == 0) - return (0); - - /* Is this CPU available? */ - if ((pcsp->pcs_flags & PCS_PA) == 0) - /* - * The TurboLaser PCS_PA bit doesn't seem to be set - * correctly. - */ - if (hwrpb->rpb_type != ST_DEC_21000) - return (0); - - /* Is this CPU's PALcode valid? */ - if ((pcsp->pcs_flags & PCS_PV) == 0) - return (0); - - return (1); -} - -void -cpu_mp_setmaxid(void) -{ - u_int64_t i; - - mp_maxid = 0; - for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) { - if (i == PCPU_GET(pal_id)) - continue; - if (!smp_cpu_enabled(LOCATE_PCS(hwrpb, i))) - continue; - mp_maxid++; - } - if (mp_maxid > MAXCPU) - mp_maxid = MAXCPU; -} - -int -cpu_mp_probe(void) -{ - int i, cpus; - - /* XXX: Need to check for valid platforms here. */ - - boot_cpu_id = PCPU_GET(pal_id); - KASSERT(boot_cpu_id == hwrpb->rpb_primary_cpu_id, - ("cpu_mp_probe() called on non-primary CPU")); - all_cpus = PCPU_GET(cpumask); - - mp_ncpus = 1; - - /* Make sure we have at least one secondary CPU. */ - cpus = 0; - for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) { - if (i == PCPU_GET(pal_id)) - continue; - if (!smp_cpu_enabled(LOCATE_PCS(hwrpb, i))) - continue; - cpus++; - } - return (cpus); -} - -void -cpu_mp_start(void) -{ - int i, cpuid; - - mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); - - cpuid = 1; - for (i = 0; i < hwrpb->rpb_pcs_cnt; i++) { - struct pcs *pcsp; - - if (i == boot_cpu_id) - continue; - pcsp = LOCATE_PCS(hwrpb, i); - if ((pcsp->pcs_flags & PCS_PP) == 0) - continue; - if ((pcsp->pcs_flags & PCS_PA) == 0) { - if (hwrpb->rpb_type == ST_DEC_21000) { - printf("Ignoring PA bit for CPU %d.\n", i); - } else { - if (bootverbose) - printf("CPU %d not available.\n", i); - continue; - } - } - if ((pcsp->pcs_flags & PCS_PV) == 0) { - if (bootverbose) - printf("CPU %d does not have valid PALcode.\n", - i); - continue; - } - if (i > MAXCPU) { - if (bootverbose) { - printf("CPU %d not supported.", i); - printf(" Only %d CPUs supported.\n", MAXCPU); - } - continue; - } - if (resource_disabled("cpu", i)) { - printf("CPU %d disabled by loader.\n", i); - continue; - } - if (smp_start_secondary(i, cpuid)) { - all_cpus |= (1 << cpuid); - mp_ncpus++; - cpuid++; - } - } - PCPU_SET(other_cpus, all_cpus & ~PCPU_GET(cpumask)); -} - -void -cpu_mp_announce(void) -{ - struct pcpu *pc; - int i; - - /* List CPUs */ - printf(" cpu0 (BSP): PAL ID: %2lu\n", boot_cpu_id); - for (i = 1; i < MAXCPU; i++) { - if (CPU_ABSENT(i)) - continue; - pc = pcpu_find(i); - MPASS(pc != NULL); - printf(" cpu%d (AP): PAL ID: %2lu\n", i, pc->pc_pal_id); - } -} - -/* - * send an IPI to a set of cpus. - */ -void -ipi_selected(u_int32_t cpus, u_int64_t ipi) -{ - struct pcpu *pcpu; - - CTR2(KTR_SMP, "ipi_selected: cpus: %x ipi: %lx", cpus, ipi); - alpha_mb(); - while (cpus) { - int cpuid = ffs(cpus) - 1; - cpus &= ~(1 << cpuid); - - pcpu = pcpu_find(cpuid); - if (pcpu) { - atomic_set_64(&pcpu->pc_pending_ipis, ipi); - alpha_mb(); - CTR1(KTR_SMP, "calling alpha_pal_wripir(%d)", - pcpu->pc_pal_id); - alpha_pal_wripir(pcpu->pc_pal_id); - } - } -} - -/* - * send an IPI INTerrupt containing 'vector' to all CPUs, including myself - */ -void -ipi_all(u_int64_t ipi) -{ - ipi_selected(all_cpus, ipi); -} - -/* - * send an IPI to all CPUs EXCEPT myself - */ -void -ipi_all_but_self(u_int64_t ipi) -{ - ipi_selected(PCPU_GET(other_cpus), ipi); -} - -/* - * send an IPI to myself - */ -void -ipi_self(u_int64_t ipi) -{ - ipi_selected(PCPU_GET(cpumask), ipi); -} - -/* - * Handle an IPI sent to this processor. - */ -void -smp_handle_ipi(struct trapframe *frame) -{ - u_int64_t ipis = atomic_readandclear_64(PCPU_PTR(pending_ipis)); - u_int64_t ipi; - int cpumask; - - cpumask = PCPU_GET(cpumask); - - CTR1(KTR_SMP, "smp_handle_ipi(), ipis=%lx", ipis); - while (ipis) { - /* - * Find the lowest set bit. - */ - ipi = ipis & ~(ipis - 1); - ipis &= ~ipi; - switch (ipi) { - case IPI_INVLTLB: - CTR0(KTR_SMP, "IPI_NVLTLB"); - ALPHA_TBIA(); - break; - - case IPI_RENDEZVOUS: - CTR0(KTR_SMP, "IPI_RENDEZVOUS"); - smp_rendezvous_action(); - break; - - case IPI_AST: - CTR0(KTR_SMP, "IPI_AST"); - break; - - case IPI_STOP: - CTR0(KTR_SMP, "IPI_STOP"); - savectx(&stoppcbs[PCPU_GET(cpuid)]); - atomic_set_acq_int(&stopped_cpus, cpumask); - while ((started_cpus & cpumask) == 0) - cpu_spinwait(); - atomic_clear_rel_int(&started_cpus, cpumask); - atomic_clear_rel_int(&stopped_cpus, cpumask); - break; - } - } - - /* - * Dump console messages to the console. XXX - we need to handle - * requests to provide PALcode to secondaries and to start up new - * secondaries that are added to the system on the fly. - */ - if (PCPU_GET(pal_id) == boot_cpu_id) { - u_int pal_id; - u_int64_t txrdy; -#ifdef DIAGNOSTIC - struct pcs *cpu; - char buf[81]; -#endif - - alpha_mb(); - while (hwrpb->rpb_txrdy != 0) { - pal_id = ffs(hwrpb->rpb_txrdy) - 1; -#ifdef DIAGNOSTIC - cpu = LOCATE_PCS(hwrpb, pal_id); - bcopy(&cpu->pcs_buffer.txbuf, buf, - cpu->pcs_buffer.txlen); - buf[cpu->pcs_buffer.txlen] = '\0'; - printf("SMP From CPU%d: %s\n", pal_id, buf); -#endif - do { - txrdy = hwrpb->rpb_txrdy; - } while (atomic_cmpset_64(&hwrpb->rpb_txrdy, txrdy, - txrdy & ~(1 << pal_id)) == 0); - } - } -} - -static void -release_aps(void *dummy __unused) -{ - if (bootverbose && mp_ncpus > 1) - printf("%s: releasing secondary CPUs\n", __func__); - atomic_store_rel_int(&aps_ready, 1); - - while (mp_ncpus > 1 && smp_started == 0) - ; /* nothing */ -} - -SYSINIT(start_aps, SI_SUB_SMP, SI_ORDER_FIRST, release_aps, NULL); diff --git a/sys/alpha/alpha/pal.s b/sys/alpha/alpha/pal.s deleted file mode 100644 index fdf2a46..0000000 --- a/sys/alpha/alpha/pal.s +++ /dev/null @@ -1,370 +0,0 @@ -/*- - * Copyright (c) 1994, 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. - */ - -/* - * The various OSF PALcode routines. - * - * The following code is originally derived from pages: (I) 6-5 - (I) 6-7 - * and (III) 2-1 - (III) 2-25 of "Alpha Architecture Reference Manual" by - * Richard L. Sites. - * - * Updates taken from pages: (II-B) 2-1 - (II-B) 2-33 of "Alpha AXP - * Architecture Reference Manual, Second Edition" by Richard L. Sites - * and Richard T. Witek. - */ - -#include <machine/asm.h> - -__KERNEL_RCSID(1, "$NetBSD: pal.s,v 1.12 1998/02/27 03:44:53 thorpej Exp $"); -__FBSDID("$FreeBSD$"); - - .text - .loc 1 __LINE__ - -/* - * alpha_rpcc: read process cycle counter (XXX INSTRUCTION, NOT PALcode OP) - */ - .text -LEAF(alpha_rpcc,1) - rpcc v0 - RET - END(alpha_rpcc) - -/* - * alpha_mb: memory barrier (XXX INSTRUCTION, NOT PALcode OP) - */ - .text -LEAF(alpha_mb,0) - mb - RET - END(alpha_mb) - -/* - * alpha_wmb: write memory barrier (XXX INSTRUCTION, NOT PALcode OP) - */ - .text -LEAF(alpha_wmb,0) - /* wmb XXX */ - mb /* XXX */ - RET - END(alpha_wmb) - -/* - * alpha_amask: read architecture features (XXX INSTRUCTION, NOT PALcode OP) - * - * Arguments: - * a0 bitmask of features to test - * - * Returns: - * v0 bitmask - bit is _cleared_ if feature is supported - */ - .text -LEAF(alpha_amask,1) - amask a0, v0 - RET - END(alpha_amask) - -/* - * alpha_implver: read implementation version (XXX INSTRUCTION, NOT PALcode OP) - * - * Returns: - * v0 implementation version - see <machine/alpha_cpu.h> - */ - .text -LEAF(alpha_implver,0) -#if 0 - implver 0x1, v0 -#else - .long 0x47e03d80 /* XXX gas(1) does the Wrong Thing */ -#endif - RET - END(alpha_implver) - -/* - * alpha_pal_imb: I-Stream memory barrier. [UNPRIVILEGED] - * (Makes instruction stream coherent with data stream.) - */ - .text -LEAF(alpha_pal_imb,0) - call_pal PAL_imb - RET - END(alpha_pal_imb) - -/* - * alpha_pal_cflush: Cache flush [PRIVILEGED] - * - * Flush the entire physical page specified by the PFN specified in - * a0 from any data caches associated with the current processor. - * - * Arguments: - * a0 page frame number of page to flush - */ - .text -LEAF(alpha_pal_cflush,1) - call_pal PAL_cflush - RET - END(alpha_pal_cflush) - -/* - * alpha_pal_draina: Drain aborts. [PRIVILEGED] - */ - .text -LEAF(alpha_pal_draina,0) - call_pal PAL_draina - RET - END(alpha_pal_draina) - -/* - * alpha_pal_halt: Halt the processor. [PRIVILEGED] - */ - .text -LEAF(alpha_pal_halt,0) - call_pal PAL_halt - br zero,alpha_pal_halt /* Just in case */ - RET - END(alpha_pal_halt) - -/* - * alpha_pal_rdmces: Read MCES processor register. [PRIVILEGED] - * - * Return: - * v0 current MCES value - */ - .text -LEAF(alpha_pal_rdmces,1) - call_pal PAL_OSF1_rdmces - RET - END(alpha_pal_rdmces) - -/* - * alpha_pal_rdps: Read processor status. [PRIVILEGED] - * - * Return: - * v0 current PS value - */ - .text -LEAF(alpha_pal_rdps,0) - call_pal PAL_OSF1_rdps - RET - END(alpha_pal_rdps) - -/* - * alpha_pal_rdusp: Read user stack pointer. [PRIVILEGED] - * - * Return: - * v0 current user stack pointer - */ - .text -LEAF(alpha_pal_rdusp,0) - call_pal PAL_OSF1_rdusp - RET - END(alpha_pal_rdusp) - -/* - * alpha_pal_rdval: Read system value. [PRIVILEGED] - * - * Returns the sysvalue in v0, allowing access to a 64-bit - * per-processor value for use by the operating system. - * - * Return: - * v0 sysvalue - */ - .text -LEAF(alpha_pal_rdval,0) - call_pal PAL_OSF1_rdval - RET - END(alpha_pal_rdval) - -/* - * alpha_pal_swpipl: Swap Interrupt priority level. [PRIVILEGED] - * _alpha_pal_swpipl: Same, from profiling code. [PRIVILEGED] - * - * Arguments: - * a0 new IPL - * - * Return: - * v0 old IPL - */ - .text -LEAF(alpha_pal_swpipl,1) - call_pal PAL_OSF1_swpipl - RET - END(alpha_pal_swpipl) - -LEAF_NOPROFILE(_alpha_pal_swpipl,1) - call_pal PAL_OSF1_swpipl - RET - END(_alpha_pal_swpipl) - -/* - * alpha_pal_tbi: Translation buffer invalidate. [PRIVILEGED] - * - * Arguments: - * a0 operation selector - * a1 address to operate on (if necessary) - */ - .text -LEAF(alpha_pal_tbi,2) - call_pal PAL_OSF1_tbi - RET - END(alpha_pal_tbi) - -/* - * alpha_pal_whami: Who am I? [PRIVILEGED] - * - * Return: - * v0 processor number - */ - .text -LEAF(alpha_pal_whami,0) - call_pal PAL_OSF1_whami - RET - END(alpha_pal_whami) - -/* - * alpha_pal_wrent: Write system entry address. [PRIVILEGED] - * - * Arguments: - * a0 new vector - * a1 vector selector - */ - .text -LEAF(alpha_pal_wrent,2) - call_pal PAL_OSF1_wrent - RET - END(alpha_pal_wrent) - -/* - * alpha_pal_wrfen: Write floating-point enable. [PRIVILEGED] - * - * Arguments: - * a0 new enable value (val & 0x1 -> enable). - */ - .text -LEAF(alpha_pal_wrfen,1) - call_pal PAL_OSF1_wrfen - RET - END(alpha_pal_wrfen) - -/* - * alpha_pal_wripir: Write interprocessor interrupt request. [PRIVILEGED] - * - * Generate an interprocessor interrupt on the processor specified by - * processor number in a0. - * - * Arguments: - * a0 processor to interrupt - */ - .text -LEAF(alpha_pal_wripir,1) - call_pal PAL_ipir - RET - END(alpha_pal_wripir) - -/* - * alpha_pal_wrusp: Write user stack pointer. [PRIVILEGED] - * - * Arguments: - * a0 new user stack pointer - */ - .text -LEAF(alpha_pal_wrusp,1) - call_pal PAL_OSF1_wrusp - RET - END(alpha_pal_wrusp) - -/* - * alpha_pal_wrvptptr: Write virtual page table pointer. [PRIVILEGED] - * - * Arguments: - * a0 new virtual page table pointer - */ - .text -LEAF(alpha_pal_wrvptptr,1) - call_pal PAL_OSF1_wrvptptr - RET - END(alpha_pal_wrvptptr) - -/* - * alpha_pal_wrmces: Write MCES processor register. [PRIVILEGED] - * - * Arguments: - * a0 value to write to MCES - */ - .text -LEAF(alpha_pal_wrmces,1) - call_pal PAL_OSF1_wrmces - RET - END(alpha_pal_wrmces) - -/* - * alpha_pal_wrval: Write system value. [PRIVILEGED] - * - * Write the value passed in a0 to this processor's sysvalue. - * - * Arguments: - * a0 value to write to sysvalue - */ -LEAF(alpha_pal_wrval,1) - call_pal PAL_OSF1_wrval - RET - END(alpha_pal_wrval) - -/* - * alpha_pal_swpctx: Swap context. [PRIVILEGED] - * - * Switch to a new process context. - * - * Arguments: - * a0 physical address of hardware PCB describing context - * - * Returns: - * v0 physical address of hardware PCB describing previous context - */ -LEAF(alpha_pal_swpctx,1) - call_pal PAL_OSF1_swpctx - RET - END(alpha_pal_swpctx) - - -/* - * alpha_pal_wrperfmon: Write perf monitor [PRIVILEGED] - * - * Enables / disables performance monitoring hardware - * - * Arguments: - * a0 function type - * - * a1 function parameter - * - * Returns: - * v0 0 (failure) or 1 (success) - */ -LEAF(alpha_pal_wrperfmon,2) - call_pal PAL_OSF1_wrperfmon - RET - END(alpha_pal_wrperfmon) diff --git a/sys/alpha/alpha/pmap.c b/sys/alpha/alpha/pmap.c deleted file mode 100644 index 10ec682..0000000 --- a/sys/alpha/alpha/pmap.c +++ /dev/null @@ -1,2727 +0,0 @@ -/*- - * Copyright (c) 1991 Regents of the University of California. - * All rights reserved. - * Copyright (c) 1994 John S. Dyson - * All rights reserved. - * Copyright (c) 1994 David Greenman - * All rights reserved. - * Copyright (c) 1998 Doug Rabson - * 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 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 - * 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: @(#)pmap.c 7.7 (Berkeley) 5/12/91 - * from: i386 Id: pmap.c,v 1.193 1998/04/19 15:22:48 bde Exp - * with some ideas from NetBSD's alpha pmap - */ - -/* - * Manages physical address maps. - * - * In addition to hardware address maps, this - * module is called upon to provide software-use-only - * maps which may or may not be stored in the same - * form as hardware maps. These pseudo-maps are - * used to store intermediate results from copy - * operations to and from address spaces. - * - * Since the information managed by this module is - * also stored by the logical address mapping module, - * this module may throw away valid virtual-to-physical - * mappings at almost any time. However, invalidations - * of virtual-to-physical mappings must be done as - * requested. - * - * In order to cope with hardware architectures which - * make virtual-to-physical map invalidates expensive, - * this module may delay invalidate or reduced protection - * operations until such time as they are actually - * necessary. This module is given full information as - * to which processors are currently using which maps, - * and to when physical maps must be made correct. - */ - -/* - * Notes for alpha pmap. - * - * On alpha, pm_pdeobj will hold lev1, lev2 and lev3 page tables. - * Indices from 0 to NUSERLEV3MAPS-1 will map user lev3 page tables, - * indices from NUSERLEV3MAPS to NUSERLEV3MAPS+NUSERLEV2MAPS-1 will - * map user lev2 page tables and index NUSERLEV3MAPS+NUSERLEV2MAPS - * will map the lev1 page table. The lev1 table will self map at - * address VADDR(PTLEV1I,0,0). - * - * The vm_object kptobj holds the kernel page tables on i386 (62 or 63 - * of them, depending on whether the system is SMP). On alpha, kptobj - * will hold the lev3 and lev2 page tables for K1SEG. Indices 0 to - * NKLEV3MAPS-1 will map kernel lev3 page tables and indices - * NKLEV3MAPS to NKLEV3MAPS+NKLEV2MAPS will map lev2 page tables. (XXX - * should the kernel Lev1map be inserted into this object?). - * - * pvtmmap is not needed for alpha since K0SEG maps all of physical - * memory. - * - * - * alpha virtual memory map: - * - * - * Address Lev1 index - * - * --------------------------------- - * 0000000000000000 | | 0 - * | | - * | | - * | | - * | | - * --- --- - * User space (USEG) - * --- --- - * | | - * | | - * | | - * | | - * 000003ffffffffff | | 511=UMAXLEV1I - * --------------------------------- - * fffffc0000000000 | | 512=K0SEGLEV1I - * | Kernel code/data/bss | - * | | - * | | - * | | - * --- --- - * K0SEG - * --- --- - * | | - * | 1-1 physical/virtual | - * | | - * | | - * fffffdffffffffff | | - * --------------------------------- - * fffffe0000000000 | | 768=K1SEGLEV1I - * | Kernel dynamic data | - * | | - * | | - * | | - * --- --- - * K1SEG - * --- --- - * | | - * | mapped by ptes | - * | | - * | | - * fffffff7ffffffff | | - * --------------------------------- - * fffffffe00000000 | | 1023=PTLEV1I - * | PTmap (pte self map) | - * ffffffffffffffff | | - * --------------------------------- - * - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/malloc.h> -#include <sys/proc.h> -#include <sys/msgbuf.h> -#include <sys/vmmeter.h> -#include <sys/mman.h> -#include <sys/smp.h> -#include <sys/sx.h> - -#include <vm/vm.h> -#include <vm/vm_param.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <vm/vm_kern.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> -#include <vm/vm_object.h> -#include <vm/vm_extern.h> -#include <vm/vm_pageout.h> -#include <vm/vm_pager.h> -#include <vm/uma.h> - -#include <machine/md_var.h> -#include <machine/pcb.h> -#include <machine/rpb.h> - -#ifndef PMAP_SHPGPERPROC -#define PMAP_SHPGPERPROC 200 -#endif - -#if defined(DIAGNOSTIC) -#define PMAP_DIAGNOSTIC -#endif - -#if 0 -#define PMAP_DIAGNOSTIC -#define PMAP_DEBUG -#endif - -#if !defined(PMAP_DIAGNOSTIC) -#define PMAP_INLINE __inline -#else -#define PMAP_INLINE -#endif - -/* - * Some macros for manipulating virtual addresses - */ -#define ALPHA_L1SIZE (1L << ALPHA_L1SHIFT) -#define ALPHA_L2SIZE (1L << ALPHA_L2SHIFT) - -#define alpha_l1trunc(va) ((va) & ~(ALPHA_L1SIZE-1)) -#define alpha_l2trunc(va) ((va) & ~(ALPHA_L2SIZE-1)) - -/* - * Get PDEs and PTEs for user/kernel address space - */ -#define pmap_pte_w(pte) ((*(pte) & PG_W) != 0) -#define pmap_pte_managed(pte) ((*(pte) & PG_MANAGED) != 0) -#define pmap_pte_v(pte) ((*(pte) & PG_V) != 0) -#define pmap_pte_pa(pte) alpha_ptob(ALPHA_PTE_TO_PFN(*(pte))) -#define pmap_pte_prot(pte) (*(pte) & PG_PROT) - -#define pmap_pte_set_w(pte, v) ((v)?(*pte |= PG_W):(*pte &= ~PG_W)) -#define pmap_pte_set_prot(pte, v) ((*pte &= ~PG_PROT), (*pte |= (v))) - -/* - * Given a map and a machine independent protection code, - * convert to an alpha protection code. - */ -#define pte_prot(m, p) (protection_codes[m == kernel_pmap ? 0 : 1][p]) -int protection_codes[2][8]; - -/* - * Return non-zero if this pmap is currently active - */ -#define pmap_isactive(pmap) (pmap->pm_active) - -/* - * Extract level 1, 2 and 3 page table indices from a va - */ -#define PTMASK ((1 << ALPHA_PTSHIFT) - 1) - -#define pmap_lev1_index(va) (((va) >> ALPHA_L1SHIFT) & PTMASK) -#define pmap_lev2_index(va) (((va) >> ALPHA_L2SHIFT) & PTMASK) -#define pmap_lev3_index(va) (((va) >> ALPHA_L3SHIFT) & PTMASK) - -/* - * Given a physical address, construct a pte - */ -#define pmap_phys_to_pte(pa) ALPHA_PTE_FROM_PFN(alpha_btop(pa)) - -/* - * Given a page frame number, construct a k0seg va - */ -#define pmap_k0seg_to_pfn(va) alpha_btop(ALPHA_K0SEG_TO_PHYS(va)) - -/* - * Given a pte, construct a k0seg va - */ -#define pmap_k0seg_to_pte(va) ALPHA_PTE_FROM_PFN(pmap_k0seg_to_pfn(va)) - -/* - * Lev1map: - * - * Kernel level 1 page table. This maps all kernel level 2 - * page table pages, and is used as a template for all user - * pmap level 1 page tables. When a new user level 1 page - * table is allocated, all Lev1map PTEs for kernel addresses - * are copied to the new map. - * - * Lev2map: - * - * Initial set of kernel level 2 page table pages. These - * map the kernel level 3 page table pages. As kernel - * level 3 page table pages are added, more level 2 page - * table pages may be added to map them. These pages are - * never freed. - * - * Lev3map: - * - * Initial set of kernel level 3 page table pages. These - * map pages in K1SEG. More level 3 page table pages may - * be added at run-time if additional K1SEG address space - * is required. These pages are never freed. - * - * Lev2mapsize: - * - * Number of entries in the initial Lev2map. - * - * Lev3mapsize: - * - * Number of entries in the initial Lev3map. - * - * NOTE: When mappings are inserted into the kernel pmap, all - * level 2 and level 3 page table pages must already be allocated - * and mapped into the parent page table. - */ -pt_entry_t *Lev1map, *Lev2map, *Lev3map; -vm_size_t Lev2mapsize, Lev3mapsize; - -/* - * Statically allocated kernel pmap - */ -struct pmap kernel_pmap_store; - -vm_offset_t virtual_avail; /* VA of first avail page (after kernel bss) */ -vm_offset_t virtual_end; /* VA of last avail page (end of kernel AS) */ - -static int nklev3, nklev2; -vm_offset_t kernel_vm_end; - -/* - * Data for the ASN allocator - */ -static int pmap_maxasn; -static pmap_t pmap_active[MAXCPU]; -static LIST_HEAD(,pmap) allpmaps; -static struct mtx allpmaps_lock; - -/* - * Data for the pv entry allocation mechanism - */ -static uma_zone_t pvzone; -static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0; - -static PMAP_INLINE void free_pv_entry(pv_entry_t pv); -static pv_entry_t get_pv_entry(pmap_t locked_pmap); -static void alpha_protection_init(void); -static void pmap_changebit(vm_page_t m, int bit, boolean_t setem); - -static int pmap_remove_pte(pmap_t pmap, pt_entry_t* ptq, vm_offset_t sva); -static void pmap_remove_page(struct pmap *pmap, vm_offset_t va); -static int pmap_remove_entry(struct pmap *pmap, vm_page_t m, vm_offset_t va); -static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, - vm_page_t mpte, vm_page_t m); - -static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va); - -static vm_page_t _pmap_allocpte(pmap_t pmap, unsigned ptepindex, int flags); -static int _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m); -static int pmap_unuse_pt(pmap_t, vm_offset_t, vm_page_t); -#ifdef SMP -static void pmap_invalidate_page_action(void *arg); -static void pmap_invalidate_all_action(void *arg); -#endif - - -/* - * Routine: pmap_lev1pte - * Function: - * Extract the level 1 page table entry associated - * with the given map/virtual_address pair. - */ -static PMAP_INLINE pt_entry_t* -pmap_lev1pte(pmap_t pmap, vm_offset_t va) -{ - if (!pmap) - return 0; - return &pmap->pm_lev1[pmap_lev1_index(va)]; -} - -/* - * Routine: pmap_lev2pte - * Function: - * Extract the level 2 page table entry associated - * with the given map/virtual_address pair. - */ -static PMAP_INLINE pt_entry_t* -pmap_lev2pte(pmap_t pmap, vm_offset_t va) -{ - pt_entry_t* l1pte; - pt_entry_t* l2map; - - l1pte = pmap_lev1pte(pmap, va); - if (!pmap_pte_v(l1pte)) - return 0; - - l2map = (pt_entry_t*) ALPHA_PHYS_TO_K0SEG(pmap_pte_pa(l1pte)); - return &l2map[pmap_lev2_index(va)]; -} - -/* - * Routine: pmap_lev3pte - * Function: - * Extract the level 3 page table entry associated - * with the given map/virtual_address pair. - */ -static PMAP_INLINE pt_entry_t* -pmap_lev3pte(pmap_t pmap, vm_offset_t va) -{ - pt_entry_t* l2pte; - pt_entry_t* l3map; - - l2pte = pmap_lev2pte(pmap, va); - if (!l2pte || !pmap_pte_v(l2pte)) - return 0; - - l3map = (pt_entry_t*) ALPHA_PHYS_TO_K0SEG(pmap_pte_pa(l2pte)); - return &l3map[pmap_lev3_index(va)]; -} - -vm_offset_t -pmap_steal_memory(vm_size_t size) -{ - vm_size_t bank_size; - vm_offset_t pa, va; - - size = round_page(size); - - bank_size = phys_avail[1] - phys_avail[0]; - while (size > bank_size) { - int i; - for (i = 0; phys_avail[i+2]; i+= 2) { - phys_avail[i] = phys_avail[i+2]; - phys_avail[i+1] = phys_avail[i+3]; - } - phys_avail[i] = 0; - phys_avail[i+1] = 0; - if (!phys_avail[0]) - panic("pmap_steal_memory: out of memory"); - bank_size = phys_avail[1] - phys_avail[0]; - } - - pa = phys_avail[0]; - phys_avail[0] += size; - - va = ALPHA_PHYS_TO_K0SEG(pa); - bzero((caddr_t) va, size); - return va; -} - -extern pt_entry_t rom_pte; /* XXX */ -extern int prom_mapped; /* XXX */ - -/* - * Bootstrap the system enough to run with virtual memory. - */ -void -pmap_bootstrap(vm_offset_t ptaddr, u_int maxasn) -{ - pt_entry_t newpte; - int i; - - /* - * Setup ASNs. PCPU_GET(next_asn) and PCPU_GET(current_asngen) are set - * up already. - */ - pmap_maxasn = maxasn; - - /* - * Allocate a level 1 map for the kernel. - */ - Lev1map = (pt_entry_t*) pmap_steal_memory(PAGE_SIZE); - - /* - * Allocate a level 2 map for the kernel - */ - Lev2map = (pt_entry_t*) pmap_steal_memory(PAGE_SIZE); - Lev2mapsize = PAGE_SIZE; - - /* - * Allocate some level 3 maps for the kernel - */ - Lev3map = (pt_entry_t*) pmap_steal_memory(PAGE_SIZE*NKPT); - Lev3mapsize = NKPT * PAGE_SIZE; - - /* Map all of the level 2 maps */ - for (i = 0; i < howmany(Lev2mapsize, PAGE_SIZE); i++) { - unsigned long pfn = - pmap_k0seg_to_pfn((vm_offset_t) Lev2map) + i; - newpte = ALPHA_PTE_FROM_PFN(pfn); - newpte |= PG_V | PG_ASM | PG_KRE | PG_KWE | PG_W; - Lev1map[K1SEGLEV1I + i] = newpte; - } - - - /* Setup the mapping for the prom console */ - { - - if (pmap_uses_prom_console()) { - /* XXX save old pte so that we can remap prom if necessary */ - rom_pte = *(pt_entry_t *)ptaddr & ~PG_ASM; /* XXX */ - } - prom_mapped = 0; - - /* - * Actually, this code lies. The prom is still mapped, and will - * remain so until the context switch after alpha_init() returns. - * Printfs using the firmware before then will end up frobbing - * Lev1map unnecessarily, but that's OK. - */ - } - - /* - * Level 1 self mapping. - * - * Don't set PG_ASM since the self-mapping is different for each - * address space. - */ - newpte = pmap_k0seg_to_pte((vm_offset_t) Lev1map); - newpte |= PG_V | PG_KRE | PG_KWE; - Lev1map[PTLEV1I] = newpte; - - /* Map all of the level 3 maps */ - for (i = 0; i < howmany(Lev3mapsize, PAGE_SIZE); i++) { - unsigned long pfn = - pmap_k0seg_to_pfn((vm_offset_t) Lev3map) + i; - newpte = ALPHA_PTE_FROM_PFN(pfn); - newpte |= PG_V | PG_ASM | PG_KRE | PG_KWE | PG_W; - Lev2map[i] = newpte; - } - - virtual_avail = VM_MIN_KERNEL_ADDRESS; - virtual_end = VPTBASE; - - /* - * Initialize protection array. - */ - alpha_protection_init(); - - /* - * Initialize the kernel pmap (which is statically allocated). - */ - PMAP_LOCK_INIT(kernel_pmap); - kernel_pmap->pm_lev1 = Lev1map; - kernel_pmap->pm_active = ~0; - kernel_pmap->pm_asn[alpha_pal_whami()].asn = 0; - kernel_pmap->pm_asn[alpha_pal_whami()].gen = 1; - TAILQ_INIT(&kernel_pmap->pm_pvlist); - nklev3 = NKPT; - nklev2 = 1; - - /* - * Initialize list of pmaps. - */ - LIST_INIT(&allpmaps); - LIST_INSERT_HEAD(&allpmaps, kernel_pmap, pm_list); - - /* - * Set up proc0's PCB such that the ptbr points to the right place - * and has the kernel pmap's. - */ - thread0.td_pcb->pcb_hw.apcb_ptbr = - ALPHA_K0SEG_TO_PHYS((vm_offset_t)Lev1map) >> PAGE_SHIFT; - thread0.td_pcb->pcb_hw.apcb_asn = 0; -} - -int -pmap_uses_prom_console() -{ - int cputype; - - cputype = hwrpb->rpb_type; - return (cputype == ST_DEC_21000 || ST_DEC_4100); -} - -/* - * Initialize a vm_page's machine-dependent fields. - */ -void -pmap_page_init(vm_page_t m) -{ - - TAILQ_INIT(&m->md.pv_list); - m->md.pv_list_count = 0; -} - -/* - * Initialize the pmap module. - * Called by vm_init, to initialize any structures that the pmap - * system needs to map virtual memory. - */ -void -pmap_init(void) -{ - int shpgperproc = PMAP_SHPGPERPROC; - - /* - * Initialize the address space (zone) for the pv entries. Set a - * high water mark so that the system can recover from excessive - * numbers of pv entries. - */ - pvzone = uma_zcreate("PV ENTRY", sizeof(struct pv_entry), NULL, NULL, - NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM | UMA_ZONE_NOFREE); - TUNABLE_INT_FETCH("vm.pmap.shpgperproc", &shpgperproc); - pv_entry_max = shpgperproc * maxproc + cnt.v_page_count; - TUNABLE_INT_FETCH("vm.pmap.pv_entries", &pv_entry_max); - pv_entry_high_water = 9 * (pv_entry_max / 10); -} - - -/*************************************************** - * Manipulate TLBs for a pmap - ***************************************************/ - -static void -pmap_invalidate_asn(pmap_t pmap) -{ - pmap->pm_asn[PCPU_GET(cpuid)].gen = 0; -} - -struct pmap_invalidate_page_arg { - pmap_t pmap; - vm_offset_t va; -}; - -static void -pmap_invalidate_page(pmap_t pmap, vm_offset_t va) -{ -#ifdef SMP - struct pmap_invalidate_page_arg arg; - arg.pmap = pmap; - arg.va = va; - - smp_rendezvous(0, pmap_invalidate_page_action, 0, (void *) &arg); -} - -static void -pmap_invalidate_page_action(void *arg) -{ - pmap_t pmap = ((struct pmap_invalidate_page_arg *) arg)->pmap; - vm_offset_t va = ((struct pmap_invalidate_page_arg *) arg)->va; -#endif - - if (pmap->pm_active & PCPU_GET(cpumask)) { - ALPHA_TBIS(va); - alpha_pal_imb(); /* XXX overkill? */ - } else { - pmap_invalidate_asn(pmap); - } -} - -static void -pmap_invalidate_all(pmap_t pmap) -{ -#ifdef SMP - smp_rendezvous(0, pmap_invalidate_all_action, 0, (void *) pmap); -} - -static void -pmap_invalidate_all_action(void *arg) -{ - pmap_t pmap = (pmap_t) arg; -#endif - - if (pmap->pm_active & PCPU_GET(cpumask)) { - ALPHA_TBIA(); - alpha_pal_imb(); /* XXX overkill? */ - } else - pmap_invalidate_asn(pmap); -} - -static void -pmap_get_asn(pmap_t pmap) -{ - - if (PCPU_GET(next_asn) > pmap_maxasn) { - /* - * Start a new ASN generation. - * - * Invalidate all per-process mappings and I-cache - */ - PCPU_SET(next_asn, 0); - PCPU_SET(current_asngen, (PCPU_GET(current_asngen) + 1) & - ASNGEN_MASK); - - if (PCPU_GET(current_asngen) == 0) { - /* - * Clear the pm_asn[].gen of all pmaps. - * This is safe since it is only called from - * pmap_activate after it has deactivated - * the old pmap and it only affects this cpu. - */ - pmap_t tpmap; - -#ifdef PMAP_DIAGNOSTIC - printf("pmap_get_asn: generation rollover\n"); -#endif - PCPU_SET(current_asngen, 1); - mtx_lock_spin(&allpmaps_lock); - LIST_FOREACH(tpmap, &allpmaps, pm_list) { - tpmap->pm_asn[PCPU_GET(cpuid)].gen = 0; - } - mtx_unlock_spin(&allpmaps_lock); - } - - /* - * Since we are about to start re-using ASNs, we must - * clear out the TLB and the I-cache since they are tagged - * with the ASN. - */ - ALPHA_TBIAP(); - alpha_pal_imb(); /* XXX overkill? */ - } - pmap->pm_asn[PCPU_GET(cpuid)].asn = PCPU_GET(next_asn); - PCPU_SET(next_asn, PCPU_GET(next_asn) + 1); - pmap->pm_asn[PCPU_GET(cpuid)].gen = PCPU_GET(current_asngen); -} - -/*************************************************** - * Low level helper routines..... - ***************************************************/ - -/* - * Routine: pmap_extract - * Function: - * Extract the physical page address associated - * with the given map/virtual_address pair. - */ -vm_paddr_t -pmap_extract(pmap_t pmap, vm_offset_t va) -{ - pt_entry_t *pte; - vm_paddr_t pa; - - pa = 0; - PMAP_LOCK(pmap); - pte = pmap_lev3pte(pmap, va); - if (pte != NULL && pmap_pte_v(pte)) - pa = pmap_pte_pa(pte); - PMAP_UNLOCK(pmap); - return (pa); -} - -/* - * Routine: pmap_extract_and_hold - * Function: - * Atomically extract and hold the physical page - * with the given pmap and virtual address pair - * if that mapping permits the given protection. - */ -vm_page_t -pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, vm_prot_t prot) -{ - pt_entry_t *pte; - vm_page_t m; - - m = NULL; - vm_page_lock_queues(); - PMAP_LOCK(pmap); - pte = pmap_lev3pte(pmap, va); - if (pte != NULL && pmap_pte_v(pte) && - (*pte & pte_prot(pmap, prot)) == pte_prot(pmap, prot)) { - m = PHYS_TO_VM_PAGE(pmap_pte_pa(pte)); - vm_page_hold(m); - } - vm_page_unlock_queues(); - PMAP_UNLOCK(pmap); - return (m); -} - -/*************************************************** - * Low level mapping routines..... - ***************************************************/ - -/* - * Add a list of wired pages to the kva - * this routine is only used for temporary - * kernel mappings that do not need to have - * page modification or references recorded. - * Note that old mappings are simply written - * over. The page *must* be wired. - */ -void -pmap_qenter(vm_offset_t va, vm_page_t *m, int count) -{ - int i; - pt_entry_t *pte; - - for (i = 0; i < count; i++) { - vm_offset_t tva = va + i * PAGE_SIZE; - pt_entry_t npte = pmap_phys_to_pte(VM_PAGE_TO_PHYS(m[i])) - | PG_ASM | PG_KRE | PG_KWE | PG_V; - pt_entry_t opte; - pte = vtopte(tva); - opte = *pte; - *pte = npte; - if (opte) - pmap_invalidate_page(kernel_pmap, tva); - } -} - -/* - * this routine jerks page mappings from the - * kernel -- it is meant only for temporary mappings. - */ -void -pmap_qremove(va, count) - vm_offset_t va; - int count; -{ - int i; - register pt_entry_t *pte; - - for (i = 0; i < count; i++) { - pte = vtopte(va); - *pte = 0; - pmap_invalidate_page(kernel_pmap, va); - va += PAGE_SIZE; - } -} - -/* - * add a wired page to the kva - * note that in order for the mapping to take effect -- you - * should do a invltlb after doing the pmap_kenter... - */ -PMAP_INLINE void -pmap_kenter(vm_offset_t va, vm_offset_t pa) -{ - pt_entry_t *pte; - pt_entry_t npte, opte; - - npte = pmap_phys_to_pte(pa) | PG_ASM | PG_KRE | PG_KWE | PG_V; - pte = vtopte(va); - opte = *pte; - *pte = npte; - if (opte) - pmap_invalidate_page(kernel_pmap, va); -} - -/* - * remove a page from the kernel pagetables - */ -PMAP_INLINE void -pmap_kremove(vm_offset_t va) -{ - register pt_entry_t *pte; - - pte = vtopte(va); - *pte = 0; - pmap_invalidate_page(kernel_pmap, va); -} - -/* - * Used to map a range of physical addresses into kernel - * virtual address space. - * - * The value passed in '*virt' is a suggested virtual address for - * the mapping. Architectures which can support a direct-mapped - * physical to virtual region can return the appropriate address - * within that region, leaving '*virt' unchanged. Other - * architectures should map the pages starting at '*virt' and - * update '*virt' with the first usable address after the mapped - * region. - */ -vm_offset_t -pmap_map(vm_offset_t *virt, vm_offset_t start, vm_offset_t end, int prot) -{ - return ALPHA_PHYS_TO_K0SEG(start); -} - -/*************************************************** - * Page table page management routines..... - ***************************************************/ - -/* - * This routine unholds page table pages, and if the hold count - * drops to zero, then it decrements the wire count. - */ -static PMAP_INLINE int -pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m) -{ - - --m->wire_count; - if (m->wire_count == 0) - return _pmap_unwire_pte_hold(pmap, va, m); - else - return 0; -} - -static int -_pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m) -{ - vm_offset_t pteva; - pt_entry_t* pte; - - /* - * unmap the page table page - */ - if (m->pindex >= NUSERLEV3MAPS) { - /* Level 2 page table */ - pte = pmap_lev1pte(pmap, va); - pteva = (vm_offset_t) PTlev2 + alpha_ptob(m->pindex - NUSERLEV3MAPS); - } else { - /* Level 3 page table */ - pte = pmap_lev2pte(pmap, va); - pteva = (vm_offset_t) PTmap + alpha_ptob(m->pindex); - } - - *pte = 0; - - if (m->pindex < NUSERLEV3MAPS) { - /* unhold the level 2 page table */ - vm_page_t lev2pg; - - lev2pg = PHYS_TO_VM_PAGE(pmap_pte_pa(pmap_lev1pte(pmap, va))); - pmap_unwire_pte_hold(pmap, va, lev2pg); - } - - --pmap->pm_stats.resident_count; - /* - * Do a invltlb to make the invalidated mapping - * take effect immediately. - */ - pmap_invalidate_page(pmap, pteva); - - if (pmap->pm_ptphint == m) - pmap->pm_ptphint = NULL; - - vm_page_free_zero(m); - atomic_subtract_int(&cnt.v_wire_count, 1); - return 1; -} - -/* - * After removing a page table entry, this routine is used to - * conditionally free the page, and manage the hold/wire counts. - */ -static int -pmap_unuse_pt(pmap_t pmap, vm_offset_t va, vm_page_t mpte) -{ - unsigned ptepindex; - if (va >= VM_MAXUSER_ADDRESS) - return 0; - - if (mpte == NULL) { - ptepindex = (va >> ALPHA_L2SHIFT); - if (pmap->pm_ptphint && - (pmap->pm_ptphint->pindex == ptepindex)) { - mpte = pmap->pm_ptphint; - } else { - mpte = PHYS_TO_VM_PAGE(pmap_pte_pa(pmap_lev2pte(pmap, va))); - pmap->pm_ptphint = mpte; - } - } - - return pmap_unwire_pte_hold(pmap, va, mpte); -} - -void -pmap_pinit0(pmap) - struct pmap *pmap; -{ - int i; - - PMAP_LOCK_INIT(pmap); - pmap->pm_lev1 = Lev1map; - pmap->pm_ptphint = NULL; - pmap->pm_active = 0; - for (i = 0; i < MAXCPU; i++) { - pmap->pm_asn[i].asn = 0; - pmap->pm_asn[i].gen = 0; - } - TAILQ_INIT(&pmap->pm_pvlist); - bzero(&pmap->pm_stats, sizeof pmap->pm_stats); - mtx_init(&allpmaps_lock, "allpmaps", NULL, MTX_SPIN | MTX_QUIET); - LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); -} - -/* - * Initialize a preallocated and zeroed pmap structure, - * such as one in a vmspace structure. - */ -void -pmap_pinit(pmap) - register struct pmap *pmap; -{ - vm_page_t lev1pg; - int i; - - PMAP_LOCK_INIT(pmap); - - /* - * allocate the page directory page - */ - while ((lev1pg = vm_page_alloc(NULL, NUSERLEV3MAPS + NUSERLEV2MAPS, VM_ALLOC_NOOBJ | - VM_ALLOC_NORMAL | VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) - VM_WAIT; - - pmap->pm_lev1 = (pt_entry_t*) ALPHA_PHYS_TO_K0SEG(VM_PAGE_TO_PHYS(lev1pg)); - - if ((lev1pg->flags & PG_ZERO) == 0) - bzero(pmap->pm_lev1, PAGE_SIZE); - - /* install self-referential address mapping entry (not PG_ASM) */ - pmap->pm_lev1[PTLEV1I] = pmap_phys_to_pte(VM_PAGE_TO_PHYS(lev1pg)) - | PG_V | PG_KRE | PG_KWE; - - pmap->pm_ptphint = NULL; - pmap->pm_active = 0; - for (i = 0; i < MAXCPU; i++) { - pmap->pm_asn[i].asn = 0; - pmap->pm_asn[i].gen = 0; - } - TAILQ_INIT(&pmap->pm_pvlist); - bzero(&pmap->pm_stats, sizeof pmap->pm_stats); - mtx_lock_spin(&allpmaps_lock); - LIST_INSERT_HEAD(&allpmaps, pmap, pm_list); - mtx_unlock_spin(&allpmaps_lock); - bcopy(PTlev1 + K1SEGLEV1I, pmap->pm_lev1 + K1SEGLEV1I, nklev2 * PTESIZE); -} - -/* - * this routine is called if the page table page is not - * mapped correctly. - */ -static vm_page_t -_pmap_allocpte(pmap_t pmap, unsigned ptepindex, int flags) -{ - pt_entry_t* pte; - vm_offset_t ptepa; - vm_page_t m; - - KASSERT((flags & (M_NOWAIT | M_WAITOK)) == M_NOWAIT || - (flags & (M_NOWAIT | M_WAITOK)) == M_WAITOK, - ("_pmap_allocpte: flags is neither M_NOWAIT nor M_WAITOK")); - - /* - * Find or fabricate a new pagetable page - */ - if ((m = vm_page_alloc(NULL, ptepindex, VM_ALLOC_NOOBJ | - VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) { - if (flags & M_WAITOK) { - PMAP_UNLOCK(pmap); - vm_page_unlock_queues(); - VM_WAIT; - vm_page_lock_queues(); - PMAP_LOCK(pmap); - } - - /* - * Indicate the need to retry. While waiting, the page table - * page may have been allocated. - */ - return (NULL); - } - if ((m->flags & PG_ZERO) == 0) - pmap_zero_page(m); - - /* - * Map the pagetable page into the process address space, if - * it isn't already there. - */ - - pmap->pm_stats.resident_count++; - - ptepa = VM_PAGE_TO_PHYS(m); - - if (ptepindex >= NUSERLEV3MAPS) { - pte = &pmap->pm_lev1[ptepindex - NUSERLEV3MAPS]; - } else { - int l1index = ptepindex >> ALPHA_PTSHIFT; - pt_entry_t* l1pte = &pmap->pm_lev1[l1index]; - pt_entry_t* l2map; - if (!pmap_pte_v(l1pte)) { - if (_pmap_allocpte(pmap, NUSERLEV3MAPS + l1index, - flags) == NULL) { - --m->wire_count; - vm_page_free(m); - return (NULL); - } - } else { - vm_page_t l2page; - - l2page = PHYS_TO_VM_PAGE(pmap_pte_pa(l1pte)); - l2page->wire_count++; - } - l2map = (pt_entry_t*) ALPHA_PHYS_TO_K0SEG(pmap_pte_pa(l1pte)); - pte = &l2map[ptepindex & ((1 << ALPHA_PTSHIFT) - 1)]; - } - - *pte = pmap_phys_to_pte(ptepa) | PG_KRE | PG_KWE | PG_V; - - /* - * Set the page table hint - */ - pmap->pm_ptphint = m; - - return m; -} - -static vm_page_t -pmap_allocpte(pmap_t pmap, vm_offset_t va) -{ - unsigned ptepindex; - pt_entry_t* lev2pte; - vm_page_t m; - - /* - * Calculate pagetable page index - */ - ptepindex = va >> (PAGE_SHIFT + ALPHA_PTSHIFT); -retry: - /* - * Get the level2 entry - */ - lev2pte = pmap_lev2pte(pmap, va); - - /* - * If the page table page is mapped, we just increment the - * hold count, and activate it. - */ - if (lev2pte && pmap_pte_v(lev2pte)) { - /* - * In order to get the page table page, try the - * hint first. - */ - if (pmap->pm_ptphint && - (pmap->pm_ptphint->pindex == ptepindex)) { - m = pmap->pm_ptphint; - } else { - m = PHYS_TO_VM_PAGE(pmap_pte_pa(lev2pte)); - pmap->pm_ptphint = m; - } - m->wire_count++; - } else { - /* - * Here if the pte page isn't mapped, or if it has been - * deallocated. - */ - m = _pmap_allocpte(pmap, ptepindex, M_WAITOK); - if (m == NULL) - goto retry; - } - return (m); -} - - -/*************************************************** -* Pmap allocation/deallocation routines. - ***************************************************/ - -/* - * Release any resources held by the given physical map. - * Called when a pmap initialized by pmap_pinit is being released. - * Should only be called if the map contains no valid mappings. - */ -void -pmap_release(pmap_t pmap) -{ - vm_page_t lev1pg; - - KASSERT(pmap->pm_stats.resident_count == 0, - ("pmap_release: pmap resident count %ld != 0", - pmap->pm_stats.resident_count)); - - lev1pg = PHYS_TO_VM_PAGE(pmap_pte_pa(&pmap->pm_lev1[PTLEV1I])); - KASSERT(lev1pg->pindex == NUSERLEV3MAPS + NUSERLEV2MAPS, - ("pmap_release: PTLEV1I page has unexpected pindex %ld", - lev1pg->pindex)); - - mtx_lock_spin(&allpmaps_lock); - LIST_REMOVE(pmap, pm_list); - mtx_unlock_spin(&allpmaps_lock); - - /* - * Level1 pages need to have the kernel - * stuff cleared, so they can go into the zero queue also. - */ - bzero(pmap->pm_lev1 + K1SEGLEV1I, nklev2 * PTESIZE); - pmap->pm_lev1[PTLEV1I] = 0; - - PMAP_LOCK_DESTROY(pmap); - - vm_page_lock_queues(); - lev1pg->wire_count--; - atomic_subtract_int(&cnt.v_wire_count, 1); - vm_page_free_zero(lev1pg); - vm_page_unlock_queues(); -} - -/* - * grow the number of kernel page table entries, if needed - */ -void -pmap_growkernel(vm_offset_t addr) -{ - /* XXX come back to this */ - struct pmap *pmap; - pt_entry_t* pte; - pt_entry_t newlev1, newlev2; - vm_offset_t pa; - vm_page_t nkpg; - - critical_enter(); - if (kernel_vm_end == 0) { - kernel_vm_end = VM_MIN_KERNEL_ADDRESS;; - - /* Count the level 2 page tables */ - nklev2 = 0; - nklev3 = 0; - while (pmap_pte_v(pmap_lev1pte(kernel_pmap, kernel_vm_end))) { - nklev2++; - nklev3 += (1L << ALPHA_PTSHIFT); - kernel_vm_end += ALPHA_L1SIZE; - } - - /* Count the level 3 page tables in the last level 2 page table */ - kernel_vm_end -= ALPHA_L1SIZE; - nklev3 -= (1 << ALPHA_PTSHIFT); - while (pmap_pte_v(pmap_lev2pte(kernel_pmap, kernel_vm_end))) { - nklev3++; - kernel_vm_end += ALPHA_L2SIZE; - } - } - - addr = (addr + ALPHA_L2SIZE) & ~(ALPHA_L2SIZE - 1); - while (kernel_vm_end < addr) { - /* - * If the level 1 pte is invalid, allocate a new level 2 page table - */ - pte = pmap_lev1pte(kernel_pmap, kernel_vm_end); - if (!pmap_pte_v(pte)) { - int pindex = NKLEV3MAPS + pmap_lev1_index(kernel_vm_end) - K1SEGLEV1I; - - nkpg = vm_page_alloc(NULL, pindex, - VM_ALLOC_NOOBJ | VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED); - if (!nkpg) - panic("pmap_growkernel: no memory to grow kernel"); - printf("pmap_growkernel: growing to %lx\n", addr); - printf("pmap_growkernel: adding new level2 page table\n"); - - nklev2++; - pmap_zero_page(nkpg); - - pa = VM_PAGE_TO_PHYS(nkpg); - newlev1 = pmap_phys_to_pte(pa) - | PG_V | PG_ASM | PG_KRE | PG_KWE; - - mtx_lock_spin(&allpmaps_lock); - LIST_FOREACH(pmap, &allpmaps, pm_list) { - *pmap_lev1pte(pmap, kernel_vm_end) = newlev1; - } - mtx_unlock_spin(&allpmaps_lock); - *pte = newlev1; - pmap_invalidate_all(kernel_pmap); - } - - /* - * If the level 2 pte is invalid, allocate a new level 3 page table - */ - pte = pmap_lev2pte(kernel_pmap, kernel_vm_end); - if (pmap_pte_v(pte)) { - kernel_vm_end = (kernel_vm_end + ALPHA_L2SIZE) & ~(ALPHA_L2SIZE - 1); - continue; - } - - /* - * This index is bogus, but out of the way - */ - nkpg = vm_page_alloc(NULL, nklev3, - VM_ALLOC_NOOBJ | VM_ALLOC_INTERRUPT | VM_ALLOC_WIRED); - if (!nkpg) - panic("pmap_growkernel: no memory to grow kernel"); - - nklev3++; - pmap_zero_page(nkpg); - pa = VM_PAGE_TO_PHYS(nkpg); - newlev2 = pmap_phys_to_pte(pa) | PG_V | PG_ASM | PG_KRE | PG_KWE; - *pte = newlev2; - - kernel_vm_end = (kernel_vm_end + ALPHA_L2SIZE) & ~(ALPHA_L2SIZE - 1); - } - critical_exit(); -} - - -/*************************************************** - * page management routines. - ***************************************************/ - -/* - * free the pv_entry back to the free list - */ -static PMAP_INLINE void -free_pv_entry(pv_entry_t pv) -{ - pv_entry_count--; - uma_zfree(pvzone, pv); -} - -/* - * get a new pv_entry, allocating a block from the system - * when needed. - */ -static pv_entry_t -get_pv_entry(pmap_t locked_pmap) -{ - static const struct timeval printinterval = { 60, 0 }; - static struct timeval lastprint; - struct vpgqueues *vpq; - pmap_t pmap; - pt_entry_t *pte, tpte; - pv_entry_t allocated_pv, next_pv, pv; - vm_offset_t va; - vm_page_t m; - - PMAP_LOCK_ASSERT(locked_pmap, MA_OWNED); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - allocated_pv = uma_zalloc(pvzone, M_NOWAIT); - if (allocated_pv != NULL) { - pv_entry_count++; - if (pv_entry_count > pv_entry_high_water) - pagedaemon_wakeup(); - else - return (allocated_pv); - } - - /* - * Reclaim pv entries: At first, destroy mappings to inactive - * pages. After that, if a pv entry is still needed, destroy - * mappings to active pages. - */ - if (ratecheck(&lastprint, &printinterval)) - printf("Approaching the limit on PV entries, " - "increase the vm.pmap.shpgperproc tunable.\n"); - vpq = &vm_page_queues[PQ_INACTIVE]; -retry: - TAILQ_FOREACH(m, &vpq->pl, pageq) { - if (m->hold_count || m->busy || (m->flags & PG_BUSY)) - continue; - TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) { - va = pv->pv_va; - pmap = pv->pv_pmap; - /* Avoid deadlock and lock recursion. */ - if (pmap > locked_pmap) - PMAP_LOCK(pmap); - else if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap)) - continue; - pmap->pm_stats.resident_count--; - pte = pmap_lev3pte(pmap, va); - tpte = *pte; - *pte = 0; - KASSERT((tpte & PG_W) == 0, - ("get_pv_entry: wired pte %#lx", tpte)); - if ((tpte & PG_FOR) == 0) - vm_page_flag_set(m, PG_REFERENCED); - if ((tpte & PG_FOW) == 0) - vm_page_dirty(m); - pmap_invalidate_page(pmap, va); - TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); - m->md.pv_list_count--; - pmap_unuse_pt(pmap, va, pv->pv_ptem); - if (pmap != locked_pmap) - PMAP_UNLOCK(pmap); - if (allocated_pv == NULL) - allocated_pv = pv; - else - free_pv_entry(pv); - } - } - if (allocated_pv == NULL) { - if (vpq == &vm_page_queues[PQ_INACTIVE]) { - vpq = &vm_page_queues[PQ_ACTIVE]; - goto retry; - } - panic("get_pv_entry: increase the vm.pmap.shpgperproc tunable"); - } - return (allocated_pv); -} - -static int -pmap_remove_entry(pmap_t pmap, vm_page_t m, vm_offset_t va) -{ - pv_entry_t pv; - int rtval; - - PMAP_LOCK_ASSERT(pmap, MA_OWNED); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - if (m->md.pv_list_count < pmap->pm_stats.resident_count) { - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - if (pmap == pv->pv_pmap && va == pv->pv_va) - break; - } - } else { - TAILQ_FOREACH(pv, &pmap->pm_pvlist, pv_plist) { - if (va == pv->pv_va) - break; - } - } - - rtval = 0; - if (pv) { - rtval = pmap_unuse_pt(pmap, va, pv->pv_ptem); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - m->md.pv_list_count--; - if (TAILQ_FIRST(&m->md.pv_list) == NULL) - vm_page_flag_clear(m, PG_WRITEABLE); - - TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); - free_pv_entry(pv); - } - - return rtval; -} - -/* - * Create a pv entry for page at pa for - * (pmap, va). - */ -static void -pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t mpte, vm_page_t m) -{ - pv_entry_t pv; - - pv = get_pv_entry(pmap); - pv->pv_va = va; - pv->pv_pmap = pmap; - pv->pv_ptem = mpte; - - PMAP_LOCK_ASSERT(pmap, MA_OWNED); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - TAILQ_INSERT_TAIL(&pmap->pm_pvlist, pv, pv_plist); - TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list); - m->md.pv_list_count++; -} - -/* - * pmap_remove_pte: do the things to unmap a page in a process - */ -static int -pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq, vm_offset_t va) -{ - pt_entry_t oldpte; - vm_page_t m; - - PMAP_LOCK_ASSERT(pmap, MA_OWNED); - oldpte = *ptq; - *ptq = 0; - if (oldpte & PG_W) - pmap->pm_stats.wired_count -= 1; - - pmap->pm_stats.resident_count -= 1; - if (oldpte & PG_MANAGED) { - m = PHYS_TO_VM_PAGE(pmap_pte_pa(&oldpte)); - if ((oldpte & PG_FOW) == 0) - vm_page_dirty(m); - if ((oldpte & PG_FOR) == 0) - vm_page_flag_set(m, PG_REFERENCED); - return pmap_remove_entry(pmap, m, va); - } else { - return pmap_unuse_pt(pmap, va, NULL); - } -} - -/* - * Remove a single page from a process address space - */ -static void -pmap_remove_page(pmap_t pmap, vm_offset_t va) -{ - register pt_entry_t *ptq; - - PMAP_LOCK_ASSERT(pmap, MA_OWNED); - ptq = pmap_lev3pte(pmap, va); - - /* - * if there is no pte for this address, just skip it!!! - */ - if (!ptq || !pmap_pte_v(ptq)) - return; - - /* - * get a local va for mappings for this pmap. - */ - (void) pmap_remove_pte(pmap, ptq, va); - pmap_invalidate_page(pmap, va); -} - -/* - * Remove the given range of addresses from the specified map. - * - * It is assumed that the start and end are properly - * rounded to the page size. - */ -void -pmap_remove(pmap_t pmap, vm_offset_t sva, vm_offset_t eva) -{ - vm_offset_t va, nva; - - /* - * Perform an unsynchronized read. This is, however, safe. - */ - if (pmap->pm_stats.resident_count == 0) - return; - - vm_page_lock_queues(); - PMAP_LOCK(pmap); - - /* - * special handling of removing one page. a very - * common operation and easy to short circuit some - * code. - */ - if (sva + PAGE_SIZE == eva) { - pmap_remove_page(pmap, sva); - goto out; - } - - for (va = sva; va < eva; va = nva) { - if (!pmap_pte_v(pmap_lev1pte(pmap, va))) { - nva = alpha_l1trunc(va + ALPHA_L1SIZE); - continue; - } - - if (!pmap_pte_v(pmap_lev2pte(pmap, va))) { - nva = alpha_l2trunc(va + ALPHA_L2SIZE); - continue; - } - - pmap_remove_page(pmap, va); - nva = va + PAGE_SIZE; - } -out: - vm_page_unlock_queues(); - PMAP_UNLOCK(pmap); -} - -/* - * Routine: pmap_remove_all - * Function: - * Removes this physical page from - * all physical maps in which it resides. - * Reflects back modify bits to the pager. - * - * Notes: - * Original versions of this routine were very - * inefficient because they iteratively called - * pmap_remove (slow...) - */ - -void -pmap_remove_all(vm_page_t m) -{ - register pv_entry_t pv; - pt_entry_t *pte, tpte; - -#if defined(PMAP_DIAGNOSTIC) - /* - * XXX this makes pmap_page_protect(NONE) illegal for non-managed - * pages! - */ - if (m->flags & PG_FICTITIOUS) { - panic("pmap_page_protect: illegal for unmanaged page, va: 0x%lx", VM_PAGE_TO_PHYS(m)); - } -#endif - - while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) { - PMAP_LOCK(pv->pv_pmap); - pte = pmap_lev3pte(pv->pv_pmap, pv->pv_va); - - pv->pv_pmap->pm_stats.resident_count--; - - if (pmap_pte_pa(pte) != VM_PAGE_TO_PHYS(m)) - panic("pmap_remove_all: pv_table for %lx is inconsistent", VM_PAGE_TO_PHYS(m)); - - tpte = *pte; - - *pte = 0; - if (tpte & PG_W) - pv->pv_pmap->pm_stats.wired_count--; - - /* - * Update the vm_page_t clean and reference bits. - */ - if ((tpte & PG_FOW) == 0) - vm_page_dirty(m); - if ((tpte & PG_FOR) == 0) - vm_page_flag_set(m, PG_REFERENCED); - - pmap_invalidate_page(pv->pv_pmap, pv->pv_va); - - TAILQ_REMOVE(&pv->pv_pmap->pm_pvlist, pv, pv_plist); - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - m->md.pv_list_count--; - pmap_unuse_pt(pv->pv_pmap, pv->pv_va, pv->pv_ptem); - PMAP_UNLOCK(pv->pv_pmap); - free_pv_entry(pv); - } - - vm_page_flag_clear(m, PG_WRITEABLE); -} - -/* - * Set the physical protection on the - * specified range of this map as requested. - */ -void -pmap_protect(pmap_t pmap, vm_offset_t sva, vm_offset_t eva, vm_prot_t prot) -{ - pt_entry_t* pte; - int newprot; - - if ((prot & VM_PROT_READ) == VM_PROT_NONE) { - pmap_remove(pmap, sva, eva); - return; - } - - if (prot & VM_PROT_WRITE) - return; - - newprot = pte_prot(pmap, prot); - - if ((sva & PAGE_MASK) || (eva & PAGE_MASK)) - panic("pmap_protect: unaligned addresses"); - - vm_page_lock_queues(); - PMAP_LOCK(pmap); - while (sva < eva) { - - /* - * If level 1 pte is invalid, skip this segment - */ - pte = pmap_lev1pte(pmap, sva); - if (!pmap_pte_v(pte)) { - sva = alpha_l1trunc(sva) + ALPHA_L1SIZE; - continue; - } - - /* - * If level 2 pte is invalid, skip this segment - */ - pte = pmap_lev2pte(pmap, sva); - if (!pmap_pte_v(pte)) { - sva = alpha_l2trunc(sva) + ALPHA_L2SIZE; - continue; - } - - /* - * If level 3 pte is invalid, skip this page - */ - pte = pmap_lev3pte(pmap, sva); - if (!pmap_pte_v(pte)) { - sva += PAGE_SIZE; - continue; - } - - if (pmap_pte_prot(pte) != newprot) { - pt_entry_t oldpte = *pte; - vm_page_t m = NULL; - if ((oldpte & PG_FOR) == 0) { - m = PHYS_TO_VM_PAGE(pmap_pte_pa(pte)); - vm_page_flag_set(m, PG_REFERENCED); - oldpte |= (PG_FOR | PG_FOE); - } - if ((oldpte & PG_FOW) == 0) { - if (m == NULL) - m = PHYS_TO_VM_PAGE(pmap_pte_pa(pte)); - vm_page_dirty(m); - oldpte |= PG_FOW; - } - oldpte = (oldpte & ~PG_PROT) | newprot; - *pte = oldpte; - pmap_invalidate_page(pmap, sva); - } - - sva += PAGE_SIZE; - } - vm_page_unlock_queues(); - PMAP_UNLOCK(pmap); -} - -/* - * Insert the given physical page (p) at - * the specified virtual address (v) in the - * target physical map with the protection requested. - * - * If specified, the page will be wired down, meaning - * that the related pte can not be reclaimed. - * - * NB: This is the only routine which MAY NOT lazy-evaluate - * or lose information. That is, this routine must actually - * insert this page into the given map NOW. - */ -void -pmap_enter(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, - boolean_t wired) -{ - vm_offset_t pa; - pt_entry_t *pte; - vm_offset_t opa; - pt_entry_t origpte, newpte; - vm_page_t mpte; - int managed; - - va &= ~PAGE_MASK; -#ifdef PMAP_DIAGNOSTIC - if (va > VM_MAX_KERNEL_ADDRESS) - panic("pmap_enter: toobig"); -#endif - - mpte = NULL; - - vm_page_lock_queues(); - PMAP_LOCK(pmap); - - /* - * In the case that a page table page is not - * resident, we are creating it here. - */ - if (va < VM_MAXUSER_ADDRESS) { - mpte = pmap_allocpte(pmap, va); - } - - pte = pmap_lev3pte(pmap, va); - - /* - * Page Directory table entry not valid, we need a new PT page - */ - if (pte == NULL) { - panic("pmap_enter: invalid kernel page tables pmap=%p, va=0x%lx\n", pmap, va); - } - - origpte = *pte; - pa = VM_PAGE_TO_PHYS(m); - managed = 0; - opa = pmap_pte_pa(pte); - - /* - * Mapping has not changed, must be protection or wiring change. - */ - if (origpte && (opa == pa)) { - /* - * Wiring change, just update stats. We don't worry about - * wiring PT pages as they remain resident as long as there - * are valid mappings in them. Hence, if a user page is wired, - * the PT page will be also. - */ - if (wired && ((origpte & PG_W) == 0)) - pmap->pm_stats.wired_count++; - else if (!wired && (origpte & PG_W)) - pmap->pm_stats.wired_count--; - - /* - * Remove extra pte reference - */ - if (mpte) - mpte->wire_count--; - - /* - * We might be turning off write access to the page, - * so we go ahead and sense modify status. - */ - if (origpte & PG_MANAGED) { - if ((origpte & PG_FOW) != PG_FOW) - vm_page_dirty(m); - } - - managed = origpte & PG_MANAGED; - goto validate; - } - /* - * Mapping has changed, invalidate old range and fall through to - * handle validating new mapping. - */ - if (opa) { - int err; - err = pmap_remove_pte(pmap, pte, va); - if (err) - panic("pmap_enter: pte vanished, va: 0x%lx", va); - } - - /* - * Enter on the PV list if part of our managed memory. Note that we - * raise IPL while manipulating pv_table since pmap_enter can be - * called at interrupt time. - */ - if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) { - KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva, - ("pmap_enter: managed mapping within the clean submap")); - pmap_insert_entry(pmap, va, mpte, m); - managed |= PG_MANAGED; - } - - /* - * Increment counters - */ - pmap->pm_stats.resident_count++; - if (wired) - pmap->pm_stats.wired_count++; - -validate: - /* - * Now validate mapping with desired protection/wiring. - */ - newpte = pmap_phys_to_pte(pa) | pte_prot(pmap, prot) | PG_V | managed; - - if (managed) { - /* - * Set up referenced/modified emulation for the new - * mapping. Any old referenced/modified emulation - * results for the old mapping will have been recorded - * either in pmap_remove_pte() or above in the code - * which handles protection and/or wiring changes. - */ - newpte |= (PG_FOR | PG_FOW | PG_FOE); - } - - if (wired) - newpte |= PG_W; - - /* - * if the mapping or permission bits are different, we need - * to update the pte. - */ - if (origpte != newpte) { - *pte = newpte; - if (origpte) - pmap_invalidate_page(pmap, va); - if (prot & VM_PROT_EXECUTE) - alpha_pal_imb(); - } - vm_page_unlock_queues(); - PMAP_UNLOCK(pmap); -} - -/* - * this code makes some *MAJOR* assumptions: - * 1. Current pmap & pmap exists. - * 2. Not wired. - * 3. Read access. - * 4. No page table pages. - * but is *MUCH* faster than pmap_enter... - */ - -vm_page_t -pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, vm_prot_t prot, - vm_page_t mpte) -{ - register pt_entry_t *pte; - int managed; - - KASSERT(va < kmi.clean_sva || va >= kmi.clean_eva || - (m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) != 0, - ("pmap_enter_quick: managed mapping within the clean submap")); - mtx_assert(&vm_page_queue_mtx, MA_OWNED); - VM_OBJECT_LOCK_ASSERT(m->object, MA_OWNED); - PMAP_LOCK(pmap); - - /* - * In the case that a page table page is not - * resident, we are creating it here. - */ - if (va < VM_MAXUSER_ADDRESS) { - unsigned ptepindex; - pt_entry_t* l2pte; - - /* - * Calculate lev2 page index - */ - ptepindex = va >> ALPHA_L2SHIFT; - if (mpte && (mpte->pindex == ptepindex)) { - mpte->wire_count++; - } else { - retry: - /* - * Get the level 2 entry - */ - l2pte = pmap_lev2pte(pmap, va); - - /* - * If the level 2 page table is mapped, we just increment - * the hold count, and activate it. - */ - if (l2pte && pmap_pte_v(l2pte)) { - if (pmap->pm_ptphint && - (pmap->pm_ptphint->pindex == ptepindex)) { - mpte = pmap->pm_ptphint; - } else { - mpte = PHYS_TO_VM_PAGE(pmap_pte_pa(l2pte)); - pmap->pm_ptphint = mpte; - } - mpte->wire_count++; - } else { - mpte = _pmap_allocpte(pmap, ptepindex, - M_NOWAIT); - if (mpte == NULL) { - PMAP_UNLOCK(pmap); - vm_page_busy(m); - vm_page_unlock_queues(); - VM_OBJECT_UNLOCK(m->object); - VM_WAIT; - VM_OBJECT_LOCK(m->object); - vm_page_lock_queues(); - vm_page_wakeup(m); - PMAP_LOCK(pmap); - goto retry; - } - } - } - } else { - mpte = NULL; - } - - /* - * This call to vtopte makes the assumption that we are - * entering the page into the current pmap. In order to support - * quick entry into any pmap, one would likely use pmap_pte_quick. - * But that isn't as quick as vtopte. - */ - pte = vtopte(va); - if (*pte) { - if (mpte != NULL) { - pmap_unwire_pte_hold(pmap, va, mpte); - mpte = NULL; - } - goto out; - } - - /* - * Enter on the PV list if part of our managed memory. Note that we - * raise IPL while manipulating pv_table since pmap_enter can be - * called at interrupt time. - */ - managed = 0; - if ((m->flags & (PG_FICTITIOUS|PG_UNMANAGED)) == 0) { - pmap_insert_entry(pmap, va, mpte, m); - managed = PG_MANAGED | PG_FOR | PG_FOW | PG_FOE; - } - - /* - * Increment counters - */ - pmap->pm_stats.resident_count++; - - /* - * Validate the mapping with limited access, read and/or execute but - * not write. - */ - *pte = pmap_phys_to_pte(VM_PAGE_TO_PHYS(m)) | PG_V | pte_prot(pmap, - prot & (VM_PROT_READ | VM_PROT_EXECUTE)) | managed; -out: - PMAP_UNLOCK(pmap); - return mpte; -} - -/* - * Make temporary mapping for a physical address. This is called - * during dump. - */ -void * -pmap_kenter_temporary(vm_offset_t pa, int i) -{ - return (void *) ALPHA_PHYS_TO_K0SEG(pa - (i * PAGE_SIZE)); -} - -/* - * pmap_object_init_pt preloads the ptes for a given object - * into the specified pmap. This eliminates the blast of soft - * faults on process startup and immediately after an mmap. - */ -void -pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, - vm_object_t object, vm_pindex_t pindex, - vm_size_t size) -{ - - VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - KASSERT(object->type == OBJT_DEVICE, - ("pmap_object_init_pt: non-device object")); -} - -/* - * Routine: pmap_change_wiring - * Function: Change the wiring attribute for a map/virtual-address - * pair. - * In/out conditions: - * The mapping must already exist in the pmap. - */ -void -pmap_change_wiring(pmap, va, wired) - register pmap_t pmap; - vm_offset_t va; - boolean_t wired; -{ - pt_entry_t *pte; - - PMAP_LOCK(pmap); - pte = pmap_lev3pte(pmap, va); - - if (wired && !pmap_pte_w(pte)) - pmap->pm_stats.wired_count++; - else if (!wired && pmap_pte_w(pte)) - pmap->pm_stats.wired_count--; - - /* - * Wiring is not a hardware characteristic so there is no need to - * invalidate TLB. - */ - pmap_pte_set_w(pte, wired); - PMAP_UNLOCK(pmap); -} - - - -/* - * Copy the range specified by src_addr/len - * from the source map to the range dst_addr/len - * in the destination map. - * - * This routine is only advisory and need not do anything. - */ - -void -pmap_copy(pmap_t dst_pmap, pmap_t src_pmap, vm_offset_t dst_addr, vm_size_t len, - vm_offset_t src_addr) -{ -} - - -/* - * pmap_zero_page zeros the specified hardware page by - * mapping it into virtual memory and using bzero to clear - * its contents. - */ - -void -pmap_zero_page(vm_page_t m) -{ - vm_offset_t va = ALPHA_PHYS_TO_K0SEG(VM_PAGE_TO_PHYS(m)); - bzero((caddr_t) va, PAGE_SIZE); -} - - -/* - * pmap_zero_page_area zeros the specified hardware page by - * mapping it into virtual memory and using bzero to clear - * its contents. - * - * off and size must reside within a single page. - */ - -void -pmap_zero_page_area(vm_page_t m, int off, int size) -{ - vm_offset_t va = ALPHA_PHYS_TO_K0SEG(VM_PAGE_TO_PHYS(m)); - bzero((char *)(caddr_t)va + off, size); -} - - -/* - * pmap_zero_page_idle zeros the specified hardware page by - * mapping it into virtual memory and using bzero to clear - * its contents. This is for the vm_pagezero idle process. - */ - -void -pmap_zero_page_idle(vm_page_t m) -{ - vm_offset_t va = ALPHA_PHYS_TO_K0SEG(VM_PAGE_TO_PHYS(m)); - bzero((caddr_t) va, PAGE_SIZE); -} - - -/* - * pmap_copy_page copies the specified (machine independent) - * page by mapping the page into virtual memory and using - * bcopy to copy the page, one machine dependent page at a - * time. - */ -void -pmap_copy_page(vm_page_t msrc, vm_page_t mdst) -{ - vm_offset_t src = ALPHA_PHYS_TO_K0SEG(VM_PAGE_TO_PHYS(msrc)); - vm_offset_t dst = ALPHA_PHYS_TO_K0SEG(VM_PAGE_TO_PHYS(mdst)); - bcopy((caddr_t) src, (caddr_t) dst, PAGE_SIZE); -} - -/* - * Returns true if the pmap's pv is one of the first - * 16 pvs linked to from this page. This count may - * be changed upwards or downwards in the future; it - * is only necessary that true be returned for a small - * subset of pmaps for proper page aging. - */ -boolean_t -pmap_page_exists_quick(pmap, m) - pmap_t pmap; - vm_page_t m; -{ - pv_entry_t pv; - int loops = 0; - - if (m->flags & PG_FICTITIOUS) - return FALSE; - - /* - * Not found, check current mappings returning immediately if found. - */ - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - if (pv->pv_pmap == pmap) { - return TRUE; - } - loops++; - if (loops >= 16) - break; - } - return (FALSE); -} - -#define PMAP_REMOVE_PAGES_CURPROC_ONLY -/* - * Remove all pages from specified address space - * this aids process exit speeds. Also, this code - * is special cased for current process only, but - * can have the more generic (and slightly slower) - * mode enabled. This is much faster than pmap_remove - * in the case of running down an entire address space. - */ -void -pmap_remove_pages(pmap_t pmap) -{ - pt_entry_t *pte, tpte; - vm_page_t m; - pv_entry_t pv, npv; - -#ifdef PMAP_REMOVE_PAGES_CURPROC_ONLY - if (pmap != vmspace_pmap(curthread->td_proc->p_vmspace)) { - printf("warning: pmap_remove_pages called with non-current pmap\n"); - return; - } -#endif - - vm_page_lock_queues(); - PMAP_LOCK(pmap); - for(pv = TAILQ_FIRST(&pmap->pm_pvlist); - pv; - pv = npv) { - -#ifdef PMAP_REMOVE_PAGES_CURPROC_ONLY - pte = vtopte(pv->pv_va); -#else - pte = pmap_pte_quick(pmap, pv->pv_va); -#endif - if (!pmap_pte_v(pte)) - panic("pmap_remove_pages: page on pm_pvlist has no pte\n"); - tpte = *pte; - - -/* - * We cannot remove wired pages from a process' mapping at this time - */ - if (tpte & PG_W) { - npv = TAILQ_NEXT(pv, pv_plist); - continue; - } - *pte = 0; - - m = PHYS_TO_VM_PAGE(pmap_pte_pa(&tpte)); - - pmap->pm_stats.resident_count--; - - if ((tpte & PG_FOW) == 0) - vm_page_dirty(m); - - npv = TAILQ_NEXT(pv, pv_plist); - TAILQ_REMOVE(&pmap->pm_pvlist, pv, pv_plist); - - m->md.pv_list_count--; - TAILQ_REMOVE(&m->md.pv_list, pv, pv_list); - if (TAILQ_EMPTY(&m->md.pv_list)) - vm_page_flag_clear(m, PG_WRITEABLE); - - pmap_unuse_pt(pmap, pv->pv_va, pv->pv_ptem); - free_pv_entry(pv); - } - pmap_invalidate_all(pmap); - PMAP_UNLOCK(pmap); - vm_page_unlock_queues(); -} - -/* - * this routine is used to modify bits in ptes - */ -static __inline void -pmap_changebit(vm_page_t m, int bit, boolean_t setem) -{ - pv_entry_t pv; - pt_entry_t *pte; - int changed; - - if ((m->flags & PG_FICTITIOUS) || - (!setem && bit == (PG_UWE|PG_KWE) && - (m->flags & PG_WRITEABLE) == 0)) - return; - - changed = 0; - - /* - * Loop over all current mappings setting/clearing as appropos If - * setting RO do we need to clear the VAC? - */ - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - PMAP_LOCK(pv->pv_pmap); - pte = pmap_lev3pte(pv->pv_pmap, pv->pv_va); - - changed = 0; - if (setem) { - *pte |= bit; - changed = 1; - } else { - pt_entry_t pbits = *pte; - if (pbits & bit) { - changed = 1; - *pte = pbits & ~bit; - } - } - if (changed) - pmap_invalidate_page(pv->pv_pmap, pv->pv_va); - PMAP_UNLOCK(pv->pv_pmap); - } - if (!setem && bit == (PG_UWE|PG_KWE)) - vm_page_flag_clear(m, PG_WRITEABLE); -} - -/* - * pmap_page_protect: - * - * Lower the permission for all mappings to a given page. - */ -void -pmap_page_protect(vm_page_t m, vm_prot_t prot) -{ - if ((prot & VM_PROT_WRITE) == 0) { - if (prot & (VM_PROT_READ | VM_PROT_EXECUTE)) { - pmap_changebit(m, PG_KWE|PG_UWE, FALSE); - } else { - pmap_remove_all(m); - } - } -} - -/* - * pmap_ts_referenced: - * - * Return a count of reference bits for a page, clearing those bits. - * It is not necessary for every reference bit to be cleared, but it - * is necessary that 0 only be returned when there are truly no - * reference bits set. - * - * XXX: The exact number of bits to check and clear is a matter that - * should be tested and standardized at some point in the future for - * optimal aging of shared pages. - */ -int -pmap_ts_referenced(vm_page_t m) -{ - pv_entry_t pv; - pt_entry_t *pte; - int count; - - if (m->flags & PG_FICTITIOUS) - return 0; - - /* - * Loop over current mappings looking for any which have don't - * have PG_FOR set (i.e. ones where we have taken an emulate - * reference trap recently). - */ - count = 0; - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - PMAP_LOCK(pv->pv_pmap); - pte = pmap_lev3pte(pv->pv_pmap, pv->pv_va); - - if (!(*pte & PG_FOR)) { - count++; - *pte |= PG_FOR | PG_FOE; - pmap_invalidate_page(pv->pv_pmap, pv->pv_va); - } - PMAP_UNLOCK(pv->pv_pmap); - } - - return count; -} - -/* - * pmap_is_modified: - * - * Return whether or not the specified physical page was modified - * in any physical maps. - */ -boolean_t -pmap_is_modified(vm_page_t m) -{ - pv_entry_t pv; - pt_entry_t *pte; - boolean_t rv; - - rv = FALSE; - if (m->flags & PG_FICTITIOUS) - return (rv); - - /* - * A page is modified if any mapping has had its PG_FOW flag - * cleared. - */ - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - PMAP_LOCK(pv->pv_pmap); - pte = pmap_lev3pte(pv->pv_pmap, pv->pv_va); - rv = !(*pte & PG_FOW); - PMAP_UNLOCK(pv->pv_pmap); - if (rv) - break; - } - return (rv); -} - -/* - * pmap_is_prefaultable: - * - * Return whether or not the specified virtual address is elgible - * for prefault. - */ -boolean_t -pmap_is_prefaultable(pmap_t pmap, vm_offset_t addr) -{ - pt_entry_t *pte; - boolean_t rv; - - rv = FALSE; - PMAP_LOCK(pmap); - if (pmap_pte_v(pmap_lev1pte(pmap, addr)) && - pmap_pte_v(pmap_lev2pte(pmap, addr))) { - pte = vtopte(addr); - rv = *pte == 0; - } - PMAP_UNLOCK(pmap); - return (rv); -} - -/* - * Clear the modify bits on the specified physical page. - */ -void -pmap_clear_modify(vm_page_t m) -{ - pv_entry_t pv; - pt_entry_t *pte; - - if (m->flags & PG_FICTITIOUS) - return; - - /* - * Loop over current mappings setting PG_FOW where needed. - */ - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - PMAP_LOCK(pv->pv_pmap); - pte = pmap_lev3pte(pv->pv_pmap, pv->pv_va); - - if (!(*pte & PG_FOW)) { - *pte |= PG_FOW; - pmap_invalidate_page(pv->pv_pmap, pv->pv_va); - } - PMAP_UNLOCK(pv->pv_pmap); - } -} - -/* - * pmap_clear_reference: - * - * Clear the reference bit on the specified physical page. - */ -void -pmap_clear_reference(vm_page_t m) -{ - pv_entry_t pv; - pt_entry_t *pte; - - if (m->flags & PG_FICTITIOUS) - return; - - /* - * Loop over current mappings setting PG_FOR and PG_FOE where needed. - */ - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - PMAP_LOCK(pv->pv_pmap); - pte = pmap_lev3pte(pv->pv_pmap, pv->pv_va); - - if (!(*pte & (PG_FOR | PG_FOE))) { - *pte |= (PG_FOR | PG_FOE); - pmap_invalidate_page(pv->pv_pmap, pv->pv_va); - } - PMAP_UNLOCK(pv->pv_pmap); - } -} - -/* - * pmap_emulate_reference: - * - * Emulate reference and/or modified bit hits. - * From NetBSD - */ -void -pmap_emulate_reference(struct vmspace *vm, vm_offset_t v, int user, int write) -{ - pmap_t pmap; - pt_entry_t *pte; - - /* - * Convert process and virtual address to physical address. - */ - if (v >= VM_MIN_KERNEL_ADDRESS) { - if (user) - panic("pmap_emulate_reference: user ref to kernel"); - pmap = kernel_pmap; - PMAP_LOCK(pmap); - pte = vtopte(v); - } else { - KASSERT(vm != NULL, ("pmap_emulate_reference: bad vmspace")); - pmap = &vm->vm_pmap; - PMAP_LOCK(pmap); - pte = pmap_lev3pte(pmap, v); - } - - /* - * Another CPU can modify the pmap between the emulation trap and this - * CPU locking the pmap. As a result, the pte may be inconsistent - * with the access that caused the emulation trap. In such cases, - * invalidate this CPU's TLB entry and return. - */ - if (!pmap_pte_v(pte)) - goto tbis; - - /* - * Twiddle the appropriate bits to reflect the reference - * and/or modification.. - * - * The rules: - * (1) always mark page as used, and - * (2) if it was a write fault, mark page as modified. - */ - if (write) { - if (!(*pte & (user ? PG_UWE : PG_UWE | PG_KWE))) - goto tbis; - if (!(*pte & PG_FOW)) - goto tbis; - *pte &= ~(PG_FOR | PG_FOE | PG_FOW); - } else { - if (!(*pte & (user ? PG_URE : PG_URE | PG_KRE))) - goto tbis; - if (!(*pte & (PG_FOR | PG_FOE))) - goto tbis; - *pte &= ~(PG_FOR | PG_FOE); - } -tbis: - ALPHA_TBIS(v); - PMAP_UNLOCK(pmap); -} - -/* - * Miscellaneous support routines follow - */ - -static void -alpha_protection_init() -{ - int prot, *kp, *up; - - kp = protection_codes[0]; - up = protection_codes[1]; - - for (prot = 0; prot < 8; prot++) { - switch (prot) { - case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_NONE: - *kp++ = PG_ASM; - *up++ = 0; - break; - case VM_PROT_READ | VM_PROT_NONE | VM_PROT_NONE: - case VM_PROT_READ | VM_PROT_NONE | VM_PROT_EXECUTE: - case VM_PROT_NONE | VM_PROT_NONE | VM_PROT_EXECUTE: - *kp++ = PG_ASM | PG_KRE; - *up++ = PG_URE | PG_KRE; - break; - case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_NONE: - *kp++ = PG_ASM | PG_KWE; - *up++ = PG_UWE | PG_KWE; - break; - case VM_PROT_NONE | VM_PROT_WRITE | VM_PROT_EXECUTE: - case VM_PROT_READ | VM_PROT_WRITE | VM_PROT_NONE: - case VM_PROT_READ | VM_PROT_WRITE | VM_PROT_EXECUTE: - *kp++ = PG_ASM | PG_KWE | PG_KRE; - *up++ = PG_UWE | PG_URE | PG_KWE | PG_KRE; - break; - } - } -} - -/* - * Map a set of physical memory pages into the kernel virtual - * address space. Return a pointer to where it is mapped. This - * routine is intended to be used for mapping device memory, - * NOT real memory. - */ -void * -pmap_mapdev(pa, size) - vm_offset_t pa; - vm_size_t size; -{ - return (void*) ALPHA_PHYS_TO_K0SEG(pa); -} - -void -pmap_unmapdev(va, size) - vm_offset_t va; - vm_size_t size; -{ -} - -/* - * perform the pmap work for mincore - */ -int -pmap_mincore(pmap, addr) - pmap_t pmap; - vm_offset_t addr; -{ - pt_entry_t *ptep, pte; - int val = 0; - - PMAP_LOCK(pmap); - ptep = pmap_lev3pte(pmap, addr); - pte = (ptep != NULL) ? *ptep : 0; - PMAP_UNLOCK(pmap); - - if (pte & PG_V) { - vm_page_t m; - vm_offset_t pa; - - val = MINCORE_INCORE; - if ((pte & PG_MANAGED) == 0) - return val; - - pa = alpha_ptob(ALPHA_PTE_TO_PFN(pte)); - - m = PHYS_TO_VM_PAGE(pa); - - /* - * Modified by us - */ - if ((pte & PG_FOW) == 0) - val |= MINCORE_MODIFIED|MINCORE_MODIFIED_OTHER; - else { - /* - * Modified by someone - */ - vm_page_lock_queues(); - if (m->dirty || pmap_is_modified(m)) - val |= MINCORE_MODIFIED_OTHER; - vm_page_unlock_queues(); - } - /* - * Referenced by us - */ - if ((pte & (PG_FOR | PG_FOE)) == 0) - val |= MINCORE_REFERENCED|MINCORE_REFERENCED_OTHER; - else { - /* - * Referenced by someone - */ - vm_page_lock_queues(); - if ((m->flags & PG_REFERENCED) || pmap_ts_referenced(m)) { - val |= MINCORE_REFERENCED_OTHER; - vm_page_flag_set(m, PG_REFERENCED); - } - vm_page_unlock_queues(); - } - } - return val; -} - -void -pmap_activate(struct thread *td) -{ - pmap_t pmap; - - pmap = vmspace_pmap(td->td_proc->p_vmspace); - - critical_enter(); - if (pmap_active[PCPU_GET(cpuid)] && pmap != pmap_active[PCPU_GET(cpuid)]) { - atomic_clear_32(&pmap_active[PCPU_GET(cpuid)]->pm_active, - PCPU_GET(cpumask)); - pmap_active[PCPU_GET(cpuid)] = 0; - } - - td->td_pcb->pcb_hw.apcb_ptbr = - ALPHA_K0SEG_TO_PHYS((vm_offset_t) pmap->pm_lev1) >> PAGE_SHIFT; - - if (pmap->pm_asn[PCPU_GET(cpuid)].gen != PCPU_GET(current_asngen)) - pmap_get_asn(pmap); - - pmap_active[PCPU_GET(cpuid)] = pmap; - atomic_set_32(&pmap->pm_active, PCPU_GET(cpumask)); - - td->td_pcb->pcb_hw.apcb_asn = pmap->pm_asn[PCPU_GET(cpuid)].asn; - critical_exit(); - - if (td == curthread) { - alpha_pal_swpctx((u_long)td->td_md.md_pcbpaddr); - } -} - -void -pmap_deactivate(struct thread *td) -{ - pmap_t pmap; - - pmap = vmspace_pmap(td->td_proc->p_vmspace); - atomic_clear_32(&pmap->pm_active, PCPU_GET(cpumask)); - pmap_active[PCPU_GET(cpuid)] = 0; -} - -vm_offset_t -pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size) -{ - - return addr; -} - -#if 0 -#if defined(PMAP_DEBUG) -pmap_pid_dump(int pid) -{ - pmap_t pmap; - struct proc *p; - int npte = 0; - int index; - - sx_slock(&allproc_lock); - LIST_FOREACH(p, &allproc, p_list) { - if (p->p_pid != pid) - continue; - - if (p->p_vmspace) { - int i,j; - index = 0; - pmap = vmspace_pmap(p->p_vmspace); - for (i = 0; i < NPDEPG; i++) { - pd_entry_t *pde; - pt_entry_t *pte; - vm_offset_t base = i << PDRSHIFT; - - pde = &pmap->pm_pdir[i]; - if (pde && pmap_pde_v(pde)) { - for (j = 0; j < NPTEPG; j++) { - vm_offset_t va = base + (j << PAGE_SHIFT); - if (va >= (vm_offset_t) VM_MIN_KERNEL_ADDRESS) { - if (index) { - index = 0; - printf("\n"); - } - sx_sunlock(&allproc_lock); - return npte; - } - pte = pmap_pte_quick(pmap, va); - if (pte && pmap_pte_v(pte)) { - vm_offset_t pa; - vm_page_t m; - pa = *(int *)pte; - m = PHYS_TO_VM_PAGE(pa); - printf("va: 0x%x, pt: 0x%x, h: %d, w: %d, f: 0x%x", - va, pa, m->hold_count, m->wire_count, m->flags); - npte++; - index++; - if (index >= 2) { - index = 0; - printf("\n"); - } else { - printf(" "); - } - } - } - } - } - } - } - sx_sunlock(&allproc_lock); - return npte; -} -#endif - -#if defined(DEBUG) - -static void pads(pmap_t pm); -void pmap_pvdump(vm_offset_t pa); - -/* print address space of pmap*/ -static void -pads(pm) - pmap_t pm; -{ - int i, j; - vm_offset_t va; - pt_entry_t *ptep; - - if (pm == kernel_pmap) - return; - for (i = 0; i < NPDEPG; i++) - if (pm->pm_pdir[i]) - for (j = 0; j < NPTEPG; j++) { - va = (i << PDRSHIFT) + (j << PAGE_SHIFT); - if (pm == kernel_pmap && va < KERNBASE) - continue; - if (pm != kernel_pmap && va > UPT_MAX_ADDRESS) - continue; - ptep = pmap_pte_quick(pm, va); - if (pmap_pte_v(ptep)) - printf("%x:%x ", va, *(int *) ptep); - }; - -} - -void -pmap_pvdump(pa) - vm_offset_t pa; -{ - pv_entry_t pv; - vm_page_t m; - - printf("pa %x", pa); - m = PHYS_TO_VM_PAGE(pa); - TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) { - printf(" -> pmap %p, va %x", (void *)pv->pv_pmap, pv->pv_va); - pads(pv->pv_pmap); - } - printf(" "); -} -#endif -#endif diff --git a/sys/alpha/alpha/prom.c b/sys/alpha/alpha/prom.c deleted file mode 100644 index 95a9361..0000000 --- a/sys/alpha/alpha/prom.c +++ /dev/null @@ -1,326 +0,0 @@ -/*- - * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University - * All Rights Reserved. - * - * 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 Mellon - * the rights to redistribute these changes. - * - */ - -#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -/* __KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.22 1998/02/27 04:03:00 thorpej Exp $"); */ -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <vm/vm.h> -#include <vm/pmap.h> -#include <sys/proc.h> -#include <sys/cons.h> - -#include <machine/md_var.h> -#include <machine/pcb.h> -#include <machine/prom.h> -#include <machine/rpb.h> -#include <machine/vmparam.h> - -struct rpb *hwrpb; - -extern struct prom_vec prom_dispatch_v; - -int prom_mapped = 1; /* Is PROM still mapped? */ -pt_entry_t rom_pte, saved_pte[1]; /* XXX */ - -static pt_entry_t *rom_lev1map(void); -extern pt_entry_t* Lev1map; - -static void prom_cache_sync(void); - -static pt_entry_t * -rom_lev1map() -{ - struct alpha_pcb *apcb; - struct pcb *cpcb; - - /* - * We may be called before the first context switch - * after alpha_init(), in which case we just need - * to use the kernel Lev1map. - */ - if (PCPU_GET(curpcb) == 0) - return (Lev1map); - - /* - * Find the level 1 map that we're currently running on. - */ - cpcb = PCPU_GET(curpcb); - apcb = (struct alpha_pcb *)ALPHA_PHYS_TO_K0SEG((vm_offset_t)cpcb); - - return ((pt_entry_t *)ALPHA_PHYS_TO_K0SEG(alpha_ptob(apcb->apcb_ptbr))); -} - -void -init_prom_interface(rpb) - struct rpb *rpb; -{ - struct crb *c; - - c = (struct crb *)((char *)rpb + rpb->rpb_crb_off); - - prom_dispatch_v.routine_arg = c->crb_v_dispatch; - prom_dispatch_v.routine = c->crb_v_dispatch->entry_va; -} - -static int alpha_console; - -void -init_bootstrap_console() -{ - char buf[4]; - - init_prom_interface(hwrpb); - - prom_getenv(PROM_E_TTY_DEV, buf, 4); - alpha_console = buf[0] - '0'; - promcnattach(alpha_console); -} - -static register_t enter_prom(void); -static void leave_prom(critical_t); - - -/* - * promcnputc: - * - * Remap char before passing off to prom. - * - * Prom only takes 32 bit addresses. Copy char somewhere prom can - * find it. This routine will stop working after pmap_rid_of_console - * is called in alpha_init. This is due to the hard coded address - * of the console area. - */ -void -promcnputc(struct consdev *cp, int c) -{ - prom_return_t ret; - unsigned char *to = (unsigned char *)0x20000000; - register_t s; - - s = enter_prom(); /* critical_enter() and map prom */ - *to = c; - - do { - ret.bits = prom_putstr(alpha_console, to, 1); - } while ((ret.u.retval & 1) == 0); - - leave_prom(s); /* unmap prom and critical_exit(s) */ -} - -/* - * promcngetc: - * - * Wait for the prom to get a real char and pass it back. - */ -int -promcngetc(struct consdev *cp) -{ - prom_return_t ret; - register_t s; - - for (;;) { - s = enter_prom(); - ret.bits = prom_getc(alpha_console); - leave_prom(s); - if (ret.u.status == 0 || ret.u.status == 1) - return (ret.u.retval); - } -} - -/* - * promcncheckc - * - * If a char is ready, return it, otherwise return -1. - */ -int -promcncheckc(struct consdev *cp) -{ - prom_return_t ret; - register_t s; - - s = enter_prom(); - ret.bits = prom_getc(alpha_console); - leave_prom(s); - if (ret.u.status == 0 || ret.u.status == 1) - return (ret.u.retval); - else - return (-1); -} - -static register_t -enter_prom() -{ - pt_entry_t *lev1map; - register_t s; - - s = intr_disable(); - - if (!prom_mapped) { - if (!pmap_uses_prom_console()) - panic("enter_prom"); - lev1map = rom_lev1map(); /* XXX */ - saved_pte[0] = lev1map[0]; /* XXX */ - lev1map[0] = rom_pte; /* XXX */ - prom_cache_sync(); /* XXX */ - } - return s; -} - -static void -leave_prom(s) - register_t s; -{ - - pt_entry_t *lev1map; - - if (!prom_mapped) { - if (!pmap_uses_prom_console()) - panic("leave_prom"); - lev1map = rom_lev1map(); /* XXX */ - lev1map[0] = saved_pte[0]; /* XXX */ - prom_cache_sync(); /* XXX */ - } - intr_restore(s); -} - -static void -prom_cache_sync(void) -{ - ALPHA_TBIA(); - alpha_pal_imb(); -} - -int -prom_getenv(id, buf, len) - int id, len; - char *buf; -{ - unsigned char *to = (unsigned char *)0x20000000; - prom_return_t ret; - register_t s; - - s = enter_prom(); - ret.bits = prom_getenv_disp(id, to, len); - bcopy(to, buf, len); - leave_prom(s); - - if (ret.u.status & 0x4) - ret.u.retval = 0; - buf[ret.u.retval] = '\0'; - - return (ret.bits); -} - -void -prom_halt(halt) - int halt; -{ - struct pcs *p; - - /* - * Turn off interrupts, for sanity. - */ - intr_disable(); - - /* - * Set "boot request" part of the CPU state depending on what - * we want to happen when we halt. - */ - p = LOCATE_PCS(hwrpb, PCPU_GET(cpuid)); - p->pcs_flags &= ~(PCS_RC | PCS_HALT_REQ); - if (halt) - p->pcs_flags |= PCS_HALT_STAY_HALTED; - else - p->pcs_flags |= PCS_HALT_WARM_BOOT; - - /* - * Halt the machine. - */ - for (;;) - alpha_pal_halt(); -} - -u_int64_t -hwrpb_checksum() -{ - u_int64_t *p, sum; - int i; - - for (i = 0, p = (u_int64_t *)hwrpb, sum = 0; - i < (offsetof(struct rpb, rpb_checksum) / sizeof (u_int64_t)); - i++, p++) - sum += *p; - - return (sum); -} - -void -hwrpb_restart_setup() -{ - struct pcs *p; - - /* Clear bootstrap-in-progress flag since we're done bootstrapping */ - p = (struct pcs *)((char *)hwrpb + hwrpb->rpb_pcs_off); - p->pcs_flags &= ~PCS_BIP; - - bcopy(&thread0.td_pcb->pcb_hw, p->pcs_hwpcb, - sizeof thread0.td_pcb->pcb_hw); - hwrpb->rpb_vptb = VPTBASE; - - /* when 'c'ontinuing from console halt, do a dump */ - hwrpb->rpb_rest_term = (u_int64_t)&XentRestart; - hwrpb->rpb_rest_term_val = 0x1; - -#if 0 - /* don't know what this is really used by, so don't mess with it. */ - hwrpb->rpb_restart = (u_int64_t)&XentRestart; - hwrpb->rpb_restart_val = 0x2; -#endif - - hwrpb->rpb_checksum = hwrpb_checksum(); - - p->pcs_flags |= (PCS_RC | PCS_CV); -} - -u_int64_t -console_restart(ra, ai, pv) - u_int64_t ra, ai, pv; -{ - struct pcs *p; - - /* Clear restart-capable flag, since we can no longer restart. */ - p = (struct pcs *)((char *)hwrpb + hwrpb->rpb_pcs_off); - p->pcs_flags &= ~PCS_RC; - - panic("user requested console halt"); - - return (1); -} diff --git a/sys/alpha/alpha/prom_disp.s b/sys/alpha/alpha/prom_disp.s deleted file mode 100644 index 1fb4ff7..0000000 --- a/sys/alpha/alpha/prom_disp.s +++ /dev/null @@ -1,116 +0,0 @@ -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#ifndef _LOCORE -#include <machine/asm.h> -#else -__KERNEL_RCSID(2, "$NetBSD: prom_disp.s,v 1.8 1997/11/03 04:22:03 ross Exp $"); -__FBSDID("$FreeBSD$"); -#endif - - .globl prom_dispatch_v - .comm prom_dispatch_v,16 - - .text - .align 4 - - .text - .loc 1 __LINE__ -/* - * Dispatcher routine. Implements prom's calling machinery, saves our - * callee-saved registers as required by C. - */ -#define D_RA (7*8) -#define D_S0 (8*8) -#define D_S1 (9*8) -#define D_S2 (10*8) -#define D_S3 (11*8) -#define D_S4 (12*8) -#define D_S5 (13*8) -#define D_S6 (14*8) -#define DISPATCH_FRAME_SIZE (15*8) -#define DISPATCH_REGS IM_RA|IM_S0|IM_S1|IM_S2|IM_S3|IM_S4|IM_S5|IM_S6 - -NESTED(prom_dispatch, 5, DISPATCH_FRAME_SIZE, ra, DISPATCH_REGS, 0) - - ldgp gp, 0(pv) - - lda sp, -DISPATCH_FRAME_SIZE(sp) - stq ra, D_RA(sp) - stq s0, D_S0(sp) - stq s1, D_S1(sp) - stq s2, D_S2(sp) - stq s3, D_S3(sp) - stq s4, D_S4(sp) - stq s5, D_S5(sp) - stq s6, D_S6(sp) - - /* Lord have mercy because.. I would not. */ -#define STUPID_PROM_IS_32_BITS -#ifdef STUPID_PROM_IS_32_BITS - ldah s0, 0x2000(zero) /* hack for hack */ - lda s0, (0x2000-8)(s0) - - stq sp, 0(s0) - or s0, zero, sp -#endif /* STUPID_PROM_IS_32_BITS */ - - lda pv, prom_dispatch_v - ldq v0, 0(pv) /* routine */ - ldq pv, 8(pv) /* routine_arg */ - - jsr ra, (v0) - -#ifdef STUPID_PROM_IS_32_BITS - ldah s0, 0x2000(zero) /* hack for hack */ - lda s0, (0x2000-8)(s0) - - ldq sp, 0(s0) -#endif /* STUPID_PROM_IS_32_BITS */ - - ldq ra, D_RA(sp) - ldq s0, D_S0(sp) - ldq s1, D_S1(sp) - ldq s2, D_S2(sp) - ldq s3, D_S3(sp) - ldq s4, D_S4(sp) - ldq s5, D_S5(sp) - ldq s6, D_S6(sp) - lda sp, DISPATCH_FRAME_SIZE(sp) - RET -END(prom_dispatch) - -#undef D_RA -#undef D_S0 -#undef D_S1 -#undef D_S2 -#undef D_S3 -#undef D_S4 -#undef D_S5 -#undef D_S6 -#undef DISPATCH_FRAME_SIZE -#undef DISPATCH_REGS diff --git a/sys/alpha/alpha/promcons.c b/sys/alpha/alpha/promcons.c deleted file mode 100644 index 609a9ba..0000000 --- a/sys/alpha/alpha/promcons.c +++ /dev/null @@ -1,248 +0,0 @@ -/* $NetBSD: promcons.c,v 1.13 1998/03/21 22:52:59 mycroft Exp $ */ -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/conf.h> -#include <sys/tty.h> -#include <sys/proc.h> -#include <sys/cons.h> - -#include <vm/vm.h> -#include <vm/vm_param.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <vm/vm_kern.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> -#include <vm/vm_object.h> -#include <vm/vm_extern.h> -#include <vm/vm_pageout.h> -#include <vm/vm_pager.h> - -#include <machine/prom.h> - -#define _PMAP_MAY_USE_PROM_CONSOLE /* XXX for now */ - -#ifdef _PMAP_MAY_USE_PROM_CONSOLE - -#define PROM_POLL_HZ 50 - -static d_open_t promopen; -static d_close_t promclose; - -static struct cdevsw prom_cdevsw = { - .d_version = D_VERSION, - .d_open = promopen, - .d_close = promclose, - .d_name = "prom", - .d_flags = D_TTY | D_NEEDGIANT, -}; - - -static int polltime; -static struct callout_handle promtimeouthandle - = CALLOUT_HANDLE_INITIALIZER(&promtimeouthandle); - -void promstart(struct tty *); -void promtimeout(void *); -int promparam(struct tty *, struct termios *); -void promstop(struct tty *, int); - -extern int promcons_dly_mkdev; -void promcons_delayed_makedev(void); - -int -promopen(dev, flag, mode, td) - struct cdev *dev; - int flag, mode; - struct thread *td; -{ - struct tty *tp; - int unit = minor(dev); - int s; - int error = 0, setuptimeout = 0; - - if (pmap_uses_prom_console() == 0 || unit != 0) - return ENXIO; - - - tp = dev->si_tty = ttyalloc(); - - s = spltty(); - tp->t_oproc = promstart; - tp->t_param = promparam; - tp->t_stop = promstop; - tp->t_dev = dev; - if ((tp->t_state & TS_ISOPEN) == 0) { - tp->t_state |= TS_CARR_ON; - ttyconsolemode(tp, 0); - - setuptimeout = 1; - } else if ((tp->t_state & TS_XCLUDE) && suser(td)) { - splx(s); - return EBUSY; - } - - splx(s); - - error = ttyld_open(tp, dev); - - if (error == 0 && setuptimeout) { - polltime = hz / PROM_POLL_HZ; - if (polltime < 1) - polltime = 1; - promtimeouthandle = timeout(promtimeout, tp, polltime); - } - return error; -} - -int -promclose(dev, flag, mode, td) - struct cdev *dev; - int flag, mode; - struct thread *td; -{ - int unit = minor(dev); - struct tty *tp = dev->si_tty; - - if (unit != 0) - return ENXIO; - - untimeout(promtimeout, tp, promtimeouthandle); - ttyld_close(tp, flag); - tty_close(tp); - return 0; -} - -int -promparam(tp, t) - struct tty *tp; - struct termios *t; -{ - - return 0; -} - -void -promstart(tp) - struct tty *tp; -{ - int s; - - s = spltty(); - - if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) { - ttwwakeup(tp); - splx(s); - return; - } - - tp->t_state |= TS_BUSY; - while (tp->t_outq.c_cc != 0) - promcnputc(NULL, getc(&tp->t_outq)); - tp->t_state &= ~TS_BUSY; - - ttwwakeup(tp); - splx(s); -} - -/* - * Stop output on a line. - */ -void -promstop(tp, flag) - struct tty *tp; - int flag; -{ - int s; - - s = spltty(); - if (tp->t_state & TS_BUSY) - if ((tp->t_state & TS_TTSTOP) == 0) - tp->t_state |= TS_FLUSH; - splx(s); -} - -void -promtimeout(v) - void *v; -{ - struct tty *tp = v; - int c; - - while ((c = promcncheckc(NULL)) != -1) { - if (tp->t_state & TS_ISOPEN) - ttyld_rint(tp, c); - } - promtimeouthandle = timeout(promtimeout, tp, polltime); -} - -CONS_DRIVER(prom, NULL, NULL, NULL, promcngetc, promcncheckc, promcnputc, NULL); - -static int promcn_attached = 0; -void -promcnattach(int alpha_console) -{ - prom_consdev.cn_pri = CN_NORMAL; - sprintf(prom_consdev.cn_name, "promcons"); - if (promcons_dly_mkdev) - promcons_dly_mkdev++; - else { - make_dev(&prom_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "promcons"); - } - cnadd(&prom_consdev); - promcn_attached = 1; -} - -void -promcons_delayed_makedev(void) -{ - if (promcn_attached) { - make_dev(&prom_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "promcons"); - } -} - -void -promcndetach(void) -{ - if (promcn_attached) { - cnremove(&prom_consdev); - promcn_attached = 0; - } -} -/* - * promcnputc, promcngetc and promchcheckc in prom.c for layering reasons - */ -#endif /* _PMAP_MAY_USE_PROM_CONSOLE */ diff --git a/sys/alpha/alpha/sgmap.c b/sys/alpha/alpha/sgmap.c deleted file mode 100644 index 9682df7..0000000 --- a/sys/alpha/alpha/sgmap.c +++ /dev/null @@ -1,195 +0,0 @@ -/*- - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <machine/bus.h> -#include <sys/malloc.h> -#include <sys/rman.h> -#include <sys/lock.h> -#include <machine/sgmap.h> -#include <vm/vm.h> -#include <vm/pmap.h> - -MALLOC_DEFINE(M_SGMAP, "sgmap", "Scatter Gather mapping"); - -struct sgmap { - struct rman rm; /* manage range of bus addresses */ - sgmap_map_callback *map; /* map one page in the sgmap */ - void *arg; /* argument to map function */ - bus_addr_t sba; - bus_addr_t eba; -}; - -void *overflow_page = 0; -vm_offset_t overflow_page_pa; - -vm_offset_t -sgmap_overflow_page(void) -{ - /* - * Allocate the overflow page if necessary. - */ - if (!overflow_page) { - overflow_page = malloc(PAGE_SIZE, M_DEVBUF, M_NOWAIT); - if (!overflow_page) - panic("sgmap_alloc_region: can't allocate overflow page"); - overflow_page_pa = pmap_kextract((vm_offset_t) overflow_page); - } - - return overflow_page_pa; -} - -/* - * Create an sgmap to manage a range of bus addresses which map - * physical memory using a scatter-gather map. - */ -struct sgmap * -sgmap_map_create(bus_addr_t sba, bus_addr_t eba, - sgmap_map_callback *map, void *arg) -{ - struct sgmap *sgmap; - - sgmap = malloc(sizeof *sgmap, M_SGMAP, M_NOWAIT); - if (!sgmap) - return 0; - - - sgmap->rm.rm_start = sba; - sgmap->rm.rm_end = eba; - sgmap->rm.rm_type = RMAN_ARRAY; - sgmap->rm.rm_descr = "Scatter Gather Bus Addresses"; - rman_init(&sgmap->rm); - rman_manage_region(&sgmap->rm, sba, eba); - sgmap->map = map; - sgmap->arg = arg; - sgmap->sba = sba; - sgmap->eba = eba; - - return sgmap; -} - -/* - * Destroy an sgmap created with sgmap_map_create(). - */ -void -sgmap_map_destroy(struct sgmap *sgmap) -{ - rman_fini(&sgmap->rm); - free(sgmap, M_SGMAP); -} - -/* - * Map a range of virtual addresses using the sgmap and return the bus - * address of the mapped region. An opaque handle for the mapped - * region is also returned in *mhp. This handle should be passed to - * sgmap_free_region() when the mapping is no longer required. - */ -bus_addr_t -sgmap_alloc_region(struct sgmap *sgmap, - bus_size_t size, - bus_size_t boundary, - void **mhp) -{ - struct resource *res; - bus_addr_t ba, nba; - - /* - * This ensures allocations are on page boundaries. The extra - * page is used as a guard page since dma prefetching can - * generate accesses to addresses outside the transfer range. - */ - size = round_page(size); - - /* - * Attempt to allocate within each boundary delimited region. - */ - res = 0; - for (ba = sgmap->sba; ba < sgmap->eba; ba = nba) { - nba = (ba + boundary) & ~(boundary - 1); - res = rman_reserve_resource(&sgmap->rm, - ba, nba - 1, size + PAGE_SIZE, - RF_ACTIVE, 0); - if (res) - break; - } - - if (res == 0) - return 0; - - *mhp = (void *) res; - return rman_get_start(res); -} - -void -sgmap_load_region(struct sgmap *sgmap, - bus_addr_t sba, - vm_offset_t va, - bus_size_t size) -{ - bus_addr_t ba, eba; - - /* - * Call the chipset to map each page in the mapped range to - * the correct physical page. - */ - for (ba = sba, eba = sba + size; ba < eba; - ba += PAGE_SIZE, va += PAGE_SIZE) { - vm_offset_t pa = pmap_kextract(va); - sgmap->map(sgmap->arg, ba, pa); - } - sgmap->map(sgmap->arg, ba, overflow_page_pa); -} - -void -sgmap_unload_region(struct sgmap *sgmap, - bus_addr_t sba, - bus_size_t size) -{ - bus_addr_t ba, eba; - - /* - * Call the chipset to unmap each page. - */ - for (ba = sba, eba = sba + size; ba < eba; ba += PAGE_SIZE) { - sgmap->map(sgmap->arg, ba, 0); - } - sgmap->map(sgmap->arg, ba, 0); -} - -/* - * Free a region allocated using sgmap_alloc_region(). - */ -void -sgmap_free_region(struct sgmap *sgmap, void *mh) -{ - struct resource *res = mh; - rman_release_resource(res); -} diff --git a/sys/alpha/alpha/support.s b/sys/alpha/alpha/support.s deleted file mode 100644 index b2b7cf4..0000000 --- a/sys/alpha/alpha/support.s +++ /dev/null @@ -1,691 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <machine/asm.h> -#include <assym.s> - - .text - -/**************************************************************************/ - -/* - * intptr_t - * casuptr(intptr_t *p, intptr_t old, intptr_t new) - */ - LEAF(casuptr, 3) - LDGP(pv) - - ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */ - cmpult a0, t0, t1 - beq t1, fusufault - - lda t0, fusufault /* trap faults */ - ldq t2, PC_CURTHREAD(pcpup) - ldq t2, TD_PCB(t2) - - stq t0, PCB_ONFAULT(t2) -1: - ldq_l v0, 0(a0) /* try to load the old value */ - cmpeq v0, a1, t0 /* compare */ - beq t0, 2f /* exit if not equal */ - mov a2, t0 /* setup value to write */ - stq_c t0, 0(a0) /* write if address still locked */ - beq t0, 1b /* if it failed, spin */ -2: - stq zero, PCB_ONFAULT(t2) /* clean up */ - RET - END(casuptr) - -/* - * fu{byte,word} : fetch a byte (word) from user memory - */ - - LEAF(suword, 1) - XLEAF(suword64, 1) - LDGP(pv) - - ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */ - cmpult a0, t0, t1 - beq t1, fusufault - - lda t0, fusufault /* trap faults */ - ldq t2, PC_CURTHREAD(pcpup) - ldq t2, TD_PCB(t2) - stq t0, PCB_ONFAULT(t2) - - stq a1, 0(a0) /* try the store */ - - stq zero, PCB_ONFAULT(t2) /* clean up */ - - mov zero, v0 - RET - END(suword) - - LEAF(suword32, 2) - LDGP(pv) - - ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */ - cmpult a0, t0, t1 - beq t1, fusufault - - lda t0, fusufault /* trap faults */ - ldq t2, PC_CURTHREAD(pcpup) - ldq t2, TD_PCB(t2) - stq t0, PCB_ONFAULT(t2) - - stl a1, 0(a0) /* try the store */ - - stq zero, PCB_ONFAULT(t2) /* clean up */ - - mov zero, v0 - RET - END(suword32) - - LEAF(subyte, 1) - LDGP(pv) - - ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */ - cmpult a0, t0, t1 - beq t1, fusufault - - lda t0, fusufault /* trap faults */ - ldq t2, PC_CURTHREAD(pcpup) - ldq t2, TD_PCB(t2) - stq t0, PCB_ONFAULT(t2) - - zap a1, 0xfe, a1 /* mask off the byte to store */ - insbl a1, a0, a1 /* shift it to the right place */ - ldq_u t0, 0(a0) /* read the qword to store it in */ - mskbl t0, a0, t0 /* make a place for our byte */ - or a1, t0, a1 /* move it in */ - stq_u a1, 0(a0) /* and put the byte back */ - - stq zero, PCB_ONFAULT(t2) /* clean up */ - - mov zero, v0 - RET - END(subyte) - - LEAF(fuword, 1) - XLEAF(fuword64, 1) - LDGP(pv) - - ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */ - cmpult a0, t0, t1 - beq t1, fusufault - - lda t0, fusufault /* trap faults */ - ldq t2, PC_CURTHREAD(pcpup) - ldq t2, TD_PCB(t2) - stq t0, PCB_ONFAULT(t2) - - ldq v0, 0(a0) /* try the fetch */ - - stq zero, PCB_ONFAULT(t2) /* clean up */ - - RET - END(fuword) - - LEAF(fuword32, 1) - LDGP(pv) - - ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */ - cmpult a0, t0, t1 - beq t1, fusufault - - lda t0, fusufault /* trap faults */ - ldq t2, PC_CURTHREAD(pcpup) - ldq t2, TD_PCB(t2) - stq t0, PCB_ONFAULT(t2) - - ldl v0, 0(a0) /* get the word containing our byte */ - - stq zero, PCB_ONFAULT(t2) /* clean up */ - - RET - END(fuword32) - - LEAF(fubyte, 1) - LDGP(pv) - - ldiq t0, VM_MAXUSER_ADDRESS /* verify address validity */ - cmpult a0, t0, t1 - beq t1, fusufault - - lda t0, fusufault /* trap faults */ - ldq t2, PC_CURTHREAD(pcpup) - ldq t2, TD_PCB(t2) - stq t0, PCB_ONFAULT(t2) - - ldq_u v0, 0(a0) /* get the word containing our byte */ - extbl v0, a0, v0 /* extract the byte */ - - stq zero, PCB_ONFAULT(t2) /* clean up */ - - RET - END(fubyte) - - LEAF(fusufault, 0) - ldq t0, PC_CURTHREAD(pcpup) - ldq t0, TD_PCB(t0) - stq zero, PCB_ONFAULT(t0) - ldiq v0, -1 - RET - END(fusufault) - -LEAF(fswintrberr, 0) -XLEAF(fuswintr, 2) /* XXX 16 bit short for profiling */ -XLEAF(suswintr, 2) /* XXX 16 bit short for profiling */ - LDGP(pv) - ldiq v0, -1 - RET - END(fswintrberr) - -/**************************************************************************/ - -/* - * Copy a null-terminated string within the kernel's address space. - * If lenp is not NULL, store the number of chars copied in *lenp - * - * int copystr(char *from, char *to, size_t len, size_t *lenp); - */ -LEAF(copystr, 4) - LDGP(pv) - - mov a2, t0 /* t0 = i = len */ - beq a2, Lcopystr2 /* if (len == 0), bail out */ - -Lcopystr1: - ldq_u t1, 0(a0) /* t1 = *from */ - extbl t1, a0, t1 - ldq_u t3, 0(a1) /* set up t2 with quad around *to */ - insbl t1, a1, t2 - mskbl t3, a1, t3 - or t3, t2, t3 /* add *from to quad around *to */ - stq_u t3, 0(a1) /* write out that quad */ - - subl a2, 1, a2 /* len-- */ - beq t1, Lcopystr2 /* if (*from == 0), bail out */ - addq a1, 1, a1 /* to++ */ - addq a0, 1, a0 /* from++ */ - bne a2, Lcopystr1 /* if (len != 0) copy more */ - -Lcopystr2: - beq a3, Lcopystr3 /* if (lenp != NULL) */ - subl t0, a2, t0 /* *lenp = (i - len) */ - stq t0, 0(a3) -Lcopystr3: - beq t1, Lcopystr4 /* *from == '\0'; leave quietly */ - - ldiq v0, ENAMETOOLONG /* *from != '\0'; error. */ - RET - -Lcopystr4: - mov zero, v0 /* return 0. */ - RET - END(copystr) - -NESTED(copyinstr, 4, 16, ra, 0, 0) - LDGP(pv) - lda sp, -16(sp) /* set up stack frame */ - stq ra, (16-8)(sp) /* save ra */ - ldiq t0, VM_MAXUSER_ADDRESS /* make sure that src addr */ - cmpult a0, t0, t1 /* is in user space. */ - beq t1, copyerr /* if it's not, error out. */ - lda v0, copyerr /* set up fault handler. */ - .set noat - ldq at_reg, PC_CURTHREAD(pcpup) - ldq at_reg, TD_PCB(at_reg) - stq v0, PCB_ONFAULT(at_reg) - .set at - CALL(copystr) /* do the copy. */ - .set noat - ldq at_reg, PC_CURTHREAD(pcpup) /* kill the fault handler. */ - ldq at_reg, TD_PCB(at_reg) - stq zero, PCB_ONFAULT(at_reg) - .set at - ldq ra, (16-8)(sp) /* restore ra. */ - lda sp, 16(sp) /* kill stack frame. */ - RET /* v0 left over from copystr */ - END(copyinstr) - -NESTED(copyoutstr, 4, 16, ra, 0, 0) - LDGP(pv) - lda sp, -16(sp) /* set up stack frame */ - stq ra, (16-8)(sp) /* save ra */ - ldiq t0, VM_MAXUSER_ADDRESS /* make sure that dest addr */ - cmpult a1, t0, t1 /* is in user space. */ - beq t1, copyerr /* if it's not, error out. */ - lda v0, copyerr /* set up fault handler. */ - .set noat - ldq at_reg, PC_CURTHREAD(pcpup) - ldq at_reg, TD_PCB(at_reg) - stq v0, PCB_ONFAULT(at_reg) - .set at - CALL(copystr) /* do the copy. */ - .set noat - ldq at_reg, PC_CURTHREAD(pcpup) /* kill the fault handler. */ - ldq at_reg, TD_PCB(at_reg) - stq zero, PCB_ONFAULT(at_reg) - .set at - ldq ra, (16-8)(sp) /* restore ra. */ - lda sp, 16(sp) /* kill stack frame. */ - RET /* v0 left over from copystr */ - END(copyoutstr) - -/* - * Alternative memory mover - */ - LEAF(memcpy,3) - mov a0,t0 - mov a1,a0 - mov t0,a1 - br bcopy - END(memcpy) - -/* - * Copy a bytes within the kernel's address space. - * Handles overlapping regions. - * - * void bcopy(char *from, char *to, size_t len); - */ -LEAF(bcopy,3) - - /* Check for negative length */ - ble a2,bcopy_done - - /* Check for overlap */ - subq a1,a0,t5 - cmpult t5,a2,t5 - bne t5,bcopy_overlap - - /* a3 = end address */ - addq a0,a2,a3 - - /* Get the first word */ - ldq_u t2,0(a0) - - /* Do they have the same alignment? */ - xor a0,a1,t0 - and t0,7,t0 - and a1,7,t1 - bne t0,bcopy_different_alignment - - /* src & dst have same alignment */ - beq t1,bcopy_all_aligned - - ldq_u t3,0(a1) - addq a2,t1,a2 - mskqh t2,a0,t2 - mskql t3,a0,t3 - or t2,t3,t2 - - /* Dst is 8-byte aligned */ - -bcopy_all_aligned: - /* If less than 8 bytes,skip loop */ - subq a2,1,t0 - and a2,7,a2 - bic t0,7,t0 - beq t0,bcopy_samealign_lp_end - -bcopy_samealign_lp: - stq_u t2,0(a1) - addq a1,8,a1 - ldq_u t2,8(a0) - subq t0,8,t0 - addq a0,8,a0 - bne t0,bcopy_samealign_lp - -bcopy_samealign_lp_end: - /* If we're done, exit */ - bne a2,bcopy_small_left - stq_u t2,0(a1) - RET - -bcopy_small_left: - mskql t2,a2,t4 - ldq_u t3,0(a1) - mskqh t3,a2,t3 - or t4,t3,t4 - stq_u t4,0(a1) - RET - -bcopy_different_alignment: - /* - * this is the fun part - */ - addq a0,a2,a3 - cmpule a2,8,t0 - bne t0,bcopy_da_finish - - beq t1,bcopy_da_noentry - - /* Do the initial partial word */ - subq zero,a1,t0 - and t0,7,t0 - ldq_u t3,7(a0) - extql t2,a0,t2 - extqh t3,a0,t3 - or t2,t3,t5 - insql t5,a1,t5 - ldq_u t6,0(a1) - mskql t6,a1,t6 - or t5,t6,t5 - stq_u t5,0(a1) - addq a0,t0,a0 - addq a1,t0,a1 - subq a2,t0,a2 - ldq_u t2,0(a0) - -bcopy_da_noentry: - subq a2,1,t0 - bic t0,7,t0 - and a2,7,a2 - beq t0,bcopy_da_finish2 - -bcopy_da_lp: - ldq_u t3,7(a0) - addq a0,8,a0 - extql t2,a0,t4 - extqh t3,a0,t5 - subq t0,8,t0 - or t4,t5,t5 - stq t5,0(a1) - addq a1,8,a1 - beq t0,bcopy_da_finish1 - ldq_u t2,7(a0) - addq a0,8,a0 - extql t3,a0,t4 - extqh t2,a0,t5 - subq t0,8,t0 - or t4,t5,t5 - stq t5,0(a1) - addq a1,8,a1 - bne t0,bcopy_da_lp - -bcopy_da_finish2: - /* Do the last new word */ - mov t2,t3 - -bcopy_da_finish1: - /* Do the last partial word */ - ldq_u t2,-1(a3) - extql t3,a0,t3 - extqh t2,a0,t2 - or t2,t3,t2 - br zero,bcopy_samealign_lp_end - -bcopy_da_finish: - /* Do the last word in the next source word */ - ldq_u t3,-1(a3) - extql t2,a0,t2 - extqh t3,a0,t3 - or t2,t3,t2 - insqh t2,a1,t3 - insql t2,a1,t2 - lda t4,-1(zero) - mskql t4,a2,t5 - cmovne t5,t5,t4 - insqh t4,a1,t5 - insql t4,a1,t4 - addq a1,a2,a4 - ldq_u t6,0(a1) - ldq_u t8,-1(a4) - bic t6,t4,t6 - bic t8,t5,t8 - and t2,t4,t2 - and t3,t5,t3 - or t2,t6,t2 - or t3,t8,t3 - stq_u t3,-1(a4) - stq_u t2,0(a1) - RET - -bcopy_overlap: - /* - * Basically equivalent to previous case, only backwards. - * Not quite as highly optimized - */ - addq a0,a2,a3 - addq a1,a2,a4 - - /* less than 8 bytes - don't worry about overlap */ - cmpule a2,8,t0 - bne t0,bcopy_ov_short - - /* Possibly do a partial first word */ - and a4,7,t4 - beq t4,bcopy_ov_nostart2 - subq a3,t4,a3 - subq a4,t4,a4 - ldq_u t1,0(a3) - subq a2,t4,a2 - ldq_u t2,7(a3) - ldq t3,0(a4) - extql t1,a3,t1 - extqh t2,a3,t2 - or t1,t2,t1 - mskqh t3,t4,t3 - mskql t1,t4,t1 - or t1,t3,t1 - stq t1,0(a4) - -bcopy_ov_nostart2: - bic a2,7,t4 - and a2,7,a2 - beq t4,bcopy_ov_lp_end - -bcopy_ov_lp: - /* This could be more pipelined, but it doesn't seem worth it */ - ldq_u t0,-8(a3) - subq a4,8,a4 - ldq_u t1,-1(a3) - subq a3,8,a3 - extql t0,a3,t0 - extqh t1,a3,t1 - subq t4,8,t4 - or t0,t1,t0 - stq t0,0(a4) - bne t4,bcopy_ov_lp - -bcopy_ov_lp_end: - beq a2,bcopy_done - - ldq_u t0,0(a0) - ldq_u t1,7(a0) - ldq_u t2,0(a1) - extql t0,a0,t0 - extqh t1,a0,t1 - or t0,t1,t0 - insql t0,a1,t0 - mskql t2,a1,t2 - or t2,t0,t2 - stq_u t2,0(a1) - -bcopy_done: - RET - -bcopy_ov_short: - ldq_u t2,0(a0) - br zero,bcopy_da_finish - - END(bcopy) - -NESTED(copyin, 3, 16, ra, 0, 0) - LDGP(pv) - lda sp, -16(sp) /* set up stack frame */ - stq ra, (16-8)(sp) /* save ra */ - ldiq t0, VM_MAXUSER_ADDRESS /* make sure that src addr */ - cmpult a0, t0, t1 /* is in user space. */ - beq t1, copyerr /* if it's not, error out. */ - lda v0, copyerr /* set up fault handler. */ - .set noat - ldq at_reg, PC_CURTHREAD(pcpup) - ldq at_reg, TD_PCB(at_reg) - stq v0, PCB_ONFAULT(at_reg) - .set at - CALL(bcopy) /* do the copy. */ - .set noat - ldq at_reg, PC_CURTHREAD(pcpup) /* kill the fault handler. */ - ldq at_reg, TD_PCB(at_reg) - stq zero, PCB_ONFAULT(at_reg) - .set at - ldq ra, (16-8)(sp) /* restore ra. */ - lda sp, 16(sp) /* kill stack frame. */ - mov zero, v0 /* return 0. */ - RET - END(copyin) - -NESTED(copyout, 3, 16, ra, 0, 0) - LDGP(pv) - lda sp, -16(sp) /* set up stack frame */ - stq ra, (16-8)(sp) /* save ra */ - ldiq t0, VM_MAXUSER_ADDRESS /* make sure that dest addr */ - cmpult a1, t0, t1 /* is in user space. */ - beq t1, copyerr /* if it's not, error out. */ - lda v0, copyerr /* set up fault handler. */ - .set noat - ldq at_reg, PC_CURTHREAD(pcpup) - ldq at_reg, TD_PCB(at_reg) - stq v0, PCB_ONFAULT(at_reg) - .set at - CALL(bcopy) /* do the copy. */ - .set noat - ldq at_reg, PC_CURTHREAD(pcpup) /* kill the fault handler. */ - ldq at_reg, TD_PCB(at_reg) - stq zero, PCB_ONFAULT(at_reg) - .set at - ldq ra, (16-8)(sp) /* restore ra. */ - lda sp, 16(sp) /* kill stack frame. */ - mov zero, v0 /* return 0. */ - RET - END(copyout) - -LEAF(copyerr, 0) - ldq t0, PC_CURTHREAD(pcpup) - ldq t0, TD_PCB(t0) - stq zero, PCB_ONFAULT(t0) /* reset fault handler. */ - ldq ra, (16-8)(sp) /* restore ra. */ - lda sp, 16(sp) /* kill stack frame. */ - ldiq v0, EFAULT /* return EFAULT. */ - RET -END(copyerr) - -/**************************************************************************/ - -/* - * Kernel setjmp and longjmp. Rather minimalist. - * - * longjmp(label_t *a) - * will generate a "return (1)" from the last call to - * setjmp(label_t *a) - * by restoring registers from the stack, - */ - - .set noreorder - -LEAF(setjmp, 1) - LDGP(pv) - - stq ra, (0 * 8)(a0) /* return address */ - stq s0, (1 * 8)(a0) /* callee-saved registers */ - stq s1, (2 * 8)(a0) - stq s2, (3 * 8)(a0) - stq s3, (4 * 8)(a0) - stq s4, (5 * 8)(a0) - stq s5, (6 * 8)(a0) - stq s6, (7 * 8)(a0) - stq sp, (8 * 8)(a0) - - ldiq t0, 0xbeeffedadeadbabe /* set magic number */ - stq t0, (9 * 8)(a0) - - mov zero, v0 /* return zero */ - RET -END(setjmp) - -LEAF(longjmp, 1) - LDGP(pv) - - ldiq t0, 0xbeeffedadeadbabe /* check magic number */ - ldq t1, (9 * 8)(a0) - cmpeq t0, t1, t0 - beq t0, longjmp_botch /* if bad, punt */ - - ldq ra, (0 * 8)(a0) /* return address */ - ldq s0, (1 * 8)(a0) /* callee-saved registers */ - ldq s1, (2 * 8)(a0) - ldq s2, (3 * 8)(a0) - ldq s3, (4 * 8)(a0) - ldq s4, (5 * 8)(a0) - ldq s5, (6 * 8)(a0) - ldq s6, (7 * 8)(a0) - ldq sp, (8 * 8)(a0) - - ldiq v0, 1 - RET - -longjmp_botch: - lda a0, longjmp_botchmsg - mov ra, a1 - CALL(panic) - call_pal PAL_bugchk - - .data -longjmp_botchmsg: - .asciz "longjmp botch from %p" - .text -END(longjmp) diff --git a/sys/alpha/alpha/swtch.s b/sys/alpha/alpha/swtch.s deleted file mode 100644 index 8523a24..0000000 --- a/sys/alpha/alpha/swtch.s +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - * - * $NetBSD: locore.s,v 1.47 1998/03/22 07:26:32 thorpej Exp $ - * $FreeBSD$ - */ - -#define _LOCORE -#include <machine/asm.h> -#include <machine/mutex.h> -#include "assym.s" - -/**************************************************************************/ - -/* - * Perform actions necessary to switch to a new context. The - * hwpcb should be in a0. - */ -#define SWITCH_CONTEXT \ - /* Make a note of the context we're running on. */ \ - stq a0, PC_CURPCB(pcpup); \ - \ - /* Swap in the new context. */ \ - call_pal PAL_OSF1_swpctx - -/* - * savectx: save process context, i.e. callee-saved registers - * - * Note that savectx() only works for threads other than curthread, - * since cpu_switch will copy over the info saved here. (It _can_ - * sanely be used for curthread iff cpu_switch won't be called again, e.g. - * from if called from boot().) - * - * Arguments: - * a0 'struct pcb *' of the process that needs its context saved - * - * Return: - * v0 0. (note that for child processes, it seems - * like savectx() returns 1, because the return address - * in the PCB is set to the return address from savectx().) - */ - -LEAF(savectx, 1) - br pv, Lsavectx1 -Lsavectx1: LDGP(pv) - stq sp, PCB_HWPCB_KSP(a0) /* store sp */ - stq s0, PCB_CONTEXT+(0 * 8)(a0) /* store s0 - s6 */ - stq s1, PCB_CONTEXT+(1 * 8)(a0) - stq s2, PCB_CONTEXT+(2 * 8)(a0) - stq s3, PCB_CONTEXT+(3 * 8)(a0) - stq s4, PCB_CONTEXT+(4 * 8)(a0) - stq s5, PCB_CONTEXT+(5 * 8)(a0) - stq s6, PCB_CONTEXT+(6 * 8)(a0) - stq ra, PCB_CONTEXT+(7 * 8)(a0) /* store ra */ - call_pal PAL_OSF1_rdps /* NOTE: doesn't kill a0 */ - stq v0, PCB_CONTEXT+(8 * 8)(a0) /* store ps, for ipl */ - - mov zero, v0 - RET - END(savectx) - -/**************************************************************************/ - -IMPORT(Lev1map, 8) - -/* - * cpu_throw() - * Switch to a new thread discarding our current state. - * - * Arguments: - * a0 'struct thread *' of the old thread - * a1 'struct thread *' of the new thread - */ -LEAF(cpu_throw, 0) - LDGP(pv) - CALL(Lcs1) - END(cpu_throw) - -/* - * cpu_switch() - * Switch to a new thread saving the current state in the old thread. - * - * Arguments: - * a0 'struct thread *' of the old thread - * a1 'struct thread *' of the new thread - */ -LEAF(cpu_switch, 1) - LDGP(pv) - /* do an inline savectx(), to save old context */ - ldq a2, TD_PCB(a0) - /* NOTE: ksp is stored by the swpctx */ - stq s0, PCB_CONTEXT+(0 * 8)(a2) /* store s0 - s6 */ - stq s1, PCB_CONTEXT+(1 * 8)(a2) - stq s2, PCB_CONTEXT+(2 * 8)(a2) - stq s3, PCB_CONTEXT+(3 * 8)(a2) - stq s4, PCB_CONTEXT+(4 * 8)(a2) - stq s5, PCB_CONTEXT+(5 * 8)(a2) - stq s6, PCB_CONTEXT+(6 * 8)(a2) - stq ra, PCB_CONTEXT+(7 * 8)(a2) /* store ra */ - call_pal PAL_OSF1_rdps /* NOTE: doesn't kill a0 */ - stq v0, PCB_CONTEXT+(8 * 8)(a2) /* store ps, for ipl */ - - mov a0, s0 /* s0 = old curthread */ - mov a2, s1 /* s1 = old pcb */ - - /* - * Deactivate the old address space before activating the - * new one. We need to do this before activating the - * new thread's address space in the event that new - * thread is using the same vmspace as the old. If we - * do this after we activate, then we might end up - * incorrectly marking the pmap inactive! - * - * We don't deactivate if we came here from switch_exit - * (old pmap no longer exists; vmspace has been freed). - * oldproc will be NULL in this case. We have actually - * taken care of calling pmap_deactivate() in cpu_exit(), - * before the vmspace went away. - */ - beq a0, sw1 - CALL(pmap_deactivate) /* pmap_deactivate(oldthread) */ - -sw1: - br pv, Lcs1 -Lcs1: LDGP(pv) - mov a1, s2 /* s2 = new thread */ - ldq s3, TD_MD_PCBPADDR(s2) /* s3 = new pcbpaddr */ - -#ifdef SMP - /* - * Save fp state if we have some. - */ - mov s0, a0 /* curthread */ - ldiq a1, 1 /* clear fpcurthread */ - CALL(alpha_fpstate_save) -#endif - - /* - * Activate the new thread's address space and perform - * the actual context swap. - */ - - mov s2, a0 /* pmap_activate(newthread) */ - CALL(pmap_activate) /* XXXKSE */ - - mov s3, a0 /* swap the context */ - SWITCH_CONTEXT - - /* - * Now that the switch is done, update curthread and other - * globals. - */ - stq s2, PC_CURTHREAD(pcpup) /* curthread = p */ - - /* - * Now running on the new pcb. - * Restore registers and return. - */ - ldq t0, TD_PCB(s2) - - /* NOTE: ksp is restored by the swpctx */ - ldq s0, PCB_CONTEXT+(0 * 8)(t0) /* restore s0 - s6 */ - ldq s1, PCB_CONTEXT+(1 * 8)(t0) - ldq s2, PCB_CONTEXT+(2 * 8)(t0) - ldq s3, PCB_CONTEXT+(3 * 8)(t0) - ldq s4, PCB_CONTEXT+(4 * 8)(t0) - ldq s5, PCB_CONTEXT+(5 * 8)(t0) - ldq s6, PCB_CONTEXT+(6 * 8)(t0) - ldq ra, PCB_CONTEXT+(7 * 8)(t0) /* restore ra */ - - ldiq v0, 1 /* possible ret to savectx() */ - RET - END(cpu_switch) - - -/* - * fork_trampoline() - * - * Arrange for a function to be invoked neatly, after a cpu_switch(). - * - * Invokes fork_exit() passing in three arguments: a callout function, - * an argument to the callout, and a trapframe pointer. For child processes - * returning from fork(2), the argument is a pointer to the child process. - * - * The callout function is in s0, the address to return to after executing - * fork_exit() is in s1, and the argument is in s2. - */ -LEAF(fork_trampoline, 0) - mov s1, ra - mov s0, a0 - mov s2, a1 - mov sp, a2 - jmp zero, fork_exit - END(fork_trampoline) diff --git a/sys/alpha/alpha/sys_machdep.c b/sys/alpha/alpha/sys_machdep.c deleted file mode 100644 index 420f666..0000000 --- a/sys/alpha/alpha/sys_machdep.c +++ /dev/null @@ -1,216 +0,0 @@ -/*- - * 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. - * 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: @(#)sys_machdep.c 5.5 (Berkeley) 1/19/91 - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_mac.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/lock.h> -#include <sys/mac.h> -#include <sys/mutex.h> -#include <sys/proc.h> -#include <sys/sysent.h> -#include <sys/sysproto.h> - -#include <vm/vm.h> -#include <vm/pmap.h> -#include <vm/vm_map.h> -#include <vm/vm_extern.h> - -#include <machine/cpu.h> -#include <machine/pcb.h> -#include <machine/sysarch.h> - -#include <vm/vm_kern.h> /* for kernel_map */ - -#include <machine/fpu.h> - -#ifndef _SYS_SYSPROTO_H_ -struct sysarch_args { - int op; - char *parms; -}; -#endif - -static int alpha_sethae(struct thread *td, char *args); -static int alpha_get_fpmask(struct thread *td, char *args); -static int alpha_set_fpmask(struct thread *td, char *args); -static int alpha_set_uac(struct thread *td, char *args); -static int alpha_get_uac(struct thread *td, char *args); - -int -sysarch(td, uap) - struct thread *td; - register struct sysarch_args *uap; -{ - int error; - - switch(uap->op) { - case ALPHA_SETHAE: - error = alpha_sethae(td, uap->parms); - break; - case ALPHA_GET_FPMASK: - error = alpha_get_fpmask(td, uap->parms); - break; - case ALPHA_SET_FPMASK: - error = alpha_set_fpmask(td, uap->parms); - break; - case ALPHA_SET_UAC: - error = alpha_set_uac(td, uap->parms); - break; - case ALPHA_GET_UAC: - error = alpha_get_uac(td, uap->parms); - break; - - default: - error = EINVAL; - break; - } - return (error); -} - -struct alpha_sethae_args { - u_int64_t hae; -}; - -static int -alpha_sethae(struct thread *td, char *args) -{ - int error; - struct alpha_sethae_args ua; - - error = copyin(args, &ua, sizeof(struct alpha_sethae_args)); - if (error) - return (error); - -#ifdef MAC - error = mac_check_sysarch_ioperm(td->td_ucred); - if (error) - return (error); -#endif - - error = securelevel_gt(td->td_ucred, 0); - if (error) - return (error); - - error = suser(td); - if (error) - return (error); - - td->td_md.md_flags |= MDTD_HAEUSED; - td->td_md.md_hae = ua.hae; - - return (0); -} - -struct alpha_fpmask_args { - u_int64_t mask; -}; - -static int -alpha_get_fpmask(struct thread *td, char *args) -{ - int error; - struct alpha_fpmask_args ua; - - ua.mask = td->td_pcb->pcb_fp_control; - error = copyout(&ua, args, sizeof(struct alpha_fpmask_args)); - - return (error); -} - -static int -alpha_set_fpmask(struct thread *td, char *args) -{ - int error; - u_int64_t oldmask, *fp_control; - struct alpha_fpmask_args ua; - - error = copyin(args, &ua, sizeof(struct alpha_fpmask_args)); - if (error) - return (error); - - fp_control = &td->td_pcb->pcb_fp_control; - oldmask = *fp_control; - *fp_control = ua.mask & IEEE_TRAP_ENABLE_MASK; - ua.mask = oldmask; - - error = copyout(&ua, args, sizeof(struct alpha_fpmask_args)); - return (error); -} - -static int -alpha_set_uac(struct thread *td, char *args) -{ - int error; - unsigned long uac; - struct proc *p, *pp; - - error = copyin(args, &uac, sizeof(uac)); - if (error) - return (error); - - p = td->td_proc; - PROC_LOCK(p); - pp = p->p_pptr; - if (pp != NULL) { - PROC_LOCK(pp); - pp->p_md.md_uac = uac & MDP_UAC_MASK; - PROC_UNLOCK(pp); - } - PROC_UNLOCK(p); - return 0; -} - -static int -alpha_get_uac(struct thread *td, char *args) -{ - struct proc *p, *pp; - int error; - unsigned long uac; - - p = td->td_proc; - error = ESRCH; - PROC_LOCK(p); - pp = p->p_pptr; - if (pp != NULL) { - PROC_LOCK(pp); - uac = pp->p_md.md_uac; - PROC_UNLOCK(pp); - PROC_UNLOCK(p); - error = copyout(&uac, args, sizeof(uac)); - } else - PROC_UNLOCK(p); - return error; -} diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c deleted file mode 100644 index 33b4826..0000000 --- a/sys/alpha/alpha/trap.c +++ /dev/null @@ -1,1318 +0,0 @@ -/* $NetBSD: trap.c,v 1.31 1998/03/26 02:21:46 thorpej Exp $ */ -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -/* #include "opt_fix_unaligned_vax_fp.h" */ -#include "opt_ddb.h" -#include "opt_ktrace.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kdb.h> -#include <sys/ktr.h> -#include <sys/sysproto.h> -#include <sys/kernel.h> -#include <sys/proc.h> -#include <sys/exec.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/smp.h> -#include <sys/vmmeter.h> -#include <sys/sysent.h> -#include <sys/signalvar.h> -#include <sys/syscall.h> -#include <sys/pioctl.h> -#include <vm/vm.h> -#include <vm/vm_kern.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> -#include <vm/vm_extern.h> -#include <vm/vm_param.h> -#include <sys/ptrace.h> -#include <machine/clock.h> -#include <machine/md_var.h> -#include <machine/reg.h> -#include <machine/pal.h> -#include <machine/pcb.h> -#include <machine/fpu.h> - -#ifdef KTRACE -#include <sys/uio.h> -#include <sys/ktrace.h> -#endif - -#include <alpha/alpha/db_instruction.h> /* for handle_opdec() */ - -unsigned long Sfloat_to_reg(unsigned int); -unsigned int reg_to_Sfloat(unsigned long); -unsigned long Tfloat_reg_cvt(unsigned long); -#ifdef FIX_UNALIGNED_VAX_FP -unsigned long Ffloat_to_reg(unsigned int); -unsigned int reg_to_Ffloat(unsigned long); -unsigned long Gfloat_reg_cvt(unsigned long); -#endif - -int unaligned_fixup(unsigned long, unsigned long, - unsigned long, struct thread *); -int handle_opdec(struct thread *td, u_int64_t *ucodep); - -static void printtrap(const unsigned long, const unsigned long, - const unsigned long, const unsigned long, struct trapframe *, int, int); - -#ifdef WITNESS -extern char *syscallnames[]; -#endif - -static const char *arith_exceptions[] = { - "software completion", - "invalid operation", - "division by zero", - "overflow", - "underflow", - "inexact result", - "integer overflow", -}; - -static const char *instruction_faults[] = { - "bpt", - "bugchk", - "gentrap", - "FEN", - "opDec" -}; - -static const char *interrupt_types[] = { - "interprocessor", - "clock", - "correctable error", - "machine check", - "I/O device", - "performance counter" -}; - -static const char *mmfault_types[] = { - "translation not valid", - "access violation", - "fault on read", - "fault on execute", - "fault on write" -}; - -static const char *mmfault_causes[] = { - "instruction fetch", - "load instructon", - "store instruction" -}; - -static void -printtrap(a0, a1, a2, entry, framep, isfatal, user) - const unsigned long a0, a1, a2, entry; - struct trapframe *framep; - int isfatal, user; -{ - char ubuf[64]; - const char *entryname; - unsigned long i; - - switch (entry) { - case ALPHA_KENTRY_INT: - entryname = "interrupt"; - break; - case ALPHA_KENTRY_ARITH: - entryname = "arithmetic trap"; - break; - case ALPHA_KENTRY_MM: - entryname = "memory management fault"; - break; - case ALPHA_KENTRY_IF: - entryname = "instruction fault"; - break; - case ALPHA_KENTRY_UNA: - entryname = "unaligned access fault"; - break; - case ALPHA_KENTRY_SYS: - entryname = "system call"; - break; - default: - snprintf(ubuf, sizeof(ubuf), "type %lx", entry); - entryname = (const char *) ubuf; - break; - } - - printf("\n"); - printf("%s %s trap:\n", isfatal? "fatal" : "handled", - user ? "user" : "kernel"); - printf("\n"); - printf(" trap entry = 0x%lx (%s)\n", entry, entryname); -#ifdef SMP - printf(" cpuid = %d\n", PCPU_GET(cpuid)); -#endif - switch (entry) { - case ALPHA_KENTRY_INT: - printf(" interrupt type = "); - if (a0 < 5) { - printf("%s\n", interrupt_types[a0]); - if (a0 > 1) { - printf(" vector = 0x%lx\n", a1); - if (a0 < 3) - printf(" logout area = 0x%lx\n", - a2); - } - } else - printf("0x%lx (unknown)\n", a0); - break; - case ALPHA_KENTRY_ARITH: - printf(" exception type = "); - for (i = 0; i < 7; i++) - if (a0 & (1 << i)) { - printf("%s", arith_exceptions[i]); - if (a0 & (~0 - (1 << i))) - printf(", "); - } - printf("\n"); - printf(" register mask = 0x%lx", a1); - break; - case ALPHA_KENTRY_MM: - printf(" faulting va = 0x%lx\n", a0); - printf(" type = "); - if (a1 < 5) - printf("%s\n", mmfault_types[a1]); - else - printf("0x%lx (unknown)\n", a1); - printf(" cause = "); - i = a2 + 1; - if (i < 3) - printf("%s\n", mmfault_causes[i]); - else - printf("0x%lx (unknown)\n", a2); - break; - case ALPHA_KENTRY_IF: - printf(" fault type = "); - if (a0 < 5) - printf("%s\n", instruction_faults[a0]); - else - printf("0x%lx (unknown)\n", a0); - break; - case ALPHA_KENTRY_UNA: - printf(" faulting va = 0x%lx\n", a0); - printf(" opcode = 0x%lx\n", a1); - printf(" register = 0x%lx\n", a2); - break; - default: - printf(" a0 = 0x%lx\n", a0); - printf(" a1 = 0x%lx\n", a1); - printf(" a2 = 0x%lx\n", a2); - break; - } - printf(" pc = 0x%lx\n", framep->tf_regs[FRAME_PC]); - printf(" ra = 0x%lx\n", framep->tf_regs[FRAME_RA]); - printf(" sp = 0x%lx\n", framep->tf_regs[FRAME_SP]); - if (curthread != NULL && (curthread->td_proc->p_flag & P_KTHREAD) == 0) - printf(" usp = 0x%lx\n", alpha_pal_rdusp()); - printf(" curthread = %p\n", curthread); - if (curthread != NULL) - printf(" pid = %d, comm = %s\n", - curthread->td_proc->p_pid, curthread->td_proc->p_comm); - printf("\n"); -} - -/* - * Trap is called from locore to handle most types of processor traps. - * System calls are broken out for efficiency and ASTs are broken out - * to make the code a bit cleaner and more representative of the - * Alpha architecture. - */ -/*ARGSUSED*/ -void -trap(a0, a1, a2, entry, framep) - const unsigned long a0, a1, a2, entry; - struct trapframe *framep; -{ - register struct thread *td; - register struct proc *p; - register int i; - u_int64_t ucode; - int user; -#ifdef SMP - register_t s; -#endif - ksiginfo_t ksi; - - /* - * Find our per-cpu globals. - */ -#ifdef SMP - s = intr_disable(); -#endif - pcpup = (struct pcpu *) alpha_pal_rdval(); - td = curthread; -#ifdef SMP - if (td == NULL) { - printtrap(a0, a1, a2, entry, framep, 1, 0); - cpu_halt(); - } - td->td_md.md_kernnest++; - intr_restore(s); -#endif - p = td->td_proc; - -#ifdef KDB - if (kdb_active) { - kdb_reenter(); - return; - } -#endif - - /* - GIANT_REQUIRED; - * Giant hasn't been acquired yet. - */ - - PCPU_LAZY_INC(cnt.v_trap); - ucode = 0; - user = (framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0; - CTR5(KTR_TRAP, "%s trap: pid %d, (%lx, %lx, %lx)", - user ? "user" : "kernel", p->p_pid, a0, a1, a2); - if (user) { - td->td_pticks = 0; - td->td_frame = framep; - if (td->td_ucred != p->p_ucred) - cred_update_thread(td); - } else { - KASSERT(cold || td->td_ucred != NULL, - ("kernel trap doesn't have ucred")); - } - -#ifdef DIAGNOSTIC - if (user) - alpha_fpstate_check(td); -#endif - - switch (entry) { - case ALPHA_KENTRY_UNA: - /* - * If user-land, do whatever fixups, printing, and - * signalling is appropriate (based on system-wide - * and per-process unaligned-access-handling flags). - */ - if (user) { - mtx_lock(&Giant); - i = unaligned_fixup(a0, a1, a2, td); - mtx_unlock(&Giant); - if (i == 0) - goto out; - ucode = a0; /* VA */ - break; - } - - /* - * Unaligned access from kernel mode is always an error, - * EVEN IF A COPY FAULT HANDLER IS SET! - * - * It's an error if a copy fault handler is set because - * the various routines which do user-initiated copies - * do so in a bcopy-like manner. In other words, the - * kernel never assumes that pointers provided by the - * user are properly aligned, and so if the kernel - * does cause an unaligned access it's a kernel bug. - */ - goto dopanic; - - case ALPHA_KENTRY_ARITH: - /* - * If user-land, give a SIGFPE if software completion - * is not requested or if the completion fails. - */ - if (user) { - mtx_lock(&Giant); - if (a0 & EXCSUM_SWC) - if (fp_software_completion(a1, td)) { - mtx_unlock(&Giant); - goto out; - } - mtx_unlock(&Giant); - i = SIGFPE; - ucode = a0; /* exception summary */ - break; - } - - /* Always fatal in kernel. Should never happen. */ - goto dopanic; - - case ALPHA_KENTRY_IF: - /* - * These are always fatal in kernel, and should never happen. - */ - if (!user) { -#ifdef KDB - /* - * ...unless, of course, KDB is configured; BUGCHK - * is used to invoke the kernel debugger, and we - * might have set a breakpoint. - */ - if (a0 == ALPHA_IF_CODE_BUGCHK || - a0 == ALPHA_IF_CODE_BPT) { - if (kdb_trap(entry, a0, framep)) - goto out; - } - - /* - * If we get here, KDB did _not_ handle the - * trap, and we need to PANIC! - */ -#endif - goto dopanic; - } - i = 0; - switch (a0) { - case ALPHA_IF_CODE_GENTRAP: - if (framep->tf_regs[FRAME_A0] == -2) { /* weird! */ - i = SIGFPE; - ucode = a0; /* exception summary */ - break; - } - /* FALLTHROUGH */ - case ALPHA_IF_CODE_BPT: - case ALPHA_IF_CODE_BUGCHK: - if (td->td_md.md_flags & (MDTD_STEP1|MDTD_STEP2)) { - mtx_lock(&Giant); - PROC_LOCK(p); - _PHOLD(p); - ptrace_clear_single_step(td); - td->td_frame->tf_regs[FRAME_PC] -= 4; - _PRELE(p); - PROC_UNLOCK(p); - mtx_unlock(&Giant); - } - ucode = a0; /* trap type */ - i = SIGTRAP; - break; - - case ALPHA_IF_CODE_OPDEC: - i = handle_opdec(td, &ucode); - if (i == 0) - goto out; - break; - - case ALPHA_IF_CODE_FEN: - /* - * on exit from the kernel, if thread == fpcurthread, - * FP is enabled. - */ - if (PCPU_GET(fpcurthread) == td) { - printf("trap: fp disabled for fpcurthread == %p", - td); - goto dopanic; - } - - alpha_fpstate_switch(td); - goto out; - - default: - printf("trap: unknown IF type 0x%lx\n", a0); - goto dopanic; - } - break; - - case ALPHA_KENTRY_MM: - switch (a1) { - case ALPHA_MMCSR_FOR: - case ALPHA_MMCSR_FOE: - case ALPHA_MMCSR_FOW: - pmap_emulate_reference(p->p_vmspace, a0, user, - a1 == ALPHA_MMCSR_FOW); - goto out; - - case ALPHA_MMCSR_INVALTRANS: - case ALPHA_MMCSR_ACCESS: - { - register vm_offset_t va; - register struct vmspace *vm = NULL; - register vm_map_t map; - vm_prot_t ftype = 0; - int rv; - - /* - * If it was caused by fuswintr or suswintr, - * just punt. Note that we check the faulting - * address against the address accessed by - * [fs]uswintr, in case another fault happens - * when they are running. - */ - if (!user && - td != NULL && - td->td_pcb->pcb_onfault == - (unsigned long)fswintrberr && - td->td_pcb->pcb_accessaddr == a0) { - framep->tf_regs[FRAME_PC] = - td->td_pcb->pcb_onfault; - td->td_pcb->pcb_onfault = 0; - goto out; - } - - /* - * It is only a kernel address space fault iff: - * 1. !user and - * 2. pcb_onfault not set or - * 3. pcb_onfault set but kernel space data fault - * The last can occur during an exec() copyin where the - * argument space is lazy-allocated. - * - * For the purposes of the Linux emulator, we allow - * kernel accesses to a small region of the - * user stack which the emulator uses to - * translate syscall arguments. - */ - if (!user - && ((a0 >= VM_MIN_KERNEL_ADDRESS) - || (td == NULL) - || (td->td_pcb->pcb_onfault == 0))) { - if (a0 >= trunc_page(PS_STRINGS - - szsigcode - - SPARE_USRSPACE) - && a0 < round_page(PS_STRINGS - - szsigcode)) { - vm = p->p_vmspace; - map = &vm->vm_map; - } else { - map = kernel_map; - } - } else { - vm = p->p_vmspace; - map = &vm->vm_map; - } - - switch (a2) { - case -1: /* instruction fetch fault */ - case 0: /* load instruction */ - ftype = VM_PROT_READ; - break; - case 1: /* store instruction */ - ftype = VM_PROT_WRITE; - break; -#ifdef DIAGNOSTIC - default: /* XXX gcc -Wuninitialized */ - goto dopanic; -#endif - } - - va = trunc_page((vm_offset_t)a0); - - if (map != kernel_map) { - /* - * Keep swapout from messing with us - * during thiscritical time. - */ - PROC_LOCK(p); - ++p->p_lock; - PROC_UNLOCK(p); - - /* Fault in the user page: */ - rv = vm_fault(map, va, ftype, - (ftype & VM_PROT_WRITE) - ? VM_FAULT_DIRTY - : VM_FAULT_NORMAL); - - PROC_LOCK(p); - --p->p_lock; - PROC_UNLOCK(p); - } else { - /* - * Don't have to worry about process - * locking or stacks in the kernel. - */ - rv = vm_fault(map, va, ftype, VM_FAULT_NORMAL); - } - if (rv == KERN_SUCCESS) - goto out; - - if (!user) { - /* Check for copyin/copyout fault */ - if (td != NULL && - td->td_pcb->pcb_onfault != 0) { - framep->tf_regs[FRAME_PC] = - td->td_pcb->pcb_onfault; - td->td_pcb->pcb_onfault = 0; - goto out; - } - goto dopanic; - } - ucode = a0; - i = SIGSEGV; -#ifdef DEBUG - printtrap(a0, a1, a2, entry, framep, 1, user); -#endif - break; - } - - default: - printf("trap: unknown MMCSR value 0x%lx\n", a1); - goto dopanic; - } - break; - - default: - goto dopanic; - } - -#ifdef DEBUG - printtrap(a0, a1, a2, entry, framep, 1, user); -#endif - framep->tf_regs[FRAME_TRAPARG_A0] = a0; - framep->tf_regs[FRAME_TRAPARG_A1] = a1; - framep->tf_regs[FRAME_TRAPARG_A2] = a2; - ksiginfo_init_trap(&ksi); - ksi.ksi_signo = i; - ksi.ksi_code = ucode; /* XXX, Should be POSIX si_code */ - ksi.ksi_addr = (void *)a0; - trapsignal(td, &ksi); - -out: - if (user) { - framep->tf_regs[FRAME_SP] = alpha_pal_rdusp(); - userret(td, framep); - mtx_assert(&Giant, MA_NOTOWNED); - } - return; - -dopanic: - printtrap(a0, a1, a2, entry, framep, 1, user); - /* XXX dump registers */ -#ifdef KDB - kdb_trap(entry, a0, framep); -#endif - panic("trap"); -} - -/* - * Process a system call. - * - * System calls are strange beasts. They are passed the syscall number - * in v0, and the arguments in the registers (as normal). They return - * an error flag in a3 (if a3 != 0 on return, the syscall had an error), - * and the return value (if any) in v0. - * - * The assembly stub takes care of moving the call number into a register - * we can get to, and moves all of the argument registers into their places - * in the trap frame. On return, it restores the callee-saved registers, - * a3, and v0 from the frame before returning to the user process. - */ -void -syscall(code, framep) - u_int64_t code; - struct trapframe *framep; -{ - struct sysent *callp; - struct thread *td; - struct proc *p; - int error = 0; - u_int64_t opc; - u_int64_t args[10]; /* XXX */ - u_int hidden = 0, nargs; -#ifdef SMP - register_t s; -#endif - - /* - * Find our per-cpu globals. - */ -#ifdef SMP - s = intr_disable(); -#endif - pcpup = (struct pcpu *) alpha_pal_rdval(); - td = curthread; -#ifdef SMP - td->td_md.md_kernnest++; - intr_restore(s); -#endif - p = td->td_proc; - - framep->tf_regs[FRAME_TRAPARG_A0] = 0; - framep->tf_regs[FRAME_TRAPARG_A1] = 0; - framep->tf_regs[FRAME_TRAPARG_A2] = 0; -#ifdef notdef /* can't happen, ever. */ - if ((framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) == 0) - panic("syscall"); -#endif - - PCPU_LAZY_INC(cnt.v_syscall); - td->td_frame = framep; - opc = framep->tf_regs[FRAME_PC] - 4; - td->td_pticks = 0; - if (td->td_ucred != p->p_ucred) - cred_update_thread(td); - if (p->p_flag & P_SA) - thread_user_enter(td); -#ifdef DIAGNOSTIC - alpha_fpstate_check(td); -#endif - - if (p->p_sysent->sv_prepsyscall) { - /* (*p->p_sysent->sv_prepsyscall)(framep, args, &code, ¶ms); */ - panic("prepsyscall"); - } else { - /* - * syscall() and __syscall() are handled the same on - * the alpha, as everything is 64-bit aligned, anyway. - */ - if (code == SYS_syscall || code == SYS___syscall) { - /* - * Code is first argument, followed by actual args. - */ - code = framep->tf_regs[FRAME_A0]; - hidden = 1; - } - } - - if (p->p_sysent->sv_mask) - code &= p->p_sysent->sv_mask; - - if (code >= p->p_sysent->sv_size) - callp = &p->p_sysent->sv_table[0]; - else - callp = &p->p_sysent->sv_table[code]; - - nargs = (callp->sy_narg & SYF_ARGMASK) + hidden; - switch (nargs) { - default: - if (nargs > 10) /* XXX */ - panic("syscall: too many args (%d)", nargs); - error = copyin((caddr_t)(alpha_pal_rdusp()), &args[6], - (nargs - 6) * sizeof(u_int64_t)); - case 6: - args[5] = framep->tf_regs[FRAME_A5]; - case 5: - args[4] = framep->tf_regs[FRAME_A4]; - case 4: - args[3] = framep->tf_regs[FRAME_A3]; - case 3: - args[2] = framep->tf_regs[FRAME_A2]; - case 2: - args[1] = framep->tf_regs[FRAME_A1]; - case 1: - args[0] = framep->tf_regs[FRAME_A0]; - case 0: - break; - } - -#ifdef KTRACE - if (KTRPOINT(td, KTR_SYSCALL)) - ktrsyscall(code, (callp->sy_narg & SYF_ARGMASK), args + hidden); -#endif - /* - * Try to run the syscall without the MP lock if the syscall - * is MP safe - */ - if ((callp->sy_narg & SYF_MPSAFE) == 0) - mtx_lock(&Giant); - - if (error == 0) { - td->td_retval[0] = 0; - td->td_retval[1] = 0; - - STOPEVENT(p, S_SCE, (callp->sy_narg & SYF_ARGMASK)); - - PTRACESTOP_SC(p, td, S_PT_SCE); - - error = (*callp->sy_call)(td, args + hidden); - } - - - switch (error) { - case 0: - framep->tf_regs[FRAME_V0] = td->td_retval[0]; - framep->tf_regs[FRAME_A4] = td->td_retval[1]; - framep->tf_regs[FRAME_A3] = 0; - break; - case ERESTART: - framep->tf_regs[FRAME_PC] = opc; - break; - case EJUSTRETURN: - break; - default: - if (p->p_sysent->sv_errsize) { - if (error >= p->p_sysent->sv_errsize) - error = -1; /* XXX */ - else - error = p->p_sysent->sv_errtbl[error]; - } - framep->tf_regs[FRAME_V0] = error; - framep->tf_regs[FRAME_A3] = 1; - break; - } - - /* - * Release Giant if we had to get it. - */ - if ((callp->sy_narg & SYF_MPSAFE) == 0) - mtx_unlock(&Giant); - - userret(td, framep); - -#ifdef KTRACE - if (KTRPOINT(td, KTR_SYSRET)) - ktrsysret(code, error, td->td_retval[0]); -#endif - /* - * This works because errno is findable through the - * register set. If we ever support an emulation where this - * is not the case, this code will need to be revisited. - */ - STOPEVENT(p, S_SCX, code); - - PTRACESTOP_SC(p, td, S_PT_SCX); - - WITNESS_WARN(WARN_PANIC, NULL, "System call %s returning", - (code >= 0 && code < SYS_MAXSYSCALL) ? syscallnames[code] : "???"); - mtx_assert(&sched_lock, MA_NOTOWNED); - mtx_assert(&Giant, MA_NOTOWNED); -} - -/* - * Unaligned access handler. It's not clear that this can get much slower... - * - */ -const static int reg_to_framereg[32] = { - FRAME_V0, FRAME_T0, FRAME_T1, FRAME_T2, - FRAME_T3, FRAME_T4, FRAME_T5, FRAME_T6, - FRAME_T7, FRAME_S0, FRAME_S1, FRAME_S2, - FRAME_S3, FRAME_S4, FRAME_S5, FRAME_S6, - FRAME_A0, FRAME_A1, FRAME_A2, FRAME_A3, - FRAME_A4, FRAME_A5, FRAME_T8, FRAME_T9, - FRAME_T10, FRAME_T11, FRAME_RA, FRAME_T12, - FRAME_AT, FRAME_GP, FRAME_SP, -1, -}; - -#define irp(td, reg) \ - ((reg_to_framereg[(reg)] == -1) ? NULL : \ - &(td)->td_frame->tf_regs[reg_to_framereg[(reg)]]) - -#define frp(td, reg) \ - (&(td)->td_pcb->pcb_fp.fpr_regs[(reg)]) - -#define unaligned_load(storage, ptrf, mod) \ - if (copyin((caddr_t)va, &(storage), sizeof (storage)) == 0 && \ - (regptr = ptrf(td, reg)) != NULL) \ - signal = 0; \ - else \ - break; \ - *regptr = mod (storage); - -#define unaligned_store(storage, ptrf, mod) \ - if ((regptr = ptrf(td, reg)) == NULL) \ - (storage) = 0; \ - else \ - (storage) = mod (*regptr); \ - if (copyout(&(storage), (caddr_t)va, sizeof (storage)) == 0) \ - signal = 0; \ - else \ - break; - -#define unaligned_load_integer(storage) \ - unaligned_load(storage, irp, ) - -#define unaligned_store_integer(storage) \ - unaligned_store(storage, irp, ) - -#define unaligned_load_floating(storage, mod) \ - alpha_fpstate_save(td, 1); \ - unaligned_load(storage, frp, mod) - -#define unaligned_store_floating(storage, mod) \ - alpha_fpstate_save(td, 0); \ - unaligned_store(storage, frp, mod) - -unsigned long -Sfloat_to_reg(s) - unsigned int s; -{ - unsigned long sign, expn, frac; - unsigned long result; - - sign = (s & 0x80000000) >> 31; - expn = (s & 0x7f800000) >> 23; - frac = (s & 0x007fffff) >> 0; - - /* map exponent part, as appropriate. */ - if (expn == 0xff) - expn = 0x7ff; - else if ((expn & 0x80) != 0) - expn = (0x400 | (expn & ~0x80)); - else if ((expn & 0x80) == 0 && expn != 0) - expn = (0x380 | (expn & ~0x80)); - - result = (sign << 63) | (expn << 52) | (frac << 29); - return (result); -} - -unsigned int -reg_to_Sfloat(r) - unsigned long r; -{ - unsigned long sign, expn, frac; - unsigned int result; - - sign = (r & 0x8000000000000000) >> 63; - expn = (r & 0x7ff0000000000000) >> 52; - frac = (r & 0x000fffffe0000000) >> 29; - - /* map exponent part, as appropriate. */ - expn = (expn & 0x7f) | ((expn & 0x400) != 0 ? 0x80 : 0x00); - - result = (sign << 31) | (expn << 23) | (frac << 0); - return (result); -} - -/* - * Conversion of T floating datums to and from register format - * requires no bit reordering whatsoever. - */ -unsigned long -Tfloat_reg_cvt(input) - unsigned long input; -{ - - return (input); -} - -#ifdef FIX_UNALIGNED_VAX_FP -unsigned long -Ffloat_to_reg(f) - unsigned int f; -{ - unsigned long sign, expn, frlo, frhi; - unsigned long result; - - sign = (f & 0x00008000) >> 15; - expn = (f & 0x00007f80) >> 7; - frhi = (f & 0x0000007f) >> 0; - frlo = (f & 0xffff0000) >> 16; - - /* map exponent part, as appropriate. */ - if ((expn & 0x80) != 0) - expn = (0x400 | (expn & ~0x80)); - else if ((expn & 0x80) == 0 && expn != 0) - expn = (0x380 | (expn & ~0x80)); - - result = (sign << 63) | (expn << 52) | (frhi << 45) | (frlo << 29); - return (result); -} - -unsigned int -reg_to_Ffloat(r) - unsigned long r; -{ - unsigned long sign, expn, frhi, frlo; - unsigned int result; - - sign = (r & 0x8000000000000000) >> 63; - expn = (r & 0x7ff0000000000000) >> 52; - frhi = (r & 0x000fe00000000000) >> 45; - frlo = (r & 0x00001fffe0000000) >> 29; - - /* map exponent part, as appropriate. */ - expn = (expn & 0x7f) | ((expn & 0x400) != 0 ? 0x80 : 0x00); - - result = (sign << 15) | (expn << 7) | (frhi << 0) | (frlo << 16); - return (result); -} - -/* - * Conversion of G floating datums to and from register format is - * symmetrical. Just swap shorts in the quad... - */ -unsigned long -Gfloat_reg_cvt(input) - unsigned long input; -{ - unsigned long a, b, c, d; - unsigned long result; - - a = (input & 0x000000000000ffff) >> 0; - b = (input & 0x00000000ffff0000) >> 16; - c = (input & 0x0000ffff00000000) >> 32; - d = (input & 0xffff000000000000) >> 48; - - result = (a << 48) | (b << 32) | (c << 16) | (d << 0); - return (result); -} -#endif /* FIX_UNALIGNED_VAX_FP */ - -extern int alpha_unaligned_print, alpha_unaligned_fix; -extern int alpha_unaligned_sigbus; - -struct unaligned_fixup_data { - const char *type; /* opcode name */ - int size; /* size, 0 if fixup not supported */ -}; - -int -unaligned_fixup(va, opcode, reg, td) - unsigned long va, opcode, reg; - struct thread *td; -{ - int doprint, dofix, dosigbus; - int signal, size; - const char *type; - struct proc *p; - unsigned long *regptr, longdata, uac; - int intdata; /* signed to get extension when storing */ - u_int16_t worddata; /* unsigned to _avoid_ extension */ - const struct unaligned_fixup_data tab_0c[0x2] = { - { "ldwu", 2 }, { "stw", 2 }, - }; - const struct unaligned_fixup_data tab_20[0x10] = { -#ifdef FIX_UNALIGNED_VAX_FP - { "ldf", 4 }, { "ldg", 8 }, -#else - { "ldf", 0 }, { "ldg", 0 }, -#endif - { "lds", 4 }, { "ldt", 8 }, -#ifdef FIX_UNALIGNED_VAX_FP - { "stf", 4 }, { "stg", 8 }, -#else - { "stf", 0 }, { "stg", 0 }, -#endif - { "sts", 4 }, { "stt", 8 }, - { "ldl", 4 }, { "ldq", 8 }, - { "ldl_l", 0 }, { "ldq_l", 0 }, /* can't fix */ - { "stl", 4 }, { "stq", 8 }, - { "stl_c", 0 }, { "stq_c", 0 }, /* can't fix */ - }; - - /* - * Figure out what actions to take. - * - */ - - if (td) { - p = td->td_proc; - uac = p->p_md.md_uac; - } else { - uac = 0; - p = NULL; - } - - doprint = alpha_unaligned_print && !(uac & MDP_UAC_NOPRINT); - dofix = alpha_unaligned_fix && !(uac & MDP_UAC_NOFIX); - dosigbus = alpha_unaligned_sigbus | (uac & MDP_UAC_SIGBUS); - - /* - * Find out which opcode it is. Arrange to have the opcode - * printed if it's an unknown opcode. - */ - if (opcode >= 0x0c && opcode <= 0x0d) { - type = tab_0c[opcode - 0x0c].type; - size = tab_0c[opcode - 0x0c].size; - } else if (opcode >= 0x20 && opcode <= 0x2f) { - type = tab_20[opcode - 0x20].type; - size = tab_20[opcode - 0x20].size; - } else { - type = "0x%lx"; - size = 0; - } - - /* - * See if the user can access the memory in question. - * Even if it's an unknown opcode, SEGV if the access - * should have failed. - */ - if (!useracc((caddr_t)va, size ? size : 1, VM_PROT_WRITE)) { - signal = SIGSEGV; - goto out; - } - - /* - * If we're supposed to be noisy, squawk now. - */ - if (doprint) { - uprintf( - "pid %d (%s): unaligned access: va=0x%lx pc=0x%lx ra=0x%lx op=", - p->p_pid, p->p_comm, va, td->td_frame->tf_regs[FRAME_PC], - td->td_frame->tf_regs[FRAME_RA]); - uprintf(type,opcode); - uprintf("\n"); - } - - /* - * If we should try to fix it and know how, give it a shot. - * - * We never allow bad data to be unknowingly used by the - * user process. That is, if we decide not to fix up an - * access we cause a SIGBUS rather than letting the user - * process go on without warning. - * - * If we're trying to do a fixup, we assume that things - * will be botched. If everything works out OK, - * unaligned_{load,store}_* clears the signal flag. - */ - signal = SIGBUS; - if (dofix && size != 0) { - switch (opcode) { - case 0x0c: /* ldwu */ - /* XXX ONLY WORKS ON LITTLE-ENDIAN ALPHA */ - unaligned_load_integer(worddata); - break; - - case 0x0d: /* stw */ - /* XXX ONLY WORKS ON LITTLE-ENDIAN ALPHA */ - unaligned_store_integer(worddata); - break; -#ifdef FIX_UNALIGNED_VAX_FP - case 0x20: /* ldf */ - unaligned_load_floating(intdata, Ffloat_to_reg); - break; - - case 0x21: /* ldg */ - unaligned_load_floating(longdata, Gfloat_reg_cvt); - break; -#endif - - case 0x22: /* lds */ - unaligned_load_floating(intdata, Sfloat_to_reg); - break; - - case 0x23: /* ldt */ - unaligned_load_floating(longdata, Tfloat_reg_cvt); - break; - -#ifdef FIX_UNALIGNED_VAX_FP - case 0x24: /* stf */ - unaligned_store_floating(intdata, reg_to_Ffloat); - break; - - case 0x25: /* stg */ - unaligned_store_floating(longdata, Gfloat_reg_cvt); - break; -#endif - - case 0x26: /* sts */ - unaligned_store_floating(intdata, reg_to_Sfloat); - break; - - case 0x27: /* stt */ - unaligned_store_floating(longdata, Tfloat_reg_cvt); - break; - - case 0x28: /* ldl */ - unaligned_load_integer(intdata); - break; - - case 0x29: /* ldq */ - unaligned_load_integer(longdata); - break; - - case 0x2c: /* stl */ - unaligned_store_integer(intdata); - break; - - case 0x2d: /* stq */ - unaligned_store_integer(longdata); - break; - -#ifdef DIAGNOSTIC - default: - panic("unaligned_fixup: can't get here"); -#endif - } - } - - /* - * Force SIGBUS if requested. - */ - if (dosigbus) - signal = SIGBUS; - -out: - return (signal); -} - - -/* - * Reserved/unimplemented instruction (opDec fault) handler - * - * Argument is the process that caused it. No useful information - * is passed to the trap handler other than the fault type. The - * address of the instruction that caused the fault is 4 less than - * the PC stored in the trap frame. - * - * If the instruction is emulated successfully, this function returns 0. - * Otherwise, this function returns the signal to deliver to the process, - * and fills in *ucodep with the code to be delivered. - */ -int -handle_opdec(td, ucodep) - struct thread *td; - u_int64_t *ucodep; -{ - alpha_instruction inst; - register_t *regptr, memaddr; - u_int64_t inst_pc; - int sig; - - /* - * Read USP into frame in case it's going to be used or modified. - * This keeps us from having to check for it in lots of places - * later. - */ - td->td_frame->tf_regs[FRAME_SP] = alpha_pal_rdusp(); - - inst_pc = memaddr = td->td_frame->tf_regs[FRAME_PC] - 4; - if (copyin((caddr_t)inst_pc, &inst, sizeof (inst)) != 0) { - /* - * really, this should never happen, but in case it - * does we handle it. - */ - printf("WARNING: handle_opdec() couldn't fetch instruction\n"); - goto sigsegv; - } - - switch (inst.generic_format.opcode) { - case op_ldbu: - case op_ldwu: - case op_stw: - case op_stb: - regptr = irp(td, inst.mem_format.rs); - if (regptr != NULL) - memaddr = *regptr; - else - memaddr = 0; - memaddr += inst.mem_format.displacement; - - regptr = irp(td, inst.mem_format.rd); - - if (inst.mem_format.opcode == op_ldwu || - inst.mem_format.opcode == op_stw) { - if (memaddr & 0x01) { - sig = unaligned_fixup(memaddr, - inst.mem_format.opcode, - inst.mem_format.rd, td); - if (sig) - goto unaligned_fixup_sig; - break; - } - } - - if (inst.mem_format.opcode == op_ldbu) { - u_int8_t b; - - /* XXX ONLY WORKS ON LITTLE-ENDIAN ALPHA */ - if (copyin((caddr_t)memaddr, &b, sizeof (b)) != 0) - goto sigsegv; - if (regptr != NULL) - *regptr = b; - } else if (inst.mem_format.opcode == op_ldwu) { - u_int16_t w; - - /* XXX ONLY WORKS ON LITTLE-ENDIAN ALPHA */ - if (copyin((caddr_t)memaddr, &w, sizeof (w)) != 0) - goto sigsegv; - if (regptr != NULL) - *regptr = w; - } else if (inst.mem_format.opcode == op_stw) { - u_int16_t w; - - /* XXX ONLY WORKS ON LITTLE-ENDIAN ALPHA */ - w = (regptr != NULL) ? *regptr : 0; - if (copyout(&w, (caddr_t)memaddr, sizeof (w)) != 0) - goto sigsegv; - } else if (inst.mem_format.opcode == op_stb) { - u_int8_t b; - - /* XXX ONLY WORKS ON LITTLE-ENDIAN ALPHA */ - b = (regptr != NULL) ? *regptr : 0; - if (copyout(&b, (caddr_t)memaddr, sizeof (b)) != 0) - goto sigsegv; - } - break; - - case op_intmisc: - if (inst.operate_generic_format.function == op_sextb && - inst.operate_generic_format.ra == 31) { - int8_t b; - - if (inst.operate_generic_format.is_lit) { - b = inst.operate_lit_format.literal; - } else { - if (inst.operate_reg_format.sbz != 0) - goto sigill; - regptr = irp(td, inst.operate_reg_format.rt); - b = (regptr != NULL) ? *regptr : 0; - } - - regptr = irp(td, inst.operate_generic_format.rc); - if (regptr != NULL) - *regptr = b; - break; - } - if (inst.operate_generic_format.function == op_sextw && - inst.operate_generic_format.ra == 31) { - int16_t w; - - if (inst.operate_generic_format.is_lit) { - w = inst.operate_lit_format.literal; - } else { - if (inst.operate_reg_format.sbz != 0) - goto sigill; - regptr = irp(td, inst.operate_reg_format.rt); - w = (regptr != NULL) ? *regptr : 0; - } - - regptr = irp(td, inst.operate_generic_format.rc); - if (regptr != NULL) - *regptr = w; - break; - } - goto sigill; - - default: - goto sigill; - } - - /* - * Write back USP. Note that in the error cases below, - * nothing will have been successfully modified so we don't - * have to write it out. - */ - alpha_pal_wrusp(td->td_frame->tf_regs[FRAME_SP]); - - return (0); - -sigill: - *ucodep = ALPHA_IF_CODE_OPDEC; /* trap type */ - return (SIGILL); - -sigsegv: - sig = SIGSEGV; - td->td_frame->tf_regs[FRAME_PC] = inst_pc; /* re-run instr. */ -unaligned_fixup_sig: - *ucodep = memaddr; /* faulting address */ - return (sig); -} diff --git a/sys/alpha/alpha/uio_machdep.c b/sys/alpha/alpha/uio_machdep.c deleted file mode 100644 index a96c398..0000000 --- a/sys/alpha/alpha/uio_machdep.c +++ /dev/null @@ -1,121 +0,0 @@ -/*- - * Copyright (c) 2004 Alan L. Cox <alc@cs.rice.edu> - * Copyright (c) 1982, 1986, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * 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. - * 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. - * - * @(#)kern_subr.c 8.3 (Berkeley) 1/21/94 - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/uio.h> - -#include <vm/vm.h> -#include <vm/vm_page.h> - -#include <machine/vmparam.h> - -/* - * Implement uiomove(9) from physical memory using the direct map to - * avoid the creation and destruction of ephemeral mappings. - */ -int -uiomove_fromphys(vm_page_t ma[], vm_offset_t offset, int n, struct uio *uio) -{ - struct thread *td = curthread; - struct iovec *iov; - void *cp; - vm_offset_t page_offset; - size_t cnt; - int error = 0; - int save = 0; - - KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, - ("uiomove_fromphys: mode")); - KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread, - ("uiomove_fromphys proc")); - save = td->td_pflags & TDP_DEADLKTREAT; - td->td_pflags |= TDP_DEADLKTREAT; - while (n > 0 && uio->uio_resid) { - iov = uio->uio_iov; - cnt = iov->iov_len; - if (cnt == 0) { - uio->uio_iov++; - uio->uio_iovcnt--; - continue; - } - if (cnt > n) - cnt = n; - page_offset = offset & PAGE_MASK; - cnt = min(cnt, PAGE_SIZE - page_offset); - cp = (char *) - ALPHA_PHYS_TO_K0SEG(ma[offset >> PAGE_SHIFT]->phys_addr) + - page_offset; - switch (uio->uio_segflg) { - case UIO_USERSPACE: - if (ticks - PCPU_GET(switchticks) >= hogticks) - uio_yield(); - if (uio->uio_rw == UIO_READ) - error = copyout(cp, iov->iov_base, cnt); - else - error = copyin(iov->iov_base, cp, cnt); - if (error) - goto out; - break; - case UIO_SYSSPACE: - if (uio->uio_rw == UIO_READ) - bcopy(cp, iov->iov_base, cnt); - else - bcopy(iov->iov_base, cp, cnt); - break; - case UIO_NOCOPY: - break; - } - iov->iov_base = (char *)iov->iov_base + cnt; - iov->iov_len -= cnt; - uio->uio_resid -= cnt; - uio->uio_offset += cnt; - offset += cnt; - n -= cnt; - } -out: - if (save == 0) - td->td_pflags &= ~TDP_DEADLKTREAT; - return (error); -} diff --git a/sys/alpha/alpha/uma_machdep.c b/sys/alpha/alpha/uma_machdep.c deleted file mode 100644 index 1847022..0000000 --- a/sys/alpha/alpha/uma_machdep.c +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * Copyright (c) 2004 Alan L. Cox <alc@cs.rice.edu> - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/systm.h> -#include <vm/vm.h> -#include <vm/vm_page.h> -#include <vm/vm_pageout.h> -#include <vm/uma.h> -#include <vm/uma_int.h> -#include <machine/md_var.h> -#include <machine/vmparam.h> - -void * -uma_small_alloc(uma_zone_t zone, int bytes, u_int8_t *flags, int wait) -{ - static vm_pindex_t color; - vm_page_t m; - void *va; - int pflags; - - *flags = UMA_SLAB_PRIV; - if ((wait & (M_NOWAIT | M_USE_RESERVE)) == M_NOWAIT) - pflags = VM_ALLOC_INTERRUPT; - else - pflags = VM_ALLOC_SYSTEM; - if (wait & M_ZERO) - pflags |= VM_ALLOC_ZERO; - for (;;) { - m = vm_page_alloc(NULL, color++, pflags | VM_ALLOC_NOOBJ); - if (m == NULL) { - if (wait & M_NOWAIT) - return (NULL); - else - VM_WAIT; - } else - break; - } - va = (void *)ALPHA_PHYS_TO_K0SEG(m->phys_addr); - if ((wait & M_ZERO) && (m->flags & PG_ZERO) == 0) - bzero(va, PAGE_SIZE); - return (va); -} - -void -uma_small_free(void *mem, int size, u_int8_t flags) -{ - vm_page_t m; - - m = PHYS_TO_VM_PAGE(ALPHA_K0SEG_TO_PHYS((vm_offset_t)mem)); - vm_page_lock_queues(); - vm_page_free(m); - vm_page_unlock_queues(); -} diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c deleted file mode 100644 index cfbdf2c..0000000 --- a/sys/alpha/alpha/vm_machdep.c +++ /dev/null @@ -1,432 +0,0 @@ -/*- - * Copyright (c) 1982, 1986 The Regents of the University of California. - * Copyright (c) 1989, 1990 William Jolitz - * Copyright (c) 1994 John Dyson - * 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, and William Jolitz. - * - * 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: @(#)vm_machdep.c 7.3 (Berkeley) 5/13/91 - * Utah $Hdr: vm_machdep.c 1.16.1.1 89/06/23$ - */ -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/proc.h> -#include <sys/malloc.h> -#include <sys/bio.h> -#include <sys/buf.h> -#include <sys/cons.h> -#include <sys/mutex.h> -#include <sys/vnode.h> -#include <sys/vmmeter.h> -#include <sys/kernel.h> -#include <sys/mbuf.h> -#include <sys/sf_buf.h> -#include <sys/sysctl.h> -#include <sys/unistd.h> - -#include <machine/clock.h> -#include <machine/cpu.h> -#include <machine/fpu.h> -#include <machine/md_var.h> -#include <machine/pcb.h> -#include <machine/prom.h> - -#include <vm/vm.h> -#include <vm/vm_param.h> -#include <sys/lock.h> -#include <vm/vm_kern.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> -#include <vm/vm_extern.h> - -/* - * Finish a fork operation, with process p2 nearly set up. - * Copy and update the pcb, set up the stack so that the child - * ready to run and return to user mode. - */ -void -cpu_fork(td1, p2, td2, flags) - register struct thread *td1; - register struct proc *p2; - register struct thread *td2; - int flags; -{ - struct proc *p1; - struct trapframe *p2tf; - - if ((flags & RFPROC) == 0) - return; - - p1 = td1->td_proc; - td2->td_pcb = (struct pcb *) - (td2->td_kstack + td2->td_kstack_pages * PAGE_SIZE) - 1; - td2->td_md.md_flags = td1->td_md.md_flags & MDTD_FPUSED; - PROC_LOCK(p2); - p2->p_md.md_uac = p1->p_md.md_uac; - PROC_UNLOCK(p2); - - /* - * Cache the physical address of the pcb, so we can - * swap to it easily. - */ - td2->td_md.md_pcbpaddr = (void*)vtophys((vm_offset_t)td2->td_pcb); - - /* - * Copy floating point state from the FP chip to the PCB - * if this process has state stored there. - */ - alpha_fpstate_save(td1, 0); - - /* - * Copy pcb and stack from proc p1 to p2. We do this as - * cheaply as possible, copying only the active part of the - * stack. The stack and pcb need to agree. Make sure that the - * new process has FEN disabled. - */ - bcopy(td1->td_pcb, td2->td_pcb, sizeof(struct pcb)); - td2->td_pcb->pcb_hw.apcb_usp = alpha_pal_rdusp(); - td2->td_pcb->pcb_hw.apcb_unique = 0; - td2->td_pcb->pcb_hw.apcb_flags &= ~ALPHA_PCB_FLAGS_FEN; - - /* - * Set the floating point state. - */ - if ((td2->td_pcb->pcb_fp_control & IEEE_INHERIT) == 0) { - td2->td_pcb->pcb_fp_control = 0; - td2->td_pcb->pcb_fp.fpr_cr = (FPCR_DYN_NORMAL - | FPCR_INVD | FPCR_DZED - | FPCR_OVFD | FPCR_INED - | FPCR_UNFD); - } - - /* - * Arrange for a non-local goto when the new process - * is started, to resume here, returning nonzero from setjmp. - */ -#ifdef DIAGNOSTIC - alpha_fpstate_check(td1); -#endif - - /* - * Create the child's kernel stack, from scratch. - * - * Pick a stack pointer, leaving room for a trapframe; - * copy trapframe from parent so return to user mode - * will be to right address, with correct registers. - */ - td2->td_frame = (struct trapframe *)td2->td_pcb - 1; - bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); - - /* - * Set up return-value registers as fork() libc stub expects. - */ - p2tf = td2->td_frame; - p2tf->tf_regs[FRAME_V0] = 0; /* child's pid (linux) */ - p2tf->tf_regs[FRAME_A3] = 0; /* no error */ - p2tf->tf_regs[FRAME_A4] = 1; /* is child (FreeBSD) */ - - /* - * Arrange for continuation at fork_return(), which - * will return to exception_return(). Note that the child - * process doesn't stay in the kernel for long! - */ - td2->td_pcb->pcb_hw.apcb_ksp = (u_int64_t)p2tf; - td2->td_pcb->pcb_context[0] = (u_int64_t)fork_return; /* s0: a0 */ - td2->td_pcb->pcb_context[1] = (u_int64_t)exception_return;/* s1: ra */ - td2->td_pcb->pcb_context[2] = (u_long)td2; /* s2: a1 */ - td2->td_pcb->pcb_context[7] = (u_int64_t)fork_trampoline; /* ra: magic*/ -#ifdef SMP - /* - * We start off at a nesting level of 1 within the kernel. - */ - td2->td_md.md_kernnest = 1; -#endif - - /* Setup to release sched_lock in fork_exit(). */ - td2->td_md.md_spinlock_count = 1; - td2->td_md.md_saved_ipl = ALPHA_PSL_IPL_0; -} - -/* - * Intercept the return address from a freshly forked process that has NOT - * been scheduled yet. - * - * This is needed to make kernel threads stay in kernel mode. - */ -void -cpu_set_fork_handler(td, func, arg) - struct thread *td; - void (*func)(void *); - void *arg; -{ - /* - * Note that the trap frame follows the args, so the function - * is really called like this: func(arg, frame); - */ - td->td_pcb->pcb_context[0] = (u_long) func; - td->td_pcb->pcb_context[2] = (u_long) arg; -} - -void -cpu_exit(struct thread *td) -{ - - /* - * XXX: Should this be in thread_exit instead? If so, - * alpha_fpstate_save() should be in cpu_set_upcall() - * as well. - */ - alpha_fpstate_drop(td); -} - -void -cpu_thread_exit(struct thread *td) -{ -} - -void -cpu_thread_clean(struct thread *td) -{ -} - -void -cpu_thread_setup(struct thread *td) -{ - - td->td_pcb = - (struct pcb *)(td->td_kstack + td->td_kstack_pages * PAGE_SIZE) - 1; - td->td_md.md_pcbpaddr = (void*)vtophys((vm_offset_t)td->td_pcb); - td->td_frame = (struct trapframe *)((caddr_t)td->td_pcb) - 1; -} - -void -cpu_thread_swapin(struct thread *td) -{ - /* - * The pcb may be at a different physical address now so cache the - * new address. - */ - td->td_md.md_pcbpaddr = (void *)vtophys((vm_offset_t)td->td_pcb); -} - -void -cpu_thread_swapout(struct thread *td) -{ - /* Make sure we aren't fpcurthread. */ - alpha_fpstate_save(td, 1); -} - -void -cpu_set_upcall(struct thread *td, struct thread *td0) -{ - struct pcb *pcb2; - - /* Point the pcb to the top of the stack. */ - pcb2 = td->td_pcb; - - /* - * Copy the upcall pcb. This loads kernel regs. - * Those not loaded individually below get their default - * values here. - * - * XXXKSE It might be a good idea to simply skip this as - * the values of the other registers may be unimportant. - * This would remove any requirement for knowing the KSE - * at this time (see the matching comment below for - * more analysis) (need a good safe default). - */ - bcopy(td0->td_pcb, pcb2, sizeof(*pcb2)); - - /* - * Create a new fresh stack for the new thread. - * Don't forget to set this stack value into whatever supplies - * the address for the fault handlers. - * The contexts are filled in at the time we actually DO the - * upcall as only then do we know which KSE we got. - */ - bcopy(td0->td_frame, td->td_frame, sizeof(struct trapframe)); - - /* - * Arrange for continuation at fork_return(), which - * will return to exception_return(). Note that the child - * process doesn't stay in the kernel for long! - */ - pcb2->pcb_hw.apcb_ksp = (u_int64_t)td->td_frame; - pcb2->pcb_context[0] = (u_int64_t)fork_return; /* s0: a0 */ - pcb2->pcb_context[1] = (u_int64_t)exception_return; /* s1: ra */ - pcb2->pcb_context[2] = (u_long)td; /* s2: a1 */ - pcb2->pcb_context[7] = (u_int64_t)fork_trampoline; /* ra: magic*/ -#ifdef SMP - /* - * We start off at a nesting level of 1 within the kernel. - */ - td->td_md.md_kernnest = 1; -#endif - - /* Setup to release sched_lock in fork_exit(). */ - td->td_md.md_spinlock_count = 1; - td->td_md.md_saved_ipl = ALPHA_PSL_IPL_0; -} - -void -cpu_set_upcall_kse(struct thread *td, void (*entry)(void *), void *arg, - stack_t *stack) -{ - struct pcb *pcb; - struct trapframe *tf; - uint64_t sp; - - pcb = td->td_pcb; - tf = td->td_frame; - sp = ((uint64_t)stack->ss_sp + stack->ss_size) & ~15; - - bzero(tf->tf_regs, FRAME_SIZE * sizeof(tf->tf_regs[0])); - bzero(&pcb->pcb_fp, sizeof(pcb->pcb_fp)); - pcb->pcb_fp_control = 0; - pcb->pcb_fp.fpr_cr = FPCR_DYN_NORMAL | FPCR_INVD | FPCR_DZED | - FPCR_OVFD | FPCR_INED | FPCR_UNFD; - if (td != curthread) { - pcb->pcb_hw.apcb_usp = sp; - pcb->pcb_hw.apcb_unique = 0; - } else { - alpha_pal_wrusp(sp); - alpha_pal_wrunique(0); - } - tf->tf_regs[FRAME_PS] = ALPHA_PSL_USERSET; - tf->tf_regs[FRAME_PC] = (u_long)entry; - tf->tf_regs[FRAME_A0] = (u_long)arg; - tf->tf_regs[FRAME_T12] = tf->tf_regs[FRAME_PC]; /* aka. PV */ - tf->tf_regs[FRAME_FLAGS] = 0; /* full restore */ -} - -int -cpu_set_user_tls(struct thread *td, void *tls_base) -{ - - if (td != curthread) - td->td_pcb->pcb_hw.apcb_unique = (unsigned long)tls_base; - else - alpha_pal_wrunique((uintptr_t)tls_base); - return (0); -} - -/* - * Reset back to firmware. - */ -void -cpu_reset() -{ - prom_halt(0); -} - -/* - * Allocate an sf_buf for the given vm_page. On this machine, however, there - * is no sf_buf object. Instead, an opaque pointer to the given vm_page is - * returned. - */ -struct sf_buf * -sf_buf_alloc(struct vm_page *m, int pri) -{ - - return ((struct sf_buf *)m); -} - -/* - * Free the sf_buf. In fact, do nothing because there are no resources - * associated with the sf_buf. - */ -void -sf_buf_free(struct sf_buf *sf) -{ -} - -/* - * Software interrupt handler for queued VM system processing. - */ -void -swi_vm(void *dummy) -{ - if (busdma_swi_pending != 0) - busdma_swi(); -} - -/* - * Tell whether this address is in some physical memory region. - * Currently used by the kernel coredump code in order to avoid - * dumping the ``ISA memory hole'' which could cause indefinite hangs, - * or other unpredictable behaviour. - */ - - -int -is_physical_memory(addr) - vm_offset_t addr; -{ - /* - * stuff other tests for known memory-mapped devices (PCI?) - * here - */ - - return 1; -} diff --git a/sys/alpha/compile/.cvsignore b/sys/alpha/compile/.cvsignore deleted file mode 100644 index 232298e..0000000 --- a/sys/alpha/compile/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -[A-Za-z0-9]* diff --git a/sys/alpha/conf/.cvsignore b/sys/alpha/conf/.cvsignore deleted file mode 100644 index 232298e..0000000 --- a/sys/alpha/conf/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -[A-Za-z0-9]* diff --git a/sys/alpha/conf/DEFAULTS b/sys/alpha/conf/DEFAULTS deleted file mode 100644 index 4a37c5f..0000000 --- a/sys/alpha/conf/DEFAULTS +++ /dev/null @@ -1,9 +0,0 @@ -# -# DEFAULTS -- Default kernel configuration file for FreeBSD/alpha -# -# $FreeBSD$ - -machine alpha - -# Pseudo devices. -device mem # Memory and kernel memory devices diff --git a/sys/alpha/conf/GENERIC b/sys/alpha/conf/GENERIC deleted file mode 100644 index 0e55ea8..0000000 --- a/sys/alpha/conf/GENERIC +++ /dev/null @@ -1,222 +0,0 @@ -# -# GENERIC -- Generic kernel configuration file for FreeBSD/alpha -# -# For more information on this file, please read the handbook section on -# Kernel Configuration Files: -# -# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig-config.html -# -# The handbook is also available locally in /usr/share/doc/handbook -# if you've installed the doc distribution, otherwise always see the -# FreeBSD World Wide Web server (http://www.FreeBSD.org/) for the -# latest information. -# -# An exhaustive list of options and more detailed explanations of the -# device lines is also present in the ../../conf/NOTES and NOTES files. -# If you are in doubt as to the purpose or necessity of a line, check first -# in NOTES. -# -# For hardware specific information check HARDWARE.TXT -# -# $FreeBSD$ - -cpu EV4 -cpu EV5 -ident GENERIC - -# To statically compile in device wiring instead of /boot/device.hints -#hints "GENERIC.hints" # Default places to look for devices. - -makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols - -# Platforms supported -options API_UP1000 # UP1000, UP1100 (Nautilus) -options DEC_EB164 # EB164, PC164, PC164LX, PC164SX -options DEC_EB64PLUS # EB64+, AlphaPC64, Aspen Alpine, etc -options DEC_2100_A50 # AlphaStation 200, 250, 255, 400 -options DEC_2100_A500 # AlphaServer 2000, 2100, 2100A -options DEC_KN20AA # AlphaStation 500, 600 -options DEC_ST550 # Personal Workstation 433, 500, 600 -options DEC_ST6600 # XP1000, DP264, DS20, DS10, family -options DEC_1000A # AlphaServer 1000, 1000A, 800 -options DEC_KN300 # AlphaServer 4100 (Rawhide), - # AlphaServer 1200 (Tincup) - -#options SCHED_ULE # ULE scheduler -options SCHED_4BSD # 4BSD scheduler -options PREEMPTION # Enable kernel thread preemption -options INET # InterNETworking -options INET6 # IPv6 communications protocols -options FFS # Berkeley Fast Filesystem -options SOFTUPDATES # Enable FFS soft updates support -options UFS_ACL # Support for access control lists -options UFS_DIRHASH # Improve performance on big directories -options MD_ROOT # MD is a potential root device -options NFSCLIENT # Network Filesystem Client -options NFSSERVER # Network Filesystem Server -options NFS_ROOT # NFS usable as /, requires NFSCLIENT -options MSDOSFS # MSDOS Filesystem -options CD9660 # ISO 9660 Filesystem -options PROCFS # Process filesystem (requires PSEUDOFS) -options PSEUDOFS # Pseudo-filesystem framework -options GEOM_GPT # GUID Partition Tables. -options COMPAT_43 # Compatible with BSD 4.3 [KEEP THIS!] -options COMPAT_43TTY # BSD 4.3 TTY compat [KEEP THIS!] -options COMPAT_FREEBSD4 # Compatible with FreeBSD4 -options COMPAT_FREEBSD5 # Compatible with FreeBSD5 -options SCSI_DELAY=5000 # Delay (in ms) before probing SCSI -options KTRACE # ktrace(1) support -options SYSVSHM # SYSV-style shared memory -options SYSVMSG # SYSV-style message queues -options SYSVSEM # SYSV-style semaphores -options _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions -options ADAPTIVE_GIANT # Giant mutex is adaptive. - -# Debugging for use in -current -options KDB # Enable kernel debugger support. -options DDB # Support DDB. -options GDB # Support remote GDB. -options INVARIANTS # Enable calls of extra sanity checking -options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -#options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed - -# To make an SMP kernel, the next line is needed -options SMP # Symmetric MultiProcessor Kernel - -# Alpha's do not appear to react well to probing high EISA slots -options EISA_SLOTS=2 - -# Standard busses -device isa -device eisa -device pci - -# Floppy drives -device fdc - -# ATA and ATAPI devices -device ata -device atadisk # ATA disk drives -device atapicd # ATAPI CDROM drives -device atapifd # ATAPI floppy drives -device atapist # ATAPI tape drives - -# SCSI Controllers -device ahc # AHA2940 and onboard AIC7xxx devices -options AHC_REG_PRETTY_PRINT # Print register bitfields in debug - # output. Adds ~128k to driver. -device isp # Qlogic family -device ispfw # Firmware module for Qlogic host adapters -device mpt # LSI-Logic MPT-Fusion -#device ncr # NCR/Symbios Logic -device sym # NCR/Symbios Logic (newer chipsets + those of `ncr') - -# SCSI peripherals -device scbus # SCSI bus (required for SCSI) -device ch # SCSI media changers -device da # Direct Access (disks) -device sa # Sequential Access (tape etc) -device cd # CD -device pass # Passthrough device (direct SCSI access) -device ses # SCSI Environmental Services (and SAF-TE) - -# RAID controllers interfaced to the SCSI subsystem -device amr # AMI MegaRAID - -# RAID controllers -device mlx # Mylex DAC960 family - -# atkbdc0 controls both the keyboard and the PS/2 mouse -device atkbdc # AT keyboard controller -device atkbd # AT keyboard -device psm # PS/2 mouse - -device vga # VGA video card driver -# TGA support is broken -# device tga # TGA video card driver - -device splash # Splash screen and screen saver support - -# syscons is the default console driver, resembling an SCO console -device sc - -device mcclock # MC146818 real time clock device - -# Serial (COM) ports -device sio # 8250, 16[45]50 based serial ports -device uart # Generic UART driver - -# Parallel port -device ppc -device ppbus # Parallel port bus (required) -device lpt # Printer -device ppi # Parallel port interface device -#device vpo # Requires scbus and da - -# If you've got a "dumb" serial or parallel PCI card that is -# supported by the puc(4) glue driver, uncomment the following -# line to enable it (connects to sio, uart and/or ppc drivers): -#device puc - -# PCI Ethernet NICs. -device de # DEC/Intel DC21x4x (``Tulip'') -device em # Intel PRO/1000 adapter Gigabit Ethernet Card -device txp # 3Com 3cR990 (``Typhoon'') -device vx # 3Com 3c590, 3c595 (``Vortex'') - -# PCI Ethernet NICs that use the common MII bus controller code. -# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! -device miibus # MII bus support -device dc # DEC/Intel 21143 and various workalikes -device fxp # Intel EtherExpress PRO/100B (82557, 82558) -device nge # NatSemi DP83820 gigabit ethernet -device pcn # AMD Am79C97x PCI 10/100 NICs -device rl # RealTek 8129/8139 -device sf # Adaptec AIC-6915 (``Starfire'') -device sis # Silicon Integrated Systems SiS 900/SiS 7016 -device ste # Sundance ST201 (D-Link DFE-550TX) -device tl # Texas Instruments ThunderLAN -device vr # VIA Rhine, Rhine II -device wb # Winbond W89C840F -device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') - -# Pseudo devices. -device loop # Network loopback -device random # Entropy device -device ether # Ethernet support -device sl # Kernel SLIP -device ppp # Kernel PPP -device tun # Packet tunnel. -device pty # Pseudo-ttys (telnet etc) -device md # Memory "disks" -device gif # IPv6 and IPv4 tunneling -device faith # IPv6-to-IPv4 relaying (translation) - -# The `bpf' device enables the Berkeley Packet Filter. -# Be aware of the administrative consequences of enabling this! -# Note that 'bpf' is required for DHCP. -device bpf # Berkeley packet filter - -# USB support -device uhci # UHCI PCI->USB interface -device ohci # OHCI PCI->USB interface -device usb # USB Bus (required) -device ugen # Generic -device uhid # "Human Interface Devices" -device ukbd # Keyboard -device ulpt # Printer -device umass # Disks/Mass storage - Requires scbus and da -device ums # Mouse -# USB Ethernet, requires miibus -device aue # ADMtek USB Ethernet -device axe # ASIX Electronics USB Ethernet -device cdce # Generic USB over Ethernet -device cue # CATC USB Ethernet -device kue # Kawasaki LSI USB Ethernet -device rue # RealTek RTL8150 USB Ethernet - -# FireWire support -device firewire # FireWire bus code -device sbp # SCSI over FireWire (Requires scbus and da) -device fwe # Ethernet over FireWire (non-standard!) diff --git a/sys/alpha/conf/GENERIC.hints b/sys/alpha/conf/GENERIC.hints deleted file mode 100644 index eb90d06..0000000 --- a/sys/alpha/conf/GENERIC.hints +++ /dev/null @@ -1,41 +0,0 @@ -# $FreeBSD$ -hint.fdc.0.at="isa" -hint.fdc.0.port="0x3F0" -hint.fdc.0.irq="6" -hint.fdc.0.drq="2" -hint.fd.0.at="fdc0" -hint.fd.0.drive="0" -hint.fd.0.flags="4" -hint.ata.0.at="isa" -hint.ata.0.port="0x1F0" -hint.ata.0.irq="14" -hint.ata.1.at="isa" -hint.ata.1.port="0x170" -hint.ata.1.irq="15" -hint.atkbdc.0.at="isa" -hint.atkbdc.0.port="0x060" -hint.atkbd.0.at="atkbdc" -hint.atkbd.0.irq="1" -hint.psm.0.at="atkbdc" -hint.psm.0.irq="12" -hint.vga.0.at="isa" -hint.sc.0.at="isa" -hint.mcclock.0.at="isa" -hint.mcclock.0.port="0x70" -hint.sio.0.at="isa" -hint.sio.0.port="0x3F8" -hint.sio.0.irq="4" -hint.sio.0.flags="0x10" -hint.sio.1.at="isa" -hint.sio.1.port="0x2F8" -hint.sio.1.irq="3" -hint.sio.1.flags="0x80" -hint.ppc.0.at="isa" -hint.ppc.0.irq="7" -hint.uart.0.at="isa" -hint.uart.0.irq="4" -hint.uart.0.port="0x3F8" -hint.uart.1.at="isa" -hint.uart.1.flags="0x80" -hint.uart.1.irq="3" -hint.uart.1.port="0x2F8" diff --git a/sys/alpha/conf/MAC b/sys/alpha/conf/MAC deleted file mode 100644 index 43c4a1d..0000000 --- a/sys/alpha/conf/MAC +++ /dev/null @@ -1,28 +0,0 @@ -# MAC -- Generic kernel configuration file for FreeBSD/alpha MAC -# -# The Mandatory Access Control, or MAC, framework allows administrators to -# finely control system security by providing for a loadable security pol- -# icy architecture. -# -# For more information see: -# -# http://www.FreeBSD.org/doc/en_US.ISO8859-1/books/handbook/mac.html -# -# $FreeBSD$ - -include GENERIC -ident MAC - -options MAC - -#options MAC_BIBA # BIBA data integrity policy -#options MAC_BSDEXTENDED # File system firewall policy -#options MAC_IFOFF # Network interface silencing policy -#options MAC_LOMAC # Low-watermark data integrity policy -#options MAC_MLS # Multi-level confidentiality policy -#options MAC_NONE # NULL policy -#options MAC_PARTITION # Process partition policy -#options MAC_PORTACL # Network port access control policy -#options MAC_SEEOTHERUIDS # UID visibility policy -#options MAC_STUB # Stub policy -#options MAC_TEST # Testing policy for the MAC framework diff --git a/sys/alpha/conf/Makefile b/sys/alpha/conf/Makefile deleted file mode 100644 index 2c006e9..0000000 --- a/sys/alpha/conf/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -# $FreeBSD$ - -.include "${.CURDIR}/../../conf/makeLINT.mk" diff --git a/sys/alpha/conf/NOTES b/sys/alpha/conf/NOTES deleted file mode 100644 index 47233e0..0000000 --- a/sys/alpha/conf/NOTES +++ /dev/null @@ -1,64 +0,0 @@ -# $FreeBSD$ -# -# This file contains machine dependent kernel configuration notes. For -# machine independent notes, look in /sys/conf/NOTES. - - -##################################################################### -# CPU OPTIONS - -# -# You must specify at least one CPU (the one you intend to run on); -# deleting the specification for CPUs you don't need to use may make -# parts of the system run faster. -# XXX: On the Alpha, CPU types are never used. This list also does -# not include newer CPU types that are supported such as the EV6. -cpu EV4 -cpu EV5 - - -##################################################################### -# PLATFORM OPTIONS - -options API_UP1000 # UP1000, UP1100 (Nautilus) -options DEC_EB164 # EB164, PC164, PC164LX, PC164SX -options DEC_EB64PLUS # EB64+, AlphaPC64, Aspen Alpine, etc -options DEC_2100_A50 # AlphaStation 200, 250, 255, 400 -options DEC_2100_A500 # AlphaServer 2000, 2100, 2100A -options DEC_KN20AA # AlphaStation 500, 600 -options DEC_ST550 # Personal Workstation 433, 500, 600 -options DEC_ST6600 # XP1000, DP264, DS20, DS10, family -options DEC_1000A # AlphaServer 1000, 1000A, 800 -options DEC_KN300 # AlphaServer 4100 (Rawhide), - # AlphaServer 1200 (Tincup) - - -##################################################################### -# HARDWARE BUS CONFIGURATION - -device isa -device eisa -device pci - - -##################################################################### -# HARDWARE DEVICE CONFIGURATION - -# -# Mandatory devices: -# - -device mcclock # MC146818 real time clock device - -# -# Optional devices: -# - -device tga # TGA video card driver - - -##################################################################### -# ABI Emulation - -# Enable OSF/1 ABI emulation -options COMPAT_OSF1 diff --git a/sys/alpha/include/_bus.h b/sys/alpha/include/_bus.h deleted file mode 100644 index 261120e..0000000 --- a/sys/alpha/include/_bus.h +++ /dev/null @@ -1,42 +0,0 @@ -/*- - * Copyright (c) 2005 M. Warner Losh. - * 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, - * without modification, immediately at the beginning of the file. - * 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. - * - * $FreeBSD$ - */ - -#ifndef ALPHA_INCLUDE__BUS_H -#define ALPHA_INCLUDE__BUS_H - -/* - * Bus address and size types - */ -typedef u_int64_t bus_addr_t; -typedef u_int64_t bus_size_t; -typedef struct alpha_busspace *bus_space_tag_t; -typedef u_int32_t bus_space_handle_t; - -#endif /* ALPHA_INCLUDE__BUS_H */ diff --git a/sys/alpha/include/_inttypes.h b/sys/alpha/include/_inttypes.h deleted file mode 100644 index e6b2536..0000000 --- a/sys/alpha/include/_inttypes.h +++ /dev/null @@ -1,220 +0,0 @@ -/*- - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * 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. - * - * From: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $ - * $FreeBSD$ - */ - -#ifndef _MACHINE_INTTYPES_H_ -#define _MACHINE_INTTYPES_H_ - -/* - * Macros for format specifiers. - */ - -/* fprintf(3) macros for signed integers. */ - -#define PRId8 "d" /* int8_t */ -#define PRId16 "d" /* int16_t */ -#define PRId32 "d" /* int32_t */ -#define PRId64 "ld" /* int64_t */ -#define PRIdLEAST8 "d" /* int_least8_t */ -#define PRIdLEAST16 "d" /* int_least16_t */ -#define PRIdLEAST32 "d" /* int_least32_t */ -#define PRIdLEAST64 "ld" /* int_least64_t */ -#define PRIdFAST8 "d" /* int_fast8_t */ -#define PRIdFAST16 "d" /* int_fast16_t */ -#define PRIdFAST32 "d" /* int_fast32_t */ -#define PRIdFAST64 "ld" /* int_fast64_t */ -#define PRIdMAX "jd" /* intmax_t */ -#define PRIdPTR "ld" /* intptr_t */ - -#define PRIi8 "i" /* int8_t */ -#define PRIi16 "i" /* int16_t */ -#define PRIi32 "i" /* int32_t */ -#define PRIi64 "li" /* int64_t */ -#define PRIiLEAST8 "i" /* int_least8_t */ -#define PRIiLEAST16 "i" /* int_least16_t */ -#define PRIiLEAST32 "i" /* int_least32_t */ -#define PRIiLEAST64 "li" /* int_least64_t */ -#define PRIiFAST8 "i" /* int_fast8_t */ -#define PRIiFAST16 "i" /* int_fast16_t */ -#define PRIiFAST32 "i" /* int_fast32_t */ -#define PRIiFAST64 "li" /* int_fast64_t */ -#define PRIiMAX "ji" /* intmax_t */ -#define PRIiPTR "li" /* intptr_t */ - -/* fprintf(3) macros for unsigned integers. */ - -#define PRIo8 "o" /* uint8_t */ -#define PRIo16 "o" /* uint16_t */ -#define PRIo32 "o" /* uint32_t */ -#define PRIo64 "lo" /* uint64_t */ -#define PRIoLEAST8 "o" /* uint_least8_t */ -#define PRIoLEAST16 "o" /* uint_least16_t */ -#define PRIoLEAST32 "o" /* uint_least32_t */ -#define PRIoLEAST64 "lo" /* uint_least64_t */ -#define PRIoFAST8 "o" /* uint_fast8_t */ -#define PRIoFAST16 "o" /* uint_fast16_t */ -#define PRIoFAST32 "o" /* uint_fast32_t */ -#define PRIoFAST64 "lo" /* uint_fast64_t */ -#define PRIoMAX "jo" /* uintmax_t */ -#define PRIoPTR "lo" /* uintptr_t */ - -#define PRIu8 "u" /* uint8_t */ -#define PRIu16 "u" /* uint16_t */ -#define PRIu32 "u" /* uint32_t */ -#define PRIu64 "lu" /* uint64_t */ -#define PRIuLEAST8 "u" /* uint_least8_t */ -#define PRIuLEAST16 "u" /* uint_least16_t */ -#define PRIuLEAST32 "u" /* uint_least32_t */ -#define PRIuLEAST64 "lu" /* uint_least64_t */ -#define PRIuFAST8 "u" /* uint_fast8_t */ -#define PRIuFAST16 "u" /* uint_fast16_t */ -#define PRIuFAST32 "u" /* uint_fast32_t */ -#define PRIuFAST64 "lu" /* uint_fast64_t */ -#define PRIuMAX "ju" /* uintmax_t */ -#define PRIuPTR "lu" /* uintptr_t */ - -#define PRIx8 "x" /* uint8_t */ -#define PRIx16 "x" /* uint16_t */ -#define PRIx32 "x" /* uint32_t */ -#define PRIx64 "lx" /* uint64_t */ -#define PRIxLEAST8 "x" /* uint_least8_t */ -#define PRIxLEAST16 "x" /* uint_least16_t */ -#define PRIxLEAST32 "x" /* uint_least32_t */ -#define PRIxLEAST64 "lx" /* uint_least64_t */ -#define PRIxFAST8 "x" /* uint_fast8_t */ -#define PRIxFAST16 "x" /* uint_fast16_t */ -#define PRIxFAST32 "x" /* uint_fast32_t */ -#define PRIxFAST64 "lx" /* uint_fast64_t */ -#define PRIxMAX "jx" /* uintmax_t */ -#define PRIxPTR "lx" /* uintptr_t */ - -#define PRIX8 "X" /* uint8_t */ -#define PRIX16 "X" /* uint16_t */ -#define PRIX32 "X" /* uint32_t */ -#define PRIX64 "lX" /* uint64_t */ -#define PRIXLEAST8 "X" /* uint_least8_t */ -#define PRIXLEAST16 "X" /* uint_least16_t */ -#define PRIXLEAST32 "X" /* uint_least32_t */ -#define PRIXLEAST64 "lX" /* uint_least64_t */ -#define PRIXFAST8 "X" /* uint_fast8_t */ -#define PRIXFAST16 "X" /* uint_fast16_t */ -#define PRIXFAST32 "X" /* uint_fast32_t */ -#define PRIXFAST64 "lX" /* uint_fast64_t */ -#define PRIXMAX "jX" /* uintmax_t */ -#define PRIXPTR "lX" /* uintptr_t */ - -/* fscanf(3) macros for signed integers. */ - -#define SCNd8 "hhd" /* int8_t */ -#define SCNd16 "hd" /* int16_t */ -#define SCNd32 "d" /* int32_t */ -#define SCNd64 "ld" /* int64_t */ -#define SCNdLEAST8 "hhd" /* int_least8_t */ -#define SCNdLEAST16 "hd" /* int_least16_t */ -#define SCNdLEAST32 "d" /* int_least32_t */ -#define SCNdLEAST64 "ld" /* int_least64_t */ -#define SCNdFAST8 "d" /* int_fast8_t */ -#define SCNdFAST16 "d" /* int_fast16_t */ -#define SCNdFAST32 "d" /* int_fast32_t */ -#define SCNdFAST64 "ld" /* int_fast64_t */ -#define SCNdMAX "jd" /* intmax_t */ -#define SCNdPTR "ld" /* intptr_t */ - -#define SCNi8 "hhi" /* int8_t */ -#define SCNi16 "hi" /* int16_t */ -#define SCNi32 "i" /* int32_t */ -#define SCNi64 "li" /* int64_t */ -#define SCNiLEAST8 "hhi" /* int_least8_t */ -#define SCNiLEAST16 "hi" /* int_least16_t */ -#define SCNiLEAST32 "i" /* int_least32_t */ -#define SCNiLEAST64 "li" /* int_least64_t */ -#define SCNiFAST8 "i" /* int_fast8_t */ -#define SCNiFAST16 "i" /* int_fast16_t */ -#define SCNiFAST32 "i" /* int_fast32_t */ -#define SCNiFAST64 "li" /* int_fast64_t */ -#define SCNiMAX "ji" /* intmax_t */ -#define SCNiPTR "li" /* intptr_t */ - -/* fscanf(3) macros for unsigned integers. */ - -#define SCNo8 "hho" /* uint8_t */ -#define SCNo16 "ho" /* uint16_t */ -#define SCNo32 "o" /* uint32_t */ -#define SCNo64 "lo" /* uint64_t */ -#define SCNoLEAST8 "hho" /* uint_least8_t */ -#define SCNoLEAST16 "ho" /* uint_least16_t */ -#define SCNoLEAST32 "o" /* uint_least32_t */ -#define SCNoLEAST64 "lo" /* uint_least64_t */ -#define SCNoFAST8 "o" /* uint_fast8_t */ -#define SCNoFAST16 "o" /* uint_fast16_t */ -#define SCNoFAST32 "o" /* uint_fast32_t */ -#define SCNoFAST64 "lo" /* uint_fast64_t */ -#define SCNoMAX "jo" /* uintmax_t */ -#define SCNoPTR "lo" /* uintptr_t */ - -#define SCNu8 "hhu" /* uint8_t */ -#define SCNu16 "hu" /* uint16_t */ -#define SCNu32 "u" /* uint32_t */ -#define SCNu64 "lu" /* uint64_t */ -#define SCNuLEAST8 "hhu" /* uint_least8_t */ -#define SCNuLEAST16 "hu" /* uint_least16_t */ -#define SCNuLEAST32 "u" /* uint_least32_t */ -#define SCNuLEAST64 "lu" /* uint_least64_t */ -#define SCNuFAST8 "u" /* uint_fast8_t */ -#define SCNuFAST16 "u" /* uint_fast16_t */ -#define SCNuFAST32 "u" /* uint_fast32_t */ -#define SCNuFAST64 "lu" /* uint_fast64_t */ -#define SCNuMAX "ju" /* uintmax_t */ -#define SCNuPTR "lu" /* uintptr_t */ - -#define SCNx8 "hhx" /* uint8_t */ -#define SCNx16 "hx" /* uint16_t */ -#define SCNx32 "x" /* uint32_t */ -#define SCNx64 "lx" /* uint64_t */ -#define SCNxLEAST8 "hhx" /* uint_least8_t */ -#define SCNxLEAST16 "hx" /* uint_least16_t */ -#define SCNxLEAST32 "x" /* uint_least32_t */ -#define SCNxLEAST64 "lx" /* uint_least64_t */ -#define SCNxFAST8 "x" /* uint_fast8_t */ -#define SCNxFAST16 "x" /* uint_fast16_t */ -#define SCNxFAST32 "x" /* uint_fast32_t */ -#define SCNxFAST64 "lx" /* uint_fast64_t */ -#define SCNxMAX "jx" /* uintmax_t */ -#define SCNxPTR "lx" /* uintptr_t */ - -#endif /* !_MACHINE_INTTYPES_H_ */ diff --git a/sys/alpha/include/_limits.h b/sys/alpha/include/_limits.h deleted file mode 100644 index 0ab5874..0000000 --- a/sys/alpha/include/_limits.h +++ /dev/null @@ -1,96 +0,0 @@ -/*- - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 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. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - * From: NetBSD: limits.h,v 1.3 1997/04/06 08:47:31 cgd Exp - * $FreeBSD$ - */ - -#ifndef _MACHINE__LIMITS_H_ -#define _MACHINE__LIMITS_H_ - -/* - * According to ANSI (section 2.2.4.2), the values below must be usable by - * #if preprocessing directives. Additionally, the expression must have the - * same type as would an expression that is an object of the corresponding - * type converted according to the integral promotions. The subtraction for - * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an - * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). - * These numbers are for the default configuration of gcc. They work for - * some other compilers as well, but this should not be depended on. - */ - -#define __CHAR_BIT 8 /* number of bits in a char */ - -#define __SCHAR_MAX 0x7f /* max value for a signed char */ -#define __SCHAR_MIN (-0x7f-1) /* min value for a signed char */ - -#define __UCHAR_MAX 0xffU /* max value for an unsigned char */ -#define __CHAR_MAX 0x7f /* max value for a char */ -#define __CHAR_MIN (-0x7f-1) /* min value for a char */ - -#define __USHRT_MAX 0xffffU /* max value for an unsigned short */ -#define __SHRT_MAX 0x7fff /* max value for a short */ -#define __SHRT_MIN (-0x7fff-1) /* min value for a short */ - -#define __UINT_MAX 0xffffffffU /* max value for an unsigned int */ -#define __INT_MAX 0x7fffffff /* max value for an int */ -#define __INT_MIN (-0x7fffffff-1) /* min value for an int */ - -#define __ULONG_MAX 0xffffffffffffffffUL /* max for an unsigned long */ -#define __LONG_MAX 0x7fffffffffffffffL /* max for a long */ -#define __LONG_MIN (-0x7fffffffffffffffL-1) /* min for a long */ - -/* Long longs and longs are the same size on the alpha. */ - /* max for an unsigned long long */ -#define __ULLONG_MAX 0xffffffffffffffffULL -#define __LLONG_MAX 0x7fffffffffffffffLL /* max for a long long */ -#define __LLONG_MIN (-0x7fffffffffffffffLL-1) /* min for a long long */ - -#define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ - -#define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ - -#define __OFF_MAX __LONG_MAX /* max value for a off_t */ -#define __OFF_MIN __LONG_MIN /* min value for a off_t */ - -/* Quads and longs are the same on the alpha. Ensure they stay in sync. */ -#define __UQUAD_MAX (__ULONG_MAX) /* max value for a uquad_t */ -#define __QUAD_MAX (__LONG_MAX) /* max value for a quad_t */ -#define __QUAD_MIN (__LONG_MIN) /* min value for a quad_t */ - -#define __LONG_BIT 64 -#define __WORD_BIT 32 - -/* - * Minimum signal stack size. The current signal frame - * for Alpha is 808 bytes large. - */ -#define __MINSIGSTKSZ (1024 * 4) - -#endif /* !_MACHINE__LIMITS_H_ */ diff --git a/sys/alpha/include/_stdint.h b/sys/alpha/include/_stdint.h deleted file mode 100644 index 1aed3e3..0000000 --- a/sys/alpha/include/_stdint.h +++ /dev/null @@ -1,171 +0,0 @@ -/*- - * Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org> - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Klaus Klein. - * - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE__STDINT_H_ -#define _MACHINE__STDINT_H_ - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) - -#define INT8_C(c) (c) -#define INT16_C(c) (c) -#define INT32_C(c) (c) -#define INT64_C(c) (c ## L) - -#define UINT8_C(c) (c) -#define UINT16_C(c) (c) -#define UINT32_C(c) (c ## U) -#define UINT64_C(c) (c ## UL) - -#define INTMAX_C(c) (c ## L) -#define UINTMAX_C(c) (c ## UL) - -#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) - -/* - * ISO/IEC 9899:1999 - * 7.18.2.1 Limits of exact-width integer types - */ -/* Minimum values of exact-width signed integer types. */ -#define INT8_MIN (-0x7f-1) -#define INT16_MIN (-0x7fff-1) -#define INT32_MIN (-0x7fffffff-1) -#define INT64_MIN (-0x7fffffffffffffffL-1) - -/* Maximum values of exact-width signed integer types. */ -#define INT8_MAX 0x7f -#define INT16_MAX 0x7fff -#define INT32_MAX 0x7fffffff -#define INT64_MAX 0x7fffffffffffffffL - -/* Maximum values of exact-width unsigned integer types. */ -#define UINT8_MAX 0xff -#define UINT16_MAX 0xffff -#define UINT32_MAX 0xffffffffU -#define UINT64_MAX 0xffffffffffffffffUL - -/* - * ISO/IEC 9899:1999 - * 7.18.2.2 Limits of minimum-width integer types - */ -/* Minimum values of minimum-width signed integer types. */ -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST64_MIN INT64_MIN - -/* Maximum values of minimum-width signed integer types. */ -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MAX INT64_MAX - -/* Maximum values of minimum-width unsigned integer types. */ -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.3 Limits of fastest minimum-width integer types - */ -/* Minimum values of fastest minimum-width signed integer types. */ -#define INT_FAST8_MIN INT32_MIN -#define INT_FAST16_MIN INT32_MIN -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST64_MIN INT64_MIN - -/* Maximum values of fastest minimum-width signed integer types. */ -#define INT_FAST8_MAX INT32_MAX -#define INT_FAST16_MAX INT32_MAX -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MAX INT64_MAX - -/* Maximum values of fastest minimum-width unsigned integer types. */ -#define UINT_FAST8_MAX UINT32_MAX -#define UINT_FAST16_MAX UINT32_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.4 Limits of integer types capable of holding object pointers - */ -#define INTPTR_MIN INT64_MIN -#define INTPTR_MAX INT64_MAX -#define UINTPTR_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.2.5 Limits of greatest-width integer types - */ -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -/* - * ISO/IEC 9899:1999 - * 7.18.3 Limits of other integer types - */ -/* Limits of ptrdiff_t. */ -#define PTRDIFF_MIN INT64_MIN -#define PTRDIFF_MAX INT64_MAX - -/* Limits of sig_atomic_t. */ -#define SIG_ATOMIC_MIN INT32_MIN -#define SIG_ATOMIC_MAX INT32_MAX - -/* Limit of size_t. */ -#define SIZE_MAX UINT64_MAX - -#ifndef WCHAR_MIN /* Also possibly defined in <wchar.h> */ -/* Limits of wchar_t. */ -#define WCHAR_MIN INT32_MIN -#define WCHAR_MAX INT32_MAX -#endif - -/* Limits of wint_t. */ -#define WINT_MIN INT32_MIN -#define WINT_MAX INT32_MAX - -#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ - -#endif /* !_MACHINE__STDINT_H_ */ diff --git a/sys/alpha/include/_types.h b/sys/alpha/include/_types.h deleted file mode 100644 index a8acbbb..0000000 --- a/sys/alpha/include/_types.h +++ /dev/null @@ -1,119 +0,0 @@ -/*- - * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. 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: @(#)ansi.h 8.2 (Berkeley) 1/4/94 - * From: @(#)types.h 8.3 (Berkeley) 1/5/94 - * $FreeBSD$ - */ - -#ifndef _MACHINE__TYPES_H_ -#define _MACHINE__TYPES_H_ - -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - -/* - * Basic types upon which most other types are built. - */ -typedef __signed char __int8_t; -typedef unsigned char __uint8_t; -typedef short __int16_t; -typedef unsigned short __uint16_t; -typedef int __int32_t; -typedef unsigned int __uint32_t; -typedef long __int64_t; -typedef unsigned long __uint64_t; - -/* - * Standard type definitions. - */ -typedef __int32_t __clock_t; /* clock()... */ -typedef unsigned int __cpumask_t; -typedef __int64_t __critical_t; -typedef double __double_t; -typedef float __float_t; -typedef __int64_t __intfptr_t; -typedef __int64_t __intmax_t; -typedef __int64_t __intptr_t; -typedef __int32_t __int_fast8_t; -typedef __int32_t __int_fast16_t; -typedef __int32_t __int_fast32_t; -typedef __int64_t __int_fast64_t; -typedef __int8_t __int_least8_t; -typedef __int16_t __int_least16_t; -typedef __int32_t __int_least32_t; -typedef __int64_t __int_least64_t; -typedef __int64_t __ptrdiff_t; /* ptr1 - ptr2 */ -typedef __int64_t __register_t; -typedef __int64_t __segsz_t; /* segment size (in pages) */ -typedef __uint64_t __size_t; /* sizeof() */ -typedef __int64_t __ssize_t; /* byte count or error */ -typedef __int32_t __time_t; /* time()... */ -typedef __uint64_t __uintfptr_t; -typedef __uint64_t __uintmax_t; -typedef __uint64_t __uintptr_t; -typedef __uint32_t __uint_fast8_t; -typedef __uint32_t __uint_fast16_t; -typedef __uint32_t __uint_fast32_t; -typedef __uint64_t __uint_fast64_t; -typedef __uint8_t __uint_least8_t; -typedef __uint16_t __uint_least16_t; -typedef __uint32_t __uint_least32_t; -typedef __uint64_t __uint_least64_t; -typedef __uint64_t __u_register_t; -typedef __uint64_t __vm_offset_t; -typedef __int64_t __vm_ooffset_t; -typedef __uint64_t __vm_paddr_t; -typedef __uint64_t __vm_pindex_t; -typedef __uint64_t __vm_size_t; - -/* - * Unusual type definitions. - */ -#ifdef __GNUCLIKE_BUILTIN_VAALIST -typedef __builtin_va_list __va_list; /* internally known to gcc */ -#else -typedef struct { - char *__base; - int __offset; - int __pad; -} __va_list; -#endif /* __GNUCLIKE_BUILTIN_VAALIST */ -#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \ - && !defined(__NO_GNUC_VA_LIST) -#define __GNUC_VA_LIST -typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ -#endif - -#endif /* !_MACHINE__TYPES_H_ */ diff --git a/sys/alpha/include/alpha_cpu.h b/sys/alpha/include/alpha_cpu.h deleted file mode 100644 index a3b4dfc..0000000 --- a/sys/alpha/include/alpha_cpu.h +++ /dev/null @@ -1,582 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: alpha_cpu.h,v 1.15 1997/09/20 19:02:34 mjacob Exp */ - -/*- - * 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_ALPHA_CPU_H__ -#define __ALPHA_ALPHA_CPU_H__ - -/* - * Alpha CPU + OSF/1 PALcode definitions for use by the kernel. - * - * Definitions for: - * - * Process Control Block - * Interrupt/Exception/Syscall Stack Frame - * Processor Status Register - * Machine Check Error Summary Register - * Machine Check Logout Area - * Virtual Memory Management - * Kernel Entry Vectors - * MMCSR Fault Type Codes - * Translation Buffer Invalidation - * - * and miscellaneous PALcode operations. - */ - - -/* - * Process Control Block definitions [OSF/1 PALcode Specific] - */ - -struct alpha_pcb { - unsigned long apcb_ksp; /* kernel stack ptr */ - unsigned long apcb_usp; /* user stack ptr */ - unsigned long apcb_ptbr; /* page table base reg */ - unsigned int apcb_cpc; /* charged process cycles */ - unsigned int apcb_asn; /* address space number */ - unsigned long apcb_unique; /* process unique value */ - unsigned long apcb_flags; /* flags; see below */ - unsigned long apcb_decrsv0; /* DEC reserved */ - unsigned long apcb_decrsv1; /* DEC reserved */ -}; - -#define ALPHA_PCB_FLAGS_FEN 0x0000000000000001 -#define ALPHA_PCB_FLAGS_PME 0x4000000000000000 - -/* - * Interrupt/Exception/Syscall "Hardware" (really PALcode) - * Stack Frame definitions - * - * These are quadword offsets from the sp on kernel entry, i.e. - * to get to the value in question you access (sp + (offset * 8)). - * - * On syscall entry, A0-A2 aren't written to memory but space - * _is_ reserved for them. - */ - -#define ALPHA_HWFRAME_PS 0 /* processor status register */ -#define ALPHA_HWFRAME_PC 1 /* program counter */ -#define ALPHA_HWFRAME_GP 2 /* global pointer */ -#define ALPHA_HWFRAME_A0 3 /* a0 */ -#define ALPHA_HWFRAME_A1 4 /* a1 */ -#define ALPHA_HWFRAME_A2 5 /* a2 */ - -#define ALPHA_HWFRAME_SIZE 6 /* 6 8-byte words */ - -/* - * Processor Status Register [OSF/1 PALcode Specific] - * - * Includes user/kernel mode bit, interrupt priority levels, etc. - */ - -#define ALPHA_PSL_USERMODE 0x0008 /* set -> user mode */ -#define ALPHA_PSL_IPL_MASK 0x0007 /* interrupt level mask */ - -#define ALPHA_PSL_IPL_0 0x0000 /* all interrupts enabled */ -#define ALPHA_PSL_IPL_SOFT 0x0001 /* software ints disabled */ -#define ALPHA_PSL_IPL_IO 0x0004 /* I/O dev ints disabled */ -#define ALPHA_PSL_IPL_CLOCK 0x0005 /* clock ints disabled */ -#define ALPHA_PSL_IPL_HIGH 0x0006 /* all but mchecks disabled */ -#define ALPHA_PSL_IPL_MCES 0x0007 /* all interrupts disabled */ - -#define ALPHA_PSL_MUST_BE_ZERO 0xfffffffffffffff0 - -/* Convenience constants: what must be set/clear in user mode */ -#define ALPHA_PSL_USERSET ALPHA_PSL_USERMODE -#define ALPHA_PSL_USERCLR (ALPHA_PSL_MUST_BE_ZERO | ALPHA_PSL_IPL_MASK) - -/* - * Interrupt Type Code Definitions [OSF/1 PALcode Specific] - */ - -#define ALPHA_INTR_XPROC 0 /* interprocessor interrupt */ -#define ALPHA_INTR_CLOCK 1 /* clock interrupt */ -#define ALPHA_INTR_ERROR 2 /* correctable error or mcheck */ -#define ALPHA_INTR_DEVICE 3 /* device interrupt */ -#define ALPHA_INTR_PERF 4 /* performance counter */ -#define ALPHA_INTR_PASSIVE 5 /* passive release */ - -/* - * Machine Check Error Summary Register definitions [OSF/1 PALcode Specific] - * - * The following bits are values as read. On write, _PCE, _SCE, and - * _MIP are "write 1 to clear." - */ - -#define ALPHA_MCES_IMP \ - 0xffffffff00000000 /* impl. dependent */ -#define ALPHA_MCES_RSVD \ - 0x00000000ffffffe0 /* reserved */ -#define ALPHA_MCES_DSC \ - 0x0000000000000010 /* disable system correctable error reporting */ -#define ALPHA_MCES_DPC \ - 0x0000000000000008 /* disable processor correctable error reporting */ -#define ALPHA_MCES_PCE \ - 0x0000000000000004 /* processor correctable error in progress */ -#define ALPHA_MCES_SCE \ - 0x0000000000000002 /* system correctable error in progress */ -#define ALPHA_MCES_MIP \ - 0x0000000000000001 /* machine check in progress */ - -/* - * Machine Check Error Summary Register definitions [OSF/1 PALcode Specific] - */ - -struct alpha_logout_area { - unsigned int la_frame_size; /* frame size */ - unsigned int la_flags; /* flags; see below */ - unsigned int la_cpu_offset; /* offset to cpu area */ - unsigned int la_system_offset; /* offset to system area */ -}; - -#define ALPHA_LOGOUT_FLAGS_RETRY 0x80000000 /* OK to continue */ -#define ALPHA_LOGOUT_FLAGS_SE 0x40000000 /* second error */ -#define ALPHA_LOGOUT_FLAGS_SBZ 0x3fffffff /* should be zero */ - -#define ALPHA_LOGOUT_NOT_BUILT \ - (struct alpha_logout_area *)0xffffffffffffffff) - -#define ALPHA_LOGOUT_PAL_AREA(lap) \ - (unsigned long *)((unsigned char *)(lap) + 16) -#define ALPHA_LOGOUT_PAL_SIZE(lap) \ - ((lap)->la_cpu_offset - 16) -#define ALPHA_LOGOUT_CPU_AREA(lap) \ - (unsigned long *)((unsigned char *)(lap) + (lap)->la_cpu_offset) -#define ALPHA_LOGOUT_CPU_SIZE(lap) \ - ((lap)->la_system_offset - (lap)->la_cpu_offset) -#define ALPHA_LOGOUT_SYSTEM_AREA(lap) \ - (unsigned long *)((unsigned char *)(lap) + (lap)->la_system_offset) -#define ALPHA_LOGOUT_SYSTEM_SIZE(lap) \ - ((lap)->la_frame_size - (lap)->la_system_offset) - -/* - * Virtual Memory Management definitions [OSF/1 PALcode Specific] - * - * Includes user and kernel space addresses and information, - * page table entry definitions, etc. - * - * NOTE THAT THESE DEFINITIONS MAY CHANGE IN FUTURE ALPHA CPUS! - */ - -#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 0x000003ffffffffffLL - -#define ALPHA_K0SEG_BASE 0xfffffc0000000000LL /* direct-mapped */ -#define ALPHA_K0SEG_END 0xfffffdffffffffffLL -#define ALPHA_K1SEG_BASE 0xfffffe0000000000LL /* virtual */ -#define ALPHA_K1SEG_END 0xffffffffffffffffLL - -#define ALPHA_K0SEG_TO_PHYS(x) ((x) & ~ALPHA_K0SEG_BASE) -#define ALPHA_PHYS_TO_K0SEG(x) ((x) | ALPHA_K0SEG_BASE) - -#define ALPHA_PTE_VALID 0x0001 - -#define ALPHA_PTE_FAULT_ON_READ 0x0002 -#define ALPHA_PTE_FAULT_ON_WRITE 0x0004 -#define ALPHA_PTE_FAULT_ON_EXECUTE 0x0008 - -#define ALPHA_PTE_ASM 0x0010 /* addr. space match */ -#define ALPHA_PTE_GRANULARITY 0x0060 /* granularity hint */ - -#define ALPHA_PTE_PROT 0xff00 -#define ALPHA_PTE_KR 0x0100 -#define ALPHA_PTE_UR 0x0200 -#define ALPHA_PTE_KW 0x1000 -#define ALPHA_PTE_UW 0x2000 - -#define ALPHA_PTE_WRITE (ALPHA_PTE_KW | ALPHA_PTE_UW) - -#define ALPHA_PTE_SOFTWARE 0xffff0000 - -#define ALPHA_PTE_PFN 0xffffffff00000000 - -#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; - -/* - * Kernel Entry Vectors. [OSF/1 PALcode Specific] - */ - -#define ALPHA_KENTRY_INT 0 -#define ALPHA_KENTRY_ARITH 1 -#define ALPHA_KENTRY_MM 2 -#define ALPHA_KENTRY_IF 3 -#define ALPHA_KENTRY_UNA 4 -#define ALPHA_KENTRY_SYS 5 - -/* - * MMCSR Fault Type Codes. [OSF/1 PALcode Specific] - */ - -#define ALPHA_MMCSR_INVALTRANS 0 -#define ALPHA_MMCSR_ACCESS 1 -#define ALPHA_MMCSR_FOR 2 -#define ALPHA_MMCSR_FOE 3 -#define ALPHA_MMCSR_FOW 4 - -/* - * Instruction Fault Type Codes. [OSF/1 PALcode Specific] - */ - -#define ALPHA_IF_CODE_BPT 0 -#define ALPHA_IF_CODE_BUGCHK 1 -#define ALPHA_IF_CODE_GENTRAP 2 -#define ALPHA_IF_CODE_FEN 3 -#define ALPHA_IF_CODE_OPDEC 4 - -/* - * Translation Buffer Invalidation definitions [OSF/1 PALcode Specific] - */ - -#define ALPHA_TBIA() alpha_pal_tbi(-2, 0) /* all TB entries */ -#define ALPHA_TBIAP() alpha_pal_tbi(-1, 0) /* all per-process */ -#define ALPHA_TBISI(va) alpha_pal_tbi(1, (va)) /* ITB entry for va */ -#define ALPHA_TBISD(va) alpha_pal_tbi(2, (va)) /* DTB entry for va */ -#define ALPHA_TBIS(va) alpha_pal_tbi(3, (va)) /* all for va */ - -/* - * Bits used in the amask instruction [EV56 and later] - */ - -#define ALPHA_AMASK_BWX 0x0001 /* byte/word extension */ -#define ALPHA_AMASK_FIX 0x0002 /* sqrt and f <-> i conversion extension */ -#define ALPHA_AMASK_CIX 0x0004 /* count extension */ -#define ALPHA_AMASK_MVI 0x0100 /* multimedia extension */ -#define ALPHA_AMASK_PRECISE 0x0200 /* Precise arithmetic traps */ - -/* - * Chip family IDs returned by implver instruction - */ - -#define ALPHA_IMPLVER_EV4 0 /* LCA/EV4/EV45 */ -#define ALPHA_IMPLVER_EV5 1 /* EV5/EV56/PCA56 */ -#define ALPHA_IMPLVER_EV6 2 /* EV6 */ - - -/* - * Inlines for Alpha instructions normally inaccessible from C. - */ - -static __inline u_int64_t -alpha_amask(u_int64_t mask) -{ - u_int64_t result; - __asm__ __volatile__ ( - "amask %1,%0" - : "=r" (result) - : "r" (mask)); - return result; -} - -static __inline unsigned long -alpha_implver(void) -{ - u_int64_t result; - __asm__ __volatile__ ( - "implver %0" - : "=r" (result)); - return result; -} - -static __inline unsigned long -alpha_rpcc(void) -{ - u_int64_t result; - __asm__ __volatile__ ( - "rpcc %0" - : "=r" (result)); - return result; -} - -static __inline void -alpha_mb(void) -{ - __asm__ __volatile__ ("mb"); -} - -static __inline void -alpha_wmb(void) -{ - /* - * XXX dfr: NetBSD originally had mb instead of wmb for - * alpha_wmb(). I'm not sure why so I'm leaving it alone. I - * think it should be safe to use wmb though. - */ - __asm__ __volatile__ ("mb"); -} - -/* - * Inlines for OSF/1 PALcode operations. - */ - -static __inline void -alpha_pal_halt(void) -{ - __asm__ __volatile__ ("call_pal 0x0 #PAL_halt"); -} - -static __inline void -alpha_pal_cflush(u_int64_t pfn) -{ - register u_int64_t a0 __asm__("$16") = pfn; - __asm__ __volatile__ ( - "call_pal 0x1 #PAL_cflush" - : - : "r" (a0)); -} - -static __inline void -alpha_pal_draina(void) -{ - __asm__ __volatile__ ("call_pal 0x2 #PAL_draina" : : : "memory"); -} - -static __inline void -alpha_pal_wripir(u_int64_t ipir) -{ - register u_int64_t a0 __asm__("$16") = ipir; - __asm__ __volatile__ ( - "call_pal 0xd #PAL_ipir" - : "+r" (a0) - : - : "$1", "$22", "$23", "$24", "$25"); -} - -static __inline u_int64_t -alpha_pal_rdmces(void) -{ - register u_int64_t v0 __asm__("$0"); - __asm__ __volatile__ ( - "call_pal 0x10 #PAL_OSF1_rdmces" - : "=r" (v0) - : - : "$1", "$22", "$23", "$24", "$25"); - return v0; -} - -static __inline void -alpha_pal_wrmces(u_int64_t mces) -{ - register u_int64_t a0 __asm__("$16") = mces; - __asm__ __volatile__ ( - "call_pal 0x11 #PAL_wrmces" - : "+r" (a0) - : - : "$1", "$22", "$23", "$24", "$25"); -} - -static __inline void -alpha_pal_wrfen(u_int64_t fen) -{ - register u_int64_t a0 __asm__("$16") = fen; - __asm__ __volatile__ ( - "call_pal 0x2b #PAL_wrfen" - : "+r" (a0) - : - : "$1", "$22", "$23", "$24", "$25"); -} - -static __inline void -alpha_pal_wrvptptr(u_int64_t vptptr) -{ - register u_int64_t a0 __asm__("$16") = vptptr; - __asm__ __volatile__ ( - "call_pal 0x2d #PAL_wrvptptr" - : "+r" (a0) - : - : "$1", "$22", "$23", "$24", "$25"); -} - -static __inline u_int64_t -alpha_pal_swpctx(u_int64_t pcb) -{ - register u_int64_t a0 __asm__("$16") = pcb; - register u_int64_t v0 __asm__("$0"); - __asm__ __volatile__ ( - "call_pal 0x30 #PAL_OSF1_swpctx" - : "=r" (v0), "+r" (a0) - : - : "$1", "$22", "$23", "$24", "$25", "memory"); - return v0; -} - -static __inline void -alpha_pal_wrval(u_int64_t sysvalue) -{ - register u_int64_t a0 __asm__("$16") = sysvalue; - __asm__ __volatile__ ( - "call_pal 0x31 #PAL_wrval" - : "+r" (a0) - : - : "$1", "$22", "$23", "$24", "$25"); -} - -static __inline u_int64_t -alpha_pal_rdval(void) -{ - register u_int64_t v0 __asm__("$0"); - __asm__ __volatile__ ( - "call_pal 0x32 #PAL_OSF1_rdval" - : "=r" (v0) - : - : "$1", "$22", "$23", "$24", "$25"); - return v0; -} - -static __inline void -alpha_pal_wrunique(u_int64_t tp) -{ - register u_int64_t a0 __asm__("$16") = tp; - __asm__ __volatile__("call_pal 0x9f # PAL_wrunique" - : "+r" (a0) : : "$1", "$22", "$23", "$24", "$25"); -} - -static __inline u_int64_t -alpha_pal_rdunique(void) -{ - register u_int64_t v0 __asm__("$0"); - __asm__ __volatile__("call_pal 0x9e # PAL_rdunique" - : "=r" (v0) : : "$1", "$22", "$23", "$24", "$25"); - return (v0); -} - -static __inline void -alpha_pal_tbi(u_int64_t op, u_int64_t va) -{ - register u_int64_t a0 __asm__("$16") = op; - register u_int64_t a1 __asm__("$17") = va; - __asm__ __volatile__ ( - "call_pal 0x33 #PAL_OSF1_tbi" - : "+r" (a0), "+r" (a1) - : - : "$1", "$22", "$23", "$24", "$25"); -} - -static __inline void -alpha_pal_wrent(void *ent, u_int64_t which) -{ - register u_int64_t a0 __asm__("$16") = (u_int64_t) ent; - register u_int64_t a1 __asm__("$17") = which; - __asm__ __volatile__ ( - "call_pal 0x34 #PAL_OSF1_wrent" - : "+r" (a0), "+r" (a1) - : - : "$1", "$22", "$23", "$24", "$25"); -} - -static __inline u_int64_t -alpha_pal_swpipl(u_int64_t newipl) -{ - register u_int64_t a0 __asm__("$16") = newipl; - register u_int64_t v0 __asm__("$0"); - __asm__ __volatile__ ( - "call_pal 0x35 #PAL_OSF1_swpipl" - : "=r" (v0), "+r" (a0) - : - : "$1", "$22", "$23", "$24", "$25"); - return v0; -} - -static __inline u_int64_t -alpha_pal_rdps(void) -{ - register u_int64_t v0 __asm__("$0"); - __asm__ __volatile__ ( - "call_pal 0x36 #PAL_OSF1_rdps" - : "=r" (v0) - : - : "$1", "$22", "$23", "$24", "$25"); - return v0; -} - -static __inline void -alpha_pal_wrusp(u_int64_t usp) -{ - register u_int64_t a0 __asm__("$16") = usp; - __asm__ __volatile__ ( - "call_pal 0x38 #PAL_wrusp" - : "+r" (a0) - : - : "$1", "$22", "$23", "$24", "$25"); -} - -static __inline u_int64_t -alpha_pal_wrperfmon(u_int64_t arg0, u_int64_t arg1) -{ - register u_int64_t v0 __asm__("$0"); - register u_int64_t a0 __asm__("$16") = arg0; - register u_int64_t a1 __asm__("$17") = arg1; - __asm__ __volatile__ ( - "call_pal 0x39 #PAL_OSF1_wrperfmon" - : "+r" (a0), "+r" (a1), "=r" (v0) - : - : "$1", "$22", "$23", "$24", "$25"); - return v0; -} - -static __inline u_int64_t -alpha_pal_rdusp(void) -{ - register u_int64_t v0 __asm__("$0"); - __asm__ __volatile__ ( - "call_pal 0x3a #PAL_OSF1_rdusp" - : "=r" (v0) - : - : "$1", "$22", "$23", "$24", "$25"); - return v0; -} - -static __inline u_int64_t -alpha_pal_whami(void) -{ - register u_int64_t v0 __asm__("$0"); - __asm__ __volatile__ ( - "call_pal 0x3c #PAL_OSF1_whami" - : "=r" (v0) - : - : "$1", "$22", "$23", "$24", "$25"); - return v0; -} - -static __inline void -alpha_pal_imb(void) -{ - __asm__ __volatile__ ("call_pal 0x86 #PAL_imb"); -} - -#endif /* __ALPHA_ALPHA_CPU_H__ */ diff --git a/sys/alpha/include/asm.h b/sys/alpha/include/asm.h deleted file mode 100644 index 3ddaf81..0000000 --- a/sys/alpha/include/asm.h +++ /dev/null @@ -1,649 +0,0 @@ -/*- - * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University - * All Rights Reserved. - * - * 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 Mellon - * the rights to redistribute these changes. - * From: NetBSD: asm.h,v 1.18 1997/11/03 04:22:06 ross Exp - * $FreeBSD$ - */ - -#ifndef _MACHINE_ASM_H_ -#define _MACHINE_ASM_H_ - -/* - * Assembly coding style - * - * This file contains macros and register defines to - * aid in writing more readable assembly code. - * Some rules to make assembly code understandable by - * a debugger are also noted. - * - * The document - * - * "ALPHA Calling Standard", DEC 27-Apr-90 - * - * defines (a superset of) the rules and conventions - * we use. While we make no promise of adhering to - * such standard and its evolution (esp where we - * can get faster code paths) it is certainly intended - * that we be interoperable with such standard. - * - * In this sense, this file is a proper part of the - * definition of the (software) Alpha architecture. - */ - -/* - * Symbolic register names and register saving rules - * - * Legend: - * T Saved by caller (Temporaries) - * S Saved by callee (call-Safe registers) - */ - -#define v0 $0 /* (T) return value */ -#define t0 $1 /* (T) temporary registers */ -#define t1 $2 -#define t2 $3 -#define t3 $4 -#define t4 $5 -#define t5 $6 -#define t6 $7 -#define t7 $8 - -#define s0 $9 /* (S) call-safe registers */ -#define s1 $10 -#define s2 $11 -#define s3 $12 -#define s4 $13 -#define s5 $14 -#define s6 $15 -#define a0 $16 /* (T) argument registers */ -#define a1 $17 -#define a2 $18 -#define a3 $19 -#define a4 $20 -#define a5 $21 -#define t8 $22 /* (T) temporary registers */ -#define t9 $23 -#define t10 $24 -#define t11 $25 -#define ra $26 /* (T) return address */ -#define t12 $27 /* (T) another temporary */ -#define at_reg $28 /* (T) assembler scratch */ -#define gp $29 /* (T) (local) data pointer */ -#define sp $30 /* (S) stack pointer */ -#define zero $31 /* wired zero */ - -/* In the kernel, we use t7 to point at the per-cpu globals. */ -#ifdef _KERNEL -#define pcpup $8 -#endif - -/* Floating point registers (XXXX VERIFY THIS) */ -#define fv0 $f0 /* (T) return value (real) */ -#define fv1 $f1 /* (T) return value (imaginary)*/ -#define ft0 fv1 -#define fs0 $f2 /* (S) call-safe registers */ -#define fs1 $f3 -#define fs2 $f4 -#define fs3 $f5 -#define fs4 $f6 -#define fs5 $f7 -#define fs6 $f8 -#define fs7 $f9 -#define ft1 $f10 /* (T) temporary registers */ -#define ft2 $f11 -#define ft3 $f12 -#define ft4 $f13 -#define ft5 $f14 -#define ft6 $f15 -#define fa0 $f16 /* (T) argument registers */ -#define fa1 $f17 -#define fa2 $f18 -#define fa3 $f19 -#define fa4 $f20 -#define fa5 $f21 -#define ft7 $f22 /* (T) more temporaries */ -#define ft8 $f23 -#define ft9 $f24 -#define ft10 $f25 -#define ft11 $f26 -#define ft12 $f27 -#define ft13 $f28 -#define ft14 $f29 -#define ft15 $f30 -#define fzero $f31 /* wired zero */ - - -/* Other DEC standard names */ -#define ai $25 /* (T) argument information */ -#define pv $27 /* (T) procedure value */ - - -/* - * Useful stuff. - */ -#ifdef __STDC__ -#define __CONCAT(a,b) a ## b -#else -#define __CONCAT(a,b) a/**/b -#endif -#define ___CONCAT(a,b) __CONCAT(a,b) - -/* - * Macro to make a local label name. - */ -#define LLABEL(name,num) ___CONCAT(___CONCAT(L,name),num) - -/* - * - * Debuggers need symbol table information to be able to properly - * decode a stack trace. The minimum that should be provided is: - * - * name: - * .proc name,numargs - * - * where "name" is the function's name; - * "numargs" how many arguments it expects. For varargs - * procedures this should be a negative number, - * indicating the minimum required number of - * arguments (which is at least 1); - * - * NESTED functions (functions that call other functions) should define - * how they handle their stack frame in a .frame directive: - * - * .frame framesize, pc_reg, i_mask, f_mask - * - * where "framesize" is the size of the frame for this function, in bytes. - * That is: - * new_sp + framesize == old_sp - * Framesizes should be rounded to a cacheline size. - * Note that old_sp plays the role of a conventional - * "frame pointer"; - * "pc_reg" is either a register which preserves the caller's PC - * or 'std', if std the saved PC should be stored at - * old_sp-8 - * "i_mask" is a bitmask that indicates which of the integer - * registers are saved. See the M_xx defines at the - * end for the encoding of this 32bit value. - * "f_mask" is the same, for floating point registers. - * - * Note, 10/31/97: This is interesting but it isn't the way gcc outputs - * frame directives and it isn't the way the macros below output them - * either. Frame directives look like this: - * - * .frame $15,framesize,$26,0 - * - * If no fp is set up then $30 should be used instead of $15. - * Also, gdb expects to find a <lda sp,-framesize(sp)> at the beginning - * of a procedure. Don't use things like sub sp,framesize,sp for this - * reason. End Note 10/31/97. ross@netbsd.org - * - * Note that registers should be saved starting at "old_sp-8", where the - * return address should be stored. Other registers follow at -16-24-32.. - * starting from register 0 (if saved) and up. Then float registers (ifany) - * are saved. - * - * If you need to alias a leaf function, or to provide multiple entry points - * use the LEAF() macro for the main entry point and XLEAF() for the other - * additional/alternate entry points. - * "XLEAF"s must be nested within a "LEAF" and a ".end". - * Similar rules for nested routines, e.g. use NESTED/XNESTED - * Symbols that should not be exported can be declared with the STATIC_xxx - * macros. - * - * All functions must be terminated by the END macro - * - * It is conceivable, although currently at the limits of compiler - * technology, that while performing inter-procedural optimizations - * the compiler/linker be able to avoid unnecessary register spills - * if told about the register usage of LEAF procedures (and by transitive - * closure of NESTED procedures as well). Assembly code can help - * this process using the .reguse directive: - * - * .reguse i_mask, f_mask - * - * where the register masks are built as above or-ing M_xx defines. - * - * - * All symbols are internal unless EXPORTed. Symbols that are IMPORTed - * must be appropriately described to the debugger. - * - */ - - /* - * for `.loc' uses - */ - - .file 1 __FILE__ - -/* - * MCOUNT - */ - -#if !defined(GPROF) && !defined(PROF) -#define MCOUNT /* nothing */ -#else -#define MCOUNT \ - .set noat; \ - jsr at_reg,_mcount; \ - .set at -#endif -/* - * PALVECT, ESETUP, and ERSAVE - * Declare a palcode transfer point, and carefully construct - * gdb symbols with an unusual _negative_ register-save offset - * so that gdb can find the otherwise lost PC and then - * invert the vector for traceback. Also, fix up framesize, - * allowing for the palframe for the same reason. - */ - -#define PALVECT(_name_) \ - ESETUP(_name_); \ - ERSAVE(); \ - br pv, 1001f; \ -1001:; \ - LDGP(pv) - -#define ESETUP(_name_) \ - .loc 1 __LINE__; \ - .globl _name_; \ - .ent _name_ 0; \ -_name_:; \ - .set noat; \ - lda sp,-(FRAME_SW_SIZE*8)(sp); \ - .frame $30,(FRAME_SW_SIZE+6)*8,$26,0; /* give gdb the real size */\ - .mask 0x4000000,-0x28; \ - .set at - -#define ERSAVE() \ - .set noat; \ - stq at_reg,(FRAME_AT*8)(sp); \ - .set at; \ - stq ra,(FRAME_RA*8)(sp); \ - .loc 1 __LINE__; \ - bsr ra,exception_save_regs /* jmp/CALL trashes pv/t12 */ - -/* - * LEAF - * Declare a global leaf function. - * A leaf function does not call other functions AND does not - * use any register that is callee-saved AND does not modify - * the stack pointer. - */ -#define LEAF(_name_,_n_args_) \ - .globl _name_; \ - .ent _name_ 0; \ -_name_:; \ - .frame sp,0,ra; \ - MCOUNT -/* should have been - .proc _name_,_n_args_; \ - .frame 0,ra,0,0 -*/ - -#define LEAF_NOPROFILE(_name_,_n_args_) \ - .globl _name_; \ - .ent _name_ 0; \ -_name_:; \ - .frame sp,0,ra -/* should have been - .proc _name_,_n_args_; \ - .frame 0,ra,0,0 -*/ - -/* - * STATIC_LEAF - * Declare a local leaf function. - */ -#define STATIC_LEAF(_name_,_n_args_) \ - .ent _name_ 0; \ -_name_:; \ - .frame sp,0,ra; \ - MCOUNT -/* should have been - .proc _name_,_n_args_; \ - .frame 0,ra,0,0 -*/ -/* - * XLEAF - * Global alias for a leaf function, or alternate entry point - */ -#define XLEAF(_name_,_n_args_) \ - .globl _name_; \ - .aent _name_ 0; \ -_name_: -/* should have been - .aproc _name_,_n_args_; -*/ - -/* - * STATIC_XLEAF - * Local alias for a leaf function, or alternate entry point - */ -#define STATIC_XLEAF(_name_,_n_args_) \ - .aent _name_ 0; \ -_name_: -/* should have been - .aproc _name_,_n_args_; -*/ - -/* - * NESTED - * Declare a (global) nested function - * A nested function calls other functions and needs - * therefore stack space to save/restore registers. - */ -#define NESTED(_name_, _n_args_, _framesize_, _pc_reg_, _i_mask_, _f_mask_ ) \ - .globl _name_; \ - .ent _name_ 0; \ -_name_:; \ - .frame sp,_framesize_,_pc_reg_; \ - .livereg _i_mask_,_f_mask_; \ - MCOUNT -/* should have been - .proc _name_,_n_args_; \ - .frame _framesize_, _pc_reg_, _i_mask_, _f_mask_ -*/ - -#define NESTED_NOPROFILE(_name_, _n_args_, _framesize_, _pc_reg_, _i_mask_, _f_mask_ ) \ - .globl _name_; \ - .ent _name_ 0; \ -_name_:; \ - .frame sp,_framesize_,_pc_reg_; \ - .livereg _i_mask_,_f_mask_ -/* should have been - .proc _name_,_n_args_; \ - .frame _framesize_, _pc_reg_, _i_mask_, _f_mask_ -*/ - -/* - * STATIC_NESTED - * Declare a local nested function. - */ -#define STATIC_NESTED(_name_, _n_args_, _framesize_, _pc_reg_, _i_mask_, _f_mask_ ) \ - .ent _name_ 0; \ -_name_:; \ - .frame sp,_framesize_,_pc_reg_; \ - .livereg _i_mask_,_f_mask_; \ - MCOUNT -/* should have been - .proc _name_,_n_args_; \ - .frame _framesize_, _pc_reg_, _i_mask_, _f_mask_ -*/ - -/* - * XNESTED - * Same as XLEAF, for a nested function. - */ -#define XNESTED(_name_,_n_args_) \ - .globl _name_; \ - .aent _name_ 0; \ -_name_: -/* should have been - .aproc _name_,_n_args_; -*/ - - -/* - * STATIC_XNESTED - * Same as STATIC_XLEAF, for a nested function. - */ -#define STATIC_XNESTED(_name_,_n_args_) \ - .aent _name_ 0; \ -_name_: -/* should have been - .aproc _name_,_n_args_; -*/ - - -/* - * END - * Function delimiter - */ -#define END(_name_) \ - .end _name_ - - -/* - * CALL - * Function invocation - */ -#define CALL(_name_) \ - .loc 1 __LINE__; \ - jsr ra,_name_; \ - ldgp gp,0(ra) -/* but this would cover longer jumps - br ra,.+4; \ - bsr ra,_name_ -*/ - - -/* - * RET - * Return from function - */ -#define RET \ - ret zero,(ra),1 - - -/* - * EXPORT - * Export a symbol - */ -#define EXPORT(_name_) \ - .globl _name_; \ -_name_: - - -/* - * IMPORT - * Make an external name visible, typecheck the size - */ -#define IMPORT(_name_, _size_) \ - .extern _name_,_size_ - - -/* - * ABS - * Define an absolute symbol - */ -#define ABS(_name_, _value_) \ - .globl _name_; \ -_name_ = _value_ - - -/* - * BSS - * Allocate un-initialized space for a global symbol - */ -#define BSS(_name_,_numbytes_) \ - .comm _name_,_numbytes_ - -/* - * VECTOR - * Make an exception entry point look like a called function, - * to make it digestible to the debugger (KERNEL only) - */ -#define VECTOR(_name_, _i_mask_) \ - .globl _name_; \ - .ent _name_ 0; \ -_name_:; \ - .mask _i_mask_|IM_EXC,0; \ - .frame sp,MSS_SIZE,ra; -/* .livereg _i_mask_|IM_EXC,0 */ -/* should have been - .proc _name_,1; \ - .frame MSS_SIZE,$31,_i_mask_,0; \ -*/ - -/* - * MSG - * Allocate space for a message (a read-only ascii string) - */ -#define ASCIZ .asciz -#define MSG(msg,reg,label) \ - lda reg, label; \ - .data; \ -label: ASCIZ msg; \ - .text; - -/* - * PRINTF - * Print a message - */ -#define PRINTF(msg,label) \ - MSG(msg,a0,label); \ - CALL(printf) - -/* - * PANIC - * Fatal error (KERNEL) - */ -#define PANIC(msg,label) \ - MSG(msg,a0,label); \ - CALL(panic) - -/* - * Register mask defines, used to define both save - * and use register sets. - * - * NOTE: The bit order should HAVE BEEN maintained when saving - * registers on the stack: sp goes at the highest - * address, gp lower on the stack, etc etc - * BUT NOONE CARES ABOUT DEBUGGERS AT MIPS - */ - -#define IM_EXC 0x80000000 -#define IM_SP 0x40000000 -#define IM_GP 0x20000000 -#define IM_AT 0x10000000 -#define IM_T12 0x08000000 -# define IM_PV IM_T4 -#define IM_RA 0x04000000 -#define IM_T11 0x02000000 -# define IM_AI IM_T3 -#define IM_T10 0x01000000 -#define IM_T9 0x00800000 -#define IM_T8 0x00400000 -#define IM_A5 0x00200000 -#define IM_A4 0x00100000 -#define IM_A3 0x00080000 -#define IM_A2 0x00040000 -#define IM_A1 0x00020000 -#define IM_A0 0x00010000 -#define IM_S6 0x00008000 -#define IM_S5 0x00004000 -#define IM_S4 0x00002000 -#define IM_S3 0x00001000 -#define IM_S2 0x00000800 -#define IM_S1 0x00000400 -#define IM_S0 0x00000200 -#define IM_T7 0x00000100 -#define IM_T6 0x00000080 -#define IM_T5 0x00000040 -#define IM_T4 0x00000020 -#define IM_T3 0x00000010 -#define IM_T2 0x00000008 -#define IM_T1 0x00000004 -#define IM_T0 0x00000002 -#define IM_V0 0x00000001 - -#define FM_T15 0x40000000 -#define FM_T14 0x20000000 -#define FM_T13 0x10000000 -#define FM_T12 0x08000000 -#define FM_T11 0x04000000 -#define FM_T10 0x02000000 -#define FM_T9 0x01000000 -#define FM_T8 0x00800000 -#define FM_T7 0x00400000 -#define FM_A5 0x00200000 -#define FM_A4 0x00100000 -#define FM_A3 0x00080000 -#define FM_A2 0x00040000 -#define FM_A1 0x00020000 -#define FM_A0 0x00010000 -#define FM_T6 0x00008000 -#define FM_T5 0x00004000 -#define FM_T4 0x00002000 -#define FM_T3 0x00001000 -#define FM_T2 0x00000800 -#define FM_T1 0x00000400 -#define FM_S7 0x00000200 -#define FM_S6 0x00000100 -#define FM_S5 0x00000080 -#define FM_S4 0x00000040 -#define FM_S3 0x00000020 -#define FM_S2 0x00000010 -#define FM_S1 0x00000008 -#define FM_S0 0x00000004 -#define FM_T0 0x00000002 -#define FM_V1 FM_T0 -#define FM_V0 0x00000001 - -/* Pull in PAL "function" codes. */ -#include <machine/pal.h> - -/* - * System call glue. - */ -#define SYSCALLNUM(name) \ - ___CONCAT(SYS_,name) - -#define CALLSYS_NOERROR(name) \ - ldiq v0, SYSCALLNUM(name); \ - call_pal PAL_OSF1_callsys - -/* - * Load the global pointer. - */ -#define LDGP(reg) \ - ldgp gp, 0(reg) - -/* - * WEAK_ALIAS: create a weak alias (ELF only). - */ -#define WEAK_ALIAS(alias,sym) \ - .weak alias; \ - alias = sym - -/* - * Kernel RCS ID tag and copyright macros - */ - -#ifdef _KERNEL - -#if !defined(lint) && !defined(NO_KERNEL_RCSIDS) -#define __KERNEL_RCSID(_n, _s) .ident _s -#else -#define __KERNEL_RCSID(_n, _s) /* nothing */ -#endif - -#endif /* _KERNEL */ - -#if !defined(lint) && !defined(STRIP_FBSDID) -#define __FBSDID(s) .ident s -#else -#define __FBSDID(s) /* nothing */ -#endif /* not lint and not STRIP_FBSDID */ - -#endif /* !_MACHINE_ASM_H_ */ diff --git a/sys/alpha/include/atomic.h b/sys/alpha/include/atomic.h deleted file mode 100644 index adae6ec..0000000 --- a/sys/alpha/include/atomic.h +++ /dev/null @@ -1,478 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_ATOMIC_H_ -#define _MACHINE_ATOMIC_H_ - -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - -#include <machine/alpha_cpu.h> - -/* - * Various simple arithmetic on memory which is atomic in the presence - * of interrupts and SMP safe. - */ - -void atomic_set_8(volatile u_int8_t *, u_int8_t); -void atomic_clear_8(volatile u_int8_t *, u_int8_t); -void atomic_add_8(volatile u_int8_t *, u_int8_t); -void atomic_subtract_8(volatile u_int8_t *, u_int8_t); - -void atomic_set_16(volatile u_int16_t *, u_int16_t); -void atomic_clear_16(volatile u_int16_t *, u_int16_t); -void atomic_add_16(volatile u_int16_t *, u_int16_t); -void atomic_subtract_16(volatile u_int16_t *, u_int16_t); - -static __inline void atomic_set_32(volatile u_int32_t *p, u_int32_t v) -{ - u_int32_t temp; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "1:\tldl_l %0, %3\n\t" /* load old value */ - "bis %0, %2, %0\n\t" /* calculate new value */ - "stl_c %0, %1\n\t" /* attempt to store */ - "beq %0, 1b\n" /* spin if failed */ - : "=&r" (temp), "=m" (*p) - : "r" (v), "m" (*p) - : "memory"); -#endif -} - -static __inline void atomic_clear_32(volatile u_int32_t *p, u_int32_t v) -{ - u_int32_t temp; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "1:\tldl_l %0, %3\n\t" /* load old value */ - "bic %0, %2, %0\n\t" /* calculate new value */ - "stl_c %0, %1\n\t" /* attempt to store */ - "beq %0, 1b\n" /* spin if failed */ - : "=&r" (temp), "=m" (*p) - : "r" (v), "m" (*p) - : "memory"); -#endif -} - -static __inline void atomic_add_32(volatile u_int32_t *p, u_int32_t v) -{ - u_int32_t temp; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "1:\tldl_l %0, %3\n\t" /* load old value */ - "addl %0, %2, %0\n\t" /* calculate new value */ - "stl_c %0, %1\n\t" /* attempt to store */ - "beq %0, 1b\n" /* spin if failed */ - : "=&r" (temp), "=m" (*p) - : "r" (v), "m" (*p) - : "memory"); -#endif -} - -static __inline void atomic_subtract_32(volatile u_int32_t *p, u_int32_t v) -{ - u_int32_t temp; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "1:\tldl_l %0, %3\n\t" /* load old value */ - "subl %0, %2, %0\n\t" /* calculate new value */ - "stl_c %0, %1\n\t" /* attempt to store */ - "beq %0, 1b\n" /* spin if failed */ - : "=&r" (temp), "=m" (*p) - : "r" (v), "m" (*p) - : "memory"); -#endif -} - -static __inline u_int32_t atomic_readandclear_32(volatile u_int32_t *addr) -{ - u_int32_t result,temp; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "wmb\n" /* ensure pending writes have drained */ - "1:\tldl_l %0,%3\n\t" /* load current value, asserting lock */ - "ldiq %1,0\n\t" /* value to store */ - "stl_c %1,%2\n\t" /* attempt to store */ - "beq %1,1b\n" /* if the store failed, spin */ - : "=&r"(result), "=&r"(temp), "=m" (*addr) - : "m" (*addr) - : "memory"); -#endif - - return result; -} - -static __inline void atomic_set_64(volatile u_int64_t *p, u_int64_t v) -{ - u_int64_t temp; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "1:\tldq_l %0, %3\n\t" /* load old value */ - "bis %0, %2, %0\n\t" /* calculate new value */ - "stq_c %0, %1\n\t" /* attempt to store */ - "beq %0, 1b\n" /* spin if failed */ - : "=&r" (temp), "=m" (*p) - : "r" (v), "m" (*p) - : "memory"); -#endif -} - -static __inline void atomic_clear_64(volatile u_int64_t *p, u_int64_t v) -{ - u_int64_t temp; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "1:\tldq_l %0, %3\n\t" /* load old value */ - "bic %0, %2, %0\n\t" /* calculate new value */ - "stq_c %0, %1\n\t" /* attempt to store */ - "beq %0, 1b\n" /* spin if failed */ - : "=&r" (temp), "=m" (*p) - : "r" (v), "m" (*p) - : "memory"); -#endif -} - -static __inline void atomic_add_64(volatile u_int64_t *p, u_int64_t v) -{ - u_int64_t temp; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "1:\tldq_l %0, %3\n\t" /* load old value */ - "addq %0, %2, %0\n\t" /* calculate new value */ - "stq_c %0, %1\n\t" /* attempt to store */ - "beq %0, 1b\n" /* spin if failed */ - : "=&r" (temp), "=m" (*p) - : "r" (v), "m" (*p) - : "memory"); -#endif -} - -static __inline void atomic_subtract_64(volatile u_int64_t *p, u_int64_t v) -{ - u_int64_t temp; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "1:\tldq_l %0, %3\n\t" /* load old value */ - "subq %0, %2, %0\n\t" /* calculate new value */ - "stq_c %0, %1\n\t" /* attempt to store */ - "beq %0, 1b\n" /* spin if failed */ - : "=&r" (temp), "=m" (*p) - : "r" (v), "m" (*p) - : "memory"); -#endif -} - -static __inline u_int64_t atomic_readandclear_64(volatile u_int64_t *addr) -{ - u_int64_t result,temp; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "wmb\n" /* ensure pending writes have drained */ - "1:\tldq_l %0,%3\n\t" /* load current value, asserting lock */ - "ldiq %1,0\n\t" /* value to store */ - "stq_c %1,%2\n\t" /* attempt to store */ - "beq %1,1b\n" /* if the store failed, spin */ - : "=&r"(result), "=&r"(temp), "=m" (*addr) - : "m" (*addr) - : "memory"); -#endif - - return result; -} - -#define ATOMIC_ACQ_REL(NAME, WIDTH) \ -static __inline void \ -atomic_##NAME##_acq_##WIDTH(volatile u_int##WIDTH##_t *p, u_int##WIDTH##_t v)\ -{ \ - atomic_##NAME##_##WIDTH(p, v); \ - alpha_mb(); \ -} \ - \ -static __inline void \ -atomic_##NAME##_rel_##WIDTH(volatile u_int##WIDTH##_t *p, u_int##WIDTH##_t v)\ -{ \ - alpha_mb(); \ - atomic_##NAME##_##WIDTH(p, v); \ -} - -/* Variants of simple arithmetic with memory barriers. */ -ATOMIC_ACQ_REL(set, 8) -ATOMIC_ACQ_REL(clear, 8) -ATOMIC_ACQ_REL(add, 8) -ATOMIC_ACQ_REL(subtract, 8) -ATOMIC_ACQ_REL(set, 16) -ATOMIC_ACQ_REL(clear, 16) -ATOMIC_ACQ_REL(add, 16) -ATOMIC_ACQ_REL(subtract, 16) -ATOMIC_ACQ_REL(set, 32) -ATOMIC_ACQ_REL(clear, 32) -ATOMIC_ACQ_REL(add, 32) -ATOMIC_ACQ_REL(subtract, 32) -ATOMIC_ACQ_REL(set, 64) -ATOMIC_ACQ_REL(clear, 64) -ATOMIC_ACQ_REL(add, 64) -ATOMIC_ACQ_REL(subtract, 64) - -#undef ATOMIC_ACQ_REL - -/* - * We assume that a = b will do atomic loads and stores. - */ -#define ATOMIC_STORE_LOAD(WIDTH) \ -static __inline u_int##WIDTH##_t \ -atomic_load_acq_##WIDTH(volatile u_int##WIDTH##_t *p) \ -{ \ - u_int##WIDTH##_t v; \ - \ - v = *p; \ - alpha_mb(); \ - return (v); \ -} \ - \ -static __inline void \ -atomic_store_rel_##WIDTH(volatile u_int##WIDTH##_t *p, u_int##WIDTH##_t v)\ -{ \ - alpha_mb(); \ - *p = v; \ -} - -ATOMIC_STORE_LOAD(32) -ATOMIC_STORE_LOAD(64) - -#undef ATOMIC_STORE_LOAD - -/* - * Atomically compare the value stored at *p with cmpval and if the - * two values are equal, update the value of *p with newval. Returns - * zero if the compare failed, nonzero otherwise. - */ -static __inline u_int32_t -atomic_cmpset_32(volatile u_int32_t* p, u_int32_t cmpval, u_int32_t newval) -{ - u_int32_t ret; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "1:\tldl_l %0, %4\n\t" /* load old value */ - "cmpeq %0, %2, %0\n\t" /* compare */ - "beq %0, 2f\n\t" /* exit if not equal */ - "mov %3, %0\n\t" /* value to store */ - "stl_c %0, %1\n\t" /* attempt to store */ - "beq %0, 1b\n\t" /* if it failed, spin */ - "2:\n" - : "=&r" (ret), "=m" (*p) - : "r" ((long)(int)cmpval), "r" (newval), "m" (*p) - : "memory"); -#endif - - return ret; -} - -/* - * Atomically compare the value stored at *p with cmpval and if the - * two values are equal, update the value of *p with newval. Returns - * zero if the compare failed, nonzero otherwise. - */ -static __inline u_int64_t -atomic_cmpset_64(volatile u_int64_t* p, u_int64_t cmpval, u_int64_t newval) -{ - u_int64_t ret; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "1:\tldq_l %0, %4\n\t" /* load old value */ - "cmpeq %0, %2, %0\n\t" /* compare */ - "beq %0, 2f\n\t" /* exit if not equal */ - "mov %3, %0\n\t" /* value to store */ - "stq_c %0, %1\n\t" /* attempt to store */ - "beq %0, 1b\n\t" /* if it failed, spin */ - "2:\n" - : "=&r" (ret), "=m" (*p) - : "r" (cmpval), "r" (newval), "m" (*p) - : "memory"); -#endif - - return ret; -} - -static __inline u_int32_t -atomic_cmpset_acq_32(volatile u_int32_t *p, u_int32_t cmpval, u_int32_t newval) -{ - int retval; - - retval = atomic_cmpset_32(p, cmpval, newval); - alpha_mb(); - return (retval); -} - -static __inline u_int32_t -atomic_cmpset_rel_32(volatile u_int32_t *p, u_int32_t cmpval, u_int32_t newval) -{ - alpha_mb(); - return (atomic_cmpset_32(p, cmpval, newval)); -} - -static __inline u_int64_t -atomic_cmpset_acq_64(volatile u_int64_t *p, u_int64_t cmpval, u_int64_t newval) -{ - int retval; - - retval = atomic_cmpset_64(p, cmpval, newval); - alpha_mb(); - return (retval); -} - -static __inline u_int64_t -atomic_cmpset_rel_64(volatile u_int64_t *p, u_int64_t cmpval, u_int64_t newval) -{ - alpha_mb(); - return (atomic_cmpset_64(p, cmpval, newval)); -} - -/* - * Atomically add the value of v to the integer pointed to by p and return - * the previous value of *p. - */ -static __inline u_int -atomic_fetchadd_32(volatile u_int32_t *p, u_int32_t v) -{ - u_int32_t value, temp; - -#ifdef __GNUCLIKE_ASM - __asm __volatile ( - "1:\tldl_l %0, %1\n\t" /* load old value */ - "addl %0, %3, %2\n\t" /* calculate new value */ - "stl_c %2, %1\n\t" /* attempt to store */ - "beq %2, 1b\n" /* spin if failed */ - : "=&r" (value), "=m" (*p), "=r" (temp) - : "r" (v), "m" (*p)); -#endif - return (value); -} - -/* Operations on chars. */ -#define atomic_set_char atomic_set_8 -#define atomic_set_acq_char atomic_set_acq_8 -#define atomic_set_rel_char atomic_set_rel_8 -#define atomic_clear_char atomic_clear_8 -#define atomic_clear_acq_char atomic_clear_acq_8 -#define atomic_clear_rel_char atomic_clear_rel_8 -#define atomic_add_char atomic_add_8 -#define atomic_add_acq_char atomic_add_acq_8 -#define atomic_add_rel_char atomic_add_rel_8 -#define atomic_subtract_char atomic_subtract_8 -#define atomic_subtract_acq_char atomic_subtract_acq_8 -#define atomic_subtract_rel_char atomic_subtract_rel_8 - -/* Operations on shorts. */ -#define atomic_set_short atomic_set_16 -#define atomic_set_acq_short atomic_set_acq_16 -#define atomic_set_rel_short atomic_set_rel_16 -#define atomic_clear_short atomic_clear_16 -#define atomic_clear_acq_short atomic_clear_acq_16 -#define atomic_clear_rel_short atomic_clear_rel_16 -#define atomic_add_short atomic_add_16 -#define atomic_add_acq_short atomic_add_acq_16 -#define atomic_add_rel_short atomic_add_rel_16 -#define atomic_subtract_short atomic_subtract_16 -#define atomic_subtract_acq_short atomic_subtract_acq_16 -#define atomic_subtract_rel_short atomic_subtract_rel_16 - -/* Operations on ints. */ -#define atomic_set_int atomic_set_32 -#define atomic_set_acq_int atomic_set_acq_32 -#define atomic_set_rel_int atomic_set_rel_32 -#define atomic_clear_int atomic_clear_32 -#define atomic_clear_acq_int atomic_clear_acq_32 -#define atomic_clear_rel_int atomic_clear_rel_32 -#define atomic_add_int atomic_add_32 -#define atomic_add_acq_int atomic_add_acq_32 -#define atomic_add_rel_int atomic_add_rel_32 -#define atomic_subtract_int atomic_subtract_32 -#define atomic_subtract_acq_int atomic_subtract_acq_32 -#define atomic_subtract_rel_int atomic_subtract_rel_32 -#define atomic_cmpset_int atomic_cmpset_32 -#define atomic_cmpset_acq_int atomic_cmpset_acq_32 -#define atomic_cmpset_rel_int atomic_cmpset_rel_32 -#define atomic_load_acq_int atomic_load_acq_32 -#define atomic_store_rel_int atomic_store_rel_32 -#define atomic_readandclear_int atomic_readandclear_32 -#define atomic_fetchadd_int atomic_fetchadd_32 - -/* Operations on longs. */ -#define atomic_set_long atomic_set_64 -#define atomic_set_acq_long atomic_set_acq_64 -#define atomic_set_rel_long atomic_set_rel_64 -#define atomic_clear_long atomic_clear_64 -#define atomic_clear_acq_long atomic_clear_acq_64 -#define atomic_clear_rel_long atomic_clear_rel_64 -#define atomic_add_long atomic_add_64 -#define atomic_add_acq_long atomic_add_acq_64 -#define atomic_add_rel_long atomic_add_rel_64 -#define atomic_subtract_long atomic_subtract_64 -#define atomic_subtract_acq_long atomic_subtract_acq_64 -#define atomic_subtract_rel_long atomic_subtract_rel_64 -#define atomic_cmpset_long atomic_cmpset_64 -#define atomic_cmpset_acq_long atomic_cmpset_acq_64 -#define atomic_cmpset_rel_long atomic_cmpset_rel_64 -#define atomic_load_acq_long atomic_load_acq_64 -#define atomic_store_rel_long atomic_store_rel_64 -#define atomic_readandclear_long atomic_readandclear_64 - -/* Operations on pointers. */ -#define atomic_set_ptr atomic_set_64 -#define atomic_set_acq_ptr atomic_set_acq_64 -#define atomic_set_rel_ptr atomic_set_rel_64 -#define atomic_clear_ptr atomic_clear_64 -#define atomic_clear_acq_ptr atomic_clear_acq_64 -#define atomic_clear_rel_ptr atomic_clear_rel_64 -#define atomic_add_ptr atomic_add_64 -#define atomic_add_acq_ptr atomic_add_acq_64 -#define atomic_add_rel_ptr atomic_add_rel_64 -#define atomic_subtract_ptr atomic_subtract_64 -#define atomic_subtract_acq_ptr atomic_subtract_acq_64 -#define atomic_subtract_rel_ptr atomic_subtract_rel_64 -#define atomic_cmpset_ptr atomic_cmpset_64 -#define atomic_cmpset_acq_ptr atomic_cmpset_acq_64 -#define atomic_cmpset_rel_ptr atomic_cmpset_rel_64 -#define atomic_load_acq_ptr atomic_load_acq_64 -#define atomic_store_rel_ptr atomic_store_rel_64 -#define atomic_readandclear_ptr atomic_readandclear_64 - -#endif /* ! _MACHINE_ATOMIC_H_ */ diff --git a/sys/alpha/include/bootinfo.h b/sys/alpha/include/bootinfo.h deleted file mode 100644 index 1548cd0..0000000 --- a/sys/alpha/include/bootinfo.h +++ /dev/null @@ -1,86 +0,0 @@ -/* $FreeBSD$ */ -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -/* - * The boot program passes a pointer (in the boot environment virtual - * address address space; "BEVA") to a bootinfo to the kernel using - * the following convention: - * - * a0 contains first free page frame number - * a1 contains page number of current level 1 page table - * if a2 contains BOOTINFO_MAGIC and a4 is nonzero: - * a3 contains pointer (BEVA) to bootinfo - * a4 contains bootinfo version number - * if a2 contains BOOTINFO_MAGIC and a4 contains 0 (backward compat): - * a3 contains pointer (BEVA) to bootinfo version - * (u_long), then the bootinfo - */ - -#define BOOTINFO_MAGIC 0xdeadbeeffeedface - -struct bootinfo_v1 { - u_long ssym; /* 0: start of kernel sym table */ - u_long esym; /* 8: end of kernel sym table */ - char boot_flags[64]; /* 16: boot flags */ - char booted_kernel[64]; /* 80: name of booted kernel */ - void *hwrpb; /* 144: hwrpb pointer (BEVA) */ - u_long hwrpbsize; /* 152: size of hwrpb data */ - int (*cngetc)(void); /* 160: console getc pointer */ - void (*cnputc)(int); /* 168: console putc pointer */ - void (*cnpollc)(int); /* 176: console pollc pointer */ - u_long pad[6]; /* 184: rsvd for future use */ - char *envp; /* 232: start of environment */ - u_long kernend; /* 240: end of kernel */ - u_long modptr; /* 248: FreeBSD module base */ - /* 256: total size */ -}; - -/* - * 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 modptr; /* FreeBSD module pointer */ - u_long kernend; /* "end of kernel" from boot code */ - char *envp; /* "end of kernel" from boot code */ - 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 deleted file mode 100644 index bfd5c55..0000000 --- a/sys/alpha/include/bus.h +++ /dev/null @@ -1,480 +0,0 @@ -/* $NetBSD: bus.h,v 1.12 1997/10/01 08:25:15 fvdl Exp $ */ - -/*- - * Copyright (c) 1996, 1997 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 Charles M. Hannum. All rights reserved. - * 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. - */ -/* $FreeBSD$ */ - -#ifndef _ALPHA_BUS_H_ -#define _ALPHA_BUS_H_ - -#include <machine/_bus.h> - -#define BUS_SPACE_MAXSIZE_24BIT 0xFFFFFF -#define BUS_SPACE_MAXSIZE_32BIT 0xFFFFFFFF -#define BUS_SPACE_MAXSIZE 0xFFFFFFFFFFFFFFFF -#define BUS_SPACE_MAXADDR_24BIT 0xFFFFFF -#define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFF -/* The largest address space known so far is 40 bits */ -#define BUS_SPACE_MAXADDR 0xFFFFFFFFFUL - -#define BUS_SPACE_UNRESTRICTED (~0) - -/* - * Map a region of device bus space into CPU virtual address space. - */ - -static __inline int bus_space_map(bus_space_tag_t t, bus_addr_t addr, - bus_size_t size, int flags, - bus_space_handle_t *bshp); - -static __inline int -bus_space_map(bus_space_tag_t t __unused, bus_addr_t addr, - bus_size_t size __unused, int flags __unused, - bus_space_handle_t *bshp) -{ - - *bshp = addr; - return (0); -} - -/* - * Unmap a region of device bus space. - */ - -static __inline void bus_space_unmap(bus_space_tag_t t, bus_space_handle_t bsh, - bus_size_t size); - -static __inline void -bus_space_unmap(bus_space_tag_t t __unused, bus_space_handle_t bsh __unused, - bus_size_t size __unused) -{ -} - - -/* - * Get a new handle for a subregion of an already-mapped area of bus space. - */ - -static __inline int bus_space_subregion(bus_space_tag_t t, - bus_space_handle_t bsh, - bus_size_t offset, bus_size_t size, - bus_space_handle_t *nbshp); - -static __inline int -bus_space_subregion(bus_space_tag_t t __unused, bus_space_handle_t bsh, - bus_size_t offset, bus_size_t size __unused, - bus_space_handle_t *nbshp) -{ - - *nbshp = bsh + offset; - return (0); -} - - -struct alpha_busspace; - -struct alpha_busspace_ops { - u_int8_t (*abo_read_1)(struct alpha_busspace *space, size_t offset); - u_int16_t (*abo_read_2)(struct alpha_busspace *space, size_t offset); - u_int32_t (*abo_read_4)(struct alpha_busspace *space, size_t offset); - - void (*abo_read_multi_1)(struct alpha_busspace *space, - size_t offset, - u_int8_t *addr, size_t count); - void (*abo_read_multi_2)(struct alpha_busspace *space, - size_t offset, - u_int16_t *addr, size_t count); - void (*abo_read_multi_4)(struct alpha_busspace *space, - size_t offset, - u_int32_t *addr, size_t count); - - void (*abo_read_region_1)(struct alpha_busspace *space, - size_t offset, - u_int8_t *addr, size_t count); - void (*abo_read_region_2)(struct alpha_busspace *space, - size_t offset, - u_int16_t *addr, size_t count); - void (*abo_read_region_4)(struct alpha_busspace *space, - size_t offset, - u_int32_t *addr, size_t count); - - void (*abo_write_1)(struct alpha_busspace *space, size_t offset, - u_int8_t value); - void (*abo_write_2)(struct alpha_busspace *space, size_t offset, - u_int16_t value); - void (*abo_write_4)(struct alpha_busspace *space, size_t offset, - u_int32_t value); - - void (*abo_write_multi_1)(struct alpha_busspace *space, - size_t offset, - const u_int8_t *addr, size_t count); - void (*abo_write_multi_2)(struct alpha_busspace *space, - size_t offset, - const u_int16_t *addr, size_t count); - void (*abo_write_multi_4)(struct alpha_busspace *space, - size_t offset, - const u_int32_t *addr, size_t count); - - void (*abo_write_region_1)(struct alpha_busspace *space, - size_t offset, - const u_int8_t *addr, size_t count); - void (*abo_write_region_2)(struct alpha_busspace *space, - size_t offset, - const u_int16_t *addr, size_t count); - void (*abo_write_region_4)(struct alpha_busspace *space, - size_t offset, - const u_int32_t *addr, size_t count); - - void (*abo_set_multi_1)(struct alpha_busspace *space, size_t offset, - u_int8_t value, size_t count); - void (*abo_set_multi_2)(struct alpha_busspace *space, size_t offset, - u_int16_t value, size_t count); - void (*abo_set_multi_4)(struct alpha_busspace *space, size_t offset, - u_int32_t value, size_t count); - - void (*abo_set_region_1)(struct alpha_busspace *space, - size_t offset, - u_int8_t value, size_t count); - void (*abo_set_region_2)(struct alpha_busspace *space, - size_t offset, - u_int16_t value, size_t count); - void (*abo_set_region_4)(struct alpha_busspace *space, - size_t offset, - u_int32_t value, size_t count); - - void (*abo_copy_region_1)(struct alpha_busspace *space, - size_t offset1, size_t offset2, - size_t count); - void (*abo_copy_region_2)(struct alpha_busspace *space, - size_t offset1, size_t offset2, - size_t count); - void (*abo_copy_region_4)(struct alpha_busspace *space, - size_t offset1, size_t offset2, - size_t count); - - void (*abo_barrier)(struct alpha_busspace *space, size_t offset, - size_t len, int flags); -}; - -struct alpha_busspace { - struct alpha_busspace_ops *ab_ops; -}; - -/* Back-compat functions for old ISA drivers */ - -extern struct alpha_busspace *busspace_isa_io; -extern struct alpha_busspace *busspace_isa_mem; - -#define inb(o) bus_space_read_1(busspace_isa_io, o, 0) -#define inw(o) bus_space_read_2(busspace_isa_io, o, 0) -#define inl(o) bus_space_read_4(busspace_isa_io, o, 0) -#define outb(o, v) bus_space_write_1(busspace_isa_io, o, 0, v) -#define outw(o, v) bus_space_write_2(busspace_isa_io, o, 0, v) -#define outl(o, v) bus_space_write_4(busspace_isa_io, o, 0, v) - -#define readb(o) bus_space_read_1(busspace_isa_mem, o, 0) -#define readw(o) bus_space_read_2(busspace_isa_mem, o, 0) -#define readl(o) bus_space_read_4(busspace_isa_mem, o, 0) -#define writeb(o, v) bus_space_write_1(busspace_isa_mem, o, 0, v) -#define writew(o, v) bus_space_write_2(busspace_isa_mem, o, 0, v) -#define writel(o, v) bus_space_write_4(busspace_isa_mem, o, 0, v) - -#define insb(o, a, c) bus_space_read_multi_1(busspace_isa_io, o, 0, \ - (void*)(a), c) -#define insw(o, a, c) bus_space_read_multi_2(busspace_isa_io, o, 0, \ - (void*)(a), c) -#define insl(o, a, c) bus_space_read_multi_4(busspace_isa_io, o, 0, \ - (void*)(a), c) - -#define outsb(o, a, c) bus_space_write_multi_1(busspace_isa_io, o, 0, \ - (void*)(a), c) -#define outsw(o, a, c) bus_space_write_multi_2(busspace_isa_io, o, 0, \ - (void*)(a), c) -#define outsl(o, a, c) bus_space_write_multi_4(busspace_isa_io, o, 0, \ - (void*)(a), c) - -#define memcpy_fromio(d, s, c) \ - bus_space_read_region_1(busspace_isa_mem, (uintptr_t)(s), 0, d, c) -#define memcpy_toio(d, s, c) \ - bus_space_write_region_1(busspace_isa_mem, (uintptr_t)(d), 0, s, c) -#define memcpy_io(d, s, c) \ - bus_space_copy_region_1(busspace_isa_mem, (uintptr_t)(s), 0, d, 0, c) -#define memset_io(d, v, c) \ - bus_space_set_region_1(busspace_isa_mem, (uintptr_t)(d), 0, v, c) -#define memsetw_io(d, v, c) \ - bus_space_set_region_2(busspace_isa_mem, (uintptr_t)(d), 0, v, c) - -static __inline void -memsetw(void *d, int val, size_t size) -{ - u_int16_t *sp = d; - - while (size--) - *sp++ = val; -} - -void busspace_generic_read_multi_1(struct alpha_busspace *space, - size_t offset, - u_int8_t *addr, size_t count); -void busspace_generic_read_multi_2(struct alpha_busspace *space, - size_t offset, - u_int16_t *addr, size_t count); -void busspace_generic_read_multi_4(struct alpha_busspace *space, - size_t offset, - u_int32_t *addr, size_t count); -void busspace_generic_read_region_1(struct alpha_busspace *space, - size_t offset, - u_int8_t *addr, size_t count); -void busspace_generic_read_region_2(struct alpha_busspace *space, - size_t offset, - u_int16_t *addr, size_t count); -void busspace_generic_read_region_4(struct alpha_busspace *space, - size_t offset, - u_int32_t *addr, size_t count); -void busspace_generic_write_multi_1(struct alpha_busspace *space, - size_t offset, - const u_int8_t *addr, size_t count); -void busspace_generic_write_multi_2(struct alpha_busspace *space, - size_t offset, - const u_int16_t *addr, size_t count); -void busspace_generic_write_multi_4(struct alpha_busspace *space, - size_t offset, - const u_int32_t *addr, size_t count); -void busspace_generic_write_region_1(struct alpha_busspace *space, - size_t offset, - const u_int8_t *addr, size_t count); -void busspace_generic_write_region_2(struct alpha_busspace *space, - size_t offset, - const u_int16_t *addr, size_t count); -void busspace_generic_write_region_4(struct alpha_busspace *space, - size_t offset, - const u_int32_t *addr, size_t count); -void busspace_generic_set_multi_1(struct alpha_busspace *space, - size_t offset, - u_int8_t value, size_t count); -void busspace_generic_set_multi_2(struct alpha_busspace *space, - size_t offset, - u_int16_t value, size_t count); -void busspace_generic_set_multi_4(struct alpha_busspace *space, - size_t offset, - u_int32_t value, size_t count); -void busspace_generic_set_region_1(struct alpha_busspace *space, - size_t offset, - u_int8_t value, size_t count); -void busspace_generic_set_region_2(struct alpha_busspace *space, - size_t offset, - u_int16_t value, size_t count); -void busspace_generic_set_region_4(struct alpha_busspace *space, - size_t offset, - u_int32_t value, size_t count); -void busspace_generic_copy_region_1(struct alpha_busspace *space, - size_t offset1, - size_t offset2, - size_t count); -void busspace_generic_copy_region_2(struct alpha_busspace *space, - size_t offset1, - size_t offset2, - size_t count); -void busspace_generic_copy_region_4(struct alpha_busspace *space, - size_t offset1, - size_t offset2, - size_t count); -void busspace_generic_barrier(struct alpha_busspace *space, - size_t offset, size_t len, - int flags); - -#define BUS_SPACE_BARRIER_READ 0x01 /* force read barrier */ -#define BUS_SPACE_BARRIER_WRITE 0x02 /* force write barrier */ - -#define bus_space_read_1(t, h, o) \ - (t)->ab_ops->abo_read_1(t, (h)+(o)) -#define bus_space_read_2(t, h, o) \ - (t)->ab_ops->abo_read_2(t, (h)+(o)) -#define bus_space_read_4(t, h, o) \ - (t)->ab_ops->abo_read_4(t, (h)+(o)) -#define bus_space_read_multi_1(t, h, o, a, c) \ - (t)->ab_ops->abo_read_multi_1(t, (h)+(o), a, c) -#define bus_space_read_multi_2(t, h, o, a, c) \ - (t)->ab_ops->abo_read_multi_2(t, (h)+(o), a, c) -#define bus_space_read_multi_4(t, h, o, a, c) \ - (t)->ab_ops->abo_read_multi_4(t, (h)+(o), a, c) -#define bus_space_read_region_1(t, h, o, a, c) \ - (t)->ab_ops->abo_read_region_1(t, (h)+(o), a, c) -#define bus_space_read_region_2(t, h, o, a, c) \ - (t)->ab_ops->abo_read_region_2(t, (h)+(o), a, c) -#define bus_space_read_region_4(t, h, o, a, c) \ - (t)->ab_ops->abo_read_region_4(t, (h)+(o), a, c) - -#define bus_space_write_1(t, h, o, v) \ - (t)->ab_ops->abo_write_1(t, (h)+(o), v) -#define bus_space_write_2(t, h, o, v) \ - (t)->ab_ops->abo_write_2(t, (h)+(o), v) -#define bus_space_write_4(t, h, o, v) \ - (t)->ab_ops->abo_write_4(t, (h)+(o), v) -#define bus_space_write_multi_1(t, h, o, a, c) \ - (t)->ab_ops->abo_write_multi_1(t, (h)+(o), a, c) -#define bus_space_write_multi_2(t, h, o, a, c) \ - (t)->ab_ops->abo_write_multi_2(t, (h)+(o), a, c) -#define bus_space_write_multi_4(t, h, o, a, c) \ - (t)->ab_ops->abo_write_multi_4(t, (h)+(o), a, c) -#define bus_space_write_region_1(t, h, o, a, c) \ - (t)->ab_ops->abo_write_region_1(t, (h)+(o), a, c) -#define bus_space_write_region_2(t, h, o, a, c) \ - (t)->ab_ops->abo_write_region_2(t, (h)+(o), a, c) -#define bus_space_write_region_4(t, h, o, a, c) \ - (t)->ab_ops->abo_write_region_4(t, (h)+(o), a, c) -#define bus_space_set_multi_1(t, h, o, v, c) \ - (t)->ab_ops->abo_set_multi_1(t, (h)+(o), v, c) -#define bus_space_set_multi_2(t, h, o, v, c) \ - (t)->ab_ops->abo_set_multi_2(t, (h)+(o), v, c) -#define bus_space_set_multi_4(t, h, o, v, c) \ - (t)->ab_ops->abo_set_multi_4(t, (h)+(o), v, c) -#define bus_space_set_region_1(t, h, o, v, c) \ - (t)->ab_ops->abo_set_region_1(t, (h)+(o), v, c) -#define bus_space_set_region_2(t, h, o, v, c) \ - (t)->ab_ops->abo_set_region_2(t, (h)+(o), v, c) -#define bus_space_set_region_4(t, h, o, v, c) \ - (t)->ab_ops->abo_set_region_4(t, (h)+(o), v, c) - -#define bus_space_copy_region_1(t, h1, o1, h2, o2, c) \ - (t)->ab_ops->abo_copy_region_1(t, (h1)+(o1), (h2)+(o2), c) -#define bus_space_copy_region_2(t, h1, o1, h2, o2, c) \ - (t)->ab_ops->abo_copy_region_2(t, (h1)+(o1), (h2)+(o2), c) -#define bus_space_copy_region_4(t, h1, o1, h2, o2, c) \ - (t)->ab_ops->abo_copy_region_4(t, (h1)+(o1), (h2)+(o2), c) - -#define bus_space_barrier(t, h, o, l, f) \ - (t)->ab_ops->abo_barrier(t, (h)+(o), l, f) - -/* - * Stream accesses are the same as normal accesses on alpha; there are no - * supported bus systems with an endianess different from the host one. - */ -#define bus_space_read_stream_1(t, h, o) bus_space_read_1((t), (h), (o)) -#define bus_space_read_stream_2(t, h, o) bus_space_read_2((t), (h), (o)) -#define bus_space_read_stream_4(t, h, o) bus_space_read_4((t), (h), (o)) - -#define bus_space_read_multi_stream_1(t, h, o, a, c) \ - bus_space_read_multi_1((t), (h), (o), (a), (c)) -#define bus_space_read_multi_stream_2(t, h, o, a, c) \ - bus_space_read_multi_2((t), (h), (o), (a), (c)) -#define bus_space_read_multi_stream_4(t, h, o, a, c) \ - bus_space_read_multi_4((t), (h), (o), (a), (c)) - -#define bus_space_write_stream_1(t, h, o, v) \ - bus_space_write_1((t), (h), (o), (v)) -#define bus_space_write_stream_2(t, h, o, v) \ - bus_space_write_2((t), (h), (o), (v)) -#define bus_space_write_stream_4(t, h, o, v) \ - bus_space_write_4((t), (h), (o), (v)) - -#define bus_space_write_multi_stream_1(t, h, o, a, c) \ - bus_space_write_multi_1((t), (h), (o), (a), (c)) -#define bus_space_write_multi_stream_2(t, h, o, a, c) \ - bus_space_write_multi_2((t), (h), (o), (a), (c)) -#define bus_space_write_multi_stream_4(t, h, o, a, c) \ - bus_space_write_multi_4((t), (h), (o), (a), (c)) - -#define bus_space_set_multi_stream_1(t, h, o, v, c) \ - bus_space_set_multi_1((t), (h), (o), (v), (c)) -#define bus_space_set_multi_stream_2(t, h, o, v, c) \ - bus_space_set_multi_2((t), (h), (o), (v), (c)) -#define bus_space_set_multi_stream_4(t, h, o, v, c) \ - bus_space_set_multi_4((t), (h), (o), (v), (c)) - -#define bus_space_read_region_stream_1(t, h, o, a, c) \ - bus_space_read_region_1((t), (h), (o), (a), (c)) -#define bus_space_read_region_stream_2(t, h, o, a, c) \ - bus_space_read_region_2((t), (h), (o), (a), (c)) -#define bus_space_read_region_stream_4(t, h, o, a, c) \ - bus_space_read_region_4((t), (h), (o), (a), (c)) - -#define bus_space_write_region_stream_1(t, h, o, a, c) \ - bus_space_write_region_1((t), (h), (o), (a), (c)) -#define bus_space_write_region_stream_2(t, h, o, a, c) \ - bus_space_write_region_2((t), (h), (o), (a), (c)) -#define bus_space_write_region_stream_4(t, h, o, a, c) \ - bus_space_write_region_4((t), (h), (o), (a), (c)) - -#define bus_space_set_region_stream_1(t, h, o, v, c) \ - bus_space_set_region_1((t), (h), (o), (v), (c)) -#define bus_space_set_region_stream_2(t, h, o, v, c) \ - bus_space_set_region_2((t), (h), (o), (v), (c)) -#define bus_space_set_region_stream_4(t, h, o, v, c) \ - bus_space_set_region_4((t), (h), (o), (v), (c)) - -#define bus_space_copy_region_stream_1(t, h1, o1, h2, o2, c) \ - bus_space_copy_region_1((t), (h1), (o1), (h2), (o2), (c)) -#define bus_space_copy_region_stream_2(t, h1, o1, h2, o2, c) \ - bus_space_copy_region_2((t), (h1), (o1), (h2), (o2), (c)) -#define bus_space_copy_region_stream_4(t, h1, o1, h2, o2, c) \ - bus_space_copy_region_4((t), (h1), (o1), (h2), (o2), (c)) - -#include <machine/bus_dma.h> - -#endif /* _ALPHA_BUS_H_ */ diff --git a/sys/alpha/include/bus_dma.h b/sys/alpha/include/bus_dma.h deleted file mode 100644 index 141fff0..0000000 --- a/sys/alpha/include/bus_dma.h +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * Copyright (c) 2005 Scott Long - * 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. - */ -/* $FreeBSD$ */ - -#ifndef _ALPHA_BUS_DMA_H_ -#define _ALPHA_BUS_DMA_H_ - -#include <sys/bus_dma.h> - -#endif /* _ALPHA_BUS_DMA_H_ */ diff --git a/sys/alpha/include/bwx.h b/sys/alpha/include/bwx.h deleted file mode 100644 index bb2866b..0000000 --- a/sys/alpha/include/bwx.h +++ /dev/null @@ -1,117 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_BWX_H_ -#define _MACHINE_BWX_H_ - -/* - * Byte/word accesses must be made with particular values for addr<37,38> - */ -#define BWX_EV56_INT8 (0L << 37) -#define BWX_EV56_INT4 (1L << 37) -#define BWX_EV56_INT2 (2L << 37) -#define BWX_EV56_INT1 (3L << 37) - -static __inline u_int8_t -ldbu(vm_offset_t va) -{ - u_int64_t r; - __asm__ __volatile__ ("ldbu %0,%1" : "=r"(r) : "m"(*(u_int8_t*)va)); - return r; -} - -static __inline u_int16_t -ldwu(vm_offset_t va) -{ - u_int64_t r; - __asm__ __volatile__ ("ldwu %0,%1" : "=r"(r) : "m"(*(u_int16_t*)va)); - return r; -} - -static __inline u_int32_t -ldl(vm_offset_t va) -{ - return *(u_int32_t*) va; -} - -static __inline void -stb(vm_offset_t va, u_int64_t r) -{ - __asm__ __volatile__ ("stb %1,%0" : "=m"(*(u_int8_t*)va) : "r"(r)); - __asm__ __volatile__ ("mb"); -} - -static __inline void -stw(vm_offset_t va, u_int64_t r) -{ - __asm__ __volatile__ ("stw %1,%0" : "=m"(*(u_int16_t*)va) : "r"(r)); - __asm__ __volatile__ ("mb"); -} - - -static __inline void -stl(vm_offset_t va, u_int64_t r) -{ - __asm__ __volatile__ ("stl %1,%0" : "=m"(*(u_int32_t*)va) : "r"(r)); - __asm__ __volatile__ ("mb"); -} - -static __inline void -stb_nb(vm_offset_t va, u_int64_t r) -{ - __asm__ __volatile__ ("stb %1,%0" : "=m"(*(u_int8_t*)va) : "r"(r)); -} - -static __inline void -stw_nb(vm_offset_t va, u_int64_t r) -{ - __asm__ __volatile__ ("stw %1,%0" : "=m"(*(u_int16_t*)va) : "r"(r)); -} - -static __inline void -stl_nb(vm_offset_t va, u_int64_t r) -{ - __asm__ __volatile__ ("stl %1,%0" : "=m"(*(u_int32_t*)va) : "r"(r)); -} - -#ifdef _KERNEL - -/* - * A kernel object for accessing memory-like spaces (port and - * memory spaces) using BWX instructions. - */ -struct bwx_space { - struct alpha_busspace_ops *ops; - u_int64_t base; /* base address of space */ -}; - -void bwx_init_space(struct bwx_space *bwx, u_int64_t base); - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_BWX_H_ */ diff --git a/sys/alpha/include/chipset.h b/sys/alpha/include/chipset.h deleted file mode 100644 index 54031a5..0000000 --- a/sys/alpha/include/chipset.h +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_CHIPSET_H_ -#define _MACHINE_CHIPSET_H_ - -typedef u_int64_t alpha_chipset_read_hae_t(void); -typedef void alpha_chipset_write_hae_t(u_int64_t); - -struct sgmap; - -typedef struct alpha_chipset { - /* - * Access the HAE register - */ - alpha_chipset_read_hae_t* read_hae; - alpha_chipset_write_hae_t* write_hae; - - /* - * Scatter-Gather map for ISA dma. - */ - struct sgmap* sgmap; - - /* - * Scatter-Gather map for PCI dma. - */ - struct sgmap* pci_sgmap; - - /* - * direct map - */ - long dmsize; - long dmoffset; -} alpha_chipset_t; - -extern alpha_chipset_t chipset; - -/* - * Exported sysctl variables describing the PCI chipset. - */ -extern char chipset_type[10]; -extern int chipset_bwx; -extern long chipset_ports; -extern long chipset_memory; -extern long chipset_dense; -extern long chipset_hae_mask; - -#endif /* !_MACHINE_CHIPSET_H_ */ diff --git a/sys/alpha/include/clock.h b/sys/alpha/include/clock.h deleted file mode 100644 index 31eca15..0000000 --- a/sys/alpha/include/clock.h +++ /dev/null @@ -1,24 +0,0 @@ -/*- - * Kernel interface to machine-dependent clock driver. - * Garrett Wollman, September 1994. - * This file is in the public domain. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_CLOCK_H_ -#define _MACHINE_CLOCK_H_ - -#ifdef _KERNEL - -extern int disable_rtc_set; -extern int wall_cmos_clock; -extern int adjkerntz; - -int sysbeep(int pitch, int period); -int acquire_timer2(int mode); -int release_timer2(void); - -#endif - -#endif /* !_MACHINE_CLOCK_H_ */ diff --git a/sys/alpha/include/clockvar.h b/sys/alpha/include/clockvar.h deleted file mode 100644 index 89b3619..0000000 --- a/sys/alpha/include/clockvar.h +++ /dev/null @@ -1,53 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: clockvar.h,v 1.4 1997/06/22 08:02:18 jonathan Exp $ */ - -/*- - * Copyright (c) 1994, 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. - */ - -/* - * Definitions for cpu-independent clock handling for the alpha and pmax. - */ - -/* - * clocktime structure: - * - * structure passed to TOY clocks when setting them. broken out this - * way, so that the time_t -> field conversion can be shared. - */ -struct clocktime { - int year; /* year - 1900 */ - int mon; /* month (1 - 12) */ - int day; /* day (1 - 31) */ - int hour; /* hour (0 - 23) */ - int min; /* minute (0 - 59) */ - int sec; /* second (0 - 59) */ - int dow; /* day of week (0 - 6; 0 = Sunday) */ -}; - -#include "clock_if.h" - -void clockattach(device_t); diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h deleted file mode 100644 index f881915..0000000 --- a/sys/alpha/include/cpu.h +++ /dev/null @@ -1,83 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: cpu.h,v 1.18 1997/09/23 23:17:49 mjacob Exp */ - -/*- - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1982, 1990, 1993 - * 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. - * 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: Utah $Hdr: cpu.h 1.16 91/03/25$ - * - * @(#)cpu.h 8.4 (Berkeley) 1/5/94 - */ - -#ifndef _ALPHA_CPU_H_ -#define _ALPHA_CPU_H_ - -/* - * Exported definitions unique to Alpha cpu support. - */ - -#include <machine/frame.h> - -#define TRAPF_USERMODE(framep) \ - (((framep)->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0) -#define TRAPF_PC(framep) ((framep)->tf_regs[FRAME_PC]) - -/* - * CTL_MACHDEP definitions. - */ -#define CPU_ROOT_DEVICE 2 /* string: root device name */ -#define CPU_UNALIGNED_PRINT 3 /* int: print unaligned accesses */ -#define CPU_UNALIGNED_FIX 4 /* int: fix unaligned accesses */ -#define CPU_UNALIGNED_SIGBUS 5 /* int: SIGBUS unaligned accesses */ -#define CPU_BOOTED_KERNEL 6 /* string: booted kernel name */ - -#ifdef _KERNEL - -#ifdef GPROF -extern char btext[]; -extern char etext[]; -#endif - -#define cpu_getstack(td) (alpha_pal_rdusp()) -#define cpu_spinwait() /* nothing */ -#define get_cyclecount() read_cycle_count() - -void cpu_halt(void); -void cpu_reset(void); -void fork_trampoline(void); /* MAGIC */ -uint64_t read_cycle_count(void); -void swi_vm(void *); - -#endif /* _KERNEL */ - -#endif /* _ALPHA_CPU_H_ */ diff --git a/sys/alpha/include/cpuconf.h b/sys/alpha/include/cpuconf.h deleted file mode 100644 index 6f1ccc3..0000000 --- a/sys/alpha/include/cpuconf.h +++ /dev/null @@ -1,135 +0,0 @@ -/* $FreeBSD$ */ -/* $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 */ -struct resource; /* 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)(void); - void (*device_register)(struct device *, void *); - void (*iointr)(void *, unsigned long); - void (*clockintr)(int, uintfptr_t); - void (*mcheck_handler)(unsigned long, struct trapframe *, - unsigned long, unsigned long); - void (*cpu_idle)(void); - void (*pci_intr_init)(void); - void (*pci_intr_map)(void *); - int (*pci_intr_route)(struct device *, struct device *, int); - void (*pci_intr_disable)(int); - void (*pci_intr_enable)(int); - int (*pci_setup_ide_intr)(struct device *dev, - struct device *child, - int chan, void (*fn)(void*), void *arg); - int (*isa_setup_intr)(struct device *, struct device *, - struct resource *, int, void *, void *, void **); - int (*isa_teardown_intr)(struct device *, struct device *, - struct resource *, void *); -} 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)(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(void); -const char *alpha_variation_name(u_int64_t variation, - const struct alpha_variation_table *avtp); -const char *alpha_unknown_sysname(void); - -extern struct cpuinit cpuinit[]; -extern struct cpuinit api_cpuinit[]; -extern int ncpuinit; -extern int napi_cpuinit; -extern void platform_not_configured(int); -extern void platform_not_supported(int); - -#endif /* _KERNEL */ -#endif /* !_ALPHA_CPUCONF_H */ diff --git a/sys/alpha/include/cpufunc.h b/sys/alpha/include/cpufunc.h deleted file mode 100644 index 5979987..0000000 --- a/sys/alpha/include/cpufunc.h +++ /dev/null @@ -1,68 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_CPUFUNC_H_ -#define _MACHINE_CPUFUNC_H_ - -#ifdef _KERNEL - -#include <sys/types.h> -#include <machine/chipset.h> -#include <machine/alpha_cpu.h> - -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - -struct thread; - -#if defined(__GNUCLIKE_ASM) - -static __inline void -breakpoint(void) -{ - __asm __volatile("call_pal 0x81"); /* XXX bugchk */ -} - -#endif - -static __inline register_t -intr_disable(void) -{ - return (alpha_pal_swpipl(ALPHA_PSL_IPL_MCES)); -} - -static __inline void -intr_restore(register_t ipl) -{ - alpha_pal_swpipl(ipl); -} - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_CPUFUNC_H_ */ diff --git a/sys/alpha/include/db_machdep.h b/sys/alpha/include/db_machdep.h deleted file mode 100644 index f72b2b0..0000000 --- a/sys/alpha/include/db_machdep.h +++ /dev/null @@ -1,100 +0,0 @@ -/* $FreeBSD$ */ -/* $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_ - -#include <sys/param.h> -#include <vm/vm.h> -#include <machine/frame.h> - -#define DB_NO_AOUT - -typedef vm_offset_t db_addr_t; /* address - unsigned */ -typedef long db_expr_t; /* expression - signed */ - -#define PC_REGS() ((db_addr_t)kdb_thrctx->pcb_context[7]) - -#define BKPT_INST 0x00000080 /* breakpoint instruction */ -#define BKPT_SIZE (4) /* size of breakpoint inst */ -#define BKPT_SET(inst) (BKPT_INST) - -#define FIXUP_PC_AFTER_BREAK (kdb_frame->tf_regs[FRAME_PC] -= BKPT_SIZE); - -#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(int inst); -boolean_t db_inst_return(int inst); -boolean_t db_inst_call(int inst); -boolean_t db_inst_branch(int inst); -boolean_t db_inst_load(int inst); -boolean_t db_inst_store(int inst); -boolean_t db_inst_unconditional_flow_transfer(int inst); -db_addr_t db_branch_taken(int inst, db_addr_t pc); - -#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) db_branch_taken(ins, pc) - -/* No delay slots on Alpha. */ -#define next_instr_address(v, b) ((db_addr_t) ((b) ? (v) : ((v) + 4))) - -u_long db_register_value(int); - -/* - * 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_ELFSIZE 64 - -#endif /* _ALPHA_DB_MACHDEP_H_ */ diff --git a/sys/alpha/include/elf.h b/sys/alpha/include/elf.h deleted file mode 100644 index a0fb706..0000000 --- a/sys/alpha/include/elf.h +++ /dev/null @@ -1,138 +0,0 @@ -/*- - * Copyright (c) 1996-1997 John D. Polstra. - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_ELF_H_ -#define _MACHINE_ELF_H_ 1 - -/* - * ELF definitions for the alpha architecture. - */ - -#include <sys/elf64.h> /* Definitions common to all 64 bit architectures. */ - -#define __ELF_WORD_SIZE 64 /* Used by <sys/elf_generic.h> */ -#include <sys/elf_generic.h> - -#define ELF_ARCH EM_ALPHA - -#define ELF_MACHINE_OK(x) ((x) == EM_ALPHA) - -/* - * Auxiliary vector entries for passing information to the interpreter. - * - * The i386 supplement to the SVR4 ABI specification names this "auxv_t", - * but POSIX lays claim to all symbols ending with "_t". - */ - -typedef struct { /* Auxiliary vector entry on initial stack */ - 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; -} Elf64_Auxinfo; - -__ElfType(Auxinfo); - -/* Values for a_type. */ -#define AT_NULL 0 /* Terminates the vector. */ -#define AT_IGNORE 1 /* Ignored entry. */ -#define AT_EXECFD 2 /* File descriptor of program to load. */ -#define AT_PHDR 3 /* Program header of program already loaded. */ -#define AT_PHENT 4 /* Size of each program header entry. */ -#define AT_PHNUM 5 /* Number of program header entries. */ -#define AT_PAGESZ 6 /* Page size in bytes. */ -#define AT_BASE 7 /* Interpreter's base address. */ -#define AT_FLAGS 8 /* Flags (unused for i386). */ -#define AT_ENTRY 9 /* Where interpreter should transfer control. */ - -/* - * The following non-standard values are used for passing information - * from John Polstra's testbed program to the dynamic linker. These - * are expected to go away soon. - * - * Unfortunately, these overlap the Linux non-standard values, so they - * must not be used in the same context. - */ -#define AT_BRK 10 /* Starting point for sbrk and brk. */ -#define AT_DEBUG 11 /* Debugging level. */ - -/* - * The following non-standard values are used in Linux ELF binaries. - */ -#define AT_NOTELF 10 /* Program is not ELF ?? */ -#define AT_UID 11 /* Real uid. */ -#define AT_EUID 12 /* Effective uid. */ -#define AT_GID 13 /* Real gid. */ -#define AT_EGID 14 /* Effective gid. */ - -#define AT_COUNT 15 /* Count of defined aux entry types. */ - -/* - * Relocation types. - */ - -#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_ALPHA_COUNT 28 - -/* Define "machine" characteristics */ -#define ELF_TARG_CLASS ELFCLASS64 -#define ELF_TARG_DATA ELFDATA2LSB -#define ELF_TARG_MACH EM_ALPHA -#define ELF_TARG_VER 1 - -#endif /* !_MACHINE_ELF_H_ */ diff --git a/sys/alpha/include/endian.h b/sys/alpha/include/endian.h deleted file mode 100644 index 974ce16..0000000 --- a/sys/alpha/include/endian.h +++ /dev/null @@ -1,127 +0,0 @@ -/*- - * Copyright (c) 1987, 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 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. - * - * @(#)endian.h 8.1 (Berkeley) 6/10/93 - * $NetBSD: endian.h,v 1.5 1997/10/09 15:42:19 bouyer Exp $ - * $FreeBSD$ - */ - -#ifndef _MACHINE_ENDIAN_H_ -#define _MACHINE_ENDIAN_H_ - -#include <sys/cdefs.h> -#include <sys/_types.h> - -/* - * Define the order of 32-bit words in 64-bit words. - */ -#define _QUAD_HIGHWORD 1 -#define _QUAD_LOWWORD 0 - -/* - * Definitions for byte order, according to byte significance from low - * address to high. - */ -#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ -#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ -#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ - -#define _BYTE_ORDER _LITTLE_ENDIAN - -/* - * Deprecated variants that don't have enough underscores to be useful in more - * strict namespaces. - */ -#if __BSD_VISIBLE -#define LITTLE_ENDIAN _LITTLE_ENDIAN -#define BIG_ENDIAN _BIG_ENDIAN -#define PDP_ENDIAN _PDP_ENDIAN -#define BYTE_ORDER _BYTE_ORDER -#endif - -#if defined(__CC_SUPPORTS___INLINE) && defined(__GNUCLIKE_ASM) - -static __inline __uint64_t -__bswap64(__uint64_t _x) -{ - - return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) | - ((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) | - ((_x << 24) & ((__uint64_t)0xff << 40)) | - ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))); -} - -static __inline __uint32_t -__bswap32(__uint32_t _x) -{ - __uint32_t __r; - - __asm __volatile__ ( - "insbl %1, 3, $1\n\t" - "extbl %1, 1, $2\n\t" - "extbl %1, 2, $3\n\t" - "extbl %1, 3, $4\n\t" - "sll $2, 16, $2\n\t" - "sll $3, 8, $3\n\t" - "or $4, $1, %0\n\t" - "or $2, $3, $2\n\t" - "or $2, %0, %0" - : "=r" (__r) : "r" (_x) : "$1", "$2", "$3", "$4"); - return (__r); -} - -static __inline __uint16_t -__bswap16(__uint16_t _x) -{ - __uint16_t __r; - - __asm __volatile__ ( - "insbl %1, 1, $1\n\t" - "extbl %1, 1, $2\n\t" - "or $1, $2, %0" - : "=r" (__r) : "r" (_x) : "$1", "$2"); - return (__r); -} - -#define __htonl(x) __bswap32(x) -#define __htons(x) __bswap16(x) -#define __ntohl(x) __bswap32(x) -#define __ntohs(x) __bswap16(x) - -#else /* !(__CC_SUPPORTS___INLINE && __GNUCLIKE_ASM) */ - -/* - * No optimizations are available for this compiler. Fall back to - * non-optimized functions by defining the constant usually used to prevent - * redefinition. - */ -#define _BYTEORDER_FUNC_DEFINED - -#endif /* __CC_SUPPORTS___INLINE && __GNUCLIKE_ASM */ - -#endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/sys/alpha/include/exec.h b/sys/alpha/include/exec.h deleted file mode 100644 index e3aa1fe..0000000 --- a/sys/alpha/include/exec.h +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. - * 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 John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_EXEC_H_ -#define _MACHINE_EXEC_H_ - -#define __LDPGSZ 8192 - -#endif /* !_MACHINE_EXEC_H_ */ diff --git a/sys/alpha/include/float.h b/sys/alpha/include/float.h deleted file mode 100644 index e2fb31d..0000000 --- a/sys/alpha/include/float.h +++ /dev/null @@ -1,79 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: float.h,v 1.6 1997/07/17 21:36:03 thorpej Exp */ - -/*- - * Copyright (c) 1989, 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. - * 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. - */ - -#ifndef _ALPHA_FLOAT_H_ -#define _ALPHA_FLOAT_H_ - -#include <sys/cdefs.h> - -__BEGIN_DECLS -int __flt_rounds(void); -__END_DECLS - -#define FLT_RADIX 2 /* b */ -#define FLT_ROUNDS __flt_rounds() -#if __ISO_C_VISIBLE >= 1999 -#define FLT_EVAL_METHOD 0 /* no promotions */ -#define DECIMAL_DIG 17 /* max precision in decimal digits */ -#endif - -#define FLT_MANT_DIG 24 /* p */ -#define FLT_EPSILON 1.19209290E-07F /* b**(1-p) */ -#define FLT_DIG 6 /* floor((p-1)*log10(b))+(b == 10) */ -#define FLT_MIN_EXP -125 /* emin */ -#define FLT_MIN 1.17549435E-38F /* b**(emin-1) */ -#define FLT_MIN_10_EXP -37 /* ceil(log10(b**(emin-1))) */ -#define FLT_MAX_EXP 128 /* emax */ -#define FLT_MAX 3.40282347E+38F /* (1-b**(-p))*b**emax */ -#define FLT_MAX_10_EXP 38 /* floor(log10((1-b**(-p))*b**emax)) */ - -#define DBL_MANT_DIG 53 -#define DBL_EPSILON 2.2204460492503131E-16 -#define DBL_DIG 15 -#define DBL_MIN_EXP -1021 -#define DBL_MIN 2.2250738585072014E-308 -#define DBL_MIN_10_EXP -307 -#define DBL_MAX_EXP 1024 -#define DBL_MAX 1.7976931348623157E+308 -#define DBL_MAX_10_EXP 308 - -#define LDBL_MANT_DIG DBL_MANT_DIG -#define LDBL_EPSILON DBL_EPSILON -#define LDBL_DIG DBL_DIG -#define LDBL_MIN_EXP DBL_MIN_EXP -#define LDBL_MIN DBL_MIN -#define LDBL_MIN_10_EXP DBL_MIN_10_EXP -#define LDBL_MAX_EXP DBL_MAX_EXP -#define LDBL_MAX DBL_MAX -#define LDBL_MAX_10_EXP DBL_MAX_10_EXP - -#endif /* _ALPHA_FLOAT_H_ */ diff --git a/sys/alpha/include/floatingpoint.h b/sys/alpha/include/floatingpoint.h deleted file mode 100644 index 22a9f48..0000000 --- a/sys/alpha/include/floatingpoint.h +++ /dev/null @@ -1,35 +0,0 @@ -/*- - * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. - * 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 John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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. - * - * $FreeBSD$ - */ - -#include <machine/ieeefp.h> diff --git a/sys/alpha/include/fpu.h b/sys/alpha/include/fpu.h deleted file mode 100644 index ad539e9..0000000 --- a/sys/alpha/include/fpu.h +++ /dev/null @@ -1,124 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_FPU_H_ -#define _MACHINE_FPU_H_ - -/* - * Floating point control register bits. - * - * From Alpha AXP Architecture Reference Manual, Instruction - * Descriptions (I) PP 4-69. - */ - -#define FPCR_INVD (1LL << 49) /* Invalid Operation DIsable */ -#define FPCR_DZED (1LL << 50) /* Division by Zero Disable */ -#define FPCR_OVFD (1LL << 51) /* Overflow Disable */ -#define FPCR_INV (1LL << 52) /* Invalid Operation */ -#define FPCR_DZE (1LL << 53) /* Division by Zero */ -#define FPCR_OVF (1LL << 54) /* Overflow */ -#define FPCR_UNF (1LL << 55) /* Underflow */ -#define FPCR_INE (1LL << 56) /* Inexact Result */ -#define FPCR_IOV (1LL << 57) /* Integer Overflow */ -#define FPCR_DYN_CHOPPED (0LL << 58) /* Chopped rounding mode */ -#define FPCR_DYN_MINUS (1LL << 58) /* Minus infinity */ -#define FPCR_DYN_NORMAL (2LL << 58) /* Normal rounding */ -#define FPCR_DYN_PLUS (3LL << 58) /* Plus infinity */ -#define FPCR_DYN_MASK (3LL << 58) /* Rounding mode mask */ -#define FPCR_DYN_SHIFT 58 -#define FPCR_UNDZ (1LL << 60) /* Underflow to Zero */ -#define FPCR_UNFD (1LL << 61) /* Underflow Disable */ -#define FPCR_INED (1LL << 62) /* Inexact Disable */ -#define FPCR_SUM (1LL << 63) /* Summary Bit */ -#define FPCR_MASK (~0LL << 49) -#define FPCR_STATUS_MASK (FPCR_INV | FPCR_DZE | FPCR_OVF | \ - FPCR_UNF | FPCR_INE | FPCR_IOV) - -/* - * Exception summary bits. - * - * From Alpha AXP Architecture Reference Manual, DEC OSF/1 Exceptions - * and Interrupts (II-B) PP 5-5. - */ - -#define EXCSUM_SWC (1LL << 0) /* Software completion */ -#define EXCSUM_INV (1LL << 1) /* Invalid operation */ -#define EXCSUM_DZE (1LL << 2) /* Division by zero */ -#define EXCSUM_OVF (1LL << 3) /* Overflow */ -#define EXCSUM_UNF (1LL << 4) /* Underflow */ -#define EXCSUM_INE (1LL << 5) /* Inexact result */ -#define EXCSUM_IOV (1LL << 6) /* Integer overflow */ - -/* - * Definitions for IEEE trap enables. These are implemented in - * software and should be compatible with OSF/1 and Linux. - */ - -/* read/write flags */ -#define IEEE_TRAP_ENABLE_INV (1LL << 1) /* Invalid operation */ -#define IEEE_TRAP_ENABLE_DZE (1LL << 2) /* Division by zero */ -#define IEEE_TRAP_ENABLE_OVF (1LL << 3) /* Overflow */ -#define IEEE_TRAP_ENABLE_UNF (1LL << 4) /* Underflow */ -#define IEEE_TRAP_ENABLE_INE (1LL << 5) /* Inexact result */ -#define IEEE_TRAP_ENABLE_MASK (IEEE_TRAP_ENABLE_INV \ - | IEEE_TRAP_ENABLE_DZE \ - | IEEE_TRAP_ENABLE_OVF \ - | IEEE_TRAP_ENABLE_UNF \ - | IEEE_TRAP_ENABLE_INE) - -/* read only flags */ -#define IEEE_STATUS_INV (1LL << 17) /* Invalid operation */ -#define IEEE_STATUS_DZE (1LL << 18) /* Division by zero */ -#define IEEE_STATUS_OVF (1LL << 19) /* Overflow */ -#define IEEE_STATUS_UNF (1LL << 20) /* Underflow */ -#define IEEE_STATUS_INE (1LL << 21) /* Inexact result */ -#define IEEE_STATUS_MASK (IEEE_STATUS_INV \ - | IEEE_STATUS_DZE \ - | IEEE_STATUS_OVF \ - | IEEE_STATUS_UNF \ - | IEEE_STATUS_INE) -#define IEEE_STATUS_TO_EXCSUM_SHIFT 16 /* convert to excsum */ -#define IEEE_STATUS_TO_FPCR_SHIFT 35 /* convert to fpcr */ - -#define IEEE_INHERIT (1LL << 63) /* inherit on fork */ - -/* read and write floating point control register */ -#define GET_FPCR(x) \ - __asm__("trapb"); \ - __asm__("mf_fpcr %0" : "=f" (x)); \ - __asm__("trapb") -#define SET_FPCR(x) \ - __asm__("trapb"); \ - __asm__("mt_fpcr %0" : : "f" (x)); \ - __asm__("trapb") - -#ifdef _KERNEL -extern int fp_software_completion(u_int64_t regmask, struct thread *td); -#endif - -#endif /* ! _MACHINE_FPU_H_ */ diff --git a/sys/alpha/include/frame.h b/sys/alpha/include/frame.h deleted file mode 100644 index 050f383..0000000 --- a/sys/alpha/include/frame.h +++ /dev/null @@ -1,101 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: frame.h,v 1.4 1997/04/06 08:47:27 cgd Exp */ - -/*- - * Copyright (c) 1994, 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_FRAME_H_ -#define _ALPHA_FRAME_H_ - -#include <machine/alpha_cpu.h> - -/* - * Software trap, exception, and syscall frame. - * - * Includes "hardware" (PALcode) frame. - * - * PALcode puts ALPHA_HWFRAME_* fields on stack. We have to add - * all of the general-purpose registers except for zero, for sp - * (which is automatically saved in the PCB's USP field for entries - * from user mode, and which is implicitly saved and restored by the - * calling conventions for entries from kernel mode), and (on traps - * and exceptions) for a0, a1, and a2 (which are saved by PALcode). - */ - -/* Quadword offsets of the registers to be saved. */ -#define FRAME_V0 0 -#define FRAME_T0 1 -#define FRAME_T1 2 -#define FRAME_T2 3 -#define FRAME_T3 4 -#define FRAME_T4 5 -#define FRAME_T5 6 -#define FRAME_T6 7 -#define FRAME_T7 8 -#define FRAME_S0 9 -#define FRAME_S1 10 -#define FRAME_S2 11 -#define FRAME_S3 12 -#define FRAME_S4 13 -#define FRAME_S5 14 -#define FRAME_S6 15 -#define FRAME_A3 16 -#define FRAME_A4 17 -#define FRAME_A5 18 -#define FRAME_T8 19 -#define FRAME_T9 20 -#define FRAME_T10 21 -#define FRAME_T11 22 -#define FRAME_RA 23 -#define FRAME_T12 24 -#define FRAME_AT 25 -#define FRAME_SP 26 -#define FRAME_FLAGS 27 -#define FRAME_FLAGS_SYSCALL 1 /* partial frame for syscalls */ -/* The following are set only when a signal is to be delivered to a process. */ -#define FRAME_TRAPARG_A0 28 -#define FRAME_TRAPARG_A1 29 -#define FRAME_TRAPARG_A2 30 - -#define FRAME_SW_SIZE (FRAME_TRAPARG_A2 + 1) -#define FRAME_HW_OFFSET FRAME_SW_SIZE - -#define FRAME_PS (FRAME_HW_OFFSET + ALPHA_HWFRAME_PS) -#define FRAME_PC (FRAME_HW_OFFSET + ALPHA_HWFRAME_PC) -#define FRAME_GP (FRAME_HW_OFFSET + ALPHA_HWFRAME_GP) -#define FRAME_A0 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A0) -#define FRAME_A1 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A1) -#define FRAME_A2 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A2) - -#define FRAME_HW_SIZE ALPHA_HWFRAME_SIZE -#define FRAME_SIZE (FRAME_HW_OFFSET + FRAME_HW_SIZE) - -struct trapframe { - unsigned long tf_regs[FRAME_SIZE]; /* See above */ -}; - -#endif /* _ALPHA_FRAME_H_ */ diff --git a/sys/alpha/include/gdb_machdep.h b/sys/alpha/include/gdb_machdep.h deleted file mode 100644 index 7518bd5..0000000 --- a/sys/alpha/include/gdb_machdep.h +++ /dev/null @@ -1,52 +0,0 @@ -/*- - * Copyright (c) 2004 Marcel Moolenaar - * 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 ``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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_GDB_MACHDEP_H_ -#define _MACHINE_GDB_MACHDEP_H_ - -#define GDB_BUFSZ 600 -#define GDB_NREGS 67 -#define GDB_REG_PC 64 - -static __inline size_t -gdb_cpu_regsz(int regnum) -{ - return (sizeof(long)); -} - -static __inline int -gdb_cpu_query(void) -{ - return (0); -} - -void *gdb_cpu_getreg(int, size_t *); -void gdb_cpu_setreg(int, void *); -int gdb_cpu_signal(int, int); - -#endif /* !_MACHINE_GDB_MACHDEP_H_ */ diff --git a/sys/alpha/include/ieee.h b/sys/alpha/include/ieee.h deleted file mode 100644 index 0b1f631..0000000 --- a/sys/alpha/include/ieee.h +++ /dev/null @@ -1,115 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: ieee.h,v 1.2 1997/04/06 08:47:27 cgd Exp */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * 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. - * 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. - * - * @(#)ieee.h 8.1 (Berkeley) 6/11/93 - * - * from: Header: ieee.h,v 1.7 92/11/26 02:04:37 torek Exp - */ - -/* - * ieee.h defines the machine-dependent layout of the machine's IEEE - * floating point. It does *not* define (yet?) any of the rounding - * mode bits, exceptions, and so forth. - */ - -/* - * Define the number of bits in each fraction and exponent. - * - * k k+1 - * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented - * - * (-exp_bias+1) - * as fractions that look like 0.fffff x 2 . This means that - * - * -126 - * the number 0.10000 x 2 , for instance, is the same as the normalized - * - * -127 -128 - * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero - * - * -129 - * in the fraction; to represent 2 , we need two, and so on. This - * - * (-exp_bias-fracbits+1) - * implies that the smallest denormalized number is 2 - * - * for whichever format we are talking about: for single precision, for - * - * -126 -149 - * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and - * - * -149 == -127 - 23 + 1. - */ -#define SNG_EXPBITS 8 -#define SNG_FRACBITS 23 - -#define DBL_EXPBITS 11 -#define DBL_FRACBITS 52 - -struct ieee_single { - u_int sng_frac:23; - u_int sng_exp:8; - u_int sng_sign:1; -}; - -struct ieee_double { - u_int dbl_fracl; - u_int dbl_frach:20; - u_int dbl_exp:11; - u_int dbl_sign:1; -}; - -/* - * Floats whose exponent is in [1..INFNAN) (of whatever type) are - * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. - * Floats whose exponent is zero are either zero (iff all fraction - * bits are zero) or subnormal values. - * - * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its - * high fraction; if the bit is set, it is a `quiet NaN'. - */ -#define SNG_EXP_INFNAN 255 -#define DBL_EXP_INFNAN 2047 - -#if 0 -#define SNG_QUIETNAN (1 << 22) -#define DBL_QUIETNAN (1 << 19) -#endif - -/* - * Exponent biases. - */ -#define SNG_EXP_BIAS 127 -#define DBL_EXP_BIAS 1023 diff --git a/sys/alpha/include/ieeefp.h b/sys/alpha/include/ieeefp.h deleted file mode 100644 index 6fb419e..0000000 --- a/sys/alpha/include/ieeefp.h +++ /dev/null @@ -1,29 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: ieeefp.h,v 1.2 1997/04/06 08:47:28 cgd Exp */ - -/*- - * Written by J.T. Conklin, Apr 28, 1995 - * Public domain. - */ - -#ifndef _ALPHA_IEEEFP_H_ -#define _ALPHA_IEEEFP_H_ - -typedef int fp_except_t; -#define FP_X_INV (1LL << 1) /* invalid operation exception */ -#define FP_X_DZ (1LL << 2) /* divide-by-zero exception */ -#define FP_X_OFL (1LL << 3) /* overflow exception */ -#define FP_X_UFL (1LL << 4) /* underflow exception */ -#define FP_X_IMP (1LL << 5) /* imprecise(inexact) exception */ -#if 0 -#define FP_X_IOV (1LL << 6) /* integer overflow XXX? */ -#endif - -typedef enum { - FP_RZ=0, /* round to zero (truncate) */ - FP_RM=1, /* round toward negative infinity */ - FP_RN=2, /* round to nearest representable number */ - FP_RP=3 /* round toward positive infinity */ -} fp_rnd_t; - -#endif /* _ALPHA_IEEEFP_H_ */ diff --git a/sys/alpha/include/in_cksum.h b/sys/alpha/include/in_cksum.h deleted file mode 100644 index 0992006..0000000 --- a/sys/alpha/include/in_cksum.h +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * 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. - * 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 - * $FreeBSD$ - */ - -#ifndef _MACHINE_IN_CKSUM_H_ -#define _MACHINE_IN_CKSUM_H_ 1 - -#include <sys/cdefs.h> - -#define in_cksum(m, len) in_cksum_skip(m, len, 0) - -/* - * 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 __CC_SUPPORTS___INLINE - -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 - -#ifdef _KERNEL -u_int in_cksum_hdr(const struct ip *ip); -u_short in_addword(u_short sum, u_short b); -u_short in_pseudo(u_int sum, u_int b, u_int c); -u_short in_cksum_skip(struct mbuf *m, int len, int skip); -#endif - -#endif /* _MACHINE_IN_CKSUM_H_ */ diff --git a/sys/alpha/include/inst.h b/sys/alpha/include/inst.h deleted file mode 100644 index b4088bc..0000000 --- a/sys/alpha/include/inst.h +++ /dev/null @@ -1,462 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_INST_H_ -#define _MACHINE_INST_H_ - -union alpha_instruction { - u_int32_t word; - struct { - u_int32_t argument : 26; - u_int32_t opcode : 6; -#define op_call_pal 0x00 -#define op_lda 0x08 -#define op_ldah 0x09 -#define op_ldbu 0x0a -#define op_unop 0x0b -#define op_ldq_u 0x0b -#define op_ldwu 0x0c -#define op_stw 0x0d -#define op_stb 0x0e -#define op_stq_u 0x0f -#define op_inta 0x10 -#define inta_addl 0x00 -#define inta_s4addl 0x02 -#define inta_subl 0x09 -#define inta_s4subl 0x0b -#define inta_cmpbge 0x0f -#define inta_s8addl 0x12 -#define inta_s8subl 0x1b -#define inta_cmpult 0x1d -#define inta_addq 0x20 -#define inta_s4addq 0x22 -#define inta_subq 0x29 -#define inta_s4subq 0x2b -#define inta_cmpeq 0x2d -#define inta_s8addq 0x32 -#define inta_s8subq 0x3b -#define inta_cmpule 0x3d -#define inta_addlv 0x40 -#define inta_sublv 0x49 -#define inta_cmplt 0x4d -#define inta_addqv 0x60 -#define inta_subqv 0x69 -#define inta_cmple 0x6d -#define op_intl 0x11 -#define intl_and 0x00 -#define intl_andnot 0x08 -#define intl_bic 0x08 -#define intl_cmovlbs 0x14 -#define intl_cmovlbc 0x16 -#define intl_or 0x20 -#define intl_bis 0x20 -#define intl_cmoveq 0x24 -#define intl_cmovne 0x26 -#define intl_ornot 0x28 -#define intl_xor 0x40 -#define intl_cmovlt 0x44 -#define intl_cmovge 0x46 -#define intl_eqv 0x48 -#define intl_amask 0x61 -#define intl_cmovle 0x64 -#define intl_cmovgt 0x66 -#define intl_implver 0x6c -#define op_ints 0x12 -#define ints_mskbl 0x02 -#define ints_extbl 0x06 -#define ints_insbl 0x0b -#define ints_mskwl 0x12 -#define ints_extwl 0x16 -#define ints_inswl 0x1b -#define ints_mskll 0x22 -#define ints_extll 0x26 -#define ints_insll 0x2b -#define ints_zap 0x30 -#define ints_zapnot 0x31 -#define ints_mskql 0x32 -#define ints_srl 0x34 -#define ints_extql 0x36 -#define ints_sll 0x39 -#define ints_insql 0x3b -#define ints_sra 0x3c -#define ints_mskwh 0x52 -#define ints_inswh 0x57 -#define ints_extwh 0x5a -#define ints_msklh 0x62 -#define ints_inslh 0x67 -#define ints_extlh 0x6a -#define ints_mskqh 0x72 -#define ints_insqh 0x77 -#define ints_extqh 0x7a -#define op_intm 0x13 -#define intm_mull 0x00 -#define intm_mulq 0x20 -#define intm_umulh 0x30 -#define intm_mullv 0x40 -#define intm_mulqv 0x60 -#define op_opc14 0x14 -#define op_fltv 0x15 -#define op_flti 0x16 -#define flti_addsc 0x000 -#define flti_subsc 0x001 -#define flti_mulsc 0x002 -#define flti_divsc 0x003 -#define flti_addtc 0x020 -#define flti_subtc 0x021 -#define flti_multc 0x022 -#define flti_divtc 0x023 -#define flti_cvttsc 0x02c -#define flti_cvttqc 0x02f -#define flti_cvtqsc 0x03c -#define flti_cvtqtc 0x03e - -#define flti_addsm 0x040 -#define flti_subsm 0x041 -#define flti_mulsm 0x042 -#define flti_divsm 0x043 -#define flti_addtm 0x060 -#define flti_subtm 0x061 -#define flti_multm 0x062 -#define flti_divtm 0x063 -#define flti_cvttsm 0x06c -#define flti_cvttqm 0x06f -#define flti_cvtqsm 0x07c -#define flti_cvtqtm 0x07e - -#define flti_adds 0x080 -#define flti_subs 0x081 -#define flti_muls 0x082 -#define flti_divs 0x083 - -#define flti_addt 0x0a0 -#define flti_subt 0x0a1 -#define flti_mult 0x0a2 -#define flti_divt 0x0a3 -#define flti_cmptun 0x0a4 -#define flti_cmpteq 0x0a5 -#define flti_cmptlt 0x0a6 -#define flti_cmptle 0x0a7 -#define flti_cvtts 0x0ac -#define flti_cvttq 0x0af -#define flti_cvtqs 0x0bc -#define flti_cvtqt 0x0be - -#define flti_addsd 0x0c0 -#define flti_subsd 0x0c1 -#define flti_mulsd 0x0c2 -#define flti_divsd 0x0c3 -#define flti_addtd 0x0e0 -#define flti_subtd 0x0e1 -#define flti_multd 0x0e2 -#define flti_divtd 0x0e3 -#define flti_cvttsd 0x0ec -#define flti_cvttqd 0x0ef -#define flti_cvtqsd 0x0fc -#define flti_cvtqtd 0x0fe - -#define flti_addsuc 0x100 -#define flti_subsuc 0x101 -#define flti_mulsuc 0x102 -#define flti_divsuc 0x103 -#define flti_addtuc 0x120 -#define flti_subtuc 0x121 -#define flti_multuc 0x122 -#define flti_divtuc 0x123 -#define flti_cvttsuc 0x12c -#define flti_cvttqvc 0x12f - -#define flti_addsum 0x140 -#define flti_subsum 0x141 -#define flti_mulsum 0x142 -#define flti_divsum 0x143 -#define flti_addtum 0x160 -#define flti_subtum 0x161 -#define flti_multum 0x162 -#define flti_divtum 0x163 -#define flti_cvttsum 0x16c -#define flti_cvttqvm 0x16f - -#define flti_addsu 0x180 -#define flti_subsu 0x181 -#define flti_mulsu 0x182 -#define flti_divsu 0x183 -#define flti_addtu 0x1a0 -#define flti_subtu 0x1a1 -#define flti_multu 0x1a2 -#define flti_divtu 0x1a3 -#define flti_cvttsu 0x1ac -#define flti_cvttqv 0x1af - -#define flti_addsud 0x1c0 -#define flti_subsud 0x1c1 -#define flti_mulsud 0x1c2 -#define flti_divsud 0x1c3 -#define flti_addtud 0x1e0 -#define flti_subtud 0x1e1 -#define flti_multud 0x1e2 -#define flti_divtud 0x1e3 -#define flti_cvttsud 0x1ec -#define flti_cvttqvd 0x1ef - -#define flti_cvtst 0x2ac - -#define flti_addssuc 0x500 -#define flti_subssuc 0x501 -#define flti_mulssuc 0x502 -#define flti_divssuc 0x503 -#define flti_addtsuc 0x520 -#define flti_subtsuc 0x521 -#define flti_multsuc 0x522 -#define flti_divtsuc 0x523 -#define flti_cvttssuc 0x52c -#define flti_cvttqsvc 0x52f - -#define flti_addssum 0x540 -#define flti_subssum 0x541 -#define flti_mulssum 0x542 -#define flti_divssum 0x543 -#define flti_addtsum 0x560 -#define flti_subtsum 0x561 -#define flti_multsum 0x562 -#define flti_divtsum 0x563 -#define flti_cvttssum 0x56c -#define flti_cvttqsvm 0x56f - -#define flti_addssu 0x580 -#define flti_subssu 0x581 -#define flti_mulssu 0x582 -#define flti_divssu 0x583 -#define flti_addtsu 0x5a0 -#define flti_subtsu 0x5a1 -#define flti_multsu 0x5a2 -#define flti_divtsu 0x5a3 -#define flti_cmptunsu 0x5a4 -#define flti_cmpteqsu 0x5a5 -#define flti_cmptltsu 0x5a6 -#define flti_cmptlesu 0x5a7 -#define flti_cvttssu 0x5ac -#define flti_cvttqsv 0x5af - -#define flti_addssud 0x5c0 -#define flti_subssud 0x5c1 -#define flti_mulssud 0x5c2 -#define flti_divssud 0x5c3 -#define flti_addtsud 0x5e0 -#define flti_subtsud 0x5e1 -#define flti_multsud 0x5e2 -#define flti_divtsud 0x5e3 -#define flti_cvttssud 0x5ec -#define flti_cvttqsvd 0x5ef - -#define flti_cvtsts 0x6ac - -#define flti_addssuic 0x700 -#define flti_subssuic 0x701 -#define flti_mulssuic 0x702 -#define flti_divssuic 0x703 -#define flti_addtsuic 0x720 -#define flti_subtsuic 0x721 -#define flti_multsuic 0x722 -#define flti_divtsuic 0x723 -#define flti_cvttssuic 0x72c -#define flti_cvttqsvic 0x72f -#define flti_cvtqssuic 0x73c -#define flti_cvtqtsuic 0x73e - -#define flti_addssuim 0x740 -#define flti_subssuim 0x741 -#define flti_mulssuim 0x742 -#define flti_divssuim 0x743 -#define flti_addtsuim 0x760 -#define flti_subtsuim 0x761 -#define flti_multsuim 0x762 -#define flti_divtsuim 0x763 -#define flti_cvttssuim 0x76c -#define flti_cvttqsvim 0x76f -#define flti_cvtqssuim 0x77c -#define flti_cvtqtsuim 0x77e - -#define flti_addssui 0x780 -#define flti_subssui 0x781 -#define flti_mulssui 0x782 -#define flti_divssui 0x783 -#define flti_addtsui 0x7a0 -#define flti_subtsui 0x7a1 -#define flti_multsui 0x7a2 -#define flti_divtsui 0x7a3 -#define flti_cmptunsui 0x7a4 -#define flti_cmpteqsui 0x7a5 -#define flti_cmptltsui 0x7a6 -#define flti_cmptlesui 0x7a7 -#define flti_cvttssui 0x7ac -#define flti_cvttqsvi 0x7af -#define flti_cvtqssui 0x7bc -#define flti_cvtqtsui 0x7bc - -#define flti_addssuid 0x7c0 -#define flti_subssuid 0x7c1 -#define flti_mulssuid 0x7c2 -#define flti_divssuid 0x7c3 -#define flti_addtsuid 0x7e0 -#define flti_subtsuid 0x7e1 -#define flti_multsuid 0x7e2 -#define flti_divtsuid 0x7e3 -#define flti_cvttssuid 0x7ec -#define flti_cvttqsvid 0x7ef -#define flti_cvtqssuid 0x7fc -#define flti_cvtqtsuid 0x7fc - -#define op_fltl 0x17 -#define fltl_cvtlq 0x010 -#define fltl_cpys 0x020 -#define fltl_cpysn 0x021 -#define fltl_cpyse 0x022 -#define fltl_mt_fpcr 0x024 -#define fltl_mf_fpcr 0x025 -#define fltl_fcmoveq 0x02a -#define fltl_fcmovne 0x02b -#define fltl_fcmovlt 0x02c -#define fltl_fcmovge 0x02d -#define fltl_fcmovle 0x02e -#define fltl_fcmovgt 0x02f -#define fltl_cvtql 0x030 -#define fltl_cvtqlv 0x130 -#define fltl_cvtqlsv 0x530 - -#define op_misc 0x18 -#define misc_trapb 0x0000 -#define misc_excb 0x0400 -#define misc_mb 0x4000 -#define misc_wmb 0x4400 -#define misc_fetch 0x8000 -#define misc_fetch_m 0xa000 -#define misc_rpcc 0xc000 -#define misc_rc 0xe000 -#define misc_ecb 0xe800 -#define misc_rs 0xf000 -#define misc_wh64 0xf800 - -#define op_pal19 0x19 -#define op_jsr 0x1a -#define op_pal1b 0x1b -#define op_pal1c 0x1c -#define op_pal1d 0x1d -#define op_pal1e 0x1e -#define op_pal1f 0x1f -#define op_ldf 0x20 -#define op_ldg 0x21 -#define op_lds 0x22 -#define op_ldt 0x23 -#define op_stf 0x24 -#define op_stg 0x25 -#define op_sts 0x26 -#define op_stt 0x27 -#define op_ldl 0x28 -#define op_ldq 0x29 -#define op_ldl_l 0x2a -#define op_ldq_l 0x2b -#define op_stl 0x2c -#define op_stq 0x2d -#define op_stl_c 0x2e -#define op_stq_c 0x2f -#define op_br 0x30 -#define op_fbeq 0x31 -#define op_fblt 0x32 -#define op_fble 0x33 -#define op_bsr 0x34 -#define op_fbne 0x35 -#define op_fbge 0x36 -#define op_fbgt 0x37 -#define op_blbc 0x38 -#define op_beq 0x39 -#define op_blt 0x3a -#define op_ble 0x3b -#define op_blbs 0x3c -#define op_bne 0x3d -#define op_bge 0x3e -#define op_bgt 0x3f - } common; - struct { - u_int32_t function : 16; - u_int32_t rb : 5; - u_int32_t ra : 5; - u_int32_t opcode : 6; - } memory_format; - struct { - u_int32_t hint : 14; - u_int32_t function : 2; -#define jsr_jmp 0 -#define jsr_jsr 1 -#define jsr_ret 2 -#define jsr_jsr_coroutine 3 - u_int32_t rb : 5; - u_int32_t ra : 5; - u_int32_t opcode : 6; - } j_format; - struct { - int32_t memory_displacement : 16; - u_int32_t rb : 5; - u_int32_t ra : 5; - u_int32_t opcode : 6; - } m_format; - struct { - u_int32_t rc : 5; - u_int32_t function : 7; - u_int32_t form : 1; - u_int32_t sbz : 3; - u_int32_t rb : 5; - u_int32_t ra : 5; - u_int32_t opcode : 6; - } o_format; - struct { - u_int32_t rc : 5; - u_int32_t function : 7; - u_int32_t form : 1; - u_int32_t literal : 8; - u_int32_t ra : 5; - u_int32_t opcode : 6; - } l_format; - struct { - u_int32_t fc : 5; - u_int32_t function : 11; - u_int32_t fb : 5; - u_int32_t fa : 5; - u_int32_t opcode : 6; - } f_format; - struct { - u_int32_t function : 26; - u_int32_t opcode : 6; - } pal_format; - struct { - int32_t branch_displacement : 21; - u_int32_t ra : 5; - u_int32_t opcode : 6; - } b_format; -}; - -#endif /* _MACHINE_INST_H_ */ diff --git a/sys/alpha/include/intr.h b/sys/alpha/include/intr.h deleted file mode 100644 index 90a0bbf..0000000 --- a/sys/alpha/include/intr.h +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_INTR_H_ -#define _MACHINE_INTR_H_ - -extern struct mtx icu_lock; - -int alpha_setup_intr(const char *name, uintptr_t vector, - driver_intr_t handler, void *arg, enum intr_type flags, - void **cookiep, volatile long *cntp, - void (*disable)(uintptr_t), void (*enable)(uintptr_t)); -int alpha_teardown_intr(void *cookie); -void alpha_dispatch_intr(void *frame, unsigned long vector); - -#endif /* !_MACHINE_INTR_H_ */ diff --git a/sys/alpha/include/intrcnt.h b/sys/alpha/include/intrcnt.h deleted file mode 100644 index 2c1b897..0000000 --- a/sys/alpha/include/intrcnt.h +++ /dev/null @@ -1,73 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: intrcnt.h,v 1.17 1998/11/19 01:48:04 ross Exp $ */ - -/*- - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#define INTRCNT_CLOCK 0 -#define INTRCNT_ISA_IRQ (INTRCNT_CLOCK + 1) -#define INTRCNT_ISA_IRQ_LEN 16 -#define INTRCNT_OTHER_BASE (INTRCNT_ISA_IRQ + INTRCNT_ISA_IRQ_LEN) -#define INTRCNT_OTHER_LEN 48 -#define INTRCNT_COUNT (INTRCNT_OTHER_BASE + INTRCNT_OTHER_LEN) - -#define INTRCNT_A12_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_DEC_1000A_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_DEC_1000_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_DEC_2100_A500_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_DEC_550_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_EB164_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_EB64PLUS_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_EB66_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_IOASIC INTRCNT_OTHER_BASE -#define INTRCNT_KN15 INTRCNT_OTHER_BASE -#define INTRCNT_KN16 INTRCNT_OTHER_BASE -#define INTRCNT_KN20AA_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_KN300_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_KN8AE_IRQ INTRCNT_OTHER_BASE -#define INTRCNT_TCDS INTRCNT_OTHER_BASE - -#define INTRCNT_A12_IRQ_LEN 10 -#define INTRCNT_DEC_1000A_IRQ_LEN 32 -#define INTRCNT_DEC_1000_IRQ_LEN 16 -#define INTRCNT_DEC_2100_A500_IRQ_LEN 16 -#define INTRCNT_DEC_550_IRQ_LEN 48 -#define INTRCNT_EB164_IRQ_LEN 24 -#define INTRCNT_EB64PLUS_IRQ_LEN 32 -#define INTRCNT_EB66_IRQ_LEN 32 -#define INTRCNT_IOASIC_LEN 4 -#define INTRCNT_ISA_IRQ_LEN 16 -#define INTRCNT_KN15_LEN 9 -#define INTRCNT_KN16_LEN 5 -#define INTRCNT_KN20AA_IRQ_LEN 32 -#define INTRCNT_KN300_LEN 19 -#define INTRCNT_KN8AE_IRQ_LEN 2 -#define INTRCNT_TCDS_LEN 2 - -# define INTRCNT_KN300_NCR810 INTRCNT_KN300_IRQ + 16 -# define INTRCNT_KN300_I2C_CTRL INTRCNT_KN300_IRQ + 17 -# define INTRCNT_KN300_I2C_BUS INTRCNT_KN300_IRQ + 18 diff --git a/sys/alpha/include/ioctl_bt848.h b/sys/alpha/include/ioctl_bt848.h deleted file mode 100644 index ca83a36..0000000 --- a/sys/alpha/include/ioctl_bt848.h +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * Copyright (c) 2003 David O'Brien - * 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 ``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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_IOCTL_BT848_H_ -#define _MACHINE_IOCTL_BT848_H_ - -#include <sys/cdefs.h> - -#ifdef __CC_SUPPORTS_WARNING -#warning Include dev/bktr/ioctl_bt848.h instead of this header. -#endif - -#include <dev/bktr/ioctl_bt848.h> - -#endif /* _MACHINE_IOCTL_BT848_H_ */ diff --git a/sys/alpha/include/ioctl_meteor.h b/sys/alpha/include/ioctl_meteor.h deleted file mode 100644 index 0322f1e..0000000 --- a/sys/alpha/include/ioctl_meteor.h +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * Copyright (c) 2003 David O'Brien - * 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 ``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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_IOCTL_METEOR_H_ -#define _MACHINE_IOCTL_METEOR_H_ - -#include <sys/cdefs.h> - -#ifdef __CC_SUPPORTS_WARNING -#warning Include dev/bktr/ioctl_meteor.h instead of this header. -#endif - -#include <dev/bktr/ioctl_meteor.h> - -#endif /* _MACHINE_IOCTL_METEOR_H_ */ diff --git a/sys/alpha/include/kdb.h b/sys/alpha/include/kdb.h deleted file mode 100644 index fb08d4b..0000000 --- a/sys/alpha/include/kdb.h +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * Copyright (c) 2004 Marcel Moolenaar - * 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 ``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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_KDB_H_ -#define _MACHINE_KDB_H_ - -#include <machine/frame.h> - -#define KDB_STOPPEDPCB(pc) &stoppcbs[pc->pc_cpuid] - -static __inline void -kdb_cpu_clear_singlestep(void) -{ -} - -static __inline void -kdb_cpu_set_singlestep(void) -{ -} - -static __inline void -kdb_cpu_trap(int vector, int _) -{ -} - -#endif /* _MACHINE_KDB_H_ */ diff --git a/sys/alpha/include/limits.h b/sys/alpha/include/limits.h deleted file mode 100644 index 9444760..0000000 --- a/sys/alpha/include/limits.h +++ /dev/null @@ -1,45 +0,0 @@ -/*- - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 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. - * - * @(#)limits.h 8.3 (Berkeley) 1/4/94 - * From: NetBSD: limits.h,v 1.3 1997/04/06 08:47:31 cgd Exp - * $FreeBSD$ - */ - -#ifndef _MACHINE_LIMITS_H_ -#define _MACHINE_LIMITS_H_ - -#include <sys/cdefs.h> - -#ifdef __CC_SUPPORTS_WARNING -#warning "machine/limits.h is deprecated. Include sys/limits.h instead." -#endif - -#include <sys/limits.h> - -#endif /* !_MACHINE_LIMITS_H_ */ diff --git a/sys/alpha/include/md_var.h b/sys/alpha/include/md_var.h deleted file mode 100644 index d576647..0000000 --- a/sys/alpha/include/md_var.h +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_MD_VAR_H_ -#define _MACHINE_MD_VAR_H_ - -/* - * Miscellaneous machine-dependent declarations. - */ - -struct cam_sim; -struct reg; -struct rpb; -struct thread; -struct trapframe; - -extern char sigcode[]; -extern char esigcode[]; -extern int szsigcode; -#ifdef COMPAT_43 -extern int szosigcode; -#endif -#ifdef COMPAT_FREEBSD4 -extern int szfreebsd4_sigcode; -#endif -extern long Maxmem; -extern int busdma_swi_pending; -extern struct rpb *hwrpb; -extern volatile int mc_expected; -extern volatile int mc_received; - -void XentArith(u_int64_t, u_int64_t, u_int64_t); /* MAGIC */ -void XentIF(u_int64_t, u_int64_t, u_int64_t); /* MAGIC */ -void XentInt(u_int64_t, u_int64_t, u_int64_t); /* MAGIC */ -void XentMM(u_int64_t, u_int64_t, u_int64_t); /* MAGIC */ -void XentRestart(void); /* MAGIC */ -void XentSys(u_int64_t, u_int64_t, u_int64_t); /* MAGIC */ -void XentUna(u_int64_t, u_int64_t, u_int64_t); /* MAGIC */ -void alpha_fpstate_check(struct thread *td); -void alpha_fpstate_drop(struct thread *td); -void alpha_fpstate_save(struct thread *td, int write); -void alpha_fpstate_switch(struct thread *td); -void alpha_init(u_long, u_long, u_long, u_long, u_long); -int alpha_pa_access(u_long); -void alpha_register_pci_scsi(int bus, int slot, struct cam_sim *sim); -int badaddr(void *, size_t); -int badaddr_read(void *, size_t, void *); -void busdma_swi(void); -u_int64_t console_restart(u_int64_t, u_int64_t, u_int64_t); -void dumpconf(void); -void exception_return(void); /* MAGIC */ -void frametoreg(struct trapframe *, struct reg *); -long fswintrberr(void); /* MAGIC */ -u_int64_t hwrpb_checksum(void); -void hwrpb_restart_setup(void); -void init_prom_interface(struct rpb*); -void interrupt(unsigned long, unsigned long, unsigned long, - struct trapframe *); -int is_physical_memory(vm_offset_t addr); -void machine_check(unsigned long, struct trapframe *, unsigned long, - unsigned long); -void regdump(struct trapframe *); -void regtoframe(struct reg *, struct trapframe *); -void set_iointr(void (*)(void *, unsigned long)); -void switch_exit(struct thread *); /* MAGIC */ -void syscall(u_int64_t, struct trapframe *); -void trap(unsigned long, unsigned long, unsigned long, unsigned long, - struct trapframe *); - -#ifdef _SYS_BUS_H_ -struct resource *alpha_platform_alloc_ide_intr(int chan); -int alpha_platform_release_ide_intr(int chan, struct resource *res); -int alpha_platform_setup_ide_intr(struct device *dev, struct resource *res, - driver_intr_t *fn, void *arg, void **cookiep); -int alpha_platform_teardown_ide_intr(struct device *dev, - struct resource *res, void *cookie); -int alpha_platform_pci_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, driver_intr_t *intr, void *arg, - void **cookiep); -int alpha_platform_pci_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie); -int alpha_pci_route_interrupt(device_t bus, device_t dev, int pin); -#endif - -#endif /* !_MACHINE_MD_VAR_H_ */ diff --git a/sys/alpha/include/memdev.h b/sys/alpha/include/memdev.h deleted file mode 100644 index 32cc1fc..0000000 --- a/sys/alpha/include/memdev.h +++ /dev/null @@ -1,38 +0,0 @@ -/*- - * Copyright (c) 2004 Mark R V Murray - * 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 - * in this position and unchanged. - * 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 AUTHORS ``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. - * - * $FreeBSD$ - */ - -#define CDEV_MAJOR 2 -#define CDEV_MINOR_MEM 0 -#define CDEV_MINOR_KMEM 1 - -d_open_t memopen; -d_read_t memrw; -#define memioctl (d_ioctl_t *)NULL -d_mmap_t memmmap; - -void dev_mem_md_init(void); diff --git a/sys/alpha/include/mutex.h b/sys/alpha/include/mutex.h deleted file mode 100644 index 7300c08..0000000 --- a/sys/alpha/include/mutex.h +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * Copyright (c) 1997 Berkeley Software Design, Inc. 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. Berkeley Software Design Inc's name may not be used to endorse or - * promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY BERKELEY SOFTWARE DESIGN INC ``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 BERKELEY SOFTWARE DESIGN INC 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 BSDI $Id: mutex.h,v 2.7.2.35 2000/04/27 03:10:26 cp Exp $ - * $FreeBSD$ - */ - -#ifndef _MACHINE_MUTEX_H_ -#define _MACHINE_MUTEX_H_ - -#ifndef LOCORE - -#ifdef _KERNEL - -/* Global locks */ -extern struct mtx clock_lock; - -#endif /* _KERNEL */ - -#else /* !LOCORE */ - -/* - * Simple assembly macros to get and release non-recursive spin locks - * - * XXX: These are presently unused and cannot be used right now. Need to be - * re-written (they are wrong). If you plan to use this and still see - * this message, know not to unless you fix them first! :-) - */ -#define MTX_ENTER(lck) \ - ldiq a0, ALPHA_PSL_IPL_HIGH; \ - call_pal PAL_OSF1_swpipl; \ -1: ldq_l a0, lck+MTX_LOCK; \ - cmpeq a0, MTX_UNOWNED, a1; \ - beq a1, 1b; \ - ldq a0, PC_CURTHREAD(pcpup); \ - stq_c a0, lck+MTX_LOCK; \ - beq a0, 1b; \ - mb; \ - stl v0, lck+MTX_SAVEINTR - -#define MTX_EXIT(lck) \ - mb; \ - ldiq a0, MTX_UNOWNED; \ - stq a0, lck+MTX_LOCK; \ - ldl a0, lck+MTX_SAVEINTR; \ - call_pal PAL_OSF1_swpipl - -#endif /* !LOCORE */ - -#endif /* __MACHINE_MUTEX_H */ diff --git a/sys/alpha/include/pal.h b/sys/alpha/include/pal.h deleted file mode 100644 index 73426af..0000000 --- a/sys/alpha/include/pal.h +++ /dev/null @@ -1,93 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: pal.h,v 1.1 1997/09/06 01:23:53 thorpej Exp */ - -/*- - * Copyright (c) 1991,1990,1989,1994,1995,1996 Carnegie Mellon University - * All Rights Reserved. - * - * 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 Mellon - * the rights to redistribute these changes. - */ - -/* - * PAL "function" codes (used as arguments to call_pal instructions). - * - * Those marked with "P" are privileged, and those marked with "U" - * are unprivileged. - */ - -/* Common PAL function codes. */ -#define PAL_halt 0x0000 /* P */ -#define PAL_cflush 0x0001 /* P */ -#define PAL_draina 0x0002 /* P */ -#define PAL_cserve 0x0009 /* P */ -#define PAL_swppal 0x000a /* P */ -#define PAL_ipir 0x000d /* P */ -#define PAL_bpt 0x0080 /* U */ -#define PAL_bugchk 0x0081 /* U */ -#define PAL_imb 0x0086 /* U */ -#define PAL_rdunique 0x009e /* U */ -#define PAL_wrunique 0x009f /* U */ -#define PAL_gentrap 0x00aa /* U */ - -/* VMS PAL function codes. */ -#define PAL_VMS_ldqp 0x0003 /* P */ -#define PAL_VMS_stqp 0x0004 /* P */ -#define PAL_VMS_mtpr_fen 0x000c /* P */ -#define PAL_VMS_mtpr_ipir 0x000d /* P */ -#define PAL_VMS_mfpr_ipl 0x000e /* P */ -#define PAL_VMS_mtpr_ipl 0x000f /* P */ -#define PAL_VMS_mfpr_mces 0x0010 /* P */ -#define PAL_VMS_mtpr_mces 0x0011 /* P */ -#define PAL_VMS_mfpr_prbr 0x0013 /* P */ -#define PAL_VMS_mtpr_prbr 0x0014 /* P */ -#define PAL_VMS_mfpr_ptbr 0x0015 /* P */ -#define PAL_VMS_mtpr_scbb 0x0017 /* P */ -#define PAL_VMS_mtpr_sirr 0x0018 /* P */ -#define PAL_VMS_mtpr_tbia 0x001b /* P */ -#define PAL_VMS_mtpr_tbiap 0x001c /* P */ -#define PAL_VMS_mtpr_tbis 0x001d /* P */ -#define PAL_VMS_mfpr_usp 0x0022 /* P */ -#define PAL_VMS_mtpr_usp 0x0023 /* P */ -#define PAL_VMS_mfpr_vptb 0x0029 /* P */ -#define PAL_VMS_mfpr_whami 0x003f /* P */ -#define PAL_VMS_rei 0x0092 /* U */ - -/* OSF/1 PAL function codes. */ -#define PAL_OSF1_rdmces 0x0010 /* P */ -#define PAL_OSF1_wrmces 0x0011 /* P */ -#define PAL_OSF1_wrfen 0x002b /* P */ -#define PAL_OSF1_wrvptptr 0x002d /* P */ -#define PAL_OSF1_swpctx 0x0030 /* P */ -#define PAL_OSF1_wrval 0x0031 /* P */ -#define PAL_OSF1_rdval 0x0032 /* P */ -#define PAL_OSF1_tbi 0x0033 /* P */ -#define PAL_OSF1_wrent 0x0034 /* P */ -#define PAL_OSF1_swpipl 0x0035 /* P */ -#define PAL_OSF1_rdps 0x0036 /* P */ -#define PAL_OSF1_wrkgp 0x0037 /* P */ -#define PAL_OSF1_wrusp 0x0038 /* P */ -#define PAL_OSF1_wrperfmon 0x0039 /* P */ -#define PAL_OSF1_rdusp 0x003a /* P */ -#define PAL_OSF1_whami 0x003c /* P */ -#define PAL_OSF1_retsys 0x003d /* P */ -#define PAL_OSF1_rti 0x003f /* P */ -#define PAL_OSF1_callsys 0x0083 /* U */ -#define PAL_OSF1_imb 0x0086 /* U */ diff --git a/sys/alpha/include/param.h b/sys/alpha/include/param.h deleted file mode 100644 index 56c5a84..0000000 --- a/sys/alpha/include/param.h +++ /dev/null @@ -1,125 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: param.h,v 1.20 1997/09/19 13:52:53 leo Exp */ - -/*- - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * 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 and Ralph Campbell. - * - * 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. - * 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: Utah $Hdr: machparam.h 1.11 89/08/14$ - * - * @(#)param.h 8.1 (Berkeley) 6/10/93 - */ - -/* - * Machine dependent constants for the Alpha. - */ - -/* - * Round p (pointer or byte index) up to a correctly-aligned value for all - * data types (int, long, ...). The result is u_long and must be cast to - * any desired pointer type. - * - * ALIGNED_POINTER is a boolean macro that checks whether an address - * is valid to fetch data elements of type t from on this architecture. - * This does not reflect the optimal alignment, just the possibility - * (within reasonable limits). - * - */ -#ifndef _ALIGNBYTES -#define _ALIGNBYTES 7 -#endif -#ifndef _ALIGN -#define _ALIGN(p) (((u_long)(p) + _ALIGNBYTES) &~ _ALIGNBYTES) -#endif -#ifndef _ALIGNED_POINTER -#define _ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0) -#endif - -#ifndef _NO_NAMESPACE_POLLUTION - -#define __PCI_REROUTE_INTERRUPT - -#ifndef _MACHINE_PARAM_H_ -#define _MACHINE_PARAM_H_ - -#ifndef MACHINE -#define MACHINE "alpha" -#endif -#ifndef MACHINE_ARCH -#define MACHINE_ARCH "alpha" -#endif -#define MID_MACHINE MID_ALPHA - -#include <machine/alpha_cpu.h> -#include <machine/cpu.h> - -#define MAXSMPCPU 8 -#ifdef SMP -#define MAXCPU MAXSMPCPU -#else -#define MAXCPU 1 -#endif - -#define ALIGNBYTES _ALIGNBYTES -#define ALIGN(p) _ALIGN(p) -#define ALIGNED_POINTER(p,t) _ALIGNED_POINTER(p,t) - -#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 0xfffffc0000300000LL /* start of kernel virtual */ -#define BTOPKERNBASE ((u_long)KERNBASE >> PGSHIFT) - -#ifndef KSTACK_PAGES -#define KSTACK_PAGES 2 /* pages of kstack (with pcb) */ -#endif -#define KSTACK_GUARD_PAGES 1 /* pages of kstack guard; 0 disables */ - - -/* - * Mach derived conversion macros - */ -#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) - -#define pgtok(x) ((x) * (PAGE_SIZE / 1024)) - -#endif /* !_MACHINE_PARAM_H_ */ -#endif /* !_NO_NAMESPACE_POLLUTION */ diff --git a/sys/alpha/include/pc/bios.h b/sys/alpha/include/pc/bios.h deleted file mode 100644 index ff5edd6..0000000 --- a/sys/alpha/include/pc/bios.h +++ /dev/null @@ -1,112 +0,0 @@ -/*- - * Copyright (c) 1997 Michael Smith - * 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. - * - * $FreeBSD$ - * from: i386/include/pc bios.h,v 1.2 - */ - -/* - * Signature structure for the BIOS32 Service Directory header - */ -struct bios32_SDheader -{ - u_int8_t sig[4]; - u_int32_t entry; - u_int8_t revision; - u_int8_t len; - u_int8_t cksum; - u_int8_t pad[5]; -}; - -/* - * BIOS32 Service Directory entry. Caller supplies name, bios32_SDlookup - * fills in the rest of the details. - */ -struct bios32_SDentry -{ - union - { - u_int8_t name[4]; /* service identifier */ - u_int32_t id; /* as a 32-bit value */ - } ident; - u_int32_t base; /* base of service */ - u_int32_t len; /* service length */ - u_int32_t entry; /* entrypoint offset from base */ -}; - -extern int bios32_SDlookup(struct bios32_SDentry *ent); -extern u_int32_t bios_sigsearch(u_int32_t start, u_char *sig, int siglen, - int paralen, int sigofs); - -/* - * Call a 32-bit BIOS function - */ -struct bios32_args { - u_long eax; - u_long ebx; - u_long ecx; - u_long edx; -}; -extern void bios32(caddr_t func_addr, struct bios32_args *args); - -#define BIOS_PADDRTOVADDR(x) (x) -#define BIOS_VADDRTOPADDR(x) (x) - -/* - * System Management BIOS / Desktop Management Interface tables - */ - -struct DMI_table -{ - u_int8_t sig[5]; /* "_DMI_" */ - u_int8_t cksum; /* checksum */ - u_int16_t st_size; /* total length of SMBIOS table (bytes)*/ - u_int32_t st_base; /* base address of the SMBIOS table (physical) */ - u_int16_t st_entries; /* total number of structures present in the table */ - u_int8_t bcd_revision; /* interface revision number */ -}; - -struct SMBIOS_table -{ - u_int8_t sig[4]; /* "_SM_" */ - u_int8_t cksum; /* checksum */ - u_int8_t len; /* structure length */ - u_int8_t major, minor; /* major/minor revision numbers */ - u_int16_t st_maxsize; /* largest structure size (bytes) */ - u_int8_t revision; /* entrypoint revision */ - u_int8_t pad[5]; - struct DMI_table dmi; /* follows immediately */ -}; - - -/* - * Exported lookup results - */ -extern struct bios32_SDentry PCIbios; -extern struct SMBIOS_table *SMBIOS_table; -extern struct DMI_table *DMI_table; - - - diff --git a/sys/alpha/include/pc/display.h b/sys/alpha/include/pc/display.h deleted file mode 100644 index fad568c..0000000 --- a/sys/alpha/include/pc/display.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * IBM PC display definitions - * - * $FreeBSD$ - * from: i386/include/pc display.h,v 1.4 - */ - -/* Color attributes for foreground text */ - -#define FG_BLACK 0 -#define FG_BLUE 1 -#define FG_GREEN 2 -#define FG_CYAN 3 -#define FG_RED 4 -#define FG_MAGENTA 5 -#define FG_BROWN 6 -#define FG_LIGHTGREY 7 -#define FG_DARKGREY 8 -#define FG_LIGHTBLUE 9 -#define FG_LIGHTGREEN 10 -#define FG_LIGHTCYAN 11 -#define FG_LIGHTRED 12 -#define FG_LIGHTMAGENTA 13 -#define FG_YELLOW 14 -#define FG_WHITE 15 -#define FG_BLINK 0x80 - -/* Color attributes for text background */ - -#define BG_BLACK 0x00 -#define BG_BLUE 0x10 -#define BG_GREEN 0x20 -#define BG_CYAN 0x30 -#define BG_RED 0x40 -#define BG_MAGENTA 0x50 -#define BG_BROWN 0x60 -#define BG_LIGHTGREY 0x70 - -/* Monochrome attributes for foreground text */ - -#define FG_UNDERLINE 0x01 -#define FG_INTENSE 0x08 - -/* Monochrome attributes for text background */ - -#define BG_INTENSE 0x10 diff --git a/sys/alpha/include/pc/vesa.h b/sys/alpha/include/pc/vesa.h deleted file mode 100644 index c2c2b16..0000000 --- a/sys/alpha/include/pc/vesa.h +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * Copyright (c) 1998 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp) - * 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. 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 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. - * - * $FreeBSD$ - * from: i386/include/pc vesa.h,v 1.1 - */ - -#ifndef _MACHINE_PC_VESA_H -#define _MACHINE_PC_VESA_H - -struct vesa_info -{ - /* mandatory fields */ - u_int8_t v_sig[4] __packed; /* VESA */ - u_int16_t v_version __packed; /* ver in BCD */ - u_int32_t v_oemstr __packed; /* OEM string */ - u_int32_t v_flags __packed; /* flags */ -#define V_DAC8 (1<<0) -#define V_NONVGA (1<<1) -#define V_SNOW (1<<2) - u_int32_t v_modetable __packed; /* modes */ - u_int16_t v_memsize __packed; /* in 64K */ - /* 2.0 */ - u_int16_t v_revision __packed; /* software rev */ - u_int32_t v_venderstr __packed; /* vender */ - u_int32_t v_prodstr __packed; /* product name */ - u_int32_t v_revstr __packed; /* product rev */ -}; - -struct vesa_mode -{ - /* mandatory fields */ - u_int16_t v_modeattr; -#define V_MODESUPP (1<<0) /* VESA mode attributes */ -#define V_MODEOPTINFO (1<<1) -#define V_MODEBIOSOUT (1<<2) -#define V_MODECOLOR (1<<3) -#define V_MODEGRAPHICS (1<<4) -#define V_MODENONVGA (1<<5) -#define V_MODENONBANK (1<<6) -#define V_MODELFB (1<<7) -#define V_MODEVESA (1<<16) /* Private attributes */ - u_int8_t v_waattr; - u_int8_t v_wbattr; -#define V_WATTREXIST (1<<0) -#define V_WATTRREAD (1<<1) -#define V_WATTRWRITE (1<<2) - u_int16_t v_wgran; - u_int16_t v_wsize; - u_int16_t v_waseg; - u_int16_t v_wbseg; - u_int32_t v_posfunc; - u_int16_t v_bpscanline; - /* fields optional for 1.0/1.1 implementations */ - u_int16_t v_width; - u_int16_t v_height; - u_int8_t v_cwidth; - u_int8_t v_cheight; - u_int8_t v_planes; - u_int8_t v_bpp; - u_int8_t v_banks; - u_int8_t v_memmodel; -#define V_MMTEXT 0 -#define V_MMCGA 1 -#define V_MMHGC 2 -#define V_MMEGA 3 -#define V_MMPACKED 4 -#define V_MMSEQU256 5 -#define V_MMDIRCOLOR 6 -#define V_MMYUV 7 - u_int8_t v_banksize; - u_int8_t v_ipages; - u_int8_t v_reserved0; - /* fields for 1.2+ implementations */ - u_int8_t v_redmasksize; - u_int8_t v_redfieldpos; - u_int8_t v_greenmasksize; - u_int8_t v_greenfieldpos; - u_int8_t v_bluemasksize; - u_int8_t v_bluefieldpos; - u_int8_t v_resmasksize; - u_int8_t v_resfieldpos; - u_int8_t v_dircolormode; - /* 2.0 implementations */ - u_int32_t v_lfb; - u_int32_t v_offscreen; - u_int8_t v_offscreensize; -}; - -#ifdef _KERNEL - -#define VESA_MODE(x) ((x) >= M_VESA_BASE) - -int vesa_load_ioctl(void); -int vesa_unload_ioctl(void); - -#ifndef VESA_MODULE -int vesa_load(void); -#endif - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_PC_VESA_H */ diff --git a/sys/alpha/include/pcb.h b/sys/alpha/include/pcb.h deleted file mode 100644 index 70646c8..0000000 --- a/sys/alpha/include/pcb.h +++ /dev/null @@ -1,65 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: pcb.h,v 1.6 1997/04/06 08:47:33 cgd Exp */ - -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#ifndef _MACHINE_PCB_H_ -#define _MACHINE_PCB_H_ - -#include <machine/frame.h> -#include <machine/reg.h> -#include <machine/alpha_cpu.h> - -/* - * PCB: process control block - * - * In this case, the hardware structure that is the defining element - * for a process, and the additional state that must be saved by software - * on a context switch. Fields marked [HW] are mandated by hardware; fields - * marked [SW] are for the software. - * - * It's said in the VMS PALcode section of the AARM that the pcb address - * passed to the swpctx PALcode call has to be a physical address. Not - * knowing this (and trying a virtual) address proved this correct. - * So we cache the physical address of the pcb in the md_proc struct. - */ -struct pcb { - struct alpha_pcb pcb_hw; /* PALcode defined */ - unsigned long pcb_context[9]; /* s[0-6], ra, ps [SW] */ - struct fpreg pcb_fp; /* FP registers [SW] */ - u_int64_t pcb_fp_control; /* IEEE control word [SW] */ - unsigned long pcb_onfault; /* for copy faults [SW] */ - unsigned long pcb_accessaddr; /* for [fs]uswintr [SW] */ -}; - -#ifdef _KERNEL -void makectx(struct trapframe *, struct pcb *); -void savectx(struct pcb *); -#endif - -#endif /* _MACHINE_PCB_H */ diff --git a/sys/alpha/include/pcpu.h b/sys/alpha/include/pcpu.h deleted file mode 100644 index eb04362..0000000 --- a/sys/alpha/include/pcpu.h +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org> - * Copyright (c) Peter Wemm <peter@netplex.com.au> - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PCPU_H_ -#define _MACHINE_PCPU_H_ - -#ifdef _KERNEL - -#define PCPU_MD_FIELDS \ - struct alpha_pcb pc_idlepcb; /* pcb for idling */ \ - u_int64_t pc_pal_id; /* physical CPU ID */ \ - u_int64_t pc_idlepcbphys; /* pa of pc_idlepcb */ \ - u_int64_t pc_pending_ipis; /* pending IPI's */ \ - u_int32_t pc_next_asn; /* next ASN to alloc */ \ - u_int32_t pc_current_asngen; /* ASN rollover check */ \ - u_int32_t pc_last_pcc_cnt; /* Previous PCC_CNT value */ \ - u_int32_t pc_pcc_base /* Hi word of cycle count. */ - -struct pcpu; - -register struct pcpu *pcpup __asm__("$8"); - -#define PCPU_GET(member) (pcpup->pc_ ## member) -#define PCPU_PTR(member) (&pcpup->pc_ ## member) -#define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_PCPU_H_ */ diff --git a/sys/alpha/include/pmap.h b/sys/alpha/include/pmap.h deleted file mode 100644 index 9dca988..0000000 --- a/sys/alpha/include/pmap.h +++ /dev/null @@ -1,250 +0,0 @@ -/*- - * 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 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 - * 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. - * 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. - * - * 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 - * $FreeBSD$ - */ - -#ifndef _MACHINE_PMAP_H_ -#define _MACHINE_PMAP_H_ - -#ifdef _KERNEL -#include <machine/chipset.h> -#include <sys/systm.h> -#endif - -/* - * 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 */ - -/* - * Pte related macros - */ -#define VADDR(l1, l2, l3) (((l1) << ALPHA_L1SHIFT) \ - + ((l2) << ALPHA_L2SHIFT) \ - + ((l3) << ALPHA_L3SHIFT) - -#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 */ - -/* - * 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 - */ -#define PTLEV1I (NPTEPG-1) /* Lev0 entry that points to Lev0 */ -#define K0SEGLEV1I (NPTEPG/2) -#define K1SEGLEV1I (K0SEGLEV1I+(NPTEPG/4)) - -#define NUSERLEV2MAPS (NPTEPG/2) -#define NUSERLEV3MAPS (NUSERLEV2MAPS << ALPHA_PTSHIFT) - -#ifndef LOCORE - -#include <sys/queue.h> -#include <sys/_lock.h> -#include <sys/_mutex.h> - -typedef alpha_pt_entry_t pt_entry_t; - -#define PTESIZE sizeof(pt_entry_t) /* for assembly files */ - -/* - * Address of current address space page table maps - */ -#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 - -#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))) -#define vtophys(va) pmap_kextract((vm_offset_t)(va)) - -/* - * 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; -} - -static __inline vm_offset_t -alpha_XXX_dmamap(vm_offset_t va) -{ - vm_offset_t pa = pmap_kextract(va); - if (pa >= chipset.dmsize) - panic ("driver uses alpha_XXX_dmamap() for an address that" - "is not within direct map"); - if (chipset.pci_sgmap != NULL) - panic ("driver uses alpha_XXX_dmamap() on largemem system"); - return (pa + chipset.dmoffset); -} - -#endif /* _KERNEL */ - -/* - * Pmap stuff - */ -struct pv_entry; - -struct md_page { - int pv_list_count; - TAILQ_HEAD(,pv_entry) pv_list; -}; - -#define ASN_BITS 8 -#define ASNGEN_BITS (32 - ASN_BITS) -#define ASNGEN_MASK ((1 << ASNGEN_BITS) - 1) - -struct pmap { - struct mtx pm_mtx; - pt_entry_t *pm_lev1; /* KVA of lev0map */ - TAILQ_HEAD(,pv_entry) pm_pvlist; /* list of mappings in pmap */ - u_int32_t pm_active; /* active cpus */ - struct { - u_int32_t asn:ASN_BITS; /* address space number */ - u_int32_t gen:ASNGEN_BITS; /* generation number */ - } pm_asn[MAXSMPCPU]; - struct pmap_statistics pm_stats; /* pmap statistics */ - struct vm_page *pm_ptphint; /* pmap ptp hint */ - LIST_ENTRY(pmap) pm_list; /* list of all pmaps. */ -}; - -typedef struct pmap *pmap_t; - -#ifdef _KERNEL -extern struct pmap kernel_pmap_store; -#define kernel_pmap (&kernel_pmap_store) - -#define PMAP_LOCK(pmap) mtx_lock(&(pmap)->pm_mtx) -#define PMAP_LOCK_ASSERT(pmap, type) \ - mtx_assert(&(pmap)->pm_mtx, (type)) -#define PMAP_LOCK_DESTROY(pmap) mtx_destroy(&(pmap)->pm_mtx) -#define PMAP_LOCK_INIT(pmap) mtx_init(&(pmap)->pm_mtx, "pmap", \ - NULL, MTX_DEF) -#define PMAP_LOCKED(pmap) mtx_owned(&(pmap)->pm_mtx) -#define PMAP_MTX(pmap) (&(pmap)->pm_mtx) -#define PMAP_TRYLOCK(pmap) mtx_trylock(&(pmap)->pm_mtx) -#define PMAP_UNLOCK(pmap) mtx_unlock(&(pmap)->pm_mtx) -#endif - -/* - * 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; - -#ifdef _KERNEL - -extern vm_offset_t phys_avail[]; -extern vm_offset_t virtual_avail; -extern vm_offset_t virtual_end; - -struct vmspace; - -#define pmap_page_is_mapped(m) (!TAILQ_EMPTY(&(m)->md.pv_list)) - -vm_offset_t pmap_steal_memory(vm_size_t); -void pmap_bootstrap(vm_offset_t, u_int); -void pmap_kenter(vm_offset_t va, vm_offset_t pa); -void *pmap_kenter_temporary(vm_offset_t pa, int i); -void pmap_kremove(vm_offset_t); -void pmap_setdevram(unsigned long long basea, vm_offset_t sizea); -int pmap_uses_prom_console(void); -void *pmap_mapdev(vm_offset_t, vm_size_t); -void pmap_unmapdev(vm_offset_t, vm_size_t); -unsigned *pmap_pte(pmap_t, vm_offset_t) __pure2; -void pmap_set_opt (unsigned *); -void pmap_set_opt_bsp (void); -void pmap_deactivate(struct thread *td); -void pmap_emulate_reference(struct vmspace *vm, vm_offset_t v, int user, int write); - -#endif /* _KERNEL */ - -#endif /* !LOCORE */ - -#endif /* !_MACHINE_PMAP_H_ */ diff --git a/sys/alpha/include/pmc_mdep.h b/sys/alpha/include/pmc_mdep.h deleted file mode 100644 index 7fc48f5..0000000 --- a/sys/alpha/include/pmc_mdep.h +++ /dev/null @@ -1,23 +0,0 @@ -/*- - * This file is in the public domain. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PMC_MDEP_H_ -#define _MACHINE_PMC_MDEP_H_ - -union pmc_md_op_pmcallocate { - uint64_t __pad[4]; -}; - -/* Logging */ -#define PMCLOG_READADDR PMCLOG_READ64 -#define PMCLOG_EMITADDR PMCLOG_EMIT64 - -#if _KERNEL -union pmc_md_pmc { -}; - -#endif -#endif /* !_MACHINE_PMC_MDEP_H_ */ diff --git a/sys/alpha/include/ppireg.h b/sys/alpha/include/ppireg.h deleted file mode 100644 index 5774757..0000000 --- a/sys/alpha/include/ppireg.h +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * Copyright (C) 2005 TAKAHASHI Yoshihiro. 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 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 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_PPIREG_H_ -#define _MACHINE_PPIREG_H_ - -#ifdef _KERNEL - -#define IO_PPI 0x61 /* Programmable Peripheral Interface */ - -/* - * PPI speaker control values - */ - -#define PIT_ENABLETMR2 0x01 /* Enable timer/counter 2 */ -#define PIT_SPKRDATA 0x02 /* Direct to speaker */ - -#define PIT_SPKR (PIT_ENABLETMR2 | PIT_SPKRDATA) - -#define ppi_spkr_on() outb(IO_PPI, inb(IO_PPI) | PIT_SPKR) -#define ppi_spkr_off() outb(IO_PPI, inb(IO_PPI) & ~PIT_SPKR) - -#endif /* _KERNEL */ - -#endif /* _MACHINE_PPIREG_H_ */ diff --git a/sys/alpha/include/proc.h b/sys/alpha/include/proc.h deleted file mode 100644 index 174e64b..0000000 --- a/sys/alpha/include/proc.h +++ /dev/null @@ -1,69 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: proc.h,v 1.3 1997/04/06 08:47:36 cgd Exp */ - -/*- - * Copyright (c) 1994, 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 _MACHINE_PROC_H_ -#define _MACHINE_PROC_H_ - -/* - * Machine-dependent part of the proc struct for the Alpha. - */ - -struct mdbpt { - vm_offset_t addr; - u_int32_t contents; -}; - -#define MDTD_FPUSED 0x0001 /* Process used the FPU */ -#define MDTD_STEP1 0x0002 /* Single step normal instruction */ -#define MDTD_STEP2 0x0004 /* Single step branch instruction */ -#define MDTD_HAEUSED 0x0008 /* Process used the HAE */ - -struct mdthread { - u_long md_flags; - struct pcb *md_pcbpaddr; /* phys addr of the pcb */ - struct mdbpt md_sstep[2]; /* two single step breakpoints */ - u_int64_t md_hae; /* user HAE register value */ - void *osf_sigtramp; /* user-level signal trampoline */ - u_int md_kernnest; /* nesting level in the kernel */ - register_t md_saved_ipl; /* save IPL for critical section */ - u_int md_spinlock_count; -}; - -#define MDP_UAC_NOPRINT 0x0010 /* Don't print unaligned traps */ -#define MDP_UAC_NOFIX 0x0020 /* Don't fixup unaligned traps */ -#define MDP_UAC_SIGBUS 0x0040 /* Deliver SIGBUS upon - unaligned access */ -#define MDP_UAC_MASK (MDP_UAC_NOPRINT | MDP_UAC_NOFIX | MDP_UAC_SIGBUS) - -struct mdproc { - u_int md_uac; /* (c) Unaligned Access Check flags. */ -}; - -#endif /* !_MACHINE_PROC_H_ */ diff --git a/sys/alpha/include/profile.h b/sys/alpha/include/profile.h deleted file mode 100644 index 47f45eb..0000000 --- a/sys/alpha/include/profile.h +++ /dev/null @@ -1,241 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: profile.h,v 1.9 1997/04/06 08:47:37 cgd Exp */ - -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#define _MCOUNT_DECL void mcount - -#define FUNCTION_ALIGNMENT 32 - -typedef u_long fptrdiff_t; - -#if 0 -/* - * XXX The definition of MCOUNT below is really the following code, run - * XXX through cpp, since the inline assembly isn't preprocessed. - */ -#define OFFSET_AT 0 -#define OFFSET_V0 8 -#define OFFSET_T0 16 -#define OFFSET_T1 24 -#define OFFSET_T2 32 -#define OFFSET_T3 40 -#define OFFSET_T4 48 -#define OFFSET_T5 56 -#define OFFSET_T6 64 -#define OFFSET_T7 72 -#define OFFSET_S6 80 -#define OFFSET_A0 88 -#define OFFSET_A1 96 -#define OFFSET_A2 104 -#define OFFSET_A3 112 -#define OFFSET_A4 120 -#define OFFSET_A5 128 -#define OFFSET_T8 136 -#define OFFSET_T9 144 -#define OFFSET_T10 152 -#define OFFSET_T11 160 -#define OFFSET_RA 168 -#define OFFSET_T12 176 -#define OFFSET_GP 184 -#define FRAME_SIZE 192 - -LEAF(_mcount,0) /* XXX */ - .set noat - .set noreorder - - lda sp, -FRAME_SIZE(sp) - - stq at_reg, OFFSET_AT(sp) - stq v0, OFFSET_V0(sp) - stq t0, OFFSET_T0(sp) - stq t1, OFFSET_T1(sp) - stq t2, OFFSET_T2(sp) - stq t3, OFFSET_T3(sp) - stq t4, OFFSET_T4(sp) - stq t5, OFFSET_T5(sp) - stq t6, OFFSET_T6(sp) - stq t7, OFFSET_T7(sp) - stq s6, OFFSET_S6(sp) /* XXX because run _after_ prologue. */ - stq a0, OFFSET_A0(sp) - stq a1, OFFSET_A1(sp) - stq a2, OFFSET_A2(sp) - stq a3, OFFSET_A3(sp) - stq a4, OFFSET_A4(sp) - stq a5, OFFSET_A5(sp) - stq t8, OFFSET_T8(sp) - stq t9, OFFSET_T9(sp) - stq t10, OFFSET_T10(sp) - stq t11, OFFSET_T11(sp) - stq ra, OFFSET_RA(sp) - stq t12, OFFSET_T12(sp) - stq gp, OFFSET_GP(sp) - - br pv, LX99 -LX99: SETGP(pv) - mov ra, a0 - mov at_reg, a1 - CALL(mcount) - - ldq v0, OFFSET_V0(sp) - ldq t0, OFFSET_T0(sp) - ldq t1, OFFSET_T1(sp) - ldq t2, OFFSET_T2(sp) - ldq t3, OFFSET_T3(sp) - ldq t4, OFFSET_T4(sp) - ldq t5, OFFSET_T5(sp) - ldq t6, OFFSET_T6(sp) - ldq t7, OFFSET_T7(sp) - ldq s6, OFFSET_S6(sp) /* XXX because run _after_ prologue. */ - ldq a0, OFFSET_A0(sp) - ldq a1, OFFSET_A1(sp) - ldq a2, OFFSET_A2(sp) - ldq a3, OFFSET_A3(sp) - ldq a4, OFFSET_A4(sp) - ldq a5, OFFSET_A5(sp) - ldq t8, OFFSET_T8(sp) - ldq t9, OFFSET_T9(sp) - ldq t10, OFFSET_T10(sp) - ldq t11, OFFSET_T11(sp) - ldq ra, OFFSET_RA(sp) - stq t12, OFFSET_T12(sp) - ldq gp, OFFSET_GP(sp) - - ldq at_reg, OFFSET_AT(sp) - - lda sp, FRAME_SIZE(sp) - ret zero, (at_reg), 1 - - END(_mcount) -#endif /* 0 */ - -#define MCOUNT __asm (" \ - .globl _mcount; \ - .ent _mcount 0; \ -_mcount:; \ - .frame $30,0,$26; \ - .set noat; \ - .set noreorder; \ - \ - lda $30, -192($30); \ - \ - stq $28, 0($30); \ - stq $0, 8($30); \ - stq $1, 16($30); \ - stq $2, 24($30); \ - stq $3, 32($30); \ - stq $4, 40($30); \ - stq $5, 48($30); \ - stq $6, 56($30); \ - stq $7, 64($30); \ - stq $8, 72($30); \ - stq $15, 80($30); \ - stq $16, 88($30); \ - stq $17, 96($30); \ - stq $18, 104($30); \ - stq $19, 112($30); \ - stq $20, 120($30); \ - stq $21, 128($30); \ - stq $22, 136($30); \ - stq $23, 144($30); \ - stq $24, 152($30); \ - stq $25, 160($30); \ - stq $26, 168($30); \ - stq $27, 176($30); \ - stq $29, 184($30); \ - \ - br $27, LX98; \ -LX98: ldgp $29,0($27); \ - mov $26, $16; \ - mov $28, $17; \ - jsr $26,mcount; \ - ldgp $29,0($26); \ - \ - ldq $0, 8($30); \ - ldq $1, 16($30); \ - ldq $2, 24($30); \ - ldq $3, 32($30); \ - ldq $4, 40($30); \ - ldq $5, 48($30); \ - ldq $6, 56($30); \ - ldq $7, 64($30); \ - ldq $8, 72($30); \ - ldq $15, 80($30); \ - ldq $16, 88($30); \ - ldq $17, 96($30); \ - ldq $18, 104($30); \ - ldq $19, 112($30); \ - ldq $20, 120($30); \ - ldq $21, 128($30); \ - ldq $22, 136($30); \ - ldq $23, 144($30); \ - ldq $24, 152($30); \ - ldq $25, 160($30); \ - ldq $26, 168($30); \ - ldq $27, 176($30); \ - ldq $29, 184($30); \ - \ - ldq $28, 0($30); \ - \ - lda $30, 192($30); \ - ret $31, ($28), 1; \ - \ - .end _mcount"); - -#ifdef _KERNEL -/* - * The following two macros do splhigh and splx respectively. - * _alpha_pal_swpipl is a special version of alpha_pal_swpipl which - * doesn't include profiling support. - * - * XXX These macros should probably use inline assembly. - */ -u_long _alpha_pal_swpipl(u_long); - -#define MCOUNT_ENTER(s) s = _alpha_pal_swpipl(ALPHA_PSL_IPL_HIGH) -#define MCOUNT_EXIT(s) (void)_alpha_pal_swpipl(s) -#define MCOUNT_DECL(s) u_long s; - -void bintr(void); -void btrap(void); -void eintr(void); -void user(void); - -#define MCOUNT_FROMPC_USER(pc) \ - ((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ? (uintfptr_t)user : pc) - -#define MCOUNT_FROMPC_INTR(pc) \ - ((pc >= (uintfptr_t)btrap && pc < (uintfptr_t)eintr) ? \ - ((pc >= (uintfptr_t)bintr) ? (uintfptr_t)bintr : \ - (uintfptr_t)btrap) : ~0UL) - -_MCOUNT_DECL(uintfptr_t, uintfptr_t); - -#else /* !_KERNEL */ -typedef u_long uintfptr_t; -#endif diff --git a/sys/alpha/include/prom.h b/sys/alpha/include/prom.h deleted file mode 100644 index a3ce282..0000000 --- a/sys/alpha/include/prom.h +++ /dev/null @@ -1,108 +0,0 @@ -/* $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. - * - * $FreeBSD$ - */ - -#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(void); -int prom_open(char *, int); -void putchar(int); -#endif - -void prom_halt(int) __attribute__((__noreturn__)); -int prom_getenv(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 promcnattach(int); -void promcndetach(void); -cn_putc_t promcnputc; -cn_getc_t promcngetc; -cn_checkc_t promcncheckc; - -u_int64_t prom_dispatch(u_int64_t, u_int64_t, u_int64_t, u_int64_t, - u_int64_t); -void init_bootstrap_console(void); -#endif /* _KERNEL */ -#endif /* ASSEMBLER */ diff --git a/sys/alpha/include/pte.h b/sys/alpha/include/pte.h deleted file mode 100644 index 1ac4e94..0000000 --- a/sys/alpha/include/pte.h +++ /dev/null @@ -1,97 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: pte.h,v 1.10 1997/09/02 19:07:22 thorpej Exp */ - -/*- - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -/* - * Alpha page table entry. - * Things which are in the VMS PALcode but not in the OSF PALcode - * are marked with "(VMS)". - * - * This information derived from pp. (II) 3-3 - (II) 3-6 and - * (III) 3-3 - (III) 3-5 of the "Alpha Architecture Reference Manual" by - * Richard L. Sites. - */ - -/* - * Alpha Page Table Entry - */ - -#include <machine/alpha_cpu.h> - -typedef alpha_pt_entry_t pt_entry_t; - -#define PT_ENTRY_NULL ((pt_entry_t *) 0) -#define PTESHIFT 3 /* pte size == 1 << PTESHIFT */ - -#define PG_V ALPHA_PTE_VALID -#define PG_NV 0 -#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_RSVD 0x000000000000cc80 /* Reserved fpr hardware */ -#define PG_WIRED 0x0000000000010000 /* Wired. [SOFTWARE] */ -#define PG_FRAME ALPHA_PTE_RAME -#define PG_SHIFT 32 -#define PG_PFNUM(x) ALPHA_PTE_TO_PFN(x) - -#if 0 /* XXX NOT HERE */ -#define K0SEG_BEGIN 0xfffffc0000000000 /* unmapped, cached */ -#define K0SEG_END 0xfffffe0000000000 -#define PHYS_UNCACHED 0x0000000040000000 -#endif - -#ifndef _LOCORE -#if 0 /* XXX NOT HERE */ -#define k0segtophys(x) ((vm_offset_t)(x) & 0x00000003ffffffff) -#define phystok0seg(x) ((vm_offset_t)(x) | K0SEG_BEGIN) - -#define phystouncached(x) ((vm_offset_t)(x) | PHYS_UNCACHED) -#define uncachedtophys(x) ((vm_offset_t)(x) & ~PHYS_UNCACHED) -#endif - -#define PTEMASK (NPTEPG - 1) -#define vatopte(va) (((va) >> PGSHIFT) & PTEMASK) -#define vatoste(va) (((va) >> SEGSHIFT) & PTEMASK) -#define kvtol1pte(va) \ - (((vm_offset_t)(va) >> (PGSHIFT + 2*(PGSHIFT-PTESHIFT))) & PTEMASK) - -#define vatopa(va) \ - ((PG_PFNUM(*kvtopte(va)) << PGSHIFT) | ((vm_offset_t)(va) & PGOFSET)) - -#define ALPHA_STSIZE ((u_long)PAGE_SIZE) /* 8k */ -#define ALPHA_MAX_PTSIZE ((u_long)(NPTEPG * NBPG)) /* 8M */ - -#endif diff --git a/sys/alpha/include/ptrace.h b/sys/alpha/include/ptrace.h deleted file mode 100644 index 657800c..0000000 --- a/sys/alpha/include/ptrace.h +++ /dev/null @@ -1,40 +0,0 @@ -/*- - * 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. - * 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 - * $FreeBSD$ - */ - -#ifndef _MACHINE_PTRACE_H_ -#define _MACHINE_PTRACE_H_ - -#ifdef _KERNEL -#define FIX_SSTEP(p) ptrace_clear_single_step(p) -#endif - -#endif diff --git a/sys/alpha/include/reg.h b/sys/alpha/include/reg.h deleted file mode 100644 index 573f825..0000000 --- a/sys/alpha/include/reg.h +++ /dev/null @@ -1,125 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: reg.h,v 1.3 1997/04/06 08:47:40 cgd Exp */ - -/*- - * Copyright (c) 1994, 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_REG_H_ -#define _ALPHA_REG_H_ - -/* - * XXX where did this info come from? - */ - -/* - * Struct reg, used for procfs and in signal contexts - * Note that in signal contexts, it's represented as an array. - * That array has to look exactly like 'struct reg' though. - */ -#define R_V0 0 -#define R_T0 1 -#define R_T1 2 -#define R_T2 3 -#define R_T3 4 -#define R_T4 5 -#define R_T5 6 -#define R_T6 7 -#define R_T7 8 -#define R_S0 9 -#define R_S1 10 -#define R_S2 11 -#define R_S3 12 -#define R_S4 13 -#define R_S5 14 -#define R_S6 15 -#define R_A0 16 -#define R_A1 17 -#define R_A2 18 -#define R_A3 19 -#define R_A4 20 -#define R_A5 21 -#define R_T8 22 -#define R_T9 23 -#define R_T10 24 -#define R_T11 25 -#define R_RA 26 -#define R_T12 27 -#define R_AT 28 -#define R_GP 29 -#define R_SP 30 -#define R_ZERO 31 - -/* - * Register extensions used in mcontext_t - */ -#define R_PS 32 -#define R_PC 33 -#define R_TRAPARG_A0 34 -#define R_TRAPARG_A1 35 -#define R_TRAPARG_A2 36 - -struct reg { - u_int64_t r_regs[32]; -}; - -/* - * Floating point unit state. (also, register set used for ptrace.) - * - * The floating point registers for a process, saved only when - * necessary. - * - * Note that in signal contexts, it's represented as an array. - * That array has to look exactly like 'struct reg' though. - */ -struct fpreg { - u_int64_t fpr_regs[32]; - u_int64_t fpr_cr; -}; - -/* - * Placeholder. - */ -struct dbreg { - unsigned long junk; -}; - -#ifdef _KERNEL -void restorefpstate(struct fpreg *); -void savefpstate(struct fpreg *); - -/* - * XXX these interfaces are MI, so they should be declared in a MI place. - */ -int fill_regs(struct thread *, struct reg *); -int set_regs(struct thread *, struct reg *); -int fill_fpregs(struct thread *, struct fpreg *); -int set_fpregs(struct thread *, struct fpreg *); -int fill_dbregs(struct thread *, struct dbreg *); -int set_dbregs(struct thread *, struct dbreg *); -#endif - -#endif /* _ALPHA_REG_H_ */ diff --git a/sys/alpha/include/reloc.h b/sys/alpha/include/reloc.h deleted file mode 100644 index 6e50536..0000000 --- a/sys/alpha/include/reloc.h +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. - * 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 John Birrell. - * 4. Neither the name of the author nor the names of any co-contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL 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. - * - * $FreeBSD$ - */ diff --git a/sys/alpha/include/resource.h b/sys/alpha/include/resource.h deleted file mode 100644 index edde5eb..0000000 --- a/sys/alpha/include/resource.h +++ /dev/null @@ -1,44 +0,0 @@ -/* $FreeBSD$ */ -/*- - * Copyright 1998 Massachusetts Institute of Technology - * - * Permission to use, copy, modify, and distribute this software and - * its documentation for any purpose and without fee is hereby - * granted, provided that both the above copyright notice and this - * permission notice appear in all copies, that both the above - * copyright notice and this permission notice appear in all - * supporting documentation, and that the name of M.I.T. not be used - * in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. M.I.T. makes - * no representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied - * warranty. - * - * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS - * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT - * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _MACHINE_RESOURCE_H_ -#define _MACHINE_RESOURCE_H_ 1 - -/* - * Definitions of resource types for Intel Architecture machines - * with support for legacy ISA devices and drivers. - */ - -#define SYS_RES_IRQ 1 /* interrupt lines */ -#define SYS_RES_DRQ 2 /* isa dma lines */ -#define SYS_RES_MEMORY 3 /* i/o memory */ -#define SYS_RES_IOPORT 4 /* i/o ports */ - -#endif /* !_MACHINE_RESOURCE_H_ */ diff --git a/sys/alpha/include/rpb.h b/sys/alpha/include/rpb.h deleted file mode 100644 index 0dd4481..0000000 --- a/sys/alpha/include/rpb.h +++ /dev/null @@ -1,463 +0,0 @@ -/* $NetBSD: rpb.h,v 1.20 1998/04/15 00:47:33 mjacob Exp $ */ -/* $FreeBSD$ */ - -/*- - * 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/Fang" (?) */ -#define ST_DEC_7000 3 /* "Ruby/Laser" (?) */ -#define ST_DEC_3000_500 4 /* "Flamingo" family (TC) */ - /* 5 = "Mannequin" simulator */ -#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" (EISA/PCI) */ -#define ST_DEC_APXVME_64 10 /* "AXPvme" (VME) */ -#define ST_DEC_AXPPCI_33 11 /* "NoName" (PCI/ISA/PCMCIA) */ -#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 /* "Alcor" (PCI/EISA) */ - /* 16 = cancelled */ -#define ST_DEC_1000 17 /* "Mikasa" (PCI/EISA) */ -#define ST_DEC_EB64 18 /* EB64 (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 /* "K2" (PCI/ISA) */ -#define ST_DEC_2100A_A500 24 /* "Lynx" (EISA/PCI) */ -#define ST_DEC_ALPHAXL 25 /* AlphaXL (PCI/ISA) */ -#define ST_EB164 26 /* EB164 (PCI/ISA) */ -#define ST_DEC_1000A 27 /* "Noritake" (PCI/EISA) */ -#define ST_DEC_ALPHAVME_224 28 /* "Cortex" (VME) */ - /* 29 = unused */ -#define ST_DEC_550 30 /* "Miata" (PCI/ISA) */ -#define ST_DEC_XXM 31 /* "XXM" ?? */ -#define ST_DEC_EV56_PBP 32 /* "Takara" (PCI/ISA) */ -#define ST_DEC_ALPHAVME_320 33 /* "Yukon" (VME) */ -#define ST_DEC_6600 34 /* "Tsunami/Typhoon" (PCI) */ -#define ST_DEC_WILDFIRE 35 /* "Wildfire" (PCI)" */ -#define ST_DEC_CUSCO 36 /* "Cusco" */ -#define ST_DEC_EIGER 37 /* "Eiger" */ -#define ST_DEC_TITAN 38 /* "Titan" ES45 (PCI) */ -#define ST_DEC_MARVEL 39 /* "Marvel" (PCI) */ - /* 40 = "Phoenix" (cPCI) */ - -/* - * System types for Alpha Processor Inc. machines - */ - -#define API_ST_BASE 200 -#define ST_API_UP1000 201 /* "Nautilus" */ - - 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 */ - -#define SV_ST_KN20AA 0x00000400 /* AlphaStation 500/600 */ - -/* - * System types for the AXPvme Family - */ -#define SV_ST_AXPVME_64 0x00000000 /* 21068, 64MHz */ -#define SV_ST_AXPVME_160 0x00000400 /* 21066, 160MHz */ -#define SV_ST_AXPVME_100 0x00000c00 /* 21066A, 99MHz */ -#define SV_ST_AXPVME_230 0x00001000 /* 21066A, 231MHz */ -#define SV_ST_AXPVME_66 0x00001400 /* 21066A, 66MHz */ -#define SV_ST_AXPVME_166 0x00001800 /* 21066A, 165MHz */ -#define SV_ST_AXPVME_264 0x00001c00 /* 21066A, 264MHz */ - -/* - * System types for the EB164 Family - */ -#define SV_ST_EB164_266 0x00000400 /* EB164, 266MHz */ -#define SV_ST_EB164_300 0x00000800 /* EB164, 300MHz */ -#define SV_ST_ALPHAPC164_366 0x00000c00 /* AlphaPC164, 366MHz */ -#define SV_ST_ALPHAPC164_400 0x00001000 /* AlphaPC164, 400MHz */ -#define SV_ST_ALPHAPC164_433 0x00001400 /* AlphaPC164, 433MHz */ -#define SV_ST_ALPHAPC164_466 0x00001800 /* AlphaPC164, 466MHz */ -#define SV_ST_ALPHAPC164_500 0x00001c00 /* AlphaPC164, 500MHz */ -#define SV_ST_ALPHAPC164LX_400 0x00002000 /* AlphaPC164LX, 400MHz */ -#define SV_ST_ALPHAPC164LX_466 0x00002400 /* AlphaPC164LX, 466MHz */ -#define SV_ST_ALPHAPC164LX_533 0x00002800 /* AlphaPC164LX, 533MHz */ -#define SV_ST_ALPHAPC164LX_600 0x00002c00 /* AlphaPC164LX, 600MHz */ -#define SV_ST_ALPHAPC164SX_400 0x00003000 /* AlphaPC164SX, 400MHz */ -#define SV_ST_ALPHAPC164SX_466 0x00003400 /* AlphaPC164SX, 433MHz */ -#define SV_ST_ALPHAPC164SX_533 0x00003800 /* AlphaPC164SX, 533MHz */ -#define SV_ST_ALPHAPC164SX_600 0x00003c00 /* AlphaPC164SX, 600MHz */ - -/* - * System types for the Digital Personal Workstation (Miata) Family - * XXX These are not very complete! - */ -#define SV_ST_MIATA_1_5 0x00004c00 /* Miata 1.5 */ - - 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 */ -}; - -#define LOCATE_PCS(h,cpunumber) ((struct pcs *) \ - ((char *)(h) + (h)->rpb_pcs_off + ((cpunumber) * (h)->rpb_pcs_size))) - -/* - * PCS: Per-CPU information. - */ -struct pcs { - - u_int64_t pcs_hwpcb[16]; /* 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; /* 128: */ - - u_int64_t pcs_pal_memsize; /* 136: PAL memory size */ - u_int64_t pcs_pal_scrsize; /* 144: PAL scratch size */ - vm_offset_t pcs_pal_memaddr; /* 152: PAL memory addr */ - vm_offset_t pcs_pal_scraddr; /* 160: 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; /* 168: */ -#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; /* 176: 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_PCA57 10 /* PCA257: 21164PC */ -#define PCS_PROC_EV67 11 /* EV67: 21264A */ -#define PCS_PROC_EV68CB 12 /* EV68CB: 21264C */ -#define PCS_PROC_EV68AL 13 /* EV6AL: 21264B */ -#define PCS_PROC_EV68CX 14 /* EV6CX: 21264D */ - -#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; /* 184: 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]; /* 192: only first 4 valid */ - char pcs_proc_sn[16]; /* 200: only first 10 valid */ - vm_offset_t pcs_machcheck; /* 216: mach chk phys addr. */ - u_int64_t pcs_machcheck_len; /* 224: length in bytes */ - vm_offset_t pcs_halt_pcbb; /* 232: pa of halt PCB */ - vm_offset_t pcs_halt_pc; /* 240: halt PC */ - u_int64_t pcs_halt_ps; /* 248: halt PS */ - u_int64_t pcs_halt_r25; /* 256: halt argument list */ - u_int64_t pcs_halt_r26; /* 264: halt ra list */ - u_int64_t pcs_halt_r27; /* 272: 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; /* 280: */ - - u_int64_t pcs_reserved_soft; /* 288: preserved software */ - struct { - u_int32_t rxlen; - u_int32_t txlen; - char rxbuf[80]; - char txbuf[80]; - } pcs_buffer; /* 296: console buffers */ - -#define PALvar_reserved 0 -#define PALvar_OpenVMS 1 -#define PALvar_OSF1 2 - u_int64_t pcs_palrevisions[16]; /* 464: PALcode revisions */ - - u_int64_t pcs_reserved_arch[6]; /* 592: 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 - -#endif /* ASSEMBLER */ diff --git a/sys/alpha/include/runq.h b/sys/alpha/include/runq.h deleted file mode 100644 index 6d03646..0000000 --- a/sys/alpha/include/runq.h +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org> - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_RUNQ_H_ -#define _MACHINE_RUNQ_H_ - -#define RQB_LEN (1UL) /* Number of priority status words. */ -#define RQB_L2BPW (6UL) /* Log2(sizeof(rqb_word_t) * NBBY)). */ -#define RQB_BPW (1UL<<RQB_L2BPW) /* Bits in an rqb_word_t. */ - -#define RQB_BIT(pri) (1UL << ((pri) & (RQB_BPW - 1))) -#define RQB_WORD(pri) ((pri) >> RQB_L2BPW) - -#define RQB_FFS(word) (ffs64(word) - 1) - -/* - * Type of run queue status word. - */ -typedef u_int64_t rqb_word_t; - -static __inline u_long -ffs64(u_long mask) -{ - u_long bit; - - if (mask == 0) - return (0); - for (bit = 1; (mask & 1UL) == 0; bit++) - mask >>= 1UL; - return (bit); -} - -#endif diff --git a/sys/alpha/include/setjmp.h b/sys/alpha/include/setjmp.h deleted file mode 100644 index bf1bec6..0000000 --- a/sys/alpha/include/setjmp.h +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * Copyright (c) 1994, 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. - * - * $NetBSD: setjmp.h,v 1.2 1997/04/06 08:47:41 cgd Exp $ - * $FreeBSD$ - */ - -/* - * machine/setjmp.h: machine dependent setjmp-related information. - */ - -#ifndef _MACHINE_SETJMP_H_ -#define _MACHINE_SETJMP_H_ - -#include <sys/cdefs.h> - -#define _JBLEN 81 /* Size, in longs, of a jmp_buf. */ - -/* - * jmp_buf and sigjmp_buf are encapsulated in different structs to force - * compile-time diagnostics for mismatches. The structs are the same - * internally to avoid some run-time errors for mismatches. - */ -#if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE -typedef struct _sigjmp_buf { long _sjb[_JBLEN + 1]; } sigjmp_buf[1]; -#endif - -typedef struct _jmp_buf { long _jb[_JBLEN + 1]; } jmp_buf[1]; - -#endif /* !_MACHINE_SETJMP_H_ */ diff --git a/sys/alpha/include/sf_buf.h b/sys/alpha/include/sf_buf.h deleted file mode 100644 index d000e30..0000000 --- a/sys/alpha/include/sf_buf.h +++ /dev/null @@ -1,58 +0,0 @@ -/*- - * Copyright (c) 2003 Alan L. Cox <alc@cs.rice.edu> - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_SF_BUF_H_ -#define _MACHINE_SF_BUF_H_ - -#include <vm/vm.h> -#include <vm/vm_param.h> -#include <vm/vm_page.h> - -/* - * On this machine, the only purpose for which sf_buf is used is to implement - * an opaque pointer required by the machine-independent parts of the kernel. - * That pointer references the vm_page that is "mapped" by the sf_buf. The - * actual mapping is provided by the direct virtual-to-physical mapping. - */ -struct sf_buf; - -static __inline vm_offset_t -sf_buf_kva(struct sf_buf *sf) -{ - - return (ALPHA_PHYS_TO_K0SEG(VM_PAGE_TO_PHYS((vm_page_t)sf))); -} - -static __inline vm_page_t -sf_buf_page(struct sf_buf *sf) -{ - - return ((vm_page_t)sf); -} - -#endif /* !_MACHINE_SF_BUF_H_ */ diff --git a/sys/alpha/include/sgmap.h b/sys/alpha/include/sgmap.h deleted file mode 100644 index 08ccbc7..0000000 --- a/sys/alpha/include/sgmap.h +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_SGMAP_H_ -#define _MACHINE_SGMAP_H_ - -struct sgmap; - -typedef void sgmap_map_callback(void *arg, bus_addr_t ba, vm_offset_t pa); - -vm_offset_t sgmap_overflow_page(void); -struct sgmap *sgmap_map_create(bus_addr_t sba, bus_addr_t eba, - sgmap_map_callback *map, void *arg); -void sgmap_map_destroy(struct sgmap *sgmap); -bus_addr_t sgmap_alloc_region(struct sgmap *sgmap, - bus_size_t size, bus_size_t boundary, - void **mhp); -void sgmap_load_region(struct sgmap *sgmap, bus_addr_t sba, - vm_offset_t va, bus_size_t size); -void sgmap_unload_region(struct sgmap *sgmap, - bus_addr_t sba, bus_size_t size); -void sgmap_free_region(struct sgmap *sgmap, void *mh); - -#endif /* !_MACHINE_SGMAP_H_ */ diff --git a/sys/alpha/include/sigframe.h b/sys/alpha/include/sigframe.h deleted file mode 100644 index 01196e5..0000000 --- a/sys/alpha/include/sigframe.h +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * Copyright (c) 1999 Marcel Moolenaar - * 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 - * in this position and unchanged. - * 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. 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_SIGFRAME_H_ -#define _MACHINE_SIGFRAME_H_ 1 - -#if defined(_KERNEL) && defined(COMPAT_FREEBSD4) -/* FreeBSD 4.x */ -struct sigframe4 { - unsigned long __spare__; - struct ucontext4 sf_uc; - siginfo_t sf_si; -}; -#endif - -struct sigframe { - unsigned long __spare__; - struct __ucontext sf_uc; - siginfo_t sf_si; -}; - -#endif /* _MACHINE_SIGFRAME_H_ */ diff --git a/sys/alpha/include/signal.h b/sys/alpha/include/signal.h deleted file mode 100644 index 06f6a41..0000000 --- a/sys/alpha/include/signal.h +++ /dev/null @@ -1,98 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: signal.h,v 1.3 1997/04/06 08:47:43 cgd Exp */ - -/*- - * Copyright (c) 1994, 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_SIGNAL_H_ -#define _ALPHA_SIGNAL_H_ - -#include <sys/cdefs.h> -#include <sys/_sigset.h> - -typedef long sig_atomic_t; - -/* - * Only the kernel should need these old type definitions. - */ -#if defined(_KERNEL) && defined(COMPAT_43) -/* - * Information pushed on stack when a signal is delivered. - * This is used by the kernel to restore state following - * execution of the signal handler. It is also made available - * to the handler to allow it to restore state properly if - * a non-standard exit is performed. - * - * Note that sc_regs[] and sc_fpregs[]+sc_fpcr are inline - * representations of 'struct reg' and 'struct fpreg', respectively. - */ -struct osigcontext { - long sc_onstack; /* sigstack state to restore */ - long sc_mask; /* signal mask to restore */ - long sc_pc; /* pc to restore */ - long sc_ps; /* ps to restore */ - unsigned long sc_regs[32]; /* integer register set (see above) */ - long sc_ownedfp; /* fp has been used */ - unsigned long sc_fpregs[32]; /* FP register set (see above) */ - unsigned long sc_fpcr; /* FP control register (see above) */ - unsigned long sc_fp_control; /* FP software control word */ - long sc_reserved[2]; /* XXX */ - long sc_xxx1[2]; /* sc_ssize, sc_sbase on DUX */ - unsigned long sc_traparg_a0; /* a0 argument to trap at exception */ - unsigned long sc_traparg_a1; /* a1 argument to trap at exception */ - unsigned long sc_traparg_a2; /* a2 argument to trap at exception */ - long sc_xxx2[3]; /* sc_fp_trap_pc, sc_fp_trigger_sum, sc_fp_trigger_inst */ -}; -#endif /* _KERNEL */ - -#if __BSD_VISIBLE -/* - * The sequence of the fields should match those in - * mcontext_t. Keep them in sync! - */ -struct sigcontext { - struct __sigset sc_mask; /* signal mask to restore */ - long sc_onstack; /* sigstack state to restore */ - unsigned long sc_regs[32]; /* integer register set (see above) */ - long sc_ps; /* ps to restore */ - long sc_pc; /* pc to restore */ - unsigned long sc_traparg_a0; /* a0 argument to trap at exception */ - unsigned long sc_traparg_a1; /* a1 argument to trap at exception */ - unsigned long sc_traparg_a2; /* a2 argument to trap at exception */ - unsigned long sc_fpregs[32]; /* FP register set (see above) */ - unsigned long sc_fpcr; /* FP control register (see above) */ - unsigned long sc_fp_control; /* FP software control word */ - long sc_ownedfp; /* fp has been used; see mcontext_t */ - long sc_format; /* see mcontext_t */ - long sc_spare[6]; /* XXX */ -}; - -#define sc_sp sc_regs[R_SP] - -#endif /* __BSD_VISIBLE */ - -#endif /* !_ALPHA_SIGNAL_H_*/ diff --git a/sys/alpha/include/smp.h b/sys/alpha/include/smp.h deleted file mode 100644 index 9bfd0c6..0000000 --- a/sys/alpha/include/smp.h +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * ---------------------------------------------------------------------------- - * "THE BEER-WARE LICENSE" (Revision 42): - * <phk@FreeBSD.org> wrote this file. As long as you retain this notice you - * can do whatever you want with this stuff. If we meet some day, and you think - * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp - * ---------------------------------------------------------------------------- - * - * $FreeBSD$ - * - */ - -#ifndef _MACHINE_SMP_H_ -#define _MACHINE_SMP_H_ - -#ifdef _KERNEL - -/* - * Interprocessor interrupts for SMP. - */ -#define IPI_INVLTLB 0x0001 -#define IPI_RENDEZVOUS 0x0002 -#define IPI_AST 0x0004 -#define IPI_CHECKSTATE 0x0008 -#define IPI_STOP 0x0010 - -#ifndef LOCORE - -extern u_int64_t boot_cpu_id; -extern struct pcb stoppcbs[]; - -void ipi_selected(u_int cpus, u_int64_t ipi); -void ipi_all(u_int64_t ipi); -void ipi_all_but_self(u_int64_t ipi); -void ipi_self(u_int64_t ipi); -void smp_handle_ipi(struct trapframe *frame); -void smp_init_secondary(void); - -#endif /* !LOCORE */ -#endif /* _KERNEL */ -#endif /* _MACHINE_SMP_H_ */ diff --git a/sys/alpha/include/stdarg.h b/sys/alpha/include/stdarg.h deleted file mode 100644 index 1344962..0000000 --- a/sys/alpha/include/stdarg.h +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * Copyright (c) 2002 David E. O'Brien. All rights reserved. - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. 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. - * - * @(#)stdarg.h 8.1 (Berkeley) 6/10/93 - * $NetBSD: stdarg.h,v 1.7 1997/04/06 08:47:44 cgd Exp $ - * $FreeBSD$ - */ - -#ifndef _MACHINE_STDARG_H_ -#define _MACHINE_STDARG_H_ - -#include <sys/cdefs.h> -#include <sys/_types.h> - -#ifndef _VA_LIST_DECLARED -#define _VA_LIST_DECLARED -typedef __va_list va_list; -#endif - -#ifdef __GNUCLIKE_BUILTIN_STDARG - -#define va_start(ap, last) \ - __builtin_stdarg_start((ap), (last)) - -#define va_arg(ap, type) \ - __builtin_va_arg((ap), type) - -#if __ISO_C_VISIBLE >= 1999 -#define va_copy(dest, src) \ - __builtin_va_copy((dest), (src)) -#endif - -#define va_end(ap) \ - __builtin_va_end(ap) - -#else /* !__GNUCLIKE_BUILTIN_STDARG */ - -#ifdef __lint__ -#define __builtin_saveregs() (0) -#define __builtin_classify_type(t) (0) -#endif - -#define __va_size(type) \ - (((sizeof(type) + sizeof(long) - 1) / sizeof(long)) * sizeof(long)) - -#define va_start(ap, last) \ - (__builtin_next_arg(last), (ap) = *(va_list *)__builtin_saveregs(), (ap).__pad = 0) - -#define __REAL_TYPE_CLASS 8 -#define __va_arg_offset(ap, type) \ - ((__builtin_classify_type(*(type *)0) == __REAL_TYPE_CLASS && \ - (ap).__offset <= (6 * 8) ? -(6 * 8) : 0) - __va_size(type)) - -#define va_arg(ap, type) \ - (*(type *)((ap).__offset += __va_size(type), \ - (ap).__base + (ap).__offset + __va_arg_offset(ap, type))) - -#define va_end(ap) ((void)0) - -#endif /* __GNUCLIKE_BUILTIN_STDARG */ - -#endif /* !_MACHINE_STDARG_H_ */ diff --git a/sys/alpha/include/swiz.h b/sys/alpha/include/swiz.h deleted file mode 100644 index 465a81a..0000000 --- a/sys/alpha/include/swiz.h +++ /dev/null @@ -1,95 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_SWIZ_H_ -#define _MACHINE_SWIZ_H_ - -/* - * Macros for accessing device ports or memory in a sparse address space. - */ - -#define SPARSE_READ(o) (*(u_int32_t*) (o)) -#define SPARSE_WRITE(o, d) (*(u_int32_t*) (o) = (d)) - -#define SPARSE_BYTE_OFFSET(o) (((o) << 5) | (0 << 3)) -#define SPARSE_WORD_OFFSET(o) (((o) << 5) | (1 << 3)) -#define SPARSE_LONG_OFFSET(o) (((o) << 5) | (3 << 3)) - -#define SPARSE_BYTE_ADDRESS(base, o) ((base) + SPARSE_BYTE_OFFSET(o)) -#define SPARSE_WORD_ADDRESS(base, o) ((base) + SPARSE_WORD_OFFSET(o)) -#define SPARSE_LONG_ADDRESS(base, o) ((base) + SPARSE_LONG_OFFSET(o)) - -#define SPARSE_BYTE_EXTRACT(o, d) ((d) >> (8*((o) & 3))) -#define SPARSE_WORD_EXTRACT(o, d) ((d) >> (8*((o) & 2))) -#define SPARSE_LONG_EXTRACT(o, d) (d) - -#define SPARSE_BYTE_INSERT(o, d) ((d) << (8*((o) & 3))) -#define SPARSE_WORD_INSERT(o, d) ((d) << (8*((o) & 2))) -#define SPARSE_LONG_INSERT(o, d) (d) - -#define SPARSE_READ_BYTE(base, o) \ - SPARSE_BYTE_EXTRACT(o, SPARSE_READ(base + SPARSE_BYTE_OFFSET(o))) - -#define SPARSE_READ_WORD(base, o) \ - SPARSE_WORD_EXTRACT(o, SPARSE_READ(base + SPARSE_WORD_OFFSET(o))) - -#define SPARSE_READ_LONG(base, o) \ - SPARSE_READ(base + SPARSE_LONG_OFFSET(o)) - -#define SPARSE_WRITE_BYTE(base, o, d) \ - SPARSE_WRITE(base + SPARSE_BYTE_OFFSET(o), SPARSE_BYTE_INSERT(o, d)) - -#define SPARSE_WRITE_WORD(base, o, d) \ - SPARSE_WRITE(base + SPARSE_WORD_OFFSET(o), SPARSE_WORD_INSERT(o, d)) - -#define SPARSE_WRITE_LONG(base, o, d) \ - SPARSE_WRITE(base + SPARSE_LONG_OFFSET(o), d) - -#ifdef _KERNEL - -/* - * A kernel object for accessing memory-like spaces (port and - * memory spaces) using SWIZ instructions. - */ - -typedef u_int32_t (*swiz_sethae_fn)(void *arg, u_int32_t hae); - -struct swiz_space { - struct alpha_busspace_ops *ops; - u_int64_t base; /* base address of space */ - swiz_sethae_fn sethae; /* function to set HAE */ - void *arg; /* arg to sethae() */ -}; - -void swiz_init_space(struct swiz_space *swiz, u_int64_t base); -void swiz_init_space_hae(struct swiz_space *swiz, u_int64_t base, - swiz_sethae_fn sethae, void *arg); - -#endif /* _KERNEL */ - -#endif /* !_MACHINE_SWIZ_H_ */ diff --git a/sys/alpha/include/sysarch.h b/sys/alpha/include/sysarch.h deleted file mode 100644 index b953d2f..0000000 --- a/sys/alpha/include/sysarch.h +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * Copyright (c) 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. - * 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. - * - * $FreeBSD$ - */ - -/* - * Architecture specific syscalls (alpha) - */ -#ifndef _MACHINE_SYSARCH_H_ -#define _MACHINE_SYSARCH_H_ - -#define ALPHA_SETHAE 0 -#define ALPHA_GET_FPMASK 1 -#define ALPHA_SET_FPMASK 2 -#define ALPHA_GET_UAC 3 -#define ALPHA_SET_UAC 4 - -#ifndef _KERNEL -#include <sys/cdefs.h> - -union descriptor; - -__BEGIN_DECLS -int alpha_sethae(u_int64_t); -int sysarch(int, void *); -__END_DECLS -#endif - -#endif /* !_MACHINE_SYSARCH_H_ */ diff --git a/sys/alpha/include/timerreg.h b/sys/alpha/include/timerreg.h deleted file mode 100644 index 0ab7d40..0000000 --- a/sys/alpha/include/timerreg.h +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * Copyright (C) 2005 TAKAHASHI Yoshihiro. 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 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 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. - * - * $FreeBSD$ - */ - -/* - * The outputs of the three timers are connected as follows: - * - * timer 0 -> irq 0 - * timer 1 -> dma chan 0 (for dram refresh) - * timer 2 -> speaker (via keyboard controller) - * - * Timer 0 is used to call hardclock. - * Timer 2 is used to generate console beeps. - */ - -#ifndef _MACHINE_TIMERREG_H_ -#define _MACHINE_TIMERREG_H_ - -#ifdef _KERNEL - -#include <dev/ic/i8253reg.h> - -#define IO_TIMER1 0x40 /* 8253 Timer #1 */ -#define TIMER_CNTR0 (IO_TIMER1 + TIMER_REG_CNTR0) -#define TIMER_CNTR1 (IO_TIMER1 + TIMER_REG_CNTR1) -#define TIMER_CNTR2 (IO_TIMER1 + TIMER_REG_CNTR2) -#define TIMER_MODE (IO_TIMER1 + TIMER_REG_MODE) - -#define timer_spkr_acquire() \ - acquire_timer2(TIMER_SEL2 | TIMER_SQWAVE | TIMER_16BIT) -#define timer_spkr_release() \ - release_timer2() - -#define spkr_set_pitch(pitch) \ - do { \ - outb(TIMER_CNTR2, (pitch) & 0xff); \ - outb(TIMER_CNTR2, (pitch) >> 8); \ - } while(0) - -#endif /* _KERNEL */ - -#endif /* _MACHINE_TIMERREG_H_ */ diff --git a/sys/alpha/include/ucontext.h b/sys/alpha/include/ucontext.h deleted file mode 100644 index d60cc6c..0000000 --- a/sys/alpha/include/ucontext.h +++ /dev/null @@ -1,69 +0,0 @@ -/*- - * Copyright (c) 1999 Marcel Moolenaar - * 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 - * in this position and unchanged. - * 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. 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. - * - * $FreeBSD$ - */ - -#ifndef _MACHINE_UCONTEXT_H_ -#define _MACHINE_UCONTEXT_H_ - -typedef struct __mcontext { - /* - * These fields must match the definition - * of struct sigcontext. That way we can support - * struct sigcontext and ucontext_t at the same - * time. - */ - long mc_onstack; /* XXX - sigcontext compat. */ - unsigned long mc_regs[37]; - unsigned long mc_fpregs[32]; - unsigned long mc_fpcr; - unsigned long mc_fp_control; -#define _MC_FPOWNED_NONE 0 /* FP state not used */ -#define _MC_FPOWNED_FPU 1 /* FP state came from FPU */ -#define _MC_FPOWNED_PCB 2 /* FP state came from PCB */ - long mc_ownedfp; -#define _MC_REV0_SIGFRAME 1 /* context is a signal frame */ -#define _MC_REV0_TRAPFRAME 2 /* context is a trap frame */ - long mc_format; - long mc_thrptr; /* Thread pointer */ - long mc_spare[5]; -} mcontext_t; - -#if defined(_KERNEL) && defined(COMPAT_FREEBSD4) -struct mcontext4 { - long mc_onstack; /* XXX - sigcontext compat. */ - unsigned long mc_regs[37]; - unsigned long mc_fpregs[32]; - unsigned long mc_fpcr; - unsigned long mc_fp_control; - long mc_ownedfp; - long __spare__[7]; -}; -#endif - -#endif /* !_MACHINE_UCONTEXT_H_ */ diff --git a/sys/alpha/include/varargs.h b/sys/alpha/include/varargs.h deleted file mode 100644 index b05a9a5..0000000 --- a/sys/alpha/include/varargs.h +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * Copyright (c) 2002 David E. O'Brien. All rights reserved. - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * (c) UNIX System Laboratories, Inc. - * All or some portions of this file are derived from material licensed - * to the University of California by American Telephone and Telegraph - * Co. or Unix System Laboratories, Inc. and are reproduced herein with - * the permission of UNIX System Laboratories, Inc. - * - * 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. - * - * @(#)varargs.h 8.2 (Berkeley) 3/22/94 - * $NetBSD: varargs.h,v 1.7 1997/04/06 08:47:46 cgd Exp $ - * $FreeBSD$ - */ - -#ifndef _MACHINE_VARARGS_H_ -#define _MACHINE_VARARGS_H_ - -#ifndef _SYS_CDEFS_H_ -#error this file needs sys/cdefs.h as a prerequisite -#endif - -#if defined(__GNUCLIKE_BUILTIN_VARARGS) - -#include <sys/_types.h> - -#ifndef _VA_LIST_DECLARED -#define _VA_LIST_DECLARED -typedef __va_list va_list; -#endif - -typedef int __builtin_va_alist_t __attribute__((__mode__(__word__))); - -#define va_alist __builtin_va_alist -#define va_dcl __builtin_va_alist_t __builtin_va_alist; ... -#define va_start(ap) __builtin_varargs_start(ap) -#define va_arg(ap, type) __builtin_va_arg((ap), type) -#define va_end(ap) __builtin_va_end(ap) - -#else /* ! __GNUCLIKE_BUILTIN_VARARGS */ - -#include <machine/stdarg.h> - -#define __va_ellipsis ... - -#ifdef __GNUCLIKE_BUILTIN_VAALIST -#define va_alist __builtin_va_alist -#define va_dcl long __builtin_va_alist; __va_ellipsis -#endif - -#undef va_start -#define va_start(ap) \ - ((ap) = *(va_list *)__builtin_saveregs(), (ap).__pad = 0) - -#endif /* __GNUCLIKE_BUILTIN_VARARGS */ - -#endif /* !_MACHINE_VARARGS_H_ */ diff --git a/sys/alpha/include/vmparam.h b/sys/alpha/include/vmparam.h deleted file mode 100644 index cc35d27..0000000 --- a/sys/alpha/include/vmparam.h +++ /dev/null @@ -1,165 +0,0 @@ -/* $FreeBSD$ */ -/* From: NetBSD: vmparam.h,v 1.6 1997/09/23 23:23:23 mjacob Exp */ -#ifndef _ALPHA_VMPARAM_H -#define _ALPHA_VMPARAM_H -/*- - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1992, 1993 - * 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 and Ralph Campbell. - * - * 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. - * 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: Utah $Hdr: vmparam.h 1.16 91/01/18$ - * - * @(#)vmparam.h 8.2 (Berkeley) 4/22/94 - */ - -/* - * Machine dependent constants for Alpha. - */ -/* - * USRTEXT is the start of the user text/data space, while USRSTACK - * is the top (end) of the user stack. Immediately above the user stack - * resides the user structure, which is UPAGES long and contains the - * kernel stack. - */ -#define USRTEXT CLBYTES -/* #define USRSTACK VM_MAXUSER_ADDRESS */ - -/* - * This stack location is suitable for OSF1 emulation. Some OSF - * programs are built as 32bit and assume that the stack is reachable - * with a 32bit value. OSF1 manages to have a variable location for - * the user stack which we should probably also support. - */ -#define USRSTACK (0x12000000LL) - -/* - * Virtual memory related constants, all in bytes - */ -#ifndef MAXTSIZ -#define MAXTSIZ (1<<30) /* max text size (1G) */ -#endif -#ifndef DFLDSIZ -#define DFLDSIZ (1<<27) /* initial data size (128M) */ -#endif -#ifndef MAXDSIZ -#define MAXDSIZ (1<<30) /* max data size (1G) */ -#endif -#ifndef DFLSSIZ -#define DFLSSIZ (1<<21) /* initial stack size (2M) */ -#endif -#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. - * 64 pte's are enough to cover 8 disks * MAXBSIZE. - */ -#ifndef USRIOSIZE -#define USRIOSIZE 64 -#endif - -/* - * Boundary at which to place first MAPMEM segment if not explicitly - * specified. Should be a power of two. This allows some slop for - * the data segment to grow underneath the first mapped segment. - */ -#define MMSEG 0x200000 - -/* - * The size of the clock loop. - */ -#define LOOPPAGES (maxfree - firstfree) - -/* - * The time for a process to be blocked before being very swappable. - * This is a number of seconds which the system takes as being a non-trivial - * amount of real time. You probably shouldn't change this; - * it is used in subtle ways (fractions and multiples of it are, that is, like - * half of a ``long time'', almost a long time, etc.) - * It is related to human patience and other factors which don't really - * change over time. - */ -#define MAXSLP 20 - -/* - * A swapped in process is given a small amount of core without being bothered - * by the page replacement algorithm. Basically this says that if you are - * swapped in you deserve some resources. We protect the last SAFERSS - * pages against paging and will just swap you out rather than paging you. - * Note that each process has at least UPAGES pages which are not - * paged anyways, in addition to SAFERSS. - */ -#define SAFERSS 10 /* nominal ``small'' resident set size - protected against replacement */ - -/* - * Alpha provides a machine specific single page allocator through the use - * of K0SEG. - */ -#define UMA_MD_SMALL_ALLOC - -/* - * Mach derived constants - */ - -/* user/kernel map constants */ -#define VM_MIN_ADDRESS (ALPHA_USEG_BASE) /* 0 */ -#define VM_MAXUSER_ADDRESS ((ALPHA_USEG_END + 1LL)) -#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS -#define VM_MIN_KERNEL_ADDRESS (ALPHA_K1SEG_BASE) -#define VM_MAX_KERNEL_ADDRESS (ALPHA_K1SEG_END) - -/* virtual sizes (bytes) for various kernel submaps */ -#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 (0xfffffffe00000000LL) /* Virt. pg table */ -#endif /* !_ALPHA_VMPARAM_H */ diff --git a/sys/alpha/isa/isa.c b/sys/alpha/isa/isa.c deleted file mode 100644 index 36b23d4..0000000 --- a/sys/alpha/isa/isa.c +++ /dev/null @@ -1,417 +0,0 @@ -/*- - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/module.h> -#include <sys/mutex.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <sys/malloc.h> -#include <sys/proc.h> -#include <sys/rman.h> -#include <sys/interrupt.h> - -#include <isa/isareg.h> -#include <isa/isavar.h> -#include <isa/isa_common.h> -#include <alpha/isa/isavar.h> -#include <machine/intr.h> -#include <machine/intrcnt.h> -#include <machine/resource.h> -#include <machine/cpuconf.h> - -static struct rman isa_irq_rman; -static struct rman isa_drq_rman; - -static void -isa_intr_enable(int irq) -{ - - if (irq < 8) - outb(IO_ICU1+1, inb(IO_ICU1+1) & ~(1 << irq)); - else - outb(IO_ICU2+1, inb(IO_ICU2+1) & ~(1 << (irq - 8))); -} - -static void -isa_intr_disable(int irq) -{ - - if (irq < 8) - outb(IO_ICU1+1, inb(IO_ICU1+1) | (1 << irq)); - else - outb(IO_ICU2+1, inb(IO_ICU2+1) | (1 << (irq - 8))); -} - -intrmask_t -isa_irq_pending(void) -{ - u_char irr1; - u_char irr2; - - irr1 = inb(IO_ICU1); - irr2 = inb(IO_ICU2); - return ((irr2 << 8) | irr1); -} - -intrmask_t -isa_irq_mask(void) -{ - u_char irr1; - u_char irr2; - - irr1 = inb(IO_ICU1+1); - irr2 = inb(IO_ICU2+1); - return ((irr2 << 8) | irr1); -} - -void -isa_init(device_t dev) -{ - isa_init_intr(); -} - -void -isa_init_intr(void) -{ - static int initted = 0; - - if (initted) return; - initted = 1; - - isa_irq_rman.rm_start = 0; - isa_irq_rman.rm_end = 15; - isa_irq_rman.rm_type = RMAN_ARRAY; - isa_irq_rman.rm_descr = "ISA Interrupt request lines"; - if (rman_init(&isa_irq_rman) - || rman_manage_region(&isa_irq_rman, 0, 1) - || rman_manage_region(&isa_irq_rman, 3, 15)) - panic("isa_probe isa_irq_rman"); - - isa_drq_rman.rm_start = 0; - isa_drq_rman.rm_end = 7; - isa_drq_rman.rm_type = RMAN_ARRAY; - isa_drq_rman.rm_descr = "ISA DMA request lines"; - if (rman_init(&isa_drq_rman) - || rman_manage_region(&isa_drq_rman, 0, 7)) - panic("isa_probe isa_drq_rman"); - - /* mask all isa interrupts */ - outb(IO_ICU1+1, 0xff); - outb(IO_ICU2+1, 0xff); - - /* make sure chaining irq is enabled */ - isa_intr_enable(2); -} - -struct resource * -isa_alloc_intr(device_t bus, device_t child, int irq) -{ - return rman_reserve_resource(&isa_irq_rman, irq, irq, 1, - 0, child); -} - -struct resource * -isa_alloc_intrs(device_t bus, device_t child, u_long start, u_long end) -{ - return rman_reserve_resource(&isa_irq_rman, start, end, - end - start + 1, 0, child); -} - -int -isa_release_intr(device_t bus, device_t child, struct resource *r) -{ - return rman_release_resource(r); -} - -/* - * This implementation simply passes the request up to the parent - * bus, which in our case is the pci chipset device, substituting any - * configured values if the caller defaulted. We can get away with - * this because there is no special mapping for ISA resources on this - * platform. When porting this code to another architecture, it may be - * necessary to interpose a mapping layer here. - * - * We manage our own interrupt resources since ISA interrupts go through - * the ISA PIC, not the PCI interrupt controller. - */ -struct resource * -isa_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) -{ - /* - * Consider adding a resource definition. - */ - int passthrough = (device_get_parent(child) != bus); - int isdefault = (start == 0UL && end == ~0UL); - struct isa_device* idev = DEVTOISA(child); - struct resource_list *rl = &idev->id_resources; - struct resource_list_entry *rle; - struct resource *res; - - if (!passthrough && !isdefault) { - rle = resource_list_find(rl, type, *rid); - if (!rle) { - if (*rid < 0) - return 0; - switch (type) { - case SYS_RES_IRQ: - if (*rid >= ISA_NIRQ) - return 0; - break; - case SYS_RES_DRQ: - if (*rid >= ISA_NDRQ) - return 0; - break; - case SYS_RES_MEMORY: - if (*rid >= ISA_NMEM) - return 0; - break; - case SYS_RES_IOPORT: - if (*rid >= ISA_NPORT) - return 0; - break; - default: - return 0; - } - resource_list_add(rl, type, *rid, start, end, count); - } - } - - if (type != SYS_RES_IRQ && type != SYS_RES_DRQ) - return resource_list_alloc(rl, bus, child, type, rid, - start, end, count, flags); - - if (!passthrough) { - rl = device_get_ivars(child); - rle = resource_list_find(rl, type, *rid); - if (!rle) - return 0; - if (rle->res) - panic("isa_alloc_resource: resource entry is busy"); - if (isdefault) { - start = end = rle->start; - count = 1; - } - } - - res = rman_reserve_resource( - (type == SYS_RES_IRQ) ? &isa_irq_rman : &isa_drq_rman, - start, start, 1, 0, child); - if (res == NULL) - return (NULL); - - rman_set_rid(res, *rid); - if (!passthrough) { - rle = resource_list_find(rl, type, *rid); - rle->start = rman_get_start(res); - rle->end = rman_get_end(res); - rle->count = 1; - rle->res = res; - } - return (res); -} - -int -isa_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *res) -{ - int passthrough = (device_get_parent(child) != bus); - struct isa_device* idev = DEVTOISA(child); - struct resource_list *rl = &idev->id_resources; - struct resource_list_entry *rle; - int error; - - if (type != SYS_RES_IRQ) - return resource_list_release(rl, bus, child, type, rid, res); - - error = rman_release_resource(res); - - if (!passthrough && !error) { - rle = resource_list_find(rl, SYS_RES_IRQ, rid); - if (rle) - rle->res = NULL; - else - error = ENOENT; - } - - return error; -} - -struct isa_intr { - void *ih; - driver_intr_t *intr; - void *arg; - int irq; -}; - -/* - * Wrap ISA interrupt routines so that we can feed non-specific - * EOI to the PICs. - */ - -static void -isa_handle_fast_intr(void *arg) -{ - struct isa_intr *ii = arg; - int irq = ii->irq; - - ii->intr(ii->arg); - - mtx_lock_spin(&icu_lock); - if (irq > 7) - outb(IO_ICU2, 0x20 | (irq & 7)); - outb(IO_ICU1, 0x20 | (irq > 7 ? 2 : irq)); - mtx_unlock_spin(&icu_lock); -} - -static void -isa_handle_intr(void *arg) -{ - struct isa_intr *ii = arg; - - ii->intr(ii->arg); -} - -/* - * Send a non-specific EIO early, then disable the source - */ - -static void -isa_disable_intr(uintptr_t vector) -{ - int irq; - - irq = (vector - 0x800) >> 4; - mtx_lock_spin(&icu_lock); - if (irq > 7) - outb(IO_ICU2, 0x20 | (irq & 7)); - outb(IO_ICU1, 0x20 | (irq > 7 ? 2 : irq)); - - isa_intr_disable(irq); - mtx_unlock_spin(&icu_lock); -} - -static void -isa_enable_intr(uintptr_t vector) -{ - int irq; - - irq = (vector - 0x800) >> 4; - mtx_lock_spin(&icu_lock); - isa_intr_enable(irq); - mtx_unlock_spin(&icu_lock); -} - - -int -isa_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, - driver_intr_t *intr, void *arg, void **cookiep) -{ - struct isa_intr *ii; - int error; - - if (platform.isa_setup_intr) - return platform.isa_setup_intr(dev, child, irq, flags, - intr, arg, cookiep); - - if (irq == NULL) - return ENODEV; - - error = rman_activate_resource(irq); - if (error) - return error; - - ii = malloc(sizeof(struct isa_intr), M_DEVBUF, M_NOWAIT); - if (!ii) - return ENOMEM; - ii->intr = intr; - ii->arg = arg; - ii->irq = rman_get_start(irq); - - error = alpha_setup_intr( - device_get_nameunit(child ? child : dev), - 0x800 + (ii->irq << 4), - ((flags & INTR_FAST) ? isa_handle_fast_intr : - isa_handle_intr), ii, flags, &ii->ih, - &intrcnt[INTRCNT_ISA_IRQ + ii->irq], - isa_disable_intr, isa_enable_intr); - if (error) { - free(ii, M_DEVBUF); - return error; - } - mtx_lock_spin(&icu_lock); - isa_intr_enable(ii->irq); - mtx_unlock_spin(&icu_lock); - - *cookiep = ii; - - if (child) - device_printf(child, "interrupting at ISA irq %d\n", - (int)ii->irq); - - return 0; -} - -int -isa_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie) -{ - struct isa_intr *ii = cookie; - struct intr_handler *ih, *handler = (struct intr_handler *)ii->ih; - struct intr_event *ie = handler->ih_event; - int num_handlers = 0; - - mtx_lock(&ie->ie_lock); - TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) - num_handlers++; - mtx_unlock(&ie->ie_lock); - - /* - * Only disable the interrupt in hardware if there are no - * other handlers sharing it. - */ - - if (num_handlers == 1) { - mtx_lock_spin(&icu_lock); - isa_intr_disable(ii->irq); - mtx_unlock_spin(&icu_lock); - if (platform.isa_teardown_intr) { - platform.isa_teardown_intr(dev, child, irq, cookie); - return 0; - } - - } - alpha_teardown_intr(ii->ih); - return 0; -} diff --git a/sys/alpha/isa/isa_dma.c b/sys/alpha/isa/isa_dma.c deleted file mode 100644 index 85e088f..0000000 --- a/sys/alpha/isa/isa_dma.c +++ /dev/null @@ -1,505 +0,0 @@ -/*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * 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. - * 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: @(#)isa.c 7.2 (Berkeley) 5/13/91 - * from: isa_dma.c,v 1.3 1999/05/09 23:56:00 peter Exp $ - */ - -/* - * code to manage AT bus - * - * 92/08/18 Frank P. MacLachlan (fpm@crash.cts.com): - * Fixed uninitialized variable problem and added code to deal - * with DMA page boundaries in isa_dmarangecheck(). Fixed word - * mode DMA count compution and reorganized DMA setup code in - * isa_dmastart() - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/malloc.h> -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/bus.h> -#include <vm/vm.h> -#include <vm/vm_param.h> -#include <vm/pmap.h> -#include <isa/isareg.h> -#include <isa/isavar.h> -#include <isa/isa_dmareg.h> -#include <machine/bus.h> - -static bus_dma_tag_t dma_tag[8]; -static bus_dmamap_t dma_map[8]; -static u_int8_t dma_busy = 0; /* Used in isa_dmastart() */ -static u_int8_t dma_inuse = 0; /* User for acquire/release */ -static u_int8_t dma_auto_mode = 0; -static u_int8_t dma_bounced = 0; - -#define VALID_DMA_MASK (7) - -/* high byte of address is stored in this port for i-th dma channel */ -static int dmapageport[8] = { 0x87, 0x83, 0x81, 0x82, 0x8f, 0x8b, 0x89, 0x8a }; - -/* - * Setup a DMA channel's bounce buffer. - */ -int -isa_dma_init(int chan, u_int bouncebufsize, int flag __unused) -{ - static int initted = 0; - bus_addr_t boundary = chan >= 4 ? 0x20000 : 0x10000; - - if (!initted) { - /* - * Reset the DMA hardware. - */ - outb(DMA1_RESET, 0); - outb(DMA2_RESET, 0); - isa_dmacascade(4); - - initted = 1; - } - -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dma_init: channel out of range"); - - if (dma_tag[chan] || dma_map[chan]) - panic("isa_dma_init: impossible request"); -#endif - - if (bus_dma_tag_create(/*parent*/NULL, - /*alignment*/2, - /*boundary*/boundary, - /*lowaddr*/BUS_SPACE_MAXADDR_24BIT, - /*highaddr*/BUS_SPACE_MAXADDR, - /*filter*/NULL, /*filterarg*/NULL, - /*maxsize*/bouncebufsize, - /*nsegments*/1, /*maxsegz*/0x3ffff, - /*flags*/BUS_DMA_ISA, - /*lockfunc*/busdma_lock_mutex, - /*lockarg*/&Giant, - &dma_tag[chan]) != 0) { - panic("isa_dma_init: unable to create dma tag\n"); - } - - if (bus_dmamap_create(dma_tag[chan], 0, &dma_map[chan])) { - panic("isa_dma_init: unable to create dma map\n"); - } - return (0); -} - -/* - * Register a DMA channel's usage. Usually called from a device driver - * in open() or during its initialization. - */ -int -isa_dma_acquire(chan) - int chan; -{ -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dma_acquire: channel out of range"); -#endif - - if (dma_inuse & (1 << chan)) { - printf("isa_dma_acquire: channel %d already in use\n", chan); - return (EBUSY); - } - dma_inuse |= (1 << chan); - dma_auto_mode &= ~(1 << chan); - - return (0); -} - -/* - * Unregister a DMA channel's usage. Usually called from a device driver - * during close() or during its shutdown. - */ -void -isa_dma_release(chan) - int chan; -{ -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dma_release: channel out of range"); - - if ((dma_inuse & (1 << chan)) == 0) - printf("isa_dma_release: channel %d not in use\n", chan); -#endif - - if (dma_busy & (1 << chan)) { - dma_busy &= ~(1 << chan); - /* - * XXX We should also do "dma_bounced &= (1 << chan);" - * because we are acting on behalf of isa_dmadone() which - * was not called to end the last DMA operation. This does - * not matter now, but it may in the future. - */ - } - - dma_inuse &= ~(1 << chan); - dma_auto_mode &= ~(1 << chan); -} - -/* - * isa_dmacascade(): program 8237 DMA controller channel to accept - * external dma control by a board. - */ -void -isa_dmacascade(chan) - int chan; -{ -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dmacascade: channel out of range"); -#endif - - /* set dma channel mode, and set dma channel mode */ - if ((chan & 4) == 0) { - outb(DMA1_MODE, DMA37MD_CASCADE | chan); - outb(DMA1_SMSK, chan); - } else { - outb(DMA2_MODE, DMA37MD_CASCADE | (chan & 3)); - outb(DMA2_SMSK, chan & 3); - } -} - -/* - * isa_dmastart(): program 8237 DMA controller channel. - */ - -struct isa_dmastart_arg { - caddr_t addr; - int chan; - int flags; -}; - -static void isa_dmastart_cb(void *arg, bus_dma_segment_t *segs, int nseg, - int error) -{ - caddr_t addr = ((struct isa_dmastart_arg *) arg)->addr; - int chan = ((struct isa_dmastart_arg *) arg)->chan; - int flags = ((struct isa_dmastart_arg *) arg)->flags; - bus_addr_t phys = segs->ds_addr; - int nbytes = segs->ds_len; - int waport; - - if (nseg != 1) - panic("isa_dmastart: transfer mapping not contiguous"); - - if ((chipset.sgmap == NULL) && - (pmap_extract(kernel_pmap, (vm_offset_t)addr) - > BUS_SPACE_MAXADDR_24BIT)) { - /* we bounced */ - dma_bounced |= (1 << chan); - /* copy bounce buffer on write */ - if (!(flags & ISADMA_READ)) - bus_dmamap_sync(dma_tag[chan], dma_map[chan], - BUS_DMASYNC_PREWRITE); - } - - if ((chan & 4) == 0) { - /* - * Program one of DMA channels 0..3. These are - * byte mode channels. - */ - /* set dma channel mode, and reset address ff */ - - /* If ISADMA_RAW flag is set, then use autoinitialise mode */ - if (flags & ISADMA_RAW) { - if (flags & ISADMA_READ) - outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_WRITE|chan); - else - outb(DMA1_MODE, DMA37MD_AUTO|DMA37MD_READ|chan); - } - else - if (flags & ISADMA_READ) - outb(DMA1_MODE, DMA37MD_SINGLE|DMA37MD_WRITE|chan); - else - outb(DMA1_MODE, DMA37MD_SINGLE|DMA37MD_READ|chan); - outb(DMA1_FFC, 0); - - /* send start address */ - waport = DMA1_CHN(chan); - outb(waport, phys); - outb(waport, phys>>8); - outb(dmapageport[chan], phys>>16); - - /* send count */ - outb(waport + 1, --nbytes); - outb(waport + 1, nbytes>>8); - - /* unmask channel */ - outb(DMA1_SMSK, chan); - } else { - /* - * Program one of DMA channels 4..7. These are - * word mode channels. - */ - /* set dma channel mode, and reset address ff */ - - /* If ISADMA_RAW flag is set, then use autoinitialise mode */ - if (flags & ISADMA_RAW) { - if (flags & ISADMA_READ) - outb(DMA2_MODE, DMA37MD_AUTO|DMA37MD_WRITE|(chan&3)); - else - outb(DMA2_MODE, DMA37MD_AUTO|DMA37MD_READ|(chan&3)); - } - else - if (flags & ISADMA_READ) - outb(DMA2_MODE, DMA37MD_SINGLE|DMA37MD_WRITE|(chan&3)); - else - outb(DMA2_MODE, DMA37MD_SINGLE|DMA37MD_READ|(chan&3)); - outb(DMA2_FFC, 0); - - /* send start address */ - waport = DMA2_CHN(chan - 4); - outb(waport, phys>>1); - outb(waport, phys>>9); - outb(dmapageport[chan], phys>>16); - - /* send count */ - nbytes >>= 1; - outb(waport + 2, --nbytes); - outb(waport + 2, nbytes>>8); - - /* unmask channel */ - outb(DMA2_SMSK, chan & 3); - } -} - -void -isa_dmastart(int flags, caddr_t addr, u_int nbytes, int chan) -{ - struct isa_dmastart_arg args; - -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dmastart: channel out of range"); - - if ((chan < 4 && nbytes > (1<<16)) - || (chan >= 4 && (nbytes > (1<<17) || (uintptr_t)addr & 1))) - panic("isa_dmastart: impossible request"); - - if ((dma_inuse & (1 << chan)) == 0) - printf("isa_dmastart: channel %d not acquired\n", chan); -#endif - -#if 0 - /* - * XXX This should be checked, but drivers like ad1848 only call - * isa_dmastart() once because they use Auto DMA mode. If we - * leave this in, drivers that do this will print this continuously. - */ - if (dma_busy & (1 << chan)) - printf("isa_dmastart: channel %d busy\n", chan); -#endif - - if (!dma_tag || !dma_map[chan]) - panic("isa_dmastart: called without isa_dma_init"); - - dma_busy |= (1 << chan); - - if (flags & ISADMA_RAW) { - dma_auto_mode |= (1 << chan); - } else { - dma_auto_mode &= ~(1 << chan); - } - - /* - * Freeze dma while updating registers. - */ - outb(chan & 4 ? DMA2_SMSK : DMA1_SMSK, (chan & 3) | 4); - - args.addr = addr; - args.chan = chan; - args.flags = flags; - bus_dmamap_load(dma_tag[chan], dma_map[chan], addr, nbytes, - isa_dmastart_cb, &args, 0); -} - -void -isa_dmadone(int flags, caddr_t addr, int nbytes, int chan) -{ -#ifdef DIAGNOSTIC - if (chan & ~VALID_DMA_MASK) - panic("isa_dmadone: channel out of range"); - - if ((dma_inuse & (1 << chan)) == 0) - printf("isa_dmadone: channel %d not acquired\n", chan); -#endif - - if (((dma_busy & (1 << chan)) == 0) && - (dma_auto_mode & (1 << chan)) == 0 ) - printf("isa_dmadone: channel %d not busy\n", chan); - - if (dma_bounced & (1 << chan)) { - /* copy bounce buffer on read */ - if (flags & ISADMA_READ) { - bus_dmamap_sync(dma_tag[chan], dma_map[chan], - BUS_DMASYNC_POSTREAD); - } - dma_bounced &= ~(1 << chan); - } - - if ((dma_auto_mode & (1 << chan)) == 0) { - outb(chan & 4 ? DMA2_SMSK : DMA1_SMSK, (chan & 3) | 4); - bus_dmamap_unload(dma_tag[chan], dma_map[chan]); - } - - dma_busy &= ~(1 << chan); -} - -/* - * Query the progress of a transfer on a DMA channel. - * - * To avoid having to interrupt a transfer in progress, we sample - * each of the high and low databytes twice, and apply the following - * logic to determine the correct count. - * - * Reads are performed with interrupts disabled, thus it is to be - * expected that the time between reads is very small. At most - * one rollover in the low count byte can be expected within the - * four reads that are performed. - * - * There are three gaps in which a rollover can occur : - * - * - read low1 - * gap1 - * - read high1 - * gap2 - * - read low2 - * gap3 - * - read high2 - * - * If a rollover occurs in gap1 or gap2, the low2 value will be - * greater than the low1 value. In this case, low2 and high2 are a - * corresponding pair. - * - * In any other case, low1 and high1 can be considered to be correct. - * - * The function returns the number of bytes remaining in the transfer, - * or -1 if the channel requested is not active. - * - */ -int -isa_dmastatus(int chan) -{ - u_long cnt = 0; - int ffport, waport; - u_long low1, high1, low2, high2; - int s; - - /* channel active? */ - if ((dma_inuse & (1 << chan)) == 0) { - printf("isa_dmastatus: channel %d not active\n", chan); - return(-1); - } - /* channel busy? */ - - if (((dma_busy & (1 << chan)) == 0) && - (dma_auto_mode & (1 << chan)) == 0 ) { - printf("chan %d not busy\n", chan); - return -2 ; - } - if (chan < 4) { /* low DMA controller */ - ffport = DMA1_FFC; - waport = DMA1_CHN(chan) + 1; - } else { /* high DMA controller */ - ffport = DMA2_FFC; - waport = DMA2_CHN(chan - 4) + 2; - } - - s = splhigh(); /* no interrupts Mr Jones! */ - outb(ffport, 0); /* clear register LSB flipflop */ - low1 = inb(waport); - high1 = inb(waport); - outb(ffport, 0); /* clear again */ - low2 = inb(waport); - high2 = inb(waport); - splx(s); /* enable interrupts again */ - - /* - * Now decide if a wrap has tried to skew our results. - * Note that after TC, the count will read 0xffff, while we want - * to return zero, so we add and then mask to compensate. - */ - if (low1 >= low2) { - cnt = (low1 + (high1 << 8) + 1) & 0xffff; - } else { - cnt = (low2 + (high2 << 8) + 1) & 0xffff; - } - - if (chan >= 4) /* high channels move words */ - cnt *= 2; - return(cnt); -} - -/* - * Reached terminal count yet ? - */ -int -isa_dmatc(int chan) -{ - - if (chan < 4) - return(inb(DMA1_STATUS) & (1 << chan)); - else - return(inb(DMA2_STATUS) & (1 << (chan & 3))); -} - -/* - * Stop a DMA transfer currently in progress. - */ -int -isa_dmastop(int chan) -{ - if ((dma_inuse & (1 << chan)) == 0) - printf("isa_dmastop: channel %d not acquired\n", chan); - - if (((dma_busy & (1 << chan)) == 0) && - ((dma_auto_mode & (1 << chan)) == 0)) { - printf("chan %d not busy\n", chan); - return -2 ; - } - - if ((chan & 4) == 0) { - outb(DMA1_SMSK, (chan & 3) | 4 /* disable mask */); - } else { - outb(DMA2_SMSK, (chan & 3) | 4 /* disable mask */); - } - return(isa_dmastatus(chan)); -} diff --git a/sys/alpha/isa/isavar.h b/sys/alpha/isa/isavar.h deleted file mode 100644 index adadbf7..0000000 --- a/sys/alpha/isa/isavar.h +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -/* - * Export low-level interrupt handling code for chipsets which route - * interrupts via the ISA interrupt controller. - */ -void isa_init_intr(void); -struct resource *isa_alloc_intr(device_t bus, device_t child, int irq); -struct resource *isa_alloc_intrs(device_t bus, device_t child, u_long start, - u_long end); -int isa_release_intr(device_t bus, device_t child, struct resource *r); -int isa_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, - driver_intr_t *intr, void *arg, void **cookiep); -int isa_teardown_intr(device_t dev, device_t child, struct resource *irq, - void *cookie); -intrmask_t isa_irq_mask(void); diff --git a/sys/alpha/isa/mcclock_isa.c b/sys/alpha/isa/mcclock_isa.c deleted file mode 100644 index de13690..0000000 --- a/sys/alpha/isa/mcclock_isa.c +++ /dev/null @@ -1,133 +0,0 @@ -/* $NetBSD: mcclock_tlsb.c,v 1.8 1998/05/13 02:50:29 thorpej Exp $ */ -/*- - * Copyright (c) 1997 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. 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 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <machine/resource.h> -#include <sys/rman.h> - -#include <isa/isavar.h> -#include <machine/clockvar.h> -#include <dev/dec/mcclockvar.h> -#include <dev/dec/mc146818reg.h> - -struct mcclock_softc { - struct resource *port; -}; - -static int mcclock_isa_probe(device_t dev); -static int mcclock_isa_attach(device_t dev); -static void mcclock_isa_write(device_t, u_int, u_int); -static u_int mcclock_isa_read(device_t, u_int); - -static device_method_t mcclock_isa_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, mcclock_isa_probe), - DEVMETHOD(device_attach, mcclock_isa_attach), - - /* mcclock interface */ - DEVMETHOD(mcclock_write, mcclock_isa_write), - DEVMETHOD(mcclock_read, mcclock_isa_read), - - /* clock interface */ - DEVMETHOD(clock_init, mcclock_init), - DEVMETHOD(clock_get, mcclock_get), - DEVMETHOD(clock_set, mcclock_set), - DEVMETHOD(clock_getsecs, mcclock_getsecs), - - { 0, 0 } -}; - -static driver_t mcclock_isa_driver = { - "mcclock", - mcclock_isa_methods, - 1, /* XXX no softc */ -}; - -static devclass_t mcclock_devclass; - -int -mcclock_isa_probe(device_t dev) -{ - struct mcclock_softc *sc = device_get_softc(dev); - int rid; - - /* No pnp support */ - if (isa_get_vendorid(dev)) - return (ENXIO); - - rid = 0; - sc->port = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, - 0ul, ~0ul, 2, RF_ACTIVE); - if (!sc->port) - return ENXIO; - - device_set_desc(dev, "MC146818A real time clock"); - return 0; -} - -int -mcclock_isa_attach(device_t dev) -{ - mcclock_attach(dev); - return 0; -} - -static void -mcclock_isa_write(device_t dev, u_int reg, u_int val) -{ - struct mcclock_softc *sc = device_get_softc(dev); - bus_space_tag_t iot = rman_get_bustag(sc->port); - bus_space_handle_t ioh = rman_get_bushandle(sc->port); - - bus_space_write_1(iot, ioh, 0, reg); - bus_space_write_1(iot, ioh, 1, val); -} - -static u_int -mcclock_isa_read(device_t dev, u_int reg) -{ - struct mcclock_softc *sc = device_get_softc(dev); - bus_space_tag_t iot = rman_get_bustag(sc->port); - bus_space_handle_t ioh = rman_get_bushandle(sc->port); - - bus_space_write_1(iot, ioh, 0, reg); - return bus_space_read_1(iot, ioh, 1); -} - -DRIVER_MODULE(mcclock, isa, mcclock_isa_driver, mcclock_devclass, 0, 0); diff --git a/sys/alpha/mcbus/mcbus.c b/sys/alpha/mcbus/mcbus.c deleted file mode 100644 index 48bf47b..0000000 --- a/sys/alpha/mcbus/mcbus.c +++ /dev/null @@ -1,319 +0,0 @@ -/*- - * Copyright (c) 2000 by Matthew Jacob - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * Autoconfiguration and support routines for the main backplane bus - * for Rawhide (Alpha 4100) systems. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/malloc.h> - -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <alpha/mcbus/mcbusreg.h> -#include <alpha/mcbus/mcbusvar.h> -#include <alpha/mcbus/mcpciavar.h> - -struct mcbus_device *mcbus_primary_cpu = NULL; - -#define KV(_addr) ((caddr_t)ALPHA_PHYS_TO_K0SEG((_addr))) -#define NO_MCPCIA_AT(mid, gid) \ - (badaddr((void *)KV(MCPCIA_BRIDGE_ADDR(gid, mid)), sizeof (u_int32_t))) - -struct mcbus_softc { - device_t mcbus_dev; - driver_intr_t * sub_intr; - u_int8_t mcbus_types[MCBUS_MID_MAX]; -}; - -static void mcbus_add_child(struct mcbus_softc *, struct mcbus_device *); -static void mcbus_intr(void *, u_long); - -static struct mcbus_softc * mcbus0_softc = NULL; -static devclass_t mcbus_devclass; - -/* - * Device methods - */ -static int mcbus_probe(device_t); -static int mcbus_print_child(device_t, device_t); -static int mcbus_read_ivar(device_t, device_t, int, u_long *); -static int mcbus_setup_intr(device_t, device_t, struct resource *, int, - driver_intr_t *, void *, void **); -static int -mcbus_teardown_intr(device_t, device_t, struct resource *, void *); - -static device_method_t mcbus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, mcbus_probe), - DEVMETHOD(device_attach, bus_generic_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - - /* Bus interface */ - DEVMETHOD(bus_print_child, mcbus_print_child), - DEVMETHOD(bus_read_ivar, mcbus_read_ivar), - DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_setup_intr, mcbus_setup_intr), - DEVMETHOD(bus_teardown_intr, mcbus_teardown_intr), - - { 0, 0 } -}; - -static driver_t mcbus_driver = { - "mcbus", mcbus_methods, sizeof (struct mcbus_softc), -}; - -/* - * Tru64 UNIX (formerly Digital UNIX (formerly DEC OSF/1)) probes for MCPCIAs - * in the following order: - * - * 5, 4, 7, 6 - * - * This is so that the built-in CD-ROM on the internal 53c810 is always - * dka500. We probe them in the same order, for consistency. - */ -static const int mcbus_mcpcia_probe_order[] = { 5, 4, 7, 6 }; - -/* - * Early console support requires us to partially probe the bus to - * find the ISA bus resources. - */ -void -mcbus_init(void) -{ - static int initted = 0; - int i, mid, gid; - - if (initted) return; - initted = 1; - - /* - * We only look at the first two mids because at this point, - * badaddr() doesn't work so we can't call NO_MCPCIA_AT(). - */ - gid = MCBUS_GID_FROM_INSTANCE(0); - for (i = 0; i < 2; ++i) { - mid = mcbus_mcpcia_probe_order[i]; - - if (NO_MCPCIA_AT(mid, gid)) { - continue; - } - mcpcia_init(gid, mid); - } -} - -/* - * At 'probe' time, we add all the devices which we know about to the - * bus. The generic attach routine will probe and attach them if they - * are alive. - */ -static int -mcbus_probe(device_t dev) -{ - struct mcbus_softc *sc = device_get_softc(dev); - struct mcbus_device *mdev; - int i, mid, gid; - - device_set_desc(dev, "MCBUS Backplane Bus"); - - /* - * XXX A note about GIDs... - * XXX If we ever support more than one MCBUS, we'll - * XXX have to probe for them, and map them to unit - * XXX numbers. - */ - - sc->mcbus_dev = dev; - mcbus0_softc = sc; - set_iointr(mcbus_intr); - gid = MCBUS_GID_FROM_INSTANCE(0); - - mcbus0_softc->mcbus_types[0] = MCBUS_TYPE_RES; - for (mid = 1; mid <= MCBUS_MID_MAX; mid++) { - mcbus0_softc->mcbus_types[mid] = MCBUS_TYPE_UNK; - } - - /* - * First, add 'memory' children to probe. - */ - mdev = (struct mcbus_device *) - malloc(sizeof (struct mcbus_device), M_DEVBUF, M_NOWAIT); - if (!mdev) { - printf("mcbus_probe: unable to malloc softc for memory dev\n"); - return (ENOMEM); - } - mdev->ma_gid = gid; - mdev->ma_mid = 1; - mdev->ma_order = MCPCIA_PER_MCBUS; - mdev->ma_type = MCBUS_TYPE_MEM; - mcbus0_softc->mcbus_types[1] = MCBUS_TYPE_MEM; - mcbus_add_child(sc, mdev); - - /* - * Now add I/O (MCPCIA) modules to probe (but only if they're there). - */ - for (i = 0; i < MCPCIA_PER_MCBUS; ++i) { - mid = mcbus_mcpcia_probe_order[i]; - - if (NO_MCPCIA_AT(mid, gid)) { - continue; - } - mdev = (struct mcbus_device *) - malloc(sizeof (struct mcbus_device), M_DEVBUF, M_NOWAIT); - if (!mdev) { - printf("mcbus_probe: unable to malloc for MCPCIA\n"); - continue; - } - mdev->ma_gid = gid; - mdev->ma_mid = mid; - mdev->ma_order = i; - mdev->ma_type = MCBUS_TYPE_PCI; - mcbus0_softc->mcbus_types[1] = MCBUS_TYPE_PCI; - mcbus_add_child(sc, mdev); - } - - /* - * XXX: ToDo Add CPU nodes. - */ - - return (0); -} - -static int -mcbus_print_child(device_t dev, device_t child) -{ - struct mcbus_device *mdev = DEVTOMCBUS(child); - int retval = 0; - - retval += bus_print_child_header(dev, child); - retval += printf(" at %s gid %d mid %d\n", - device_get_nameunit(dev), mdev->ma_gid, mdev->ma_mid); - return (retval); -} - -static int -mcbus_read_ivar(device_t dev, device_t child, int index, u_long *result) -{ - struct mcbus_device *mdev = DEVTOMCBUS(child); - - switch (index) { - case MCBUS_IVAR_MID: - *result = mdev->ma_mid; - break; - - case MCBUS_IVAR_GID: - *result = mdev->ma_gid; - break; - - case MCBUS_IVAR_TYPE: - *result = mdev->ma_type; - break; - - } - return (ENOENT); -} - -static int -mcbus_setup_intr(device_t dev, device_t child, struct resource *r, int f, - driver_intr_t *intr, void *a, void **ac) -{ - if (strncmp(device_get_name(child), "pcib", 6) == 0) { - if (mcbus0_softc->sub_intr == NULL) - mcbus0_softc->sub_intr = intr; - return (0); - } else { - return (ENXIO); - } -} - -static int -mcbus_teardown_intr(device_t dev, device_t child, struct resource *i, void *c) -{ - if (strncmp(device_get_name(child), "pcib", 6) == 0) { - mcbus0_softc->sub_intr = NULL; - return (0); - } else { - return (ENXIO); - } -} - -static void -mcbus_intr(void *frame, u_long vector) -{ - if (vector && mcbus0_softc->sub_intr) - (*mcbus0_softc->sub_intr)((void *)vector); -} - -static void -mcbus_add_child(struct mcbus_softc *mcbus, struct mcbus_device *mdev) -{ - static int mcpciaproto, memproto, cpuproto; - device_t cd; - int un; - char *dn, *ds; - - switch (mdev->ma_type) { - case MCBUS_TYPE_PCI: - dn = "pcib"; - ds = "MCPCIA PCI Bus Bridge"; - un = mcpciaproto++; - break; - case MCBUS_TYPE_MEM: - dn = "mcmem"; - un = memproto++; - ds = "MCBUS Memory Module"; - break; - case MCBUS_TYPE_CPU: - dn = "mccpu"; - un = cpuproto++; - ds = "MCBUS Processor Module"; - break; - default: - printf("mcbus_add_child: unknown MCBUS type 0x%x\n", - mdev->ma_type); - return; - } - - cd = device_add_child_ordered(mcbus->mcbus_dev, mdev->ma_type, dn, un); - if (cd == NULL) { - return; - } - device_set_ivars(cd, mdev); - device_set_desc(cd, ds); -} -DRIVER_MODULE(mcbus, root, mcbus_driver, mcbus_devclass, 0, 0); diff --git a/sys/alpha/mcbus/mcbusreg.h b/sys/alpha/mcbus/mcbusreg.h deleted file mode 100644 index d52c1a5..0000000 --- a/sys/alpha/mcbus/mcbusreg.h +++ /dev/null @@ -1,82 +0,0 @@ -/* $FreeBSD$ */ - -/*- - * Copyright (c) 1998, 2000 by Matthew Jacob - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * 'Register' definitions for the MCBUS main - * system bus found on AlphaServer 4100 systems. - */ - -/* - * Information gathered from:" - * - * "Rawhide System Programmer's Manual, revision 1.4". - */ - -/* - * There are 7 possible MC bus modules (architecture says 10, but - * the address map details say otherwise), 1 though 7. - * Their uses are defined as follows: - * - * MID Module - * ---- ------ - * 1 Memory - * 2 CPU - * 3 CPU - * 4 CPU, PCI - * 5 CPU, PCI - * 6 CPU, PCI - * 7 CPU, PCI - * - */ -#define MCBUS_MID_MAX 7 - -/* - * For this architecture, bit 39 of a 40 bit address controls whether - * you access I/O or Memory space. Further, there *could* be multiple - * MC busses (but only one specified for now). - */ - -#define MCBUS_IOSPACE 0x0000008000000000L -#define MCBUS_GID_MASK 0x0000007000000000L -#define MCBUS_GID_SHIFT 36 -#define MCBUS_MID_MASK 0x0000000E00000000L -#define MCBUS_MID_SHIFT 33 - -#define MAX_MC_BUS 8 - -#define MCPCIA_PER_MCBUS 4 -#define MCPCIA_PCI_MIDMIN 4 -/* - * This is something of a layering violation, but it makes probing cleaner. - */ -/* the MCPCIA bridge CSR addresses, offset zero, is a good thing to probe for */ -#define MCPCIA_BRIDGE_ADDR(gid, mid) \ - (MCBUS_IOSPACE | 0x1E0000000LL | \ - (((unsigned long) gid) << MCBUS_GID_SHIFT) | \ - (((unsigned long) mid) << MCBUS_MID_SHIFT)) diff --git a/sys/alpha/mcbus/mcbusvar.h b/sys/alpha/mcbus/mcbusvar.h deleted file mode 100644 index 63e8d27..0000000 --- a/sys/alpha/mcbus/mcbusvar.h +++ /dev/null @@ -1,75 +0,0 @@ -/* $FreeBSD$ */ -/*- - * Copyright (c) 2000 by Matthew Jacob - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * Definitions for the MCBUS System Bus found on - * AlphaServer 4100 systems. - */ - -enum mcbus_device_instvars { - MCBUS_IVAR_MID, - MCBUS_IVAR_GID, - MCBUS_IVAR_TYPE, -}; - -#define MCBUS_ACCESSOR(A, B, T) \ - \ -static __inline T mcbus_get_ ## A(device_t dev) \ -{ \ - u_long v; \ - BUS_READ_IVAR(device_get_parent(dev), dev, MCBUS_IVAR_ ## B, &v); \ - return v; \ -} - -MCBUS_ACCESSOR(mid, MID, u_int8_t) -MCBUS_ACCESSOR(gid, GID, u_int8_t) -MCBUS_ACCESSOR(type, TYPE, u_int8_t) - -/* - * The structure used to attach devices to the MCBUS - */ -struct mcbus_device { - u_int8_t ma_gid; /* GID of MCBUS (MCBUS #) */ - u_int8_t ma_mid; /* Module ID on MCBUS */ - u_int8_t ma_type; /* Module "type" */ - u_int8_t ma_order; /* order of attachment */ -}; -#define MCBUS_GID_FROM_INSTANCE(unit) (7 - unit) - -/* - * "types" - */ -#define MCBUS_TYPE_RES 0 -#define MCBUS_TYPE_UNK 1 -#define MCBUS_TYPE_MEM 2 -#define MCBUS_TYPE_CPU 3 -#define MCBUS_TYPE_PCI 4 - -#define DEVTOMCBUS(dev) ((struct mcbus_device *) device_get_ivars(dev)) - -extern void mcbus_init(void); diff --git a/sys/alpha/mcbus/mcmem.c b/sys/alpha/mcbus/mcmem.c deleted file mode 100644 index bd3a784..0000000 --- a/sys/alpha/mcbus/mcmem.c +++ /dev/null @@ -1,85 +0,0 @@ -/*- - * Copyright (c) 2000 by Matthew Jacob - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * Dummy Node for MCBUS Memory Modules - * found on AlphaServer 4100 systems. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/malloc.h> - -#include <machine/rpb.h> - -#include <alpha/mcbus/mcbusreg.h> -#include <alpha/mcbus/mcbusvar.h> - -/* - * Device methods - */ -static int mcbusmem_probe(device_t); - -static device_method_t mcbusmem_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, mcbusmem_probe), - DEVMETHOD(device_attach, bus_generic_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, bus_generic_read_ivar), - DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - { 0, 0 } -}; - -static devclass_t mcbusmem_devclass; -static driver_t mcbusmem_driver = { - "mcbusmem", mcbusmem_methods, 1 -}; - -static int -mcbusmem_probe(device_t dev) -{ - struct mcbus_device *mdev = DEVTOMCBUS(dev); - if (mdev->ma_type != MCBUS_TYPE_MEM) { - return (-1); - } - return (0); -} - -DRIVER_MODULE(mcbusmem, mcbus, mcbusmem_driver, mcbusmem_devclass, 0, 0); diff --git a/sys/alpha/mcbus/mcpcia.c b/sys/alpha/mcbus/mcpcia.c deleted file mode 100644 index 3b2f378..0000000 --- a/sys/alpha/mcbus/mcpcia.c +++ /dev/null @@ -1,805 +0,0 @@ -/*- - * Copyright (c) 2000 Matthew Jacob - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/module.h> -#include <sys/mutex.h> -#include <sys/bus.h> -#include <sys/cons.h> -#include <machine/bus.h> -#include <machine/md_var.h> -#include <sys/proc.h> -#include <sys/rman.h> -#include <sys/interrupt.h> - -#include <machine/swiz.h> -#include <machine/intr.h> -#include <machine/intrcnt.h> -#include <machine/resource.h> -#include <machine/sgmap.h> -#include <machine/prom.h> -#include <vm/vm.h> -#include <vm/vm_page.h> - - -#include <alpha/mcbus/mcbusreg.h> -#include <alpha/mcbus/mcbusvar.h> - -#include <alpha/mcbus/mcpciareg.h> -#include <alpha/mcbus/mcpciavar.h> -#include <alpha/pci/pcibus.h> -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> - -#include "alphapci_if.h" -#include "pcib_if.h" - -static devclass_t mcpcia_devclass; - -/* We're only allowing for one MCBUS right now */ -static device_t mcpcias[MCPCIA_PER_MCBUS]; - -#define KV(pa) ((void *)ALPHA_PHYS_TO_K0SEG(pa)) - -struct mcpcia_softc { - struct mcpcia_softc *next; - device_t dev; /* backpointer */ - u_int64_t sysbase; /* shorthand */ - vm_offset_t dmem_base; /* dense memory */ - vm_offset_t smem_base; /* sparse memory */ - vm_offset_t io_base; /* sparse i/o */ - int mcpcia_inst; /* our mcpcia instance # */ - struct swiz_space io_space; /* accessor for ports */ - struct swiz_space mem_space; /* accessor for memory */ - struct rman io_rman; /* resource manager for ports */ - struct rman mem_rman; /* resource manager for memory */ -}; -static struct mcpcia_softc *mcpcia_eisa = NULL; -extern void dec_kn300_cons_init(void); - -static driver_intr_t mcpcia_intr; -static void mcpcia_enable_intr(struct mcpcia_softc *, int); -static void mcpcia_disable_intr(struct mcpcia_softc *, int); - -/* - * SGMAP window for ISA: 8M at 8M - */ -#define MCPCIA_ISA_SG_MAPPED_BASE (8*1024*1024) -#define MCPCIA_ISA_SG_MAPPED_SIZE (8*1024*1024) - -/* - * Direct-mapped window: 2G at 2G - */ -#define MCPCIA_DIRECT_MAPPED_BASE (2UL*1024UL*1024UL*1024UL) -#define MCPCIA_DIRECT_MAPPED_SIZE (2UL*1024UL*1024UL*1024UL) - -/* - * SGMAP window for PCI: 1G at 1G - */ -#define MCPCIA_PCI_SG_MAPPED_BASE (1UL*1024UL*1024UL*1024UL) -#define MCPCIA_PCI_SG_MAPPED_SIZE (1UL*1024UL*1024UL*1024UL) - -#define MCPCIA_SGTLB_INVALIDATE(sc) \ -do { \ - alpha_mb(); \ - REGVAL(MCPCIA_SG_TBIA(sc)) = 0xdeadbeef; \ - alpha_mb(); \ -} while (0) - -static void mcpcia_dma_init(struct mcpcia_softc *); -static void mcpcia_sgmap_map(void *, bus_addr_t, vm_offset_t); - -#define MCPCIA_SOFTC(dev) (struct mcpcia_softc *) device_get_softc(dev) - -static struct mcpcia_softc *mcpcia_root; - -/* - * Early console support requires us to partially probe the bus to - * find the ISA bus resources. - */ -void -mcpcia_init(int gid, int mid) -{ - static struct swiz_space io_space; - static struct swiz_space mem_space; - u_int64_t sysbase; - vm_offset_t regs, io_base, smem_base; - - sysbase = MCBUS_IOSPACE | - (((u_int64_t) gid) << MCBUS_GID_SHIFT) | - (((u_int64_t) mid) << MCBUS_MID_SHIFT); - - if (EISA_PRESENT(REGVAL(sysbase - | MCPCIA_PCI_BRIDGE - | _MCPCIA_PCI_REV))) { - /* - * Define temporary spaces for bootstrap i/o. - */ - regs = (vm_offset_t) KV(sysbase); - io_base = regs + MCPCIA_PCI_IOSPACE; - smem_base = regs + MCPCIA_PCI_SPARSE; - - swiz_init_space(&io_space, io_base); - swiz_init_space(&mem_space, smem_base); - - busspace_isa_io = (struct alpha_busspace *) &io_space; - busspace_isa_mem = (struct alpha_busspace *) &mem_space; - } -} - -static int -mcpcia_probe(device_t dev) -{ - device_t child; - int unit; - struct mcpcia_softc *xc, *sc = MCPCIA_SOFTC(dev); - - unit = device_get_unit(dev); - if (mcpcias[unit]) { - printf("%s: already attached\n", device_get_nameunit(dev)); - return EEXIST; - } - sc->mcpcia_inst = unit; - if ((xc = mcpcia_root) == NULL) { - chipset.pci_sgmap = NULL; - mcpcia_root = sc; - } else { - while (xc->next) - xc = xc->next; - xc->next = sc; - } - sc->dev = mcpcias[unit] = dev; - /* PROBE ? */ - device_set_desc(dev, "MCPCIA PCI Adapter"); - if (unit == 0) { - pci_init_resources(); - } - child = device_add_child(dev, "pci", -1); - device_set_ivars(child, &sc->mcpcia_inst); - return (0); -} - -static int -mcpcia_attach(device_t dev) -{ - struct mcpcia_softc *sc = MCPCIA_SOFTC(dev); - device_t p = device_get_parent(dev); - vm_offset_t regs; - u_int32_t ctl; - int mid, gid, rval; - void *intr; - - mid = mcbus_get_mid(dev); - gid = mcbus_get_gid(dev); - - sc->sysbase = MCBUS_IOSPACE | - (((u_int64_t) gid) << MCBUS_GID_SHIFT) | \ - (((u_int64_t) mid) << MCBUS_MID_SHIFT); - regs = (vm_offset_t) KV(sc->sysbase); - sc->dmem_base = regs + MCPCIA_PCI_DENSE; - sc->smem_base = regs + MCPCIA_PCI_SPARSE; - sc->io_base = regs + MCPCIA_PCI_IOSPACE; - - swiz_init_space(&sc->io_space, sc->io_base); - swiz_init_space(&sc->mem_space, sc->smem_base); - - sc->io_rman.rm_start = 0; - sc->io_rman.rm_end = ~0u; - sc->io_rman.rm_type = RMAN_ARRAY; - sc->io_rman.rm_descr = "I/O ports"; - if (rman_init(&sc->io_rman) - || rman_manage_region(&sc->io_rman, 0x0, (1L << 32))) - panic("mcpcia_attach: io_rman"); - - sc->mem_rman.rm_start = 0; - sc->mem_rman.rm_end = ~0u; - sc->mem_rman.rm_type = RMAN_ARRAY; - sc->mem_rman.rm_descr = "I/O memory"; - if (rman_init(&sc->mem_rman) - || rman_manage_region(&sc->mem_rman, 0x0, (1L << 32))) - panic("mcpcia_attach: mem_rman"); - - /* - * Disable interrupts and clear errors prior to probing - */ - REGVAL(MCPCIA_INT_MASK0(sc)) = 0; - REGVAL(MCPCIA_INT_MASK1(sc)) = 0; - REGVAL(MCPCIA_CAP_ERR(sc)) = 0xFFFFFFFF; - alpha_mb(); - - /* - * Say who we are - */ - ctl = REGVAL(MCPCIA_PCI_REV(sc)); - printf("%s: Horse Revision %d, %s Handed Saddle Revision %d," - " CAP Revision %d\n", device_get_nameunit(dev), HORSE_REV(ctl), - (SADDLE_TYPE(ctl) & 1)? "Right": "Left", SADDLE_REV(ctl), - CAP_REV(ctl)); - - /* - * See if we're the fella with the EISA bus... - */ - - if (EISA_PRESENT(REGVAL(MCPCIA_PCI_REV(sc)))) { - mcpcia_eisa = sc; - } - - /* - * Set up DMA stuff here. - */ - - mcpcia_dma_init(sc); - - /* - * Register our interrupt service requirements with our parent. - */ - rval = - BUS_SETUP_INTR(p, dev, NULL, INTR_TYPE_MISC, mcpcia_intr, 0, &intr); - if (rval == 0) { - if (sc == mcpcia_eisa) { - busspace_isa_io = (struct alpha_busspace *) - &sc->io_space; - busspace_isa_mem = (struct alpha_busspace *) - &sc->mem_space; - /* - * Enable EISA interrupts. - */ - mcpcia_enable_intr(sc, 16); - } - bus_generic_attach(dev); - } - return (rval); -} - -static void -mcpcia_enable_intr(struct mcpcia_softc *sc, int irq) -{ - - REGVAL(MCPCIA_INT_MASK0(sc)) |= (1 << irq); - alpha_mb(); -} - -static void -mcpcia_disable_intr(struct mcpcia_softc *sc, int irq) -{ - - /* - * We need to write to INT_REQ as well as INT_MASK0 in case we - * are trying to mask an interrupt which is already - * asserted. Writing a 1 bit to INT_REQ clears the - * corresponding bit in the register. - */ - REGVAL(MCPCIA_INT_MASK0(sc)) &= ~(1 << irq); - REGVAL(MCPCIA_INT_REQ(sc)) = (1 << irq); - alpha_mb(); -} - -static void -mcpcia_disable_intr_vec(uintptr_t vector) -{ - int mid, irq; - struct mcpcia_softc *sc = mcpcia_root; - - if (vector < MCPCIA_VEC_PCI) { - printf("EISA disable (0x%lx)\n", vector); - return; - } - - if (vector == MCPCIA_VEC_NCR) { - mid = 5; - irq = 16; - } else { - int tmp, slot; - tmp = vector - MCPCIA_VEC_PCI; - mid = (tmp / MCPCIA_VECWIDTH_PER_MCPCIA) + 4; - tmp &= (MCPCIA_VECWIDTH_PER_MCPCIA - 1); - slot = tmp / MCPCIA_VECWIDTH_PER_SLOT; - if (slot < 2 || slot > 5) { - printf("Bad slot (%d) for vector %lx\n", slot, vector); - return; - } - tmp -= (2 * MCPCIA_VECWIDTH_PER_SLOT); - irq = (tmp >> MCPCIA_VECWIDTH_PER_INTPIN) & 0xf; - } -/* printf("D<%03x>=%d,%d\n", vector, mid, irq); */ - while (sc) { - if (mcbus_get_mid(sc->dev) == mid) { - break; - } - sc = sc->next; - } - if (sc == NULL) { - panic("couldn't find MCPCIA softc for vector 0x%lx", vector); - } - mtx_lock_spin(&icu_lock); - mcpcia_disable_intr(sc, irq); - mtx_unlock_spin(&icu_lock); -} - -static void -mcpcia_enable_intr_vec(uintptr_t vector) -{ - int mid, irq; - struct mcpcia_softc *sc = mcpcia_root; - - if (vector < MCPCIA_VEC_PCI) { - printf("EISA ensable (0x%lx)\n", vector); - return; - } - - if (vector == MCPCIA_VEC_NCR) { - mid = 5; - irq = 16; - } else { - int tmp, slot; - tmp = vector - MCPCIA_VEC_PCI; - mid = (tmp / MCPCIA_VECWIDTH_PER_MCPCIA) + 4; - tmp &= (MCPCIA_VECWIDTH_PER_MCPCIA - 1); - slot = tmp / MCPCIA_VECWIDTH_PER_SLOT; - if (slot < 2 || slot > 5) { - printf("Bad slot (%d) for vector %lx\n", slot, vector); - return; - } - tmp -= (2 * MCPCIA_VECWIDTH_PER_SLOT); - irq = (tmp >> MCPCIA_VECWIDTH_PER_INTPIN) & 0xf; - } -/* printf("E<%03x>=%d,%d\n", vector, mid, irq); */ - while (sc) { - if (mcbus_get_mid(sc->dev) == mid) { - break; - } - sc = sc->next; - } - if (sc == NULL) { - panic("couldn't find MCPCIA softc for vector 0x%lx", vector); - } - mtx_lock_spin(&icu_lock); - mcpcia_enable_intr(sc, irq); - mtx_unlock_spin(&icu_lock); -} - -static int -mcpcia_pci_route_interrupt(device_t bus, device_t dev, int pin) -{ - int irq, slot, mid; - - /* - * Validate requested pin number. - */ - if ((pin < 1) || (pin > 4)) { - printf("mcpcia_pci_route_interrupt: bad interrupt pin %d\n", - pin); - return(255); - } - - slot = pci_get_slot(dev); - mid = mcbus_get_mid(bus); - -#if 0 - printf("mcpcia_pci_route_interrupt: called for slot=%d, pin=%d, mid=%d\n", slot, pin, mid); -#endif - - if (mid == 5 && slot == 1) { - irq = 16; /* MID 5, slot 1, is the internal NCR 53c810 */ - } else if (slot >= 2 && slot <= 5) { - irq = ((slot - 2) * 4) + (pin - 1); - } else { - printf("mcpcia_pci_route_interrupt: weird device number %d\n", - slot); - return (255); - } - - return(irq); -} - -static int -mcpcia_setup_intr(device_t dev, device_t child, struct resource *ir, int flags, - driver_intr_t *intr, void *arg, void **cp) -{ - struct mcpcia_softc *sc = MCPCIA_SOFTC(dev); - int mid, birq, irq, error, h; - - irq = rman_get_start(ir); - mid = mcbus_get_mid(dev); - - error = rman_activate_resource(ir); - if (error) - return error; - - /* - * We now construct a vector as the hardware would, unless - * this is the internal NCR 53c810 interrupt. - */ - if (irq == 16) { - h = MCPCIA_VEC_NCR; - } else { - h = MCPCIA_VEC_PCI + - ((mid - MCPCIA_PCI_MIDMIN) * MCPCIA_VECWIDTH_PER_MCPCIA) + - irq * MCPCIA_VECWIDTH_PER_INTPIN + - 2 * MCPCIA_VECWIDTH_PER_SLOT; - } - birq = irq + INTRCNT_KN300_IRQ; - error = alpha_setup_intr(device_get_nameunit(child), h, - intr, arg, flags, cp, &intrcnt[birq], - mcpcia_disable_intr_vec, mcpcia_enable_intr_vec); - if (error) - return error; - mtx_lock_spin(&icu_lock); - mcpcia_enable_intr(sc, irq); - mtx_unlock_spin(&icu_lock); - device_printf(child, "interrupting at IRQ 0x%x (vec 0x%x)\n", - irq , h); - return (0); -} - -static int -mcpcia_teardown_intr(device_t dev, device_t child, struct resource *i, void *c) -{ - struct mcpcia_softc *sc = MCPCIA_SOFTC(dev); - - mtx_lock_spin(&icu_lock); - mcpcia_disable_intr(sc, rman_get_start(i)); - mtx_unlock_spin(&icu_lock); - alpha_teardown_intr(c); - return (rman_deactivate_resource(i)); -} - -static int -mcpcia_read_ivar(device_t dev, device_t child, int which, u_long *result) -{ - switch (which) { - case PCIB_IVAR_BUS: - *result = 0; - return 0; - } - return ENOENT; -} - -static void * -mcpcia_cvt_dense(device_t dev, vm_offset_t addr) -{ - struct mcpcia_softc *sc = MCPCIA_SOFTC(dev); - - addr &= 0xffffffffUL; - return (void *) KV(addr | sc->dmem_base); - -} - -static struct alpha_busspace * -mcpcia_get_bustag(device_t dev, int type) -{ - struct mcpcia_softc *sc = MCPCIA_SOFTC(dev); - - switch (type) { - case SYS_RES_IOPORT: - return (struct alpha_busspace *) &sc->io_space; - - case SYS_RES_MEMORY: - return (struct alpha_busspace *) &sc->mem_space; - } - - return 0; -} - -static struct rman * -mcpcia_get_rman(device_t dev, int type) -{ - struct mcpcia_softc *sc = MCPCIA_SOFTC(dev); - - switch (type) { - case SYS_RES_IOPORT: - return &sc->io_rman; - - case SYS_RES_MEMORY: - return &sc->mem_rman; - } - - return 0; -} - -static int -mcpcia_maxslots(device_t dev) -{ - return (MCPCIA_MAXDEV); -} - -static u_int32_t -mcpcia_read_config(device_t dev, int bus, int slot, int func, - int off, int sz) -{ - struct mcpcia_softc *sc = MCPCIA_SOFTC(dev); - u_int32_t *dp, data, rvp; - u_int64_t paddr; - - if ((off == PCIR_INTLINE) && (sz == 1)) { - /* SRM left bad value; let intr_route fill them in later */ - return ~0; - } - - rvp = data = ~0; - - /* - * There's nothing in slot 0 on a primary bus. - */ - if (bus == 0 && (slot < 1 || slot >= MCPCIA_MAXDEV)) - return (data); - - paddr = bus << 21; - paddr |= slot << 16; - paddr |= func << 13; - paddr |= ((sz - 1) << 3); - paddr |= ((unsigned long) ((off >> 2) << 7)); - paddr |= MCPCIA_PCI_CONF; - paddr |= sc->sysbase; - dp = (u_int32_t *)KV(paddr); - -#if 0 -printf("CFGREAD MID %d %d.%d.%d sz %d off %d -> paddr 0x%x", -mcbus_get_mid(dev), bus , slot, func, sz, off, paddr); -#endif - if (badaddr(dp, sizeof (*dp)) == 0) { - data = *dp; - } - if (data != ~0) { - if (sz == 1) { - rvp = SPARSE_BYTE_EXTRACT(off, data); - } else if (sz == 2) { - rvp = SPARSE_WORD_EXTRACT(off, data); - } else { - rvp = data; - } - } else { - rvp = data; - } - -#if 0 -printf(" data 0x%x -> 0x%x\n", data, rvp); -#endif - return (rvp); -} - -static void -mcpcia_write_config(device_t dev, int bus, int slot, int func, - int off, u_int32_t data, int sz) -{ - struct mcpcia_softc *sc = MCPCIA_SOFTC(dev); - u_int32_t *dp; - u_int64_t paddr; - - /* - * There's nothing in slot 0 on a primary bus. - */ - if (bus != 0 && (slot < 1 || slot >= MCPCIA_MAXDEV)) - return; - - paddr = bus << 21; - paddr |= slot << 16; - paddr |= func << 13; - paddr |= ((sz - 1) << 3); - paddr |= ((unsigned long) ((off >> 2) << 7)); - paddr |= MCPCIA_PCI_CONF; - paddr |= sc->sysbase; - dp = (u_int32_t *)KV(paddr); - - if (badaddr(dp, sizeof (*dp)) == 0) { - u_int32_t new_data; - if (sz == 1) { - new_data = SPARSE_BYTE_INSERT(off, data); - } else if (sz == 2) { - new_data = SPARSE_WORD_INSERT(off, data); - } else { - new_data = data; - } - -#if 0 -printf("CFGWRITE MID%d %d.%d.%d sz %d off %d paddr %lx, data %x new_data %x\n", -mcbus_get_mid(dev), bus , slot, func, sz, off, paddr, data, new_data); -#endif - - *dp = new_data; - } -} - -static void -mcpcia_sgmap_map(void *arg, bus_addr_t ba, vm_offset_t pa) -{ - struct mcpcia_softc *sc; - u_int64_t *sgtable = arg; - int index = alpha_btop(ba - MCPCIA_ISA_SG_MAPPED_BASE); - - if (pa) { - /* XXX */ - if (pa > (1L<<32)) - panic("mcpcia_sgmap_map: can't map address 0x%lx", pa); - sgtable[index] = ((pa >> 13) << 1) | 1; - } else { - sgtable[index] = 0; - } - alpha_mb(); - if ((struct sgmap*)sgtable == chipset.sgmap) - MCPCIA_SGTLB_INVALIDATE(mcpcia_eisa); - else { - for (sc = mcpcia_root; sc != NULL; sc = sc->next) - MCPCIA_SGTLB_INVALIDATE(sc); - } -} - -static void -mcpcia_dma_init(struct mcpcia_softc *sc) -{ - void *sgtable; - - /* - * Disable all windows first. - */ - - REGVAL(MCPCIA_W0_BASE(sc)) = 0; - REGVAL(MCPCIA_W1_BASE(sc)) = 0; - REGVAL(MCPCIA_W2_BASE(sc)) = 0; - REGVAL(MCPCIA_W3_BASE(sc)) = 0; - REGVAL(MCPCIA_T0_BASE(sc)) = 0; - REGVAL(MCPCIA_T1_BASE(sc)) = 0; - REGVAL(MCPCIA_T2_BASE(sc)) = 0; - REGVAL(MCPCIA_T3_BASE(sc)) = 0; - alpha_mb(); - - /* - * Set up window 0 as an 8MB SGMAP-mapped window starting at 8MB. - * Do this only for the EISA carrying MCPCIA. Partly because - * there's only one chipset sgmap thingie. - */ - - if (sc == mcpcia_eisa) { - REGVAL(MCPCIA_W0_MASK(sc)) = MCPCIA_WMASK_8M; - - sgtable = contigmalloc(8192, M_DEVBUF, - M_NOWAIT, 0, 1L<<34, 32<<10, 1L<<34); - - if (sgtable == NULL) { - panic("mcpcia_dma_init: cannot allocate sgmap"); - /* NOTREACHED */ - } - REGVAL(MCPCIA_T0_BASE(sc)) = - pmap_kextract((vm_offset_t)sgtable) >> MCPCIA_TBASEX_SHIFT; - - alpha_mb(); - REGVAL(MCPCIA_W0_BASE(sc)) = MCPCIA_WBASE_EN | - MCPCIA_WBASE_SG | MCPCIA_ISA_SG_MAPPED_BASE; - alpha_mb(); - MCPCIA_SGTLB_INVALIDATE(sc); - chipset.sgmap = sgmap_map_create(MCPCIA_ISA_SG_MAPPED_BASE, - MCPCIA_ISA_SG_MAPPED_BASE + MCPCIA_ISA_SG_MAPPED_SIZE - 1, - mcpcia_sgmap_map, sgtable); - } - - /* - * Set up window 1 as a 2 GB Direct-mapped window starting at 2GB. - */ - - chipset.dmsize = 2UL * 1024UL * 1024UL * 1024UL; - chipset.dmoffset = MCPCIA_DIRECT_MAPPED_BASE; - REGVAL(MCPCIA_W1_MASK(sc)) = MCPCIA_WMASK_2G; - REGVAL(MCPCIA_T1_BASE(sc)) = 0; - alpha_mb(); - REGVAL(MCPCIA_W1_BASE(sc)) = - MCPCIA_DIRECT_MAPPED_BASE | MCPCIA_WBASE_EN; - alpha_mb(); - - if (alpha_ptob(Maxmem) <= chipset.dmsize) - return; - - /* - * Set up window 2 as a 1G SGMAP-mapped window starting at 1G. - */ - - if (chipset.pci_sgmap == NULL) { - sgtable = contigmalloc(1048576, M_DEVBUF, - M_NOWAIT, 0, 1L<<34, 32<<10, 1L<<34); - if (sgtable == NULL) { - panic("mcpcia_dma_init: cannot allocate pci_sgmap"); - /* NOTREACHED */ - } - chipset.pci_sgmap = sgmap_map_create(MCPCIA_PCI_SG_MAPPED_BASE, - MCPCIA_PCI_SG_MAPPED_BASE + MCPCIA_PCI_SG_MAPPED_SIZE - 1, - mcpcia_sgmap_map, sgtable); - } - REGVAL(MCPCIA_W2_MASK(sc)) = MCPCIA_WMASK_1G; - REGVAL(MCPCIA_T2_BASE(sc)) = - pmap_kextract((vm_offset_t)chipset.pci_sgmap) >> - MCPCIA_TBASEX_SHIFT; - alpha_mb(); - REGVAL(MCPCIA_W2_BASE(sc)) = - MCPCIA_WBASE_EN | MCPCIA_WBASE_SG | MCPCIA_PCI_SG_MAPPED_BASE; - alpha_mb(); - MCPCIA_SGTLB_INVALIDATE(sc); -} - -/* - */ - -static void -mcpcia_intr(void *arg) -{ - unsigned long vec = (unsigned long) arg; - - /* - * Check for I2C interrupts. These are technically within - * the PCI vector range, but no PCI device should ever map - * to them. - */ - if (vec == MCPCIA_I2C_CVEC) { - printf("i2c: controller interrupt\n"); - return; - } - if (vec == MCPCIA_I2C_BVEC) { - printf("i2c: bus interrupt\n"); - return; - } - - alpha_dispatch_intr(NULL, vec); -} - -static device_method_t mcpcia_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, mcpcia_probe), - DEVMETHOD(device_attach, mcpcia_attach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, mcpcia_read_ivar), - DEVMETHOD(bus_setup_intr, mcpcia_setup_intr), - DEVMETHOD(bus_teardown_intr, mcpcia_teardown_intr), - DEVMETHOD(bus_alloc_resource, alpha_pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), - - /* alphapci interface */ - DEVMETHOD(alphapci_cvt_dense, mcpcia_cvt_dense), - DEVMETHOD(alphapci_get_bustag, mcpcia_get_bustag), - DEVMETHOD(alphapci_get_rman, mcpcia_get_rman), - - /* pcib interface */ - DEVMETHOD(pcib_maxslots, mcpcia_maxslots), - DEVMETHOD(pcib_read_config, mcpcia_read_config), - DEVMETHOD(pcib_write_config, mcpcia_write_config), - DEVMETHOD(pcib_route_interrupt, mcpcia_pci_route_interrupt), - - { 0, 0 } -}; - -static driver_t mcpcia_driver = { - "pcib", mcpcia_methods, sizeof (struct mcpcia_softc) -}; - -DRIVER_MODULE(pcib, mcbus, mcpcia_driver, mcpcia_devclass, 0, 0); diff --git a/sys/alpha/mcbus/mcpciareg.h b/sys/alpha/mcbus/mcpciareg.h deleted file mode 100644 index ae477fd..0000000 --- a/sys/alpha/mcbus/mcpciareg.h +++ /dev/null @@ -1,447 +0,0 @@ -/* $FreeBSD$ */ - -/*- - * Copyright (c) 2000 by Matthew Jacob - * - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * Taken from: - * - * ``RAWHIDE Systems Programmer's Manual, Revision 1.4'' - */ - -#define REGVAL(r) (*(volatile int32_t *)ALPHA_PHYS_TO_K0SEG(r)) - -/* - * There are 4 possible PCI busses per MCBUS. - * - * (from mcpcia.h, Digital Unix 4.0E): - * - * I/O Space Per PCI Node (8GBytes per) - * ------------------------------------ - * (8+x)8 0000 0000 - (8+x)9 FFFF FFFF - I/O Space for PCI0 - * (8+x)A 0000 0000 - (8+x)B FFFF FFFF - I/O Space for PCI1 - * (8+x)C 0000 0000 - (8+x)D FFFF FFFF - I/O Space for PCI2 - * (8+x)E 0000 0000 - (8+x)F FFFF FFFF - I/O Space for PCI3 - * - * CPU to PCI Address Mapping: - * --------------------------- - * - * +---+-------+-------+--+--+--+--+--+--+---------------+----------+-----+ - * | 1 | GID | MID | | | | | | | Byte Aligned | Byte Len | Zero| - * | | | | | | | | | | I/O Address | Field | | - * +---+-------+-------+--+--+--+--+--+--+---------------+----------+-----+ - * 39 38 36 35 33 32 31 30 29 28 27 26 5 4 3 2 0 - * - * <39> - I/O Select (Always 1 for direct I/O access) - * - * <38-36> - Global Bus slot # (MCBUS #) - * GID slot #0->7 (MCBUS #0->7) - * - * <35-33> - MCBUS Slot # - * MCBUS slot 0->7 - * - * <32-27> - PCI Address Space - * 0.xxxxx = Sparse Memory Space ( 4GB on MCBUS; 128MB on PCI) - * 1.0xxxx = Dense Memory Space ( 2GB on MCBUS; 2GB on PCI) - * 1.10xxx = Sparse IO Space ( 1GB on MCBUS; 32MB on PCI) - * 1.110xx = Sparse Config Space (512MB on MCBUS; 16MB on PCI) - * 1.1110x = PCI Bridge CSR Space (256MB on MCBUS) -- Sparse-mapped! - * 1.11110 = Interrupt Acknowledge (128MB on MCBUS) - * 1.11111 = Unused (128MB on MCBUS) - * - * ------------------------------------------------------------ - * Cpu to PCI Address Mapping for MCBUS-PCIy Bridge on MCBUS x: - * ------------------------------------------------------------ - * - * CPU Address Range PCI Address Range PCI Address Space - * ------------------------ --------------------- ------------------------ - * (8+x)(8+y*2).0000.0000 0000.0000 - 00FF.FFFF PCIy Sparse Memory Space - * - (8+x)(8+y*2).1FFF.FFFF (fixed, lower 16MB) - * - * (8+x)(8+y*2).2000.0000 0100.0000 - 07FF.FFFF PCIy Sparse Memory Space - * - (8+x)(8+y*2).FFFF.FFFF (variable, offset = 0) - * - * (8+x)(9+y*2).0000.0000 0000.0000 - 7FFF.FFFF PCIy Dense Memory Space - * - (8+x)(9+y*2).7FFF.FFFF or 8000.0000 - FFFF.FFFF if HAE_DENSE_MEM = 1 - * - * (8+x)(9+y*2).8000.0000 0000.0000 - 0000.FFFF PCIy Sparse IO Space - * - (8+x)(9+y*2).801F.FFFF (fixed, lower 64K) - * - * (8+x)(9+y*2).8020.0000 0001.0000 - 01FF.FFFF PCIy Sparse IO Space - * - (8+x)(9+y*2).BFFF.FFFF (variable, offset = 0) - * - * (8+x)(9+y*2).C000.0000 0000.0000 - 0FFF.FFFF PCIy Config Space (16MB) - * - (8+x)(9+y*2).DFFF.FFFF - * - * (8+x)(9+y*2).E000.0000 N/A PCIy-Bridge CSR Space - * (8MB) - * - (8+x)(9+y*2).EFFF.FFFF - * - * (8+x)(9+y*2).F000.0000 N/A Unused - * - (8+x)(9+y*2).F000.3EFF - * - * (8+x)(9+y*2).F000.3F00, N/A PCIy Interrupt ACK0 - * (8+x)(9+y*2).F000.3F40 PCIy INteruppt ACK1 - * - * (8+x)(9+y*2).F000.3F80 N/A Unused - * - (8+x)(9+y*2).FFFF.FFFF - * - */ - -/* - * MC-PCI Bus Bridge CSRs - * - * Address Map Overview: - * - * Offset Selected Space - * ---------------- ------------------------------------------------- - * 0x00000000 General config, control, diag, error logging regs. - * 0x00001000 PCI Error Status - * 0x00001300 PCI Scatter/Gather Regs. - * 0x00001800 Scatter/Gather TLB Regs. - * 0x00004000 MDPA Error Status & Diagnostic Control - * 0x00008000 MDPB Error Status & Diagnostic Control - * 0x000E0000 - Flash Rom Space -- - * 0x000FFFFF offset address into PCI Dense Mem Space - * 0x10003F00 Interrupt Acknowledge - * - */ - - -/* - * Address Space Cookies - */ - -#define MCPCIA_PCI_SPARSE 0x000000000LL -#define MCPCIA_PCI_DENSE 0x100000000LL -#define MCPCIA_PCI_IOSPACE 0x180000000LL -#define MCPCIA_PCI_CONF 0x1C0000000LL -#define MCPCIA_PCI_BRIDGE 0x1E0000000LL -#define MCPCIA_PCI_IACK 0x1F0000000LL - -/* - * MCPCIA Bus Bridge Registers - * - * These are offsets that don't include GBUS, MID, or address space offsets. - */ - -#define _MCPCIA_PCI_REV 0x000000000 /* PCI Revision Register (R) */ -#define _MCPCIA_WHOAMI 0x000000040 /* PCI Who Am I (R) */ -#define _MCPCIA_PCI_LAT 0x000000080 /* PCI Latency Timer (RW) */ -#define _MCPCIA_CAP_CTRL 0x000000100 /* PCI Bridge Control (RW) */ -#define _MCPCIA_HAE_MEM 0x000000400 /* PCI HAE Sparse Memory (RW) */ -#define _MCPCIA_HAE_IO 0x000000440 /* PCI HAE Sparse I/O (RW) */ -#define _MCPCIA_IACK_SC 0x000000480 /* PCI Special Cycle Ack */ -#define _MCPCIA_HAE_DENSE 0x0000004C0 /* PCI HAE Dense Memory (RW) */ - -#define _MCPCIA_INT_CTL 0x000000500 /* PCI Interrupt Control */ -#define _MCPCIA_INT_REQ 0x000000540 /* PCI Interrupt Request */ -#define _MCPCIA_INT_TARG 0x000000580 /* PCI Int Tgt Devices */ -#define _MCPCIA_INT_ADR 0x0000005C0 /* PCI Int Tgt Address */ -#define _MCPCIA_INT_ADR_EXT 0x000000600 /* PCI Int Tgt Addr Ext */ -#define _MCPCIA_INT_MASK0 0x000000640 /* PCI Int Mask 0 */ -#define _MCPCIA_INT_MASK1 0x000000680 /* PCI Int Mask 1 */ - -#define _MCPCIA_INT_ACK0 0x010003F00 /* PCI Int Ack 0 */ -#define _MCPCIA_INT_ACK1 0x010003F40 /* PCI Int Ack 1 */ - -#define _MCPCIA_PERF_MON 0x000000300 /* PCI Perf Monitor */ -#define _MCPCIA_PERF_CONT 0x000000340 /* PCI Perf Monitor Control */ - -#define _MCPCIA_CAP_DIAG 0x000000700 /* MC-PCI Diagnostic Control */ -#define _MCPCIA_SCRATCH0 0x000000740 /* Diag General */ -#define _MCPCIA_SCRATCH1 0x000000780 /* Diag General */ -#define _MCPCIA_TOM 0x0000007C0 /* Top Of Memory */ -#define _MCPCIA_MC_ERR0 0x000000800 /* MC Err Info 0 */ -#define _MCPCIA_MC_ERR1 0x000000840 /* MC Err Info 1 */ -#define _MCPCIA_CAP_ERR 0x000000880 /* CAP Error Register */ - -#define _MCPCIA_PCI_ERR1 0x000001040 /* PCI Error Status */ - -#define _MCPCIA_MDPA_STAT 0x000004000 /* MDPA Status */ -#define _MCPCIA_MDPA_SYN 0x000004040 /* MDPA Syndrome */ -#define _MCPCIA_MDPA_DIAG 0x000004080 /* Diag Check MDPA */ - -#define _MCPCIA_MDPB_STAT 0x000008000 /* MDPB Status */ -#define _MCPCIA_MDPB_SYN 0x000008040 /* MDPB Syndrome */ -#define _MCPCIA_MDPB_DIAG 0x000008080 /* Diag Check MDPB */ - -#define _MCPCIA_SG_TBIA 0x000001300 /* Scatter/Gather TBIA */ -#define _MCPCIA_HBASE 0x000001340 /* PC "Hole" Compatibility */ -#define _MCPCIA_W0_BASE 0x000001400 /* Window Base 0 */ -#define _MCPCIA_W0_MASK 0x000001440 /* Window Mask 0 */ -#define _MCPCIA_T0_BASE 0x000001480 /* Translated Base 0 */ -#define _MCPCIA_W1_BASE 0x000001500 /* Window Base 1 */ -#define _MCPCIA_W1_MASK 0x000001540 /* Window Mask 1 */ -#define _MCPCIA_T1_BASE 0x000001580 /* Translated Base 1 */ -#define _MCPCIA_W2_BASE 0x000001600 /* Window Base 2 */ -#define _MCPCIA_W2_MASK 0x000001640 /* Window Mask 2 */ -#define _MCPCIA_T2_BASE 0x000001680 /* Translated Base 2 */ -#define _MCPCIA_W3_BASE 0x000001700 /* Window Base 3 */ -#define _MCPCIA_W3_MASK 0x000001740 /* Window Mask 3 */ -#define _MCPCIA_T3_BASE 0x000001780 /* Translated Base 3 */ -#define _MCPCIA_W_DAC 0x0000017C0 /* Window DAC Base */ - - -/* - * Handier defines- uses precalculated offset in softc. - */ -#define _SYBRIDGE(ccp) ((ccp)->sysbase | MCPCIA_PCI_BRIDGE) - -#define MCPCIA_PCI_REV(ccp) (_SYBRIDGE(ccp) | _MCPCIA_PCI_REV) -#define MCPCIA_WHOAMI(ccp) (_SYBRIDGE(ccp) | _MCPCIA_WHOAMI) -#define MCPCIA_PCI_LAT(ccp) (_SYBRIDGE(ccp) | _MCPCIA_PCI_LAT) -#define MCPCIA_CAP_CTRL(ccp) (_SYBRIDGE(ccp) | _MCPCIA_CAP_CTRL) -#define MCPCIA_HAE_MEM(ccp) (_SYBRIDGE(ccp) | _MCPCIA_HAE_MEM) -#define MCPCIA_HAE_IO(ccp) (_SYBRIDGE(ccp) | _MCPCIA_HAE_IO) -#define MCPCIA_IACK_SC(ccp) (_SYBRIDGE(ccp) | _MCPCIA_IACK_SC) -#define MCPCIA_HAE_DENSE(ccp) (_SYBRIDGE(ccp) | _MCPCIA_HAE_DENSE) -#define MCPCIA_INT_CTL(ccp) (_SYBRIDGE(ccp) | _MCPCIA_INT_CTL) -#define MCPCIA_INT_REQ(ccp) (_SYBRIDGE(ccp) | _MCPCIA_INT_REQ) -#define MCPCIA_INT_TARG(ccp) (_SYBRIDGE(ccp) | _MCPCIA_INT_TARG) -#define MCPCIA_INT_ADR(ccp) (_SYBRIDGE(ccp) | _MCPCIA_INT_ADR) -#define MCPCIA_INT_ADR_EXT(ccp) (_SYBRIDGE(ccp) | _MCPCIA_INT_ADR_EXT) -#define MCPCIA_INT_MASK0(ccp) (_SYBRIDGE(ccp) | _MCPCIA_INT_MASK0) -#define MCPCIA_INT_MASK1(ccp) (_SYBRIDGE(ccp) | _MCPCIA_INT_MASK1) -#define MCPCIA_PERF_MON(ccp) (_SYBRIDGE(ccp) | _MCPCIA_PERF_MON) -#define MCPCIA_PERF_CONT(ccp) (_SYBRIDGE(ccp) | _MCPCIA_PERF_CONT) -#define MCPCIA_CAP_DIAG(ccp) (_SYBRIDGE(ccp) | _MCPCIA_CAP_DIAG) -#define MCPCIA_SCRATCH0(ccp) (_SYBRIDGE(ccp) | _MCPCIA_SCRATCH0) -#define MCPCIA_SCRATCH1(ccp) (_SYBRIDGE(ccp) | _MCPCIA_SCRATCH1) -#define MCPCIA_TOM(ccp) (_SYBRIDGE(ccp) | _MCPCIA_TOM) -#define MCPCIA_MC_ERR0(ccp) (_SYBRIDGE(ccp) | _MCPCIA_MC_ERR0) -#define MCPCIA_MC_ERR1(ccp) (_SYBRIDGE(ccp) | _MCPCIA_MC_ERR1) -#define MCPCIA_CAP_ERR(ccp) (_SYBRIDGE(ccp) | _MCPCIA_CAP_ERR) -#define MCPCIA_PCI_ERR1(ccp) (_SYBRIDGE(ccp) | _MCPCIA_PCI_ERR1) -#define MCPCIA_MDPA_STAT(ccp) (_SYBRIDGE(ccp) | _MCPCIA_MDPA_STAT) -#define MCPCIA_MDPA_SYN(ccp) (_SYBRIDGE(ccp) | _MCPCIA_MDPA_SYN) -#define MCPCIA_MDPA_DIAG(ccp) (_SYBRIDGE(ccp) | _MCPCIA_MDPA_DIAG) -#define MCPCIA_MDPB_STAT(ccp) (_SYBRIDGE(ccp) | _MCPCIA_MDPB_STAT) -#define MCPCIA_MDPB_SYN(ccp) (_SYBRIDGE(ccp) | _MCPCIA_MDPB_SYN) -#define MCPCIA_MDPB_DIAG(ccp) (_SYBRIDGE(ccp) | _MCPCIA_MDPB_DIAG) -#define MCPCIA_SG_TBIA(ccp) (_SYBRIDGE(ccp) | _MCPCIA_SG_TBIA) -#define MCPCIA_HBASE(ccp) (_SYBRIDGE(ccp) | _MCPCIA_HBASE) -#define MCPCIA_W0_BASE(ccp) (_SYBRIDGE(ccp) | _MCPCIA_W0_BASE) -#define MCPCIA_W0_MASK(ccp) (_SYBRIDGE(ccp) | _MCPCIA_W0_MASK) -#define MCPCIA_T0_BASE(ccp) (_SYBRIDGE(ccp) | _MCPCIA_T0_BASE) -#define MCPCIA_W1_BASE(ccp) (_SYBRIDGE(ccp) | _MCPCIA_W1_BASE) -#define MCPCIA_W1_MASK(ccp) (_SYBRIDGE(ccp) | _MCPCIA_W1_MASK) -#define MCPCIA_T1_BASE(ccp) (_SYBRIDGE(ccp) | _MCPCIA_T1_BASE) -#define MCPCIA_W2_BASE(ccp) (_SYBRIDGE(ccp) | _MCPCIA_W2_BASE) -#define MCPCIA_W2_MASK(ccp) (_SYBRIDGE(ccp) | _MCPCIA_W2_MASK) -#define MCPCIA_T2_BASE(ccp) (_SYBRIDGE(ccp) | _MCPCIA_T2_BASE) -#define MCPCIA_W3_BASE(ccp) (_SYBRIDGE(ccp) | _MCPCIA_W3_BASE) -#define MCPCIA_W3_MASK(ccp) (_SYBRIDGE(ccp) | _MCPCIA_W3_MASK) -#define MCPCIA_T3_BASE(ccp) (_SYBRIDGE(ccp) | _MCPCIA_T3_BASE) -#define MCPCIA_W_DAC(ccp) (_SYBRIDGE(ccp) | _MCPCIA_W_DAC) - -#define MCPCIA_INT_ACK0(ccp) \ - ((ccp)->sysbase | MCPCIA_PCI_IACK | _MCPCIA_INT_ACK0) -#define MCPCIA_INT_ACK1(ccp) \ - ((ccp)->sysbase | MCPCIA_PCI_IACK | _MCPCIA_INT_ACK1) - -/* - * This is here for what error handling will get as a collected subpacket. - */ - -struct mcpcia_iodsnap { - u_int64_t base_addr; - u_int32_t whami; - u_int32_t rsvd0; - u_int32_t pci_rev; - u_int32_t cap_ctrl; - u_int32_t hae_mem; - u_int32_t hae_io; - u_int32_t int_ctl; - u_int32_t int_reg; - u_int32_t int_mask0; - u_int32_t int_mask1; - u_int32_t mc_err0; - u_int32_t mc_err1; - u_int32_t cap_err; - u_int32_t sys_env; - u_int32_t pci_err1; - u_int32_t mdpa_stat; - u_int32_t mdpa_syn; - u_int32_t mdpb_stat; - u_int32_t mdpb_syn; - u_int32_t rsvd2; - u_int32_t rsvd3; - u_int32_t rsvd4; -}; - -/* - * PCI_REV Register definitions - */ -#define CAP_REV(reg) ((reg) & 0xf) -#define HORSE_REV(reg) (((reg) >> 4) & 0xf) -#define SADDLE_REV(reg) (((reg) >> 8) & 0xf) -#define SADDLE_TYPE(reg) (((reg) >> 12) & 0x3) -#define EISA_PRESENT(reg) ((reg) & (1 << 15)) -#define IS_MCPCIA_MAGIC(reg) (((reg) & 0xffff0000) == 0x6000000) - - -/* - * WHOAMI Register definitions - * - * The Device ID is an echo of the MID of the CPU reading this register- - * cheezy way to figure out who you are (ask someone else!). - */ -#define MCBUS_CPU_MID(x) ((x) & 0x7) -#define MCBUS_CPU_INFO(x) (((x) >> 6) & 0xff) -#define CPU_Fill_Err 0x80 -#define CPU_DTAG_Perr 0x40 -#define CPU_RevMask 0x38 -#define CPU_RevShift 3 -#define CPU_BCacheMask 0x3 -#define CPU_BCache_0MB 0 -#define CPU_BCache_1MB 1 -#define CPU_BCache_2MB 2 -#define CPU_BCache_4MB 3 - -/* - * PCI Latency Register Definitions - */ -#define PCI_LAT_SHIFT 8 /* it's in the 2nd byte. */ - -/* - * CAP Control Register Defintions - */ -#define CAP_LED_ON 0x00000001 /* Selftest LED passed */ -#define CAP_EV56_BW_EN 0x00000002 /* BW Enables (EV56, EV6 only) */ -#define CAP_DLY_RD_EN 0x00000010 /* PCI Delayed Reads Enabled */ -#define CAP_MEM_EN 0x00000020 /* Respond to PCI transactions */ -#define CAP_REQ64_EN 0x00000040 /* Request 64 bit data transactions */ -#define CAP_ACK64_EN 0x00000080 /* Respond to 64 bit data "" */ -#define CAP_ADR_PAR_EN 0x00000100 /* Check PCI address Parity */ -#define CAP_MC_CA_PAR 0x00000200 /* Check MC bus CMD/Address Parity */ -#define CAP_MC_NXM_EN 0x00000400 /* Check for MC NXM */ -#define CAP_BUS_MON 0x00000800 /* Check for PCI errs (as bystander) */ -/* bits 19:16 control number of pending write transactions */ -#define SHORT 0 -#define MED 1 -#define LONG 2 -#define CAP_MEMRD_PREFETCH_SHIFT 20 -#define CAP_MEMRDLN_PREFETCH_SHIFT 22 -#define CAP_MEMRDMULT_PREFETCH_SHIFT 24 -#define CAP_PARTIAL_WRITE (1 << 26) - -#define CAP_ARB_BPRI 0x00000000 /* Bridge Priority Arb */ -#define CAP_ARB_RROBIN 0x40000000 /* "" Round Robin */ -#define CAP_ARB_RROBIN1 0x80000000 /* "" Round Robin #1 */ - -/* - * Diagnostic Register Bits - */ -/* CAP_DIAG register */ -#define CAP_DIAG_PCIRESET 0x1 /* - * WriteOnly. Assert 1 for 100usec min., - * then write zero. NOTE: deadlocks - * exist in h/w if anything but this - * register is accessed while reset - * is asserted. - */ -#define CAP_DIAG_MC_ADRPE (1<<30) /* Invert MC Bus Address/Parity */ -#define CAP_DIAG_PCI_ADRPE (1<<31) /* Force bad PCI parity (low 32) */ - -/* MDPA_DIAG or MDPB_DIAG registers */ -#define MDPX_ECC_ENA (1<<28) /* Enable ECC on MC Bus (default 1) */ -#define MDPX_PAR_ENA (1<<29) /* Enable Parity on PCI (default 0) */ -#define MDPX_DIAG_FPE_PCI (1<<30) /* Force PCI parity error */ -#define MDPX_DIAG_USE_CHK (1<<31) /* - * When set, DMA write cycles use the - * value in the low 8 bits of this - * register (MDPA or MDPB) as ECC - * sent onto main memory. - */ - -/* - * Interrupt Specific bits... - * - * Mostly we don't have to mess with any of the interrupt specific registers - * as the SRM has set most of this pretty complex stuff up for us. - * - * However, to enable specific interrupts, we need to set some bits - * in imask0 if we want to have them vectored to PALcode for appropriate - * dispatch. - */ -/* - * Bits for INT_CTL register - */ -#define MCPCIA_INTCTL_EN_INT 0x1 /* enable interrupts */ -#define MCPCIA_INTCTL_EN_INT_NUM 0x2 /* enable INT_ADR/ADR_EXT */ - -/* - * Bits for MASK0 registers. - * bits 0-15 correspond to 4 slots (time 4 buspins) for each PCI bus. - * bit 16 is the NCR810 onboard SCSI interrupt. - * bits 19-20 are reserved. - */ - -#define MCPCIA_I2C_CTRL_INTR (1<<17) -#define MCPCIA_I2C_CTRL_BUS_ERR (1<<18) - -#define MCPCIA_8259_NMI_INTR (1<<21) -#define MCPCIA_SOFT_ERR_INTR (1<<22) -#define MCPCIA_HARD_ERR_INTR (1<<23) - -#ifdef YET -#define MCPCIA_GEN_IENABL \ - (MCPCIA_I2C_CTRL_BUS_ERR|MCPCIA_SOFT_ERR_INTR|MCPCIA_HARD_ERR_INTR) -#else -#define MCPCIA_GEN_IENABL \ - (MCPCIA_SOFT_ERR_INTR|MCPCIA_HARD_ERR_INTR) -#endif - -/* - * DMA Address Specific bits... - */ - -#define MCPCIA_WBASE_EN 0x1 -#define MCPCIA_WBASE_SG 0x2 -#define MCPCIA_WBASE_DAC 0x8 -#define MCPCIA_WBASE_BSHIFT 20 - -#define MCPCIA_WMASK_1M 0x00000000 -#define MCPCIA_WMASK_2M 0x00100000 -#define MCPCIA_WMASK_4M 0x00300000 -#define MCPCIA_WMASK_8M 0x00700000 -#define MCPCIA_WMASK_16M 0x00f00000 -#define MCPCIA_WMASK_32M 0x01f00000 -#define MCPCIA_WMASK_64M 0x03f00000 -#define MCPCIA_WMASK_128M 0x07f00000 -#define MCPCIA_WMASK_256M 0x0ff00000 -#define MCPCIA_WMASK_512M 0x1ff00000 -#define MCPCIA_WMASK_1G 0x3ff00000 -#define MCPCIA_WMASK_2G 0x7ff00000 -#define MCPCIA_WMASK_4G 0xfff00000 - -/* - * The WBASEX register contains bits 39:10 of a physical address - * shifted to bits 31:2 of this 32 bit register. Namely, shifted - * right by 8 bits. - */ -#define MCPCIA_TBASEX_SHIFT 8 diff --git a/sys/alpha/mcbus/mcpciavar.h b/sys/alpha/mcbus/mcpciavar.h deleted file mode 100644 index 00c1ada..0000000 --- a/sys/alpha/mcbus/mcpciavar.h +++ /dev/null @@ -1,65 +0,0 @@ -/* $FreeBSD$ */ - -/*- - * Copyright (c) 1998, 2000 by Matthew Jacob - * - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * There are four PCI slots per MCPCIA PCI bus here, but some are 'hidden'- - * none seems to be higher than 6 though. - */ -#define MCPCIA_MAXDEV 6 -#define MCPCIA_MAXSLOT 8 - -/* - * Interrupt Stuff for MCPCIA systems. - * - * EISA interrupts (at vector 0x800) have to be shared interrupts- - * and that can be easily managed. All the PCI interrupts are deterministic - * in that they start at vector 0x900, 0x40 per PCI slot, 0x200 per - * MCPCIA, 4 MCPCIAs per GCBUS.... - */ -#define MCPCIA_EISA_KEYB_IRQ 1 -#define MCPCIA_EISA_MOUSE_IRQ 12 -#define MCPCIA_VEC_EISA 0x800 -#define MCPCIA_EISA_IRQ 16 -#define MCPCIA_VEC_PCI 0x900 -#define MCPCIA_VEC_NCR 0xB40 -#define MCPCIA_NCR_IRQ 16 - -#define MCPCIA_VECWIDTH_PER_MCPCIA 0x200 -#define MCPCIA_MID_SHIFT 9 -#define MCPCIA_VECWIDTH_PER_SLOT 0x40 -#define MCPCIA_SLOT_SHIFT 6 -#define MCPCIA_VECWIDTH_PER_INTPIN 0x10 -#define MCPCIA_IRQ_SHIFT 4 - -/* - * Special Vectors - */ -#define MCPCIA_I2C_CVEC 0xA90 -#define MCPCIA_I2C_BVEC 0xAA0 - -extern void mcpcia_init(int, int); diff --git a/sys/alpha/osf1/Makefile b/sys/alpha/osf1/Makefile deleted file mode 100644 index d542007..0000000 --- a/sys/alpha/osf1/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $FreeBSD$ - -# Makefile for syscall tables. - -all: - @echo "make sysent only" - -sysent: osf1_sysent.c osf1_syscall.h osf1_proto.h - -osf1_sysent.c osf1_syscall.h osf1_proto.h: ../../kern/makesyscalls.sh \ - syscalls.master syscalls.conf - -mv -f osf1_sysent.c osf1_sysent.c.bak - -mv -f osf1_syscall.h osf1_syscall.h.bak - -mv -f osf1_proto.h osf1_proto.h.bak - sh ../../kern/makesyscalls.sh syscalls.master syscalls.conf diff --git a/sys/alpha/osf1/README.mach-traps b/sys/alpha/osf1/README.mach-traps deleted file mode 100644 index bbc1a79..0000000 --- a/sys/alpha/osf1/README.mach-traps +++ /dev/null @@ -1,69 +0,0 @@ -$NetBSD: README.mach-traps,v 1.2 1999/03/23 09:19:25 itohy Exp $ -$FreeBSD$ - -Some Alpha AXP OSF/1 binaries directly use the facilities provided by -the Mach kernel that is the basis for OSF/1. These include (but are -surely not limited to) 'dd', 'ps', and 'w'. - -Invariably, the symptom that these binaries display is that they crash -with an "unimplemented system call" trap (SIGSYS signal) for a syscall -that has a negative number. In general, binaries that use the Mach -syscalls appear to invoke task_self() as their first syscall. - -The name, number, and number of arguments for each Mach syscall is -given below; this information was gleaned by looking through the OSF/1 -libmach.a's object files with dbx, then double-checked against the -contents of OSF/1's <mach/syscall_sw.h>. - -These calls would be very difficult to implement properly in the -OSF/1 emulation code; by its very nature, NetBSD is not Mach, and we -don't and can't provide the underlying facilities that it does. - --- cgd - -trap name number nargs notes ----- ---- ------ ----- ----- -task_self -10 0 -thread_reply -11 0 -task_notify -12 0 -thread_self -13 0 -msg_send_old -14 3 -msg_receive_old -15 3 -msg_rpc_old -16 5 -msg_send_trap -20 4 -msg_receive_trap -21 5 -msg_rpc_trap -22 6 -lw_wire -30 3 -lw_unwire -31 1 -nxm_task_init -33 2 -nxm_sched_thread -34 1 -nxm_idle -35 1 -nxm_wakeup_idle -36 1 -nxm_set_pthid -37 2 -nxm_thread_kill -38 2 -nxm_thread_block -39 1 -nxm_thread_wakeup -40 1 -inode_swap_preference -40 3 old call? -init_process -41 0 -map_fd -43 5 -nxm_resched -44 2 -htg_unix_syscall -52 3 -host_self -55 1 -host_priv_self -56 1 -swtch_pri -59 1 -swtch -60 0 -thread_switch -61 3 -semop_fast -62 4 -mach_sctimes_0 -70 0 only if MACH_SCTIMES defined -mach_sctimes_1 -71 1 only if MACH_SCTIMES defined -mach_sctimes_2 -72 2 only if MACH_SCTIMES defined -mach_sctimes_3 -73 3 only if MACH_SCTIMES defined -mach_sctimes_4 -74 4 only if MACH_SCTIMES defined -mach_sctimes_5 -75 5 only if MACH_SCTIMES defined -mach_sctimes_6 -76 6 only if MACH_SCTIMES defined -mach_sctimes_7 -77 0 only if MACH_SCTIMES defined -mach_sctimes_8 -78 6 only if MACH_SCTIMES defined -mach_sctimes_9 -79 1 only if MACH_SCTIMES defined -mach_sctimes_10 -80 2 only if MACH_SCTIMES defined -mach_sctimes_11 -81 2 only if MACH_SCTIMES defined -mach_sctimes_port_alloc_dealloc -82 1 only if MACH_SCTIMES defined diff --git a/sys/alpha/osf1/exec_ecoff.h b/sys/alpha/osf1/exec_ecoff.h deleted file mode 100644 index b888612..0000000 --- a/sys/alpha/osf1/exec_ecoff.h +++ /dev/null @@ -1,195 +0,0 @@ -/* $NetBSD: exec_ecoff.h,v 1.10 1996/09/26 22:39:14 cgd Exp $ */ - -/*- - * Copyright (c) 1994 Adam Glass - * 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 Adam Glass. - * 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. - * - * $FreeBSD$ - */ - -#ifndef _SYS_EXEC_ECOFF_H_ -#define _SYS_EXEC_ECOFF_H_ - -#define ECOFF_LDPGSZ 4096 - -#define ECOFF_PAD \ - u_short bldrev; /* XXX */ - -#define ECOFF_MACHDEP \ - u_int gprmask; \ - u_int fprmask; \ - u_long gp_value - -#define ECOFF_MAGIC_ALPHA 0603 -#define ECOFF_MAGIC_NETBSD_ALPHA 0605 -#define ECOFF_BADMAG(ep) ((ep)->f.f_magic != ECOFF_MAGIC_ALPHA) - -#define ECOFF_FLAG_EXEC 0002 -#define ECOFF_SEGMENT_ALIGNMENT(ep) \ - (((ep)->f.f_flags & ECOFF_FLAG_EXEC) == 0 ? 8 : 16) - -struct ecoff_symhdr { - int16_t magic; - int16_t vstamp; - int32_t lineMax; - int32_t densenumMax; - int32_t procMax; - int32_t lsymMax; - int32_t optsymMax; - int32_t auxsymMax; - int32_t lstrMax; - int32_t estrMax; - int32_t fdMax; - int32_t rfdMax; - int32_t esymMax; - long linesize; - long cbLineOffset; - long cbDnOffset; - long cbPdOffset; - long cbSymOffset; - long cbOptOffset; - long cbAuxOffset; - long cbSsOffset; - long cbSsExtOffset; - long cbFdOffset; - long cbRfdOffset; - long cbExtOffset; -}; - -struct ecoff_extsym { - long es_value; - int es_strindex; - unsigned es_type:6; - unsigned es_class:5; - unsigned :1; - unsigned es_symauxindex:20; - unsigned es_jmptbl:1; - unsigned es_cmain:1; - unsigned es_weakext:1; - unsigned :29; - int es_indexfld; -}; - - -struct ecoff_filehdr { - u_short f_magic; /* magic number */ - u_short f_nscns; /* # of sections */ - u_int f_timdat; /* time and date stamp */ - u_long f_symptr; /* file offset of symbol table */ - u_int f_nsyms; /* # of symbol table entries */ - u_short f_opthdr; /* sizeof the optional header */ - u_short f_flags; /* flags??? */ -}; - -struct ecoff_aouthdr { - u_short magic; - u_short vstamp; - ECOFF_PAD - u_long tsize; - u_long dsize; - u_long bsize; - u_long entry; - u_long text_start; - u_long data_start; - u_long bss_start; - ECOFF_MACHDEP; -}; - -struct ecoff_scnhdr { /* needed for size info */ - char s_name[8]; /* name */ - u_long s_paddr; /* physical addr? for ROMing?*/ - u_long s_vaddr; /* virtual addr? */ - u_long s_size; /* size */ - u_long s_scnptr; /* file offset of raw data */ - u_long s_relptr; /* file offset of reloc data */ - u_long s_lnnoptr; /* file offset of line data */ - u_short s_nreloc; /* # of relocation entries */ - u_short s_nlnno; /* # of line entries */ - u_int s_flags; /* flags */ -}; - -struct ecoff_exechdr { - struct ecoff_filehdr f; - struct ecoff_aouthdr a; -}; -enum scnhdr_flags { - STYP_REG = 0x00, /* regular (alloc'ed, reloc'ed, loaded) */ - STYP_DSECT = 0x01, /* dummy (reloc'd) */ - STYP_NOLOAD = 0x02, /* no-load (reloc'd) */ - STYP_GROUP = 0x04, /* grouped */ - STYP_PAD = 0x08, /* padding (loaded) */ - STYP_COPY = 0x10, /* ??? */ - STYP_TEXT = 0x20, /* text */ - STYP_DATA = 0x40, /* data */ - STYP_BSS = 0x80, /* bss */ - STYP_INFO = 0x200, /* comment (!loaded, !alloc'ed, !reloc'd) */ - STYP_OVER = 0x400, /* overlay (!allocated, reloc'd, !loaded) */ - STYP_LIB = 0x800 /* lists shared library files */ -}; - -#define ECOFF_HDR_SIZE (sizeof(struct ecoff_exechdr)) - -#define ECOFF_OMAGIC 0407 -#define ECOFF_NMAGIC 0410 -#define ECOFF_ZMAGIC 0413 - -#define ECOFF_ROUND(value, by) \ - (((value) + (by) - 1) & ~((by) - 1)) - -#define ECOFF_BLOCK_ALIGN(ep, value) \ - ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_ROUND((value), ECOFF_LDPGSZ) : \ - (value)) - -#define ECOFF_TXTOFF(ep) \ - ((ep)->a.magic == ECOFF_ZMAGIC ? 0 : \ - ECOFF_ROUND(ECOFF_HDR_SIZE + (ep)->f.f_nscns * \ - sizeof(struct ecoff_scnhdr), ECOFF_SEGMENT_ALIGNMENT(ep))) - -#define ECOFF_DATOFF(ep) \ - (ECOFF_BLOCK_ALIGN((ep), ECOFF_TXTOFF(ep) + (ep)->a.tsize)) - -#define ECOFF_SEGMENT_ALIGN(ep, value) \ - (ECOFF_ROUND((value), ((ep)->a.magic == ECOFF_ZMAGIC ? ECOFF_LDPGSZ : \ - ECOFF_SEGMENT_ALIGNMENT(ep)))) - -typedef struct { - char *loader; - char exec_path[PATH_MAX]; - char *executable; - struct nameidata *ndp; - -} Osf_Auxargs; - -#define OSF1_EXEC_NAME (1001) -#define OSF1_LOADER_NAME (1002) -#define OSF1_LOADER_FLAGS (1003) - -#define DYNAMIC_FLAG 0x3000 -#define DEFAULT_LOADER "/sbin/loader" - -#endif /* !_SYS_EXEC_ECOFF_H_ */ diff --git a/sys/alpha/osf1/imgact_osf1.c b/sys/alpha/osf1/imgact_osf1.c deleted file mode 100644 index 55498e0..0000000 --- a/sys/alpha/osf1/imgact_osf1.c +++ /dev/null @@ -1,250 +0,0 @@ -/*- - * Copyright (c) 1998-1999 Andrew Gallatin - * All rights reserved. - * - * Based heavily on imgact_linux.c which is - * Copyright (c) 1994-1996 Søren Schmidt. - * Which in turn is based heavily on /sys/kern/imgact_aout.c which is: - * Copyright (c) 1993, David Greenman - * - * 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 - * in this position and unchanged. - * 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. 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/types.h> -#include <sys/malloc.h> - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/mount.h> -#include <sys/filedesc.h> -#include <sys/fcntl.h> -#include <sys/resourcevar.h> -#include <sys/exec.h> -#include <sys/mman.h> -#include <sys/imgact.h> -#include <sys/imgact_aout.h> -#include <sys/kernel.h> -#include <sys/module.h> - -#include <sys/lock.h> -#include <sys/mutex.h> -#include <sys/proc.h> -#include <sys/pioctl.h> -#include <sys/namei.h> -#include <sys/sysent.h> -#include <sys/shm.h> -#include <sys/sysctl.h> -#include <sys/vnode.h> - -#include <vm/vm.h> -#include <vm/vm_kern.h> -#include <vm/vm_param.h> -#include <vm/pmap.h> -#include <vm/vm_map.h> -#include <vm/vm_extern.h> - -#include <alpha/osf1/exec_ecoff.h> -extern struct sysentvec osf1_sysvec; - -#ifdef DEBUG -#define DPRINTF(a) printf a; -#else -#define DPRINTF(a) -#endif - -static int -exec_osf1_imgact(struct image_params *imgp) -{ - int error; - int path_not_saved; - size_t bytes; - const struct ecoff_exechdr *execp; - const struct ecoff_aouthdr *eap; - struct vmspace *vmspace; - vm_offset_t baddr; - vm_offset_t bsize; - vm_offset_t bss_start; - vm_offset_t daddr; - vm_offset_t dend; - vm_offset_t dsize; - vm_offset_t raw_dend; - vm_offset_t taddr; - vm_offset_t tend; - vm_offset_t tsize; - struct nameidata *ndp; - Osf_Auxargs *osf_auxargs; - struct thread *td; - - GIANT_REQUIRED; - - execp = (const struct ecoff_exechdr*)imgp->image_header; - eap = &execp->a; - ndp = NULL; - td = FIRST_THREAD_IN_PROC(imgp->proc); - -/* check to make sure we have an alpha ecoff executable */ - if (ECOFF_BADMAG(execp)) - return -1; - -/* verfify it an OSF/1 exectutable */ - if (eap->magic != ECOFF_ZMAGIC) { - printf("unknown ecoff magic %x\n", eap->magic); - return ENOEXEC; - } - osf_auxargs = malloc(sizeof(Osf_Auxargs), M_TEMP, M_WAITOK | M_ZERO); - imgp->auxargs = osf_auxargs; - osf_auxargs->executable = osf_auxargs->exec_path; - path_not_saved = copystr(imgp->args->fname, osf_auxargs->executable, - PATH_MAX, &bytes); - if (execp->f.f_flags & DYNAMIC_FLAG) { - if (path_not_saved) { - uprintf("path to dynamic exectutable not found\n"); - free(imgp->auxargs, M_TEMP); - return(path_not_saved); - } - /* - * Unmap the executable & attempt to slide in - * /sbin/loader in its place. - */ - if (imgp->firstpage) - exec_unmap_first_page(imgp); - - /* - * Replicate what execve does, and map the first - * page of the loader. - */ - ndp = (struct nameidata *)malloc(sizeof(struct nameidata), - M_TEMP, M_WAITOK); - NDINIT(ndp, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME, UIO_SYSSPACE, - "/compat/osf1/sbin/loader", td); - error = namei(ndp); - if (error) { - uprintf("imgact_osf1: can't read /compat/osf1/sbin/loader\n"); - free(imgp->auxargs, M_TEMP); - free(ndp, M_TEMP); - return(error); - } - NDFREE(ndp, NDF_ONLY_PNBUF); - if (imgp->vp) { - vput(imgp->vp); - /* leaking in the nameizone ??? XXX */ - } - imgp->vp = ndp->ni_vp; - error = exec_map_first_page(imgp); - osf_auxargs->loader = "/compat/osf1/sbin/loader"; - } - - execp = (const struct ecoff_exechdr*)imgp->image_header; - eap = &execp->a; - taddr = ECOFF_SEGMENT_ALIGN(execp, eap->text_start); - tend = round_page(eap->text_start + eap->tsize); - tsize = tend - taddr; - - daddr = ECOFF_SEGMENT_ALIGN(execp, eap->data_start); - dend = round_page(eap->data_start + eap->dsize); - dsize = dend - daddr; - - bss_start = ECOFF_SEGMENT_ALIGN(execp, eap->bss_start); - bsize = eap->bsize; - - imgp->entry_addr = eap->entry; - - /* - * Destroy old process VM and create a new one (with a new stack). - */ - exec_new_vmspace(imgp, &osf1_sysvec); - - /* - * The vm space can now be changed. - */ - vmspace = imgp->proc->p_vmspace; - - imgp->interpreted = 0; - imgp->proc->p_sysent = &osf1_sysvec; - - /* set up text segment */ - if ((error = vm_mmap(&vmspace->vm_map, &taddr, tsize, - VM_PROT_READ|VM_PROT_EXECUTE, VM_PROT_ALL, MAP_FIXED|MAP_COPY, - OBJT_VNODE, imgp->vp, ECOFF_TXTOFF(execp)))) { - DPRINTF(("%s(%d): error = %d\n", __FILE__, __LINE__, error)); - goto bail; - } - /* .. data .. */ - if ((error = vm_mmap(&vmspace->vm_map, &daddr, dsize, - VM_PROT_READ|VM_PROT_EXECUTE|VM_PROT_WRITE, VM_PROT_ALL, - MAP_FIXED|MAP_COPY, OBJT_VNODE, imgp->vp, ECOFF_DATOFF(execp)))) { - DPRINTF(("%s(%d): error = %d\n", __FILE__, __LINE__, error)); - goto bail; - } - /* .. bss .. */ - if (round_page(bsize)) { - baddr = bss_start; - if ((error = vm_map_find(&vmspace->vm_map, NULL, - (vm_offset_t) 0, &baddr, round_page(bsize), FALSE, - VM_PROT_ALL, VM_PROT_ALL, FALSE))) { - DPRINTF(("%s(%d): error = %d\n", __FILE__, __LINE__, - error)); - goto bail; - - } - } - - - raw_dend = (eap->data_start + eap->dsize); - if (dend > raw_dend) { - caddr_t zeros; - zeros = malloc(dend-raw_dend,M_TEMP,M_WAITOK|M_ZERO); - if ((error = copyout(zeros, (caddr_t)raw_dend, - dend-raw_dend))) { - uprintf("Can't zero start of bss, error %d\n",error); - free(zeros,M_TEMP); - goto bail; - } - free(zeros,M_TEMP); - - } - vmspace->vm_tsize = btoc(round_page(tsize)); - vmspace->vm_dsize = btoc((round_page(dsize) + round_page(bsize))); - vmspace->vm_taddr = (caddr_t)taddr; - vmspace->vm_daddr = (caddr_t)daddr; - - return(0); - - bail: - free(imgp->auxargs, M_TEMP); - if (ndp) { - VOP_CLOSE(ndp->ni_vp, FREAD, td->td_ucred, td); - vrele(ndp->ni_vp); - free(ndp, M_TEMP); - } - return(error); -} -/* - * Tell kern_execve.c about it, with a little help from the linker. - */ -struct execsw osf1_execsw = { exec_osf1_imgact, "OSF/1 ECOFF" }; -EXEC_SET(osf1_ecoff, osf1_execsw); diff --git a/sys/alpha/osf1/osf1.h b/sys/alpha/osf1/osf1.h deleted file mode 100644 index 41592d9..0000000 --- a/sys/alpha/osf1/osf1.h +++ /dev/null @@ -1,298 +0,0 @@ -/*- - * Copyright (c) 1998-1999 Andrew Gallatin - * - * 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 - * in this position and unchanged. - * 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. 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. - * - * $FreeBSD$ - */ - -extern struct sysent osf1_sysent[]; -extern int bsd_to_osf1_sig[]; -extern int bsd_to_osf1_errno[]; - -#define OSF1_MINSIGSTKSZ 4096 - -/* osf/1 ioctls */ -#define OSF1_IOCPARM_MASK 0x1fff /* parameter length, at most 13 bits */ -#define OSF1_IOCPARM_LEN(x) (((x) >> 16) & OSF1_IOCPARM_MASK) -#define OSF1_IOCGROUP(x) (((x) >> 8) & 0xff) -#define OSF1_IOCPARM_MAX NBPG /* max size of ioctl */ -#define OSF1_IOC_VOID 0x20000000 /* no parameters */ -#define OSF1_IOC_OUT 0x40000000 /* copy out parameters */ -#define OSF1_IOC_IN 0x80000000 /* copy in parameters */ -#define OSF1_IOC_INOUT (OSF1_IOC_IN|OSF1_IOC_OUT) -#define OSF1_IOC_DIRMASK 0xe0000000 /* mask for IN/OUT/VOID */ -#define OSF1_IOCCMD(x) ((x) & 0xff) - -/* for get sysinfo */ -#define OSF_GET_MAX_UPROCS 2 -#define OSF_GET_PHYSMEM 19 -#define OSF_GET_MAX_CPU 30 -#define OSF_GET_IEEE_FP_CONTROL 45 -#define OSF_GET_CPUS_IN_BOX 55 -#define OSF_GET_CPU_INFO 59 -#define OSF_GET_PROC_TYPE 60 -#define OSF_GET_HWRPB 101 -#define OSF_GET_PLATFORM_NAME 103 - -struct osf1_cpu_info { - int current_cpu; - int cpus_in_box; - int cpu_type; - int ncpus; - u_int64_t cpus_present; - u_int64_t cpus_running; - u_int64_t cpu_binding; - u_int64_t cpu_ex_binding; - int mhz; - int unused[3]; -}; - - - -/* for set sysinfo */ -#define OSF_SET_IEEE_FP_CONTROL 14 - -/* for rlimit */ -#define OSF1_RLIMIT_LASTCOMMON 5 /* last one that's common */ -#define OSF1_RLIMIT_NOFILE 6 /* OSF1's RLIMIT_NOFILE */ -#define OSF1_RLIMIT_NLIMITS 8 /* Number of OSF1 rlimits */ - -/* mmap flags */ - -#define OSF1_MAP_SHARED 0x001 -#define OSF1_MAP_PRIVATE 0x002 -#define OSF1_MAP_ANONYMOUS 0x010 -#define OSF1_MAP_FILE 0x000 -#define OSF1_MAP_TYPE 0x0f0 -#define OSF1_MAP_FIXED 0x100 -#define OSF1_MAP_HASSEMAPHORE 0x200 -#define OSF1_MAP_INHERIT 0x400 -#define OSF1_MAP_UNALIGNED 0x800 - -/* msync flags */ - -#define OSF1_MS_ASYNC 1 -#define OSF1_MS_SYNC 2 -#define OSF1_MS_INVALIDATE 4 - -#define OSF1_F_DUPFD 0 -#define OSF1_F_GETFD 1 -#define OSF1_F_SETFD 2 -#define OSF1_F_GETFL 3 -#define OSF1_F_SETFL 4 - - -#define _OSF1_PC_CHOWN_RESTRICTED 10 -#define _OSF1_PC_LINK_MAX 11 -#define _OSF1_PC_MAX_CANON 12 -#define _OSF1_PC_MAX_INPUT 13 -#define _OSF1_PC_NAME_MAX 14 -#define _OSF1_PC_NO_TRUNC 15 -#define _OSF1_PC_PATH_MAX 16 -#define _OSF1_PC_PIPE_BUF 17 -#define _OSF1_PC_VDISABLE 18 - - - -#define OSF1_FNONBLOCK 0x00004 /* XXX OSF1_O_NONBLOCK */ -#define OSF1_FAPPEND 0x00008 /* XXX OSF1_O_APPEND */ -#define OSF1_FDEFER 0x00020 -#define OSF1_FASYNC 0x00040 -#define OSF1_FCREAT 0x00200 -#define OSF1_FTRUNC 0x00400 -#define OSF1_FEXCL 0x00800 -#define OSF1_FSYNC 0x04000 /* XXX OSF1_O_SYNC */ -#define OSF1_FNDELAY 0x08000 - -#define OSF1_RB_ASKNAME 0x001 -#define OSF1_RB_SINGLE 0x002 -#define OSF1_RB_NOSYNC 0x004 -#define OSF1_RB_HALT 0x008 -#define OSF1_RB_INITNAME 0x010 -#define OSF1_RB_DFLTROOT 0x020 -#define OSF1_RB_ALTBOOT 0x040 -#define OSF1_RB_UNIPROC 0x080 -#define OSF1_RB_ALLFLAGS 0x0ff /* all of the above */ - -/* - * osf/1 uses ints in its struct timeval, this means that - * any syscalls which means that any system calls using - * timevals need to be intercepted. - */ - - -struct osf1_timeval { - int tv_sec; /* seconds */ - int tv_usec; /* microseconds */ -}; - -struct osf1_itimerval { - struct osf1_timeval it_interval; /* timer interval */ - struct osf1_timeval it_value; /* current value */ -}; -#define TV_CP(src,dst) {dst.tv_usec = src.tv_usec; dst.tv_sec = src.tv_sec;} - -#define timersub(tvp, uvp, vvp) \ - do { \ - (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \ - (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \ - if ((vvp)->tv_usec < 0) { \ - (vvp)->tv_sec--; \ - (vvp)->tv_usec += 1000000; \ - } \ - } while (0) - -struct osf1_rusage { - struct osf1_timeval ru_utime; /* user time used */ - struct osf1_timeval ru_stime; /* system time used */ - long ru_maxrss; /* max resident set size */ -#define ru_first ru_ixrss - long ru_ixrss; /* integral shared memory size */ - long ru_idrss; /* integral unshared data " */ - long ru_isrss; /* integral unshared stack " */ - long ru_minflt; /* page reclaims */ - long ru_majflt; /* page faults */ - long ru_nswap; /* swaps */ - long ru_inblock; /* block input operations */ - long ru_oublock; /* block output operations */ - long ru_msgsnd; /* messages sent */ - long ru_msgrcv; /* messages received */ - long ru_nsignals; /* signals received */ - long ru_nvcsw; /* voluntary context switches */ - long ru_nivcsw; /* involuntary " */ -#define ru_last ru_nivcsw -}; - -#define OSF1_USC_GET 1 -#define OSF1_USC_SET 2 -#define OSF1_USW_NULLP 0x100 - - -/* File system type numbers. */ -#define OSF1_MOUNT_NONE 0 -#define OSF1_MOUNT_UFS 1 -#define OSF1_MOUNT_NFS 2 -#define OSF1_MOUNT_MFS 3 -#define OSF1_MOUNT_PC 4 -#define OSF1_MOUNT_S5FS 5 -#define OSF1_MOUNT_CDFS 6 -#define OSF1_MOUNT_DFS 7 -#define OSF1_MOUNT_EFS 8 -#define OSF1_MOUNT_PROCFS 9 -#define OSF1_MOUNT_MSFS 10 -#define OSF1_MOUNT_FFM 11 -#define OSF1_MOUNT_FDFS 12 -#define OSF1_MOUNT_ADDON 13 -#define OSF1_MOUNT_MAXTYPE OSF1_MOUNT_ADDON - -#define OSF1_MNT_WAIT 0x1 -#define OSF1_MNT_NOWAIT 0x2 - -#define OSF1_MNT_FORCE 0x1 -#define OSF1_MNT_NOFORCE 0x2 - -/* acceptable flags for various calls */ -#define OSF1_GETFSSTAT_FLAGS (OSF1_MNT_WAIT|OSF1_MNT_NOWAIT) -#define OSF1_MOUNT_FLAGS 0xffffffff /* XXX */ -#define OSF1_UNMOUNT_FLAGS (OSF1_MNT_FORCE|OSF1_MNT_NOFORCE) - -struct osf1_statfs { - int16_t f_type; /* 0 */ - int16_t f_flags; /* 2 */ - int32_t f_fsize; /* 4 */ - int32_t f_bsize; /* 8 */ - int32_t f_blocks; /* 12 */ - int32_t f_bfree; /* 16 */ - int32_t f_bavail; /* 20 */ - int32_t f_files; /* 24 */ - int32_t f_ffree; /* 28 */ - int64_t f_fsid; /* 32 */ - int32_t f_spare[9]; /* 40 (36 bytes) */ - char f_mntonname[90]; /* 76 (90 bytes) */ - char f_mntfromname[90]; /* 166 (90 bytes) */ - char f_xxx[80]; /* 256 (80 bytes) XXX */ -}; -/* Arguments to mount() for various FS types. */ -#ifdef notyet /* XXX */ -struct osf1_ufs_args { - char *fspec; - int32_t exflags; - u_int32_t exroot; -}; - -struct osf1_cdfs_args { - char *fspec; - int32_t exflags; - u_int32_t exroot; - int32_t flags; -}; -#endif - -struct osf1_mfs_args { - char *name; - caddr_t base; - u_int size; -}; - -struct osf1_nfs_args { - struct sockaddr_in *addr; - void *fh; - int32_t flags; - int32_t wsize; - int32_t rsize; - int32_t timeo; - int32_t retrans; - char *hostname; - int32_t acregmin; - int32_t acregmax; - int32_t acdirmin; - int32_t acdirmax; - char *netname; - void *pathconf; -}; - -#define OSF1_NFSMNT_SOFT 0x00001 -#define OSF1_NFSMNT_WSIZE 0x00002 -#define OSF1_NFSMNT_RSIZE 0x00004 -#define OSF1_NFSMNT_TIMEO 0x00008 -#define OSF1_NFSMNT_RETRANS 0x00010 -#define OSF1_NFSMNT_HOSTNAME 0x00020 -#define OSF1_NFSMNT_INT 0x00040 -#define OSF1_NFSMNT_NOCONN 0x00080 -#define OSF1_NFSMNT_NOAC 0x00100 /* ??? */ -#define OSF1_NFSMNT_ACREGMIN 0x00200 /* ??? */ -#define OSF1_NFSMNT_ACREGMAX 0x00400 /* ??? */ -#define OSF1_NFSMNT_ACDIRMIN 0x00800 /* ??? */ -#define OSF1_NFSMNT_ACDIRMAX 0x01000 /* ??? */ -#define OSF1_NFSMNT_NOCTO 0x02000 /* ??? */ -#define OSF1_NFSMNT_POSIX 0x04000 /* ??? */ -#define OSF1_NFSMNT_AUTO 0x08000 /* ??? */ - -#define OSF1_NFSMNT_FLAGS \ - (OSF1_NFSMNT_SOFT|OSF1_NFSMNT_WSIZE|OSF1_NFSMNT_RSIZE| \ - OSF1_NFSMNT_TIMEO|OSF1_NFSMNT_RETRANS|OSF1_NFSMNT_HOSTNAME| \ - OSF1_NFSMNT_INT|OSF1_NFSMNT_NOCONN) - -#define memset(x,y,z) bzero((x),(z)) diff --git a/sys/alpha/osf1/osf1_ioctl.c b/sys/alpha/osf1/osf1_ioctl.c deleted file mode 100644 index 09d970d..0000000 --- a/sys/alpha/osf1/osf1_ioctl.c +++ /dev/null @@ -1,377 +0,0 @@ -/* $NetBSD: osf1_ioctl.c,v 1.5 1996/10/13 00:46:53 christos Exp $ */ -/*- - * Copyright (c) 1994, 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. - */ -/* - * Additional Copyright (c) 1999 by Andrew Gallatin - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/fcntl.h> -#include <sys/filio.h> -#include <sys/ioctl_compat.h> -#include <sys/termios.h> -#include <sys/filedesc.h> -#include <sys/file.h> -#include <sys/proc.h> -#include <sys/mount.h> -#include <sys/sysproto.h> -#include <alpha/osf1/osf1_signal.h> -#include <alpha/osf1/osf1_proto.h> -#include <alpha/osf1/osf1.h> -#include <sys/socket.h> -#include <net/if.h> -#include <net/if_dl.h> -#include <net/if_types.h> -#include <sys/sockio.h> - -#include "opt_compat.h" - -/*#define IOCTL_DEBUG*/ - -int osf1_ioctl_i(struct thread *td, struct ioctl_args *nuap, - int cmd, int dir, int len); -int osf1_ioctl_t(struct thread *td, struct ioctl_args *nuap, - int cmd, int dir, int len); -int osf1_ioctl_f(struct thread *td, struct ioctl_args *nuap, - int cmd, int dir, int len); -int osf1_ioctl_m(struct thread *td, struct ioctl_args *nuap, - int cmd, int dir, int len); - -int -osf1_ioctl(td, uap) - struct thread *td; - struct osf1_ioctl_args *uap; -{ - char *dirstr; - unsigned int cmd, dir, group, len, op; - struct ioctl_args /* { - syscallarg(int) fd; - syscallarg(u_long) com; - syscallarg(caddr_t) data; - } */ a; - - op = uap->com; - dir = op & OSF1_IOC_DIRMASK; - group = OSF1_IOCGROUP(op); - cmd = OSF1_IOCCMD(op); - len = OSF1_IOCPARM_LEN(op); - - switch (dir) { - case OSF1_IOC_VOID: - dir = IOC_VOID; - dirstr = "none"; - break; - - case OSF1_IOC_OUT: - dir = IOC_OUT; - dirstr = "out"; - break; - - case OSF1_IOC_IN: - dir = IOC_IN; - dirstr = "in"; - break; - - case OSF1_IOC_INOUT: - dir = IOC_INOUT; - dirstr = "in-out"; - break; - - default: - return (EINVAL); - break; - } -#ifdef IOCTL_DEBUG - uprintf( - "OSF/1 IOCTL: group = %c, cmd = %d, len = %d, dir = %s\n", - group, cmd, len, dirstr); -#endif - - a.fd = uap->fd; - a.com = (unsigned long)uap->com; - bzero(&a.com, sizeof(long)); - a.com = _IOC(dir, group, cmd, len); - a.data = uap->data; - switch (group) { - case 'i': - return osf1_ioctl_i(td, &a, cmd, dir, len); - case 't': - return osf1_ioctl_t(td, &a, cmd, dir, len); - case 'f': - return osf1_ioctl_f(td, &a, cmd, dir, len); - case 'm': - return osf1_ioctl_m(td, &a, cmd, dir, len); - case 'S': - /* - * XXX SVR4 Streams IOCTLs are all unimpl. - */ - -#ifndef IOCTL_DEBUG - return (0); -#endif - default: - printf( - "unimplented OSF/1 IOCTL: group = %c, cmd = %d, len = %d, dir = %s\n", - group, cmd, len, dirstr); - return (ENOTTY); - } -} - -/* - * Structure used to query de and qe for physical addresses. - */ -struct osf1_ifdevea { - char ifr_name[IFNAMSIZ]; /* if name, e.g. "en0" */ - u_char default_pa[6]; /* default hardware address */ - u_char current_pa[6]; /* current physical address */ -}; - - -int -osf1_ioctl_i(td, uap, cmd, dir, len) - struct thread *td; - struct ioctl_args /* { - syscallarg(int) fd; - syscallarg(u_long) com; - syscallarg(caddr_t) data; - } */ *uap; - int cmd; - int dir; - int len; -{ - - switch (cmd) { - case 20: /* OSF/1 OSIOCGIFCONF */ - case 36: /* OSF/1 SIOCGIFCONF */ - case 12: /* OSF/1 SIOCSIFADDR */ - case 14: /* OSF/1 SIOCSIFDSTADDR */ - case 16: /* OSF/1 SIOCSIFFLAGS (XXX) */ - case 17: /* OSF/1 SIOCGIFFLAGS (XXX) */ - case 19: /* OSF/1 SIOCSIFBRDADDR */ - case 22: /* OSF/1 SIOCSIFNETMASK */ - case 23: /* OSF/1 SIOCGIFMETRIC */ - case 24: /* OSF/1 SIOCSIFMETRIC */ - case 25: /* OSF/1 SIOCDIFADDR */ - case 33: /* OSF/1 SIOCGIFADDR */ - case 34: /* OSF/1 SIOCGIFDSTADDR */ - case 35: /* OSF/1 SIOCGIFBRDADDR */ - case 37: /* OSF/1 SIOCGIFNETMASK */ - /* same as in FreeBSD */ - return ioctl(td, uap); - break; - - case 62: /* OSF/1 SIOCRPHYSADDR */ - - { - int ifn, retval; - struct ifnet *ifp; - struct ifaddr *ifa; - struct sockaddr_dl *sdl; - struct osf1_ifdevea *ifd = (struct osf1_ifdevea *)uap->data; - - /* - * Note that we don't actually respect the name in the ifreq - * structure, as DU interface names are all different. - */ - for (ifn = 0; ifn < if_index; ifn++) { - ifp = ifnet_byindex(ifn + 1); - /* Only look at ether interfaces, exclude alteon nics - * because osf/1 doesn't know about most of them. - */ - if (ifp->if_type == IFT_ETHER - && strcmp(ifp->if_dname, "ti") != 0) { /* looks good */ - /* walk the address list */ - TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) /* we have an address structure */ - && (sdl->sdl_family == AF_LINK) /* it's a link address */ - && (sdl->sdl_type == IFT_ETHER)) { /* for an ethernet link */ - retval = copyout(LLADDR(sdl), - (caddr_t)&ifd->current_pa, - 6); - if (!retval) { - return(copyout( - LLADDR(sdl), - (caddr_t)&ifd->default_pa, - 6)); - } - } - } - } - } - return(ENOENT); /* ??? */ - } - - - default: - printf("osf1_ioctl_i: cmd = %d\n", cmd); - return (ENOTTY); - } - - -} -#ifndef _SGTTYB_ -#define _SGTTYB_ -struct sgttyb { - char sg_ispeed; /* input speed */ - char sg_ospeed; /* output speed */ - char sg_erase; /* erase character */ - char sg_kill; /* kill character */ - short sg_flags; /* mode flags */ -}; -#endif - -int -osf1_ioctl_t(td, uap, cmd, dir, len) - struct thread *td; - struct ioctl_args /* { - syscallarg(int) fd; - syscallarg(u_long) com; - syscallarg(caddr_t) data; - } */ *uap; - int cmd; - int dir; - int len; -{ - int retval; - - switch (cmd) { -#ifdef COMPAT_43 - case 0: /* OSF/1 COMPAT_43 TIOCGETD */ - case 1: /* OSF/1 COMPAT_43 TIOCSETD */ - case 8: /* OSF/1 COMPAT_43 TIOCGETP */ - case 9: /* OSF/1 COMPAT_43 TIOCSETP */ - case 10: /* OSF/1 COMPAT_43 TIOCSETN */ - case 17: /* OSF/1 TIOCSETC (XXX) */ - case 18: /* OSF/1 TIOCGETC (XXX) */ - case 116: /* OSF/1 TIOCSLTC */ - case 117: /* OSF/1 TIOCGLTC */ - case 124: /* OSF/1 TIOCLGET */ - case 125: /* OSF/1 TIOCLSET */ - case 126: /* OSF/1 TIOCLBIC */ - case 127: /* OSF/1 TIOCLBIS */ -#endif - case 19: /* OSF/1 TIOCGETA (XXX) */ - case 20: /* OSF/1 TIOCSETA (XXX) */ - case 21: /* OSF/1 TIOCSETAW (XXX) */ - case 22: /* OSF/1 TIOCSETAF (XXX) */ - case 26: /* OSF/1 TIOCGETD (XXX) */ - case 27: /* OSF/1 TIOCSETD (XXX) */ - case 97: /* OSF/1 TIOCSCTTY */ - case 103: /* OSF/1 TIOCSWINSZ */ - case 104: /* OSF/1 TIOCGWINSZ */ - case 110: /* OSF/1 TIOCSTART */ - case 111: /* OSF/1 TIOCSTOP */ - case 118: /* OSF/1 TIOCGPGRP */ - case 119: /* OSF/1 TIOCGPGRP */ - /* same as in FreeBSD */ - break; - - - default: - printf("osf1_ioctl_t: cmd = %d\n", cmd); - return (ENOTTY); - } - - retval = ioctl(td, uap); -#if 0 - if (retval) - printf("osf1_ioctl_t: cmd = %d, com = 0x%lx, retval = %d\n", - cmd, uap->com,retval); -#endif - return retval; -} - -/* - * file locking ioctl's - */ - -int -osf1_ioctl_f(td, uap, cmd, dir, len) - struct thread *td; - struct ioctl_args /* { - syscallarg(int) fd; - syscallarg(int) com; - syscallarg(caddr_t) data; - } */ *uap; - int cmd; - int dir; - int len; -{ - - switch (cmd) { - case 1: /* OSF/1 FIOCLEX (XXX) */ - case 2: /* OSF/1 FIONCLEX (XXX) */ - case 127: /* OSF/1 FIONREAD (XXX) */ - case 126: /* OSF/1 FIONREAD (XXX) */ - case 125: /* OSF/1 FIOASYNC (XXX) */ - case 124: /* OSF/1 FIOSETOWN (XXX) */ - case 123: /* OSF/1 FIOGETOWN (XXX) */ - /* same as in FreeBSD */ - break; - - default: - printf("osf1_ioctl_f: cmd = %d\n", cmd); - return (ENOTTY); - } - - return ioctl(td, uap); -} - -/* - * mag tape ioctl's - */ - -int -osf1_ioctl_m(td, uap, cmd, dir, len) - struct thread *td; - struct ioctl_args /* { - syscallarg(int) fd; - syscallarg(int) com; - syscallarg(caddr_t) data; - } */ *uap; - int cmd; - int dir; - int len; -{ - - switch (cmd) { - case 1: /* OSF/1 MTIOCTOP (XXX) */ - case 2: /* OSF/1 MTIOCGET (XXX) */ - /* same as in FreeBSD */ - break; - - default: - printf("osf1_ioctl_m: cmd = %d\n", cmd); - return (ENOTTY); - } - - return ioctl(td, uap); -} diff --git a/sys/alpha/osf1/osf1_misc.c b/sys/alpha/osf1/osf1_misc.c deleted file mode 100644 index 13a5ca7..0000000 --- a/sys/alpha/osf1/osf1_misc.c +++ /dev/null @@ -1,1614 +0,0 @@ -/* $NetBSD: osf1_misc.c,v 1.14 1998/05/20 16:34:29 chs Exp $ */ -/*- - * Copyright (c) 1994, 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. - */ -/* - * Additional Copyright (c) 1999 by Andrew Gallatin - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/bus.h> -#include <sys/exec.h> -#include <sys/fcntl.h> -#include <sys/filedesc.h> -#include <sys/imgact.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/file.h> /* Must come after sys/malloc.h */ -#include <sys/mman.h> -#include <sys/module.h> -#include <sys/mount.h> -#include <sys/mutex.h> -#include <sys/namei.h> -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/reboot.h> -#include <sys/resource.h> -#include <sys/resourcevar.h> -#include <sys/selinfo.h> -#include <sys/pipe.h> /* Must come after sys/selinfo.h */ -#include <sys/signal.h> -#include <sys/signalvar.h> -#include <sys/socket.h> -#include <sys/socketvar.h> -#include <sys/stat.h> -#include <sys/syscallsubr.h> -#include <sys/sysctl.h> -#include <sys/sysent.h> -#include <sys/sysproto.h> -#include <sys/systm.h> -#include <sys/unistd.h> -#include <sys/utsname.h> -#include <sys/vnode.h> -#include <sys/wait.h> - -#include <vm/vm.h> -#include <vm/vm_kern.h> -#include <vm/vm_param.h> -#include <vm/pmap.h> -#include <vm/vm_map.h> -#include <vm/vm_extern.h> - -#include <machine/cpu.h> -#include <machine/cpuconf.h> -#include <machine/fpu.h> -#include <machine/md_var.h> -#include <machine/pcb.h> -#include <machine/rpb.h> - -#include <alpha/osf1/exec_ecoff.h> -#include <alpha/osf1/osf1_signal.h> -#include <alpha/osf1/osf1_proto.h> -#include <alpha/osf1/osf1_syscall.h> -#include <alpha/osf1/osf1_util.h> -#include <alpha/osf1/osf1.h> - -static void cvtstat2osf1(struct stat *, struct osf1_stat *); -static int osf2bsd_pathconf(int *); - -static const char osf1_emul_path[] = "/compat/osf1"; - -/* - * [ taken from the linux emulator ] - * Search an alternate path before passing pathname arguments on - * to system calls. Useful for keeping a separate 'emulation tree'. - * - * If cflag is set, we check if an attempt can be made to create - * the named file, i.e. we check if the directory it should - * be in exists. - */ -int -osf1_emul_find(struct thread *td, char *path, enum uio_seg pathseg, - char **pbuf, int create) -{ - - return (kern_alternate_path(td, osf1_emul_path, path, pathseg, pbuf, - create)); -} - - -int -osf1_open(td, uap) - struct thread *td; - struct osf1_open_args *uap; -{ - char *path; - int error; - - CHECKALTEXIST(td, uap->path, &path); - - /* XXX: translate flags */ - error = kern_open(td, path, UIO_SYSSPACE, uap->flags, uap->mode); - free(path, M_TEMP); - return (error); -} - -extern long totalphysmem; - -int -osf1_getsysinfo(td, uap) - struct thread *td; - struct osf1_getsysinfo_args *uap; -{ - int error, retval; - int ncpus = 1; /* XXX until SMP */ - int ophysmem; - int unit; - long percpu; - long proctype; - struct osf1_cpu_info cpuinfo; - - error = retval = 0; - - switch(uap->op) { - case OSF_GET_MAX_UPROCS: - error = copyout(&maxprocperuid, uap->buffer, - sizeof(maxprocperuid)); - retval = 1; - break; - case OSF_GET_PHYSMEM: - ophysmem = totalphysmem * (PAGE_SIZE >> 10); - error = copyout(&ophysmem, uap->buffer, - sizeof(ophysmem)); - retval = 1; - break; - case OSF_GET_MAX_CPU: - case OSF_GET_CPUS_IN_BOX: - error = copyout(&ncpus, uap->buffer, - sizeof(ncpus)); - retval = 1; - break; - case OSF_GET_IEEE_FP_CONTROL: - error = copyout(&td->td_pcb->pcb_fp_control,uap->buffer, - sizeof(td->td_pcb->pcb_fp_control)); - retval = 1; - break; - case OSF_GET_CPU_INFO: - - if (uap->nbytes < sizeof(cpuinfo)) - error = EINVAL; - else { - bzero(&cpuinfo, sizeof(cpuinfo)); - unit = alpha_pal_whami(); - cpuinfo.current_cpu = unit; - cpuinfo.cpus_in_box = ncpus; - cpuinfo.cpu_type = - LOCATE_PCS(hwrpb, unit)->pcs_proc_type; - cpuinfo.ncpus = ncpus; - cpuinfo.cpus_present = ncpus; - cpuinfo.cpus_running = ncpus; - cpuinfo.cpu_binding = 1; - cpuinfo.cpu_ex_binding = 0; - cpuinfo.mhz = hwrpb->rpb_cc_freq / 1000000; - error = copyout(&cpuinfo, uap->buffer, - sizeof(cpuinfo)); - retval = 1; - } - break; - case OSF_GET_PROC_TYPE: - if(uap->nbytes < sizeof(proctype)) - error = EINVAL; - else { - unit = alpha_pal_whami(); - proctype = LOCATE_PCS(hwrpb, unit)->pcs_proc_type; - error = copyout (&proctype, uap->buffer, - sizeof(percpu)); - retval = 1; - } - break; - case OSF_GET_HWRPB: { /* note -- osf/1 doesn't have rpb_tbhint[8] */ - unsigned long rpb_size; - rpb_size = (unsigned long)&hwrpb->rpb_tbhint - - (unsigned long)hwrpb; - if(uap->nbytes < rpb_size){ - uprintf("nbytes = %ld, sizeof(struct rpb) = %ld\n", - uap->nbytes, rpb_size); - error = EINVAL; - } - else { - error = copyout(hwrpb, uap->buffer, rpb_size); - retval = 1; - } - } - break; - case OSF_GET_PLATFORM_NAME: - error = copyout(platform.model, uap->buffer, - strlen(platform.model)); - retval = 1; - break; - default: - printf("osf1_getsysinfo called with unknown op=%ld\n", uap->op); - return EINVAL; - } - td->td_retval[0] = retval; - return(error); -} - - -int -osf1_setsysinfo(td, uap) - struct thread *td; - struct osf1_setsysinfo_args *uap; -{ - int error; - - error = 0; - - switch(uap->op) { - case OSF_SET_IEEE_FP_CONTROL: - { - u_int64_t temp, *fp_control; - - if ((error = copyin(uap->buffer, &temp, sizeof(temp)))) - break; - fp_control = &td->td_pcb->pcb_fp_control; - *fp_control = temp & IEEE_TRAP_ENABLE_MASK; - break; - } - default: - uprintf("osf1_setsysinfo called with op=%ld\n", uap->op); - /*error = EINVAL;*/ - } - return (error); -} - - -int -osf1_getrlimit(td, uap) - struct thread *td; - struct osf1_getrlimit_args *uap; -{ - struct rlimit bsd_rlim; - struct proc *p; - int which; - - if (uap->which >= OSF1_RLIMIT_NLIMITS) - return (EINVAL); - - if (uap->which <= OSF1_RLIMIT_LASTCOMMON) - which = uap->which; - else if (uap->which == OSF1_RLIMIT_NOFILE) - which = RLIMIT_NOFILE; - else - return (0); - - p = td->td_proc; - PROC_LOCK(p); - lim_rlimit(p, which, &bsd_rlim); - PROC_UNLOCK(p); - return (copyout(&bsd_rlim, uap->rlp, sizeof(bsd_rlim))); -} - - -int -osf1_setrlimit(td, uap) - struct thread *td; - struct osf1_setrlimit_args *uap; -{ - struct rlimit bsd_rlim; - int error, which; - - if (uap->which >= OSF1_RLIMIT_NLIMITS) - return (EINVAL); - - if (uap->which <= OSF1_RLIMIT_LASTCOMMON) - which = uap->which; - else if (uap->which == OSF1_RLIMIT_NOFILE) - which = RLIMIT_NOFILE; - else - return (0); - - error = copyin(uap->rlp, &bsd_rlim, sizeof(bsd_rlim)); - if (error) - return (error); - - return (kern_setrlimit(td, which, &bsd_rlim)); -} - - -/* - * As linux says, this is a total guess. - */ - -int -osf1_set_program_attributes(td, uap) - struct thread *td; - struct osf1_set_program_attributes_args *uap; -{ - struct vmspace *vm = td->td_proc->p_vmspace; - - vm->vm_taddr = (caddr_t)uap->text_start; - vm->vm_tsize = btoc(round_page(uap->text_len)); - vm->vm_daddr = (caddr_t)uap->bss_start; - vm->vm_dsize = btoc(round_page(uap->bss_len)); - - return(KERN_SUCCESS); -} - - -int -osf1_mmap(td, uap) - struct thread *td; - struct osf1_mmap_args *uap; -{ - struct mmap_args /* { - syscallarg(caddr_t) addr; - syscallarg(size_t) len; - syscallarg(int) prot; - syscallarg(int) flags; - syscallarg(int) fd; - syscallarg(long) pad; - syscallarg(off_t) pos; - } */ a; - int retval; - vm_map_t map; - vm_offset_t addr, len, newaddr; - - GIANT_REQUIRED; - - a.addr = uap->addr; - a.len = uap->len; - a.prot = uap->prot; - a.fd = uap->fd; - a.pad = 0; - a.pos = uap->pos; - - a.flags = 0; - - /* - * OSF/1's mmap, unlike FreeBSD's, does its best to map memory at the - * user's requested address, even if MAP_FIXED is not set. Here we - * try to replicate this behaviour as much as we can because some - * applications (like /sbin/loader) depend on having things put as - * close to where they've requested as possible. - */ - - if (uap->addr != NULL) - addr = round_page((vm_offset_t)a.addr); - else - /* - * Try to use the apparent OSF/1 default placement of 0x10000 for - * NULL addrs, this helps to prevent non-64 bit clean binaries from - * SEGV'ing. - */ - addr = round_page((vm_offset_t)0x10000UL); - len = (vm_offset_t)a.len; - map = &td->td_proc->p_vmspace->vm_map; - if (!vm_map_findspace(map, addr, len, &newaddr)) { - a.addr = (caddr_t) newaddr; - a.flags |= (MAP_FIXED); - } -#ifdef DEBUG - else - uprintf("osf1_mmap:vm_map_findspace failed for: %p 0x%lx\n", - (caddr_t)addr, len); -#endif - if (uap->flags & OSF1_MAP_SHARED) - a.flags |= MAP_SHARED; - if (uap->flags & OSF1_MAP_PRIVATE) - a.flags |= MAP_PRIVATE; - - switch (uap->flags & OSF1_MAP_TYPE) { - case OSF1_MAP_ANONYMOUS: - a.flags |= MAP_ANON; - break; - case OSF1_MAP_FILE: - a.flags |= MAP_FILE; - break; - default: - return (EINVAL); - } - if (uap->flags & OSF1_MAP_FIXED) - a.flags |= MAP_FIXED; - if (uap->flags & OSF1_MAP_HASSEMAPHORE) - a.flags |= MAP_HASSEMAPHORE; - if (uap->flags & OSF1_MAP_INHERIT) - return (EINVAL); - if (uap->flags & OSF1_MAP_UNALIGNED) - return (EINVAL); - /* - * Emulate an osf/1 bug: Apparently, mmap'ed segments are always - * readable even if the user doesn't or in PROT_READ. This causes - * some buggy programs to segv. - */ - a.prot |= PROT_READ; - - - retval = mmap(td, &a); -#ifdef DEBUG - uprintf( - "\nosf1_mmap: addr=%p (%p), len = 0x%lx, prot=0x%x, fd=%d, pad=0, pos=0x%lx", - uap->addr, a.addr,uap->len, uap->prot, - uap->fd, uap->pos); - printf(" flags = 0x%x\n",uap->flags); -#endif - return (retval); -} - -int -osf1_msync(td, uap) - struct thread *td; - struct osf1_msync_args *uap; -{ - struct msync_args a; - - a.addr = uap->addr; - a.len = uap->len; - a.flags = 0; - if(uap->flags & OSF1_MS_ASYNC) - a.flags |= MS_ASYNC; - if(uap->flags & OSF1_MS_SYNC) - a.flags |= MS_SYNC; - if(uap->flags & OSF1_MS_INVALIDATE) - a.flags |= MS_INVALIDATE; - return(msync(td, &a)); -} - -struct osf1_stat { - int32_t st_dev; - u_int32_t st_ino; - u_int32_t st_mode; - u_int16_t st_nlink; - u_int32_t st_uid; - u_int32_t st_gid; - int32_t st_rdev; - u_int64_t st_size; - int32_t st_atime_sec; - int32_t st_spare1; - int32_t st_mtime_sec; - int32_t st_spare2; - int32_t st_ctime_sec; - int32_t st_spare3; - u_int32_t st_blksize; - int32_t st_blocks; - u_int32_t st_flags; - u_int32_t st_gen; -}; - -/* - * Get file status; this version follows links. - */ -/* ARGSUSED */ -int -osf1_stat(td, uap) - struct thread *td; - struct osf1_stat_args *uap; -{ - struct stat sb; - struct osf1_stat osb; - char *path; - int error; - - CHECKALTEXIST(td, uap->path, &path); - - error = kern_stat(td, path, UIO_SYSSPACE, &sb); - free(path, M_TEMP); - if (error) - return (error); - cvtstat2osf1(&sb, &osb); - error = copyout((caddr_t)&osb, (caddr_t)uap->ub, sizeof (osb)); - return (error); -} - - -/* - * Get file status; this version does not follow links. - */ -/* ARGSUSED */ -int -osf1_lstat(td, uap) - struct thread *td; - register struct osf1_lstat_args *uap; -{ - struct stat sb; - struct osf1_stat osb; - char *path; - int error; - - CHECKALTEXIST(td, uap->path, &path); - - error = kern_lstat(td, path, UIO_SYSSPACE, &sb); - free(path, M_TEMP); - if (error) - return (error); - cvtstat2osf1(&sb, &osb); - error = copyout((caddr_t)&osb, (caddr_t)uap->ub, sizeof (osb)); - return (error); -} - - -/* - * Return status information about a file descriptor. - */ -int -osf1_fstat(td, uap) - struct thread *td; - register struct osf1_fstat_args *uap; -{ - struct osf1_stat oub; - struct stat ub; - int error; - - error = kern_fstat(td, uap->fd, &ub); - if (error) - return (error); - cvtstat2osf1(&ub, &oub); - if (error == 0) - error = copyout((caddr_t)&oub, (caddr_t)uap->sb, - sizeof (oub)); - return (error); -} - - -#define bsd2osf_dev(dev) (umajor(dev) << 20 | uminor(dev)) -/* - * Convert from a stat structure to an osf1 stat structure. - */ -static void -cvtstat2osf1(st, ost) - struct stat *st; - struct osf1_stat *ost; -{ - - ost->st_dev = bsd2osf_dev(st->st_dev); - ost->st_ino = st->st_ino; - ost->st_mode = st->st_mode; - ost->st_nlink = st->st_nlink; - ost->st_uid = st->st_uid == -2 ? (u_int16_t) -2 : st->st_uid; - ost->st_gid = st->st_gid == -2 ? (u_int16_t) -2 : st->st_gid; - ost->st_rdev = bsd2osf_dev(st->st_rdev); - ost->st_size = st->st_size; - ost->st_atime_sec = st->st_atime; - ost->st_spare1 = 0; - ost->st_mtime_sec = st->st_mtime; - ost->st_spare2 = 0; - ost->st_ctime_sec = st->st_ctime; - ost->st_spare3 = 0; - ost->st_blksize = st->st_blksize; - ost->st_blocks = st->st_blocks; - ost->st_flags = st->st_flags; - ost->st_gen = st->st_gen; -} - - -int -osf1_mknod(td, uap) - struct thread *td; - struct osf1_mknod_args *uap; -{ - - printf("osf1_mknod no longer implemented\n"); - return ENOSYS; -} - - -int -osf1_access(td, uap) - struct thread *td; - struct osf1_access_args *uap; -{ - char *path; - int error; - - CHECKALTEXIST(td, uap->path, &path); - error = kern_access(td, path, UIO_SYSSPACE, uap->flags); - free(path, M_TEMP); - return (error); -} - - -struct osf1_flock { - short l_type; - short l_whence; - off_t l_start; - off_t l_len; - pid_t l_pid; - }; - -int -osf1_fcntl(td, uap) - struct thread *td; - struct osf1_fcntl_args *uap; -{ - int error; - long tmp; - struct osf1_flock osf_flock; - struct flock bsd_flock; - - error = 0; - - switch (uap->cmd) { - - case F_SETFL: - /* need to translate flags here */ - tmp = 0; - if ((long)uap->arg & OSF1_FNONBLOCK) - tmp |= FNONBLOCK; - if ((long)uap->arg & OSF1_FAPPEND) - tmp |= FAPPEND; - if ((long)uap->arg & OSF1_FDEFER) - tmp |= FDEFER; - if ((long)uap->arg & OSF1_FASYNC) - tmp |= FASYNC; - if ((long)uap->arg & OSF1_FCREAT) - tmp |= O_CREAT; - if ((long)uap->arg & OSF1_FTRUNC) - tmp |= O_TRUNC; - if ((long)uap->arg & OSF1_FEXCL) - tmp |= O_EXCL; - if ((long)uap->arg & OSF1_FNDELAY) - tmp |= FNDELAY; - if ((long)uap->arg & OSF1_FSYNC) - tmp |= FFSYNC; - error = kern_fcntl(td, uap->fd, F_SETFL, tmp); - break; - - case F_SETLK: - case F_SETLKW: - case F_GETLK: - /* - * The OSF/1 flock stucture has a different order than - * the BSD one, but all else is the same. We must - * reorder the one we've gotten so that flock() groks it. - */ - error = copyin(uap->arg, &osf_flock, sizeof(osf_flock)); - if (error) - return (error); - bsd_flock.l_type = osf_flock.l_type; - bsd_flock.l_whence = osf_flock.l_whence; - bsd_flock.l_start = osf_flock.l_start; - bsd_flock.l_len = osf_flock.l_len; - bsd_flock.l_pid = osf_flock.l_pid; - error = kern_fcntl(td, uap->fd, uap->cmd, (intptr_t)&bsd_flock); -/* if (error) { - printf("fcntl called with cmd=%d, args=0x%lx\n returns %d\n",uap->cmd,(long)uap->arg,error); - printf("bsd_flock.l_type = 0x%x\n", bsd_flock.l_type); - printf("bsd_flock.l_whence = 0x%x\n", bsd_flock.l_whence); - printf("bsd_flock.l_start = 0x%lx\n", bsd_flock.l_start); - printf("bsd_flock.l_len = 0x%lx\n", bsd_flock.l_len); - printf("bsd_flock.l_pid = 0x%x\n", bsd_flock.l_pid); - } -*/ - if ((uap->cmd == F_GETLK) && !error) { - /* - * XXX: Why are we hardcoding F_UNLCK here instead of - * copying the structure members from bsd_flock? - */ - osf_flock.l_type = F_UNLCK; - error = copyout(&osf_flock, uap->arg, - sizeof(osf_flock)); - } - break; - default: - error = kern_fcntl(td, uap->fd, uap->cmd, (intptr_t)uap->arg); - - if ((uap->cmd == OSF1_F_GETFL) && !error ) { - tmp = td->td_retval[0] & O_ACCMODE; - if (td->td_retval[0] & FNONBLOCK) - tmp |= OSF1_FNONBLOCK; - if (td->td_retval[0] & FAPPEND) - tmp |= OSF1_FAPPEND; - if (td->td_retval[0] & FDEFER) - tmp |= OSF1_FDEFER; - if (td->td_retval[0] & FASYNC) - tmp |= OSF1_FASYNC; - if (td->td_retval[0] & O_CREAT) - tmp |= OSF1_FCREAT; - if (td->td_retval[0] & O_TRUNC) - tmp |= OSF1_FTRUNC; - if (td->td_retval[0] & O_EXCL) - tmp |= OSF1_FEXCL; - if (td->td_retval[0] & FNDELAY) - tmp |= OSF1_FNDELAY; - if (td->td_retval[0] & FFSYNC) - tmp |= OSF1_FSYNC; - td->td_retval[0] = tmp; - } - } - - return (error); -} - - -#if 0 -int -osf1_fcntl(td, uap) - struct thread *td; - struct osf1_fcntl_args *uap; -{ - struct fcntl_args a; - long tmp; - int error; - - a.fd = uap->fd; - - switch (uap->cmd) { - - case OSF1_F_DUPFD: - a.cmd = F_DUPFD; - a.arg = (long)uap->arg; - break; - - case OSF1_F_GETFD: - a.cmd = F_GETFD; - a.arg = (long)uap->arg; - break; - - case OSF1_F_SETFD: - a.cmd = F_SETFD; - a.arg = (long)uap->arg; - break; - - case OSF1_F_GETFL: - a.cmd = F_GETFL; - a.arg = (long)uap->arg; /* ignored */ - break; - - case OSF1_F_SETFL: - a.cmd = F_SETFL; - tmp = 0; - if ((long)uap->arg & OSF1_FAPPEND) - tmp |= FAPPEND; - if ((long)uap->arg & OSF1_FNONBLOCK) - tmp |= FNONBLOCK; - if ((long)uap->arg & OSF1_FASYNC) - tmp |= FASYNC; - if ((long)uap->arg & OSF1_FSYNC) - tmp |= FFSYNC; - a.arg = tmp; - break; - - default: /* XXX other cases */ - return (EINVAL); - } - - error = fcntl(td, &a); - - if (error) - return error; - - switch (uap->cmd) { - case OSF1_F_GETFL: - /* XXX */ - break; - } - - return error; -} -#endif - -int -osf1_socket(td, uap) - struct thread *td; - struct osf1_socket_args *uap; -{ - struct socket_args a; - - if (uap->type > AF_LINK) - return (EINVAL); /* XXX After AF_LINK, divergence. */ - - a.domain = uap->domain; - a.type = uap->type; - a.protocol = uap->protocol; - - return socket(td, &a); -} - - -int -osf1_sendto(td, uap) - struct thread *td; - register struct osf1_sendto_args *uap; -{ - struct sendto_args a; - - if (uap->flags & ~0x7f) /* unsupported flags */ - return (EINVAL); - - a.s = uap->s; - a.buf = uap->buf; - a.len = uap->len; - a.flags = uap->flags; - a.to = (caddr_t)uap->to; - a.tolen = uap->tolen; - - return sendto(td, &a); -} - - -int -osf1_reboot(td, uap) - struct thread *td; - struct osf1_reboot_args *uap; -{ - struct reboot_args a; - - if (uap->opt & ~OSF1_RB_ALLFLAGS && - uap->opt & (OSF1_RB_ALTBOOT|OSF1_RB_UNIPROC)) - return (EINVAL); - - a.opt = 0; - - if (uap->opt & OSF1_RB_ASKNAME) - a.opt |= RB_ASKNAME; - if (uap->opt & OSF1_RB_SINGLE) - a.opt |= RB_SINGLE; - if (uap->opt & OSF1_RB_NOSYNC) - a.opt |= RB_NOSYNC; - if (uap->opt & OSF1_RB_HALT) - a.opt |= RB_HALT; - if (uap->opt & OSF1_RB_INITNAME) - a.opt |= RB_INITNAME; - if (uap->opt & OSF1_RB_DFLTROOT) - a.opt |= RB_DFLTROOT; - - return reboot(td, &a); -} - - -int -osf1_lseek(td, uap) - struct thread *td; - struct osf1_lseek_args *uap; -{ - struct lseek_args a; - - a.fd = uap->fd; - a.pad = 0; - a.offset = uap->offset; - a.whence = uap->whence; - - return lseek(td, &a); -} - - -/* - * OSF/1 defines _POSIX_SAVED_IDS, which means that our normal - * setuid() won't work. - * - * Instead, by P1003.1b-1993, setuid() is supposed to work like: - * If the process has appropriate [super-user] privileges, the - * setuid() function sets the real user ID, effective user - * ID, and the saved set-user-ID to uid. - * If the process does not have appropriate privileges, but uid - * is equal to the real user ID or the saved set-user-ID, the - * setuid() function sets the effective user ID to uid; the - * real user ID and saved set-user-ID remain unchanged by - * this function call. - */ -int -osf1_setuid(td, uap) - struct thread *td; - struct osf1_setuid_args *uap; -{ - struct proc *p; - int error; - uid_t uid; - struct uidinfo *uip; - struct ucred *newcred, *oldcred; - - p = td->td_proc; - uid = uap->uid; - newcred = crget(); - uip = uifind(uid); - PROC_LOCK(p); - oldcred = p->p_ucred; - - if ((error = suser_cred(p->p_ucred, SUSER_ALLOWJAIL)) != 0 && - uid != oldcred->cr_ruid && uid != oldcred->cr_svuid) { - PROC_UNLOCK(p); - uifree(uip); - crfree(newcred); - return (error); - } - - crcopy(newcred, oldcred); - if (error == 0) { - if (uid != oldcred->cr_ruid) { - change_ruid(newcred, uip); - setsugid(p); - } - if (oldcred->cr_svuid != uid) { - change_svuid(newcred, uid); - setsugid(p); - } - } - if (newcred->cr_uid != uid) { - change_euid(newcred, uip); - setsugid(p); - } - p->p_ucred = newcred; - PROC_UNLOCK(p); - uifree(uip); - crfree(oldcred); - return (0); -} - - -/* - * OSF/1 defines _POSIX_SAVED_IDS, which means that our normal - * setgid() won't work. - * - * If you change "uid" to "gid" in the discussion, above, about - * setuid(), you'll get a correct description of setgid(). - */ -int -osf1_setgid(td, uap) - struct thread *td; - struct osf1_setgid_args *uap; -{ - struct proc *p; - int error; - gid_t gid; - struct ucred *newcred, *oldcred; - - p = td->td_proc; - gid = uap->gid; - newcred = crget(); - PROC_LOCK(p); - oldcred = p->p_ucred; - - if (((error = suser_cred(p->p_ucred, SUSER_ALLOWJAIL)) != 0 ) && - gid != oldcred->cr_rgid && gid != oldcred->cr_svgid) { - PROC_UNLOCK(p); - crfree(newcred); - return (error); - } - - crcopy(newcred, oldcred); - if (error == 0) { - if (gid != oldcred->cr_rgid) { - change_rgid(newcred, gid); - setsugid(p); - } - if (oldcred->cr_svgid != gid) { - change_svgid(newcred, gid); - setsugid(p); - } - } - if (newcred->cr_groups[0] != gid) { - change_egid(newcred, gid); - setsugid(p); - } - p->p_ucred = newcred; - PROC_UNLOCK(p); - crfree(oldcred); - return (0); -} - - -/* - * The structures end up being the same... but we can't be sure that - * the other word of our iov_len is zero! - */ -struct osf1_iovec { - char *iov_base; - int iov_len; -}; - -static int -osf1_copyinuio(struct osf1_iovec *iovp, u_int iovcnt, struct uio **uiop) -{ - struct osf1_iovec oiov; - struct iovec *iov; - struct uio *uio; - u_int iovlen; - int error, i; - - *uiop = NULL; - if (iovcnt > UIO_MAXIOV) - return (EINVAL); - iovlen = iovcnt * sizeof(struct iovec); - uio = malloc(iovlen + sizeof *uio, M_IOV, M_WAITOK); - iov = (struct iovec *)(uio + 1); - for (i = 0; i < iovcnt; i++) { - error = copyin(&iovp[i], &oiov, sizeof(struct osf1_iovec)); - if (error) { - free(uio, M_IOV); - return (error); - } - iov[i].iov_base = oiov.iov_base; - iov[i].iov_len = oiov.iov_len; - } - uio->uio_iov = iov; - uio->uio_iovcnt = iovcnt; - uio->uio_segflg = UIO_USERSPACE; - uio->uio_offset = -1; - uio->uio_resid = 0; - for (i = 0; i < iovcnt; i++) { - if (iov->iov_len > INT_MAX - uio->uio_resid) { - free(uio, M_IOV); - return (EINVAL); - } - uio->uio_resid += iov->iov_len; - iov++; - } - *uiop = uio; - return (0); -} - -int -osf1_readv(td, uap) - struct thread *td; - struct osf1_readv_args *uap; -{ - struct uio *auio; - int error; - - error = osf1_copyinuio(uap->iovp, uap->iovcnt, &auio); - if (error) - return (error); - error = kern_readv(td, uap->fd, auio); - free(auio, M_IOV); - return (error); -} - - -int -osf1_writev(td, uap) - struct thread *td; - struct osf1_writev_args *uap; -{ - struct uio *auio; - int error; - - error = osf1_copyinuio(uap->iovp, uap->iovcnt, &auio); - if (error) - return (error); - error = kern_writev(td, uap->fd, auio); - free(auio, M_IOV); - return (error); -} - - -/* - * More of the stupid off_t padding! - */ -int -osf1_truncate(td, uap) - struct thread *td; - struct osf1_truncate_args *uap; -{ - char *path; - int error; - - CHECKALTEXIST(td, uap->path, &path); - error = kern_truncate(td, path, UIO_SYSSPACE, uap->length); - free(path, M_TEMP); - return (error); -} - - -int -osf1_ftruncate(td, uap) - struct thread *td; - struct osf1_ftruncate_args *uap; -{ - struct ftruncate_args a; - - a.fd = uap->fd; - a.pad = 0; - a.length = uap->length; - - return ftruncate(td, &a); -} - - -static int -osf2bsd_pathconf(name) - int *name; -{ - - switch (*name) { - case _OSF1_PC_LINK_MAX: - case _OSF1_PC_MAX_CANON: - case _OSF1_PC_MAX_INPUT: - case _OSF1_PC_NAME_MAX: - *name -= 10; - break; - - case _OSF1_PC_PATH_MAX: - case _OSF1_PC_PIPE_BUF: - *name -= 9; - - case _OSF1_PC_NO_TRUNC: - *name = _PC_NO_TRUNC; - break; - - case _OSF1_PC_CHOWN_RESTRICTED: - *name = _PC_CHOWN_RESTRICTED; - break; - - case _OSF1_PC_VDISABLE: - *name = _PC_VDISABLE; - break; - - default: - return (EINVAL); - } - return 0; -} - - -int -osf1_pathconf(td, uap) - struct thread *td; - struct osf1_pathconf_args *uap; -{ - char *path; - int error; - - if (osf2bsd_pathconf(&uap->name)) - return (EINVAL); - CHECKALTEXIST(td, uap->path, &path); - error = kern_pathconf(td, path, UIO_SYSSPACE, uap->name); - free(path, M_TEMP); - return (error); -} - - -int -osf1_fpathconf(td, uap) - struct thread *td; - struct osf1_fpathconf_args *uap; -{ - - if (osf2bsd_pathconf(&uap->name)) - return (EINVAL); - else - return (fpathconf(td, (void *)uap)); -} - - -int -osf1_getrusage(td, uap) - struct thread *td; - struct osf1_getrusage_args *uap; -{ - struct osf1_rusage oru; - struct rusage ru; - int error; - - error = kern_getrusage(td, uap->who, &ru); - if (error) - return (error); - TV_CP(ru.ru_utime, oru.ru_utime); - TV_CP(ru.ru_stime, oru.ru_stime); - bcopy(&(ru.ru_first), &(oru.ru_first), - (&(oru.ru_last) - &(oru.ru_first))); - - return (copyout((caddr_t)&oru, (caddr_t)uap->rusage, - sizeof (struct osf1_rusage))); -} - - -int -osf1_wait4(td, uap) - struct thread *td; - struct osf1_wait4_args *uap; -{ - int error, status; - struct osf1_rusage oru; - struct rusage ru, *rup; - - if (uap->rusage != NULL) - rup = &ru; - else - rup = NULL; - error = kern_wait(td, uap->pid, &status, uap->options, rup); - if (error) - return (error); - if (uap->status != NULL) - error = copyout(&status, uap->status, sizeof(status)); - if (uap->rusage != NULL && error == 0) { - TV_CP(ru.ru_utime, oru.ru_utime); - TV_CP(ru.ru_stime, oru.ru_stime); - bcopy(&ru.ru_first, &oru.ru_first, - (&(oru.ru_last) - &(oru.ru_first))); - error = copyout(&oru, uap->rusage, sizeof (struct osf1_rusage)); - } - return (error); -} - - -int -osf1_madvise(td, uap) - struct thread *td; - struct osf1_madvise_args *uap; -{ - - /* XXX */ - return EINVAL; -} - - -int -osf1_execve(td, uap) - struct thread *td; - struct osf1_execve_args *uap; -{ - struct image_args eargs; - char *path; - int error; - - CHECKALTEXIST(td, uap->path, &path); - - error = exec_copyin_args(&eargs, path, UIO_SYSSPACE, uap->argp, - uap->envp); - free(path, M_TEMP); - if (error == 0) - error = kern_execve(td, &eargs, NULL); - return (error); -} - - -int -osf1_usleep_thread(td, uap) - struct thread *td; - struct osf1_usleep_thread_args *uap; -{ - int error, timo; - struct osf1_timeval time; - struct timeval difftv, endtv, sleeptv, tv; - - if ((error = copyin(uap->sleep, &time, sizeof time))) - return (error); - - sleeptv.tv_sec = (u_long)time.tv_sec; - sleeptv.tv_usec = (u_long)time.tv_usec; - timo = tvtohz(&sleeptv); - - /* - * Some callers use usleep(0) as a sort of thread-yield so make - * sure that the timeout is non-zero. - */ - - if (timo == 0) - timo = 1; - microtime(&tv); - - tsleep(td, PUSER|PCATCH, "OSF/1", timo); - - if (uap->slept != NULL) { - microtime(&endtv); - timersub(&endtv, &tv, &difftv); - if (difftv.tv_sec < 0 || difftv.tv_usec < 0) - difftv.tv_sec = difftv.tv_usec = 0; - TV_CP(difftv, time) - error = copyout(&time, uap->slept, sizeof time); - } - return (error); -} - - -int -osf1_gettimeofday(td, uap) - struct thread *td; - register struct osf1_gettimeofday_args *uap; -{ - int error; - struct timeval atv; - struct timezone tz; - struct osf1_timeval otv; - - error = 0; - - if (uap->tp) { - microtime(&atv); - otv.tv_sec = atv.tv_sec; - otv.tv_usec = atv.tv_usec; - if ((error = copyout((caddr_t)&otv, (caddr_t)uap->tp, - sizeof (otv)))) - return (error); - } - if (uap->tzp) { - tz.tz_minuteswest = tz_minuteswest; - tz.tz_dsttime = tz_dsttime; - error = copyout((caddr_t)&tz, (caddr_t)uap->tzp, sizeof (tz)); - } - return (error); -} - - -int -osf1_select(td, uap) - struct thread *td; - register struct osf1_select_args *uap; -{ - struct osf1_timeval otv; - struct timeval tv, *tvp; - int error; - - if (uap->tv != NULL) { - error = copyin(uap->tv, &otv, sizeof(otv)); - if (error) - return (error); - TV_CP(otv, tv); - tvp = &tv; - } else - tvp = NULL; - return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp)); -} - - -int -osf1_setitimer(td, uap) - struct thread *td; - struct osf1_setitimer_args *uap; -{ - struct itimerval itv, oitv; - struct osf1_itimerval otv; - int error; - - error = copyin(uap->itv, &otv, sizeof(otv)); - if (error) { - printf("%s(%d): error = %d\n", __FILE__, __LINE__, error); - return (error); - } - TV_CP(otv.it_interval, itv.it_interval); - TV_CP(otv.it_value, itv.it_value); - error = kern_setitimer(td, uap->which, &itv, &oitv); - if (error || uap->oitv == NULL) - return (error); - - TV_CP(oitv.it_interval, otv.it_interval); - TV_CP(oitv.it_value, otv.it_value); - error = copyout(&otv, uap->oitv, sizeof(otv)); - if (error) - printf("%s(%d): error = %d\n", __FILE__, __LINE__, error); - return (error); -} - - -int -osf1_getitimer(td, uap) - struct thread *td; - struct osf1_getitimer_args *uap; -{ - struct itimerval itv; - struct osf1_itimerval otv; - int error; - - error = kern_getitimer(td, uap->which, &itv); - if (error) - return (error); - TV_CP(itv.it_interval, otv.it_interval); - TV_CP(itv.it_value, otv.it_value); - error = copyout(&otv, uap->itv, sizeof(otv)); - if (error) - printf("%s(%d): error = %d\n", __FILE__, __LINE__, error); - return (error); -} - - -int -osf1_proplist_syscall(td, uap) - struct thread *td; - struct osf1_proplist_syscall_args *uap; -{ - - return(EOPNOTSUPP); -} - - -int -osf1_ntpgettime(td, uap) - struct thread *td; - struct osf1_ntpgettime_args *uap; -{ - - return(ENOSYS); -} - - -int -osf1_ntpadjtime(td, uap) - struct thread *td; - struct osf1_ntpadjtime_args *uap; -{ - - return(ENOSYS); -} - - -int -osf1_setpgrp(td, uap) - struct thread *td; - struct osf1_setpgrp_args *uap; -{ - - return(setpgid(td, (struct setpgid_args *)uap)); -} - - -int -osf1_uswitch(td, uap) - struct thread *td; - struct osf1_uswitch_args *uap; -{ - struct proc *p; - int rv; - vm_map_entry_t entry; - vm_offset_t zero; - - GIANT_REQUIRED; - p = td->td_proc; - zero = 0; - - if (uap->cmd == OSF1_USC_GET) { - if (vm_map_lookup_entry(&(p->p_vmspace->vm_map), 0, &entry)) - td->td_retval[0] = OSF1_USW_NULLP; - else - td->td_retval[0] = 0; - return(KERN_SUCCESS); - } else if (uap->cmd == OSF1_USC_SET) - if (uap->mask & OSF1_USW_NULLP) { - rv = vm_mmap(&(p->p_vmspace->vm_map), &zero, PAGE_SIZE, - VM_PROT_READ, VM_PROT_ALL, - MAP_PRIVATE | MAP_FIXED | MAP_ANON, OBJT_DEFAULT, - NULL, 0); - if (!rv) - return(KERN_SUCCESS); - else { - printf( - "osf1_uswitch:vm_mmap of zero page failed with status %d\n", - rv); - return(rv); - } - } - return(EINVAL); -} - - -int -osf1_classcntl(td, uap) - struct thread *td; - struct osf1_classcntl_args *uap; -{ - - return(EACCES); /* class scheduling not enabled */ -} - - -struct osf1_tbl_loadavg -{ - union { - long l[3]; - double d[3]; - } tl_avenrun; - int tl_lscale; - long tl_mach_factor[3]; /* ???? */ -}; - -struct osf1_tbl_sysinfo { - long si_user; - long si_nice; - long si_sys; - long si_idle; - long si_hz; - long si_phz; - long si_boottime; - long wait; -}; - -#define TBL_LOADAVG 3 -#define TBL_SYSINFO 12 - -int -osf1_table(td, uap) - struct thread *td; - struct osf1_table_args /*{ - long id; - long index; - void *addr; - long nel; - u_long lel; - }*/ *uap; -{ - int retval; - struct osf1_tbl_loadavg ld; - struct osf1_tbl_sysinfo si; - - retval = 0; - - switch(uap->id) { - case TBL_LOADAVG: /* xemacs wants this */ - if ((uap->index != 0) || (uap->nel != 1)) - retval = EINVAL; - bcopy(&averunnable, &ld, sizeof(averunnable)); - ld.tl_lscale = (u_int)averunnable.fscale; - retval = copyout(&ld, uap->addr, sizeof(ld)); - break; - case TBL_SYSINFO: - if ((uap->index != 0) || (uap->nel != 1)) - retval = EINVAL; - bzero(&si, sizeof(si)); -#if 0 - si.si_user = cp_time[CP_USER]; - si.si_nice = cp_time[CP_NICE]; - si.si_sys = cp_time[CP_SYS]; - si.si_idle = cp_time[CP_IDLE]; - si.wait = cp_time[CP_INTR]; -#endif - si.si_hz = hz; - si.si_phz = profhz; - si.si_boottime = boottime.tv_sec; - retval = copyout(&si, uap->addr, sizeof(si)); - break; - default: - printf("osf1_table: %ld, %ld, %p, %ld %ld\n", - uap->id, uap->index, uap->addr, uap->nel, uap->lel); - retval = EINVAL; - } - return retval; -} - - -/* - * MPSAFE - */ -int -osf1_sysinfo(td, uap) - struct thread *td; - struct osf1_sysinfo_args /*{ - int cmd; - char *buf; - long count; - }*/ *uap; -{ - int name[2], retval; - size_t bytes, len; - char *string; - - string = NULL; - - switch(uap->cmd) { - case 1: /* OS */ - string = "OSF1"; - break; - case 2: /* hostname, from ogethostname */ - len = uap->count; - name[0] = CTL_KERN; - name[1] = KERN_HOSTNAME; - mtx_lock(&Giant); - retval = userland_sysctl(td, name, 2, uap->buf, &len, - 1, 0, 0, &bytes, 0); - mtx_unlock(&Giant); - td->td_retval[0] = bytes; - return(retval); - break; - case 3: /* release of osf1 */ - string = "V4.0"; - break; - case 4: /* minor version of osf1 */ - string = "878"; - break; - case 5: /* machine or arch */ - case 6: - string = "alpha"; - break; - case 7: /* serial number, real osf1 returns 0! */ - string = "0"; - break; - case 8: /* HW vendor */ - string = "Digital"; - break; - case 9: /* dunno, this is what du does.. */ - return(ENOSYS); - break; - default: - return(EINVAL); - } - bytes = min(uap->count, strlen(string)+1); - copyout(string, uap->buf, bytes); - td->td_retval[0] = bytes; - return(0); -} diff --git a/sys/alpha/osf1/osf1_mount.c b/sys/alpha/osf1/osf1_mount.c deleted file mode 100644 index d0ef281..0000000 --- a/sys/alpha/osf1/osf1_mount.c +++ /dev/null @@ -1,361 +0,0 @@ -/* $NetBSD: osf1_mount.c,v 1.7 1998/05/20 16:34:29 chs Exp $ */ -/*- - * Copyright (c) 1994, 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. - */ -/* - * Additional Copyright (c) 1999 by Andrew Gallatin - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_mac.h" -#include "opt_nfs.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sysproto.h> -#include <sys/kernel.h> -#include <sys/sysctl.h> -#include <sys/file.h> -#include <sys/filedesc.h> -#include <sys/vnode.h> -#include <sys/mac.h> -#include <sys/malloc.h> -#include <sys/mount.h> -#include <sys/proc.h> -#include <sys/mbuf.h> -#include <sys/socket.h> -#include <sys/socketvar.h> -#include <sys/domain.h> -#include <sys/protosw.h> -#include <sys/syscallsubr.h> -#include <sys/namei.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <nfs/xdr_subs.h> -#include <nfs/rpcv2.h> -#include <nfs/nfsproto.h> -#include <rpc/rpcclnt.h> -#include <nfsclient/nfs.h> -#include <nfsclient/nfsmount.h> -#include <nfsclient/nfsargs.h> - -#include <sys/sysent.h> -#include <alpha/osf1/osf1_signal.h> -#include <alpha/osf1/osf1_proto.h> -#include <alpha/osf1/osf1_syscall.h> -#include <alpha/osf1/osf1_util.h> -#include <alpha/osf1/osf1.h> - - -void bsd2osf_statfs(struct statfs *, struct osf1_statfs *); -int osf1_mount_mfs(struct thread *, struct osf1_mount_args *, - struct mount_args *); -int osf1_mount_nfs(struct thread *, struct osf1_mount_args *, - struct mount_args *); - -#ifdef notanymore -static const char *fsnames[OSF1_MOUNT_MAXTYPE+2] = INITMOUNTNAMES; -#endif - -void -bsd2osf_statfs(bsfs, osfs) - struct statfs *bsfs; - struct osf1_statfs *osfs; -{ - -#ifdef notanymore -bzero(osfs, sizeof (struct osf1_statfs)); - if (!strncmp(fsnames[MOUNT_UFS], bsfs->f_fstypename, MFSNAMELEN)) - osfs->f_type = OSF1_MOUNT_UFS; - else if (!strncmp(fsnames[MOUNT_NFS], bsfs->f_fstypename, MFSNAMELEN)) - osfs->f_type = OSF1_MOUNT_NFS; - else if (!strncmp(fsnames[MOUNT_MFS], bsfs->f_fstypename, MFSNAMELEN)) - osfs->f_type = OSF1_MOUNT_MFS; - else - /* uh oh... XXX = PC, CDFS, PROCFS, etc. */ - osfs->f_type = OSF1_MOUNT_ADDON; - osfs->f_flags = bsfs->f_flags; /* XXX translate */ - osfs->f_fsize = bsfs->f_bsize; - osfs->f_bsize = bsfs->f_iosize; - osfs->f_blocks = bsfs->f_blocks; - osfs->f_bfree = bsfs->f_bfree; - osfs->f_bavail = bsfs->f_bavail; - osfs->f_files = bsfs->f_files; - osfs->f_ffree = bsfs->f_ffree; - bcopy(&bsfs->f_fsid, &osfs->f_fsid, - max(sizeof bsfs->f_fsid, sizeof osfs->f_fsid)); - /* osfs->f_spare zeroed above */ - bcopy(bsfs->f_mntonname, osfs->f_mntonname, - max(sizeof bsfs->f_mntonname, sizeof osfs->f_mntonname)); - bcopy(bsfs->f_mntfromname, osfs->f_mntfromname, - max(sizeof bsfs->f_mntfromname, sizeof osfs->f_mntfromname)); - /* XXX osfs->f_xxx should be filled in... */ -#endif -} - -int -osf1_statfs(td, uap) - struct thread *td; - struct osf1_statfs_args *uap; -{ - struct osf1_statfs osfs; - struct statfs sf; - int error; - - error = kern_statfs(td, uap->path, UIO_USERSPACE, &sf); - if (error) - return (error); - bsd2osf_statfs(&sf, &osfs); - return (copyout(&osfs, uap->buf, min(sizeof osfs, uap->len))); -} - -int -osf1_fstatfs(td, uap) - struct thread *td; - struct osf1_fstatfs_args *uap; -{ - struct osf1_statfs osfs; - struct statfs sf; - int error; - - error = kern_fstatfs(td, uap->fd, &sf); - if (error) - return (error); - bsd2osf_statfs(&sf, &osfs); - return (copyout(&osfs, uap->buf, min(sizeof osfs, uap->len))); -} - -int -osf1_getfsstat(td, uap) - struct thread *td; - register struct osf1_getfsstat_args *uap; -{ - struct statfs *buf, *sp; - struct osf1_statfs osfs; - size_t count, size; - int error, flags; - - if (uap->flags & ~OSF1_GETFSSTAT_FLAGS) - return (EINVAL); - flags = 0; - if (uap->flags & OSF1_MNT_WAIT) - flags |= MNT_WAIT; - if (uap->flags & OSF1_MNT_NOWAIT) - flags |= MNT_NOWAIT; - - count = uap->bufsize / sizeof(struct osf1_statfs); - size = count * sizeof(struct statfs); - error = kern_getfsstat(td, &buf, size, UIO_SYSSPACE, flags); - if (size > 0) { - count = td->td_retval[0]; - sp = buf; - while (count > 0 && error == 0) { - bsd2osf_statfs(sp, &osfs); - error = copyout(&osfs, uap->buf, sizeof(osfs)); - sp++; - uap->buf++; - count--; - } - free(buf, M_TEMP); - } - return (error); -} - -int -osf1_unmount(td, uap) - struct thread *td; - struct osf1_unmount_args *uap; -{ - struct unmount_args a; - - a.path = uap->path; - - if (uap->flags & ~OSF1_UNMOUNT_FLAGS) - return (EINVAL); - a.flags = 0; - if ((uap->flags & OSF1_MNT_FORCE) && - (uap->flags & OSF1_MNT_NOFORCE) == 0) - a.flags |= MNT_FORCE; - - return unmount(td, &a); -} - -int -osf1_mount(td, uap) - struct thread *td; - struct osf1_mount_args *uap; -{ - int error; - struct mount_args a; - - a.path = uap->path; - - if (uap->flags & ~OSF1_MOUNT_FLAGS) - return (EINVAL); - a.flags = uap->flags; /* XXX - xlate */ - - switch (uap->type) { - case OSF1_MOUNT_UFS: /* XXX */ - return (EINVAL); - break; - - case OSF1_MOUNT_NFS: /* XXX */ - if ((error = osf1_mount_nfs(td, uap, &a))) - return error; - break; - - case OSF1_MOUNT_MFS: /* XXX */ -#ifdef notyet - if ((error = osf1_mount_mfs(td, uap, &a))) - return error; -#endif - return EINVAL; - break; - - case OSF1_MOUNT_CDFS: /* XXX */ - return (EINVAL); - break; - - case OSF1_MOUNT_PROCFS: /* XXX */ - return (EINVAL); - break; - - case OSF1_MOUNT_NONE: - case OSF1_MOUNT_PC: - case OSF1_MOUNT_S5FS: - case OSF1_MOUNT_DFS: - case OSF1_MOUNT_EFS: - case OSF1_MOUNT_MSFS: - case OSF1_MOUNT_FFM: - case OSF1_MOUNT_FDFS: - case OSF1_MOUNT_ADDON: - default: - return (EINVAL); - } - - return mount(td, &a); -} - -int -osf1_mount_mfs(td, osf_argp, bsd_argp) - struct thread *td; - struct osf1_mount_args *osf_argp; - struct mount_args *bsd_argp; -{ -#ifdef notyet - int error, len; - caddr_t sg; - static const char mfs_name[] = "mfs"; - struct osf1_mfs_args osf_ma; - struct mfs_args bsd_ma; - - sg = stackgap_init(); - - if ((error = copyin(osf_argp->data, &osf_ma, sizeof osf_ma))) - return error; - - bzero(&bsd_ma, sizeof bsd_ma); - bsd_ma.fspec = osf_ma.name; - /* XXX export args */ - bsd_ma.base = osf_ma.base; - bsd_ma.size = osf_ma.size; - - bsd_argp->data = stackgap_alloc(&sg, sizeof bsd_ma); - if ((error = copyout(&bsd_ma, bsd_argp->data, sizeof bsd_ma))) - return error; - - len = strlen(mfs_name) + 1; - bsd_argp->type = stackgap_alloc(&sg, len); - if ((error = copyout(mfs_name, (void *)bsd_argp->type, len))) - return error; -#endif - return 0; -} - -int -osf1_mount_nfs(td, osf_argp, bsd_argp) - struct thread *td; - struct osf1_mount_args *osf_argp; - struct mount_args *bsd_argp; -{ - int error, len; - caddr_t sg; - static const char nfs_name[] = "nfs"; - struct osf1_nfs_args osf_na; - struct nfs_args bsd_na; - - sg = stackgap_init(); - - if ((error = copyin(osf_argp->data, &osf_na, sizeof osf_na))) - return error; - - bzero(&bsd_na, sizeof bsd_na); - bsd_na.addr = (struct sockaddr *)osf_na.addr; - bsd_na.addrlen = sizeof (struct sockaddr_in); - bsd_na.sotype = SOCK_DGRAM; - bsd_na.proto = 0; - bsd_na.fh = osf_na.fh; - - if (osf_na.flags & ~OSF1_NFSMNT_FLAGS) - return EINVAL; - if (osf_na.flags & OSF1_NFSMNT_SOFT) - bsd_na.flags |= NFSMNT_SOFT; - if (osf_na.flags & OSF1_NFSMNT_WSIZE) { - bsd_na.wsize = osf_na.wsize; - bsd_na.flags |= NFSMNT_WSIZE; - } - if (osf_na.flags & OSF1_NFSMNT_RSIZE) { - bsd_na.rsize = osf_na.rsize; - bsd_na.flags |= NFSMNT_RSIZE; - } - if (osf_na.flags & OSF1_NFSMNT_TIMEO) { - bsd_na.timeo = osf_na.timeo; - bsd_na.flags |= NFSMNT_TIMEO; - } - if (osf_na.flags & OSF1_NFSMNT_RETRANS) { - bsd_na.retrans = osf_na.retrans; - bsd_na.flags |= NFSMNT_RETRANS; - } - if (osf_na.flags & OSF1_NFSMNT_HOSTNAME) - bsd_na.hostname = osf_na.hostname; - if (osf_na.flags & OSF1_NFSMNT_INT) - bsd_na.flags |= NFSMNT_INT; - if (osf_na.flags & OSF1_NFSMNT_NOCONN) - bsd_na.flags |= NFSMNT_NOCONN; - - bsd_argp->data = stackgap_alloc(&sg, sizeof bsd_na); - if ((error = copyout(&bsd_na, bsd_argp->data, sizeof bsd_na))) - return error; - - len = strlen(nfs_name) + 1; - bsd_argp->type = stackgap_alloc(&sg, len); - if ((error = copyout(nfs_name, (void *)bsd_argp->type, len))) - return error; - - return 0; -} diff --git a/sys/alpha/osf1/osf1_proto.h b/sys/alpha/osf1/osf1_proto.h deleted file mode 100644 index 4d6820f..0000000 --- a/sys/alpha/osf1/osf1_proto.h +++ /dev/null @@ -1,377 +0,0 @@ -/* - * System call prototypes. - * - * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD$ - * created from; FreeBSD: src/sys/alpha/osf1/syscalls.master,v 1.12 2005/07/13 20:32:42 jhb Exp - */ - -#ifndef _OSF1_SYSPROTO_H_ -#define _OSF1_SYSPROTO_H_ - -#include <sys/signal.h> -#include <sys/acl.h> -#include <sys/thr.h> -#include <sys/umtx.h> -#include <posix4/_semaphore.h> - -#include <sys/ucontext.h> - -struct proc; - -struct thread; - -#define PAD_(t) (sizeof(register_t) <= sizeof(t) ? \ - 0 : sizeof(register_t) - sizeof(t)) - -#if BYTE_ORDER == LITTLE_ENDIAN -#define PADL_(t) 0 -#define PADR_(t) PAD_(t) -#else -#define PADL_(t) PAD_(t) -#define PADR_(t) 0 -#endif - -struct osf1_wait4_args { - char pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)]; - char status_l_[PADL_(int *)]; int * status; char status_r_[PADR_(int *)]; - char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)]; - char rusage_l_[PADL_(struct osf1_rusage *)]; struct osf1_rusage * rusage; char rusage_r_[PADR_(struct osf1_rusage *)]; -}; -struct osf1_mknod_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; - char dev_l_[PADL_(int)]; int dev; char dev_r_[PADR_(int)]; -}; -struct osf1_getfsstat_args { - char buf_l_[PADL_(struct osf1_statfs *)]; struct osf1_statfs * buf; char buf_r_[PADR_(struct osf1_statfs *)]; - char bufsize_l_[PADL_(long)]; long bufsize; char bufsize_r_[PADR_(long)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; -}; -struct osf1_lseek_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char offset_l_[PADL_(off_t)]; off_t offset; char offset_r_[PADR_(off_t)]; - char whence_l_[PADL_(int)]; int whence; char whence_r_[PADR_(int)]; -}; -struct osf1_mount_args { - char type_l_[PADL_(int)]; int type; char type_r_[PADR_(int)]; - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; - char data_l_[PADL_(caddr_t)]; caddr_t data; char data_r_[PADR_(caddr_t)]; -}; -struct osf1_unmount_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; -}; -struct osf1_setuid_args { - char uid_l_[PADL_(uid_t)]; uid_t uid; char uid_r_[PADR_(uid_t)]; -}; -struct osf1_access_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; -}; -struct osf1_kill_args { - char pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)]; - char signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)]; -}; -struct osf1_set_program_attributes_args { - char text_start_l_[PADL_(vm_offset_t)]; vm_offset_t text_start; char text_start_r_[PADR_(vm_offset_t)]; - char text_len_l_[PADL_(vm_offset_t)]; vm_offset_t text_len; char text_len_r_[PADR_(vm_offset_t)]; - char bss_start_l_[PADL_(vm_offset_t)]; vm_offset_t bss_start; char bss_start_r_[PADR_(vm_offset_t)]; - char bss_len_l_[PADL_(vm_offset_t)]; vm_offset_t bss_len; char bss_len_r_[PADR_(vm_offset_t)]; -}; -struct osf1_open_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; - char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)]; -}; -struct osf1_sigprocmask_args { - char how_l_[PADL_(int)]; int how; char how_r_[PADR_(int)]; - char mask_l_[PADL_(osf1_sigset_t)]; osf1_sigset_t mask; char mask_r_[PADR_(osf1_sigset_t)]; -}; -struct osf1_sigpending_args { - char p_l_[PADL_(struct proc *)]; struct proc * p; char p_r_[PADR_(struct proc *)]; - char mask_l_[PADL_(osf1_sigset_t *)]; osf1_sigset_t * mask; char mask_r_[PADR_(osf1_sigset_t *)]; -}; -struct osf1_classcntl_args { - char opcode_l_[PADL_(int)]; int opcode; char opcode_r_[PADR_(int)]; - char arg1_l_[PADL_(int)]; int arg1; char arg1_r_[PADR_(int)]; - char arg2_l_[PADL_(int)]; int arg2; char arg2_r_[PADR_(int)]; - char arg3_l_[PADL_(int)]; int arg3; char arg3_r_[PADR_(int)]; -}; -struct osf1_ioctl_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char com_l_[PADL_(int)]; int com; char com_r_[PADR_(int)]; - char data_l_[PADL_(caddr_t)]; caddr_t data; char data_r_[PADR_(caddr_t)]; -}; -struct osf1_reboot_args { - char opt_l_[PADL_(int)]; int opt; char opt_r_[PADR_(int)]; -}; -struct osf1_execve_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char argp_l_[PADL_(char **)]; char ** argp; char argp_r_[PADR_(char **)]; - char envp_l_[PADL_(char **)]; char ** envp; char envp_r_[PADR_(char **)]; -}; -struct osf1_stat_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char ub_l_[PADL_(struct osf1_stat *)]; struct osf1_stat * ub; char ub_r_[PADR_(struct osf1_stat *)]; -}; -struct osf1_lstat_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char ub_l_[PADL_(struct osf1_stat *)]; struct osf1_stat * ub; char ub_r_[PADR_(struct osf1_stat *)]; -}; -struct osf1_mmap_args { - char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)]; - char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; - char prot_l_[PADL_(int)]; int prot; char prot_r_[PADR_(int)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char pos_l_[PADL_(off_t)]; off_t pos; char pos_r_[PADR_(off_t)]; -}; -struct osf1_madvise_args { - register_t dummy; -}; -struct osf1_setpgrp_args { - char pid_l_[PADL_(int)]; int pid; char pid_r_[PADR_(int)]; - char pgid_l_[PADL_(int)]; int pgid; char pgid_r_[PADR_(int)]; -}; -struct osf1_setitimer_args { - char which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)]; - char itv_l_[PADL_(struct itimerval *)]; struct itimerval * itv; char itv_r_[PADR_(struct itimerval *)]; - char oitv_l_[PADL_(struct itimerval *)]; struct itimerval * oitv; char oitv_r_[PADR_(struct itimerval *)]; -}; -struct osf1_table_args { - char id_l_[PADL_(long)]; long id; char id_r_[PADR_(long)]; - char index_l_[PADL_(long)]; long index; char index_r_[PADR_(long)]; - char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; - char nel_l_[PADL_(long)]; long nel; char nel_r_[PADR_(long)]; - char lel_l_[PADL_(u_long)]; u_long lel; char lel_r_[PADR_(u_long)]; -}; -struct osf1_getitimer_args { - char which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)]; - char itv_l_[PADL_(struct itimerval *)]; struct itimerval * itv; char itv_r_[PADR_(struct itimerval *)]; -}; -struct osf1_fstat_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char sb_l_[PADL_(void *)]; void * sb; char sb_r_[PADR_(void *)]; -}; -struct osf1_fcntl_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; - char arg_l_[PADL_(void *)]; void * arg; char arg_r_[PADR_(void *)]; -}; -struct osf1_select_args { - char nd_l_[PADL_(u_int)]; u_int nd; char nd_r_[PADR_(u_int)]; - char in_l_[PADL_(fd_set *)]; fd_set * in; char in_r_[PADR_(fd_set *)]; - char ou_l_[PADL_(fd_set *)]; fd_set * ou; char ou_r_[PADR_(fd_set *)]; - char ex_l_[PADL_(fd_set *)]; fd_set * ex; char ex_r_[PADR_(fd_set *)]; - char tv_l_[PADL_(struct timeval *)]; struct timeval * tv; char tv_r_[PADR_(struct timeval *)]; -}; -struct osf1_socket_args { - char domain_l_[PADL_(int)]; int domain; char domain_r_[PADR_(int)]; - char type_l_[PADL_(int)]; int type; char type_r_[PADR_(int)]; - char protocol_l_[PADL_(int)]; int protocol; char protocol_r_[PADR_(int)]; -}; -struct osf1_sigreturn_args { - char sigcntxp_l_[PADL_(struct osigcontext *)]; struct osigcontext * sigcntxp; char sigcntxp_r_[PADR_(struct osigcontext *)]; -}; -struct osf1_sigsuspend_args { - char ss_l_[PADL_(osf1_sigset_t)]; osf1_sigset_t ss; char ss_r_[PADR_(osf1_sigset_t)]; -}; -struct osf1_osigstack_args { - char nss_l_[PADL_(struct sigstack *)]; struct sigstack * nss; char nss_r_[PADR_(struct sigstack *)]; - char oss_l_[PADL_(struct sigstack *)]; struct sigstack * oss; char oss_r_[PADR_(struct sigstack *)]; -}; -struct osf1_gettimeofday_args { - char tp_l_[PADL_(struct timeval *)]; struct timeval * tp; char tp_r_[PADR_(struct timeval *)]; - char tzp_l_[PADL_(struct timezone *)]; struct timezone * tzp; char tzp_r_[PADR_(struct timezone *)]; -}; -struct osf1_getrusage_args { - char who_l_[PADL_(long)]; long who; char who_r_[PADR_(long)]; - char rusage_l_[PADL_(void *)]; void * rusage; char rusage_r_[PADR_(void *)]; -}; -struct osf1_readv_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char iovp_l_[PADL_(struct osf1_iovec *)]; struct osf1_iovec * iovp; char iovp_r_[PADR_(struct osf1_iovec *)]; - char iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)]; -}; -struct osf1_writev_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char iovp_l_[PADL_(struct osf1_iovec *)]; struct osf1_iovec * iovp; char iovp_r_[PADR_(struct osf1_iovec *)]; - char iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)]; -}; -struct osf1_truncate_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)]; -}; -struct osf1_ftruncate_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char length_l_[PADL_(off_t)]; off_t length; char length_r_[PADR_(off_t)]; -}; -struct osf1_setgid_args { - char gid_l_[PADL_(gid_t)]; gid_t gid; char gid_r_[PADR_(gid_t)]; -}; -struct osf1_sendto_args { - char s_l_[PADL_(int)]; int s; char s_r_[PADR_(int)]; - char buf_l_[PADL_(caddr_t)]; caddr_t buf; char buf_r_[PADR_(caddr_t)]; - char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; - char to_l_[PADL_(struct sockaddr *)]; struct sockaddr * to; char to_r_[PADR_(struct sockaddr *)]; - char tolen_l_[PADL_(int)]; int tolen; char tolen_r_[PADR_(int)]; -}; -struct osf1_getrlimit_args { - char which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)]; - char rlp_l_[PADL_(struct rlimit *)]; struct rlimit * rlp; char rlp_r_[PADR_(struct rlimit *)]; -}; -struct osf1_setrlimit_args { - char which_l_[PADL_(u_int)]; u_int which; char which_r_[PADR_(u_int)]; - char rlp_l_[PADL_(struct rlimit *)]; struct rlimit * rlp; char rlp_r_[PADR_(struct rlimit *)]; -}; -struct osf1_sigaction_args { - char signum_l_[PADL_(long)]; long signum; char signum_r_[PADR_(long)]; - char nsa_l_[PADL_(struct osf1_sigaction *)]; struct osf1_sigaction * nsa; char nsa_r_[PADR_(struct osf1_sigaction *)]; - char osa_l_[PADL_(struct osf1_sigaction *)]; struct osf1_sigaction * osa; char osa_r_[PADR_(struct osf1_sigaction *)]; - char sigtramp_l_[PADL_(void *)]; void * sigtramp; char sigtramp_r_[PADR_(void *)]; -}; -struct osf1_statfs_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char buf_l_[PADL_(struct osf1_statfs *)]; struct osf1_statfs * buf; char buf_r_[PADR_(struct osf1_statfs *)]; - char len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)]; -}; -struct osf1_fstatfs_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char buf_l_[PADL_(struct osf1_statfs *)]; struct osf1_statfs * buf; char buf_r_[PADR_(struct osf1_statfs *)]; - char len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)]; -}; -struct osf1_msync_args { - char addr_l_[PADL_(caddr_t)]; caddr_t addr; char addr_r_[PADR_(caddr_t)]; - char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; - char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; -}; -struct osf1_signal_args { - char signum_l_[PADL_(int)]; int signum; char signum_r_[PADR_(int)]; - char handler_l_[PADL_(void *)]; void * handler; char handler_r_[PADR_(void *)]; -}; -struct osf1_sigaltstack_args { - char nss_l_[PADL_(struct osf1_sigaltstack *)]; struct osf1_sigaltstack * nss; char nss_r_[PADR_(struct osf1_sigaltstack *)]; - char oss_l_[PADL_(struct osf1_sigaltstack *)]; struct osf1_sigaltstack * oss; char oss_r_[PADR_(struct osf1_sigaltstack *)]; -}; -struct osf1_sysinfo_args { - char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; - char buf_l_[PADL_(char *)]; char * buf; char buf_r_[PADR_(char *)]; - char count_l_[PADL_(long)]; long count; char count_r_[PADR_(long)]; -}; -struct osf1_proplist_syscall_args { - register_t dummy; -}; -struct osf1_ntpadjtime_args { - char tp_l_[PADL_(void *)]; void * tp; char tp_r_[PADR_(void *)]; -}; -struct osf1_ntpgettime_args { - char tp_l_[PADL_(void *)]; void * tp; char tp_r_[PADR_(void *)]; -}; -struct osf1_pathconf_args { - char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)]; - char name_l_[PADL_(int)]; int name; char name_r_[PADR_(int)]; -}; -struct osf1_fpathconf_args { - char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; - char name_l_[PADL_(int)]; int name; char name_r_[PADR_(int)]; -}; -struct osf1_uswitch_args { - char cmd_l_[PADL_(long)]; long cmd; char cmd_r_[PADR_(long)]; - char mask_l_[PADL_(long)]; long mask; char mask_r_[PADR_(long)]; -}; -struct osf1_usleep_thread_args { - char sleep_l_[PADL_(struct timeval *)]; struct timeval * sleep; char sleep_r_[PADR_(struct timeval *)]; - char slept_l_[PADL_(struct timeval *)]; struct timeval * slept; char slept_r_[PADR_(struct timeval *)]; -}; -struct osf1_getsysinfo_args { - char op_l_[PADL_(u_long)]; u_long op; char op_r_[PADR_(u_long)]; - char buffer_l_[PADL_(caddr_t)]; caddr_t buffer; char buffer_r_[PADR_(caddr_t)]; - char nbytes_l_[PADL_(u_long)]; u_long nbytes; char nbytes_r_[PADR_(u_long)]; - char arg_l_[PADL_(caddr_t)]; caddr_t arg; char arg_r_[PADR_(caddr_t)]; - char flag_l_[PADL_(u_long)]; u_long flag; char flag_r_[PADR_(u_long)]; -}; -struct osf1_setsysinfo_args { - char op_l_[PADL_(u_long)]; u_long op; char op_r_[PADR_(u_long)]; - char buffer_l_[PADL_(caddr_t)]; caddr_t buffer; char buffer_r_[PADR_(caddr_t)]; - char nbytes_l_[PADL_(u_long)]; u_long nbytes; char nbytes_r_[PADR_(u_long)]; - char arg_l_[PADL_(caddr_t)]; caddr_t arg; char arg_r_[PADR_(caddr_t)]; - char flag_l_[PADL_(u_long)]; u_long flag; char flag_r_[PADR_(u_long)]; -}; -int osf1_wait4(struct thread *, struct osf1_wait4_args *); -int osf1_mknod(struct thread *, struct osf1_mknod_args *); -int osf1_getfsstat(struct thread *, struct osf1_getfsstat_args *); -int osf1_lseek(struct thread *, struct osf1_lseek_args *); -int osf1_mount(struct thread *, struct osf1_mount_args *); -int osf1_unmount(struct thread *, struct osf1_unmount_args *); -int osf1_setuid(struct thread *, struct osf1_setuid_args *); -int osf1_access(struct thread *, struct osf1_access_args *); -int osf1_kill(struct thread *, struct osf1_kill_args *); -int osf1_set_program_attributes(struct thread *, struct osf1_set_program_attributes_args *); -int osf1_open(struct thread *, struct osf1_open_args *); -int osf1_sigprocmask(struct thread *, struct osf1_sigprocmask_args *); -int osf1_sigpending(struct thread *, struct osf1_sigpending_args *); -int osf1_classcntl(struct thread *, struct osf1_classcntl_args *); -int osf1_ioctl(struct thread *, struct osf1_ioctl_args *); -int osf1_reboot(struct thread *, struct osf1_reboot_args *); -int osf1_execve(struct thread *, struct osf1_execve_args *); -int osf1_stat(struct thread *, struct osf1_stat_args *); -int osf1_lstat(struct thread *, struct osf1_lstat_args *); -int osf1_mmap(struct thread *, struct osf1_mmap_args *); -int osf1_madvise(struct thread *, struct osf1_madvise_args *); -int osf1_setpgrp(struct thread *, struct osf1_setpgrp_args *); -int osf1_setitimer(struct thread *, struct osf1_setitimer_args *); -int osf1_table(struct thread *, struct osf1_table_args *); -int osf1_getitimer(struct thread *, struct osf1_getitimer_args *); -int osf1_fstat(struct thread *, struct osf1_fstat_args *); -int osf1_fcntl(struct thread *, struct osf1_fcntl_args *); -int osf1_select(struct thread *, struct osf1_select_args *); -int osf1_socket(struct thread *, struct osf1_socket_args *); -int osf1_sigreturn(struct thread *, struct osf1_sigreturn_args *); -int osf1_sigsuspend(struct thread *, struct osf1_sigsuspend_args *); -int osf1_osigstack(struct thread *, struct osf1_osigstack_args *); -int osf1_gettimeofday(struct thread *, struct osf1_gettimeofday_args *); -int osf1_getrusage(struct thread *, struct osf1_getrusage_args *); -int osf1_readv(struct thread *, struct osf1_readv_args *); -int osf1_writev(struct thread *, struct osf1_writev_args *); -int osf1_truncate(struct thread *, struct osf1_truncate_args *); -int osf1_ftruncate(struct thread *, struct osf1_ftruncate_args *); -int osf1_setgid(struct thread *, struct osf1_setgid_args *); -int osf1_sendto(struct thread *, struct osf1_sendto_args *); -int osf1_getrlimit(struct thread *, struct osf1_getrlimit_args *); -int osf1_setrlimit(struct thread *, struct osf1_setrlimit_args *); -int osf1_sigaction(struct thread *, struct osf1_sigaction_args *); -int osf1_statfs(struct thread *, struct osf1_statfs_args *); -int osf1_fstatfs(struct thread *, struct osf1_fstatfs_args *); -int osf1_msync(struct thread *, struct osf1_msync_args *); -int osf1_signal(struct thread *, struct osf1_signal_args *); -int osf1_sigaltstack(struct thread *, struct osf1_sigaltstack_args *); -int osf1_sysinfo(struct thread *, struct osf1_sysinfo_args *); -int osf1_proplist_syscall(struct thread *, struct osf1_proplist_syscall_args *); -int osf1_ntpadjtime(struct thread *, struct osf1_ntpadjtime_args *); -int osf1_ntpgettime(struct thread *, struct osf1_ntpgettime_args *); -int osf1_pathconf(struct thread *, struct osf1_pathconf_args *); -int osf1_fpathconf(struct thread *, struct osf1_fpathconf_args *); -int osf1_uswitch(struct thread *, struct osf1_uswitch_args *); -int osf1_usleep_thread(struct thread *, struct osf1_usleep_thread_args *); -int osf1_getsysinfo(struct thread *, struct osf1_getsysinfo_args *); -int osf1_setsysinfo(struct thread *, struct osf1_setsysinfo_args *); - -#ifdef COMPAT_43 - - -#endif /* COMPAT_43 */ - - -#ifdef COMPAT_FREEBSD4 - - -#endif /* COMPAT_FREEBSD4 */ - -#undef PAD_ -#undef PADL_ -#undef PADR_ - -#endif /* !_OSF1_SYSPROTO_H_ */ diff --git a/sys/alpha/osf1/osf1_signal.c b/sys/alpha/osf1/osf1_signal.c deleted file mode 100644 index 56e2298..0000000 --- a/sys/alpha/osf1/osf1_signal.c +++ /dev/null @@ -1,637 +0,0 @@ -/* $NetBSD: osf1_signal.c,v 1.4 1998/05/20 16:35:01 chs Exp $ - */ -/*- - * Copyright (c) 1998-1999 Andrew Gallatin - * - * Taken from NetBSD's sys/compat/osf1/osf1_signal.c, which at the - * time *had no copyright*! - * - * 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 - * in this position and unchanged. - * 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. 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. - * - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_compat.h" -#ifndef COMPAT_43 -#error "COMPAT_OSF1 requires COMPAT_43" -#endif - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/sysproto.h> -#include <sys/signalvar.h> -#include <sys/kernel.h> -#include <sys/proc.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/reboot.h> -#include <sys/bio.h> -#include <sys/buf.h> -#include <sys/bus.h> -#include <sys/mbuf.h> -#include <sys/vmmeter.h> -#include <sys/msgbuf.h> -#include <sys/exec.h> -#include <sys/syscallsubr.h> -#include <sys/sysctl.h> -#include <sys/uio.h> -#include <net/netisr.h> -#include <vm/vm.h> -#include <vm/vm_kern.h> -#include <vm/vm_page.h> -#include <vm/vm_map.h> -#include <vm/vm_extern.h> -#include <vm/vm_object.h> -#include <vm/vm_pager.h> -#include <sys/ptrace.h> -#include <sys/cons.h> -#include <machine/clock.h> -#include <machine/md_var.h> -#include <machine/reg.h> -#include <machine/pal.h> -#include <machine/cpuconf.h> -#include <machine/bootinfo.h> -#include <machine/rpb.h> -#include <machine/prom.h> -#include <machine/chipset.h> -#include <machine/vmparam.h> -#include <machine/elf.h> -#include <ddb/ddb.h> -#include <alpha/alpha/db_instruction.h> -#include <sys/vnode.h> -#include <machine/pcb.h> - -#include <alpha/osf1/osf1_signal.h> -#include <alpha/osf1/osf1_proto.h> -#include <alpha/osf1/osf1_syscall.h> -#include <alpha/osf1/osf1_util.h> -#include <alpha/osf1/osf1.h> -#include <sys/sysproto.h> - -#define DPRINTF uprintf -int osf1_sigdbg = 0; - -static void bsd_to_osf1_sigaction(const struct sigaction *bsa, - struct osf1_sigaction *osa); -static void osf1_to_bsd_sigaction(const struct osf1_sigaction *osa, - struct sigaction *bsa); - -#define sigemptyset(s) SIGEMPTYSET(*(s)) -#define sigismember(s, n) SIGISMEMBER(*(s), n) -#define sigaddset(s, n) SIGADDSET(*(s), n) - -#define osf1_sigmask(n) (1 << ((n) - 1)) -#define osf1_sigemptyset(s) memset((s), 0, sizeof(*(s))) -#define osf1_sigfillset(s) memset((s), 0xffffffff, sizeof(*(s))) -#define osf1_sigismember(s, n) (*(s) & sigmask(n)) -#define osf1_sigaddset(s, n) (*(s) |= sigmask(n)) - -void -osf1_to_bsd_sigset(oss, bss) - const osf1_sigset_t *oss; - sigset_t *bss; -{ - const u_int32_t *obits; - - SIGEMPTYSET(*bss); - obits = (const u_int32_t *)oss; - bss->__bits[0] = obits[0]; - bss->__bits[1] = obits[1]; -} - -void -bsd_to_osf1_sigset(bss, oss) - const sigset_t *bss; - osf1_sigset_t *oss; -{ - u_int32_t *obits; - - osf1_sigemptyset(oss); - obits = (u_int32_t *)oss; - obits[0] = bss->__bits[0]; - obits[1] = bss->__bits[1]; -} - -/* - * XXX: Only a subset of the flags is currently implemented. - */ -void -osf1_to_bsd_sigaction(osa, bsa) - const struct osf1_sigaction *osa; - struct sigaction *bsa; -{ - - bsa->sa_handler = osa->osa_handler; - if (osf1_sigdbg) - uprintf("%s(%d): handler @0x%lx \n", __FILE__, __LINE__, - (unsigned long)osa->osa_handler); - osf1_to_bsd_sigset(&osa->osa_mask, &bsa->sa_mask); - bsa->sa_flags = 0; - if ((osa->osa_flags & OSF1_SA_ONSTACK) != 0) - bsa->sa_flags |= SA_ONSTACK; - if ((osa->osa_flags & OSF1_SA_RESTART) != 0) - bsa->sa_flags |= SA_RESTART; - if ((osa->osa_flags & OSF1_SA_RESETHAND) != 0) - bsa->sa_flags |= SA_RESETHAND; - if ((osa->osa_flags & OSF1_SA_NOCLDSTOP) != 0) - bsa->sa_flags |= SA_NOCLDSTOP; - if ((osa->osa_flags & OSF1_SA_NODEFER) != 0) - bsa->sa_flags |= SA_NODEFER; -} - -void -bsd_to_osf1_sigaction(bsa, osa) - const struct sigaction *bsa; - struct osf1_sigaction *osa; -{ - - osa->osa_handler = bsa->sa_handler; - bsd_to_osf1_sigset(&bsa->sa_mask, &osa->osa_mask); - osa->osa_flags = 0; - if ((bsa->sa_flags & SA_ONSTACK) != 0) - osa->osa_flags |= SA_ONSTACK; - if ((bsa->sa_flags & SA_RESTART) != 0) - osa->osa_flags |= SA_RESTART; - if ((bsa->sa_flags & SA_NOCLDSTOP) != 0) - osa->osa_flags |= SA_NOCLDSTOP; - if ((bsa->sa_flags & SA_NODEFER) != 0) - osa->osa_flags |= SA_NODEFER; - if ((bsa->sa_flags & SA_RESETHAND) != 0) - osa->osa_flags |= SA_RESETHAND; -} - -void -osf1_to_bsd_sigaltstack(oss, bss) - const struct osf1_sigaltstack *oss; - struct sigaltstack *bss; -{ - - bss->ss_sp = oss->ss_sp; - bss->ss_size = oss->ss_size; - bss->ss_flags = 0; - - if ((oss->ss_flags & OSF1_SS_DISABLE) != 0) - bss->ss_flags |= SS_DISABLE; - if ((oss->ss_flags & OSF1_SS_ONSTACK) != 0) - bss->ss_flags |= SS_ONSTACK; -} - -void -bsd_to_osf1_sigaltstack(bss, oss) - const struct sigaltstack *bss; - struct osf1_sigaltstack *oss; -{ - - oss->ss_sp = bss->ss_sp; - oss->ss_size = bss->ss_size; - oss->ss_flags = 0; - - if ((bss->ss_flags & SS_DISABLE) != 0) - oss->ss_flags |= OSF1_SS_DISABLE; - if ((bss->ss_flags & SS_ONSTACK) != 0) - oss->ss_flags |= OSF1_SS_ONSTACK; -} - -int -osf1_sigaction(td, uap) - struct thread *td; - struct osf1_sigaction_args *uap; -{ - struct osf1_sigaction osa; - struct sigaction nbsa, obsa; - struct sigaction *nbsap; - int error; - - if (osf1_sigdbg && uap->sigtramp) - uprintf("osf1_sigaction: trampoline handler at %p\n", - uap->sigtramp); - td->td_md.osf_sigtramp = uap->sigtramp; - if (uap->nsa != NULL) { - if ((error = copyin(uap->nsa, &osa, sizeof(osa))) != 0) - return (error); - osf1_to_bsd_sigaction(&osa, &nbsa); - nbsap = &nbsa; - } else - nbsap = NULL; - error = kern_sigaction(td, uap->signum, &nbsa, &obsa, 0); - - if (error == 0 && uap->osa != NULL) { - bsd_to_osf1_sigaction(&obsa, &osa); - error = copyout(&osa, uap->osa, sizeof(osa)); - } - return (error); -} - -int -osf1_sigaltstack(td, uap) - register struct thread *td; - struct osf1_sigaltstack_args *uap; -{ - struct osf1_sigaltstack oss; - struct sigaltstack nbss, obss, *nbssp; - int error; - - if (uap->nss != NULL) { - if ((error = copyin(uap->nss, &oss, sizeof(oss))) != 0) - return (error); - osf1_to_bsd_sigaltstack(&oss, &nbss); - nbssp = &nbss; - } else - nbssp = NULL; - error = kern_sigaltstack(td, nbssp, &obss); - if (error == 0 && uap->oss != NULL) { - bsd_to_osf1_sigaltstack(&obss, &oss); - error = copyout(&oss, uap->oss, sizeof(oss)); - } - return (error); -} - -int -osf1_signal(td, uap) - register struct thread *td; - struct osf1_signal_args *uap; -{ - struct proc *p; - int error, signum; - - signum = OSF1_SIGNO(uap->signum); - if (signum <= 0 || signum > OSF1_NSIG) { - if (OSF1_SIGCALL(uap->signum) == OSF1_SIGNAL_MASK || - OSF1_SIGCALL(uap->signum) == OSF1_SIGDEFER_MASK) - td->td_retval[0] = -1; - return EINVAL; - } - - switch (OSF1_SIGCALL(uap->signum)) { - case OSF1_SIGDEFER_MASK: - /* - * sigset is identical to signal() except - * that SIG_HOLD is allowed as - * an action. - */ - if ((u_long)uap->handler == OSF1_SIG_HOLD) { - sigset_t mask; - - SIGEMPTYSET(mask); - SIGADDSET(mask, signum); - return (kern_sigprocmask(td, SIG_BLOCK, &mask, NULL, - 0)); - } - /* FALLTHROUGH */ - - case OSF1_SIGNAL_MASK: - { - struct sigaction nbsa, obsa; - - nbsa.sa_handler = uap->handler; - SIGEMPTYSET(nbsa.sa_mask); - nbsa.sa_flags = 0; -#if 0 - if (signum != SIGALRM) - nbsa.sa_flags = SA_RESTART; -#endif - error = kern_sigaction(td, signum, &nbsa, &obsa, 0); - if (error != 0) { - DPRINTF("signal: sigaction failed: %d\n", - error); - td->td_retval[0] = -1; - return (error); - } - td->td_retval[0] = (long)obsa.sa_handler; - return 0; - } - - case OSF1_SIGHOLD_MASK: - { - sigset_t set; - - SIGEMPTYSET(set); - SIGADDSET(set, signum); - return (kern_sigprocmask(td, SIG_BLOCK, &set, NULL, 0)); - } - - case OSF1_SIGRELSE_MASK: - { - sigset_t set; - - SIGEMPTYSET(set); - SIGADDSET(set, signum); - return (kern_sigprocmask(td, SIG_UNBLOCK, &set, NULL, - 0)); - - } - - case OSF1_SIGIGNORE_MASK: - { - struct sigaction sa; - - sa.sa_handler = SIG_IGN; - SIGEMPTYSET(sa.sa_mask); - sa.sa_flags = 0; - error = kern_sigaction(td, signum, &sa, NULL, 0); - if (error != 0) - DPRINTF(("sigignore: sigaction failed\n")); - return (error); - } - - case OSF1_SIGPAUSE_MASK: - { - sigset_t mask; - - p = td->td_proc; - PROC_LOCK(p); - mask = td->td_sigmask; - PROC_UNLOCK(p); - SIGDELSET(mask, signum); - return kern_sigsuspend(td, mask); - } - - default: - return ENOSYS; - } -} - -int -osf1_sigprocmask(td, uap) - register struct thread *td; - struct osf1_sigprocmask_args /* { - syscallarg(int) how; - syscallarg(osf1_sigset_t *) set; - } */ *uap; -{ - osf1_sigset_t oss; - sigset_t obss, nbss; - int error; - - /* OSF/1 sigprocmask flag values match FreeBSD flag values. */ - osf1_to_bsd_sigset(&uap->mask, &nbss); - error = kern_sigprocmask(td, uap->how, &nbss, &obss, 0); - if (error == 0) { - bsd_to_osf1_sigset(&obss, &oss); - td->td_retval[0] = oss; - } - return (error); -} - -int -osf1_sigpending(td, uap) - register struct thread *td; - struct osf1_sigpending_args /* { - syscallarg(osf1_sigset_t *) mask; - } */ *uap; -{ - struct proc *p; - osf1_sigset_t oss; - sigset_t bss; - - p = td->td_proc; - PROC_LOCK(p); - bss = td->td_siglist; - SIGSETOR(bss, p->p_siglist); - SIGSETAND(bss, td->td_sigmask); - PROC_UNLOCK(p); - bsd_to_osf1_sigset(&bss, &oss); - - return copyout(&oss, uap->mask, sizeof(oss)); -} - -int -osf1_sigsuspend(td, uap) - register struct thread *td; - struct osf1_sigsuspend_args /* { - syscallarg(osf1_sigset_t *) ss; - } */ *uap; -{ - osf1_sigset_t oss; - sigset_t bss; - - oss = uap->ss; - osf1_to_bsd_sigset(&oss, &bss); - return kern_sigsuspend(td, bss); -} - -int -osf1_kill(td, uap) - register struct thread *td; - struct osf1_kill_args /* { - syscallarg(int) pid; - syscallarg(int) signum; - } */ *uap; -{ - struct kill_args ka; - - ka.pid = uap->pid; - ka.signum = uap->signum; - return kill(td, &ka); -} - - -/* - * Send an interrupt to process. - * - * Stack is set up to allow sigcode stored at top to call routine, - * followed by kcall to sigreturn routine below. After sigreturn resets - * the signal mask, the stack, and the frame pointer, it returns to the - * user specified pc, psl. - */ - -void -osf1_sendsig(sig_t catcher, ksiginfo_t *kp, sigset_t *mask) -{ - int fsize, oonstack, rndfsize; - struct thread *td; - struct proc *p; - osiginfo_t *sip, ksi; - struct trapframe *frame; - struct sigacts *psp; - int sig; - int code; - - td = curthread; - p = td->td_proc; - PROC_LOCK_ASSERT(p, MA_OWNED); - sig = kp->ksi_signo; - code = kp->ksi_code; - psp = p->p_sigacts; - mtx_assert(&psp->ps_mtx, MA_OWNED); - - frame = td->td_frame; - oonstack = sigonstack(alpha_pal_rdusp()); - fsize = sizeof ksi; - rndfsize = ((fsize + 15) / 16) * 16; - - /* - * Allocate and validate space for the signal handler context. - * Note that if the stack is in P0 space, the call to grow() is a nop, - * and the useracc() check will fail if the process has not already - * allocated the space with a `brk'. - */ - if ((td->td_pflags & TDP_ALTSTACK) && !oonstack && - SIGISMEMBER(psp->ps_sigonstack, sig)) { - sip = (osiginfo_t *)((caddr_t)td->td_sigstk.ss_sp + - td->td_sigstk.ss_size - rndfsize); - td->td_sigstk.ss_flags |= SS_ONSTACK; - } else - sip = (osiginfo_t *)(alpha_pal_rdusp() - rndfsize); - mtx_unlock(&psp->ps_mtx); - PROC_UNLOCK(p); - - /* - * Build the signal context to be used by sigreturn. - */ - ksi.si_sc.sc_onstack = (oonstack) ? 1 : 0; - bsd_to_osf1_sigset(mask, &ksi.si_sc.sc_mask); - ksi.si_sc.sc_pc = frame->tf_regs[FRAME_PC]; - ksi.si_sc.sc_ps = frame->tf_regs[FRAME_PS]; - - /* copy the registers. */ - fill_regs(td, (struct reg *)ksi.si_sc.sc_regs); - ksi.si_sc.sc_regs[R_ZERO] = 0xACEDBADE; /* magic number */ - ksi.si_sc.sc_regs[R_SP] = alpha_pal_rdusp(); - - /* save the floating-point state, if necessary, then copy it. */ - alpha_fpstate_save(td, 1); /* XXX maybe write=0 */ - ksi.si_sc.sc_ownedfp = td->td_md.md_flags & MDTD_FPUSED; - bcopy(&td->td_pcb->pcb_fp, (struct fpreg *)ksi.si_sc.sc_fpregs, - sizeof(struct fpreg)); - ksi.si_sc.sc_fp_control = td->td_pcb->pcb_fp_control; - bzero(ksi.si_sc.sc_reserved, sizeof ksi.si_sc.sc_reserved); /* XXX */ - ksi.si_sc.sc_xxx1[0] = 0; /* XXX */ - ksi.si_sc.sc_xxx1[1] = 0; /* XXX */ - ksi.si_sc.sc_traparg_a0 = frame->tf_regs[FRAME_TRAPARG_A0]; - ksi.si_sc.sc_traparg_a1 = frame->tf_regs[FRAME_TRAPARG_A1]; - ksi.si_sc.sc_traparg_a2 = frame->tf_regs[FRAME_TRAPARG_A2]; - ksi.si_sc.sc_xxx2[0] = 0; /* XXX */ - ksi.si_sc.sc_xxx2[1] = 0; /* XXX */ - ksi.si_sc.sc_xxx2[2] = 0; /* XXX */ - /* Fill in POSIX parts */ - ksi.si_signo = sig; - ksi.si_code = code; - ksi.si_value = kp->ksi_value; - - /* - * copy the frame out to userland. - */ - if (copyout((caddr_t)&ksi, (caddr_t)sip, fsize) != 0) { - /* - * Process has trashed its stack; give it an illegal - * instruction to halt it in its tracks. - */ - PROC_LOCK(p); - sigexit(td, SIGILL); - return; - } - - /* - * Set up the registers to return to sigcode. - */ - if (osf1_sigdbg) - uprintf("attempting to call osf1 sigtramp\n"); - frame->tf_regs[FRAME_PC] = (u_int64_t)td->td_md.osf_sigtramp; - frame->tf_regs[FRAME_A0] = sig; - frame->tf_regs[FRAME_A1] = code; - frame->tf_regs[FRAME_A2] = (u_int64_t)sip; - frame->tf_regs[FRAME_A3] = (u_int64_t)catcher; /* a3 is pv */ - frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */ - alpha_pal_wrusp((unsigned long)sip); - PROC_LOCK(p); - mtx_lock(&psp->ps_mtx); -} - - -/* - * System call to cleanup state after a signal has been taken. Reset signal - * mask and stack state from context left by sendsig (above). Return to - * previous pc and psl as specified by context left by sendsig. Check - * carefully to make sure that the user has not modified the state to gain - * improper privileges. - */ -int -osf1_sigreturn(struct thread *td, - struct osf1_sigreturn_args /* { - struct osigcontext *sigcntxp; - } */ *uap) -{ - struct osigcontext ksc, *scp; - struct proc *p; - - p = td->td_proc; - scp = uap->sigcntxp; - - /* - * Fetch the entire context structure at once for speed. - */ - if (copyin((caddr_t)scp, (caddr_t)&ksc, sizeof ksc)) - return (EFAULT); - - /* - * Restore the user-supplied information. - */ - PROC_LOCK(p); - if (ksc.sc_onstack) - td->td_sigstk.ss_flags |= SS_ONSTACK; - else - td->td_sigstk.ss_flags &= ~SS_ONSTACK; - - /* - * longjmp is still implemented by calling osigreturn. The new - * sigmask is stored in sc_reserved, sc_mask is only used for - * backward compatibility. - */ - osf1_to_bsd_sigset(&ksc.sc_mask, &td->td_sigmask); - SIG_CANTMASK(td->td_sigmask); - signotify(td); - PROC_UNLOCK(p); - - set_regs(td, (struct reg *)ksc.sc_regs); - td->td_frame->tf_regs[FRAME_PC] = ksc.sc_pc; - td->td_frame->tf_regs[FRAME_PS] = - (ksc.sc_ps | ALPHA_PSL_USERSET) & ~ALPHA_PSL_USERCLR; - td->td_frame->tf_regs[FRAME_FLAGS] = 0; /* full restore */ - - alpha_pal_wrusp(ksc.sc_regs[R_SP]); - - /* XXX ksc.sc_ownedfp ? */ - alpha_fpstate_drop(td); - bcopy((struct fpreg *)ksc.sc_fpregs, &td->td_pcb->pcb_fp, - sizeof(struct fpreg)); - td->td_pcb->pcb_fp_control = ksc.sc_fp_control; - return (EJUSTRETURN); -} - -int -osf1_osigstack(td, uap) - register struct thread *td; - struct osf1_osigstack_args /* { - struct sigstack *nss; - struct sigstack *oss; - } */ *uap; -{ - -/* uprintf("osf1_osigstack: oss = %p, nss = %p",uap->oss, uap->nss); - uprintf(" stack ptr = %p\n",p->p_sigacts->ps_sigstk.ss_sp);*/ - return(osigstack(td, (struct osigstack_args *)uap)); -} diff --git a/sys/alpha/osf1/osf1_signal.h b/sys/alpha/osf1/osf1_signal.h deleted file mode 100644 index 1ef5ac4..0000000 --- a/sys/alpha/osf1/osf1_signal.h +++ /dev/null @@ -1,67 +0,0 @@ -/* $FreeBSD$ */ - -#ifndef _OSF1_SIGNAL_H -#define _OSF1_SIGNAL_H - -#define OSF1_NSIG 64 - -#define OSF1_SIG_DFL 0 -#define OSF1_SIG_ERR -1 -#define OSF1_SIG_IGN 1 -#define OSF1_SIG_HOLD 2 - -#define OSF1_SIGNO(a) ((a) & OSF1_SIGNO_MASK) -#define OSF1_SIGCALL(a) ((a) & ~OSF1_SIGNO_MASK) - -#define OSF1_SIG_BLOCK 1 -#define OSF1_SIG_UNBLOCK 2 -#define OSF1_SIG_SETMASK 3 - - -typedef u_long osf1_sigset_t; -typedef void (*osf1_handler_t)(int); - -struct osf1_sigaction { - osf1_handler_t osa_handler; - osf1_sigset_t osa_mask; - int osa_flags; -}; - -struct osf1_sigaltstack { - caddr_t ss_sp; - int ss_flags; - size_t ss_size; -}; - -/* sa_flags */ -#define OSF1_SA_ONSTACK 0x00000001 -#define OSF1_SA_RESTART 0x00000002 -#define OSF1_SA_NOCLDSTOP 0x00000004 -#define OSF1_SA_NODEFER 0x00000008 -#define OSF1_SA_RESETHAND 0x00000010 -#define OSF1_SA_NOCLDWAIT 0x00000020 -#define OSF1_SA_SIGINFO 0x00000040 - -/* ss_flags */ -#define OSF1_SS_ONSTACK 0x00000001 -#define OSF1_SS_DISABLE 0x00000002 - - -#define OSF1_SIGNO_MASK 0x00FF -#define OSF1_SIGNAL_MASK 0x0000 -#define OSF1_SIGDEFER_MASK 0x0100 -#define OSF1_SIGHOLD_MASK 0x0200 -#define OSF1_SIGRELSE_MASK 0x0400 -#define OSF1_SIGIGNORE_MASK 0x0800 -#define OSF1_SIGPAUSE_MASK 0x1000 - - -extern int osf1_to_linux_sig[]; -void bsd_to_osf1_sigaltstack(const struct sigaltstack *, struct osf1_sigaltstack *); -void bsd_to_osf1_sigset(const sigset_t *, osf1_sigset_t *); -void osf1_to_bsd_sigaltstack(const struct osf1_sigaltstack *, struct sigaltstack *); -void osf1_to_bsd_sigset(const osf1_sigset_t *, sigset_t *); -void osf1_sendsig(sig_t, struct ksiginfo *, sigset_t *); - - -#endif /* !_OSF1_SIGNAL_H */ diff --git a/sys/alpha/osf1/osf1_syscall.h b/sys/alpha/osf1/osf1_syscall.h deleted file mode 100644 index 8a5ab95..0000000 --- a/sys/alpha/osf1/osf1_syscall.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * System call numbers. - * - * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD$ - * created from; FreeBSD: src/sys/alpha/osf1/syscalls.master,v 1.12 2005/07/13 20:32:42 jhb Exp - */ - -#define OSF1_SYS_nosys 0 -#define OSF1_SYS_exit 1 -#define OSF1_SYS_fork 2 -#define OSF1_SYS_read 3 -#define OSF1_SYS_write 4 -#define OSF1_SYS_close 6 -#define OSF1_SYS_osf1_wait4 7 -#define OSF1_SYS_link 9 -#define OSF1_SYS_unlink 10 -#define OSF1_SYS_chdir 12 -#define OSF1_SYS_fchdir 13 -#define OSF1_SYS_osf1_mknod 14 -#define OSF1_SYS_chmod 15 -#define OSF1_SYS_chown 16 -#define OSF1_SYS_obreak 17 -#define OSF1_SYS_osf1_getfsstat 18 -#define OSF1_SYS_osf1_lseek 19 -#define OSF1_SYS_getpid 20 -#define OSF1_SYS_osf1_mount 21 -#define OSF1_SYS_osf1_unmount 22 -#define OSF1_SYS_osf1_setuid 23 -#define OSF1_SYS_getuid 24 -#define OSF1_SYS_recvfrom 29 -#define OSF1_SYS_accept 30 -#define OSF1_SYS_getpeername 31 -#define OSF1_SYS_getsockname 32 -#define OSF1_SYS_osf1_access 33 -#define OSF1_SYS_sync 36 -#define OSF1_SYS_osf1_kill 37 -#define OSF1_SYS_setpgid 39 -#define OSF1_SYS_dup 41 -#define OSF1_SYS_pipe 42 -#define OSF1_SYS_osf1_set_program_attributes 43 -#define OSF1_SYS_osf1_open 45 - /* 46 is obsolete sigaction */ -#define OSF1_SYS_getgid 47 -#define OSF1_SYS_osf1_sigprocmask 48 -#define OSF1_SYS_getlogin 49 -#define OSF1_SYS_setlogin 50 -#define OSF1_SYS_acct 51 -#define OSF1_SYS_osf1_sigpending 52 -#define OSF1_SYS_osf1_classcntl 53 -#define OSF1_SYS_osf1_ioctl 54 -#define OSF1_SYS_osf1_reboot 55 -#define OSF1_SYS_revoke 56 -#define OSF1_SYS_symlink 57 -#define OSF1_SYS_readlink 58 -#define OSF1_SYS_osf1_execve 59 -#define OSF1_SYS_umask 60 -#define OSF1_SYS_chroot 61 -#define OSF1_SYS_getpgrp 63 -#define OSF1_SYS_ogetpagesize 64 -#define OSF1_SYS_vfork 66 -#define OSF1_SYS_osf1_stat 67 -#define OSF1_SYS_osf1_lstat 68 -#define OSF1_SYS_osf1_mmap 71 -#define OSF1_SYS_munmap 73 -#define OSF1_SYS_mprotect 74 -#define OSF1_SYS_osf1_madvise 75 -#define OSF1_SYS_getgroups 79 -#define OSF1_SYS_setgroups 80 -#define OSF1_SYS_osf1_setpgrp 82 -#define OSF1_SYS_osf1_setitimer 83 -#define OSF1_SYS_osf1_table 85 -#define OSF1_SYS_osf1_getitimer 86 -#define OSF1_SYS_ogethostname 87 -#define OSF1_SYS_osethostname 88 -#define OSF1_SYS_getdtablesize 89 -#define OSF1_SYS_dup2 90 -#define OSF1_SYS_osf1_fstat 91 -#define OSF1_SYS_osf1_fcntl 92 -#define OSF1_SYS_osf1_select 93 -#define OSF1_SYS_poll 94 -#define OSF1_SYS_fsync 95 -#define OSF1_SYS_setpriority 96 -#define OSF1_SYS_osf1_socket 97 -#define OSF1_SYS_connect 98 -#define OSF1_SYS_oaccept 99 -#define OSF1_SYS_getpriority 100 -#define OSF1_SYS_osend 101 -#define OSF1_SYS_orecv 102 -#define OSF1_SYS_osf1_sigreturn 103 -#define OSF1_SYS_bind 104 -#define OSF1_SYS_setsockopt 105 -#define OSF1_SYS_listen 106 -#define OSF1_SYS_osf1_sigsuspend 111 -#define OSF1_SYS_osf1_osigstack 112 -#define OSF1_SYS_osf1_gettimeofday 116 -#define OSF1_SYS_osf1_getrusage 117 -#define OSF1_SYS_getsockopt 118 -#define OSF1_SYS_osf1_readv 120 -#define OSF1_SYS_osf1_writev 121 -#define OSF1_SYS_settimeofday 122 -#define OSF1_SYS_fchown 123 -#define OSF1_SYS_fchmod 124 -#define OSF1_SYS_orecvfrom 125 -#define OSF1_SYS_setreuid 126 -#define OSF1_SYS_setregid 127 -#define OSF1_SYS_rename 128 -#define OSF1_SYS_osf1_truncate 129 -#define OSF1_SYS_osf1_ftruncate 130 -#define OSF1_SYS_flock 131 -#define OSF1_SYS_osf1_setgid 132 -#define OSF1_SYS_osf1_sendto 133 -#define OSF1_SYS_shutdown 134 -#define OSF1_SYS_mkdir 136 -#define OSF1_SYS_rmdir 137 -#define OSF1_SYS_utimes 138 - /* 139 is obsolete 4.2 sigreturn */ -#define OSF1_SYS_ogetpeername 141 -#define OSF1_SYS_ogethostid 142 -#define OSF1_SYS_osethostid 143 -#define OSF1_SYS_osf1_getrlimit 144 -#define OSF1_SYS_osf1_setrlimit 145 -#define OSF1_SYS_setsid 147 -#define OSF1_SYS_oquota 149 -#define OSF1_SYS_ogetsockname 150 -#define OSF1_SYS_osf1_sigaction 156 -#define OSF1_SYS_ogetdirentries 159 -#define OSF1_SYS_osf1_statfs 160 -#define OSF1_SYS_osf1_fstatfs 161 -#define OSF1_SYS_getdomainname 165 -#define OSF1_SYS_setdomainname 166 -#define OSF1_SYS_msgctl 200 -#define OSF1_SYS_msgget 201 -#define OSF1_SYS_msgrcv 202 -#define OSF1_SYS_msgsnd 203 -#define OSF1_SYS___semctl 204 -#define OSF1_SYS_semget 205 -#define OSF1_SYS_semop 206 -#define OSF1_SYS_uname 207 -#define OSF1_SYS_lchown 208 -#define OSF1_SYS_shmat 209 -#define OSF1_SYS_shmctl 210 -#define OSF1_SYS_shmdt 211 -#define OSF1_SYS_shmget 212 -#define OSF1_SYS_osf1_msync 217 -#define OSF1_SYS_osf1_signal 218 -#define OSF1_SYS_getpgid 233 -#define OSF1_SYS_getsid 234 -#define OSF1_SYS_osf1_sigaltstack 235 -#define OSF1_SYS_osf1_sysinfo 241 -#define OSF1_SYS_osf1_proplist_syscall 244 -#define OSF1_SYS_osf1_ntpadjtime 245 -#define OSF1_SYS_osf1_ntpgettime 246 -#define OSF1_SYS_osf1_pathconf 247 -#define OSF1_SYS_osf1_fpathconf 248 -#define OSF1_SYS_osf1_uswitch 250 -#define OSF1_SYS_osf1_usleep_thread 251 -#define OSF1_SYS_osf1_getsysinfo 256 -#define OSF1_SYS_osf1_setsysinfo 257 -#define OSF1_SYS_MAXSYSCALL 301 diff --git a/sys/alpha/osf1/osf1_sysent.c b/sys/alpha/osf1/osf1_sysent.c deleted file mode 100644 index 356721f..0000000 --- a/sys/alpha/osf1/osf1_sysent.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - * System call switch table. - * - * DO NOT EDIT-- this file is automatically generated. - * $FreeBSD$ - * created from; FreeBSD: src/sys/alpha/osf1/syscalls.master,v 1.12 2005/07/13 20:32:42 jhb Exp - */ - -#include <bsm/audit_kevents.h> -#include "opt_compat.h" -#include <sys/param.h> -#include <sys/sysent.h> -#include <sys/sysproto.h> -#include <alpha/osf1/osf1.h> -#include <alpha/osf1/osf1_signal.h> -#include <alpha/osf1/osf1_proto.h> - -#define AS(name) (sizeof(struct name) / sizeof(register_t)) - -/* The casts are bogus but will do for now. */ -struct sysent osf1_sysent[] = { - { SYF_MPSAFE | 0, (sy_call_t *)nosys, AUE_NULL }, /* 0 = nosys */ - { SYF_MPSAFE | AS(sys_exit_args), (sy_call_t *)sys_exit, AUE_NULL }, /* 1 = exit */ - { SYF_MPSAFE | 0, (sy_call_t *)fork, AUE_NULL }, /* 2 = fork */ - { SYF_MPSAFE | AS(read_args), (sy_call_t *)read, AUE_NULL }, /* 3 = read */ - { SYF_MPSAFE | AS(write_args), (sy_call_t *)write, AUE_NULL }, /* 4 = write */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 5 = old open */ - { SYF_MPSAFE | AS(close_args), (sy_call_t *)close, AUE_NULL }, /* 6 = close */ - { SYF_MPSAFE | AS(osf1_wait4_args), (sy_call_t *)osf1_wait4, AUE_NULL }, /* 7 = osf1_wait4 */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 8 = old creat */ - { SYF_MPSAFE | AS(link_args), (sy_call_t *)link, AUE_NULL }, /* 9 = link */ - { SYF_MPSAFE | AS(unlink_args), (sy_call_t *)unlink, AUE_NULL }, /* 10 = unlink */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 11 = execv */ - { SYF_MPSAFE | AS(chdir_args), (sy_call_t *)chdir, AUE_NULL }, /* 12 = chdir */ - { SYF_MPSAFE | AS(fchdir_args), (sy_call_t *)fchdir, AUE_NULL }, /* 13 = fchdir */ - { SYF_MPSAFE | AS(osf1_mknod_args), (sy_call_t *)osf1_mknod, AUE_NULL }, /* 14 = osf1_mknod */ - { SYF_MPSAFE | AS(chmod_args), (sy_call_t *)chmod, AUE_NULL }, /* 15 = chmod */ - { SYF_MPSAFE | AS(chown_args), (sy_call_t *)chown, AUE_NULL }, /* 16 = chown */ - { SYF_MPSAFE | AS(obreak_args), (sy_call_t *)obreak, AUE_NULL }, /* 17 = obreak */ - { SYF_MPSAFE | AS(osf1_getfsstat_args), (sy_call_t *)osf1_getfsstat, AUE_NULL }, /* 18 = osf1_getfsstat */ - { SYF_MPSAFE | AS(osf1_lseek_args), (sy_call_t *)osf1_lseek, AUE_NULL }, /* 19 = osf1_lseek */ - { SYF_MPSAFE | 0, (sy_call_t *)getpid, AUE_NULL }, /* 20 = getpid */ - { AS(osf1_mount_args), (sy_call_t *)osf1_mount, AUE_NULL }, /* 21 = osf1_mount */ - { AS(osf1_unmount_args), (sy_call_t *)osf1_unmount, AUE_NULL }, /* 22 = osf1_unmount */ - { SYF_MPSAFE | AS(osf1_setuid_args), (sy_call_t *)osf1_setuid, AUE_NULL }, /* 23 = osf1_setuid */ - { SYF_MPSAFE | 0, (sy_call_t *)getuid, AUE_NULL }, /* 24 = getuid */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 25 = exec_with_loader */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 26 = ptrace */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 27 = recvmsg */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 28 = sendmsg */ - { SYF_MPSAFE | AS(recvfrom_args), (sy_call_t *)recvfrom, AUE_NULL }, /* 29 = recvfrom */ - { SYF_MPSAFE | AS(accept_args), (sy_call_t *)accept, AUE_NULL }, /* 30 = accept */ - { SYF_MPSAFE | AS(getpeername_args), (sy_call_t *)getpeername, AUE_NULL }, /* 31 = getpeername */ - { SYF_MPSAFE | AS(getsockname_args), (sy_call_t *)getsockname, AUE_NULL }, /* 32 = getsockname */ - { SYF_MPSAFE | AS(osf1_access_args), (sy_call_t *)osf1_access, AUE_NULL }, /* 33 = osf1_access */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 34 = chflags */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 35 = fchflags */ - { SYF_MPSAFE | 0, (sy_call_t *)sync, AUE_NULL }, /* 36 = sync */ - { SYF_MPSAFE | AS(osf1_kill_args), (sy_call_t *)osf1_kill, AUE_NULL }, /* 37 = osf1_kill */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 38 = old stat */ - { SYF_MPSAFE | AS(setpgid_args), (sy_call_t *)setpgid, AUE_NULL }, /* 39 = setpgid */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 40 = old lstat */ - { SYF_MPSAFE | AS(dup_args), (sy_call_t *)dup, AUE_NULL }, /* 41 = dup */ - { SYF_MPSAFE | 0, (sy_call_t *)pipe, AUE_NULL }, /* 42 = pipe */ - { AS(osf1_set_program_attributes_args), (sy_call_t *)osf1_set_program_attributes, AUE_NULL }, /* 43 = osf1_set_program_attributes */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 44 = profil */ - { SYF_MPSAFE | AS(osf1_open_args), (sy_call_t *)osf1_open, AUE_NULL }, /* 45 = osf1_open */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 46 = obsolete sigaction */ - { SYF_MPSAFE | 0, (sy_call_t *)getgid, AUE_NULL }, /* 47 = getgid */ - { SYF_MPSAFE | AS(osf1_sigprocmask_args), (sy_call_t *)osf1_sigprocmask, AUE_NULL }, /* 48 = osf1_sigprocmask */ - { SYF_MPSAFE | AS(getlogin_args), (sy_call_t *)getlogin, AUE_NULL }, /* 49 = getlogin */ - { SYF_MPSAFE | AS(setlogin_args), (sy_call_t *)setlogin, AUE_NULL }, /* 50 = setlogin */ - { SYF_MPSAFE | AS(acct_args), (sy_call_t *)acct, AUE_NULL }, /* 51 = acct */ - { SYF_MPSAFE | AS(osf1_sigpending_args), (sy_call_t *)osf1_sigpending, AUE_NULL }, /* 52 = osf1_sigpending */ - { SYF_MPSAFE | AS(osf1_classcntl_args), (sy_call_t *)osf1_classcntl, AUE_NULL }, /* 53 = osf1_classcntl */ - { AS(osf1_ioctl_args), (sy_call_t *)osf1_ioctl, AUE_NULL }, /* 54 = osf1_ioctl */ - { SYF_MPSAFE | AS(osf1_reboot_args), (sy_call_t *)osf1_reboot, AUE_NULL }, /* 55 = osf1_reboot */ - { SYF_MPSAFE | AS(revoke_args), (sy_call_t *)revoke, AUE_NULL }, /* 56 = revoke */ - { SYF_MPSAFE | AS(symlink_args), (sy_call_t *)symlink, AUE_NULL }, /* 57 = symlink */ - { SYF_MPSAFE | AS(readlink_args), (sy_call_t *)readlink, AUE_NULL }, /* 58 = readlink */ - { SYF_MPSAFE | AS(osf1_execve_args), (sy_call_t *)osf1_execve, AUE_NULL }, /* 59 = osf1_execve */ - { SYF_MPSAFE | AS(umask_args), (sy_call_t *)umask, AUE_NULL }, /* 60 = umask */ - { SYF_MPSAFE | AS(chroot_args), (sy_call_t *)chroot, AUE_NULL }, /* 61 = chroot */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 62 = old fstat */ - { SYF_MPSAFE | 0, (sy_call_t *)getpgrp, AUE_NULL }, /* 63 = getpgrp */ - { SYF_MPSAFE | 0, (sy_call_t *)ogetpagesize, AUE_NULL }, /* 64 = ogetpagesize */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 65 = mremap */ - { SYF_MPSAFE | 0, (sy_call_t *)vfork, AUE_NULL }, /* 66 = vfork */ - { SYF_MPSAFE | AS(osf1_stat_args), (sy_call_t *)osf1_stat, AUE_NULL }, /* 67 = osf1_stat */ - { SYF_MPSAFE | AS(osf1_lstat_args), (sy_call_t *)osf1_lstat, AUE_NULL }, /* 68 = osf1_lstat */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 69 = sbrk */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 70 = sstk */ - { AS(osf1_mmap_args), (sy_call_t *)osf1_mmap, AUE_NULL }, /* 71 = osf1_mmap */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 72 = ovadvise */ - { SYF_MPSAFE | AS(munmap_args), (sy_call_t *)munmap, AUE_NULL }, /* 73 = munmap */ - { SYF_MPSAFE | AS(mprotect_args), (sy_call_t *)mprotect, AUE_NULL }, /* 74 = mprotect */ - { SYF_MPSAFE | 0, (sy_call_t *)osf1_madvise, AUE_NULL }, /* 75 = osf1_madvise */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 76 = old vhangup */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 77 = kmodcall */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 78 = mincore */ - { SYF_MPSAFE | AS(getgroups_args), (sy_call_t *)getgroups, AUE_NULL }, /* 79 = getgroups */ - { SYF_MPSAFE | AS(setgroups_args), (sy_call_t *)setgroups, AUE_NULL }, /* 80 = setgroups */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 81 = old getpgrp */ - { SYF_MPSAFE | AS(osf1_setpgrp_args), (sy_call_t *)osf1_setpgrp, AUE_NULL }, /* 82 = osf1_setpgrp */ - { SYF_MPSAFE | AS(osf1_setitimer_args), (sy_call_t *)osf1_setitimer, AUE_NULL }, /* 83 = osf1_setitimer */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 84 = old wait */ - { SYF_MPSAFE | AS(osf1_table_args), (sy_call_t *)osf1_table, AUE_NULL }, /* 85 = osf1_table */ - { SYF_MPSAFE | AS(osf1_getitimer_args), (sy_call_t *)osf1_getitimer, AUE_NULL }, /* 86 = osf1_getitimer */ - { SYF_MPSAFE | AS(gethostname_args), (sy_call_t *)ogethostname, AUE_NULL }, /* 87 = ogethostname */ - { SYF_MPSAFE | AS(sethostname_args), (sy_call_t *)osethostname, AUE_NULL }, /* 88 = osethostname */ - { SYF_MPSAFE | 0, (sy_call_t *)getdtablesize, AUE_NULL }, /* 89 = getdtablesize */ - { SYF_MPSAFE | AS(dup2_args), (sy_call_t *)dup2, AUE_NULL }, /* 90 = dup2 */ - { SYF_MPSAFE | AS(osf1_fstat_args), (sy_call_t *)osf1_fstat, AUE_NULL }, /* 91 = osf1_fstat */ - { SYF_MPSAFE | AS(osf1_fcntl_args), (sy_call_t *)osf1_fcntl, AUE_NULL }, /* 92 = osf1_fcntl */ - { SYF_MPSAFE | AS(osf1_select_args), (sy_call_t *)osf1_select, AUE_NULL }, /* 93 = osf1_select */ - { SYF_MPSAFE | AS(poll_args), (sy_call_t *)poll, AUE_NULL }, /* 94 = poll */ - { SYF_MPSAFE | AS(fsync_args), (sy_call_t *)fsync, AUE_NULL }, /* 95 = fsync */ - { SYF_MPSAFE | AS(setpriority_args), (sy_call_t *)setpriority, AUE_NULL }, /* 96 = setpriority */ - { SYF_MPSAFE | AS(osf1_socket_args), (sy_call_t *)osf1_socket, AUE_NULL }, /* 97 = osf1_socket */ - { SYF_MPSAFE | AS(connect_args), (sy_call_t *)connect, AUE_NULL }, /* 98 = connect */ - { SYF_MPSAFE | AS(accept_args), (sy_call_t *)oaccept, AUE_NULL }, /* 99 = oaccept */ - { SYF_MPSAFE | AS(getpriority_args), (sy_call_t *)getpriority, AUE_NULL }, /* 100 = getpriority */ - { SYF_MPSAFE | AS(osend_args), (sy_call_t *)osend, AUE_NULL }, /* 101 = osend */ - { SYF_MPSAFE | AS(orecv_args), (sy_call_t *)orecv, AUE_NULL }, /* 102 = orecv */ - { SYF_MPSAFE | AS(osf1_sigreturn_args), (sy_call_t *)osf1_sigreturn, AUE_NULL }, /* 103 = osf1_sigreturn */ - { SYF_MPSAFE | AS(bind_args), (sy_call_t *)bind, AUE_NULL }, /* 104 = bind */ - { SYF_MPSAFE | AS(setsockopt_args), (sy_call_t *)setsockopt, AUE_NULL }, /* 105 = setsockopt */ - { SYF_MPSAFE | AS(listen_args), (sy_call_t *)listen, AUE_NULL }, /* 106 = listen */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 107 = plock */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 108 = old sigvec */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 109 = old sigblock */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 110 = old sigsetmask */ - { SYF_MPSAFE | AS(osf1_sigsuspend_args), (sy_call_t *)osf1_sigsuspend, AUE_NULL }, /* 111 = osf1_sigsuspend */ - { SYF_MPSAFE | AS(osf1_osigstack_args), (sy_call_t *)osf1_osigstack, AUE_NULL }, /* 112 = osf1_osigstack */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 113 = old recvmsg */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 114 = old sendmsg */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 115 = vtrace */ - { SYF_MPSAFE | AS(osf1_gettimeofday_args), (sy_call_t *)osf1_gettimeofday, AUE_NULL }, /* 116 = osf1_gettimeofday */ - { SYF_MPSAFE | AS(osf1_getrusage_args), (sy_call_t *)osf1_getrusage, AUE_NULL }, /* 117 = osf1_getrusage */ - { SYF_MPSAFE | AS(getsockopt_args), (sy_call_t *)getsockopt, AUE_NULL }, /* 118 = getsockopt */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 119 = */ - { SYF_MPSAFE | AS(osf1_readv_args), (sy_call_t *)osf1_readv, AUE_NULL }, /* 120 = osf1_readv */ - { SYF_MPSAFE | AS(osf1_writev_args), (sy_call_t *)osf1_writev, AUE_NULL }, /* 121 = osf1_writev */ - { SYF_MPSAFE | AS(settimeofday_args), (sy_call_t *)settimeofday, AUE_NULL }, /* 122 = settimeofday */ - { SYF_MPSAFE | AS(fchown_args), (sy_call_t *)fchown, AUE_NULL }, /* 123 = fchown */ - { SYF_MPSAFE | AS(fchmod_args), (sy_call_t *)fchmod, AUE_NULL }, /* 124 = fchmod */ - { SYF_MPSAFE | AS(recvfrom_args), (sy_call_t *)orecvfrom, AUE_NULL }, /* 125 = orecvfrom */ - { SYF_MPSAFE | AS(setreuid_args), (sy_call_t *)setreuid, AUE_NULL }, /* 126 = setreuid */ - { SYF_MPSAFE | AS(setregid_args), (sy_call_t *)setregid, AUE_NULL }, /* 127 = setregid */ - { SYF_MPSAFE | AS(rename_args), (sy_call_t *)rename, AUE_NULL }, /* 128 = rename */ - { SYF_MPSAFE | AS(osf1_truncate_args), (sy_call_t *)osf1_truncate, AUE_NULL }, /* 129 = osf1_truncate */ - { SYF_MPSAFE | AS(osf1_ftruncate_args), (sy_call_t *)osf1_ftruncate, AUE_NULL }, /* 130 = osf1_ftruncate */ - { SYF_MPSAFE | AS(flock_args), (sy_call_t *)flock, AUE_NULL }, /* 131 = flock */ - { SYF_MPSAFE | AS(osf1_setgid_args), (sy_call_t *)osf1_setgid, AUE_NULL }, /* 132 = osf1_setgid */ - { SYF_MPSAFE | AS(osf1_sendto_args), (sy_call_t *)osf1_sendto, AUE_NULL }, /* 133 = osf1_sendto */ - { SYF_MPSAFE | AS(shutdown_args), (sy_call_t *)shutdown, AUE_NULL }, /* 134 = shutdown */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 135 = socketpair */ - { SYF_MPSAFE | AS(mkdir_args), (sy_call_t *)mkdir, AUE_NULL }, /* 136 = mkdir */ - { SYF_MPSAFE | AS(rmdir_args), (sy_call_t *)rmdir, AUE_NULL }, /* 137 = rmdir */ - { SYF_MPSAFE | AS(utimes_args), (sy_call_t *)utimes, AUE_NULL }, /* 138 = utimes */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 139 = obsolete 4.2 sigreturn */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 140 = adjtime */ - { SYF_MPSAFE | AS(ogetpeername_args), (sy_call_t *)ogetpeername, AUE_NULL }, /* 141 = ogetpeername */ - { SYF_MPSAFE | 0, (sy_call_t *)ogethostid, AUE_NULL }, /* 142 = ogethostid */ - { SYF_MPSAFE | AS(osethostid_args), (sy_call_t *)osethostid, AUE_NULL }, /* 143 = osethostid */ - { SYF_MPSAFE | AS(osf1_getrlimit_args), (sy_call_t *)osf1_getrlimit, AUE_NULL }, /* 144 = osf1_getrlimit */ - { SYF_MPSAFE | AS(osf1_setrlimit_args), (sy_call_t *)osf1_setrlimit, AUE_NULL }, /* 145 = osf1_setrlimit */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 146 = old killpg */ - { SYF_MPSAFE | 0, (sy_call_t *)setsid, AUE_NULL }, /* 147 = setsid */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 148 = quotactl */ - { SYF_MPSAFE | 0, (sy_call_t *)oquota, AUE_NULL }, /* 149 = oquota */ - { SYF_MPSAFE | AS(getsockname_args), (sy_call_t *)ogetsockname, AUE_NULL }, /* 150 = ogetsockname */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 151 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 152 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 153 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 154 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 155 = */ - { SYF_MPSAFE | AS(osf1_sigaction_args), (sy_call_t *)osf1_sigaction, AUE_NULL }, /* 156 = osf1_sigaction */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 157 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 158 = nfssvc */ - { AS(ogetdirentries_args), (sy_call_t *)ogetdirentries, AUE_NULL }, /* 159 = ogetdirentries */ - { SYF_MPSAFE | AS(osf1_statfs_args), (sy_call_t *)osf1_statfs, AUE_NULL }, /* 160 = osf1_statfs */ - { SYF_MPSAFE | AS(osf1_fstatfs_args), (sy_call_t *)osf1_fstatfs, AUE_NULL }, /* 161 = osf1_fstatfs */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 162 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 163 = async_daemon */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 164 = getfh */ - { SYF_MPSAFE | AS(getdomainname_args), (sy_call_t *)getdomainname, AUE_NULL }, /* 165 = getdomainname */ - { SYF_MPSAFE | AS(setdomainname_args), (sy_call_t *)setdomainname, AUE_NULL }, /* 166 = setdomainname */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 167 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 168 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 169 = exportfs */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 170 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 171 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 172 = alt msgctl */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 173 = alt msgget */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 174 = alt msgrcv */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 175 = alt msgsnd */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 176 = alt semctl */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 177 = alt semget */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 178 = alt semop */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 179 = alt uname */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 180 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 181 = alt plock */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 182 = lockf */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 183 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 184 = getmnt */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 185 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 186 = unmount */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 187 = alt sigpending */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 188 = alt setsid */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 189 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 190 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 191 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 192 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 193 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 194 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 195 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 196 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 197 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 198 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 199 = swapon */ - { SYF_MPSAFE | AS(msgctl_args), (sy_call_t *)msgctl, AUE_NULL }, /* 200 = msgctl */ - { SYF_MPSAFE | AS(msgget_args), (sy_call_t *)msgget, AUE_NULL }, /* 201 = msgget */ - { SYF_MPSAFE | AS(msgrcv_args), (sy_call_t *)msgrcv, AUE_NULL }, /* 202 = msgrcv */ - { SYF_MPSAFE | AS(msgsnd_args), (sy_call_t *)msgsnd, AUE_NULL }, /* 203 = msgsnd */ - { SYF_MPSAFE | AS(__semctl_args), (sy_call_t *)__semctl, AUE_NULL }, /* 204 = __semctl */ - { SYF_MPSAFE | AS(semget_args), (sy_call_t *)semget, AUE_NULL }, /* 205 = semget */ - { SYF_MPSAFE | AS(semop_args), (sy_call_t *)semop, AUE_NULL }, /* 206 = semop */ - { SYF_MPSAFE | AS(uname_args), (sy_call_t *)uname, AUE_NULL }, /* 207 = uname */ - { SYF_MPSAFE | AS(lchown_args), (sy_call_t *)lchown, AUE_NULL }, /* 208 = lchown */ - { SYF_MPSAFE | AS(shmat_args), (sy_call_t *)shmat, AUE_NULL }, /* 209 = shmat */ - { SYF_MPSAFE | AS(shmctl_args), (sy_call_t *)shmctl, AUE_NULL }, /* 210 = shmctl */ - { SYF_MPSAFE | AS(shmdt_args), (sy_call_t *)shmdt, AUE_NULL }, /* 211 = shmdt */ - { SYF_MPSAFE | AS(shmget_args), (sy_call_t *)shmget, AUE_NULL }, /* 212 = shmget */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 213 = mvalid */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 214 = getaddressconf */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 215 = msleep */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 216 = mwakeup */ - { SYF_MPSAFE | AS(osf1_msync_args), (sy_call_t *)osf1_msync, AUE_NULL }, /* 217 = osf1_msync */ - { SYF_MPSAFE | AS(osf1_signal_args), (sy_call_t *)osf1_signal, AUE_NULL }, /* 218 = osf1_signal */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 219 = utc gettime */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 220 = utc adjtime */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 221 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 222 = security */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 223 = kloadcall */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 224 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 225 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 226 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 227 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 228 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 229 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 230 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 231 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 232 = */ - { SYF_MPSAFE | AS(getpgid_args), (sy_call_t *)getpgid, AUE_NULL }, /* 233 = getpgid */ - { SYF_MPSAFE | AS(getsid_args), (sy_call_t *)getsid, AUE_NULL }, /* 234 = getsid */ - { SYF_MPSAFE | AS(osf1_sigaltstack_args), (sy_call_t *)osf1_sigaltstack, AUE_NULL }, /* 235 = osf1_sigaltstack */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 236 = waitid */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 237 = priocntlset */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 238 = sigsendset */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 239 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 240 = msfs_syscall */ - { SYF_MPSAFE | AS(osf1_sysinfo_args), (sy_call_t *)osf1_sysinfo, AUE_NULL }, /* 241 = osf1_sysinfo */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 242 = uadmin */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 243 = fuser */ - { SYF_MPSAFE | 0, (sy_call_t *)osf1_proplist_syscall, AUE_NULL }, /* 244 = osf1_proplist_syscall */ - { SYF_MPSAFE | AS(osf1_ntpadjtime_args), (sy_call_t *)osf1_ntpadjtime, AUE_NULL }, /* 245 = osf1_ntpadjtime */ - { SYF_MPSAFE | AS(osf1_ntpgettime_args), (sy_call_t *)osf1_ntpgettime, AUE_NULL }, /* 246 = osf1_ntpgettime */ - { SYF_MPSAFE | AS(osf1_pathconf_args), (sy_call_t *)osf1_pathconf, AUE_NULL }, /* 247 = osf1_pathconf */ - { SYF_MPSAFE | AS(osf1_fpathconf_args), (sy_call_t *)osf1_fpathconf, AUE_NULL }, /* 248 = osf1_fpathconf */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 249 = */ - { AS(osf1_uswitch_args), (sy_call_t *)osf1_uswitch, AUE_NULL }, /* 250 = osf1_uswitch */ - { SYF_MPSAFE | AS(osf1_usleep_thread_args), (sy_call_t *)osf1_usleep_thread, AUE_NULL }, /* 251 = osf1_usleep_thread */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 252 = audcntl */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 253 = audgen */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 254 = sysfs */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 255 = */ - { SYF_MPSAFE | AS(osf1_getsysinfo_args), (sy_call_t *)osf1_getsysinfo, AUE_NULL }, /* 256 = osf1_getsysinfo */ - { SYF_MPSAFE | AS(osf1_setsysinfo_args), (sy_call_t *)osf1_setsysinfo, AUE_NULL }, /* 257 = osf1_setsysinfo */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 258 = afs_syscall */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 259 = swapctl */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 260 = memcntl */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 261 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 262 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 263 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 264 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 265 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 266 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 267 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 268 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 269 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 270 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 271 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 272 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 273 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 274 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 275 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 276 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 277 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 278 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 279 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 280 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 281 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 282 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 283 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 284 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 285 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 286 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 287 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 288 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 289 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 290 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 291 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 292 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 293 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 294 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 295 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 296 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 297 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 298 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 299 = */ - { 0, (sy_call_t *)nosys, AUE_NULL }, /* 300 = */ -}; diff --git a/sys/alpha/osf1/osf1_sysvec.c b/sys/alpha/osf1/osf1_sysvec.c deleted file mode 100644 index 8182553..0000000 --- a/sys/alpha/osf1/osf1_sysvec.c +++ /dev/null @@ -1,148 +0,0 @@ -/*- - * Copyright (c) 1998-1999 Andrew Gallatin - * All rights reserved. - * - * Based heavily on linux_sysvec.c - * Which is Copyright (c) 1994-1996 Søren Schmidt - * - * 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 - * in this position and unchanged. - * 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. 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -/* XXX we use functions that might not exist. */ -#include "opt_compat.h" - -#ifndef COMPAT_43 -#error "Unable to compile Osf1-emulator due to missing COMPAT_43 option!" -#endif - -#include <sys/param.h> -#include <sys/proc.h> -#include <sys/systm.h> -#include <sys/sysent.h> -#include <sys/imgact.h> -#include <sys/imgact_aout.h> -#include <sys/imgact_elf.h> -#include <sys/malloc.h> -#include <alpha/osf1/exec_ecoff.h> -#include <alpha/osf1/osf1_signal.h> -#include <alpha/osf1/osf1_syscall.h> -#include <alpha/osf1/osf1_util.h> -#include <alpha/osf1/osf1.h> - -MODULE_VERSION(osf1, 1); -MODULE_DEPEND(osf1, sysvmsg, 1, 1, 1); -MODULE_DEPEND(osf1, sysvsem, 1, 1, 1); -MODULE_DEPEND(osf1, sysvshm, 1, 1, 1); - -int osf1_szsigcode; -extern char sigcode[]; -static int osf1_freebsd_fixup(long **stack_base, struct image_params *imgp); - -struct sysentvec osf1_sysvec = { - OSF1_SYS_MAXSYSCALL, - osf1_sysent, - 0, - 0, - NULL, - 0, - NULL, - NULL, /* trap-to-signal translation function */ - osf1_freebsd_fixup, /* fixup */ - osf1_sendsig, - sigcode, /* use generic trampoline */ - &osf1_szsigcode, /* use generic trampoline size */ - NULL, /* prepsyscall */ - "OSF/1 ECOFF", - NULL, /* we don't have an ECOFF coredump function */ - NULL, - OSF1_MINSIGSTKSZ, - PAGE_SIZE, - VM_MIN_ADDRESS, - VM_MAXUSER_ADDRESS, - USRSTACK, - PS_STRINGS, - VM_PROT_ALL, - exec_copyout_strings, - exec_setregs, - NULL -}; - -/* - * Do some magic to setup the stack properly for the osf1 dynamic loader - * OSF/1 binaries need an auxargs vector describing the name of the - * executable (must be a full path). - * - * If we're executing a dynamic binary, the loader will expect its - * name, /sbin/loader, to be in the auxargs vectore as well. - * Bear in mind that when we execute a dynamic binary, we begin by - * executing the loader. The loader then takes care of mapping - * executable (which is why it needs the full path) - * and its requisite shared libs, then it transfers control - * to the executable after calling set_program_attributes(). - */ - -#define AUXARGS_ENTRY(pos, id, val) {suword(pos++, id); suword(pos++, val);} - -static int -osf1_freebsd_fixup(long **stack_base, struct image_params *imgp) -{ - char *destp; - int sz; - long *pos; - struct ps_strings *arginfo; - Osf_Auxargs *args; - - args = (Osf_Auxargs *)imgp->auxargs; - pos = *stack_base + (imgp->args->argc + imgp->args->envc + 2); - - arginfo = (struct ps_strings *)PS_STRINGS; - - sz = *(imgp->proc->p_sysent->sv_szsigcode); - destp = (caddr_t)arginfo - szsigcode - SPARE_USRSPACE - - roundup((ARG_MAX - imgp->args->stringspace), sizeof(char *)); - - destp -= imgp->args->stringspace; - - destp -= strlen(args->executable)+2; - copyout(args->executable, destp, strlen(args->executable)+1); - - AUXARGS_ENTRY(pos, OSF1_EXEC_NAME, (long)destp); - if (args->loader) { - /* the loader seems to want the name here, then it overwrites it with - the FD of the executable. I have NFC what's going on here.. */ - AUXARGS_ENTRY(pos, OSF1_EXEC_NAME, (long)destp); - destp-= (strlen("/sbin/loader")+1); - copyout("/sbin/loader", destp, strlen("/sbin/loader")+1); - AUXARGS_ENTRY(pos, OSF1_LOADER_NAME, (long)destp); - AUXARGS_ENTRY(pos, OSF1_LOADER_FLAGS, 0); - } - free(imgp->auxargs, M_TEMP); - imgp->auxargs = NULL; - (*stack_base)--; - **stack_base = (long)imgp->args->argc; - return 0; -} diff --git a/sys/alpha/osf1/osf1_util.h b/sys/alpha/osf1/osf1_util.h deleted file mode 100644 index f5a6ddf..0000000 --- a/sys/alpha/osf1/osf1_util.h +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * Copyright (c) 1998-1999 Andrew Gallatin - * 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 - * in this position and unchanged. - * 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. 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. - * - * $FreeBSD$ - */ - -#include <vm/vm.h> -#include <vm/vm_param.h> -#include <vm/pmap.h> - - -#include <sys/exec.h> -#include <sys/sysent.h> -#include <sys/cdefs.h> - -static __inline caddr_t stackgap_init(void); -static __inline void *stackgap_alloc(caddr_t *, size_t); - -static __inline caddr_t -stackgap_init() -{ -#define szsigcode (*(curproc->p_sysent->sv_szsigcode)) - return (caddr_t)(((caddr_t)PS_STRINGS) - szsigcode - SPARE_USRSPACE); -} - -static __inline void * -stackgap_alloc(sgp, sz) - caddr_t *sgp; - size_t sz; -{ - void *p; - - p = (void *) *sgp; - *sgp += ALIGN(sz); - return p; -} - - -int osf1_emul_find(struct thread *td, char *path, enum uio_seg pathseg, - char **pbuf, int create); - -#define CHECKALT(td, upath, pathp, i) \ - do { \ - int _error; \ - \ - _error = osf1_emul_find(td, upath, UIO_USERSPACE, pathp, i); \ - if (*(pathp) == NULL) \ - return (_error); \ - } while (0) - -#define CHECKALTEXIST(td, upath, pathp) CHECKALT((td), (upath), (pathp), 0) -#define CHECKALTCREAT(td, upath, pathp) CHECKALT((td), (upath), (pathp), 1) diff --git a/sys/alpha/osf1/syscalls.conf b/sys/alpha/osf1/syscalls.conf deleted file mode 100644 index 466046a..0000000 --- a/sys/alpha/osf1/syscalls.conf +++ /dev/null @@ -1,11 +0,0 @@ -# $FreeBSD$ -sysnames="/dev/null" -sysproto="osf1_proto.h" -sysproto_h=_OSF1_SYSPROTO_H_ -syshdr="osf1_syscall.h" -syssw="osf1_sysent.c" -sysmk="/dev/null" -syscallprefix="OSF1_SYS_" -switchname="osf1_sysent" -namesname="osf1_syscallnames" -sysvec="\n" diff --git a/sys/alpha/osf1/syscalls.master b/sys/alpha/osf1/syscalls.master deleted file mode 100644 index 1de440a..0000000 --- a/sys/alpha/osf1/syscalls.master +++ /dev/null @@ -1,443 +0,0 @@ -; $FreeBSD$ - -; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 -; System call name/number master file (or rather, slave, from OSF1). -; Processed to created osf1_sysent.c, osf1_syscalls.c and osf1_syscall.h. - -; Columns: number type nargs name alt{name,tag,rtyp}/comments -; number system call number, must be in order -; audit the audit event associated with the system call -; A value of AUE_NULL means no auditing, but it also means that -; there is no audit event for the call at this time. For the -; case where the event exists, but we don't want auditing, the -; event should be #defined to AUE_NULL in audit_kevents.h. -; type one of STD, OBSOL, UNIMPL, COMPAT -; name psuedo-prototype of syscall routine -; If one of the following alts is different, then all appear: -; altname name of system call if different -; alttag name of args struct tag if different from [o]`name'"_args" -; altrtyp return type if not int (bogus - syscalls always return int) -; for UNIMPL/OBSOL, name continues with comments - -; types: -; STD always included -; COMPAT included on COMPAT #ifdef -; LIBCOMPAT included on COMPAT #ifdef, and placed in syscall.h -; OBSOL obsolete, not included in system, only specifies name -; UNIMPL not implemented, placeholder only - -#include "opt_compat.h" -#include <sys/param.h> -#include <sys/sysent.h> -#include <sys/sysproto.h> -#include <alpha/osf1/osf1.h> -#include <alpha/osf1/osf1_signal.h> -#include <alpha/osf1/osf1_proto.h> - - -0 AUE_NULL MNOPROTO { int nosys(void); } -1 AUE_NULL MNOPROTO { void sys_exit(int rval); } exit \ - sys_exit_args void -2 AUE_NULL MNOPROTO { int fork(void); } -3 AUE_NULL MNOPROTO { ssize_t read(int fd, char *buf, \ - ssize_t nbyte); } -4 AUE_NULL MNOPROTO { ssize_t write(int fd, char *buf, \ - ssize_t nbyte); } -5 AUE_NULL UNIMPL old open -6 AUE_NULL MNOPROTO { int close(int fd); } -7 AUE_NULL MSTD { int osf1_wait4(int pid, int *status, \ - int options, \ - struct osf1_rusage *rusage); } -8 AUE_NULL UNIMPL old creat -9 AUE_NULL MNOPROTO { int link(char *path, char *link); } -10 AUE_NULL MNOPROTO { int unlink(char *path); } -11 AUE_NULL UNIMPL execv -12 AUE_NULL MNOPROTO { int chdir(char *path); } -13 AUE_NULL MNOPROTO { int fchdir(int fd); } -14 AUE_NULL MSTD { int osf1_mknod(char *path, int mode, \ - int dev); } -15 AUE_NULL MNOPROTO { int chmod(char *path, int mode); } -16 AUE_NULL MNOPROTO { int chown(char *path, int uid, int gid); } -17 AUE_NULL MNOPROTO { int obreak(char *nsize); } -18 AUE_NULL MSTD { int osf1_getfsstat( \ - struct osf1_statfs *buf, long bufsize, \ - int flags); } -19 AUE_NULL MSTD { off_t osf1_lseek(int fd, off_t offset, \ - int whence); } -20 AUE_NULL MNOPROTO { pid_t getpid(void); } -21 AUE_NULL STD { int osf1_mount(int type, char *path, \ - int flags, caddr_t data); } -22 AUE_NULL STD { int osf1_unmount(char *path, int flags); } -23 AUE_NULL MSTD { int osf1_setuid(uid_t uid); } -24 AUE_NULL MNOPROTO { uid_t getuid(void); } -25 AUE_NULL UNIMPL exec_with_loader -26 AUE_NULL UNIMPL ptrace -27 AUE_NULL UNIMPL recvmsg -28 AUE_NULL UNIMPL sendmsg -29 AUE_NULL MNOPROTO { int recvfrom(int s, caddr_t buf, \ - size_t len, int flags, caddr_t from, \ - int *fromlenaddr); } -30 AUE_NULL MNOPROTO { int accept(int s, caddr_t name, \ - int *anamelen); } -31 AUE_NULL MNOPROTO { int getpeername(int fdes, caddr_t asa, \ - int *alen); } -32 AUE_NULL MNOPROTO { int getsockname(int fdes, caddr_t asa, \ - int *alen); } -33 AUE_NULL MSTD { int osf1_access(char *path, int flags); } -34 AUE_NULL UNIMPL chflags -35 AUE_NULL UNIMPL fchflags -36 AUE_NULL MNOPROTO { int sync(void); } -37 AUE_NULL MSTD { int osf1_kill(int pid, int signum); } -38 AUE_NULL UNIMPL old stat -39 AUE_NULL MNOPROTO { int setpgid(int pid, int pgid); } -40 AUE_NULL UNIMPL old lstat -41 AUE_NULL MNOPROTO { int dup(u_int fd); } -42 AUE_NULL MNOPROTO { int pipe(void); } -43 AUE_NULL STD { int osf1_set_program_attributes( \ - vm_offset_t text_start, \ - vm_offset_t text_len, \ - vm_offset_t bss_start, \ - vm_offset_t bss_len); } -44 AUE_NULL UNIMPL profil -45 AUE_NULL MSTD { int osf1_open(char *path, int flags, \ - int mode); } -46 AUE_NULL OBSOL sigaction -47 AUE_NULL MNOPROTO { gid_t getgid(void); } -48 AUE_NULL MSTD { int osf1_sigprocmask(int how, \ - osf1_sigset_t mask); } -49 AUE_NULL MNOPROTO { int getlogin(char *namebuf, \ - u_int namelen); } -50 AUE_NULL MNOPROTO { int setlogin(char *namebuf); } -51 AUE_NULL MNOPROTO { int acct(char *path); } -52 AUE_NULL MSTD { int osf1_sigpending(struct proc *p, \ - osf1_sigset_t *mask ); } -53 AUE_NULL MSTD { int osf1_classcntl(int opcode, int arg1, \ - int arg2, int arg3);} -54 AUE_NULL STD { int osf1_ioctl(int fd, int com, \ - caddr_t data); } -55 AUE_NULL MSTD { int osf1_reboot(int opt); } -56 AUE_NULL MNOPROTO { int revoke(char *path); } -57 AUE_NULL MNOPROTO { int symlink(char *path, char *link); } -58 AUE_NULL MNOPROTO { int readlink(char *path, char *buf, \ - int count); } -59 AUE_NULL MSTD { int osf1_execve(char *path, char **argp, \ - char **envp); } -60 AUE_NULL MNOPROTO { int umask(int newmask); } -61 AUE_NULL MNOPROTO { int chroot(char *path); } -62 AUE_NULL UNIMPL old fstat -63 AUE_NULL MNOPROTO { int getpgrp(void); } -64 AUE_NULL MNOPROTO { int ogetpagesize(void); } -65 AUE_NULL UNIMPL mremap -66 AUE_NULL MNOPROTO { int vfork(void); } -67 AUE_NULL MSTD { int osf1_stat(char *path, \ - struct osf1_stat *ub); } -68 AUE_NULL MSTD { int osf1_lstat(char *path, \ - struct osf1_stat *ub); } -69 AUE_NULL UNIMPL sbrk -70 AUE_NULL UNIMPL sstk -71 AUE_NULL STD { caddr_t osf1_mmap(caddr_t addr, \ - size_t len, int prot, int flags, int fd, \ - off_t pos); } -72 AUE_NULL UNIMPL ovadvise -73 AUE_NULL MNOPROTO { int munmap(caddr_t addr, size_t len); } -74 AUE_NULL MNOPROTO { int mprotect(void *addr, size_t len, \ - int prot); } -; XXX -75 AUE_NULL MSTD { int osf1_madvise(void); } -76 AUE_NULL UNIMPL old vhangup -77 AUE_NULL UNIMPL kmodcall -78 AUE_NULL UNIMPL mincore -79 AUE_NULL MNOPROTO { int getgroups(u_int gidsetsize, \ - gid_t *gidset); } -80 AUE_NULL MNOPROTO { int setgroups(u_int gidsetsize, \ - gid_t *gidset); } -81 AUE_NULL UNIMPL old getpgrp -; OSF/1 setpgrp(); identical in function to setpgid(). XXX -82 AUE_NULL MSTD { int osf1_setpgrp(int pid, int pgid); } -83 AUE_NULL MSTD { int osf1_setitimer(u_int which, \ - struct itimerval *itv, \ - struct itimerval *oitv); } -84 AUE_NULL UNIMPL old wait -85 AUE_NULL MSTD { int osf1_table(long id, long index, \ - void *addr, long nel, u_long lel); } -86 AUE_NULL MSTD { int osf1_getitimer(u_int which, \ - struct itimerval *itv); } -87 AUE_NULL MNOPROTO { int ogethostname(char *hostname, \ - u_int len); } ogethostname \ - gethostname_args int -88 AUE_NULL MNOPROTO { int osethostname(char *hostname, \ - u_int len); } osethostname \ - sethostname_args int -89 AUE_NULL MNOPROTO { int getdtablesize(void); } -90 AUE_NULL MNOPROTO { int dup2(u_int from, u_int to); } -91 AUE_NULL MSTD { int osf1_fstat(int fd, void *sb); } -92 AUE_NULL MSTD { int osf1_fcntl(int fd, int cmd, \ - void *arg); } -93 AUE_NULL MSTD { int osf1_select(u_int nd, fd_set *in, \ - fd_set *ou, fd_set *ex, \ - struct timeval *tv); } -94 AUE_NULL MNOPROTO { int poll(struct pollfd *fds, u_int nfds, \ - int timeout); } -95 AUE_NULL MNOPROTO { int fsync(int fd); } -96 AUE_NULL MNOPROTO { int setpriority(int which, int who, \ - int prio); } -97 AUE_NULL MSTD { int osf1_socket(int domain, int type, \ - int protocol); } -98 AUE_NULL MNOPROTO { int connect(int s, caddr_t name, \ - int namelen); } -99 AUE_NULL MNOPROTO { int oaccept(int s, caddr_t name, \ - int *anamelen); } oaccept accept_args int -100 AUE_NULL MNOPROTO { int getpriority(int which, int who); } -101 AUE_NULL MNOPROTO { int osend(int s, caddr_t buf, int len, \ - int flags); } -102 AUE_NULL MNOPROTO { int orecv(int s, caddr_t buf, int len, \ - int flags); } -103 AUE_NULL MSTD { int osf1_sigreturn( \ - struct osigcontext *sigcntxp); } -104 AUE_NULL MNOPROTO { int bind(int s, caddr_t name, \ - int namelen); } -105 AUE_NULL MNOPROTO { int setsockopt(int s, int level, int name, \ - caddr_t val, int valsize); } -106 AUE_NULL MNOPROTO { int listen(int s, int backlog); } -107 AUE_NULL UNIMPL plock -108 AUE_NULL UNIMPL old sigvec -109 AUE_NULL UNIMPL old sigblock -110 AUE_NULL UNIMPL old sigsetmask -111 AUE_NULL MSTD { int osf1_sigsuspend(osf1_sigset_t ss); } -112 AUE_NULL MSTD { int osf1_osigstack(struct sigstack *nss, \ - struct sigstack *oss); } -113 AUE_NULL UNIMPL old recvmsg -114 AUE_NULL UNIMPL old sendmsg -115 AUE_NULL UNIMPL vtrace -116 AUE_NULL MSTD { int osf1_gettimeofday(struct timeval *tp, \ - struct timezone *tzp); } -; XXX -117 AUE_NULL MSTD { int osf1_getrusage(long who, \ - void *rusage); } -118 AUE_NULL MNOPROTO { int getsockopt(int s, int level, int name, \ - caddr_t val, int *avalsize); } -119 AUE_NULL UNIMPL -120 AUE_NULL MSTD { int osf1_readv(int fd, \ - struct osf1_iovec *iovp, u_int iovcnt); } -121 AUE_NULL MSTD { int osf1_writev(int fd, \ - struct osf1_iovec *iovp, u_int iovcnt); } -122 AUE_NULL MNOPROTO { int settimeofday(struct timeval *tv, \ - struct timezone *tzp); } -123 AUE_NULL MNOPROTO { int fchown(int fd, int uid, int gid); } -124 AUE_NULL MNOPROTO { int fchmod(int fd, int mode); } -125 AUE_NULL MNOPROTO { int orecvfrom(int s, caddr_t buf, \ - size_t len, int flags, caddr_t from, \ - int *fromlenaddr); } orecvfrom \ - recvfrom_args int -126 AUE_NULL MNOPROTO { int setreuid(int ruid, int euid); } -127 AUE_NULL MNOPROTO { int setregid(int rgid, int egid); } -128 AUE_NULL MNOPROTO { int rename(const char *from, \ - const char *to); } -129 AUE_NULL MSTD { int osf1_truncate(char *path, \ - off_t length); } -130 AUE_NULL MSTD { int osf1_ftruncate(int fd, off_t length); } -131 AUE_NULL MNOPROTO { int flock(int fd, int how); } -132 AUE_NULL MSTD { int osf1_setgid(gid_t gid); } -133 AUE_NULL MSTD { int osf1_sendto(int s, caddr_t buf, \ - size_t len, int flags, \ - struct sockaddr *to, int tolen); } -134 AUE_NULL MNOPROTO { int shutdown(int s, int how); } -135 AUE_NULL UNIMPL socketpair -136 AUE_NULL MNOPROTO { int mkdir(char *path, int mode); } -137 AUE_NULL MNOPROTO { int rmdir(char *path); } -138 AUE_NULL MNOPROTO { int utimes(char *path, \ - struct timeval *tptr); } -139 AUE_NULL OBSOL 4.2 sigreturn -140 AUE_NULL UNIMPL adjtime -141 AUE_NULL MNOPROTO { int ogetpeername(int fdes, caddr_t asa, \ - int *alen); } -142 AUE_NULL MNOPROTO { int32_t ogethostid(void); } -143 AUE_NULL MNOPROTO { int osethostid(int32_t hostid); } -144 AUE_NULL MSTD { int osf1_getrlimit(u_int which, \ - struct rlimit *rlp); } -145 AUE_NULL MSTD { int osf1_setrlimit(u_int which, \ - struct rlimit *rlp); } -146 AUE_NULL UNIMPL old killpg -147 AUE_NULL MNOPROTO { int setsid(void); } -148 AUE_NULL UNIMPL quotactl -149 AUE_NULL MNOPROTO { int oquota(void); } -150 AUE_NULL MNOPROTO { int ogetsockname(int fdec, caddr_t asa, \ - int *alen);} ogetsockname \ - getsockname_args int -151 AUE_NULL UNIMPL -152 AUE_NULL UNIMPL -153 AUE_NULL UNIMPL -154 AUE_NULL UNIMPL -155 AUE_NULL UNIMPL -156 AUE_NULL MSTD { int osf1_sigaction(long signum, \ - struct osf1_sigaction *nsa, \ - struct osf1_sigaction *osa, \ - void *sigtramp); } -157 AUE_NULL UNIMPL -158 AUE_NULL UNIMPL nfssvc -159 AUE_NULL NOPROTO { int ogetdirentries(int fd, char *buf, \ - u_int count, long *basep); } -160 AUE_NULL MSTD { int osf1_statfs(char *path, \ - struct osf1_statfs *buf, int len); } -161 AUE_NULL MSTD { int osf1_fstatfs(int fd, \ - struct osf1_statfs *buf, int len); } -162 AUE_NULL UNIMPL -163 AUE_NULL UNIMPL async_daemon -164 AUE_NULL UNIMPL getfh -165 AUE_NULL MNOPROTO { int getdomainname(char *domainname, \ - int len); } -166 AUE_NULL MNOPROTO { int setdomainname(char *domainname, \ - int len); } -167 AUE_NULL UNIMPL -168 AUE_NULL UNIMPL -169 AUE_NULL UNIMPL exportfs -170 AUE_NULL UNIMPL -171 AUE_NULL UNIMPL -172 AUE_NULL UNIMPL alt msgctl -173 AUE_NULL UNIMPL alt msgget -174 AUE_NULL UNIMPL alt msgrcv -175 AUE_NULL UNIMPL alt msgsnd -176 AUE_NULL UNIMPL alt semctl -177 AUE_NULL UNIMPL alt semget -178 AUE_NULL UNIMPL alt semop -179 AUE_NULL UNIMPL alt uname -180 AUE_NULL UNIMPL -181 AUE_NULL UNIMPL alt plock -182 AUE_NULL UNIMPL lockf -183 AUE_NULL UNIMPL -184 AUE_NULL UNIMPL getmnt -185 AUE_NULL UNIMPL -186 AUE_NULL UNIMPL unmount -187 AUE_NULL UNIMPL alt sigpending -188 AUE_NULL UNIMPL alt setsid -189 AUE_NULL UNIMPL -190 AUE_NULL UNIMPL -191 AUE_NULL UNIMPL -192 AUE_NULL UNIMPL -193 AUE_NULL UNIMPL -194 AUE_NULL UNIMPL -195 AUE_NULL UNIMPL -196 AUE_NULL UNIMPL -197 AUE_NULL UNIMPL -198 AUE_NULL UNIMPL -199 AUE_NULL UNIMPL swapon -200 AUE_NULL MNOPROTO { int msgctl(int msqid, int cmd, \ - struct msqid_ds *buf); } -201 AUE_NULL MNOPROTO { int msgget(key_t key, int msgflg); } -202 AUE_NULL MNOPROTO { int msgrcv(int msqid, void *msgp, \ - size_t msgsz, long msgtyp, int msgflg); } -203 AUE_NULL MNOPROTO { int msgsnd(int msqid, void *msgp, \ - size_t msgsz, int msgflg); } -204 AUE_NULL MNOPROTO { int __semctl(int semid, int semnum, \ - int cmd, union semun *arg); } -205 AUE_NULL MNOPROTO { int semget(key_t key, int nsems, \ - int semflg); } -206 AUE_NULL MNOPROTO { int semop(int semid, struct sembuf *sops, \ - u_int nsops); } -207 AUE_NULL MNOPROTO { int uname(struct utsname *name); } -208 AUE_NULL MNOPROTO { int lchown(char *path, int uid, int gid); } -209 AUE_NULL MNOPROTO { int shmat(int shmid, void *shmaddr, \ - int shmflg); } -210 AUE_NULL MNOPROTO { int shmctl(int shmid, int cmd, \ - struct shmid_ds *buf); } -211 AUE_NULL MNOPROTO { int shmdt(void *shmaddr); } -212 AUE_NULL MNOPROTO { int shmget(key_t key, int size, \ - int shmflg); } -213 AUE_NULL UNIMPL mvalid -214 AUE_NULL UNIMPL getaddressconf -215 AUE_NULL UNIMPL msleep -216 AUE_NULL UNIMPL mwakeup -217 AUE_NULL MSTD { int osf1_msync(caddr_t addr, size_t len, \ - int flags); } -218 AUE_NULL MSTD { int osf1_signal(int signum, void *handler); } -219 AUE_NULL UNIMPL utc gettime -220 AUE_NULL UNIMPL utc adjtime -221 AUE_NULL UNIMPL -222 AUE_NULL UNIMPL security -223 AUE_NULL UNIMPL kloadcall -224 AUE_NULL UNIMPL -225 AUE_NULL UNIMPL -226 AUE_NULL UNIMPL -227 AUE_NULL UNIMPL -228 AUE_NULL UNIMPL -229 AUE_NULL UNIMPL -230 AUE_NULL UNIMPL -231 AUE_NULL UNIMPL -232 AUE_NULL UNIMPL -233 AUE_NULL MNOPROTO { pid_t getpgid(pid_t pid); } -234 AUE_NULL MNOPROTO { pid_t getsid(pid_t pid); } -235 AUE_NULL MSTD { int osf1_sigaltstack( \ - struct osf1_sigaltstack *nss, \ - struct osf1_sigaltstack *oss); } -236 AUE_NULL UNIMPL waitid -237 AUE_NULL UNIMPL priocntlset -238 AUE_NULL UNIMPL sigsendset -239 AUE_NULL UNIMPL -240 AUE_NULL UNIMPL msfs_syscall -241 AUE_NULL MSTD { int osf1_sysinfo(int cmd, char *buf, \ - long count); } -242 AUE_NULL UNIMPL uadmin -243 AUE_NULL UNIMPL fuser -244 AUE_NULL MSTD { int osf1_proplist_syscall(void); } -245 AUE_NULL MSTD { int osf1_ntpadjtime(void *tp); } -246 AUE_NULL MSTD { int osf1_ntpgettime(void *tp); } -247 AUE_NULL MSTD { int osf1_pathconf(char *path, int name); } -248 AUE_NULL MSTD { int osf1_fpathconf(int fd, int name); } -249 AUE_NULL UNIMPL -250 AUE_NULL STD { int osf1_uswitch(long cmd, long mask); } -251 AUE_NULL MSTD { int osf1_usleep_thread( \ - struct timeval *sleep, \ - struct timeval *slept); } -252 AUE_NULL UNIMPL audcntl -253 AUE_NULL UNIMPL audgen -254 AUE_NULL UNIMPL sysfs -255 AUE_NULL UNIMPL -256 AUE_NULL MSTD { int osf1_getsysinfo(u_long op, \ - caddr_t buffer, u_long nbytes, \ - caddr_t arg, u_long flag); } -257 AUE_NULL MSTD { int osf1_setsysinfo(u_long op, \ - caddr_t buffer, u_long nbytes, \ - caddr_t arg, u_long flag); } -258 AUE_NULL UNIMPL afs_syscall -259 AUE_NULL UNIMPL swapctl -260 AUE_NULL UNIMPL memcntl -261 AUE_NULL UNIMPL -262 AUE_NULL UNIMPL -263 AUE_NULL UNIMPL -264 AUE_NULL UNIMPL -265 AUE_NULL UNIMPL -266 AUE_NULL UNIMPL -267 AUE_NULL UNIMPL -268 AUE_NULL UNIMPL -269 AUE_NULL UNIMPL -270 AUE_NULL UNIMPL -271 AUE_NULL UNIMPL -272 AUE_NULL UNIMPL -273 AUE_NULL UNIMPL -274 AUE_NULL UNIMPL -275 AUE_NULL UNIMPL -276 AUE_NULL UNIMPL -277 AUE_NULL UNIMPL -278 AUE_NULL UNIMPL -279 AUE_NULL UNIMPL -280 AUE_NULL UNIMPL -281 AUE_NULL UNIMPL -282 AUE_NULL UNIMPL -283 AUE_NULL UNIMPL -284 AUE_NULL UNIMPL -285 AUE_NULL UNIMPL -286 AUE_NULL UNIMPL -287 AUE_NULL UNIMPL -288 AUE_NULL UNIMPL -289 AUE_NULL UNIMPL -290 AUE_NULL UNIMPL -291 AUE_NULL UNIMPL -292 AUE_NULL UNIMPL -293 AUE_NULL UNIMPL -294 AUE_NULL UNIMPL -295 AUE_NULL UNIMPL -296 AUE_NULL UNIMPL -297 AUE_NULL UNIMPL -298 AUE_NULL UNIMPL -299 AUE_NULL UNIMPL -300 AUE_NULL UNIMPL diff --git a/sys/alpha/pci/alphapci_if.m b/sys/alpha/pci/alphapci_if.m deleted file mode 100644 index 32b0b5d..0000000 --- a/sys/alpha/pci/alphapci_if.m +++ /dev/null @@ -1,59 +0,0 @@ -#- -# Copyright (c) 2000 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. -# -# $FreeBSD$ -# - -#include <sys/bus.h> -#include <alpha/pci/pcibus.h> - -INTERFACE alphapci; - -CODE { - static void *null_cvt(device_t dev, vm_offset_t ba) - { - return 0; - } -}; - -METHOD void * cvt_dense { - device_t dev; - vm_offset_t ba; -} DEFAULT null_cvt; - -METHOD void * cvt_bwx { - device_t dev; - vm_offset_t ba; -} DEFAULT null_cvt; - -METHOD struct alpha_busspace * get_bustag { - device_t dev; - int type; -} DEFAULT pci_get_bustag; - -METHOD struct rman * get_rman { - device_t dev; - int type; -} DEFAULT pci_get_rman; diff --git a/sys/alpha/pci/apecs.c b/sys/alpha/pci/apecs.c deleted file mode 100644 index a2bbe53..0000000 --- a/sys/alpha/pci/apecs.c +++ /dev/null @@ -1,390 +0,0 @@ -/*- - * 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. - * - */ -/*- - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ -/*- - * Additional Copyright (c) 1998 by Andrew Gallatin for Duke University - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/module.h> -#include <sys/mutex.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <sys/proc.h> -#include <sys/rman.h> -#include <sys/interrupt.h> - -#include <alpha/pci/apecsreg.h> -#include <alpha/pci/apecsvar.h> -#include <alpha/isa/isavar.h> - -#include <machine/cpuconf.h> -#include <machine/intr.h> -#include <machine/intrcnt.h> -#include <machine/md_var.h> -#include <machine/resource.h> -#include <machine/rpb.h> -#include <machine/sgmap.h> -#include <machine/swiz.h> - -#include <vm/vm.h> -#include <vm/vm_page.h> - -#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) - -static devclass_t apecs_devclass; -static device_t apecs0; /* XXX only one for now */ - -struct apecs_softc { - vm_offset_t dmem_base; /* dense memory */ - vm_offset_t smem_base; /* sparse memory */ - vm_offset_t io_base; /* dense i/o */ - vm_offset_t cfg0_base; /* dense pci0 config */ - vm_offset_t cfg1_base; /* dense pci1 config */ -}; - -#define APECS_SOFTC(dev) (struct apecs_softc*) device_get_softc(dev) - -static alpha_chipset_read_hae_t apecs_read_hae; -static alpha_chipset_write_hae_t apecs_write_hae; - -static alpha_chipset_t apecs_swiz_chipset = { - apecs_read_hae, - apecs_write_hae, -}; - -/* - * Memory functions. - * - * XXX linux does 32-bit reads/writes via dense space. This doesn't - * appear to work for devices behind a ppb. I'm using sparse - * accesses & they appear to work just fine everywhere. - */ - -static u_int32_t apecs_hae_mem; - -#define REG1 (1UL << 24) -static u_int32_t -apecs_set_hae_mem(void *arg, u_int32_t pa) -{ - int s; - u_int32_t msb; - if (pa >= REG1){ - msb = pa & 0xf8000000; - pa -= msb; - s = splhigh(); - if (msb != apecs_hae_mem) { - apecs_hae_mem = msb; - REGVAL(EPIC_HAXR1) = apecs_hae_mem; - alpha_mb(); - apecs_hae_mem = REGVAL(EPIC_HAXR1); - } - splx(s); - } - return pa; -} - -static u_int64_t -apecs_read_hae(void) -{ - return apecs_hae_mem & 0xf8000000; -} - -static void -apecs_write_hae(u_int64_t hae) -{ - u_int32_t pa = hae; - apecs_set_hae_mem(0, pa); -} - -static int apecs_probe(device_t dev); -static int apecs_attach(device_t dev); -static int apecs_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, - driver_intr_t *intr, void *arg, void **cookiep); -static int apecs_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie); - -static device_method_t apecs_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, apecs_probe), - DEVMETHOD(device_attach, apecs_attach), - - /* Bus interface */ - DEVMETHOD(bus_setup_intr, apecs_setup_intr), - DEVMETHOD(bus_teardown_intr, apecs_teardown_intr), - - { 0, 0 } -}; - -static driver_t apecs_driver = { - "apecs", - apecs_methods, - sizeof(struct apecs_softc), -}; - -#define APECS_SGMAP_BASE (8*1024*1024) -#define APECS_SGMAP_SIZE (8*1024*1024) - -static void -apecs_sgmap_invalidate(void) -{ - alpha_mb(); - REGVAL(EPIC_TBIA) = 0; - alpha_mb(); -} - -static void -apecs_sgmap_map(void *arg, bus_addr_t ba, vm_offset_t pa) -{ - u_int64_t *sgtable = arg; - int index = alpha_btop(ba - APECS_SGMAP_BASE); - - if (pa) { - if (pa > (1L<<32)) - panic("apecs_sgmap_map: can't map address 0x%lx", pa); - sgtable[index] = ((pa >> 13) << 1) | 1; - } else { - sgtable[index] = 0; - } - alpha_mb(); - apecs_sgmap_invalidate(); -} - -static void -apecs_init_sgmap(void) -{ - void *sgtable; - - /* - * First setup Window 0 to map 8Mb to 16Mb with an - * sgmap. Allocate the map aligned to a 32 boundary. - */ - REGVAL(EPIC_PCI_BASE_1) = APECS_SGMAP_BASE | - EPIC_PCI_BASE_SGEN | EPIC_PCI_BASE_WENB; - alpha_mb(); - - REGVAL(EPIC_PCI_MASK_1) = EPIC_PCI_MASK_8M; - alpha_mb(); - - sgtable = contigmalloc(8192, M_DEVBUF, M_NOWAIT, - 0, (1L<<34), - 32*1024, (1L<<34)); - if (!sgtable) - panic("apecs_init_sgmap: can't allocate page table"); - REGVAL(EPIC_TBASE_1) = - (pmap_kextract((vm_offset_t) sgtable) >> EPIC_TBASE_SHIFT); - - chipset.sgmap = sgmap_map_create(APECS_SGMAP_BASE, - APECS_SGMAP_BASE + APECS_SGMAP_SIZE, - apecs_sgmap_map, sgtable); - chipset.pci_sgmap = NULL; - chipset.dmsize = 1UL * 1024UL * 1024UL * 1024UL; - chipset.dmoffset = 1UL * 1024UL * 1024UL * 1024UL; -} - -void -apecs_init() -{ - static int initted = 0; - static struct swiz_space io_space, mem_space; - - if (initted) return; - initted = 1; - - swiz_init_space(&io_space, KV(APECS_PCI_SIO)); - swiz_init_space_hae(&mem_space, KV(APECS_PCI_SPARSE), - apecs_set_hae_mem, 0); - - busspace_isa_io = (struct alpha_busspace *) &io_space; - busspace_isa_mem = (struct alpha_busspace *) &mem_space; - - chipset = apecs_swiz_chipset; - - if (platform.pci_intr_init) - platform.pci_intr_init(); - -} - -static int -apecs_probe(device_t dev) -{ - int memwidth; - if (apecs0) - return ENXIO; - apecs0 = dev; - memwidth = (REGVAL(COMANCHE_GCR) & COMANCHE_GCR_WIDEMEM) != 0 ? 128 : 64; - if(memwidth == 64){ - device_set_desc(dev, "DECchip 21071 Core Logic chipset"); - } else { - device_set_desc(dev, "DECchip 21072 Core Logic chipset"); - } - apecs_hae_mem = REGVAL(EPIC_HAXR1); - - isa_init_intr(); - apecs_init_sgmap(); - - device_add_child(dev, "pcib", 0); - - return 0; -} - -static int -apecs_attach(device_t dev) -{ - struct apecs_softc* sc = APECS_SOFTC(dev); - apecs_init(); - - sc->dmem_base = APECS_PCI_DENSE; - sc->smem_base = APECS_PCI_SPARSE; - sc->io_base = APECS_PCI_SIO; - sc->cfg0_base = KV(APECS_PCI_CONF); - sc->cfg1_base = 0; - - set_iointr(alpha_dispatch_intr); - - snprintf(chipset_type, sizeof(chipset_type), "apecs"); - chipset_bwx = 0; - chipset_ports = APECS_PCI_SIO; - chipset_memory = APECS_PCI_SPARSE; - chipset_dense = APECS_PCI_DENSE; - chipset_hae_mask = EPIC_HAXR1_EADDR; - - bus_generic_attach(dev); - return 0; -} - -static void -apecs_disable_intr(uintptr_t vector) -{ - int irq; - - irq = (vector - 0x900) >> 4; - mtx_lock_spin(&icu_lock); - platform.pci_intr_disable(irq); - mtx_unlock_spin(&icu_lock); -} - -static void -apecs_enable_intr(uintptr_t vector) -{ - int irq; - - irq = (vector - 0x900) >> 4; - mtx_lock_spin(&icu_lock); - platform.pci_intr_enable(irq); - mtx_unlock_spin(&icu_lock); -} - -static int -apecs_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, - driver_intr_t *intr, void *arg, void **cookiep) -{ - int error, start; - - start = rman_get_start(irq); - /* - * the avanti routes interrupts through the isa interrupt - * controller, so we need to special case it - */ - if(hwrpb->rpb_type == ST_DEC_2100_A50) - return isa_setup_intr(dev, child, irq, flags, - intr, arg, cookiep); - - error = rman_activate_resource(irq); - if (error) - return error; - - error = alpha_setup_intr(device_get_nameunit(child ? child : dev), - 0x900 + (start << 4), intr, arg, flags, cookiep, - &intrcnt[INTRCNT_EB64PLUS_IRQ + start], - apecs_disable_intr, apecs_enable_intr); - if (error) - return error; - - /* Enable PCI interrupt */ - mtx_lock_spin(&icu_lock); - platform.pci_intr_enable(start); - mtx_unlock_spin(&icu_lock); - - device_printf(child, "interrupting at APECS irq %d\n", start); - - - - return 0; -} - -static int -apecs_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie) -{ - /* - * the avanti routes interrupts through the isa interrupt - * controller, so we need to special case it - */ - if(hwrpb->rpb_type == ST_DEC_2100_A50) - return isa_teardown_intr(dev, child, irq, cookie); - - alpha_teardown_intr(cookie); - return rman_deactivate_resource(irq); -} - -DRIVER_MODULE(apecs, root, apecs_driver, apecs_devclass, 0, 0); - diff --git a/sys/alpha/pci/apecs_pci.c b/sys/alpha/pci/apecs_pci.c deleted file mode 100644 index 40af5cc..0000000 --- a/sys/alpha/pci/apecs_pci.c +++ /dev/null @@ -1,254 +0,0 @@ -/*- - * 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, SPEAPECSL, 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <sys/rman.h> -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <machine/cpuconf.h> -#include <machine/swiz.h> -#include <machine/md_var.h> -#include <machine/rpb.h> -#include <machine/resource.h> - -#include <alpha/pci/apecsreg.h> -#include <alpha/pci/apecsvar.h> -#include <alpha/pci/pcibus.h> -#include <alpha/isa/isavar.h> - -#include "alphapci_if.h" -#include "pcib_if.h" - -#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) - -static devclass_t pcib_devclass; - -static int -apecs_pcib_probe(device_t dev) -{ - device_set_desc(dev, "2107x PCI host bus adapter"); - - pci_init_resources(); - device_add_child(dev, "pci", 0); - - return 0; -} - -static int -apecs_pcib_read_ivar(device_t dev, device_t child, int which, u_long *result) -{ - if (which == PCIB_IVAR_BUS) { - *result = 0; - return 0; - } - return ENOENT; -} - -static struct resource * -apecs_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) -{ - struct resource *rv = NULL; - - if ((hwrpb->rpb_type == ST_DEC_2100_A50) && - (type == SYS_RES_IRQ)) - rv = isa_alloc_intr(bus, child, start); - else - rv = alpha_pci_alloc_resource(bus, child, type, rid, - start, end, count, flags); - if (rv != NULL) - rman_set_rid(rv, *rid); - return (rv); -} - -static int -apecs_pcib_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - if ((hwrpb->rpb_type == ST_DEC_2100_A50) && - (type == SYS_RES_IRQ)) - return isa_release_intr(bus, child, r); - else - return pci_release_resource(bus, child, type, rid, r); -} - -static void * -apecs_pcib_cvt_dense(device_t dev, vm_offset_t addr) -{ - addr &= 0xffffffffUL; - return (void *) KV(addr | APECS_PCI_DENSE); -} - -static int -apecs_pcib_maxslots(device_t dev) -{ - return 31; -} - -#define APECS_SWIZ_CFGOFF(b, s, f, r) \ - (((b) << 16) | ((s) << 11) | ((f) << 8) | (r)) - -#define APECS_TYPE1_SETUP(b,s,old_haxr2) if((b)) { \ - do { \ - (s) = splhigh(); \ - (old_haxr2) = REGVAL(EPIC_HAXR2); \ - alpha_mb(); \ - REGVAL(EPIC_HAXR2) = (old_haxr2) | 0x1; \ - alpha_mb(); \ - } while(0); \ -} - -#define APECS_TYPE1_TEARDOWN(b,s,old_haxr2) if((b)) { \ - do { \ - alpha_mb(); \ - REGVAL(EPIC_HAXR2) = (old_haxr2); \ - alpha_mb(); \ - splx((s)); \ - } while(0); \ -} - -#define SWIZ_CFGREAD(b, s, f, r, width, type) do { \ - type val = ~0; \ - int ipl = 0; \ - u_int32_t old_haxr2 = 0; \ - vm_offset_t off = APECS_SWIZ_CFGOFF(b, s, f, r); \ - vm_offset_t kv = \ - SPARSE_##width##_ADDRESS(KV(APECS_PCI_CONF), off); \ - alpha_mb(); \ - APECS_TYPE1_SETUP(b,ipl,old_haxr2); \ - if (!badaddr((caddr_t)kv, sizeof(type))) { \ - val = SPARSE_##width##_EXTRACT(off, SPARSE_READ(kv)); \ - } \ - APECS_TYPE1_TEARDOWN(b,ipl,old_haxr2); \ - return val; \ -} while (0) - -#define SWIZ_CFGWRITE(b, s, f, r, data, width, type) do { \ - int ipl = 0; \ - u_int32_t old_haxr2 = 0; \ - vm_offset_t off = APECS_SWIZ_CFGOFF(b, s, f, r); \ - vm_offset_t kv = \ - SPARSE_##width##_ADDRESS(KV(APECS_PCI_CONF), off); \ - alpha_mb(); \ - APECS_TYPE1_SETUP(b,ipl,old_haxr2); \ - if (!badaddr((caddr_t)kv, sizeof(type))) { \ - SPARSE_WRITE(kv, SPARSE_##width##_INSERT(off, data)); \ - alpha_wmb(); \ - } \ - APECS_TYPE1_TEARDOWN(b,ipl,old_haxr2); \ - return; \ -} while (0) - -u_int32_t -apecs_pcib_read_config(device_t dev, u_int b, u_int s, u_int f, - u_int reg, int width) -{ - pcicfgregs cfg; - - if ((reg == PCIR_INTLINE) && (width == 1) && - (platform.pci_intr_map != NULL)) { - cfg.bus = b; - cfg.slot = s; - cfg.func = f; - cfg.intline = 255; - cfg.intpin = - apecs_pcib_read_config(dev, b, s, f, PCIR_INTPIN, 1); - platform.pci_intr_map((void *)&cfg); - if (cfg.intline != 255) - return cfg.intline; - } - - switch (width) { - case 1: - SWIZ_CFGREAD(b, s, f, reg, BYTE, u_int8_t); - break; - case 2: - SWIZ_CFGREAD(b, s, f, reg, WORD, u_int16_t); - break; - case 4: - SWIZ_CFGREAD(b, s, f, reg, LONG, u_int32_t); - } - return ~0; -} - -static void -apecs_pcib_write_config(device_t dev, u_int b, u_int s, u_int f, - u_int reg, u_int32_t val, int width) -{ - switch (width) { - case 1: - SWIZ_CFGWRITE(b, s, f, reg, val, BYTE, u_int8_t); - break; - case 2: - SWIZ_CFGWRITE(b, s, f, reg, val, WORD, u_int16_t); - break; - case 4: - SWIZ_CFGWRITE(b, s, f, reg, val, LONG, u_int32_t); - } -} - -static device_method_t apecs_pcib_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, apecs_pcib_probe), - DEVMETHOD(device_attach, bus_generic_attach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, apecs_pcib_read_ivar), - DEVMETHOD(bus_alloc_resource, apecs_pcib_alloc_resource), - DEVMETHOD(bus_release_resource, apecs_pcib_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - /* alphapci interface */ - DEVMETHOD(alphapci_cvt_dense, apecs_pcib_cvt_dense), - - /* pcib interface */ - DEVMETHOD(pcib_maxslots, apecs_pcib_maxslots), - DEVMETHOD(pcib_read_config, apecs_pcib_read_config), - DEVMETHOD(pcib_write_config, apecs_pcib_write_config), - DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), - - { 0, 0 } -}; - -static driver_t apecs_pcib_driver = { - "pcib", - apecs_pcib_methods, - 1, -}; - -DRIVER_MODULE(pcib, apecs, apecs_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/alpha/pci/apecsreg.h b/sys/alpha/pci/apecsreg.h deleted file mode 100644 index a9e180b..0000000 --- a/sys/alpha/pci/apecsreg.h +++ /dev/null @@ -1,344 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: apecsreg.h,v 1.7 1997/06/06 23:54:24 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. - */ - -/* - * APECS Chipset registers and constants. - * - * Taken from ``DECchip 21071 and DECchip 21072 Core Logic Chipsets Data - * Sheet'' (DEC order number EC-QAEMA-TE), pages 4-1 - 4-27, 10-21 - 10-38. - */ - -#define REGVAL(r) (*(volatile int32_t *)ALPHA_PHYS_TO_K0SEG(r)) - -/* - * Base addresses - */ -#define COMANCHE_BASE 0x180000000L /* 21071-CA Regs */ -#define EPIC_BASE 0x1a0000000L /* 21071-DA Regs */ -#define APECS_PCI_IACK 0x1b0000000L /* PCI Int. Ack. */ -#define APECS_PCI_SIO 0x1c0000000L /* PCI Sp. I/O Space */ -#define APECS_PCI_CONF 0x1e0000000L /* PCI Conf. Space */ -#define APECS_PCI_SPARSE 0x200000000L /* PCI Sparse Space */ -#define APECS_PCI_DENSE 0x300000000L /* PCI Dense Space */ - - -/* - * 21071-CA Registers - */ - -/* - * 21071-CA General Registers - */ -#define COMANCHE_GCR (COMANCHE_BASE + 0x0000) /* General Control */ -#define COMANCHE_GCR_RSVD 0xc009 -#define COMANCHE_GCR_SYSARB 0x0006 -#define COMANCHE_GCR_WIDEMEM 0x0010 -#define COMANCHE_GCR_BC_EN 0x0020 -#define COMANCHE_GCR_BC_NOALLOC 0x0040 -#define COMANCHE_GCR_BC_LONGWR 0x0080 -#define COMANCHE_GCR_BC_IGNTAG 0x0100 -#define COMANCHE_GCR_BC_FRCTAG 0x0200 -#define COMANCHE_GCR_BC_FRCD 0x0400 -#define COMANCHE_GCR_BC_FRCV 0x0800 -#define COMANCHE_GCR_BC_FRCP 0x1000 -#define COMANCHE_GCR_BC_BADAP 0x2000 - -#define COMANCHE_RSVD (COMANCHE_BASE + 0x0020) /* Reserved */ - -#define COMANCHE_ED (COMANCHE_BASE + 0x0040) /* Err & Diag Status */ -#define COMANCHE_ED_LOSTERR 0x0001 -#define COMANCHE_ED_BC_TAPERR 0x0002 -#define COMANCHE_ED_BC_TCPERR 0x0004 -#define COMANCHE_ED_NXMERR 0x0008 -#define COMANCHE_ED_DMACAUSE 0x0010 -#define COMANCHE_ED_VICCAUSE 0x0020 -#define COMANCHE_ED_CREQCAUSE 0x01c0 -#define COMANCHE_ED_RSVD 0x1e00 -#define COMANCHE_ED_PASS2 0x2000 -#define COMANCHE_ED_IDXLLOCK 0x4000 -#define COMANCHE_ED_WRPEND 0x8000 - -#define COMANCHE_TAGENB (COMANCHE_BASE + 0x0060) /* Tag Enable */ -#define COMANCHE_TAGENB_RSVD 0x0001 - -#define COMANCHE_TAGENB_C_4G 0x0000 -#define COMANCHE_TAGENB_C_2G 0x8000 -#define COMANCHE_TAGENB_C_1G 0xc000 -#define COMANCHE_TAGENB_C_512M 0xe000 -#define COMANCHE_TAGENB_C_256M 0xf000 -#define COMANCHE_TAGENB_C_128M 0xf800 -#define COMANCHE_TAGENB_C_64M 0xfc00 -#define COMANCHE_TAGENB_C_32M 0xfe00 -#define COMANCHE_TAGENB_C_16M 0xff00 -#define COMANCHE_TAGENB_C_8M 0xff80 -#define COMANCHE_TAGENB_C_4M 0xffc0 -#define COMANCHE_TAGENB_C_2M 0xffe0 -#define COMANCHE_TAGENB_C_1M 0xfff0 -#define COMANCHE_TAGENB_C_512K 0xfff8 -#define COMANCHE_TAGENB_C_256K 0xfffc -#define COMANCHE_TAGENB_C_128K 0xfffe - -#define COMANCHE_TAGENB_M_4G 0xffff -#define COMANCHE_TAGENB_M_2G 0x7fff -#define COMANCHE_TAGENB_M_1G 0x3fff -#define COMANCHE_TAGENB_M_512M 0x1fff -#define COMANCHE_TAGENB_M_256M 0x0fff -#define COMANCHE_TAGENB_M_128M 0x07ff -#define COMANCHE_TAGENB_M_64M 0x03ff -#define COMANCHE_TAGENB_M_32M 0x01ff -#define COMANCHE_TAGENB_M_16M 0x00ff -#define COMANCHE_TAGENB_M_8M 0x007f -#define COMANCHE_TAGENB_M_4M 0x003f -#define COMANCHE_TAGENB_M_2M 0x001f -#define COMANCHE_TAGENB_M_1M 0x000e -#define COMANCHE_TAGENB_M_512K 0x0006 -#define COMANCHE_TAGENB_M_256K 0x0002 -#define COMANCHE_TAGENB_M_128K 0x0000 - -#define COMANCHE_ERR_LO (COMANCHE_BASE + 0x0080) /* Error Low Address */ - -#define COMANCHE_ERR_HI (COMANCHE_BASE + 0x00a0) /* Error High Address */ -#define COMANCHE_ERR_HI_RSVD 0xe000 - -#define COMANCHE_LCK_LO (COMANCHE_BASE + 0x00c0) /* LDx_L Low Address */ - -#define COMANCHE_LCK_HI (COMANCHE_BASE + 0x00e0) /* LDx_L High Address */ -#define COMANCHE_LOCK_HI_RSVD 0xe000 - -/* - * 21071-CA Memory Registers - */ -#define COMANCHE_GTIM (COMANCHE_BASE + 0x0200) /* Global Timing */ -#define COMANCHE_LOCK_HI_RSVD 0xe000 - -#define COMANCHE_RTIM (COMANCHE_BASE + 0x0220) /* Refresh Timing */ - -#define COMANCHE_VFP (COMANCHE_BASE + 0x0240) /* Video Frame Ptr. */ -#define COMANCHE_VFP_COL 0x001f -#define COMANCHE_VFP_ROW 0x3fe0 -#define COMANCHE_VFP_SUBBANK 0x4000 -#define COMANCHE_VFP_RSVD 0x8000 - -#define COMANCHE_PD_LO (COMANCHE_BASE + 0x0260) /* Pres Detect Low */ - -#define COMANCHE_PD_HI (COMANCHE_BASE + 0x0280) /* Pres Detect High */ - -/* - * 21071-CA Memory banks' Base Address Register format - */ -#define COMANCHE_B0_BAR (COMANCHE_BASE + 0x0800) /* Bank 0 BA */ -#define COMANCHE_B1_BAR (COMANCHE_BASE + 0x0820) /* Bank 1 BA */ -#define COMANCHE_B2_BAR (COMANCHE_BASE + 0x0840) /* Bank 2 BA */ -#define COMANCHE_B3_BAR (COMANCHE_BASE + 0x0860) /* Bank 3 BA */ -#define COMANCHE_B4_BAR (COMANCHE_BASE + 0x0880) /* Bank 4 BA */ -#define COMANCHE_B5_BAR (COMANCHE_BASE + 0x08a0) /* Bank 5 BA */ -#define COMANCHE_B6_BAR (COMANCHE_BASE + 0x08c0) /* Bank 6 BA */ -#define COMANCHE_B7_BAR (COMANCHE_BASE + 0x08e0) /* Bank 7 BA */ -#define COMANCHE_B8_BAR (COMANCHE_BASE + 0x0900) /* Bank 8 BA */ -#define COMANCHE_BAR_RSVD 0x001f - -/* - * 21071-CA Memory banks' Configuration Register format - */ -#define COMANCHE_B0_CR (COMANCHE_BASE + 0x0a00) /* Bank 0 Config */ -#define COMANCHE_B1_CR (COMANCHE_BASE + 0x0a20) /* Bank 1 Config */ -#define COMANCHE_B2_CR (COMANCHE_BASE + 0x0a40) /* Bank 2 Config */ -#define COMANCHE_B3_CR (COMANCHE_BASE + 0x0a60) /* Bank 3 Config */ -#define COMANCHE_B4_CR (COMANCHE_BASE + 0x0a80) /* Bank 4 Config */ -#define COMANCHE_B5_CR (COMANCHE_BASE + 0x0aa0) /* Bank 5 Config */ -#define COMANCHE_B6_CR (COMANCHE_BASE + 0x0ac0) /* Bank 6 Config */ -#define COMANCHE_B7_CR (COMANCHE_BASE + 0x0ae0) /* Bank 7 Config */ -#define COMANCHE_B8_CR (COMANCHE_BASE + 0x0b00) /* Bank 8 Config */ -#define COMANCHE_CR_VALID 0x0001 -#define COMANCHE_CR_SIZE 0x001e -#define COMANCHE_CR_SUBENA 0x0020 -#define COMANCHE_CR_COLSEL 0x01c0 -#define COMANCHE_CR_S0_RSVD 0xfe00 -#define COMANCHE_CR_S8_CHECK 0x0200 -#define COMANCHE_CR_S8_RSVD 0xfc00 - -/* - * 21071-CA Memory banks' Timing Register A format - */ -#define COMANCHE_B0_TRA (COMANCHE_BASE + 0x0c00) /* Bank 0 Timing A */ -#define COMANCHE_B1_TRA (COMANCHE_BASE + 0x0c20) /* Bank 1 Timing A */ -#define COMANCHE_B2_TRA (COMANCHE_BASE + 0x0c40) /* Bank 2 Timing A */ -#define COMANCHE_B3_TRA (COMANCHE_BASE + 0x0c60) /* Bank 3 Timing A */ -#define COMANCHE_B4_TRA (COMANCHE_BASE + 0x0c80) /* Bank 4 Timing A */ -#define COMANCHE_B5_TRA (COMANCHE_BASE + 0x0ca0) /* Bank 5 Timing A */ -#define COMANCHE_B6_TRA (COMANCHE_BASE + 0x0cc0) /* Bank 6 Timing A */ -#define COMANCHE_B7_TRA (COMANCHE_BASE + 0x0ce0) /* Bank 7 Timing A */ -#define COMANCHE_B8_TRA (COMANCHE_BASE + 0x0d00) /* Bank 8 Timing A */ -#define COMANCHE_TRA_ROWSETUP 0x0003 -#define COMANCHE_TRA_ROWHOLD 0x000c -#define COMANCHE_TRA_COLSETUP 0x0070 -#define COMANCHE_TRA_COLHOLD 0x0180 -#define COMANCHE_TRA_RDLYROW 0x0e00 -#define COMANCHE_TRA_RDLYCOL 0x7000 -#define COMANCHE_TRA_RSVD 0x8000 - -/* - * 21071-CA Memory banks' Timing Register B format - */ -#define COMANCHE_B0_TRB (COMANCHE_BASE + 0x0e00) /* Bank 0 Timing B */ -#define COMANCHE_B1_TRB (COMANCHE_BASE + 0x0e20) /* Bank 1 Timing B */ -#define COMANCHE_B2_TRB (COMANCHE_BASE + 0x0e40) /* Bank 2 Timing B */ -#define COMANCHE_B3_TRB (COMANCHE_BASE + 0x0e60) /* Bank 3 Timing B */ -#define COMANCHE_B4_TRB (COMANCHE_BASE + 0x0e80) /* Bank 4 Timing B */ -#define COMANCHE_B5_TRB (COMANCHE_BASE + 0x0ea0) /* Bank 5 Timing B */ -#define COMANCHE_B6_TRB (COMANCHE_BASE + 0x0ec0) /* Bank 6 Timing B */ -#define COMANCHE_B7_TRB (COMANCHE_BASE + 0x0ee0) /* Bank 7 Timing B */ -#define COMANCHE_B8_TRB (COMANCHE_BASE + 0x0f00) /* Bank 8 Timing B */ -#define COMANCHE_TRB_RTCAS 0x0007 -#define COMANCHE_TRB_WTCAS 0x0038 -#define COMANCHE_TRB_TCP 0x00c0 -#define COMANCHE_TRB_WHOLD0ROW 0x0700 -#define COMANCHE_TRB_WHOLD0COL 0x3800 -#define COMANCHE_TRB_RSVD 0xc000 - - -/* - * 21071-DA Registers - */ -#define EPIC_DCSR (EPIC_BASE + 0x0000) /* Diagnostic CSR */ -#define EPIC_DCSR_TENB 0x00000001 -#define EPIC_DCSR_RSVD 0x7fc00082 -#define EPIC_DCSR_PENB 0x00000004 -#define EPIC_DCSR_DCEI 0x00000008 -#define EPIC_DCSR_DPEC 0x00000010 -#define EPIC_DCSR_IORT 0x00000020 -#define EPIC_DCSR_LOST 0x00000040 -#define EPIC_DCSR_DDPE 0x00000100 -#define EPIC_DCSR_IOPE 0x00000200 -#define EPIC_DCSR_TABT 0x00000400 -#define EPIC_DCSR_NDEV 0x00000800 -#define EPIC_DCSR_CMRD 0x00001000 -#define EPIC_DCSR_UMRD 0x00002000 -#define EPIC_DCSR_IPTL 0x00004000 -#define EPIC_DCSR_MERR 0x00008000 -#define EPIC_DCSR_DBYP 0x00030000 -#define EPIC_DCSR_PCMD 0x003c0000 -#define EPIC_DCSR_PASS2 0x80000000 - -#define EPIC_PEAR (EPIC_BASE + 0x0020) /* PCI Err Addr. */ - -#define EPIC_SEAR (EPIC_BASE + 0x0040) /* sysBus Err Addr. */ -#define EPIC_SEAR_RSVD 0x0000000f -#define EPIC_SEAR_SYS_ERR 0xfffffff0 - -#define EPIC_DUMMY_1 (EPIC_BASE + 0x0060) /* Dummy 1 */ -#define EPIC_DUMMY_2 (EPIC_BASE + 0x0080) /* Dummy 2 */ -#define EPIC_DUMMY_3 (EPIC_BASE + 0x00a0) /* Dummy 3 */ - -#define EPIC_TBASE_1 (EPIC_BASE + 0x00c0) /* Trans. Base 1 */ -#define EPIC_TBASE_2 (EPIC_BASE + 0x00e0) /* Trans. Base 2 */ -#define EPIC_TBASE_RSVD 0x000001ff -#define EPIC_TBASE_T_BASE 0xfffffe00 -#define EPIC_TBASE_SHIFT 1 - -#define EPIC_PCI_BASE_1 (EPIC_BASE + 0x0100) /* PCI Base 1 */ -#define EPIC_PCI_BASE_2 (EPIC_BASE + 0x0120) /* PCI Base 2 */ -#define EPIC_PCI_BASE_RSVD 0x0003ffff -#define EPIC_PCI_BASE_SGEN 0x00040000 -#define EPIC_PCI_BASE_WENB 0x00080000 -#define EPIC_PCI_BASE_PCI_BASE 0xfff00000 - -#define EPIC_PCI_MASK_1 (EPIC_BASE + 0x0140) /* PCI Mask 1 */ -#define EPIC_PCI_MASK_2 (EPIC_BASE + 0x0160) /* PCI Mask 2 */ -#define EPIC_PCI_MASK_RSVD 0x000fffff -#define EPIC_PCI_MASK_PCI_MASK 0xfff00000 -#define EPIC_PCI_MASK_1M 0x00000000 -#define EPIC_PCI_MASK_2M 0x00100000 -#define EPIC_PCI_MASK_4M 0x00300000 -#define EPIC_PCI_MASK_8M 0x00700000 -#define EPIC_PCI_MASK_16M 0x00f00000 -#define EPIC_PCI_MASK_32M 0x01f00000 -#define EPIC_PCI_MASK_64M 0x03f00000 -#define EPIC_PCI_MASK_128M 0x07f00000 -#define EPIC_PCI_MASK_256M 0x0ff00000 -#define EPIC_PCI_MASK_512M 0x1ff00000 -#define EPIC_PCI_MASK_1G 0x3ff00000 -#define EPIC_PCI_MASK_2G 0x7ff00000 -#define EPIC_PCI_MASK_4G 0xfff00000 - -#define EPIC_HAXR0 (EPIC_BASE + 0x0180) /* Host Addr Extn 0 */ - -#define EPIC_HAXR1 (EPIC_BASE + 0x01a0) /* Host Addr Extn 1 */ -#define EPIC_HAXR1_RSVD 0x07ffffff -#define EPIC_HAXR1_EADDR 0xf8000000 - -#define EPIC_HAXR2 (EPIC_BASE + 0x01c0) /* Host Addr Extn 2 */ -#define EPIC_HAXR2_CONF_TYPE 0x00000003 -#define EPIC_HAXR2_CONF_TYPO0 0x00000000 -#define EPIC_HAXR2_CONF_TYPE1 0x00000001 -#define EPIC_HAXR2_RSVD 0x00fffffc -#define EPIC_HAXR2_EADDR 0xff000000 - -#define EPIC_PMLT (EPIC_BASE + 0x01e0) /* PCI Mstr Lat Tmr */ -#define EPIC_PMLT_PMLC 0x000000ff -#define EPIC_PMLT_RSVD 0xffffff00 - -#define EPIC_TLB_TAG_0 (EPIC_BASE + 0x0200) /* TLB Tag 0 */ -#define EPIC_TLB_TAG_1 (EPIC_BASE + 0x0220) /* TLB Tag 1 */ -#define EPIC_TLB_TAG_2 (EPIC_BASE + 0x0240) /* TLB Tag 2 */ -#define EPIC_TLB_TAG_3 (EPIC_BASE + 0x0260) /* TLB Tag 3 */ -#define EPIC_TLB_TAG_4 (EPIC_BASE + 0x0280) /* TLB Tag 4 */ -#define EPIC_TLB_TAG_5 (EPIC_BASE + 0x02a0) /* TLB Tag 5 */ -#define EPIC_TLB_TAG_6 (EPIC_BASE + 0x02c0) /* TLB Tag 6 */ -#define EPIC_TLB_TAG_7 (EPIC_BASE + 0x02e0) /* TLB Tag 7 */ -#define EPIC_TLB_TAG_RSVD 0x00000fff -#define EPIC_TLB_TAG_EVAL 0x00001000 -#define EPIC_TLB_TAG_PCI_PAGE 0xffffe000 - -#define EPIC_TLB_DATA_0 (EPIC_BASE + 0x0300) /* TLB Data 0 */ -#define EPIC_TLB_DATA_1 (EPIC_BASE + 0x0320) /* TLB Data 1 */ -#define EPIC_TLB_DATA_2 (EPIC_BASE + 0x0340) /* TLB Data 2 */ -#define EPIC_TLB_DATA_3 (EPIC_BASE + 0x0360) /* TLB Data 3 */ -#define EPIC_TLB_DATA_4 (EPIC_BASE + 0x0380) /* TLB Data 4 */ -#define EPIC_TLB_DATA_5 (EPIC_BASE + 0x03a0) /* TLB Data 5 */ -#define EPIC_TLB_DATA_6 (EPIC_BASE + 0x03c0) /* TLB Data 6 */ -#define EPIC_TLB_DATA_7 (EPIC_BASE + 0x03e0) /* TLB Data 7 */ -#define EPIC_TLB_DATA_RSVD 0xffe00001 -#define EPIC_TLB_DATA_CPU_PAGE 0x001ffffe - -#define EPIC_TBIA (EPIC_BASE + 0x0400) /* TLB Invl All */ - -/* - * EPIC Scatter-Gather Map Entries - */ - -struct sgmapent { - u_int64_t val; -}; -#define SGMAPENT_EVAL 0x0000000000000001L -#define SGMAPENT_PFN 0x00000000001ffffeL -#define SGMAPENT_RSVD 0xffffffffffe00000L - -#define SGMAP_MAKEENTRY(pfn) (SGMAPENT_EVAL | ((pfn) << 1)) diff --git a/sys/alpha/pci/apecsvar.h b/sys/alpha/pci/apecsvar.h deleted file mode 100644 index 2c6987e..0000000 --- a/sys/alpha/pci/apecsvar.h +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -struct device; - -extern void apecs_init(void); -u_int32_t apecs_pcib_read_config(struct device *dev, u_int b, u_int s, u_int f, - u_int reg, int width); diff --git a/sys/alpha/pci/bwx.c b/sys/alpha/pci/bwx.c deleted file mode 100644 index fd63ebb..0000000 --- a/sys/alpha/pci/bwx.c +++ /dev/null @@ -1,132 +0,0 @@ -/*- - * Copyright (c) 2000 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/kobj.h> - -#include <machine/bus.h> -#include <machine/bwx.h> - -static u_int8_t -bwx_read_1(struct alpha_busspace *space, size_t offset) -{ - struct bwx_space *bwx = (struct bwx_space *) space; - alpha_mb(); - return ldbu(bwx->base + offset); -} - -static u_int16_t -bwx_read_2(struct alpha_busspace *space, size_t offset) -{ - struct bwx_space *bwx = (struct bwx_space *) space; - alpha_mb(); - return ldwu(bwx->base + offset); -} - -static u_int32_t -bwx_read_4(struct alpha_busspace *space, size_t offset) -{ - struct bwx_space *bwx = (struct bwx_space *) space; - alpha_mb(); - return ldl(bwx->base + offset); -} - -static void -bwx_write_1(struct alpha_busspace *space, size_t offset, u_int8_t data) -{ - struct bwx_space *bwx = (struct bwx_space *) space; - stb(bwx->base + offset, data); - alpha_mb(); -} - -static void -bwx_write_2(struct alpha_busspace *space, size_t offset, u_int16_t data) -{ - struct bwx_space *bwx = (struct bwx_space *) space; - stw(bwx->base + offset, data); - alpha_mb(); -} - -static void -bwx_write_4(struct alpha_busspace *space, size_t offset, u_int32_t data) -{ - struct bwx_space *bwx = (struct bwx_space *) space; - stl(bwx->base + offset, data); - alpha_mb(); -} - -static struct alpha_busspace_ops bwx_space_ops = { - bwx_read_1, - bwx_read_2, - bwx_read_4, - - busspace_generic_read_multi_1, - busspace_generic_read_multi_2, - busspace_generic_read_multi_4, - - busspace_generic_read_region_1, - busspace_generic_read_region_2, - busspace_generic_read_region_4, - - bwx_write_1, - bwx_write_2, - bwx_write_4, - - busspace_generic_write_multi_1, - busspace_generic_write_multi_2, - busspace_generic_write_multi_4, - - busspace_generic_write_region_1, - busspace_generic_write_region_2, - busspace_generic_write_region_4, - - busspace_generic_set_multi_1, - busspace_generic_set_multi_2, - busspace_generic_set_multi_4, - - busspace_generic_set_region_1, - busspace_generic_set_region_2, - busspace_generic_set_region_4, - - busspace_generic_copy_region_1, - busspace_generic_copy_region_2, - busspace_generic_copy_region_4, - - busspace_generic_barrier, -}; - -void -bwx_init_space(struct bwx_space *bwx, u_int64_t base) -{ - bwx->ops = &bwx_space_ops; - bwx->base = base; -} - diff --git a/sys/alpha/pci/cia.c b/sys/alpha/pci/cia.c deleted file mode 100644 index 3abb50f..0000000 --- a/sys/alpha/pci/cia.c +++ /dev/null @@ -1,580 +0,0 @@ -/*- - * 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. - */ -/*- - * Copyright (c) 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) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_cpu.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/module.h> -#include <sys/mutex.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <sys/proc.h> -#include <sys/rman.h> -#include <sys/interrupt.h> - -#include <alpha/pci/ciareg.h> -#include <alpha/pci/ciavar.h> -#include <alpha/isa/isavar.h> - -#include <machine/bwx.h> -#include <machine/cpuconf.h> -#include <machine/intr.h> -#include <machine/intrcnt.h> -#include <machine/md_var.h> -#include <machine/resource.h> -#include <machine/rpb.h> -#include <machine/sgmap.h> -#include <machine/swiz.h> - -#include <vm/vm.h> -#include <vm/vm_page.h> - -#include "alphapci_if.h" - -#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) - -static devclass_t cia_devclass; -static device_t cia0; /* XXX only one for now */ -static u_int32_t cia_hae_mem; -static int cia_rev, cia_ispyxis, cia_config; - -struct cia_softc { - int junk; /* no softc */ -}; - -#define CIA_SOFTC(dev) (struct cia_softc*) device_get_softc(dev) - -static alpha_chipset_read_hae_t cia_read_hae; -static alpha_chipset_write_hae_t cia_write_hae; - -static alpha_chipset_t cia_bwx_chipset = { - cia_read_hae, - cia_write_hae, -}; -static alpha_chipset_t cia_swiz_chipset = { - cia_read_hae, - cia_write_hae, -}; - -static u_int32_t -cia_swiz_set_hae_mem(void *arg, u_int32_t pa) -{ - /* Only bother with region 1 */ -#define REG1 (7 << 29) - if ((cia_hae_mem & REG1) != (pa & REG1)) { - /* - * Seems fairly paranoid but this is what Linux does... - */ - u_int32_t msb = pa & REG1; - register_t s; - - s = intr_disable(); - cia_hae_mem = (cia_hae_mem & ~REG1) | msb; - REGVAL(CIA_CSR_HAE_MEM) = cia_hae_mem; - alpha_mb(); - cia_hae_mem = REGVAL(CIA_CSR_HAE_MEM); - intr_restore(s); - } - return pa & ~REG1; -} - -static u_int64_t -cia_read_hae(void) -{ - return cia_hae_mem & REG1; -} - -static void -cia_write_hae(u_int64_t hae) -{ - u_int32_t pa = hae; - cia_swiz_set_hae_mem(0, pa); -} - -static int cia_probe(device_t dev); -static int cia_attach(device_t dev); -static int cia_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, - driver_intr_t *intr, void *arg, void **cookiep); -static int cia_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie); - -static device_method_t cia_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, cia_probe), - DEVMETHOD(device_attach, cia_attach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_setup_intr, cia_setup_intr), - DEVMETHOD(bus_teardown_intr, cia_teardown_intr), - - { 0, 0 } -}; - -static driver_t cia_driver = { - "cia", - cia_methods, - sizeof(struct cia_softc), -}; - -#define CIA_SGMAP_BASE (8*1024*1024) -#define CIA_SGMAP_SIZE (8*1024*1024) -#define CIA_PYXIS_BUG_BASE (128*1024*1024) -#define CIA_PYXIS_BUG_SIZE (2*1024*1024) - -static void -cia_sgmap_invalidate(void) -{ - REGVAL(CIA_PCI_TBIA) = CIA_PCI_TBIA_ALL; - alpha_mb(); -} - -static void -cia_sgmap_invalidate_pyxis(void) -{ - volatile u_int64_t dummy; - u_int32_t ctrl; - int i; - register_t s; - - s = intr_disable(); - - /* - * Put the Pyxis into PCI loopback mode. - */ - alpha_mb(); - ctrl = REGVAL(CIA_CSR_CTRL); - REGVAL(CIA_CSR_CTRL) = ctrl | CTRL_PCI_LOOP_EN; - alpha_mb(); - - /* - * Now, read from PCI dense memory space at offset 128M (our - * target window base), skipping 64k on each read. This forces - * S/G TLB misses. - * - * XXX Looks like the TLB entries are `not quite LRU'. We need - * XXX to read more times than there are actual tags! - */ - for (i = 0; i < CIA_TLB_NTAGS + 4; i++) { - dummy = *((volatile u_int64_t *) - ALPHA_PHYS_TO_K0SEG(CIA_PCI_DENSE + CIA_PYXIS_BUG_BASE + - (i * 65536))); - } - - /* - * Restore normal PCI operation. - */ - alpha_mb(); - REGVAL(CIA_CSR_CTRL) = ctrl; - alpha_mb(); - - intr_restore(s); -} - -static void -cia_sgmap_map(void *arg, bus_addr_t ba, vm_offset_t pa) -{ - u_int64_t *sgtable = arg; - int index = alpha_btop(ba - CIA_SGMAP_BASE); - - if (pa) { - if (pa > (1L<<32)) - panic("cia_sgmap_map: can't map address 0x%lx", pa); - sgtable[index] = ((pa >> 13) << 1) | 1; - } else { - sgtable[index] = 0; - } - alpha_mb(); - - if (cia_ispyxis) - cia_sgmap_invalidate_pyxis(); - else - cia_sgmap_invalidate(); -} - -static void -cia_init_sgmap(void) -{ - void *sgtable; - - /* - * First setup Window 0 to map 8Mb to 16Mb with an - * sgmap. Allocate the map aligned to a 32k boundary. - */ - REGVAL(CIA_PCI_W0BASE) = (CIA_SGMAP_BASE - | CIA_PCI_WnBASE_SG_EN - | CIA_PCI_WnBASE_W_EN); - alpha_mb(); - - REGVAL(CIA_PCI_W0MASK) = CIA_PCI_WnMASK_8M; - alpha_mb(); - - sgtable = contigmalloc(8192, M_DEVBUF, M_NOWAIT, - 0, (1L<<34), - 32*1024, (1L<<34)); - if (!sgtable) - panic("cia_init_sgmap: can't allocate page table"); - REGVAL(CIA_PCI_T0BASE) = - (pmap_kextract((vm_offset_t) sgtable) >> CIA_PCI_TnBASE_SHIFT); - - chipset.sgmap = sgmap_map_create(CIA_SGMAP_BASE, - CIA_SGMAP_BASE + CIA_SGMAP_SIZE - 1, - cia_sgmap_map, sgtable); - chipset.pci_sgmap = NULL; - chipset.dmsize = 1UL * 1024UL * 1024UL * 1024UL; - chipset.dmoffset = 1UL * 1024UL * 1024UL * 1024UL; - - if (cia_ispyxis) { - /* - * Pyxis has broken TLB invalidate. We use the NetBSD - * workaround of using another region to spill entries - * out of the TLB. The 'bug' region is 2Mb mapped at - * 128Mb. - */ - int i; - vm_offset_t pa; - u_int64_t *bugtable; - - REGVAL(CIA_PCI_W2BASE) = CIA_PYXIS_BUG_BASE | - CIA_PCI_WnBASE_SG_EN | CIA_PCI_WnBASE_W_EN; - alpha_mb(); - - REGVAL(CIA_PCI_W2MASK) = CIA_PCI_WnMASK_2M; - alpha_mb(); - - bugtable = contigmalloc(8192, M_DEVBUF, M_NOWAIT, - 0, (1L<<34), - 2*1024, (1L<<34)); - if (!bugtable) - panic("cia_init_sgmap: can't allocate page table"); - REGVAL(CIA_PCI_T2BASE) = - (pmap_kextract((vm_offset_t) bugtable) - >> CIA_PCI_TnBASE_SHIFT); - - pa = sgmap_overflow_page(); - for (i = 0; i < alpha_btop(CIA_PYXIS_BUG_SIZE); i++) - bugtable[i] = ((pa >> 13) << 1) | 1; - } -} - -void -cia_init() -{ - static int initted = 0; - static union space { - struct bwx_space bwx; - struct swiz_space swiz; - } io_space, mem_space; - - if (initted) return; - initted = 1; - - if (chipset_bwx == 0) { - swiz_init_space(&io_space.swiz, KV(CIA_PCI_SIO1)); - swiz_init_space_hae(&mem_space.swiz, KV(CIA_PCI_SMEM1), - cia_swiz_set_hae_mem, 0); - - chipset = cia_swiz_chipset; - } else { - bwx_init_space(&io_space.bwx, KV(CIA_EV56_BWIO)); - bwx_init_space(&mem_space.bwx, KV(CIA_EV56_BWMEM)); - - chipset = cia_bwx_chipset; - } - cia_hae_mem = REGVAL(CIA_CSR_HAE_MEM); - - busspace_isa_io = (struct alpha_busspace *) &io_space; - busspace_isa_mem = (struct alpha_busspace *) &mem_space; - - if (platform.pci_intr_init) - platform.pci_intr_init(); -} - -static int -cia_probe(device_t dev) -{ - uintptr_t use_bwx = 1; - device_t child; - - if (cia0) - return ENXIO; - cia0 = dev; - device_set_desc(dev, "2117x Core Logic chipset"); /* XXX */ - - isa_init_intr(); - - cia_rev = REGVAL(CIA_CSR_REV) & REV_MASK; - - /* - * Determine if we have a Pyxis. Only two systypes can - * have this: the EB164 systype (AlphaPC164LX and AlphaPC164SX) - * and the DEC_ST550 systype (Miata). - */ - if ((hwrpb->rpb_type == ST_EB164 && - (hwrpb->rpb_variation & SV_ST_MASK) >= SV_ST_ALPHAPC164LX_400) || - hwrpb->rpb_type == ST_DEC_550) - cia_ispyxis = TRUE; - else - cia_ispyxis = FALSE; - - cia_init_sgmap(); - - /* - * ALCOR/ALCOR2 Revisions >= 2 and Pyxis have the CNFG register. - */ - if (cia_rev >= 2 || cia_ispyxis) - cia_config = REGVAL(CIA_CSR_CNFG); - else - cia_config = 0; - - if ((alpha_implver() < ALPHA_IMPLVER_EV5) || - (alpha_amask(ALPHA_AMASK_BWX) != 0) || - (cia_config & CNFG_BWEN) == 0) { - use_bwx = 0; - } else { - use_bwx = 1; - } - - if (cia_ispyxis) { - if (use_bwx == 0) { - printf("PYXIS but not BWX?\n"); - } - } - - child = device_add_child(dev, "pcib", 0); - chipset_bwx = use_bwx = (use_bwx == (uintptr_t) 1); - device_set_ivars(child, (void *)use_bwx); - return 0; -} - -static int -cia_attach(device_t dev) -{ - char* name; - int pass; - - cia_init(); - - name = cia_ispyxis ? "Pyxis" : "ALCOR/ALCOR2"; - if (cia_ispyxis) { - name = "Pyxis"; - pass = cia_rev; - } else { - name = "ALCOR/ALCOR2"; - pass = cia_rev+1; - } - printf("cia0: %s, pass %d\n", name, pass); - if (cia_config) - printf("cia0: extended capabilities: %b\n", - cia_config, CIA_CSR_CNFG_BITS); - -#ifdef DEC_ST550 - if (hwrpb->rpb_type == ST_DEC_550 && - (hwrpb->rpb_variation & SV_ST_MASK) < SV_ST_MIATA_1_5) { - /* - * Miata 1 systems have a bug: DMA cannot cross - * an 8k boundary! Make sure PCI read prefetching - * is disabled on these chips. Note that secondary - * PCI busses don't have this problem, because of - * the way PPBs handle PCI read requests. - * - * In the 21174 Technical Reference Manual, this is - * actually documented as "Pyxis Pass 1", but apparently - * there are chips that report themselves as "Pass 1" - * which do not have the bug! Miatas with the Cypress - * PCI-ISA bridge (i.e. Miata 1.5 and Miata 2) do not - * have the bug, so we use this check. - * - * XXX We also need to deal with this boundary constraint - * XXX in the PCI bus 0 (and ISA) DMA tags, but some - * XXX drivers are going to need to be changed first. - */ - u_int32_t ctrl; - - /* XXX no bets... */ - printf("cia0: WARNING: Pyxis pass 1 DMA bug; no bets...\n"); - - alpha_mb(); - ctrl = REGVAL(CIA_CSR_CTRL); - ctrl &= ~(CTRL_RD_TYPE|CTRL_RL_TYPE|CTRL_RM_TYPE); - REGVAL(CIA_CSR_CTRL) = ctrl; - alpha_mb(); - } -#endif - - if (!platform.iointr) /* XXX */ - set_iointr(alpha_dispatch_intr); - - if (chipset_bwx) { - snprintf(chipset_type, sizeof(chipset_type), "cia/bwx"); - chipset_bwx = 1; - chipset_ports = CIA_EV56_BWIO; - chipset_memory = CIA_EV56_BWMEM; - chipset_dense = CIA_PCI_DENSE; - } else { - snprintf(chipset_type, sizeof(chipset_type), "cia/swiz"); - chipset_bwx = 0; - chipset_ports = CIA_PCI_SIO1; - chipset_memory = CIA_PCI_SMEM1; - chipset_dense = CIA_PCI_DENSE; - chipset_hae_mask = 7L << 29; - } - - bus_generic_attach(dev); - return 0; -} - -static void -cia_disable_intr(uintptr_t vector) -{ - int irq; - - irq = (vector - 0x900) >> 4; - mtx_lock_spin(&icu_lock); - platform.pci_intr_disable(irq); - mtx_unlock_spin(&icu_lock); -} - -static void -cia_enable_intr(uintptr_t vector) -{ - int irq; - - irq = (vector - 0x900) >> 4; - mtx_lock_spin(&icu_lock); - platform.pci_intr_enable(irq); - mtx_unlock_spin(&icu_lock); -} - -static int -cia_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, - driver_intr_t *intr, void *arg, void **cookiep) -{ - int error, start; - - error = rman_activate_resource(irq); - if (error) - return error; - start = rman_get_start(irq); - - error = alpha_setup_intr( - device_get_nameunit(child ? child : dev), - 0x900 + (start << 4), intr, arg, flags, cookiep, - &intrcnt[INTRCNT_EB164_IRQ + start], - cia_disable_intr, cia_enable_intr); - if (error) - return error; - - /* Enable PCI interrupt */ - mtx_lock_spin(&icu_lock); - platform.pci_intr_enable(start); - mtx_unlock_spin(&icu_lock); - - device_printf(child, "interrupting at CIA irq %d\n", start); - - return 0; -} - -static int -cia_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie) -{ - alpha_teardown_intr(cookie); - return rman_deactivate_resource(irq); -} - -DRIVER_MODULE(cia, root, cia_driver, cia_devclass, 0, 0); diff --git a/sys/alpha/pci/cia_pci.c b/sys/alpha/pci/cia_pci.c deleted file mode 100644 index 69fd4f3..0000000 --- a/sys/alpha/pci/cia_pci.c +++ /dev/null @@ -1,445 +0,0 @@ -/*- - * 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. - * - */ -/*- - * Copyright (c) 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) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <machine/md_var.h> -#include <sys/rman.h> -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <machine/cpuconf.h> -#include <machine/bwx.h> -#include <machine/swiz.h> - -#include <alpha/pci/ciareg.h> -#include <alpha/pci/ciavar.h> -#include <alpha/pci/pcibus.h> -#include <alpha/isa/isavar.h> - -#include "alphapci_if.h" -#include "pcib_if.h" - -#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) - -static devclass_t pcib_devclass; - -static int -cia_pcib_probe(device_t dev) -{ - device_set_desc(dev, "2117x PCI host bus adapter"); - - pci_init_resources(); - device_add_child(dev, "pci", 0); - - return 0; -} - -static int -cia_pcib_read_ivar(device_t dev, device_t child, int which, u_long *result) -{ - switch (which) { - case PCIB_IVAR_BUS: - *result = 0; - return 0; - } - return ENOENT; -} - -static void * -cia_pcib_cvt_dense(device_t dev, vm_offset_t addr) -{ - addr &= 0xffffffffUL; - return (void *) KV(addr | CIA_PCI_DENSE); -} - -static void * -cia_pcib_cvt_bwx(device_t dev, vm_offset_t addr) -{ - if (chipset_bwx) { - addr &= 0xffffffffUL; - return (void *) KV(addr | CIA_EV56_BWMEM); - } else { - return 0; - } -} - -static void -cia_clear_abort(void) -{ - /* - * Some (apparently-common) revisions of EB164 and AlphaStation - * firmware do the Wrong thing with PCI master and target aborts, - * which are caused by accesing the configuration space of devices - * that don't exist (for example). - * - * To work around this, we clear the CIA error register's PCI - * master and target abort bits before touching PCI configuration - * space and check it afterwards. If it indicates a master or target - * abort, the device wasn't there so we return 0xffffffff. - */ - REGVAL(CIA_CSR_CIA_ERR) = CIA_ERR_RCVD_MAS_ABT|CIA_ERR_RCVD_TAR_ABT; - alpha_mb(); - alpha_pal_draina(); -} - -static int -cia_check_abort(void) -{ - u_int32_t errbits; - int ba = 0; - - alpha_pal_draina(); - alpha_mb(); - errbits = REGVAL(CIA_CSR_CIA_ERR); - if (errbits & (CIA_ERR_RCVD_MAS_ABT|CIA_ERR_RCVD_TAR_ABT)) - ba = 1; - - if (errbits) { - REGVAL(CIA_CSR_CIA_ERR) = errbits; - alpha_mb(); - alpha_pal_draina(); - } - - return ba; -} - -#define CIA_BWX_CFGADDR(b, s, f, r) \ - KV(((b) ? CIA_EV56_BWCONF1 : CIA_EV56_BWCONF0) \ - | ((b) << 16) | ((s) << 11) | ((f) << 8) | (r)) - -#define BWX_CFGREAD(b, s, f, r, width, type, op) do { \ - vm_offset_t va = CIA_BWX_CFGADDR(b, s, f, r); \ - type data; \ - cia_clear_abort(); \ - if (badaddr((caddr_t)va, width)) { \ - cia_check_abort(); \ - return ~0; \ - } \ - data = op(va); \ - if (cia_check_abort()) \ - return ~0; \ - return data; \ -} while (0) - -#define BWX_CFGWRITE(b, s, f, r, data, width, type, op) do { \ - vm_offset_t va = CIA_BWX_CFGADDR(b, s, f, r); \ - cia_clear_abort(); \ - if (badaddr((caddr_t)va, width)) return; \ - op(va, data); \ - cia_check_abort(); \ - return; \ -} while (0) - -#define CIA_SWIZ_CFGOFF(b, s, f, r) \ - (((b) << 16) | ((s) << 11) | ((f) << 8) | (r)) - -/* when doing a type 1 pci configuration space access, we - * must set a bit in the CIA_CSR_CFG register & clear it - * when we're done -*/ - -#define CIA_TYPE1_SETUP(b,s,old_cfg) if((b)) { \ - do { \ - (s) = splhigh(); \ - (old_cfg) = REGVAL(CIA_CSR_CFG); \ - alpha_mb(); \ - REGVAL(CIA_CSR_CFG) = (old_cfg) | 0x1; \ - alpha_mb(); \ - } while(0); \ -} - -#define CIA_TYPE1_TEARDOWN(b,s,old_cfg) if((b)) { \ - do { \ - alpha_mb(); \ - REGVAL(CIA_CSR_CFG) = (old_cfg); \ - alpha_mb(); \ - splx((s)); \ - } while(0); \ -} - -/* - * From NetBSD: - * Some (apparently-common) revisions of EB164 and AlphaStation - * firmware do the Wrong thing with PCI master and target aborts, - * which are caused by accesing the configuration space of devices - * that don't exist (for example). - * - * To work around this, we clear the CIA error register's PCI - * master and target abort bits before touching PCI configuration - * space and check it afterwards. If it indicates a master or target - * abort, the device wasn't there so we return ~0 - */ - - -#define SWIZ_CFGREAD(b, s, f, r, width, type) do { \ - type val = ~0; \ - int ipl = 0; \ - u_int32_t old_cfg = 0, errbits; \ - vm_offset_t off = CIA_SWIZ_CFGOFF(b, s, f, r); \ - vm_offset_t kv = SPARSE_##width##_ADDRESS(KV(CIA_PCI_CONF), off); \ - REGVAL(CIA_CSR_CIA_ERR) = CIA_ERR_RCVD_MAS_ABT|CIA_ERR_RCVD_TAR_ABT; \ - alpha_mb(); \ - CIA_TYPE1_SETUP(b,ipl,old_cfg); \ - if (!badaddr((caddr_t)kv, sizeof(type))) { \ - val = SPARSE_##width##_EXTRACT(off, SPARSE_READ(kv)); \ - } \ - CIA_TYPE1_TEARDOWN(b,ipl,old_cfg); \ - errbits = REGVAL(CIA_CSR_CIA_ERR); \ - if (errbits & (CIA_ERR_RCVD_MAS_ABT|CIA_ERR_RCVD_TAR_ABT)) \ - val = ~0; \ - if (errbits) { \ - REGVAL(CIA_CSR_CIA_ERR) = errbits; \ - alpha_mb(); \ - alpha_pal_draina(); \ - } \ - return val; \ -} while (0) - -#define SWIZ_CFGWRITE(b, s, f, r, data, width, type) do { \ - int ipl = 0; \ - u_int32_t old_cfg = 0; \ - vm_offset_t off = CIA_SWIZ_CFGOFF(b, s, f, r); \ - vm_offset_t kv = SPARSE_##width##_ADDRESS(KV(CIA_PCI_CONF), off); \ - alpha_mb(); \ - CIA_TYPE1_SETUP(b,ipl,old_cfg); \ - if (!badaddr((caddr_t)kv, sizeof(type))) { \ - SPARSE_WRITE(kv, SPARSE_##width##_INSERT(off, data)); \ - alpha_wmb(); \ - } \ - CIA_TYPE1_TEARDOWN(b,ipl,old_cfg); \ - return; \ -} while (0) - -static u_int32_t -cia_pcib_swiz_read_config(u_int b, u_int s, u_int f, u_int reg, int width) -{ - switch (width) { - case 1: - SWIZ_CFGREAD(b, s, f, reg, BYTE, u_int8_t); - break; - case 2: - SWIZ_CFGREAD(b, s, f, reg, WORD, u_int16_t); - break; - case 4: - SWIZ_CFGREAD(b, s, f, reg, LONG, u_int32_t); - } - return ~0; -} - -static void -cia_pcib_swiz_write_config(u_int b, u_int s, u_int f, u_int reg, - u_int32_t val, int width) -{ - switch (width) { - case 1: - SWIZ_CFGWRITE(b, s, f, reg, val, BYTE, u_int8_t); - break; - case 2: - SWIZ_CFGWRITE(b, s, f, reg, val, WORD, u_int16_t); - break; - case 4: - SWIZ_CFGWRITE(b, s, f, reg, val, LONG, u_int32_t); - } -} - -static u_int32_t -cia_pcib_bwx_read_config(u_int b, u_int s, u_int f, u_int reg, int width) -{ - switch (width) { - case 1: - BWX_CFGREAD(b, s, f, reg, 1, u_int8_t, ldbu); - break; - case 2: - BWX_CFGREAD(b, s, f, reg, 2, u_int16_t, ldwu); - break; - case 4: - BWX_CFGREAD(b, s, f, reg, 4, u_int32_t, ldl); - } - return ~0; -} - -static void -cia_pcib_bwx_write_config(u_int b, u_int s, u_int f, u_int reg, - u_int32_t val, u_int width) -{ - switch (width) { - case 1: - BWX_CFGWRITE(b, s, f, reg, val, 1, u_int8_t, stb); - break; - case 2: - BWX_CFGWRITE(b, s, f, reg, val, 2, u_int16_t, stw); - break; - case 4: - BWX_CFGWRITE(b, s, f, reg, val, 4, u_int32_t, stl); - } -} - -static int -cia_pcib_maxslots(device_t dev) -{ - return 31; -} - -static u_int32_t -cia_pcib_read_config(device_t dev, int b, int s, int f, - int reg, int width) -{ - pcicfgregs cfg; - - if ((reg == PCIR_INTLINE) && (width == 1) && - (platform.pci_intr_map != NULL)) { - cfg.bus = b; - cfg.slot = s; - cfg.func = f; - cfg.intline = 255; - cfg.intpin = - cia_pcib_read_config(dev, b, s, f, PCIR_INTPIN, 1); - platform.pci_intr_map((void *)&cfg); - if (cfg.intline != 255) - return cfg.intline; - } - - if (chipset_bwx) - return cia_pcib_bwx_read_config(b, s, f, reg, width); - else - return cia_pcib_swiz_read_config(b, s, f, reg, width); -} - -static void -cia_pcib_write_config(device_t dev, int b, int s, int f, - int reg, u_int32_t val, int width) -{ - if (chipset_bwx) - cia_pcib_bwx_write_config(b, s, f, reg, val, width); - else - cia_pcib_swiz_write_config(b, s, f, reg, val, width); -} - -static device_method_t cia_pcib_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, cia_pcib_probe), - DEVMETHOD(device_attach, bus_generic_attach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, cia_pcib_read_ivar), - DEVMETHOD(bus_alloc_resource, alpha_pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), - DEVMETHOD(bus_setup_intr, alpha_platform_pci_setup_intr), - DEVMETHOD(bus_teardown_intr, alpha_platform_pci_teardown_intr), - - /* alphapci interface */ - DEVMETHOD(alphapci_cvt_dense, cia_pcib_cvt_dense), - DEVMETHOD(alphapci_cvt_bwx, cia_pcib_cvt_bwx), - - /* pcib interface */ - DEVMETHOD(pcib_maxslots, cia_pcib_maxslots), - DEVMETHOD(pcib_read_config, cia_pcib_read_config), - DEVMETHOD(pcib_write_config, cia_pcib_write_config), - DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), - - { 0, 0 } -}; - -static driver_t cia_pcib_driver = { - "pcib", - cia_pcib_methods, - 1, -}; - -DRIVER_MODULE(pcib, cia, cia_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/alpha/pci/ciareg.h b/sys/alpha/pci/ciareg.h deleted file mode 100644 index 4b5d153..0000000 --- a/sys/alpha/pci/ciareg.h +++ /dev/null @@ -1,215 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: ciareg.h,v 1.22 1998/06/06 20:40:14 thorpej Exp $ */ - -/*- - * Copyright (c) 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Authors: Chris G. Demetriou, Jason R. Thorpe - * - * 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. - */ - -/* - * 21171 Chipset registers and constants. - * - * Taken from EC-QE18B-TE. - */ - -#define REGVAL(r) (*(volatile int32_t *)ALPHA_PHYS_TO_K0SEG(r)) -#define REGVAL64(r) (*(volatile u_int64_t *)ALPHA_PHYS_TO_K0SEG(r)) - -/* - * Base addresses - */ -#define CIA_PCI_SMEM1 0x8000000000UL -#define CIA_PCI_SMEM2 0x8400000000UL -#define CIA_PCI_SMEM3 0x8500000000UL -#define CIA_PCI_SIO1 0x8580000000UL -#define CIA_PCI_SIO2 0x85c0000000UL -#define CIA_PCI_DENSE 0x8600000000UL -#define CIA_PCI_CONF 0x8700000000UL -#define CIA_PCI_IACK 0x8720000000UL -#define CIA_CSRS 0x8740000000UL -#define CIA_PCI_MC_CSRS 0x8750000000UL -#define CIA_PCI_ATRANS 0x8760000000UL -#define CIA_PCI_TBIA 0x8760000100UL -#define CIA_EV56_BWMEM 0x8800000000UL -#define CIA_EV56_BWIO 0x8900000000UL -#define CIA_EV56_BWCONF0 0x8a00000000UL -#define CIA_EV56_BWCONF1 0x8b00000000UL - -#define CIA_PCI_W0BASE 0x8760000400UL -#define CIA_PCI_W0MASK 0x8760000440UL -#define CIA_PCI_T0BASE 0x8760000480UL - -#define CIA_PCI_W1BASE 0x8760000500UL -#define CIA_PCI_W1MASK 0x8760000540UL -#define CIA_PCI_T1BASE 0x8760000580UL - -#define CIA_PCI_W2BASE 0x8760000600UL -#define CIA_PCI_W2MASK 0x8760000640UL -#define CIA_PCI_T2BASE 0x8760000680UL - -#define CIA_PCI_W3BASE 0x8760000700UL -#define CIA_PCI_W3MASK 0x8760000740UL -#define CIA_PCI_T3BASE 0x8760000780UL - -#define PYXIS_INT_REQ 0x87a0000000UL -#define PYXIS_INT_MASK 0x87a0000040UL -#define PYXIS_GPO 0x87a0000180UL - -/* - * Values for CIA_PCI_TBIA - */ -#define CIA_PCI_TBIA_NOOP 0 /* no operation */ -#define CIA_PCI_TBIA_LOCKED 1 /* invalidate and unlock locked tags */ -#define CIA_PCI_TBIA_UNLOCKED 2 /* invalidate unlocked tags */ -#define CIA_PCI_TBIA_ALL 3 /* invalidate and unlock all tags */ - -#define CIA_TLB_NTAGS 8 /* number of TLB entries */ - -/* - * Values for CIA_PCI_WnBASE - */ -#define CIA_PCI_WnBASE_W_BASE 0xfff00000 -#define CIA_PCI_WnBASE_DAC_EN 0x00000008 /* W3BASE only */ -#define CIA_PCI_WnBASE_MEMCS_EN 0x00000004 /* W0BASE only */ -#define CIA_PCI_WnBASE_SG_EN 0x00000002 -#define CIA_PCI_WnBASE_W_EN 0x00000001 - -/* - * Values for CIA_PCI_WnMASK - */ -#define CIA_PCI_WnMASK_W_MASK 0xfff00000 -#define CIA_PCI_WnMASK_1M 0x00000000 -#define CIA_PCI_WnMASK_2M 0x00100000 -#define CIA_PCI_WnMASK_4M 0x00300000 -#define CIA_PCI_WnMASK_8M 0x00700000 -#define CIA_PCI_WnMASK_16M 0x00f00000 -#define CIA_PCI_WnMASK_32M 0x01f00000 -#define CIA_PCI_WnMASK_64M 0x03f00000 -#define CIA_PCI_WnMASK_128M 0x07f00000 -#define CIA_PCI_WnMASK_256M 0x0ff00000 -#define CIA_PCI_WnMASK_512M 0x1ff00000 -#define CIA_PCI_WnMASK_1G 0x3ff00000 -#define CIA_PCI_WnMASK_2G 0x7ff00000 -#define CIA_PCI_WnMASK_4G 0xfff00000 - -/* - * Values for CIA_PCI_TnBASE - */ -#define CIA_PCI_TnBASE_MASK 0xfffffff0 -#define CIA_PCI_TnBASE_SHIFT 2 - -/* - * General CSRs - */ - -#define CIA_CSR_REV (CIA_CSRS + 0x80) - -#define REV_MASK 0x000000ff -#define REV_ALT_MEM 0x00000100 /* not on Pyxis */ - -#define REV_PYXIS_ID_MASK 0x0000ff00 -#define REV_PYXIS_ID_21174 0x00000100 - -#define CIA_CSR_CTRL (CIA_CSRS + 0x100) - -#define CTRL_RCI_EN 0x00000001 -#define CTRL_PCI_LOCK_EN 0x00000002 -#define CTRL_PCI_LOOP_EN 0x00000004 -#define CTRL_FST_BB_EN 0x00000008 -#define CTRL_PCI_MST_EN 0x00000010 -#define CTRL_PCI_MEM_EN 0x00000020 -#define CTRL_PCI_REQ64_EN 0x00000040 -#define CTRL_PCI_ACK64_EN 0x00000080 -#define CTRL_ADDR_PE_EN 0x00000100 -#define CTRL_PERR_EN 0x00000200 -#define CTRL_FILL_ERR_EN 0x00000400 -#define CTRL_ECC_CHK_EN 0x00001000 -#define CTRL_CACK_EN_PE 0x00002000 -#define CTRL_CON_IDLE_BC 0x00004000 -#define CTRL_CSR_IOA_BYPASS 0x00008000 -#define CTRL_IO_FLUSHREQ_EN 0x00010000 -#define CTRL_CPU_CLUSHREQ_EN 0x00020000 -#define CTRL_ARB_EV5_EN 0x00040000 -#define CTRL_EN_ARB_LINK 0x00080000 -#define CTRL_RD_TYPE 0x00300000 -#define CTRL_RL_TYPE 0x03000000 -#define CTRL_RM_TYPE 0x30000000 - -/* a.k.a. CIA_CSR_PYXIS_CTRL1 */ -#define CIA_CSR_CNFG (CIA_CSRS + 0x140) - -#define CNFG_BWEN 0x00000001 -#define CNFG_MWEN 0x00000010 -#define CNFG_DWEN 0x00000020 -#define CNFG_WLEN 0x00000100 - -#define CIA_CSR_CNFG_BITS "\20\11WLEN\6DWEN\5MWEN\1BWEN" - -#define CIA_CSR_HAE_MEM (CIA_CSRS + 0x400) - -#define HAE_MEM_REG1_START(x) (((u_int32_t)(x) & 0xe0000000UL) << 0) -#define HAE_MEM_REG1_MASK 0x1fffffffUL -#define HAE_MEM_REG2_START(x) (((u_int32_t)(x) & 0x0000f800UL) << 16) -#define HAE_MEM_REG2_MASK 0x07ffffffUL -#define HAE_MEM_REG3_START(x) (((u_int32_t)(x) & 0x000000fcUL) << 24) -#define HAE_MEM_REG3_MASK 0x03ffffffUL - -#define CIA_CSR_HAE_IO (CIA_CSRS + 0x440) - -#define HAE_IO_REG1_START(x) 0UL -#define HAE_IO_REG1_MASK 0x01ffffffUL -#define HAE_IO_REG2_START(x) (((u_int32_t)(x) & 0xfe000000UL) << 0) -#define HAE_IO_REG2_MASK 0x01ffffffUL - -#define CIA_CSR_CFG (CIA_CSRS + 0x480) - -#define CFG_CFG_MASK 0x00000003UL - -#define CIA_CSR_CIA_ERR (CIA_CSRS + 0x8200) - -#define CIA_ERR_COR_ERR 0x00000001 -#define CIA_ERR_UN_COR_ERR 0x00000002 -#define CIA_ERR_CPU_PE 0x00000004 -#define CIA_ERR_MEM_NEM 0x00000008 -#define CIA_ERR_PCI_SERR 0x00000010 -#define CIA_ERR_PERR 0x00000020 -#define CIA_ERR_PCI_ADDR_PE 0x00000040 -#define CIA_ERR_RCVD_MAS_ABT 0x00000080 -#define CIA_ERR_RCVD_TAR_ABT 0x00000100 -#define CIA_ERR_PA_PTE_INV 0x00000200 -#define CIA_ERR_FROM_WRT_ERR 0x00000400 -#define CIA_ERR_IOA_TIMEOUT 0x00000800 -#define CIA_ERR_LOST_COR_ERR 0x00010000 -#define CIA_ERR_LOST_UN_COR_ERR 0x00020000 -#define CIA_ERR_LOST_CPU_PE 0x00040000 -#define CIA_ERR_LOST_MEM_NEM 0x00080000 -#define CIA_ERR_LOST_PERR 0x00200000 -#define CIA_ERR_LOST_PCI_ADDR_PE 0x00400000 -#define CIA_ERR_LOST_RCVD_MAS_ABT 0x00800000 -#define CIA_ERR_LOST_RCVD_TAR_ABT 0x01000000 -#define CIA_ERR_LOST_PA_PTE_INV 0x02000000 -#define CIA_ERR_LOST_FROM_WRT_ERR 0x04000000 -#define CIA_ERR_LOST_IOA_TIMEOUT 0x08000000 -#define CIA_ERR_VALID 0x80000000 diff --git a/sys/alpha/pci/ciavar.h b/sys/alpha/pci/ciavar.h deleted file mode 100644 index 1e50032..0000000 --- a/sys/alpha/pci/ciavar.h +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -extern void cia_init(void); - diff --git a/sys/alpha/pci/irongate.c b/sys/alpha/pci/irongate.c deleted file mode 100644 index 6092bd7..0000000 --- a/sys/alpha/pci/irongate.c +++ /dev/null @@ -1,178 +0,0 @@ -/*- - * Copyright (c) 2000 Andrew Gallatin - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_cpu.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <sys/rman.h> -#include <sys/malloc.h> - -#include <dev/pci/pcivar.h> -#include <dev/pci/pcireg.h> -#include <alpha/isa/isavar.h> -#include <alpha/pci/irongatereg.h> -#include <alpha/pci/irongatevar.h> - -#include <machine/bwx.h> -#include <machine/cpuconf.h> -#include <machine/intr.h> -#include <machine/intrcnt.h> -#include <machine/md_var.h> -#include <machine/resource.h> -#include <machine/rpb.h> -#include <machine/sgmap.h> - -#include <vm/vm.h> -#include <vm/vm_page.h> - -#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) - -static devclass_t irongate_devclass; -static device_t irongate0; /* XXX only one for now */ - -struct irongate_softc { - int junk; /* no softc */ -}; - -#define IRONGATE_SOFTC(dev) (struct irongate_softc*) device_get_softc(dev) - -static alpha_chipset_read_hae_t irongate_read_hae; -static alpha_chipset_write_hae_t irongate_write_hae; - -static alpha_chipset_t irongate_chipset = { - irongate_read_hae, - irongate_write_hae, -}; - -/* - * There doesn't appear to be an hae on this platform - */ - - -static u_int64_t -irongate_read_hae(void) -{ - return 0; -} - -static void -irongate_write_hae(u_int64_t hae) -{ -} - -static int irongate_probe(device_t dev); -static int irongate_attach(device_t dev); - -static device_method_t irongate_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, irongate_probe), - DEVMETHOD(device_attach, irongate_attach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_setup_intr, isa_setup_intr), - DEVMETHOD(bus_teardown_intr, isa_teardown_intr), - - { 0, 0 } -}; - -static driver_t irongate_driver = { - "irongate", - irongate_methods, - sizeof(struct irongate_softc), -}; - -void -irongate_init() -{ - static int initted = 0; - static struct bwx_space io_space, mem_space; - - if (initted) return; - initted = 1; - - chipset = irongate_chipset; - - bwx_init_space(&io_space, KV(IRONGATE_IO)); - bwx_init_space(&mem_space, KV(IRONGATE_MEM)); - - busspace_isa_io = (struct alpha_busspace *) &io_space; - busspace_isa_mem = (struct alpha_busspace *) &mem_space; - - if (platform.pci_intr_init) - platform.pci_intr_init(); -} - -static int -irongate_probe(device_t dev) -{ - - if (irongate0) - return ENXIO; - irongate0 = dev; - device_set_desc(dev, "AMD 751 Core Logic chipset"); - isa_init_intr(); - device_add_child(dev, "pcib", 0); - return 0; -} - - - -static int -irongate_attach(device_t dev) -{ - irongate_init(); - - if (!platform.iointr) /* XXX */ - set_iointr(alpha_dispatch_intr); - - snprintf(chipset_type, sizeof(chipset_type), "irongate"); - chipset_bwx = 1; - - chipset_ports = IRONGATE_IO; - chipset_memory = IRONGATE_MEM; - chipset_dense = IRONGATE_MEM; - /* no s/g support in this chipset, must use bounce-buffers */ - chipset.sgmap = NULL; - chipset.pci_sgmap = NULL; - chipset.dmsize = 4UL * 1024UL * 1024UL * 1024UL; - chipset.dmoffset = 0; - - bus_generic_attach(dev); - - return 0; -} - -DRIVER_MODULE(irongate, root, irongate_driver, irongate_devclass, 0, 0); - diff --git a/sys/alpha/pci/irongate_pci.c b/sys/alpha/pci/irongate_pci.c deleted file mode 100644 index e3bdf69..0000000 --- a/sys/alpha/pci/irongate_pci.c +++ /dev/null @@ -1,221 +0,0 @@ -/*- - * Copyright (c) 2000 Andrew Gallatin - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/malloc.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <machine/md_var.h> -#include <machine/bwx.h> -#include <sys/rman.h> -#include <dev/pci/pcivar.h> -#include <dev/pci/pcireg.h> -#include <alpha/pci/irongatereg.h> -#include <alpha/pci/irongatevar.h> -#include <alpha/pci/pcibus.h> - -#include "alphapci_if.h" -#include "pcib_if.h" - -#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) - -static devclass_t pcib_devclass; - -static int -irongate_pcib_probe(device_t dev) -{ - - device_set_desc(dev, "AMD 751 PCI host bus adapter"); - - pci_init_resources(); - device_add_child(dev, "pci", 0); - - /* - * XXX -- The SRM console doesn't properly initialize - * the AcerLabs M1533C southbridge. We must turn off 32-bit - * DMA support. - */ - if ((0x153310b9 == PCIB_READ_CONFIG(dev, 0, 7, 0, - PCIR_DEVVENDOR, 4))) { - u_int8_t value = PCIB_READ_CONFIG(dev, 0, 7, 0, 0x42, 1); - value &= ~0x40; - PCIB_WRITE_CONFIG(dev, 0, 7, 0, 0x42, 0, 1); - } - - return 0; -} - -static int -irongate_pcib_read_ivar(device_t dev, device_t child, int which, u_long *result) -{ - switch (which) { - case PCIB_IVAR_BUS: - *result = 0; - return 0; - } - return ENOENT; -} - -static void * -irongate_pcib_cvt_dense(device_t dev, vm_offset_t addr) -{ - addr &= 0xffffffffUL; - return (void *) KV(addr | IRONGATE_MEM); -} - -static void * -irongate_pcib_cvt_bwx(device_t dev, vm_offset_t addr) -{ - addr &= 0xffffffffUL; - return (void *) KV(addr | IRONGATE_MEM); -} - -static int -irongate_pcib_maxslots(device_t dev) -{ - return 31; -} - -static void -irongate_clear_abort(void) -{ - alpha_mb(); - alpha_pal_draina(); -} - -static int -irongate_check_abort(void) -{ - alpha_pal_draina(); - alpha_mb(); - - return 0; -} - -#define IRONGATE_CFGADDR(b, s, f, r) \ - KV(IRONGATE_CONF | ((b) << 16) | ((s) << 11) | ((f) << 8) | (r)) - -#define CFGREAD(b, s, f, r, width, type, op) do { \ - vm_offset_t va; \ - type data; \ - va = IRONGATE_CFGADDR(b, s, f, r); \ - irongate_clear_abort(); \ - if (badaddr((caddr_t)va, width)) { \ - irongate_check_abort(); \ - return ~0; \ - } \ - data = op(va); \ - if (irongate_check_abort()) \ - return ~0; \ - return data; \ -} while (0) - -#define CFGWRITE(b, s, f, r, data, width, op) do { \ - vm_offset_t va; \ - va = IRONGATE_CFGADDR(b, s, f, r); \ - irongate_clear_abort(); \ - if (badaddr((caddr_t)va, width)) \ - return; \ - op(va, data); \ - irongate_check_abort(); \ -} while (0) - -static u_int32_t -irongate_pcib_read_config(device_t dev, u_int b, u_int s, u_int f, - u_int reg, int width) -{ - switch (width) { - case 1: - CFGREAD(b, s, f, reg, 1, u_int8_t, ldbu); - break; - case 2: - CFGREAD(b, s, f, reg, 2, u_int16_t, ldwu); - break; - case 4: - CFGREAD(b, s, f, reg, 4, u_int32_t, ldl); - } - return ~0; -} - -static void -irongate_pcib_write_config(device_t dev, u_int b, u_int s, u_int f, - u_int reg, u_int32_t val, int width) -{ - switch (width) { - case 1: - CFGWRITE(b, s, f, reg, val, 1, stb); - break; - case 2: - CFGWRITE(b, s, f, reg, val, 2, stw); - break; - case 4: - CFGWRITE(b, s, f, reg, val, 4, stl); - } -} - -static device_method_t irongate_pcib_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, irongate_pcib_probe), - DEVMETHOD(device_attach, bus_generic_attach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, irongate_pcib_read_ivar), - DEVMETHOD(bus_alloc_resource, alpha_pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - /* alphapci interface */ - DEVMETHOD(alphapci_cvt_dense, irongate_pcib_cvt_dense), - DEVMETHOD(alphapci_cvt_bwx, irongate_pcib_cvt_bwx), - - /* pcib interface */ - DEVMETHOD(pcib_maxslots, irongate_pcib_maxslots), - DEVMETHOD(pcib_read_config, irongate_pcib_read_config), - DEVMETHOD(pcib_write_config, irongate_pcib_write_config), - DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), - - { 0, 0 } -}; - -static driver_t irongate_pcib_driver = { - "pcib", - irongate_pcib_methods, - 1, -}; - -DRIVER_MODULE(pcib, irongate, irongate_pcib_driver, pcib_devclass, 0, 0); - - diff --git a/sys/alpha/pci/irongatereg.h b/sys/alpha/pci/irongatereg.h deleted file mode 100644 index 0d10d15..0000000 --- a/sys/alpha/pci/irongatereg.h +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * Copyright (c) 2000 Andrew Gallatin - * 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. - * - * $FreeBSD$ - */ - -/* - * AMD-751 Chipset registers and constants. - * - */ - - -/* - * memory / i/o space macros - * - */ - -#define IRONGATE_MEM 0x10000000000UL -#define IRONGATE_IACK_SC 0x101F8000000UL -#define IRONGATE_IO 0x101FC000000UL -#define IRONGATE_CONF 0x101FE000000UL diff --git a/sys/alpha/pci/irongatevar.h b/sys/alpha/pci/irongatevar.h deleted file mode 100644 index 31012d9..0000000 --- a/sys/alpha/pci/irongatevar.h +++ /dev/null @@ -1,30 +0,0 @@ -/*- - * Copyright (c) 2000 Andrew Gallatin - * 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. - * - * $FreeBSD$ - */ - -extern void irongate_init(void); - diff --git a/sys/alpha/pci/lca.c b/sys/alpha/pci/lca.c deleted file mode 100644 index c631a93..0000000 --- a/sys/alpha/pci/lca.c +++ /dev/null @@ -1,305 +0,0 @@ -/*- - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/malloc.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <sys/rman.h> -#include <sys/proc.h> -#include <sys/sched.h> - -#include <alpha/pci/lcareg.h> -#include <alpha/pci/lcavar.h> -#include <alpha/isa/isavar.h> - -#include <machine/cpuconf.h> -#include <machine/intr.h> -#include <machine/md_var.h> -#include <machine/sgmap.h> -#include <machine/swiz.h> - -#include <vm/vm.h> -#include <vm/vm_page.h> - -#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) - -static devclass_t lca_devclass; -static device_t lca0; /* XXX only one for now */ - -struct lca_softc { - int junk; -}; - -#define LCA_SOFTC(dev) (struct lca_softc*) device_get_softc(dev) - -static alpha_chipset_read_hae_t lca_read_hae; -static alpha_chipset_write_hae_t lca_write_hae; - -static alpha_chipset_t lca_chipset = { - lca_read_hae, - lca_write_hae, -}; - -/* - * The LCA HAE is write-only. According to NetBSD, this is where it starts. - */ -static u_int32_t lca_hae_mem = 0x80000000; - -/* - * The first 16Mb ignores the HAE. The next 112Mb uses the HAE to set - * the high bits of the PCI address. - */ -#define REG1 (1UL << 24) - -static u_int32_t -lca_set_hae_mem(void *arg, u_int32_t pa) -{ - int s; - u_int32_t msb; - if(pa >= REG1){ - msb = pa & 0xf8000000; - pa -= msb; - s = splhigh(); - if (msb != lca_hae_mem) { - lca_hae_mem = msb; - REGVAL(LCA_IOC_HAE) = lca_hae_mem; - alpha_mb(); - alpha_mb(); - } - splx(s); - } - return pa; -} - -static u_int64_t -lca_read_hae(void) -{ - return lca_hae_mem & 0xf8000000; -} - -static void -lca_write_hae(u_int64_t hae) -{ - u_int32_t pa = hae; - lca_set_hae_mem(0, pa); -} - -static int lca_probe(device_t dev); -static int lca_attach(device_t dev); -static device_method_t lca_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, lca_probe), - DEVMETHOD(device_attach, lca_attach), - - /* Bus interface */ - DEVMETHOD(bus_setup_intr, isa_setup_intr), - DEVMETHOD(bus_teardown_intr, isa_teardown_intr), - - { 0, 0 } -}; - -static driver_t lca_driver = { - "lca", - lca_methods, - sizeof(struct lca_softc), -}; - -#define LCA_SGMAP_BASE (8*1024*1024) -#define LCA_SGMAP_SIZE (8*1024*1024) - -static void -lca_sgmap_invalidate(void) -{ - alpha_mb(); - REGVAL(LCA_IOC_TBIA) = 0; - alpha_mb(); -} - -static void -lca_sgmap_map(void *arg, bus_addr_t ba, vm_offset_t pa) -{ - u_int64_t *sgtable = arg; - int index = alpha_btop(ba - LCA_SGMAP_BASE); - - if (pa) { - if (pa > (1L<<32)) - panic("lca_sgmap_map: can't map address 0x%lx", pa); - sgtable[index] = ((pa >> 13) << 1) | 1; - } else { - sgtable[index] = 0; - } - alpha_mb(); - lca_sgmap_invalidate(); -} - -static void -lca_init_sgmap(void) -{ - void *sgtable; - - /* - * First setup Window 0 to map 8Mb to 16Mb with an - * sgmap. Allocate the map aligned to a 32 boundary. - */ - REGVAL64(LCA_IOC_W_BASE0) = LCA_SGMAP_BASE | - IOC_W_BASE_SG | IOC_W_BASE_WEN; - alpha_mb(); - - REGVAL64(LCA_IOC_W_MASK0) = IOC_W_MASK_8M; - alpha_mb(); - - sgtable = contigmalloc(8192, M_DEVBUF, M_NOWAIT, - 0, (1L<<34), - 32*1024, (1L<<34)); - if (!sgtable) - panic("lca_init_sgmap: can't allocate page table"); - chipset.sgmap = sgmap_map_create(LCA_SGMAP_BASE, - LCA_SGMAP_BASE + LCA_SGMAP_SIZE, - lca_sgmap_map, sgtable); - chipset.pci_sgmap = NULL; - chipset.dmsize = 1UL * 1024UL * 1024UL * 1024UL; - chipset.dmoffset = 1UL * 1024UL * 1024UL * 1024UL; - - REGVAL64(LCA_IOC_W_T_BASE0) = pmap_kextract((vm_offset_t) sgtable); - alpha_mb(); - REGVAL64(LCA_IOC_TB_ENA) = IOC_TB_ENA_TEN; - alpha_mb(); - lca_sgmap_invalidate(); -} - -void -lca_init() -{ - static int initted = 0; - static struct swiz_space io_space, mem_space; - - if (initted) return; - initted = 1; - - swiz_init_space(&io_space, KV(LCA_PCI_SIO)); - swiz_init_space_hae(&mem_space, KV(LCA_PCI_SPARSE), - lca_set_hae_mem, 0); - - busspace_isa_io = (struct alpha_busspace *) &io_space; - busspace_isa_mem = (struct alpha_busspace *) &mem_space; - - /* Type 0 PCI conf access. */ - REGVAL64(LCA_IOC_CONF) = 0; - - if (platform.pci_intr_init) - platform.pci_intr_init(); - - chipset = lca_chipset; -} - -static void -lca_machine_check(unsigned long mces, struct trapframe *framep, - unsigned long vector, unsigned long param); - -static void lca_cpu_idle (void); - -static int -lca_probe(device_t dev) -{ - if (lca0) - return ENXIO; - lca0 = dev; - device_set_desc(dev, "21066 Core Logic chipset"); /* XXX */ - - isa_init_intr(); - lca_init_sgmap(); - - platform.mcheck_handler = lca_machine_check; - platform.cpu_idle = lca_cpu_idle; - - device_add_child(dev, "pcib", 0); - - return 0; -} - -static int -lca_attach(device_t dev) -{ - lca_init(); - - set_iointr(alpha_dispatch_intr); - - snprintf(chipset_type, sizeof(chipset_type), "lca"); - chipset_bwx = 0; - chipset_ports = LCA_PCI_SIO; - chipset_memory = LCA_PCI_SPARSE; - chipset_dense = LCA_PCI_DENSE; - chipset_hae_mask = IOC_HAE_ADDREXT; - - bus_generic_attach(dev); - return 0; -} - -static void -lca_machine_check(unsigned long mces, struct trapframe *framep, - unsigned long vector, unsigned long param) -{ - long stat0; - - machine_check(mces, framep, vector, param); - /* clear error flags in IOC_STATUS0 register */ - stat0 = REGVAL64(LCA_IOC_STAT0); - REGVAL64(LCA_IOC_STAT0) = stat0; -} - -void -lca_cpu_idle (void) -{ - /* - * 0x0 = 1 - * 0x1 = 1.5 - * 0x2 = 2 - * 0x3 = 4 - * 0x4 = 8 - * 0x5 = 16 - */ - long override = 0x0; - long primary = 0x5; - long dma_ovr = 1; - long intr_ovr = 1; - - REGVAL64(LCA_PMR) = - (dma_ovr << 7) | (intr_ovr << 6) | (override << 3) | primary; - if (sched_runnable()) { - REGVAL64(LCA_PMR) = - (override << 3) | override; - } -} - -DRIVER_MODULE(lca, root, lca_driver, lca_devclass, 0, 0); - diff --git a/sys/alpha/pci/lca_pci.c b/sys/alpha/pci/lca_pci.c deleted file mode 100644 index 3b05e63..0000000 --- a/sys/alpha/pci/lca_pci.c +++ /dev/null @@ -1,238 +0,0 @@ -/*- - * 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, SPELCAL, 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <machine/resource.h> -#include <sys/rman.h> -#include <dev/pci/pcireg.h> -#include <dev/pci/pcivar.h> -#include <machine/cpuconf.h> -#include <machine/swiz.h> -#include <machine/md_var.h> - -#include <alpha/pci/lcareg.h> -#include <alpha/pci/lcavar.h> -#include <alpha/pci/pcibus.h> -#include <alpha/isa/isavar.h> - -#include "alphapci_if.h" -#include "pcib_if.h" - -#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) - -static devclass_t pcib_devclass; - -static int -lca_pcib_probe(device_t dev) -{ - device_set_desc(dev, "21066 PCI host bus adapter"); - - pci_init_resources(); - device_add_child(dev, "pci", 0); - - return 0; -} - -static int -lca_pcib_read_ivar(device_t dev, device_t child, int which, u_long *result) -{ - if (which == PCIB_IVAR_BUS) { - *result = 0; - return 0; - } - return ENOENT; -} - -static struct resource * -lca_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) -{ - struct resource *rv = NULL; - - if (type == SYS_RES_IRQ) - rv = isa_alloc_intr(bus, child, start); - else - rv = alpha_pci_alloc_resource(bus, child, type, rid, - start, end, count, flags); - if (rv != NULL) - rman_set_rid(rv, *rid); - return (rv); -} - -static int -lca_pcib_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - if (type == SYS_RES_IRQ) - return isa_release_intr(bus, child, r); - else - return pci_release_resource(bus, child, type, rid, r); -} - -static void * -lca_pcib_cvt_dense(device_t dev, vm_offset_t addr) -{ - addr &= 0xffffffffUL; - return (void *) KV(addr | LCA_PCI_DENSE); -} - -static int -lca_pcib_maxslots(device_t dev) -{ - return 15; -} - -#define LCA_CFGOFF(b, s, f, r) \ - ((b) ? (((b) << 16) | ((s) << 11) | ((f) << 8) | (r)) \ - : ((1 << ((s) + 11)) | ((f) << 8) | (r))) - -#define LCA_TYPE1_SETUP(b,s) if ((b)) { \ - do { \ - (s) = splhigh(); \ - alpha_mb(); \ - REGVAL(LCA_IOC_CONF) = 1; \ - alpha_mb(); \ - } while(0); \ -} - -#define LCA_TYPE1_TEARDOWN(b,s) if ((b)) { \ - do { \ - alpha_mb(); \ - REGVAL(LCA_IOC_CONF) = 0; \ - alpha_mb(); \ - splx((s)); \ - } while(0); \ -} - -#define CFGREAD(b, s, f, r, width, type) do { \ - type val = ~0; \ - int ipl = 0; \ - vm_offset_t off = LCA_CFGOFF(b, s, f, r); \ - vm_offset_t kv = SPARSE_##width##_ADDRESS(KV(LCA_PCI_CONF), off); \ - alpha_mb(); \ - LCA_TYPE1_SETUP(b,ipl); \ - if (!badaddr((caddr_t)kv, sizeof(type))) { \ - val = SPARSE_##width##_EXTRACT(off, SPARSE_READ(kv)); \ - } \ - LCA_TYPE1_TEARDOWN(b,ipl); \ - return val; \ -} while (0) - -#define CFGWRITE(b, s, f, r, data, width, type) do { \ - int ipl = 0; \ - vm_offset_t off = LCA_CFGOFF(b, s, f, r); \ - vm_offset_t kv = SPARSE_##width##_ADDRESS(KV(LCA_PCI_CONF), off); \ - alpha_mb(); \ - LCA_TYPE1_SETUP(b,ipl); \ - if (!badaddr((caddr_t)kv, sizeof(type))) { \ - SPARSE_WRITE(kv, SPARSE_##width##_INSERT(off, data)); \ - alpha_wmb(); \ - } \ - LCA_TYPE1_TEARDOWN(b,ipl); \ - return; \ -} while (0) - -u_int32_t -lca_pcib_read_config(device_t dev, u_int b, u_int s, u_int f, - u_int reg, int width) -{ - - if ((reg == PCIR_INTLINE) && (width == 1)) { - /* SRM left bad value; let intr_route fill them in later */ - return ~0; - } - - switch (width) { - case 1: - CFGREAD(b, s, f, reg, BYTE, u_int8_t); - break; - case 2: - CFGREAD(b, s, f, reg, WORD, u_int16_t); - break; - case 4: - CFGREAD(b, s, f, reg, LONG, u_int32_t); - } - return ~0; -} - -static void -lca_pcib_write_config(device_t dev, u_int b, u_int s, u_int f, - u_int reg, u_int32_t val, int width) -{ - switch (width) { - case 1: - CFGWRITE(b, s, f, reg, val, BYTE, u_int8_t); - break; - case 2: - CFGWRITE(b, s, f, reg, val, WORD, u_int16_t); - break; - case 4: - CFGWRITE(b, s, f, reg, val, LONG, u_int32_t); - } -} - -static device_method_t lca_pcib_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, lca_pcib_probe), - DEVMETHOD(device_attach, bus_generic_attach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, lca_pcib_read_ivar), - DEVMETHOD(bus_alloc_resource, lca_pcib_alloc_resource), - DEVMETHOD(bus_release_resource, lca_pcib_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - /* alphapci interface */ - DEVMETHOD(alphapci_cvt_dense, lca_pcib_cvt_dense), - - /* pcib interface */ - DEVMETHOD(pcib_maxslots, lca_pcib_maxslots), - DEVMETHOD(pcib_read_config, lca_pcib_read_config), - DEVMETHOD(pcib_write_config, lca_pcib_write_config), - DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), - - { 0, 0 } -}; - -static driver_t lca_pcib_driver = { - "pcib", - lca_pcib_methods, - 1, -}; - -DRIVER_MODULE(pcib, lca, lca_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/alpha/pci/lcareg.h b/sys/alpha/pci/lcareg.h deleted file mode 100644 index c6255d8..0000000 --- a/sys/alpha/pci/lcareg.h +++ /dev/null @@ -1,98 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: lcareg.h,v 1.8 1997/09/05 02:14:31 thorpej Exp $ */ - -/*- - * Copyright (c) 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Authors: Jeffrey Hsu, Jason R. Thorpe - * - * 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. - */ - -/* - * 21066 chip registers - */ - -#define REGVAL(r) (*(volatile int32_t *)ALPHA_PHYS_TO_K0SEG(r)) -#define REGVAL64(r) (*(volatile int64_t *)ALPHA_PHYS_TO_K0SEG(r)) - -/* - * Base addresses - */ -#define LCA_IOC_BASE 0x180000000L /* LCA IOC Regs */ -#define LCA_PCI_SIO 0x1c0000000L /* PCI Sp. I/O Space */ -#define LCA_PCI_CONF 0x1e0000000L /* PCI Conf. Space */ -#define LCA_PCI_SPARSE 0x200000000L /* PCI Sparse Space */ -#define LCA_PCI_DENSE 0x300000000L /* PCI Dense Space */ - -#define LCA_PMR 0x120000098L /* Power Management (21066A)*/ - -#define LCA_IOC_HAE LCA_IOC_BASE /* Host Address Ext. (64) */ -#define IOC_HAE_ADDREXT 0x00000000f8000000UL -#define IOC_HAE_RSVSD 0xffffffff07ffffffUL - -#define LCA_IOC_CONF (LCA_IOC_BASE + 0x020) /* Configuration Cycle Type */ - -#define LCA_IOC_STAT0 (LCA_IOC_BASE + 0x040) /* Status 0 */ -#define IOC_STAT0_CMD 0x000000000000000fUL /* PCI command mask */ -#define IOC_STAT0_ERR 0x0000000000000010UL /* IOC error indicator R/W1C */ -#define IOC_STAT0_LOST 0x0000000000000020UL /* IOC lose error info R/W1C */ -#define IOC_STAT0_THIT 0x0000000000000040UL /* test hit */ -#define IOC_STAT0_TREF 0x0000000000000080UL /* test reference */ -#define IOC_STAT0_CODE 0x0000000000000700UL /* code mask */ -#define IOC_STAT0_CODESHIFT 8 -#define IOC_STAT0_P_NBR 0x00000000ffffe000UL /* page number mask */ - -#define LCA_IOC_STAT1 (LCA_IOC_BASE + 0x060) /* Status 1 */ -#define IOC_STAT1_ADDR 0x00000000ffffffffUL /* PCI address mask */ - -#define LCA_IOC_TBIA (LCA_IOC_BASE + 0x080) /* TLB Invalidate All */ -#define LCA_IOC_TB_ENA (LCA_IOC_BASE + 0x0a0) /* TLB Enable */ -#define IOC_TB_ENA_TEN 0x0000000000000080UL - -#define LCA_IOC_W_BASE0 (LCA_IOC_BASE + 0x100) /* Window Base */ -#define LCA_IOC_W_MASK0 (LCA_IOC_BASE + 0x140) /* Window Mask */ -#define LCA_IOC_W_T_BASE0 (LCA_IOC_BASE + 0x180) /* Translated Base */ - -#define LCA_IOC_W_BASE1 (LCA_IOC_BASE + 0x120) /* Window Base */ -#define LCA_IOC_W_MASK1 (LCA_IOC_BASE + 0x160) /* Window Mask */ -#define LCA_IOC_W_T_BASE1 (LCA_IOC_BASE + 0x1a0) /* Translated Base */ - -#define IOC_W_BASE_W_BASE 0x00000000fff00000UL /* Window base value */ -#define IOC_W_BASE_SG 0x0000000100000000UL /* Window uses SGMAPs */ -#define IOC_W_BASE_WEN 0x0000000200000000UL /* Window enable */ - -#define IOC_W_MASK_1M 0x0000000000000000UL /* 1MB window */ -#define IOC_W_MASK_2M 0x0000000000100000UL /* 2MB window */ -#define IOC_W_MASK_4M 0x0000000000300000UL /* 4MB window */ -#define IOC_W_MASK_8M 0x0000000000700000UL /* 8MB window */ -#define IOC_W_MASK_16M 0x0000000000f00000UL /* 16MB window */ -#define IOC_W_MASK_32M 0x0000000001f00000UL /* 32MB window */ -#define IOC_W_MASK_64M 0x0000000003f00000UL /* 64MB window */ -#define IOC_W_MASK_128M 0x0000000007f00000UL /* 128M window */ -#define IOC_W_MASK_256M 0x000000000ff00000UL /* 256M window */ -#define IOC_W_MASK_512M 0x000000001ff00000UL /* 512M window */ -#define IOC_W_MASK_1G 0x000000003ff00000UL /* 1GB window */ -#define IOC_W_MASK_2G 0x000000007ff00000UL /* 2GB window */ -#define IOC_W_MASK_4G 0x00000000fff00000UL /* 4GB window */ - -#define IOC_W_T_BASE 0x00000000fffffc00UL /* page table base */ diff --git a/sys/alpha/pci/lcavar.h b/sys/alpha/pci/lcavar.h deleted file mode 100644 index ee53b75..0000000 --- a/sys/alpha/pci/lcavar.h +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -struct device; - -extern void lca_init(void); -u_int32_t lca_pcib_read_config(struct device *dev, u_int b, u_int s, u_int f, - u_int reg, int width); diff --git a/sys/alpha/pci/pci_eb164_intr.s b/sys/alpha/pci/pci_eb164_intr.s deleted file mode 100644 index 542839f..0000000 --- a/sys/alpha/pci/pci_eb164_intr.s +++ /dev/null @@ -1,95 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: pci_eb164_intr.s,v 1.5 1997/09/02 13:19:42 thorpej Exp $ */ - -/*- - * 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. - */ - -/* - * The description of how to enable and disable interrupts in the - * AlphaPC 164 motherboard technical reference manual is incorrect, - * at least for the OSF/1 PALcode. - * - * These functions were written by disassembling a Digital UNIX kernel's - * eb164_intrdsabl and eb164_intrenabl functions (because they had - * interesting names), and then playing with them to see how to call - * them correctly. - * - * It looks like the right thing to do is to call them with the interrupt - * request that you want to enable or disable (presumably in the range - * 0 -> 23, since there are 3 8-bit interrupt-enable bits in the - * interrupt mask PLD). - */ - -#include <machine/asm.h> - -__KERNEL_RCSID(0, "$NetBSD: pci_eb164_intr.s,v 1.5 1997/09/02 13:19:42 thorpej Exp $"); - - .text -LEAF(eb164_intr_enable,1) - mov a0, a1 - ldiq a0, 0x34 - call_pal PAL_cserve - RET - END(eb164_intr_enable) - - .text -LEAF(eb164_intr_disable,1) - mov a0, a1 - ldiq a0, 0x35 - call_pal PAL_cserve - RET - END(eb164_intr_disable) - - .text -LEAF(eb164_intr_enable_icsr,1) - mov a0, a1 - ldiq a0, 0x34 - call_pal PAL_cserve - ldiq a0, 0x08 /* Allow PALRES */ - call_pal PAL_cserve - .long 0x66100118 /* hw_mfpr a0, icsr */ - ldah a1, 0x0020 /* IMSK1 */ - or a0, a1, a0 - xor a0, a1, a0 - .long 0x76100118 /* hw_mtpr a0, icsr */ - ldiq a0, 0x09 /* Disable PALRES */ - call_pal PAL_cserve - RET - END(eb164_intr_enable_icsr) - - .text -LEAF(eb164_intr_disable_icsr,1) - ldiq a0, 0x08 /* Allow PALRES */ - call_pal PAL_cserve - .long 0x66100118 /* hw_mfpr a0, icsr */ - ldah a1, 0x0020 /* IMSK1 */ - or a0, a1, a0 - .long 0x76100118 /* hw_mtpr a0, icsr */ - ldiq a0, 0x09 /* Disable PALRES */ - call_pal PAL_cserve - RET - END(eb164_intr_disable_icsr) diff --git a/sys/alpha/pci/pci_eb64plus_intr.s b/sys/alpha/pci/pci_eb64plus_intr.s deleted file mode 100644 index ce33c2a..0000000 --- a/sys/alpha/pci/pci_eb64plus_intr.s +++ /dev/null @@ -1,64 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: pci_eb64plus_intr.s,v 1.2 1997/09/02 13:19:43 thorpej Exp $ */ - -/*- - * 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. - */ - -/* - * This file hacked from pci_eb164_intr.s - * - * These functions were written by disassembling a Digital UNIX kernel's - * eb64p_intrdsabl and eb64p_intrenabl functions (because they had - * interesting names, and looked like the eb164 versions which were - * known to already work), and then playing with them to see how to call - * them correctly. - * - * It looks like the right thing to do is to call them with the interrupt - * request that you want to enable or disable (presumably in the range - * 0 -> 23, since there are 3 8-bit interrupt-enable bits in the - * interrupt mask PLD). - */ - -#include <machine/asm.h> - -__KERNEL_RCSID(0, "$NetBSD: pci_eb64plus_intr.s,v 1.2 1997/09/02 13:19:43 thorpej Exp $"); - - .text -LEAF(eb64plus_intr_enable,1) - mov a0, a1 - ldiq a0, 0x34 - call_pal PAL_cserve - RET - END(eb64plus_intr_enable) - - .text -LEAF(eb64plus_intr_disable,1) - mov a0, a1 - ldiq a0, 0x35 - call_pal PAL_cserve - RET - END(eb64plus_intr_disable) diff --git a/sys/alpha/pci/pcibus.c b/sys/alpha/pci/pcibus.c deleted file mode 100644 index 61c6bd7..0000000 --- a/sys/alpha/pci/pcibus.c +++ /dev/null @@ -1,376 +0,0 @@ -/*- - * Copyright (c) 1997, Stefan Esser <se@freebsd.org> - * 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 unmodified, 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 ``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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_isa.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/proc.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <sys/interrupt.h> -#include <sys/sysctl.h> -#include <sys/rman.h> - -#include <dev/pci/pcivar.h> -#include <machine/chipset.h> -#include <machine/cpuconf.h> -#include <machine/resource.h> -#include <machine/md_var.h> -#include <alpha/pci/pcibus.h> -#include <alpha/isa/isavar.h> - -#include "alphapci_if.h" - -#define ISA_IRQ_OFFSET 0xe0 -#define ISA_IRQ_LEN 0x10 - -struct alpha_busspace *busspace_isa_io; -struct alpha_busspace *busspace_isa_mem; - -char chipset_type[10]; -int chipset_bwx = 0; -long chipset_ports = 0; -long chipset_memory = 0; -long chipset_dense = 0; -long chipset_hae_mask = 0; - -SYSCTL_NODE(_hw, OID_AUTO, chipset, CTLFLAG_RW, 0, "PCI chipset information"); -SYSCTL_STRING(_hw_chipset, OID_AUTO, type, CTLFLAG_RD, chipset_type, 0, - "PCI chipset type"); -SYSCTL_INT(_hw_chipset, OID_AUTO, bwx, CTLFLAG_RD, &chipset_bwx, 0, - "PCI chipset supports BWX access"); -SYSCTL_LONG(_hw_chipset, OID_AUTO, ports, CTLFLAG_RD, &chipset_ports, 0, - "PCI chipset port address"); -SYSCTL_LONG(_hw_chipset, OID_AUTO, memory, CTLFLAG_RD, &chipset_memory, 0, - "PCI chipset memory address"); -SYSCTL_LONG(_hw_chipset, OID_AUTO, dense, CTLFLAG_RD, &chipset_dense, 0, - "PCI chipset dense memory address"); -SYSCTL_LONG(_hw_chipset, OID_AUTO, hae_mask, CTLFLAG_RD, &chipset_hae_mask, 0, - "PCI chipset mask for HAE register"); - -int -alpha_pci_route_interrupt(device_t bus, device_t dev, int pin) -{ - /* - * Validate requested pin number. - */ - if ((pin < 1) || (pin > 4)) - return(255); - - if (platform.pci_intr_route) - return(platform.pci_intr_route(bus, dev, pin)); - return(255); -} - -#ifdef DEV_ISA -struct resource * -alpha_platform_alloc_ide_intr(int chan) -{ - int irqs[2] = { 14, 15 }; - return (isa_alloc_intr(0, 0, irqs[chan])); -} - -int -alpha_platform_release_ide_intr(int chan, struct resource *res) -{ - return isa_release_intr(0, 0, res); -} - -int -alpha_platform_setup_ide_intr(device_t dev, - struct resource *res, - driver_intr_t *fn, void *arg, - void **cookiep) -{ - return isa_setup_intr(0, dev, res, INTR_TYPE_BIO, fn, arg, cookiep); -} - -int -alpha_platform_teardown_ide_intr(device_t dev, - struct resource *res, void *cookie) -{ - return isa_teardown_intr(0, dev, res, cookie); -} -#else -struct resource * -alpha_platform_alloc_ide_intr(int chan) -{ - return (NULL); -} -int -alpha_platform_release_ide_intr(int chan, struct resource *res) -{ - return (ENXIO); -} - -int -alpha_platform_setup_ide_intr(struct resource *res, - driver_intr_t *fn, void *arg, void **cookiep) -{ - return (ENXIO); -} - -int -alpha_platform_teardown_ide_intr(struct resource *res, void *cookie) -{ - return (ENXIO); -} -#endif - -static struct rman irq_rman, port_rman, mem_rman; - -int -alpha_platform_pci_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, - driver_intr_t *intr, void *arg, - void **cookiep) -{ -#ifdef DEV_ISA - /* - * XXX - If we aren't the resource manager for this IRQ, assume that - * it is actually handled by the ISA PIC. - */ - if (!rman_is_region_manager(irq, &irq_rman)) - return isa_setup_intr(dev, child, irq, flags, intr, arg, - cookiep); - else -#endif - return bus_generic_setup_intr(dev, child, irq, flags, intr, - arg, cookiep); -} - -int -alpha_platform_pci_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie) -{ -#ifdef DEV_ISA - /* - * XXX - If we aren't the resource manager for this IRQ, assume that - * it is actually handled by the ISA PIC. - */ - if (!rman_is_region_manager(irq, &irq_rman)) - return isa_teardown_intr(dev, child, irq, cookie); - else -#endif - return bus_generic_teardown_intr(dev, child, irq, cookie); -} - -void -pci_init_resources(void) -{ - irq_rman.rm_start = 0; - irq_rman.rm_end = 65536; - irq_rman.rm_type = RMAN_ARRAY; - irq_rman.rm_descr = "PCI Mapped Interrupts"; - if (rman_init(&irq_rman) - || rman_manage_region(&irq_rman, 0, 65536)) - panic("pci_init_resources irq_rman"); - - port_rman.rm_start = 0; - port_rman.rm_end = ~0u; - port_rman.rm_type = RMAN_ARRAY; - port_rman.rm_descr = "I/O ports"; - if (rman_init(&port_rman) - || rman_manage_region(&port_rman, 0x0, (1L << 32))) - panic("pci_init_resources port_rman"); - - mem_rman.rm_start = 0; - mem_rman.rm_end = ~0u; - mem_rman.rm_type = RMAN_ARRAY; - mem_rman.rm_descr = "I/O memory"; - if (rman_init(&mem_rman) - || rman_manage_region(&mem_rman, 0x0, (1L << 32))) - panic("pci_init_resources mem_rman"); -} - -/* - * Allocate a resource on behalf of child. NB: child is usually going to be a - * child of one of our descendants, not a direct child of the pci chipset. - */ -struct resource * -alpha_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, - u_long start, u_long end, u_long count, u_int flags) -{ - struct rman *rm; - struct resource *rv; - void *va; - int rstart; - - switch (type) { - case SYS_RES_IRQ: -#ifdef DEV_ISA - if((start >= ISA_IRQ_OFFSET) && - (end < ISA_IRQ_OFFSET + ISA_IRQ_LEN)) { - rv = isa_alloc_intrs(bus, child, - start - ISA_IRQ_OFFSET, end - ISA_IRQ_OFFSET); - if (rv != NULL) - rman_set_rid(rv, *rid); - return (rv); - } - else -#endif - rm = &irq_rman; - break; - - case SYS_RES_IOPORT: - case SYS_RES_MEMORY: - rm = ALPHAPCI_GET_RMAN(bus, type); - break; - - default: - return 0; - } - - rv = rman_reserve_resource(rm, start, end, count, flags, child); - if (rv == 0) - return 0; - - rman_set_rid(rv, *rid); - rstart = rman_get_start(rv); - rman_set_bustag(rv, ALPHAPCI_GET_BUSTAG(bus, type)); - rman_set_bushandle(rv, rstart); - switch (type) { - case SYS_RES_MEMORY: - va = 0; - if (flags & PCI_RF_DENSE) - va = ALPHAPCI_CVT_DENSE(bus, rstart); - else if (flags & PCI_RF_BWX) - va = ALPHAPCI_CVT_BWX(bus, rstart); - else - va = (void *)ALPHA_PHYS_TO_K0SEG(rstart); - rman_set_virtual(rv, va); - - break; - } - - return rv; -} - -int -pci_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - return (rman_activate_resource(r)); -} - -int -pci_deactivate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - return (rman_deactivate_resource(r)); -} - -int -pci_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r) -{ - return (rman_release_resource(r)); -} - -struct alpha_busspace * -pci_get_bustag(device_t dev, int type) -{ - switch (type) { - case SYS_RES_IOPORT: - return busspace_isa_io; - - case SYS_RES_MEMORY: - return busspace_isa_mem; - } - - return 0; -} - -struct rman * -pci_get_rman(device_t dev, int type) -{ - switch (type) { - case SYS_RES_IOPORT: - return &port_rman; - - case SYS_RES_MEMORY: - return &mem_rman; - } - - return 0; -} - -#include "opt_ddb.h" -#ifdef DDB -#include <ddb/ddb.h> - -DB_COMMAND(in, db_in) -{ - int c; - int size; - - if (!have_addr) - return; - - size = -1; - while ((c = *modif++) != '\0') { - switch (c) { - case 'b': - size = 1; - break; - case 'w': - size = 2; - break; - case 'l': - size = 4; - break; - } - } - - if (size < 0) { - db_printf("bad size\n"); - return; - } - - if (count <= 0) count = 1; - while (--count >= 0) { - db_printf("%08lx:\t", addr); - switch (size) { - case 1: - db_printf("%02x\n", inb(addr)); - break; - case 2: - db_printf("%04x\n", inw(addr)); - break; - case 4: - db_printf("%08x\n", inl(addr)); - break; - } - } -} - -#endif diff --git a/sys/alpha/pci/pcibus.h b/sys/alpha/pci/pcibus.h deleted file mode 100644 index 608b2a5..0000000 --- a/sys/alpha/pci/pcibus.h +++ /dev/null @@ -1,41 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -void pci_init_resources(void); -struct resource *alpha_pci_alloc_resource(device_t bus, device_t child, - int type, int *rid, - u_long start, u_long end, u_long count, - u_int flags); -int pci_activate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r); -int pci_deactivate_resource(device_t bus, device_t child, int type, int rid, - struct resource *r); -int pci_release_resource(device_t bus, device_t child, int type, int rid, - struct resource *r); -struct alpha_busspace *pci_get_bustag(device_t dev, int type); -struct rman *pci_get_rman(device_t dev, int type); diff --git a/sys/alpha/pci/swiz.c b/sys/alpha/pci/swiz.c deleted file mode 100644 index fe25038..0000000 --- a/sys/alpha/pci/swiz.c +++ /dev/null @@ -1,155 +0,0 @@ -/*- - * Copyright (c) 2000 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/kobj.h> - -#include <machine/bus.h> -#include <machine/swiz.h> - -static u_int8_t -swiz_read_1(struct alpha_busspace *space, size_t offset) -{ - struct swiz_space *swiz = (struct swiz_space *) space; - alpha_mb(); - if (swiz->sethae) - offset = swiz->sethae(swiz->arg, offset); - return SPARSE_READ_BYTE(swiz->base, offset); -} - -static u_int16_t -swiz_read_2(struct alpha_busspace *space, size_t offset) -{ - struct swiz_space *swiz = (struct swiz_space *) space; - alpha_mb(); - if (swiz->sethae) - offset = swiz->sethae(swiz->arg, offset); - return SPARSE_READ_WORD(swiz->base, offset); -} - -static u_int32_t -swiz_read_4(struct alpha_busspace *space, size_t offset) -{ - struct swiz_space *swiz = (struct swiz_space *) space; - alpha_mb(); - if (swiz->sethae) - offset = swiz->sethae(swiz->arg, offset); - return SPARSE_READ_LONG(swiz->base, offset); -} - -static void -swiz_write_1(struct alpha_busspace *space, size_t offset, u_int8_t data) -{ - struct swiz_space *swiz = (struct swiz_space *) space; - if (swiz->sethae) - offset = swiz->sethae(swiz->arg, offset); - SPARSE_WRITE_BYTE(swiz->base, offset, data); - alpha_mb(); -} - -static void -swiz_write_2(struct alpha_busspace *space, size_t offset, u_int16_t data) -{ - struct swiz_space *swiz = (struct swiz_space *) space; - if (swiz->sethae) - offset = swiz->sethae(swiz->arg, offset); - SPARSE_WRITE_WORD(swiz->base, offset, data); - alpha_mb(); -} - -static void -swiz_write_4(struct alpha_busspace *space, size_t offset, u_int32_t data) -{ - struct swiz_space *swiz = (struct swiz_space *) space; - if (swiz->sethae) - offset = swiz->sethae(swiz->arg, offset); - SPARSE_WRITE_LONG(swiz->base, offset, data); - alpha_mb(); -} - -static struct alpha_busspace_ops swiz_space_ops = { - swiz_read_1, - swiz_read_2, - swiz_read_4, - - busspace_generic_read_multi_1, - busspace_generic_read_multi_2, - busspace_generic_read_multi_4, - - busspace_generic_read_region_1, - busspace_generic_read_region_2, - busspace_generic_read_region_4, - - swiz_write_1, - swiz_write_2, - swiz_write_4, - - busspace_generic_write_multi_1, - busspace_generic_write_multi_2, - busspace_generic_write_multi_4, - - busspace_generic_write_region_1, - busspace_generic_write_region_2, - busspace_generic_write_region_4, - - busspace_generic_set_multi_1, - busspace_generic_set_multi_2, - busspace_generic_set_multi_4, - - busspace_generic_set_region_1, - busspace_generic_set_region_2, - busspace_generic_set_region_4, - - busspace_generic_copy_region_1, - busspace_generic_copy_region_2, - busspace_generic_copy_region_4, - - busspace_generic_barrier, -}; - -void -swiz_init_space(struct swiz_space *swiz, u_int64_t base) -{ - swiz->ops = &swiz_space_ops; - swiz->base = base; - swiz->sethae = 0; - swiz->arg = 0; -} - -void swiz_init_space_hae(struct swiz_space *swiz, u_int64_t base, - swiz_sethae_fn sethae, void *arg) -{ - swiz->ops = &swiz_space_ops; - swiz->base = base; - swiz->sethae = sethae; - swiz->arg = arg; -} - diff --git a/sys/alpha/pci/t2.c b/sys/alpha/pci/t2.c deleted file mode 100644 index ea6be8a..0000000 --- a/sys/alpha/pci/t2.c +++ /dev/null @@ -1,642 +0,0 @@ -/*- - * Copyright (c) 2000 Andrew Gallatin & 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. - * - * Portions of this file were obtained from Compaq intellectual - * property which was made available under the following copyright: - * - * ***************************************************************** - * * * - * * Copyright Compaq Computer Corporation, 2000 * - * * * - * * Permission to use, copy, modify, distribute, and sell * - * * this software and its documentation for any purpose is * - * * hereby granted without fee, provided that the above * - * * copyright notice appear in all copies and that both * - * * that copyright notice and this permission notice appear * - * * in supporting documentation, and that the name of * - * * Compaq Computer Corporation not be used in advertising * - * * or publicity pertaining to distribution of the software * - * * without specific, written prior permission. Compaq * - * * makes no representations about the suitability of this * - * * software for any purpose. It is provided "AS IS" * - * * without express or implied warranty. * - * * * - * ***************************************************************** - */ - -/* - * T2 CBUS to PCI bridge - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/malloc.h> -#include <sys/module.h> -#include <sys/mutex.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <sys/proc.h> -#include <sys/rman.h> -#include <sys/interrupt.h> - -#include <dev/pci/pcivar.h> -#include <alpha/pci/t2reg.h> -#include <alpha/pci/t2var.h> -#include <alpha/isa/isavar.h> - -#include <machine/cpuconf.h> -#include <machine/intr.h> -#include <machine/intrcnt.h> -#include <machine/md_var.h> -#include <machine/resource.h> -#include <machine/sgmap.h> -#include <machine/swiz.h> - -#include <vm/vm.h> -#include <vm/vm_page.h> - -#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa + sable_lynx_base) - -vm_offset_t sable_lynx_base = 0UL; - -volatile t2_csr_t *t2_csr[2]; -static int pci_int_type[2]; - -static devclass_t t2_devclass; -static device_t t2_0; /* XXX only one for now */ - -struct t2_softc { - int junk; -}; - -#define T2_SOFTC(dev) (struct t2_softc*) device_get_softc(dev) - -static alpha_chipset_read_hae_t t2_read_hae; -static alpha_chipset_write_hae_t t2_write_hae; - -static alpha_chipset_t t2_chipset = { - t2_read_hae, - t2_write_hae, -}; - -static u_int32_t t2_hae_mem[2]; - -#define REG1 (1UL << 24) - -static u_int32_t -t2_set_hae_mem(void *arg, u_int32_t pa) -{ - register_t s; - u_int32_t msb; - int hose; - - hose = (long)arg; - - if(pa >= REG1){ - msb = pa & 0xf8000000; - pa -= msb; - msb >>= 27; /* t2 puts high bits in the bottom of the register */ - s = intr_disable(); - if (msb != t2_hae_mem[hose]) { - t2_hae_mem[hose] = msb; - t2_csr[hose]->hae0_1 = t2_hae_mem[hose]; - alpha_mb(); - t2_hae_mem[hose] = t2_csr[hose]->hae0_1; - } - intr_restore(s); - } - return pa; -} - -static u_int64_t -t2_read_hae(void) -{ - return t2_hae_mem[0] << 27; -} - -static void -t2_write_hae(u_int64_t hae) -{ - u_int32_t pa = hae; - t2_set_hae_mem(0, pa); -} - -static int t2_probe(device_t dev); -static int t2_attach(device_t dev); -static int t2_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, - void *intr, void *arg, void **cookiep); -static int t2_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie); -static void -t2_dispatch_intr(void *frame, unsigned long vector); -static void -t2_machine_check(unsigned long mces, struct trapframe *framep, - unsigned long vector, unsigned long param); - - -static device_method_t t2_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, t2_probe), - DEVMETHOD(device_attach, t2_attach), - - /* Bus interface */ - DEVMETHOD(bus_setup_intr, t2_setup_intr), - DEVMETHOD(bus_teardown_intr, t2_teardown_intr), - - { 0, 0 } -}; - -static driver_t t2_driver = { - "t2", - t2_methods, - sizeof(struct t2_softc), -}; - - -#define T2_SGMAP_BASE (8*1024*1024) -#define T2_SGMAP_SIZE (8*1024*1024) - -static void -t2_sgmap_invalidate(void) -{ - u_int64_t val; - - alpha_mb(); - val = REGVAL64(T2_IOCSR); - val |= T2_IOCSRL_ITLB; - REGVAL64(T2_IOCSR) = val; - alpha_mb(); - alpha_mb(); - val = REGVAL64(T2_IOCSR); - val &= ~T2_IOCSRL_ITLB; - REGVAL64(T2_IOCSR) = val; - alpha_mb(); - alpha_mb(); -} - -static void -t2_sgmap_map(void *arg, bus_addr_t ba, vm_offset_t pa) -{ - u_int64_t *sgtable = arg; - int index = alpha_btop(ba - T2_SGMAP_BASE); - - if (pa) { - if (pa > (1L<<32)) - panic("t2_sgmap_map: can't map address 0x%lx", pa); - sgtable[index] = ((pa >> 13) << 1) | 1; - } else { - sgtable[index] = 0; - } - alpha_mb(); - t2_sgmap_invalidate(); -} - - -static void -t2_init_sgmap(int h) -{ - void *sgtable; - - /* - * First setup Window 2 to map 8Mb to 16Mb with an - * sgmap. Allocate the map aligned to a 32 boundary. - * - * bits 31..20 of WBASE represent the pci start address - * (in units of 1Mb), and bits 11..0 represent the pci - * end address - */ - t2_csr[h]->wbase2 = T2_WSIZE_8M|T2_WINDOW_ENABLE|T2_WINDOW_SG - | ((T2_SGMAP_BASE >> 20) << 20) - | ((T2_SGMAP_BASE + T2_SGMAP_SIZE) >> 20); - t2_csr[h]->wmask2 = T2_WMASK_8M; - alpha_mb(); - - sgtable = contigmalloc(8192, M_DEVBUF, M_NOWAIT, - 0, (1L<<34), - 32*1024, (1L<<34)); - if (!sgtable) - panic("t2_init_sgmap: can't allocate page table"); - - t2_csr[h]->tbase2 = - (pmap_kextract((vm_offset_t) sgtable) >> T2_TBASE_SHIFT); - - chipset.sgmap = sgmap_map_create(T2_SGMAP_BASE, - T2_SGMAP_BASE + T2_SGMAP_SIZE, - t2_sgmap_map, sgtable); - chipset.pci_sgmap = NULL; - chipset.dmsize = 2UL * 1024UL * 1024UL * 1024UL; - chipset.dmoffset = 1UL * 1024UL * 1024UL * 1024UL; -} - -static void -t2_csr_init(int h) -{ - /* - * initialize the DMA windows - */ - t2_csr[h]->wbase1 = T2_WSIZE_1G|T2_WINDOW_ENABLE|T2_WINDOW_DIRECT|0x7ff; - t2_csr[h]->wmask1 = T2_WMASK_1G; - t2_csr[h]->tbase1 = 0x0; - - t2_csr[h]->wbase2 = 0x0; - - /* - * enable the PCI "Hole" for ISA devices which use memory in - * the 512k - 1MB range - */ - t2_csr[h]->hbase = 1 << 13; - t2_init_sgmap(0); - - /* initialize the HAEs */ - t2_csr[h]->hae0_1 = 0x0; - alpha_mb(); - t2_csr[h]->hae0_2 = 0x0; - alpha_mb(); - t2_csr[h]->hae0_3 = 0x0; - alpha_mb(); - -} - -/* - * Perform basic chipset init/fixup. Called by various early - * consumers to ensure that the system will work before the - * bus methods are invoked. - * - */ - -void -t2_init() -{ - static int initted = 0; - static struct swiz_space io_space, mem_space; - - if (initted) return; - initted = 1; - - swiz_init_space(&io_space, KV(T2_PCI_SIO)); - swiz_init_space_hae(&mem_space, KV(T2_PCI_SPARSE), - t2_set_hae_mem, 0); - - busspace_isa_io = (struct alpha_busspace *) &io_space; - busspace_isa_mem = (struct alpha_busspace *) &mem_space; - - chipset = t2_chipset; - -} - -static int -t2_probe(device_t dev) -{ - int h, t2_num_hoses = 1; - device_t child; - - if (t2_0) - return ENXIO; - - t2_0 = dev; - device_set_desc(dev, "T2 Core Logic chipset"); - t2_csr[0] = (t2_csr_t *) - ALPHA_PHYS_TO_K0SEG(sable_lynx_base + PCI0_BASE); - t2_csr[1] = (t2_csr_t *) - ALPHA_PHYS_TO_K0SEG(sable_lynx_base + PCI1_BASE); - - /* Look at the rev of the chip. If the high bit is set in the - * rev field then we have either a T3 or a T4 chip, so use the - * new interrupt structure. If it is clear, then we have a T2 - * so use the old way */ - - platform.mcheck_handler = t2_machine_check; - - if (((t2_csr[0]->iocsr) >> 35) & 1) - pci_int_type[0] = 1; - else - pci_int_type[0] = 0; - - device_printf(dev, "using interrupt type %d on pci bus 0\n", - pci_int_type[0]); - - if (!badaddr(__DEVOLATILE(void *, &t2_csr[1]->tlbbr), sizeof(long))) { - pci_int_type[1] = 1; /* PCI1 always uses the new scheme */ - /* Clear any errors that the BADADDR probe may have caused */ - t2_csr[1]->cerr1 |= t2_csr[1]->cerr1; - t2_csr[1]->pcierr1 |= t2_csr[1]->pcierr1; - device_printf(dev, "found EXT_IO!!!!!\n"); - /* t2_num_hoses = 2; XXX not ready for this yet */ - } - - for (h = 0; h < t2_num_hoses; h++) - t2_csr_init(h); - - - child = device_add_child(dev, "pcib", 0); - device_set_ivars(child, 0); - - return 0; -} - -static int -t2_attach(device_t dev) -{ - t2_init(); - - set_iointr(t2_dispatch_intr); - platform.isa_setup_intr = t2_setup_intr; - platform.isa_teardown_intr = t2_teardown_intr; - - snprintf(chipset_type, sizeof(chipset_type), "t2"); - - bus_generic_attach(dev); - - return 0; -} - - -/* - * magical mystery table partly obtained from Linux - * at least some of their values for PCI masks - * were incorrect, and I've filled in my own extrapolations - * XXX this needs more testers - */ - -unsigned long t2_shadow_mask = -1L; -static const char irq_to_mask[40] = { - -1, 6, -1, 8, 15, 12, 7, 9, /* ISA 0-7 */ - -1, 16, 17, 18, 3, -1, 21, 22, /* ISA 8-15 */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ?? EISA XXX */ - -1, -1, -1, -1, -1, -1, -1, -1, /* ?? EISA XXX */ - 0, 1, 2, 3, 4, 5, 6, 7 /* PCI 0-7 XXX */ -}; - - -static void -t2_8259_disable_mask(int mask) -{ - t2_shadow_mask |= (1UL << mask); - - if (mask <= 7) - outb(SLAVE0_ICU, t2_shadow_mask); - else if (mask <= 15) - outb(SLAVE1_ICU, t2_shadow_mask >> 8); - else - outb(SLAVE2_ICU, t2_shadow_mask >> 16); -} - -static void -t2_8259_enable_mask(int mask) -{ - t2_shadow_mask &= ~(1UL << mask); - - if (mask <= 7) - outb(SLAVE0_ICU, t2_shadow_mask); - else if (mask <= 15) - outb(SLAVE1_ICU, t2_shadow_mask >> 8); - else - outb(SLAVE2_ICU, t2_shadow_mask >> 16); -} - - -static void -t2_eoi( int vector) -{ - int irq, hose; - - hose = (vector >= 0xC00); - irq = (vector - 0x800) >> 4; - - if (pci_int_type[hose]) { - - /* New interrupt scheme. Both PCI0 and PCI1 can use - * the same handler. Dispatching interrupts with the - * IC IC chip is easy. We simply write the vector - * address register (var) on the T3/T4 (offset - * 0x480) with the IRQ level (0 - 63) of what came in. */ - t2_csr[hose]->var = (u_long) irq; - alpha_mb(); - alpha_mb(); - } else { - switch (irq) { - case 0 ... 7: - outb(SLAVE0_ICU-1, (0xe0 | (irq))); - outb(MASTER_ICU-1, (0xe0 | 1)); - break; - case 8 ... 15: - outb(SLAVE1_ICU-1, (0xe0 | (irq - 8))); - outb(MASTER_ICU-1, (0xe0 | 3)); - break; - case 16 ... 24: - outb(SLAVE2_ICU-1, (0xe0 | (irq - 16))); - outb(MASTER_ICU-1, (0xe0 | 4)); - break; - } - } -} - -static void -t2_enable_vec(uintptr_t vector) -{ - int irq, hose; - u_long IC_mask, scratch; - - hose = (vector >= 0xC00); - irq = (vector - 0x800) >> 4; - - mtx_lock_spin(&icu_lock); - if (pci_int_type[hose]) { - - /* Write the air register on the T3/T4 with the - * address of the IC IC masks register (offset 0x40) */ - t2_csr[hose]->air = 0x40; - alpha_mb(); - scratch = t2_csr[hose]->air; - alpha_mb(); - IC_mask = t2_csr[hose]->dir; - IC_mask &= ~(1L << ( (u_long) irq)); - t2_csr[hose]->dir = IC_mask; - alpha_mb(); - alpha_mb(); - /* - * EOI the interrupt we just enabled. - */ - t2_eoi(vector); - } else { - /* Old style 8259 (Gack!!!) interrupts */ - t2_8259_enable_mask(irq); - } - mtx_unlock_spin(&icu_lock); -} - -static void -t2_disable_vec(uintptr_t vector) -{ - int hose, irq; - u_long scratch, IC_mask; - - hose = (vector >= 0xC00); - irq = (vector - 0x800) >> 4; - - mtx_lock_spin(&icu_lock); - if (pci_int_type[hose]) { - - /* Write the air register on the T3/T4 wioth the - * address of the IC IC masks register (offset 0x40) */ - - t2_csr[hose]->air = 0x40; - alpha_mb(); - scratch = t2_csr[hose]->air; - alpha_mb(); - /* - * Read the dir register to fetch the mask data, 'or' in the - * new disable bit, and write the data back. - */ - IC_mask = t2_csr[hose]->dir; - IC_mask |= (1L << ( (u_long) irq)); - /* Set the disable bit */ - t2_csr[hose]->dir = IC_mask; - alpha_mb(); - alpha_mb(); - } else { - /* Old style 8259 (Gack!!!) interrupts */ - t2_8259_disable_mask(irq); - } - mtx_unlock_spin(&icu_lock); -} - - -static int -t2_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, - void *intr, void *arg, void **cookiep) -{ - int error, vector, stdio_irq, start; - const char *name; - device_t bus, parent; - - name = device_get_nameunit(dev); - start = stdio_irq = rman_get_start(irq); - if (strncmp(name, "eisa", 4) == 0) { - if ((stdio_irq != 6 ) && (stdio_irq != 3 )) { - stdio_irq = - T2_EISA_IRQ_TO_STDIO_IRQ(stdio_irq); - } - } else if ((strncmp(name, "isa", 3)) == 0) { - stdio_irq = irq_to_mask[stdio_irq]; - } - - parent = dev; - do { - bus = parent; - parent = device_get_parent(bus); - } while (parent && strncmp("t2", device_get_nameunit(parent), 2)); - - if (parent && (device_get_unit(bus) != 0)) - vector = STDIO_PCI1_IRQ_TO_SCB_VECTOR(stdio_irq); - else - vector = STDIO_PCI0_IRQ_TO_SCB_VECTOR(stdio_irq); - - error = rman_activate_resource(irq); - if (error) - return error; - - error = alpha_setup_intr(device_get_nameunit(child ? child : dev), - vector, intr, arg, flags, cookiep, - &intrcnt[start], t2_disable_vec, t2_enable_vec); - - if (error) - return error; - - /* Enable interrupt */ - t2_enable_vec(vector); - - if (bootverbose != 0) - device_printf(child, - "interrupting at T2 irq %d (stdio irq %d)\n", - start, stdio_irq); - return 0; -} - -static int -t2_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie) -{ - int mask; - - mask = irq_to_mask[rman_get_start(irq)]; - - /* Disable interrupt */ - - /* - * XXX this is totally broken! - * we don't have enough info to figure out where the interrupt - * came from if hose != 0 and pci_int_type[hose] != 0 - * We should probably carry around the vector someplace -- - * that would be enough to figure out the hose and the stdio irq - */ - - t2_shadow_mask |= (1UL << mask); - - mtx_lock_spin(&icu_lock); - if (mask <= 7) - outb(SLAVE0_ICU, t2_shadow_mask); - else if (mask <= 15) - outb(SLAVE1_ICU, t2_shadow_mask >> 8); - else - outb(SLAVE2_ICU, t2_shadow_mask >> 16); - mtx_unlock_spin(&icu_lock); - - alpha_teardown_intr(cookie); - return rman_deactivate_resource(irq); -} - - - -static void -t2_dispatch_intr(void *frame, unsigned long vector) -{ - alpha_dispatch_intr(frame, vector); - mtx_lock_spin(&icu_lock); - t2_eoi(vector); - mtx_unlock_spin(&icu_lock); -} - -static void -t2_machine_check(unsigned long mces, struct trapframe *framep, - unsigned long vector, unsigned long param) -{ - int expected; - - expected = mc_expected; - machine_check(mces, framep, vector, param); - /* for some reason the alpha_pal_wrmces() doesn't clear all - pending machine checks & we may take another */ - mc_expected = expected; -} - -DRIVER_MODULE(t2, root, t2_driver, t2_devclass, 0, 0); diff --git a/sys/alpha/pci/t2_pci.c b/sys/alpha/pci/t2_pci.c deleted file mode 100644 index 44288a0..0000000 --- a/sys/alpha/pci/t2_pci.c +++ /dev/null @@ -1,209 +0,0 @@ -/*- - * Copyright (c) 2000 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, SPELCAL, 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <sys/rman.h> -#include <dev/pci/pcivar.h> -#include <machine/swiz.h> -#include <machine/md_var.h> - -#include <alpha/pci/t2reg.h> -#include <alpha/pci/t2var.h> -#include <alpha/pci/pcibus.h> - -#include "alphapci_if.h" -#include "pcib_if.h" - -#define KV(pa) ALPHA_PHYS_TO_K0SEG((pa) + sable_lynx_base) - -static devclass_t pcib_devclass; - -static int -t2_pcib_probe(device_t dev) -{ - device_t child; - - device_set_desc(dev, "T2 PCI host bus adapter"); - - pci_init_resources(); - - child = device_add_child(dev, "pci", 0); - device_set_ivars(child, 0); - - return 0; -} - -static int -t2_pcib_read_ivar(device_t dev, device_t child, int which, u_long *result) -{ - if (which == PCIB_IVAR_BUS) { - *result = 0; - return 0; - } - return ENOENT; -} - -static void * -t2_pcib_cvt_dense(device_t dev, vm_offset_t addr) -{ - addr &= 0xffffffffUL; - return (void *) KV(addr | T2_PCI_DENSE); -} - -static int -t2_pcib_maxslots(device_t dev) -{ - return 9; -} - -#define T2_CFGOFF(b, s, f, r) \ - ((b) ? (((b) << 16) | ((s) << 11) | ((f) << 8) | (r)) \ - : ((1 << ((s) + 11)) | ((f) << 8) | (r))) - -#define T2_TYPE1_SETUP(b,s,old_hae3) if((b)) { \ - do { \ - (s) = intr_disable(); \ - (old_hae3) = REGVAL(T2_HAE0_3); \ - alpha_mb(); \ - REGVAL(T2_HAE0_3) = (old_hae3) | (1<<30); \ - alpha_mb(); \ - } while(0); \ -} - -#define T2_TYPE1_TEARDOWN(b,s,old_hae3) if((b)) { \ - do { \ - alpha_mb(); \ - REGVAL(T2_HAE0_3) = (old_hae3); \ - alpha_mb(); \ - intr_restore((s)); \ - } while(0); \ -} - -#define SWIZ_CFGREAD(b, s, f, r, width, type) do { \ - type val = ~0; \ - register_t ipl = 0; \ - u_int32_t old_hae3 = 0; \ - vm_offset_t off = T2_CFGOFF(b, s, f, r); \ - vm_offset_t kv = SPARSE_##width##_ADDRESS(KV(T2_PCI_CONF), off); \ - alpha_mb(); \ - T2_TYPE1_SETUP(b,ipl,old_hae3); \ - if (!badaddr((caddr_t)kv, sizeof(type))) { \ - val = SPARSE_##width##_EXTRACT(off, SPARSE_READ(kv)); \ - } \ - T2_TYPE1_TEARDOWN(b,ipl,old_hae3); \ - return val; \ -} while (0) - -#define SWIZ_CFGWRITE(b, s, f, r, data, width, type) do { \ - register_t ipl = 0; \ - u_int32_t old_hae3 = 0; \ - vm_offset_t off = T2_CFGOFF(b, s, f, r); \ - vm_offset_t kv = SPARSE_##width##_ADDRESS(KV(T2_PCI_CONF), off); \ - alpha_mb(); \ - T2_TYPE1_SETUP(b,ipl,old_hae3); \ - if (!badaddr((caddr_t)kv, sizeof(type))) { \ - SPARSE_WRITE(kv, SPARSE_##width##_INSERT(off, data)); \ - alpha_wmb(); \ - } \ - T2_TYPE1_TEARDOWN(b,ipl,old_hae3); \ - return; \ -} while (0) - -static u_int32_t -t2_pcib_read_config(device_t dev, u_int b, u_int s, u_int f, - u_int reg, int width) -{ - switch (width) { - case 1: - SWIZ_CFGREAD(b, s, f, reg, BYTE, u_int8_t); - break; - case 2: - SWIZ_CFGREAD(b, s, f, reg, WORD, u_int16_t); - break; - case 4: - SWIZ_CFGREAD(b, s, f, reg, LONG, u_int32_t); - } - return ~0; -} - -static void -t2_pcib_write_config(device_t dev, u_int b, u_int s, u_int f, - u_int reg, u_int32_t val, int width) -{ - switch (width) { - case 1: - SWIZ_CFGWRITE(b, s, f, reg, val, BYTE, u_int8_t); - break; - case 2: - SWIZ_CFGWRITE(b, s, f, reg, val, WORD, u_int16_t); - break; - case 4: - SWIZ_CFGWRITE(b, s, f, reg, val, LONG, u_int32_t); - } -} - -static device_method_t t2_pcib_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, t2_pcib_probe), - DEVMETHOD(device_attach, bus_generic_attach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, t2_pcib_read_ivar), - DEVMETHOD(bus_alloc_resource, alpha_pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - /* alphapci interface */ - DEVMETHOD(alphapci_cvt_dense, t2_pcib_cvt_dense), - - /* pcib interface */ - DEVMETHOD(pcib_maxslots, t2_pcib_maxslots), - DEVMETHOD(pcib_read_config, t2_pcib_read_config), - DEVMETHOD(pcib_write_config, t2_pcib_write_config), - DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), - - { 0, 0 } -}; - -static driver_t t2_pcib_driver = { - "pcib", - t2_pcib_methods, - 1, -}; - -DRIVER_MODULE(pcib, t2, t2_pcib_driver, pcib_devclass, 0, 0); diff --git a/sys/alpha/pci/t2reg.h b/sys/alpha/pci/t2reg.h deleted file mode 100644 index b805201..0000000 --- a/sys/alpha/pci/t2reg.h +++ /dev/null @@ -1,261 +0,0 @@ -/*- - * Copyright (c) 2000 Doug Rabson & Andrew Gallatin - * 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. - * - * Portions of this file were obtained from Compaq intellectual - * property which was made available under the following copyright: - * - * ***************************************************************** - * * * - * * Copyright Compaq Computer Corporation, 2000 * - * * * - * * Permission to use, copy, modify, distribute, and sell * - * * this software and its documentation for any purpose is * - * * hereby granted without fee, provided that the above * - * * copyright notice appear in all copies and that both * - * * that copyright notice and this permission notice appear * - * * in supporting documentation, and that the name of * - * * Compaq Computer Corporation not be used in advertising * - * * or publicity pertaining to distribution of the software * - * * without specific, written prior permission. Compaq * - * * makes no representations about the suitability of this * - * * software for any purpose. It is provided "AS IS" * - * * without express or implied warranty. * - * * * - * ***************************************************************** - * - * $FreeBSD$ - */ - - - -/* - * Registers in the T2 CBUS-to-PCI bridge as used in the SABLE - * systems. - */ - -#define REGVAL(r) (*(volatile int32_t *) \ - ALPHA_PHYS_TO_K0SEG(r + sable_lynx_base)) -#define REGVAL64(r) (*(volatile int64_t *) \ - ALPHA_PHYS_TO_K0SEG(r + sable_lynx_base)) - -#define SABLE_BASE 0x0UL /* offset of SABLE CSRs */ -#define LYNX_BASE 0x8000000000UL /* offset of LYNX CSRs */ -#define PCI0_BASE 0x38e000000UL -#define PCI1_BASE 0x38f000000UL - -#define CBUS_BASE 0x380000000 /* CBUS CSRs */ -#define T2_PCI_SIO 0x3a0000000 /* PCI sparse I/O space */ -#define T2_PCI_CONF 0x390000000 /* PCI configuration space */ -#define T2_PCI_SPARSE 0x200000000 /* PCI sparse memory space */ -#define T2_PCI_DENSE 0x3c0000000 /* PCI dense memory space */ - -#define T2_IOCSR (CBUS_BASE + 0xe000000) - /* Low word */ -#define T2_IOCSRL_EL 0x00000002UL /* loopback enable */ -#define T2_IOCSRL_ESMV 0x00000004UL /* enable state machine visibility */ -#define T2_IOCSRL_PDBP 0x00000008UL /* PCI drive bad parity */ -#define T2_IOCSRL_SLOT0 0x00000030UL /* PCI slot 0 present bits */ -#define T2_IOCSRL_PINT 0x00000040UL /* PCI interrupt */ -#define T2_IOCSRL_ENTLBEC 0x00000080UL /* enable TLB error check */ -#define T2_IOCSRL_ENCCDMA 0x00000100UL /* enable CXACK for DMA */ -#define T2_IOCSRL_ENXXCHG 0x00000400UL /* enable exclusive exchange for EV5 */ -#define T2_IOCSRL_CAWWP0 0x00001000UL /* CBUS command/address write wrong parity 0 */ -#define T2_IOCSRL_CAWWP2 0x00002000UL /* CBUS command/address write wrong parity 2 */ -#define T2_IOCSRL_CDWWPE 0x00004000UL /* CBUS data write wrong parity even */ -#define T2_IOCSRL_SLOT2 0x00008000UL /* PCI slot 2 present bit */ -#define T2_IOCSRL_PSERR 0x00010000UL /* power supply error */ -#define T2_IOCSRL_MBA7 0x00020000UL /* MBA7 asserted */ -#define T2_IOCSRL_SLOT1 0x000c0000UL /* PCI slot 1 present bits */ -#define T2_IOCSRL_PDWWP1 0x00100000UL /* PCI DMA write wrong parity HW1 */ -#define T2_IOCSRL_PDWWP0 0x00200000UL /* PCI DMA write wrong parity HW0 */ -#define T2_IOCSRL_PBR 0x00400000UL /* PCI bus reset */ -#define T2_IOCSRL_PIR 0x00800000UL /* PCI interface reset */ -#define T2_IOCSRL_ENCOI 0x01000000UL /* enable NOACK, CUCERR and out-of-sync int */ -#define T2_IOCSRL_EPMS 0x02000000UL /* enable PCI memory space */ -#define T2_IOCSRL_ETLB 0x04000000UL /* enable TLB */ -#define T2_IOCSRL_EACC 0x08000000UL /* enable atomic CBUS cycles */ -#define T2_IOCSRL_ITLB 0x10000000UL /* flush TLB */ -#define T2_IOCSRL_ECPC 0x20000000UL /* enable CBUS parity check */ -#define T2_IOCSRL_CIR 0x40000000UL /* CBUS interface reset */ -#define T2_IOCSRL_EPL 0x80000000UL /* enable PCI lock */ - /* High word */ -#define T2_IOCSRH_CBBCE 0x00000001UL /* CBUS back-to-back cycle enable */ -#define T2_IOCSRH_TM 0x0000000eUL /* T2 revision number */ -#define T2_IOCSRH_SMVL 0x00000070UL /* state machine visibility select */ -#define T2_IOCSRH_SLOT2 0x00000080UL /* PCI slot 2 present bit */ -#define T2_IOCSRH_EPR 0x00000100UL /* enable passive release */ -#define T2_IOCSRH_CAWWP1 0x00001000UL /* cbus command/address write wrong parity 1 */ -#define T2_IOCSRH_CAWWP3 0x00002000UL /* cbus command/address write wrong parity 3 */ -#define T2_IOCSRH_DWWPO 0x00004000UL /* CBUS data write wrong parity odd */ -#define T2_IOCSRH_PRM 0x00100000UL /* PCI read multiple */ -#define T2_IOCSRH_PWM 0x00200000UL /* PCI write multiple */ -#define T2_IOCSRH_FPRDPED 0x00400000UL /* force PCI RDPE detect */ -#define T2_IOCSRH_PFAPED 0x00800000UL /* force PCI APE detect */ -#define T2_IOCSRH_FPWDPED 0x01000000UL /* force PCI WDPE detect */ -#define T2_IOCSRH_EPNMI 0x02000000UL /* enable PCI NMI */ -#define T2_IOCSRH_EPDTI 0x04000000UL /* enable PCI DTI */ -#define T2_IOCSRH_EPSEI 0x08000000UL /* enable PCI SERR interrupt */ -#define T2_IOCSRH_EPPEI 0x10000000UL /* enable PCI PERR interrupt */ -#define T2_IOCSRH_ERDPC 0x20000000UL /* enable PCI RDP interrupt */ -#define T2_IOCSRH_EADPC 0x40000000UL /* enable PCI AP interrupt */ -#define T2_IOCSRH_EWDPC 0x80000000UL /* enable PCI WDP interrupt */ - -#define T2_CERR1 (CBUS_BASE + 0xe000020) -#define T2_CERR2 (CBUS_BASE + 0xe000040) -#define T2_CERR3 (CBUS_BASE + 0xe000060) -#define T2_PERR1 (CBUS_BASE + 0xe000080) -#define T2_PERR1_PWDPE 0x00000001 /* PCI write data parity error */ -#define T2_PERR1_PAPE 0x00000002 /* PCI address parity error */ -#define T2_PERR1_PRDPE 0x00000004 /* PCI read data parity error */ -#define T2_PERR1_PPE 0x00000008 /* PCI parity error */ -#define T2_PERR1_PSE 0x00000010 /* PCI system error */ -#define T2_PERR1_PDTE 0x00000020 /* PCI device timeout error */ -#define T2_PERR1_NMI 0x00000040 /* PCI NMI */ - -#define T2_PERR2 (CBUS_BASE + 0xe0000a0) -#define T2_PSCR (CBUS_BASE + 0xe0000c0) -#define T2_HAE0_1 (CBUS_BASE + 0xe0000e0) -#define T2_HAE0_2 (CBUS_BASE + 0xe000100) -#define T2_HBASE (CBUS_BASE + 0xe000120) -#define T2_WBASE1 (CBUS_BASE + 0xe000140) -#define T2_WMASK1 (CBUS_BASE + 0xe000160) -#define T2_TBASE1 (CBUS_BASE + 0xe000180) -#define T2_WBASE2 (CBUS_BASE + 0xe0001a0) -#define T2_WMASK2 (CBUS_BASE + 0xe0001c0) -#define T2_TBASE2 (CBUS_BASE + 0xe0001e0) -#define T2_TLBBR (CBUS_BASE + 0xe000200) -#define T2_HAE0_3 (CBUS_BASE + 0xe000240) -#define T2_HAE0_4 (CBUS_BASE + 0xe000280) - -/* - * DMA window constants, section 5.2.1.1.1 of the - * Sable I/O Specification - */ - -#define T2_WINDOW_ENABLE 0x00080000 -#define T2_WINDOW_DISABLE 0x00000000 -#define T2_WINDOW_SG 0x00040000 -#define T2_WINDOW_DIRECT 0x00000000 - -#define T2_WMASK_2G 0x7ff00000 -#define T2_WMASK_1G 0x3ff00000 -#define T2_WMASK_512M 0x1ff00000 -#define T2_WMASK_256M 0x0ff00000 -#define T2_WMASK_128M 0x07f00000 -#define T2_WMASK_64M 0x03f00000 -#define T2_WMASK_32M 0x01f00000 -#define T2_WMASK_16M 0x00f00000 -#define T2_WMASK_8M 0x00700000 -#define T2_WMASK_4M 0x00300000 -#define T2_WMASK_2M 0x00100000 -#define T2_WMASK_1M 0x00000000 - - -#define T2_WSIZE_2G 0x80000000 -#define T2_WSIZE_1G 0x40000000 -#define T2_WSIZE_512M 0x20000000 -#define T2_WSIZE_256M 0x10000000 -#define T2_WSIZE_128M 0x08000000 -#define T2_WSIZE_64M 0x04000000 -#define T2_WSIZE_32M 0x02000000 -#define T2_WSIZE_16M 0x01000000 -#define T2_WSIZE_8M 0x00800000 -#define T2_WSIZE_4M 0x00400000 -#define T2_WSIZE_2M 0x00200000 -#define T2_WSIZE_1M 0x00100000 -#define T2_WSIZE_0M 0x00000000 - -#define T2_TBASE_SHIFT 1 - -#define MASTER_ICU 0x535 -#define SLAVE0_ICU 0x537 -#define SLAVE1_ICU 0x53b -#define SLAVE2_ICU 0x53d -#define SLAVE3_ICU 0x53f - - -#define T2_EISA_IRQ_TO_STDIO_IRQ( x ) ((x) + 7) -#define T2_STDIO_IRQ_TO_EISA_IRQ( x ) ((x) - 7) -#define STDIO_PCI0_IRQ_TO_SCB_VECTOR( x ) (( ( x ) * 0x10) + 0x800) -#define STDIO_PCI1_IRQ_TO_SCB_VECTOR( x ) (( ( x ) * 0x10) + 0xC00) - -/* - * T4 Control and Status Registers - * - * All CBUS CSRs in the Cbus2 IO subsystems are in the T4 gate array. The - * CBUS CSRs in the T4 are all aligned on hexaword boundaries and have - * quadword length. Note, this structure also works for T2 as the T2 - * registers are a proper subset of the T3/T4's. Just make sure - * that T2 code does not reference T3/T4-only registers. - * - */ - -typedef struct { - u_long iocsr; u_long fill_00[3]; /* I/O Control/Status */ - u_long cerr1; u_long fill_01[3]; /* Cbus Error Register 1 */ - u_long cerr2; u_long fill_02[3]; /* Cbus Error Register 2 */ - u_long cerr3; u_long fill_03[3]; /* Cbus Error Register 3 */ - u_long pcierr1; u_long fill_04[3]; /* PCI Error Register 1 */ - u_long pcierr2; u_long fill_05[3]; /* PCI Error Register 2 */ - u_long pciscr; u_long fill_06[3]; /* PCI Special Cycle */ - u_long hae0_1; u_long fill_07[3]; /* High Address Extension 1 */ - u_long hae0_2; u_long fill_08[3]; /* High Address Extension 2 */ - u_long hbase; u_long fill_09[3]; /* PCI Hole Base */ - u_long wbase1; u_long fill_0a[3]; /* Window Base 1 */ - u_long wmask1; u_long fill_0b[3]; /* Window Mask 1 */ - u_long tbase1; u_long fill_0c[3]; /* Translated Base 1 */ - u_long wbase2; u_long fill_0d[3]; /* Window Base 2 */ - u_long wmask2; u_long fill_0e[3]; /* Window Mask 2 */ - u_long tbase2; u_long fill_0f[3]; /* Translated Base 2 */ - u_long tlbbr; u_long fill_10[3]; /* TLB by-pass */ - u_long ivr; u_long fill_11[3]; /* IVR Passive Rels/Intr Addr (reserved on T3/T4) */ - u_long hae0_3; u_long fill_12[3]; /* High Address Extension 3 */ - u_long hae0_4; u_long fill_13[3]; /* High Address Extension 4 */ - u_long wbase3; u_long fill_14[3]; /* Window Base 3 */ - u_long wmask3; u_long fill_15[3]; /* Window Mask 3 */ - u_long tbase3; u_long fill_16[3]; /* Translated Base 3 */ - - u_long rsvd1; u_long fill_16a[3]; /* unused location */ - - u_long tdr0; u_long fill_17[3]; /* tlb data register 0 */ - u_long tdr1; u_long fill_18[3]; /* tlb data register 1 */ - u_long tdr2; u_long fill_19[3]; /* tlb data register 2 */ - u_long tdr3; u_long fill_1a[3]; /* tlb data register 3 */ - u_long tdr4; u_long fill_1b[3]; /* tlb data register 4 */ - u_long tdr5; u_long fill_1c[3]; /* tlb data register 5 */ - u_long tdr6; u_long fill_1d[3]; /* tlb data register 6 */ - u_long tdr7; u_long fill_1e[3]; /* tlb data register 7 */ - u_long wbase4; u_long fill_1f[3]; /* Window Base 4 */ - u_long wmask4; u_long fill_20[3]; /* Window Mask 4 */ - u_long tbase4; u_long fill_21[3]; /* Translated Base 4 */ -/* - * The following 4 registers are used to get to the ICIC chip - */ - u_long air; u_long fill_22[3]; /* Address Indirection register */ - u_long var; u_long fill_23[3]; /* Vector access register */ - u_long dir; u_long fill_24[3]; /* Data Indirection register */ - u_long ice; u_long fill_25[3]; /* IC enable register Indirection register */ - -} t2_csr_t; diff --git a/sys/alpha/pci/t2var.h b/sys/alpha/pci/t2var.h deleted file mode 100644 index 73ec13e..0000000 --- a/sys/alpha/pci/t2var.h +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * Copyright (c) 2000 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. - * - * $FreeBSD$ - */ - -extern vm_offset_t sable_lynx_base; - -extern void t2_init(void); diff --git a/sys/alpha/pci/tsunami.c b/sys/alpha/pci/tsunami.c deleted file mode 100644 index d09bfcb..0000000 --- a/sys/alpha/pci/tsunami.c +++ /dev/null @@ -1,417 +0,0 @@ -/*- - * Copyright (c) 1999 Andrew Gallatin - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include "opt_cpu.h" - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/module.h> -#include <sys/mutex.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <sys/proc.h> -#include <sys/rman.h> -#include <sys/interrupt.h> -#include <sys/malloc.h> - -#include <dev/pci/pcivar.h> -#include <alpha/isa/isavar.h> -#include <alpha/pci/tsunamireg.h> -#include <alpha/pci/tsunamivar.h> - -#include <machine/bwx.h> -#include <machine/cpuconf.h> -#include <machine/intr.h> -#include <machine/intrcnt.h> -#include <machine/md_var.h> -#include <machine/resource.h> -#include <machine/rpb.h> -#include <machine/sgmap.h> - -#include <vm/vm.h> -#include <vm/vm_page.h> - -#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) - -static devclass_t tsunami_devclass; -static device_t tsunami0; /* XXX only one for now */ - -struct tsunami_softc { - int junk; /* no softc */ -}; - -int tsunami_num_pchips = 0; -static volatile tsunami_pchip *pchip[2] = {pchip0, pchip1}; - -#define TSUNAMI_SOFTC(dev) (struct tsunami_softc*) device_get_softc(dev) - -static alpha_chipset_read_hae_t tsunami_read_hae; -static alpha_chipset_write_hae_t tsunami_write_hae; - -static alpha_chipset_t tsunami_chipset = { - tsunami_read_hae, - tsunami_write_hae, -}; - -static void tsunami_intr_enable(int); -static void tsunami_intr_disable(int); - -/* - * There doesn't appear to be an hae on this platform - */ - - -static u_int64_t -tsunami_read_hae(void) -{ - return 0; -} - -static void -tsunami_write_hae(u_int64_t hae) -{ -} - -static int tsunami_probe(device_t dev); -static int tsunami_attach(device_t dev); -static int tsunami_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, - driver_intr_t *intr, void *arg, void **cookiep); -static int tsunami_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie); - -static device_method_t tsunami_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, tsunami_probe), - DEVMETHOD(device_attach, tsunami_attach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_setup_intr, tsunami_setup_intr), - DEVMETHOD(bus_teardown_intr, tsunami_teardown_intr), - - { 0, 0 } -}; - -static driver_t tsunami_driver = { - "tsunami", - tsunami_methods, - sizeof(struct tsunami_softc), -}; - -static void -pchip_init(volatile tsunami_pchip *pchip, int index) -{ - - int i; - - /* - * initialize the direct map DMA windows. - * - * leave window 0 untouched; we'll set that up for S/G DMA for - * isa devices later in the boot process - * - * window 1 goes at 2GB and has a length of 1 GB. It maps - * physical address 0 - 1GB. The SRM console typically sets - * this window up here. - */ - - pchip->wsba[1].reg = (2UL*1024*1024*1024) | WINDOW_ENABLE; - pchip->wsm[1].reg = (1UL*1024*1024*1024 - 1) & 0xfff00000UL; - pchip->tba[1].reg = 0; - - /* - * window 2 goes at 3GB and has a length of 1 GB. It maps - * physical address 1GB-2GB. - */ - - pchip->wsba[2].reg = (3UL*1024*1024*1024) | WINDOW_ENABLE; - pchip->wsm[2].reg = (1UL*1024*1024*1024 - 1) & 0xfff00000UL; - pchip->tba[2].reg = 1UL*1024*1024*1024; - - /* - * window 3 is disabled. The SRM console typically leaves it - * disabled - */ - - pchip->wsba[3].reg = 0; - alpha_mb(); - - if(bootverbose) { - printf("pchip%d:\n", index); - for (i = 0; i < 4; i++) { - printf("\twsba[%d].reg = 0x%lx\n", - i, pchip->wsba[i].reg); - printf("\t wsm[%d].reg = 0x%lx\n", - i, pchip->wsm[i].reg); - printf("\t tba[%d].reg = 0x%lx\n", - i, pchip->tba[i].reg); - } - } -} - -#define TSUNAMI_SGMAP_BASE (8*1024*1024) -#define TSUNAMI_SGMAP_SIZE (8*1024*1024) - -static void -tsunami_sgmap_invalidate(void) -{ - alpha_mb(); - switch (tsunami_num_pchips) { - case 2: - pchip[1]->tlbia.reg = (u_int64_t)0; - case 1: - pchip[0]->tlbia.reg = (u_int64_t)0; - } - alpha_mb(); -} - -static void -tsunami_sgmap_map(void *arg, bus_addr_t ba, vm_offset_t pa) -{ - u_int64_t *sgtable = arg; - int index = alpha_btop(ba - TSUNAMI_SGMAP_BASE); - - if (pa) { - if (pa > (1L<<32)) - panic("tsunami_sgmap_map: can't map address 0x%lx", pa); - sgtable[index] = ((pa >> 13) << 1) | 1; - } else { - sgtable[index] = 0; - } - alpha_mb(); - tsunami_sgmap_invalidate(); -} - - -static void -tsunami_init_sgmap(void) -{ - void *sgtable; - int i; - - sgtable = contigmalloc(8192, M_DEVBUF, M_NOWAIT, - 0, (1L<<34), - 32*1024, (1L<<34)); - if (!sgtable) - panic("tsunami_init_sgmap: can't allocate page table"); - - for(i=0; i < tsunami_num_pchips; i++){ - pchip[i]->tba[0].reg = - pmap_kextract((vm_offset_t) sgtable); - pchip[i]->wsba[0].reg |= WINDOW_ENABLE | WINDOW_SCATTER_GATHER; - } - - chipset.sgmap = sgmap_map_create(TSUNAMI_SGMAP_BASE, - TSUNAMI_SGMAP_BASE + TSUNAMI_SGMAP_SIZE, - tsunami_sgmap_map, sgtable); - chipset.pci_sgmap = NULL; -} - -void -tsunami_init() -{ - static int initted = 0; - static struct bwx_space io_space; - static struct bwx_space mem_space; - - if (initted) return; - initted = 1; - - /* - * Define two temporary spaces for bootstrap i/o on hose 0. - */ - bwx_init_space(&io_space, KV(TSUNAMI_IO(0))); - bwx_init_space(&mem_space, KV(TSUNAMI_MEM(0))); - - busspace_isa_io = (struct alpha_busspace *) &io_space; - busspace_isa_mem = (struct alpha_busspace *) &mem_space; - - chipset = tsunami_chipset; - platform.pci_intr_enable = tsunami_intr_enable; - platform.pci_intr_disable = tsunami_intr_disable; - chipset.dmsize = 2UL * 1024UL * 1024UL * 1024UL; - chipset.dmoffset = 2UL * 1024UL * 1024UL * 1024UL; - - if (platform.pci_intr_init) - platform.pci_intr_init(); -} - -static int -tsunami_probe(device_t dev) -{ - device_t child; - int i; - if (tsunami0) - return ENXIO; - tsunami0 = dev; - device_set_desc(dev, "21271 Core Logic chipset"); - if(cchip->csc.reg & CSC_P1P) - tsunami_num_pchips = 2; - else - tsunami_num_pchips = 1; - - isa_init_intr(); - - for(i = 0; i < tsunami_num_pchips; i++) { - child = device_add_child(dev, "pcib", i); - pchip_init(pchip[i], i); - } - - return 0; -} - -static int -tsunami_attach(device_t dev) -{ - tsunami_init(); - - if (!platform.iointr) /* XXX */ - set_iointr(alpha_dispatch_intr); - - snprintf(chipset_type, sizeof(chipset_type), "tsunami"); - chipset_bwx = 1; - - chipset_ports = TSUNAMI_IO(0); - chipset_memory = TSUNAMI_MEM(0); - chipset_dense = TSUNAMI_MEM(0); - bus_generic_attach(dev); - tsunami_init_sgmap(); - - return 0; -} - -static void -tsunami_disable_intr_vec(uintptr_t vector) -{ - int irq; - - irq = (vector - 0x900) >> 4; - mtx_lock_spin(&icu_lock); - platform.pci_intr_disable(irq); - mtx_unlock_spin(&icu_lock); -} - -static void -tsunami_enable_intr_vec(uintptr_t vector) -{ - int irq; - - irq = (vector - 0x900) >> 4; - mtx_lock_spin(&icu_lock); - platform.pci_intr_enable(irq); - mtx_unlock_spin(&icu_lock); -} - -static int -tsunami_setup_intr(device_t dev, device_t child, - struct resource *irq, int flags, - driver_intr_t *intr, void *arg, void **cookiep) -{ - int error, start; - - error = rman_activate_resource(irq); - if (error) - return error; - - start = rman_get_start(irq); - - error = alpha_setup_intr(device_get_nameunit(child ? child : dev), - 0x900 + (start << 4), intr, arg, flags, cookiep, - &intrcnt[INTRCNT_EB164_IRQ + start], - tsunami_disable_intr_vec, tsunami_enable_intr_vec); - if (error) - return error; - - /* Enable PCI interrupt */ - mtx_lock_spin(&icu_lock); - platform.pci_intr_enable(start); - mtx_unlock_spin(&icu_lock); - - device_printf(child, "interrupting at TSUNAMI irq %d\n", start); - - return 0; -} - -static int -tsunami_teardown_intr(device_t dev, device_t child, - struct resource *irq, void *cookie) -{ - - alpha_teardown_intr(cookie); - return rman_deactivate_resource(irq); - -} - - -/* - * Currently, all interrupts will be funneled through CPU 0 - */ - -static void -tsunami_intr_enable(int irq) -{ - volatile u_int64_t *mask; - u_int64_t saved_mask; - - mask = &cchip->dim0.reg; - saved_mask = *mask; - - saved_mask |= (1UL << (unsigned long)irq); - *mask = saved_mask; - alpha_mb(); - alpha_mb(); - saved_mask = *mask; - alpha_mb(); - alpha_mb(); -} - -static void -tsunami_intr_disable(int irq) -{ - volatile u_int64_t *mask; - u_int64_t saved_mask; - - mask = &cchip->dim0.reg; - saved_mask = *mask; - - saved_mask &= ~(1UL << (unsigned long)irq); - *mask = saved_mask; - alpha_mb(); - saved_mask = *mask; - alpha_mb(); - alpha_mb(); -} - - - -DRIVER_MODULE(tsunami, root, tsunami_driver, tsunami_devclass, 0, 0); - diff --git a/sys/alpha/pci/tsunami_pci.c b/sys/alpha/pci/tsunami_pci.c deleted file mode 100644 index 9b5853c..0000000 --- a/sys/alpha/pci/tsunami_pci.c +++ /dev/null @@ -1,296 +0,0 @@ -/*- - * Copyright (c) 1999 Andrew Gallatin - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/malloc.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <machine/md_var.h> -#include <sys/rman.h> -#include <dev/pci/pcivar.h> -#include <alpha/pci/tsunamireg.h> -#include <alpha/pci/tsunamivar.h> -#include <alpha/pci/pcibus.h> -#include <machine/resource.h> -#include <machine/bwx.h> - -#include "alphapci_if.h" -#include "pcib_if.h" - -struct tsunami_hose_softc { - struct bwx_space io; /* accessor for ports */ - struct bwx_space mem; /* accessor for memory */ - struct rman io_rman; /* resource manager for ports */ - struct rman mem_rman; /* resource manager for memory */ -}; - -static devclass_t pcib_devclass; - - -static int -tsunami_pcib_probe(device_t dev) -{ - struct tsunami_hose_softc *sc = device_get_softc(dev); - device_t child; - - device_set_desc(dev, "21271 PCI host bus adapter"); - - pci_init_resources(); /* XXX probably don't need */ - child = device_add_child(dev, "pci", -1); - - bwx_init_space(&sc->io, KV(TSUNAMI_IO(device_get_unit(dev)))); - bwx_init_space(&sc->mem, KV(TSUNAMI_MEM(device_get_unit(dev)))); - - sc->io_rman.rm_start = 0; - sc->io_rman.rm_end = ~0u; - sc->io_rman.rm_type = RMAN_ARRAY; - sc->io_rman.rm_descr = "I/O ports"; - if (rman_init(&sc->io_rman) - || rman_manage_region(&sc->io_rman, 0x0, (1L << 32))) - panic("tsunami_pcib_probe: io_rman"); - - sc->mem_rman.rm_start = 0; - sc->mem_rman.rm_end = ~0u; - sc->mem_rman.rm_type = RMAN_ARRAY; - sc->mem_rman.rm_descr = "I/O memory"; - if (rman_init(&sc->mem_rman) - || rman_manage_region(&sc->mem_rman, 0x0, (1L << 32))) - panic("tsunami_pcib_probe: mem_rman"); - - /* - * Replace the temporary bootstrap spaces with real onys. This - * isn't stictly necessary but it keeps things tidy. - */ - if (device_get_unit(dev) == 0) { - busspace_isa_io = (struct alpha_busspace *) &sc->io; - busspace_isa_mem = (struct alpha_busspace *) &sc->mem; - } - - return 0; -} - -static int -tsunami_pcib_read_ivar(device_t dev, device_t child, int which, u_long *result) -{ - if (which == PCIB_IVAR_BUS) { - *result = 0; - } - return ENOENT; -} - -static void * -tsunami_pcib_cvt_dense(device_t dev, vm_offset_t addr) -{ - int h = device_get_unit(dev); - addr &= 0xffffffffUL; - return (void *) KV(addr | TSUNAMI_MEM(h)); -} - -static void * -tsunami_pcib_cvt_bwx(device_t dev, vm_offset_t addr) -{ - int h = device_get_unit(dev); - addr &= 0xffffffffUL; - return (void *) KV(addr | TSUNAMI_MEM(h)); -} - -static kobj_t -tsunami_pcib_get_bustag(device_t dev, int type) -{ - struct tsunami_hose_softc *sc = device_get_softc(dev); - - switch (type) { - case SYS_RES_IOPORT: - return (kobj_t) &sc->io; - - case SYS_RES_MEMORY: - return (kobj_t) &sc->mem; - } - - return 0; -} - -static struct rman * -tsunami_pcib_get_rman(device_t dev, int type) -{ - struct tsunami_hose_softc *sc = device_get_softc(dev); - - switch (type) { - case SYS_RES_IOPORT: - return &sc->io_rman; - - case SYS_RES_MEMORY: - return &sc->mem_rman; - } - - return 0; -} - -static int -tsunami_pcib_maxslots(device_t dev) -{ - return 31; -} - -static void -tsunami_clear_abort(void) -{ - alpha_mb(); - alpha_pal_draina(); -} - -static int -tsunami_check_abort(void) -{ -/* u_int32_t errbits;*/ - int ba = 0; - - alpha_pal_draina(); - alpha_mb(); -#if 0 - errbits = REGVAL(TSUNAMI_CSR_TSUNAMI_ERR); - if (errbits & (TSUNAMI_ERR_RCVD_MAS_ABT|TSUNAMI_ERR_RCVD_TAR_ABT)) - ba = 1; - - if (errbits) { - REGVAL(TSUNAMI_CSR_TSUNAMI_ERR) = errbits; - alpha_mb(); - alpha_pal_draina(); - } -#endif - return ba; -} - -#define TSUNAMI_CFGADDR(b, s, f, r, h) \ - KV(TSUNAMI_CONF(h) | ((b) << 16) | ((s) << 11) | ((f) << 8) | (r)) - -#define CFGREAD(h, b, s, f, r, op, width, type) do { \ - vm_offset_t va; \ - type data; \ - va = TSUNAMI_CFGADDR(b, s, f, r, h); \ - tsunami_clear_abort(); \ - if (badaddr((caddr_t)va, width)) { \ - tsunami_check_abort(); \ - return ~0; \ - } \ - data = op(va); \ - if (tsunami_check_abort()) \ - return ~0; \ - return data; \ -} while (0) - -#define CFGWRITE(h, b, s, f, r, data, op, width) do { \ - vm_offset_t va; \ - va = TSUNAMI_CFGADDR(b, s, f, r, h); \ - tsunami_clear_abort(); \ - if (badaddr((caddr_t)va, width)) \ - return; \ - op(va, data); \ - tsunami_check_abort(); \ -} while (0) - -static u_int32_t -tsunami_pcib_read_config(device_t dev, u_int b, u_int s, u_int f, - u_int reg, int width) -{ - int h = device_get_unit(dev); - switch (width) { - case 1: - CFGREAD(h, b, s, f, reg, ldbu, 1, u_int8_t); - break; - case 2: - CFGREAD(h, b, s, f, reg, ldwu, 2, u_int16_t); - break; - case 4: - CFGREAD(h, b, s, f, reg, ldl, 4, u_int32_t); - } - return ~0; -} - -static void -tsunami_pcib_write_config(device_t dev, u_int b, u_int s, u_int f, - u_int reg, u_int32_t val, int width) -{ - int h = device_get_unit(dev); - switch (width) { - case 1: - CFGWRITE(h, b, s, f, reg, val, stb, 1); - break; - case 2: - CFGWRITE(h, b, s, f, reg, val, stw, 2); - break; - case 4: - CFGWRITE(h, b, s, f, reg, val, stl, 4); - } -} - -static device_method_t tsunami_pcib_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, tsunami_pcib_probe), - DEVMETHOD(device_attach, bus_generic_attach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, tsunami_pcib_read_ivar), - DEVMETHOD(bus_alloc_resource, alpha_pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), - DEVMETHOD(bus_setup_intr, alpha_platform_pci_setup_intr), - DEVMETHOD(bus_teardown_intr, alpha_platform_pci_teardown_intr), - - /* alphapci interface */ - DEVMETHOD(alphapci_cvt_dense, tsunami_pcib_cvt_dense), - DEVMETHOD(alphapci_cvt_bwx, tsunami_pcib_cvt_bwx), - DEVMETHOD(alphapci_get_bustag, tsunami_pcib_get_bustag), - DEVMETHOD(alphapci_get_rman, tsunami_pcib_get_rman), - - /* pcib interface */ - DEVMETHOD(pcib_maxslots, tsunami_pcib_maxslots), - DEVMETHOD(pcib_read_config, tsunami_pcib_read_config), - DEVMETHOD(pcib_write_config, tsunami_pcib_write_config), - DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), - - { 0, 0 } -}; - - -static driver_t tsunami_pcib_driver = { - "pcib", - tsunami_pcib_methods, - sizeof(struct tsunami_hose_softc), -}; - - -DRIVER_MODULE(pcib, tsunami, tsunami_pcib_driver, pcib_devclass, 0, 0); - - diff --git a/sys/alpha/pci/tsunamireg.h b/sys/alpha/pci/tsunamireg.h deleted file mode 100644 index 36ecaaf..0000000 --- a/sys/alpha/pci/tsunamireg.h +++ /dev/null @@ -1,105 +0,0 @@ -/* $FreeBSD$ */ - -/* - * 21271 Chipset registers and constants. - * - * Taken from Tsunami/Typhoon Specification Rev. 1.2 - * and Compaq Professional Workstation XP1000: Technical - * Information, both graciously provided by Don Rice - */ - - -typedef struct { - volatile u_int64_t reg __aligned(64); -} tsunami_reg; - /* notes */ -typedef struct { - tsunami_reg csc; /* rw */ - tsunami_reg mtr; /* rw */ - tsunami_reg misc; /* rw */ - tsunami_reg mpd; /* rw */ - tsunami_reg aar0; /* rw */ - tsunami_reg aar1; /* rw */ - tsunami_reg aar2; /* rw */ - tsunami_reg aar3; /* rw */ - tsunami_reg dim0; /* rw */ - tsunami_reg dim1; /* rw */ - tsunami_reg dir0; /* ro */ - tsunami_reg dir1; /* ro */ - tsunami_reg drir; /* ro */ - tsunami_reg prben; /* "special" */ - tsunami_reg iic0; /* rw */ - tsunami_reg iic1; /* rw */ - tsunami_reg mpr0; /* wo */ - tsunami_reg mpr1; /* wo */ - tsunami_reg mpr2; /* wo */ - tsunami_reg mpr3; /* wo */ - tsunami_reg mctl; /* rw, Tsunami only */ - tsunami_reg ttr; /* rw */ - tsunami_reg tdr; /* rw */ - tsunami_reg dim2; /* rw, Typhoon only */ - tsunami_reg dim3; /* rw, Typhoon only */ - tsunami_reg dir2; /* ro, Typhoon only */ - tsunami_reg dir3; /* ro, Typhoon only */ - tsunami_reg iic2; /* rw, Typhoon only */ - tsunami_reg iic3; /* rw, Typhoon only */ - tsunami_reg pwr; /* rw */ -} tsunami_cchip; - -/* - * cchip csc defines - */ -#define CSC_P1P (1L << 14) /* pchip1 present if this bit is set in - chip->csc */ - -typedef struct { - tsunami_reg dsc; - tsunami_reg str; - tsunami_reg drev; -} tsunami_dchip; - -typedef struct { - tsunami_reg wsba[4]; /* rw */ - tsunami_reg wsm[4]; /* rw */ - tsunami_reg tba[4]; /* rw */ - tsunami_reg pctl; /* rw */ - tsunami_reg plat; /* ro */ - tsunami_reg reserved; /* rw */ - tsunami_reg perror; /* rw */ - tsunami_reg perrmask; /* rw */ - tsunami_reg perrset; /* wo */ - tsunami_reg tlbiv; /* wo */ - tsunami_reg tlbia; /* wo */ - tsunami_reg pmonctl; /* rw */ - tsunami_reg pmoncnt; /* rw */ -} tsunami_pchip; - -/* - * pchip window defines - */ -#define WINDOW_ENABLE 0x1 -#define WINDOW_DISABLE 0x0 -#define WINDOW_SCATTER_GATHER 0x2 -#define WINDOW_DIRECT_MAPPED 0x0 - - - -#define KV(pa) ALPHA_PHYS_TO_K0SEG(pa) - -#define cchip ((tsunami_cchip *)(KV(0x101A0000000UL))) -#define dchip ((tsunami_dchip *)(KV(0x101B0000800UL))) -#define pchip0 ((tsunami_pchip *)(KV(0x10180000000UL))) -#define pchip1 ((tsunami_pchip *)(KV(0x10380000000UL))) - -/* - * memory / i/o space macros - * - */ -#define HOSE(h) (((unsigned long)(h)) << 33) -#define TSUNAMI_MEM(h) (0x10000000000UL + HOSE(h)) -#define TSUNAMI_IACK_SC(h) (0x101F8000000UL + HOSE(h)) -#define TSUNAMI_IO(h) (0x101FC000000UL + HOSE(h)) -#define TSUNAMI_CONF(h) (0x101FE000000UL + HOSE(h)) - - -#define TSUNAMI_MAXHOSES 4 diff --git a/sys/alpha/pci/tsunamivar.h b/sys/alpha/pci/tsunamivar.h deleted file mode 100644 index 89cb2ab..0000000 --- a/sys/alpha/pci/tsunamivar.h +++ /dev/null @@ -1,31 +0,0 @@ -/*- - * Copyright (c) 1998 Andrew Gallatin - * 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. - * - * $FreeBSD$ - */ - -extern void tsunami_init(void); -extern int tsunami_bus_within_hose(int, int); -extern int tsunami_hose_from_bus(int); diff --git a/sys/alpha/tlsb/dwlpx.c b/sys/alpha/tlsb/dwlpx.c deleted file mode 100644 index d8520ab..0000000 --- a/sys/alpha/tlsb/dwlpx.c +++ /dev/null @@ -1,862 +0,0 @@ -/*- - * 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. - */ -/*- - * Based very closely on NetBSD version- - * - * Copyright (c) 1997 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. 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 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/lock.h> -#include <sys/module.h> -#include <sys/mutex.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <machine/md_var.h> -#include <sys/proc.h> -#include <sys/rman.h> -#include <sys/interrupt.h> - -#include <machine/swiz.h> -#include <machine/intr.h> -#include <machine/intrcnt.h> -#include <machine/resource.h> -#include <machine/sgmap.h> -#include <vm/vm.h> -#include <vm/vm_page.h> - - -#include <alpha/tlsb/tlsbreg.h> -#include <alpha/tlsb/tlsbvar.h> - -#include <alpha/tlsb/kftxxreg.h> -#include <alpha/tlsb/kftxxvar.h> - -#include <alpha/tlsb/dwlpxreg.h> -#include <alpha/tlsb/dwlpxvar.h> -#include <alpha/pci/pcibus.h> -#include <dev/pci/pcivar.h> - -#include "alphapci_if.h" -#include "pcib_if.h" - -static devclass_t dwlpx_devclass; -static device_t dwlpxs[DWLPX_NIONODE][DWLPX_NHOSE]; - - -#define KV(pa) ((void *)ALPHA_PHYS_TO_K0SEG(pa)) - -struct dwlpx_softc { - struct dwlpx_softc *next; - device_t dev; /* backpointer */ - u_int64_t sysbase; /* shorthand */ - vm_offset_t dmem_base; /* dense memory */ - vm_offset_t smem_base; /* sparse memory */ - vm_offset_t io_base; /* sparse i/o */ - struct swiz_space io_space; /* accessor for ports */ - struct swiz_space mem_space; /* accessor for memory */ - struct rman io_rman; /* resource manager for ports */ - struct rman mem_rman; /* resource manager for memory */ - int bushose; /* our bus && hose */ - u_int : 26, - nhpc : 2, /* how many HPCs */ - dwlpb : 1, /* this is a DWLPB */ - sgmapsz : 3; /* Scatter Gather map size */ -}; - -static driver_intr_t dwlpx_intr; - -static u_int32_t imaskcache[DWLPX_NIONODE][DWLPX_NHOSE][NHPC]; -static void dwlpx_eintr(unsigned long); - -/* - * Direct-mapped window: 2G at 2G - */ -#define DWLPx_DIRECT_MAPPED_BASE (2UL*1024UL*1024UL*1024UL) -#define DWLPx_DIRECT_MAPPED_SIZE (2UL*1024UL*1024UL*1024UL) -#define DWLPx_DIRECT_MAPPED_WMASK PCIA_WMASK_2G - -/* - * SGMAP window A: 256M at 1.75G or 1G at 1G - */ -#define DWLPx_SG_MAPPED_SIZE(x) ((x) * PAGE_SIZE) -static void dwlpx_dma_init(struct dwlpx_softc *); - -#define DWLPX_SOFTC(dev) (struct dwlpx_softc *) device_get_softc(dev) -static struct dwlpx_softc *dwlpx_root; - -static int -dwlpx_probe(device_t dev) -{ - device_t child; - u_int32_t ctl; - struct dwlpx_softc *xc, *sc = DWLPX_SOFTC(dev); - unsigned long ls; - int io, hose; - - io = kft_get_node(dev) - 4; - hose = kft_get_hosenum(dev); - - sc->bushose = (io << 2) | hose; - - if (dwlpxs[io][hose]) { - device_printf(dev, "already attached\n"); - return EEXIST; - } - if ((xc = dwlpx_root) == NULL) { - dwlpx_root = sc; - } else { - while (xc->next) - xc = xc->next; - xc->next = sc; - } - sc->dev = dwlpxs[io][hose] = dev; - - ls = DWLPX_BASE(io + 4, hose); - for (sc->nhpc = 1; sc->nhpc < NHPC; sc->nhpc++) { - if (badaddr(KV(PCIA_CTL(sc->nhpc) + ls), sizeof (ctl))) { - break; - } - } - if (sc->nhpc != NHPC) { - REGVAL(PCIA_ERR(0) + ls) = PCIA_ERR_ALLERR; - } - ctl = REGVAL(PCIA_PRESENT + ls); - if ((ctl >> PCIA_PRESENT_REVSHIFT) & PCIA_PRESENT_REVMASK) { - sc->dwlpb = 1; - device_set_desc(dev, "DWLPB PCI adapter"); - } else { - device_set_desc(dev, "DWLPA PCI adapter"); - } - sc->sgmapsz = DWLPX_SG32K; - - if (device_get_unit(dev) == 0) { - pci_init_resources(); - } - - child = device_add_child(dev, "pci", -1); - device_set_ivars(child, &sc->bushose); - return (0); -} - -static int -dwlpx_attach(device_t dev) -{ - struct dwlpx_softc *sc = DWLPX_SOFTC(dev); - device_t parent = device_get_parent(dev); - vm_offset_t regs; - u_int32_t ctl; - int i, io, hose; - void *intr; - - io = kft_get_node(dev) - 4; - hose = kft_get_hosenum(dev); - - sc->sysbase = DWLPX_BASE(io + 4, hose); - regs = (vm_offset_t) KV(sc->sysbase); - sc->dmem_base = regs + DWLPX_PCI_DENSE; - sc->smem_base = regs + DWLPX_PCI_SPARSE; - sc->io_base = regs + DWLPX_PCI_IOSPACE; - - /* - * Maybe initialise busspace_isa_io and busspace_isa_mem - * here. Does the 8200 actually have any ISA slots? - */ - swiz_init_space(&sc->io_space, sc->io_base); - swiz_init_space(&sc->mem_space, sc->smem_base); - - sc->io_rman.rm_start = 0; - sc->io_rman.rm_end = ~0u; - sc->io_rman.rm_type = RMAN_ARRAY; - sc->io_rman.rm_descr = "I/O ports"; - if (rman_init(&sc->io_rman) - || rman_manage_region(&sc->io_rman, 0x0, (1L << 32))) - panic("dwlpx_attach: io_rman"); - - sc->mem_rman.rm_start = 0; - sc->mem_rman.rm_end = ~0u; - sc->mem_rman.rm_type = RMAN_ARRAY; - sc->mem_rman.rm_descr = "I/O memory"; - if (rman_init(&sc->mem_rman) - || rman_manage_region(&sc->mem_rman, 0x0, (1L << 32))) - panic("dwlpx_attach: mem_rman"); - - /* - * Set up interrupt stuff for this DWLPX. - * - * Note that all PCI interrupt pins are disabled at this time. - * - * Do this even for all HPCs- even for the - * nonexistent one on hose zero of a KFTIA. - */ - for (i = 0; i < NHPC; i++) { - REGVAL(PCIA_IMASK(i) + sc->sysbase) = DWLPX_IMASK_DFLT; - REGVAL(PCIA_ERRVEC(i) + sc->sysbase) = - DWLPX_ERRVEC(io, hose); - } - - for (i = 0; i < DWLPX_MAXDEV; i++) { - u_int16_t vec; - int ss, hpc; - - vec = DWLPX_MVEC(io, hose, i); - ss = i; - if (i < 4) { - hpc = 0; - } else if (i < 8) { - ss -= 4; - hpc = 1; - } else { - ss -= 8; - hpc = 2; - } - REGVAL(PCIA_DEVVEC(hpc, ss, 1) + sc->sysbase) = vec; - REGVAL(PCIA_DEVVEC(hpc, ss, 2) + sc->sysbase) = vec; - REGVAL(PCIA_DEVVEC(hpc, ss, 3) + sc->sysbase) = vec; - REGVAL(PCIA_DEVVEC(hpc, ss, 4) + sc->sysbase) = vec; - } - - /* - * Establish HAE values, as well as make sure of sanity elsewhere. - */ - for (i = 0; i < sc->nhpc; i++) { - ctl = REGVAL(PCIA_CTL(i) + sc->sysbase); - ctl &= 0x0fffffff; - ctl &= ~(PCIA_CTL_MHAE(0x1f) | PCIA_CTL_IHAE(0x1f)); - /* - * I originally also had it or'ing in 3, which makes no sense. - */ - - ctl |= PCIA_CTL_RMMENA | PCIA_CTL_RMMARB; - - /* - * Only valid if we're attached to a KFTIA or a KTHA. - */ - ctl |= PCIA_CTL_3UP; - - ctl |= PCIA_CTL_CUTENA; - - /* - * Fit in appropriate S/G Map Ram size. - */ - if (sc->sgmapsz == DWLPX_SG32K) - ctl |= PCIA_CTL_SG32K; - else if (sc->sgmapsz == DWLPX_SG128K) - ctl |= PCIA_CTL_SG128K; - else - ctl |= PCIA_CTL_SG32K; - - REGVAL(PCIA_CTL(i) + sc->sysbase) = ctl; - } - - /* - * Enable TBIT if required - */ - if (sc->sgmapsz == DWLPX_SG128K) - REGVAL(PCIA_TBIT + sc->sysbase) = 1; - - alpha_mb(); - - for (io = 0; io < DWLPX_NIONODE; io++) { - for (hose = 0; hose < DWLPX_NHOSE; hose++) { - for (i = 0; i < NHPC; i++) { - imaskcache[io][hose][i] = DWLPX_IMASK_DFLT; - } - } - } - - /* - * Set up DMA stuff here. - */ - - dwlpx_dma_init(sc); - - - /* - * Register our interrupt service requirements with our parent. - */ - i = BUS_SETUP_INTR(parent, dev, NULL, - INTR_TYPE_MISC, dwlpx_intr, 0, &intr); - if (i == 0) { - bus_generic_attach(dev); - } - return (i); -} - -static void dwlpx_enadis_intr(int, int, int); - -static void -dwlpx_enadis_intr(int vector, int intpin, int onoff) -{ - unsigned long paddr; - u_int32_t val; - int device, ionode, hose, hpc; - - ionode = DWLPX_MVEC_IONODE(vector); - hose = DWLPX_MVEC_HOSE(vector); - device = DWLPX_MVEC_PCISLOT(vector); - - paddr = (1LL << 39); - paddr |= (unsigned long) ionode << 36; - paddr |= (unsigned long) hose << 34; - if (device < 4) { - hpc = 0; - } else if (device < 8) { - hpc = 1; - device -= 4; - } else { - hpc = 2; - device -= 8; - } - intpin <<= (device << 2); - mtx_lock_spin(&icu_lock); - val = imaskcache[ionode][hose][hpc]; - if (onoff) - val |= intpin; - else - val &= ~intpin; - imaskcache[ionode][hose][hpc] = val; - REGVAL(PCIA_IMASK(hpc) + paddr) = val; - mtx_unlock_spin(&icu_lock); -} - -static int -dwlpx_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, - driver_intr_t *intr, void *arg, void **cookiep) -{ - struct dwlpx_softc *sc = DWLPX_SOFTC(dev); - int slot, ionode, hose, error, vector, intpin; - - error = rman_activate_resource(irq); - if (error) - return error; - - intpin = pci_get_intpin(child); - slot = pci_get_slot(child); - ionode = sc->bushose >> 2; - hose = sc->bushose & 0x3; - - vector = DWLPX_MVEC(ionode, hose, slot); - error = alpha_setup_intr(device_get_nameunit(child ? child : dev), - vector, intr, arg, flags, cookiep, - &intrcnt[INTRCNT_KN8AE_IRQ], NULL, NULL); - if (error) - return error; - dwlpx_enadis_intr(vector, intpin, 1); - device_printf(child, "Node %d Hose %d Slot %d interrupting at TLSB " - "vector 0x%x intpin %d\n", ionode+4, hose, slot, vector, intpin); - return (0); -} - -static int -dwlpx_teardown_intr(device_t dev, device_t child, struct resource *irq, void *c) -{ - struct dwlpx_softc *sc = DWLPX_SOFTC(dev); - int slot, ionode, hose, vector, intpin; - - intpin = pci_get_intpin(child); - slot = pci_get_slot(child); - ionode = sc->bushose >> 2; - hose = sc->bushose & 0x3; - vector = DWLPX_MVEC(ionode, hose, slot); - dwlpx_enadis_intr(vector, intpin, 0); - alpha_teardown_intr(c); - return rman_deactivate_resource(irq); -} - -static int -dwlpx_read_ivar(device_t dev, device_t child, int which, u_long *result) -{ - switch (which) { - case PCIB_IVAR_BUS: - *result = 0; - return 0; - } - return ENOENT; -} - -static void * -dwlpx_cvt_dense(device_t dev, vm_offset_t addr) -{ - struct dwlpx_softc *sc = DWLPX_SOFTC(dev); - - addr &= 0xffffffffUL; - return (void *) KV(addr | sc->dmem_base); - -} - -static kobj_t -dwlpx_get_bustag(device_t dev, int type) -{ - struct dwlpx_softc *sc = DWLPX_SOFTC(dev); - - switch (type) { - case SYS_RES_IOPORT: - return (kobj_t) &sc->io_space; - - case SYS_RES_MEMORY: - return (kobj_t) &sc->mem_space; - } - - return 0; -} - -static struct rman * -dwlpx_get_rman(device_t dev, int type) -{ - struct dwlpx_softc *sc = DWLPX_SOFTC(dev); - - switch (type) { - case SYS_RES_IOPORT: - return &sc->io_rman; - - case SYS_RES_MEMORY: - return &sc->mem_rman; - } - - return 0; -} - -static int -dwlpx_maxslots(device_t dev) -{ - return (DWLPX_MAXDEV); -} - -static u_int32_t -dwlpx_read_config(device_t dev, int bus, int slot, int func, - int off, int sz) -{ - struct dwlpx_softc *sc = DWLPX_SOFTC(dev); - u_int32_t *dp, data, rvp, pci_idsel, hpcdev; - unsigned long paddr; - int hose, ionode; - int secondary = 0, s = 0, i; - - rvp = data = ~0; - - ionode = ((sc->bushose >> 2) & 0x7); - hose = (sc->bushose & 0x3); - - if (sc->nhpc < 1) - return (data); - else if (sc->nhpc < 2 && slot >= 4) - return (data); - else if (sc->nhpc < 3 && slot >= 8) - return (data); - else if (slot >= DWLPX_MAXDEV) - return (data); - hpcdev = slot >> 2; - pci_idsel = (1 << ((slot & 0x3) + 2)); - paddr = (hpcdev << 22) | (pci_idsel << 16) | (func << 13); - - if (secondary) { - paddr &= 0x1fffff; - paddr |= (secondary << 21); - -#if 0 - printf("read secondary %d reg %x (paddr %lx)", - secondary, offset, tag); -#endif - - alpha_pal_draina(); - s = splhigh(); - /* - * Set up HPCs for type 1 cycles. - */ - for (i = 0; i < sc->nhpc; i++) { - rvp = REGVAL(PCIA_CTL(i)+sc->sysbase) | PCIA_CTL_T1CYC; - alpha_mb(); - REGVAL(PCIA_CTL(i) + sc->sysbase) = rvp; - alpha_mb(); - } - } - - paddr |= ((unsigned long) ((off >> 2) << 7)); - paddr |= ((sz - 1) << 3); - paddr |= DWLPX_PCI_CONF; - paddr |= ((unsigned long) hose) << 34; - paddr |= ((unsigned long) ionode) << 36; - paddr |= 1L << 39; - - dp = (u_int32_t *)KV(paddr); - -#if 0 -printf("CFGREAD %d.%d.%d.%d.%d.%d.%d -> paddr 0x%lx", -ionode+4, hose, bus, slot, func, off, sz, paddr); -#endif - - if (badaddr(dp, sizeof (*dp)) == 0) { - data = *dp; - } - - if (secondary) { - alpha_pal_draina(); - for (i = 0; i < sc->nhpc; i++) { - rvp = REGVAL(PCIA_CTL(i)+sc->sysbase) & ~PCIA_CTL_T1CYC; - alpha_mb(); - REGVAL(PCIA_CTL(i) + sc->sysbase) = rvp; - alpha_mb(); - } - (void) splx(s); - } - - if (data != ~0) { - if (sz == 1) { - rvp = SPARSE_BYTE_EXTRACT(off, data); - } else if (sz == 2) { - rvp = SPARSE_WORD_EXTRACT(off, data); - } else { - rvp = data; - } - } else { - rvp = data; - } - -#if 0 -printf(" data 0x%x -> 0x%x\n", data, rvp); -#endif - return (rvp); -} - -static void -dwlpx_write_config(device_t dev, int bus, int slot, int func, - int off, u_int32_t data, int sz) -{ - struct dwlpx_softc *sc = DWLPX_SOFTC(dev); - int hose, ionode; - int secondary = 0, s = 0, i; - u_int32_t *dp, rvp, pci_idsel, hpcdev; - unsigned long paddr; - - ionode = ((sc->bushose >> 2) & 0x7); - hose = (sc->bushose & 0x3); - - if (sc->nhpc < 1) - return; - else if (sc->nhpc < 2 && slot >= 4) - return; - else if (sc->nhpc < 3 && slot >= 8) - return; - else if (slot >= DWLPX_MAXDEV) - return; - hpcdev = slot >> 2; - pci_idsel = (1 << ((slot & 0x3) + 2)); - paddr = (hpcdev << 22) | (pci_idsel << 16) | (func << 13); - - if (secondary) { - paddr &= 0x1fffff; - paddr |= (secondary << 21); - -#if 0 - printf("write secondary %d reg %x (paddr %lx)", - secondary, offset, tag); -#endif - - alpha_pal_draina(); - s = splhigh(); - /* - * Set up HPCs for type 1 cycles. - */ - for (i = 0; i < sc->nhpc; i++) { - rvp = REGVAL(PCIA_CTL(i)+sc->sysbase) | PCIA_CTL_T1CYC; - alpha_mb(); - REGVAL(PCIA_CTL(i) + sc->sysbase) = rvp; - alpha_mb(); - } - } - - paddr |= ((unsigned long) ((off >> 2) << 7)); - paddr |= ((sz - 1) << 3); - paddr |= DWLPX_PCI_CONF; - paddr |= ((unsigned long) hose) << 34; - paddr |= ((unsigned long) ionode) << 36; - paddr |= 1L << 39; - - dp = (u_int32_t *)KV(paddr); - if (badaddr(dp, sizeof (*dp)) == 0) { - u_int32_t new_data; - if (sz == 1) { - new_data = SPARSE_BYTE_INSERT(off, data); - } else if (sz == 2) { - new_data = SPARSE_WORD_INSERT(off, data); - } else { - new_data = data; - } - -#if 0 -printf("CFGWRITE %d.%d.%d.%d.%d.%d.%d paddr 0x%lx data 0x%x -> 0x%x\n", -ionode+4, hose, bus, slot, func, off, sz, paddr, data, new_data); -#endif - - *dp = new_data; - } - if (secondary) { - alpha_pal_draina(); - for (i = 0; i < sc->nhpc; i++) { - rvp = REGVAL(PCIA_CTL(i)+sc->sysbase) & ~PCIA_CTL_T1CYC; - alpha_mb(); - REGVAL(PCIA_CTL(i) + sc->sysbase) = rvp; - alpha_mb(); - } - (void) splx(s); - } -} - -static void -dwlpx_dma_init(struct dwlpx_softc *sc) -{ - u_int32_t *tbl, sgwmask, sgwbase, sgwend; - int i, lim; - - /* - * Determine size of Window C based on the amount of SGMAP - * page table SRAM available. - */ - if (sc->sgmapsz == DWLPX_SG128K) { - lim = 128 * 1024; - sgwmask = PCIA_WMASK_1G; - sgwbase = 1UL*1024UL*1024UL*1024UL; - } else { - lim = 32 * 1024; - sgwmask = PCIA_WMASK_256M; - sgwbase = 1UL*1024UL*1024UL*1024UL+3UL*256UL*1024UL*1024UL; - } - sgwend = sgwbase + (lim * 8192) - 1; - - /* - * A few notes about SGMAP-mapped DMA on the DWLPx: - * - * The DWLPx has PCIA-resident SRAM that is used for - * the SGMAP page table; there is no TLB. The DWLPA - * has room for 32K entries, yielding a total of 256M - * of sgva space. The DWLPB has 32K entries or 128K - * entries, depending on TBIT, yielding either 256M or - * 1G of sgva space. - */ - - /* - * Initialize the page table. - */ - tbl = (u_int32_t *) ALPHA_PHYS_TO_K0SEG(PCIA_SGMAP_PT + sc->sysbase); - for (i = 0; i < lim; i++) - tbl[i] = 0; - -#if 0 - /* XXX NOT DONE YET XXX */ - /* - * Initialize the SGMAP for window C: - * - * Size: 256M or 1GB - * Window base: 1GB - * SGVA base: 0 - */ - chipset.sgmap = sgmap_map_create(sgwbase, sgwend, dwlpx_sgmap_map, tbl); -#else - chipset.sgmap = NULL; -#endif - chipset.pci_sgmap = NULL; - chipset.dmsize = 2UL * 1024UL * 1024UL * 1024UL; - chipset.dmoffset = DWLPx_DIRECT_MAPPED_BASE; - - /* - * Set up DMA windows for this DWLPx. - */ - for (i = 0; i < sc->nhpc; i++) { - REGVAL(PCIA_WMASK_A(i) + sc->sysbase) = - DWLPx_DIRECT_MAPPED_WMASK; - REGVAL(PCIA_TBASE_A(i) + sc->sysbase) = 0; - REGVAL(PCIA_WBASE_A(i) + sc->sysbase) = - DWLPx_DIRECT_MAPPED_BASE | PCIA_WBASE_W_EN; - - REGVAL(PCIA_WMASK_B(i) + sc->sysbase) = 0; - REGVAL(PCIA_TBASE_B(i) + sc->sysbase) = 0; - REGVAL(PCIA_WBASE_B(i) + sc->sysbase) = 0; - - REGVAL(PCIA_WMASK_C(i) + sc->sysbase) = sgwmask; - REGVAL(PCIA_TBASE_C(i) + sc->sysbase) = 0; - REGVAL(PCIA_WBASE_C(i) + sc->sysbase) = - sgwbase | PCIA_WBASE_W_EN | PCIA_WBASE_SG_EN; - } - alpha_mb(); -} - -/* - */ - -static void -dwlpx_intr(void *arg) -{ - unsigned long vec = (unsigned long) arg; - if ((vec & DWLPX_VEC_EMARK) != 0) { - dwlpx_eintr(vec); - return; - } - if ((vec & DWLPX_VEC_MARK) == 0) { - panic("dwlpx_intr: bad vector %p", arg); - /* NOTREACHED */ - } - alpha_dispatch_intr(NULL, vec); -} - -static void -dwlpx_eintr(unsigned long vec) -{ - device_t dev; - struct dwlpx_softc *sc; - int ionode, hosenum, i; - struct { - u_int32_t err; - u_int32_t addr; - } hpcs[NHPC]; - - ionode = (vec >> 8) & 0xf; - hosenum = (vec >> 4) & 0x7; - if (ionode >= DWLPX_NIONODE || hosenum >= DWLPX_NHOSE) { - panic("dwlpx_iointr: mangled vector 0x%lx", vec); - /* NOTREACHED */ - } - dev = dwlpxs[ionode][hosenum]; - sc = DWLPX_SOFTC(dev); - for (i = 0; i < sc->nhpc; i++) { - hpcs[i].err = REGVAL(PCIA_ERR(i) + sc->sysbase); - hpcs[i].addr = REGVAL(PCIA_FADR(i) + sc->sysbase); - } - printf("%s: node %d hose %d error interrupt\n", - device_get_nameunit(dev), ionode + 4, hosenum); - - for (i = 0; i < sc->nhpc; i++) { - if ((hpcs[i].err & PCIA_ERR_ERROR) == 0) - continue; - printf("\tHPC %d: ERR=0x%08x; DMA %s Memory, " - "Failing Address 0x%x\n", - i, hpcs[i].err, hpcs[i].addr & 0x1? "write to" : - "read from", hpcs[i].addr & ~3); - if (hpcs[i].err & PCIA_ERR_SERR_L) - printf("\t PCI device asserted SERR_L\n"); - if (hpcs[i].err & PCIA_ERR_ILAT) - printf("\t Incremental Latency Exceeded\n"); - if (hpcs[i].err & PCIA_ERR_SGPRTY) - printf("\t CPU access of SG RAM Parity Error\n"); - if (hpcs[i].err & PCIA_ERR_ILLCSR) - printf("\t Illegal CSR Address Error\n"); - if (hpcs[i].err & PCIA_ERR_PCINXM) - printf("\t Nonexistent PCI Address Error\n"); - if (hpcs[i].err & PCIA_ERR_DSCERR) - printf("\t PCI Target Disconnect Error\n"); - if (hpcs[i].err & PCIA_ERR_ABRT) - printf("\t PCI Target Abort Error\n"); - if (hpcs[i].err & PCIA_ERR_WPRTY) - printf("\t PCI Write Parity Error\n"); - if (hpcs[i].err & PCIA_ERR_DPERR) - printf("\t PCI Data Parity Error\n"); - if (hpcs[i].err & PCIA_ERR_APERR) - printf("\t PCI Address Parity Error\n"); - if (hpcs[i].err & PCIA_ERR_DFLT) - printf("\t SG Map RAM Invalid Entry Error\n"); - if (hpcs[i].err & PCIA_ERR_DPRTY) - printf("\t DMA access of SG RAM Parity Error\n"); - if (hpcs[i].err & PCIA_ERR_DRPERR) - printf("\t DMA Read Return Parity Error\n"); - if (hpcs[i].err & PCIA_ERR_MABRT) - printf("\t PCI Master Abort Error\n"); - if (hpcs[i].err & PCIA_ERR_CPRTY) - printf("\t CSR Parity Error\n"); - if (hpcs[i].err & PCIA_ERR_COVR) - printf("\t CSR Overrun Error\n"); - if (hpcs[i].err & PCIA_ERR_MBPERR) - printf("\t Mailbox Parity Error\n"); - if (hpcs[i].err & PCIA_ERR_MBILI) - printf("\t Mailbox Illegal Length Error\n"); - REGVAL(PCIA_ERR(i) + sc->sysbase) = hpcs[i].err; - } -} - -static device_method_t dwlpx_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, dwlpx_probe), - DEVMETHOD(device_attach, dwlpx_attach), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, dwlpx_read_ivar), - DEVMETHOD(bus_setup_intr, dwlpx_setup_intr), - DEVMETHOD(bus_teardown_intr, dwlpx_teardown_intr), - DEVMETHOD(bus_alloc_resource, alpha_pci_alloc_resource), - DEVMETHOD(bus_release_resource, pci_release_resource), - DEVMETHOD(bus_activate_resource, pci_activate_resource), - DEVMETHOD(bus_deactivate_resource, pci_deactivate_resource), - - /* alphapci interface */ - DEVMETHOD(alphapci_cvt_dense, dwlpx_cvt_dense), - DEVMETHOD(alphapci_get_bustag, dwlpx_get_bustag), - DEVMETHOD(alphapci_get_rman, dwlpx_get_rman), - - /* pcib interface */ - DEVMETHOD(pcib_maxslots, dwlpx_maxslots), - DEVMETHOD(pcib_read_config, dwlpx_read_config), - DEVMETHOD(pcib_write_config, dwlpx_write_config), - DEVMETHOD(pcib_route_interrupt, alpha_pci_route_interrupt), - - { 0, 0 } -}; - -static driver_t dwlpx_driver = { - "pcib", dwlpx_methods, sizeof (struct dwlpx_softc) -}; - -DRIVER_MODULE(pcib, kft, dwlpx_driver, dwlpx_devclass, 0, 0); diff --git a/sys/alpha/tlsb/dwlpxreg.h b/sys/alpha/tlsb/dwlpxreg.h deleted file mode 100644 index 826af32..0000000 --- a/sys/alpha/tlsb/dwlpxreg.h +++ /dev/null @@ -1,236 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: dwlpxreg.h,v 1.9 1998/03/21 22:02:42 mjacob Exp $ */ - -/*- - * Copyright (c) 1997, 2000 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * Taken from combinations of: - * - * ``DWLPA and DWLPB PCI Adapter Technical Manual, - * Order Number: EK-DWLPX-TM.A01'' - * - * and - * - * ``AlphaServer 8200/8400 System Technical Manual, - * Order Number EK-T8030-TM. A01'' - */ - -#define REGVAL(r) (*(volatile int32_t *)ALPHA_PHYS_TO_K0SEG(r)) - -/* - * There are (potentially) 4 I/O hoses, and there are three - * (electrically distinct) PCI busses per DWLPX (which appear - * as one logical PCI bus). - * - * A CPU to PCI Address Mapping looks (roughly) like this: - * - * 39 38........36 35.34 33.....32 31....................5 4.........3 2...0 - * -------------------------------------------------------------------------- - * |1| I/O NodeID |Hose#|PCI Space|Byte Aligned I/O <26:0>|Byte Length|0 0 0| - * -------------------------------------------------------------------------- - * - * I/O Node is the TLSB Node ID minus 4. Don't ask. - */ - -#define NHPC 3 - -/* - * Address Space Cookies - * - * (lacking I/O Node ID and Hose Numbers) - */ - -#define DWLPX_PCI_DENSE 0x000000000LL -#define DWLPX_PCI_SPARSE 0x100000000LL -#define DWLPX_PCI_IOSPACE 0x200000000LL -#define DWLPX_PCI_CONF 0x300000000LL - -/* - * PCIA Interface Adapter Register Addresses (Offsets from Node Address) - * - * - * Addresses are for Hose #0, PCI bus #0. Macros below will offset - * per bus. I/O Hose and TLSB Node I/D offsets must be added separately. - */ - -#define _PCIA_CTL 0x380000000LL /* PCI 0 Bus Control */ -#define _PCIA_MRETRY 0x380000080LL /* PCI 0 Master Retry Limit */ -#define _PCIA_GPR 0x380000100LL /* PCI 0 General Purpose */ -#define _PCIA_ERR 0x380000180LL /* PCI 0 Error Summary */ -#define _PCIA_FADR 0x380000200LL /* PCI 0 Failing Address */ -#define _PCIA_IMASK 0x380000280LL /* PCI 0 Interrupt Mask */ -#define _PCIA_DIAG 0x380000300LL /* PCI 0 Diagnostic */ -#define _PCIA_IPEND 0x380000380LL /* PCI 0 Interrupt Pending */ -#define _PCIA_IPROG 0x380000400LL /* PCI 0 Interrupt in Progress */ -#define _PCIA_WMASK_A 0x380000480LL /* PCI 0 Window Mask A */ -#define _PCIA_WBASE_A 0x380000500LL /* PCI 0 Window Base A */ -#define _PCIA_TBASE_A 0x380000580LL /* PCI 0 Window Translated Base A */ -#define _PCIA_WMASK_B 0x380000600LL /* PCI 0 Window Mask B */ -#define _PCIA_WBASE_B 0x380000680LL /* PCI 0 Window Base B */ -#define _PCIA_TBASE_B 0x380000700LL /* PCI 0 Window Translated Base B */ -#define _PCIA_WMASK_C 0x380000780LL /* PCI 0 Window Mask C */ -#define _PCIA_WBASE_C 0x380000800LL /* PCI 0 Window Base C */ -#define _PCIA_TBASE_C 0x380000880LL /* PCI 0 Window Translated Base C */ -#define _PCIA_ERRVEC 0x380000900LL /* PCI 0 Error Interrupt Vector */ -#define _PCIA_DEVVEC 0x380001000LL /* PCI 0 Device Interrupt Vector */ - - -#define PCIA_CTL(hpc) (_PCIA_CTL + (0x200000 * (hpc))) -#define PCIA_MRETRY(hpc) (_PCIA_MRETRY + (0x200000 * (hpc))) -#define PCIA_GPR(hpc) (_PCIA_GPR + (0x200000 * (hpc))) -#define PCIA_ERR(hpc) (_PCIA_ERR + (0x200000 * (hpc))) -#define PCIA_FADR(hpc) (_PCIA_FADR + (0x200000 * (hpc))) -#define PCIA_IMASK(hpc) (_PCIA_IMASK + (0x200000 * (hpc))) -#define PCIA_DIAG(hpc) (_PCIA_DIAG + (0x200000 * (hpc))) -#define PCIA_IPEND(hpc) (_PCIA_IPEND + (0x200000 * (hpc))) -#define PCIA_IPROG(hpc) (_PCIA_IPROG + (0x200000 * (hpc))) -#define PCIA_WMASK_A(hpc) (_PCIA_WMASK_A + (0x200000 * (hpc))) -#define PCIA_WBASE_A(hpc) (_PCIA_WBASE_A + (0x200000 * (hpc))) -#define PCIA_TBASE_A(hpc) (_PCIA_TBASE_A + (0x200000 * (hpc))) -#define PCIA_WMASK_B(hpc) (_PCIA_WMASK_B + (0x200000 * (hpc))) -#define PCIA_WBASE_B(hpc) (_PCIA_WBASE_B + (0x200000 * (hpc))) -#define PCIA_TBASE_B(hpc) (_PCIA_TBASE_B + (0x200000 * (hpc))) -#define PCIA_WMASK_C(hpc) (_PCIA_WMASK_C + (0x200000 * (hpc))) -#define PCIA_WBASE_C(hpc) (_PCIA_WBASE_C + (0x200000 * (hpc))) -#define PCIA_TBASE_C(hpc) (_PCIA_TBASE_C + (0x200000 * (hpc))) -#define PCIA_ERRVEC(hpc) (_PCIA_ERRVEC + (0x200000 * (hpc))) - -#define PCIA_DEVVEC(hpc, subslot, ipin) \ - (_PCIA_DEVVEC + (0x200000 * (hpc)) + ((subslot) * 0x200) + ((ipin-1) * 0x80)) - -#define PCIA_SCYCLE 0x380002000LL /* PCI Special Cycle */ -#define PCIA_IACK 0x380002080LL /* PCI Interrupt Acknowledge */ - -#define PCIA_PRESENT 0x380800000LL /* PCI Slot Present */ -#define PCIA_TBIT 0x380A00000LL /* PCI TBIT */ -#define PCIA_MCTL 0x380C00000LL /* PCI Module Control */ -#define PCIA_IBR 0x380E00000LL /* PCI Information Base Repair */ - -/* - * Bits in PCIA_CTL register - */ -#define PCIA_CTL_SG32K (0<<25) /* 32K SGMAP entries */ -#define PCIA_CTL_SG64K (1<<25) /* 64K SGMAP entries */ -#define PCIA_CTL_SG128K (3<<25) /* 128K SGMAP entries */ -#define PCIA_CTL_SG0K (2<<25) /* disable SGMAP in HPC */ -#define PCIA_CTL_4UP (0<<23) /* 4 Up Hose buffers */ -#define PCIA_CTL_1UP (1<<23) /* 1 "" */ -#define PCIA_CTL_2UP (2<<23) /* 2 "" */ -#define PCIA_CTL_3UP (3<<23) /* 3 "" (normal) */ -#define PCIA_CTL_RMM4X (1<<22) /* Read Multiple 2X -> 4X */ -#define PCIA_CTL_RMMENA (1<<21) /* Read Multiple Enable */ -#define PCIA_CTL_RMMARB (1<<20) /* RMM Multiple Arb */ -#define PCIA_CTL_HAEDIS (1<<19) /* Hardware Address Ext. Disable */ -#define PCIA_CTL_MHAE(x) ((x&0x1f)<<14) /* Memory Hardware Address Extension */ -#define PCIA_CTL_IHAE(x) ((x&0x1f)<<9) /* I/O Hardware Address Extension */ -#define PCIA_CTL_CUTENA (1<<8) /* PCI Cut Through */ -#define PCIA_CTL_CUT(x) ((x&0x7)<<4) /* PCI Cut Through Size */ -#define PCIA_CTL_PRESET (1<<3) /* PCI Reset */ -#define PCIA_CTL_DTHROT (1<<2) /* DMA downthrottle */ -#define PCIA_CTL_T1CYC (1<<0) /* Type 1 Configuration Cycle */ - -/* - * Bits in PCIA_ERR. All are "Write 1 to clear". - */ -#define PCIA_ERR_SERR_L (1<<18) /* PCI device asserted SERR_L */ -#define PCIA_ERR_ILAT (1<<17) /* Incremental Latency Exceeded */ -#define PCIA_ERR_SGPRTY (1<<16) /* CPU access of SG RAM Parity Error */ -#define PCIA_ERR_ILLCSR (1<<15) /* Illegal CSR Address Error */ -#define PCIA_ERR_PCINXM (1<<14) /* Nonexistent PCI Address Error */ -#define PCIA_ERR_DSCERR (1<<13) /* PCI Target Disconnect Error */ -#define PCIA_ERR_ABRT (1<<12) /* PCI Target Abort Error */ -#define PCIA_ERR_WPRTY (1<<11) /* PCI Write Parity Error */ -#define PCIA_ERR_DPERR (1<<10) /* PCI Data Parity Error */ -#define PCIA_ERR_APERR (1<<9) /* PCI Address Parity Error */ -#define PCIA_ERR_DFLT (1<<8) /* SG Map RAM Invalid Entry Error */ -#define PCIA_ERR_DPRTY (1<<7) /* DMA access of SG RAM Parity Error */ -#define PCIA_ERR_DRPERR (1<<6) /* DMA Read Return Parity Error */ -#define PCIA_ERR_MABRT (1<<5) /* PCI Master Abort Error */ -#define PCIA_ERR_CPRTY (1<<4) /* CSR Parity Error */ -#define PCIA_ERR_COVR (1<<3) /* CSR Overrun Error */ -#define PCIA_ERR_MBPERR (1<<2) /* Mailbox Parity Error */ -#define PCIA_ERR_MBILI (1<<1) /* Mailbox Illegal Length Error */ -#define PCIA_ERR_ERROR (1<<0) /* Summary Error */ -#define PCIA_ERR_ALLERR ((1<<19) - 1) - -/* - * Bits in PCIA_PRESENT. - */ -#define PCIA_PRESENT_REVSHIFT 25 /* shift by this to get revision */ -#define PCIA_PRESENT_REVMASK 0xf -#define PCIA_PRESENT_STDIO 0x01000000 /* STD I/O bridge present */ -#define PCIA_PRESENT_SLOTSHIFT(hpc, slot) \ - (((hpc) << 3) + ((slot) << 1)) -#define PCIA_PRESENT_SLOT_MASK 0x3 -#define PCIA_PRESENT_SLOT_NONE 0x0 -#define PCIA_PRESENT_SLOT_25W 0x1 -#define PCIA_PRESENT_SLOT_15W 0x2 -#define PCIA_PRESENT_SLOW_7W 0x3 - -/* - * Location of the DWLPx SGMAP page table SRAM. - */ -#define PCIA_SGMAP_PT 0x381000000UL - -/* - * Values for PCIA_WMASK_x - */ -#define PCIA_WMASK_MASK 0xffff0000 /* mask of valid bits */ -#define PCIA_WMASK_64K 0x00000000 -#define PCIA_WMASK_128K 0x00010000 -#define PCIA_WMASK_256K 0x00030000 -#define PCIA_WMASK_512K 0x00070000 -#define PCIA_WMASK_1M 0x000f0000 -#define PCIA_WMASK_2M 0x001f0000 -#define PCIA_WMASK_4M 0x003f0000 -#define PCIA_WMASK_8M 0x007f0000 -#define PCIA_WMASK_16M 0x00ff0000 -#define PCIA_WMASK_32M 0x01ff0000 -#define PCIA_WMASK_64M 0x03ff0000 -#define PCIA_WMASK_128M 0x07ff0000 -#define PCIA_WMASK_256M 0x0fff0000 -#define PCIA_WMASK_512M 0x1fff0000 -#define PCIA_WMASK_1G 0x3fff0000 -#define PCIA_WMASK_2G 0x7fff0000 -#define PCIA_WMASK_4G 0xffff0000 - -/* - * Values for PCIA_WBASE_x - */ -#define PCIA_WBASE_MASK 0xffff0000 /* mask of valid bits in address */ -#define PCIA_WBASE_W_EN 0x00000002 /* window enable */ -#define PCIA_WBASE_SG_EN 0x00000001 /* SGMAP enable */ - -/* - * Values for PCIA_TBASE_x - * - * NOTE: Translated Base is only used on direct-mapped DMA on the DWLPx!! - */ -#define PCIA_TBASE_MASK 0x00fffffe -#define PCIA_TBASE_SHIFT 15 diff --git a/sys/alpha/tlsb/dwlpxvar.h b/sys/alpha/tlsb/dwlpxvar.h deleted file mode 100644 index 7d880b1..0000000 --- a/sys/alpha/tlsb/dwlpxvar.h +++ /dev/null @@ -1,92 +0,0 @@ -/* $FreeBSD$ */ -/*- - * Copyright (c) 2000 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - - -#define DWLPX_NONE 0 -#define DWLPX_SG32K 1 -#define DWLPX_SG64K 2 -#define DWLPX_SG128K 3 - -/* - * Each DWLPX supports up to 15 devices, 12 of which are PCI slots. - * - * Since the STD I/O modules in slots 12-14 are really a PCI-EISA - * bridge, we'll punt on those for the moment. - */ -#define DWLPX_MAXDEV 12 - -/* - * There are 5 possible slots that can have I/O boards, and for each - * one there are 4 possible hoses. To cover them all, we'd have to - * reserve 5 bits of selector out our current 32 bit cookie we use - * for primary PCI address spaces. It turns out that we *just* have - * enough bits for this (see drawing in dwlpxreg.h) - */ - -#define DWLPX_NIONODE 5 -#define DWLPX_NHOSE 4 - -/* - * Interrupt Cookie for DWLPX vectors. - * - * Bits 0..3 PCI Slot (0..11) - * Bits 4..7 I/O Hose (0..3) - * Bits 8..11 I/O Node (0..4) - * Bit 15 Constant 1 - */ -#define DWLPX_VEC_MARK (1<<15) -#define DWLPX_MVEC(ionode, hose, pcislot) \ - (DWLPX_VEC_MARK | (ionode << 8) | (hose << 4) | (pcislot)) - -#define DWLPX_MVEC_IONODE(cookie) \ - ((((u_int64_t)(cookie)) >> 8) & 0xf) -#define DWLPX_MVEC_HOSE(cookie) \ - ((((u_int64_t)(cookie)) >> 4) & 0xf) -#define DWLPX_MVEC_PCISLOT(cookie) \ - (((u_int64_t)(cookie)) & 0xf) - -/* - * DWLPX Error Interrupt - */ -#define DWLPX_VEC_EMARK (1<<14) -#define DWLPX_ERRVEC(ionode, hose) \ - (DWLPX_VEC_EMARK | (ionode << 8) | (hose << 4)) - -/* - * Default values to put into DWLPX IMASK register(s) - */ -#define DWLPX_IMASK_DFLT \ - (1 << 24) | /* IPL 17 for error interrupts */ \ - (1 << 17) | /* IPL 14 for device interrupts */ \ - (1 << 16) /* Enable Error Interrupts */ - -#define DWLPX_BASE(node, hose) \ - ((((unsigned long)(node - 4)) << 36) | \ - (((unsigned long)(hose)) << 34) | \ - (1LL << 39)) diff --git a/sys/alpha/tlsb/gbus.c b/sys/alpha/tlsb/gbus.c deleted file mode 100644 index 092423b..0000000 --- a/sys/alpha/tlsb/gbus.c +++ /dev/null @@ -1,156 +0,0 @@ -/* $NetBSD: gbus.c,v 1.8 1998/05/13 22:13:35 thorpej Exp $ */ -/*- - * Copyright (c) 1997, 2000 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * Autoconfiguration and support routines for the Gbus: the internal - * bus on AlphaServer CPU modules. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> - -#include <machine/rpb.h> -#include <machine/pte.h> - -#include <alpha/tlsb/gbusreg.h> -#include <alpha/tlsb/gbusvar.h> - -#include <alpha/tlsb/tlsbreg.h> -#include <alpha/tlsb/tlsbvar.h> - -extern int cputype; - -#define KV(_addr) ((caddr_t)ALPHA_PHYS_TO_K0SEG((_addr))) - -/* - * The structure used to attach devices to the Gbus. - */ -struct gbus_device { - const char* gd_name; - int gd_offset; -}; - -#define DEVTOGBUS(dev) ((struct gbus_device*) device_get_ivars(dev)) - -struct gbus_device gbus_children[] = { - { "zsc", GBUS_DUART0_OFFSET }, - { "mcclock", GBUS_CLOCK_OFFSET }, - { NULL, 0 }, -}; - -static devclass_t gbus_devclass; - -/* - * Device methods - */ -static int gbus_probe(device_t); -static int gbus_print_child(device_t, device_t); -static int gbus_read_ivar(device_t, device_t, int, u_long *); - -static device_method_t gbus_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, gbus_probe), - DEVMETHOD(device_attach, bus_generic_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - - /* Bus interface */ - DEVMETHOD(bus_print_child, gbus_print_child), - DEVMETHOD(bus_read_ivar, gbus_read_ivar), - DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - { 0, 0 } -}; - -static driver_t gbus_driver = { - "gbus", gbus_methods, 1 -}; - -/* - * At 'probe' time, we add all the devices which we know about to the - * bus. The generic attach routine will probe and attach them if they - * are alive. - */ -static int -gbus_probe(device_t dev) -{ - device_t child; - struct gbus_device *gdev; - - /* - * Make sure we're looking for a Gbus. - * A Gbus can only be a child of a TLSB CPU Node. - */ - if (!TLDEV_ISCPU(tlsb_get_dtype(device_get_parent(dev)))) { - return ENXIO; - } - - for (gdev = gbus_children; gdev->gd_name; gdev++) { - child = device_add_child(dev, gdev->gd_name, -1); - device_set_ivars(child, gdev); - } - - return (0); -} - -static int -gbus_print_child(device_t bus, device_t dev) -{ - struct gbus_device* gdev = DEVTOGBUS(dev); - int retval = 0; - - retval += bus_print_child_header(bus, dev); - retval += printf(" on %s offset 0x%x\n", device_get_nameunit(bus), - gdev->gd_offset); - - return (retval); -} - -static int -gbus_read_ivar(device_t bus, device_t dev, - int index, u_long* result) -{ - struct gbus_device* gdev = DEVTOGBUS(dev); - - switch (index) { - case GBUS_IVAR_OFFSET: - *result = gdev->gd_offset; - break; - } - return ENOENT; -} -DRIVER_MODULE(gbus, tlsbcpu, gbus_driver, gbus_devclass, 0, 0); diff --git a/sys/alpha/tlsb/gbusreg.h b/sys/alpha/tlsb/gbusreg.h deleted file mode 100644 index 3402185..0000000 --- a/sys/alpha/tlsb/gbusreg.h +++ /dev/null @@ -1,47 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: gbusreg.h,v 1.1 1998/05/13 02:50:29 thorpej Exp $ */ - -/*- - * Copyright (c) 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. - */ - -/* - * Register definitions for the Gbus found on TurboLaser CPU modules. - */ - -#define GBUS_DUART0_OFFSET 0x10000000 /* duart 0 */ -#define GBUS_DUART1_OFFSET 0x11000000 /* duart 1 */ -#define GBUS_CLOCK_OFFSET 0x20000000 /* clock */ diff --git a/sys/alpha/tlsb/gbusvar.h b/sys/alpha/tlsb/gbusvar.h deleted file mode 100644 index cc0bd8e..0000000 --- a/sys/alpha/tlsb/gbusvar.h +++ /dev/null @@ -1,89 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ -/* $NetBSD: gbusvar.h,v 1.1 1998/05/13 02:50:29 thorpej Exp $ */ - -/*- - * Copyright (c) 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. - */ - -/* - * Autoconfiguration definitions for the Gbus found on TurboLaser CPU modules. - */ - -enum gbus_device_ivars { - GBUS_IVAR_OFFSET /* offset from Gbus base */ -}; - -/* - * Simplified accessors for gbus devices - */ - -#define GBUS_ACCESSOR(A, B, T) \ - \ -static __inline T gbus_get_ ## A(device_t dev) \ -{ \ - u_long v; \ - BUS_READ_IVAR(device_get_parent(dev), dev, GBUS_IVAR_ ## B, &v); \ - return (T) v; \ -} - -GBUS_ACCESSOR(offset, OFFSET, u_int32_t) - diff --git a/sys/alpha/tlsb/kftxx.c b/sys/alpha/tlsb/kftxx.c deleted file mode 100644 index f0714e3..0000000 --- a/sys/alpha/tlsb/kftxx.c +++ /dev/null @@ -1,199 +0,0 @@ -/* $NetBSD: kftxx.c,v 1.9 1998/05/14 00:01:32 thorpej Exp $ */ -/*- - * Copyright (c) 1997, 2000 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * KFTIA and KFTHA Bus Adapter Node for I/O hoses - * found on AlphaServer 8200 and 8400 systems. - * - * i.e., handler for all TLSB I/O nodes. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/malloc.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> - -#include <machine/rpb.h> - -#include <alpha/tlsb/tlsbreg.h> -#include <alpha/tlsb/tlsbvar.h> -#include <alpha/tlsb/kftxxreg.h> -#include <alpha/tlsb/kftxxvar.h> - -struct kft_softc { - int sc_node; /* TLSB node */ - u_int16_t sc_dtype; /* device type */ -}; - -/* - * Instance variables for kft devices. - */ -struct kft_device { - char * kd_name; /* name */ - int kd_node; /* node number */ - u_int16_t kd_dtype; /* device type */ - u_int16_t kd_hosenum; /* hose number */ -}; - -#define KV(_addr) ((caddr_t)ALPHA_PHYS_TO_K0SEG((_addr))) - -static devclass_t kft_devclass; - -/* - * Device methods - */ -static int kft_probe(device_t); -static int kft_print_child(device_t, device_t); -static int kft_read_ivar(device_t, device_t, int, u_long *); - -static device_method_t kft_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, kft_probe), - DEVMETHOD(device_attach, bus_generic_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - - /* Bus interface */ - DEVMETHOD(bus_print_child, kft_print_child), - DEVMETHOD(bus_read_ivar, kft_read_ivar), - DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - { 0, 0 } -}; - -static driver_t kft_driver = { - "kft", - kft_methods, - 1, /* no softc */ -}; - -static int -kft_probe(device_t dev) -{ - static int dun; - device_t cd; - struct kft_softc *sc = (struct kft_softc *) device_get_softc(dev); - struct kft_device *kd; - int hose; - - if (!TLDEV_ISIOPORT(tlsb_get_dtype(dev))) - return ENXIO; - - sc->sc_node = tlsb_get_node(dev); - sc->sc_dtype = tlsb_get_dtype(dev); - - for (hose = 0; hose < MAXHOSE; hose++) { - u_int32_t value = - TLSB_GET_NODEREG(sc->sc_node, KFT_IDPNSEX(hose)); - if (value & 0x0E000000) { - printf("%s: Hose %d IDPNSE has %x\n", - device_get_nameunit(dev), - hose, value); - continue; - } - if ((value & 0x1) != 0x0) { - printf("%s: Hose %d has a Bad Cable (0x%x)\n", - device_get_nameunit(dev), - hose, value); - continue; - } - if ((value & 0x6) != 0x6) { - if (value) - printf("%s: Hose %d is missing PWROK (0x%x)\n", - device_get_nameunit(dev), - hose, value); - continue; - } - - kd = (struct kft_device *) - malloc(sizeof(struct kft_device), M_DEVBUF, M_NOWAIT); - - if (kd == NULL) - continue; - - kd->kd_name = "pcib"; - kd->kd_node = sc->sc_node; - kd->kd_dtype = sc->sc_dtype; - kd->kd_hosenum = hose; - cd = device_add_child_ordered(dev, hose, kd->kd_name, dun++); - device_set_ivars(cd, kd); - } - - return 0; -} - -static int -kft_print_child(device_t bus, device_t dev) -{ - struct kft_device *kd = (struct kft_device*) device_get_ivars(dev); - int retval = 0; - - retval += bus_print_child_header(bus, dev); - retval += printf(" on %s hose %d\n", device_get_nameunit(bus), - kd->kd_hosenum); - - return (retval); -} - -static int -kft_read_ivar(device_t bus, device_t dev, - int index, u_long* result) -{ - struct kft_device *kd = (struct kft_device*) device_get_ivars(dev); - - switch (index) { - case KFT_IVAR_NAME: - *result = (u_long) kd->kd_name; - return 0; - - case KFT_IVAR_NODE: - *result = (u_long) kd->kd_node; - return 0; - - case KFT_IVAR_DTYPE: - *result = (u_long) kd->kd_dtype; - return 0; - - case KFT_IVAR_HOSENUM: - *result = (u_long) kd->kd_hosenum; - return 0; - - default: - return ENOENT; - } -} - -DRIVER_MODULE(kft, tlsb, kft_driver, kft_devclass, 0, 0); diff --git a/sys/alpha/tlsb/kftxxreg.h b/sys/alpha/tlsb/kftxxreg.h deleted file mode 100644 index d4431d2..0000000 --- a/sys/alpha/tlsb/kftxxreg.h +++ /dev/null @@ -1,77 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: kftxxreg.h,v 1.5 1998/07/08 00:45:08 mjacob Exp $ */ - -/*- - * Copyright (c) 1997, 2000 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * Registers and values specific to KFTIA or KFTHA nodes. - */ - -/* - * Taken from combinations of: - * - * ``DWLPA and DWLPB PCI Adapter Technical Manual, - * Order Number: EK-DWLPX-TM.A01'' - * - * and - * - * ``AlphaServer 8200/8400 System Technical Manual, - * Order Number EK-T8030-TM. A01'' - */ - -#define REGVAL(r) (*(volatile int32_t *)ALPHA_PHYS_TO_K0SEG(r)) - -/* - * There are (potentially) 4 I/O hoses per I/O node. - * - * A CPU to Hose Address Mapping looks (roughly) like this: - * - * 39 38........36 35.34 33.................0 - * ------------------------------------------- - * |1|TLSB NodeID |Hose#|Hose Module Specific| - * ------------------------------------------- - * - */ - -#define HOSE_SIZE 0x400000000L - -#define MAXHOSE 4 -/* - * Hose Specific I/O registers (offsets from base of I/O Board) - */ - -#define KFT_IDPNSEX(hose) ((hose)? (0x2040 + (0x100 * (hose))) : 0x2A40) - -#define KFT_ICCNSE 0x2040 -#define KFT_ICCWTR 0x2100 -#define KFT_IDPMSR 0x2B80 -#define KFT_IDPNSE0 0x2A40 -#define KFT_IDPNSE1 0x2140 -#define KFT_IDPNSE2 0x2240 -#define KFT_IDPNSE3 0x2340 diff --git a/sys/alpha/tlsb/kftxxvar.h b/sys/alpha/tlsb/kftxxvar.h deleted file mode 100644 index 2bdb248..0000000 --- a/sys/alpha/tlsb/kftxxvar.h +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -/* - * Instance vars for children of a KFTIA or KFTHA node. - */ -enum kft_dev_ivars { - KFT_IVAR_NAME, - KFT_IVAR_NODE, - KFT_IVAR_DTYPE, - KFT_IVAR_HOSENUM -}; - -/* - * Simplified accessors for kft devices - */ - -#define KFT_ACCESSOR(A, B, T) \ - \ -static __inline T kft_get_ ## A(device_t dev) \ -{ \ - u_long v; \ - BUS_READ_IVAR(device_get_parent(dev), dev, KFT_IVAR_ ## B, &v); \ - return (T) v; \ -} - -KFT_ACCESSOR(name, NAME, const char*) -KFT_ACCESSOR(node, NODE, int) -KFT_ACCESSOR(dtype, DTYPE, u_int16_t) -KFT_ACCESSOR(hosenum, HOSENUM, u_int16_t) diff --git a/sys/alpha/tlsb/mcclock_tlsb.c b/sys/alpha/tlsb/mcclock_tlsb.c deleted file mode 100644 index bbbaa29..0000000 --- a/sys/alpha/tlsb/mcclock_tlsb.c +++ /dev/null @@ -1,125 +0,0 @@ -/* $NetBSD: mcclock_tlsb.c,v 1.8 1998/05/13 02:50:29 thorpej Exp $ */ -/*- - * Copyright (c) 1997, 2000 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/module.h> -#include <sys/bus.h> - -#include <machine/clockvar.h> -#include <dev/dec/mcclockvar.h> - -#include <alpha/tlsb/gbusvar.h> - -#include <alpha/tlsb/tlsbreg.h> /* XXX */ - -#include <dev/dec/mc146818reg.h> - -#define KV(_addr) ((caddr_t)ALPHA_PHYS_TO_K0SEG((_addr))) -/* - * Registers are 64 bytes apart (and 1 byte wide) - */ -#define REGSHIFT 6 - -struct mcclock_tlsb_softc { - unsigned long regbase; -}; - -static int mcclock_tlsb_probe(device_t dev); -static int mcclock_tlsb_attach(device_t dev); -static void mcclock_tlsb_write(device_t, u_int, u_int); -static u_int mcclock_tlsb_read(device_t, u_int); - -static device_method_t mcclock_tlsb_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, mcclock_tlsb_probe), - DEVMETHOD(device_attach, mcclock_tlsb_attach), - - /* mcclock interface */ - DEVMETHOD(mcclock_write, mcclock_tlsb_write), - DEVMETHOD(mcclock_read, mcclock_tlsb_read), - - /* clock interface */ - DEVMETHOD(clock_init, mcclock_init), - DEVMETHOD(clock_get, mcclock_get), - DEVMETHOD(clock_set, mcclock_set), - DEVMETHOD(clock_getsecs, mcclock_getsecs), - - { 0, 0 } -}; - -static driver_t mcclock_tlsb_driver = { - "mcclock", mcclock_tlsb_methods, sizeof(struct mcclock_tlsb_softc), -}; - -static devclass_t mcclock_devclass; - -int -mcclock_tlsb_probe(device_t dev) -{ - device_set_desc(dev, "MC146818A real time clock"); - return 0; -} - -int -mcclock_tlsb_attach(device_t dev) -{ - struct mcclock_tlsb_softc *sc = device_get_softc(dev); - - /* XXX Should be bus.h'd, so we can accomodate the kn7aa. */ - - sc->regbase = TLSB_GBUS_BASE + gbus_get_offset(dev); - - mcclock_attach(dev); - return 0; -} - -static void -mcclock_tlsb_write(device_t dev, u_int reg, u_int val) -{ - struct mcclock_tlsb_softc *sc = device_get_softc(dev); - unsigned char *ptr = (unsigned char *) - KV(sc->regbase + (reg << REGSHIFT)); - *ptr = val; -} - -static u_int -mcclock_tlsb_read(device_t dev, u_int reg) -{ - struct mcclock_tlsb_softc *sc = device_get_softc(dev); - unsigned char *ptr = (unsigned char *) - KV(sc->regbase + (reg << REGSHIFT)); - return *ptr; -} - -DRIVER_MODULE(mcclock, gbus, mcclock_tlsb_driver, mcclock_devclass, 0, 0); diff --git a/sys/alpha/tlsb/tlsb.c b/sys/alpha/tlsb/tlsb.c deleted file mode 100644 index 34b6686..0000000 --- a/sys/alpha/tlsb/tlsb.c +++ /dev/null @@ -1,323 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 by Matthew Jacob - * NASA AMES Research Center. - * All rights reserved. - * - * Based in part upon a prototype version by Jason Thorpe - * Copyright (c) 1996 by Jason Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * Autoconfiguration and support routines for the TurboLaser System Bus - * found on AlphaServer 8200 and 8400 systems. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/malloc.h> - -#include <machine/cpuconf.h> -#include <machine/md_var.h> -#include <machine/rpb.h> - -#include <alpha/tlsb/tlsbreg.h> -#include <alpha/tlsb/tlsbvar.h> - -struct tlsb_device *tlsb_primary_cpu = NULL; - -#define KV(_addr) ((caddr_t)ALPHA_PHYS_TO_K0SEG((_addr))) - -struct tlsb_softc { - driver_intr_t * zsc_intr; - void * zsc_arg; - driver_intr_t * sub_intr; - device_t tlsb_dev; - int tlsb_map; -}; - -static void tlsb_add_child(struct tlsb_softc *, struct tlsb_device *); -static char *tlsb_node_type_str(u_int32_t); -static void tlsb_intr(void *, u_long); - -static struct tlsb_softc * tlsb0_softc = NULL; -static devclass_t tlsb_devclass; - -/* - * Device methods - */ -static int tlsb_probe(device_t); -static int tlsb_print_child(device_t, device_t); -static int tlsb_read_ivar(device_t, device_t, int, u_long *); -static int tlsb_setup_intr(device_t, device_t, struct resource *, int, - driver_intr_t *, void *, void **); -static int -tlsb_teardown_intr(device_t, device_t, struct resource *, void *); - -static device_method_t tlsb_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, tlsb_probe), - DEVMETHOD(device_attach, bus_generic_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - - /* Bus interface */ - DEVMETHOD(bus_print_child, tlsb_print_child), - DEVMETHOD(bus_read_ivar, tlsb_read_ivar), - DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_setup_intr, tlsb_setup_intr), - DEVMETHOD(bus_teardown_intr, tlsb_teardown_intr), - - { 0, 0 } -}; - -static driver_t tlsb_driver = { - "tlsb", tlsb_methods, sizeof (struct tlsb_softc), -}; - -/* - * At 'probe' time, we add all the devices which we know about to the - * bus. The generic attach routine will probe and attach them if they - * are alive. - */ -static int -tlsb_probe(device_t dev) -{ - struct tlsb_softc *sc = device_get_softc(dev); - struct tlsb_device *tdev; - u_int32_t tldev; - int node; - - device_set_desc(dev, "TurboLaser Backplane Bus"); - - sc->tlsb_dev = dev; - tlsb0_softc = sc; - set_iointr(tlsb_intr); - - /* - * Attempt to find all devices on the bus, including - * CPUs, memory modules, and I/O modules. - */ - - for (node = 0; node <= TLSB_NODE_MAX; ++node) { - /* - * Check for invalid address. - */ - if (badaddr(TLSB_NODE_REG_ADDR(node, TLDEV), sizeof(u_int32_t))) - continue; - tldev = TLSB_GET_NODEREG(node, TLDEV); - if (tldev == 0) { - /* Nothing at this node. */ - continue; - } - tdev = (struct tlsb_device *) - malloc(sizeof (struct tlsb_device), M_DEVBUF, M_NOWAIT); - - if (!tdev) { - printf("tlsb_probe: unable to malloc softc\n"); - continue; - } - - sc->tlsb_map |= (1 << node); - tdev->td_node = node; - tdev->td_tldev = tldev; - tlsb_add_child(sc, tdev); - } - return (0); -} - -static int -tlsb_print_child(device_t dev, device_t child) -{ - struct tlsb_device* tdev = DEVTOTLSB(child); - int retval = 0; - - retval += bus_print_child_header(dev, child); - retval += printf(" at %s node %d\n", - device_get_nameunit(dev), tdev->td_node); - return (retval); -} - -static int -tlsb_read_ivar(device_t dev, device_t child, int index, u_long *result) -{ - struct tlsb_device *tdev = DEVTOTLSB(child); - - switch (index) { - case TLSB_IVAR_NODE: - *result = tdev->td_node; - break; - - case TLSB_IVAR_DTYPE: - *result = TLDEV_DTYPE(tdev->td_tldev); - break; - - case TLSB_IVAR_SWREV: - *result = TLDEV_SWREV(tdev->td_tldev); - break; - - case TLSB_IVAR_HWREV: - *result = TLDEV_HWREV(tdev->td_tldev); - break; - } - return (ENOENT); -} - -static int -tlsb_setup_intr(device_t dev, device_t child, struct resource *i, int f, - driver_intr_t *intr, void *arg, void **c) -{ - if (strncmp(device_get_name(child), "zsc", 3) == 0) { - if (tlsb0_softc->zsc_intr) - return (EBUSY); - tlsb0_softc->zsc_intr = intr; - tlsb0_softc->zsc_arg = arg; - return (0); - } else if (strncmp(device_get_name(device_get_parent(child)), "kft", 3) - == 0) { - if (tlsb0_softc->sub_intr == NULL) - tlsb0_softc->sub_intr = intr; - return (0); - } else { - return (ENXIO); - } -} - -static int -tlsb_teardown_intr(device_t dev, device_t child, struct resource *i, void *c) -{ - if (strncmp(device_get_name(child), "zsc", 3) == 0) { - tlsb0_softc->zsc_intr = NULL; - return (0); - } else if (strncmp(device_get_name(device_get_parent(child)), "kft", 3) - == 0) { - tlsb0_softc->sub_intr = NULL; - return (0); - } else { - return (ENXIO); - } -} - -static void -tlsb_intr(void *frame, u_long vector) -{ - if (vector && tlsb0_softc->sub_intr) - (*tlsb0_softc->sub_intr)((void *)vector); -} - -static void -tlsb_add_child(struct tlsb_softc *tlsb, struct tlsb_device *tdev) -{ - static int kftproto, memproto, cpuproto; - u_int32_t dtype = tdev->td_tldev & TLDEV_DTYPE_MASK; - int i, unit, ordr, units = 1; - char *dn; - device_t cd; - - /* - * We want CPU and Memory boards to configure first, and we want the - * I/O boards to configure in reverse slot number order. This is - * further complicated by the possibility of dual CPU nodes. - */ - ordr = tdev->td_node << 1; - - switch (dtype) { - case TLDEV_DTYPE_KFTHA: - case TLDEV_DTYPE_KFTIA: - ordr = 16 + (TLSB_NODE_MAX - tdev->td_node); - dn = "kft"; - unit = kftproto++; - break; - case TLDEV_DTYPE_MS7CC: - dn = "tlsbmem"; - unit = memproto++; - break; - case TLDEV_DTYPE_SCPU4: - case TLDEV_DTYPE_SCPU16: - dn = "tlsbcpu"; - unit = cpuproto++; - break; - case TLDEV_DTYPE_DCPU4: - case TLDEV_DTYPE_DCPU16: - units = 2; - dn = "tlsbcpu"; - unit = cpuproto; - cpuproto += 2; - break; - default: - printf("tlsb_add_child: unknown TLSB node type 0x%x\n", dtype); - return; - } - - for (i = 0; i < units; i++, unit++) { - cd = device_add_child_ordered(tlsb->tlsb_dev, ordr, dn, unit); - if (cd == NULL) { - return; - } - device_set_ivars(cd, tdev); - device_set_desc(cd, tlsb_node_type_str(dtype)); - } -} - -static char * -tlsb_node_type_str(u_int32_t dtype) -{ - static char tmp[64]; - - switch (dtype & TLDEV_DTYPE_MASK) { - case TLDEV_DTYPE_KFTHA: - return ("KFTHA I/O interface"); - - case TLDEV_DTYPE_KFTIA: - return ("KFTIA I/O interface"); - - case TLDEV_DTYPE_MS7CC: - return ("MS7CC Memory Module"); - - case TLDEV_DTYPE_SCPU4: - return ("Single CPU, 4MB cache"); - - case TLDEV_DTYPE_SCPU16: - return ("Single CPU, 16MB cache"); - - case TLDEV_DTYPE_DCPU4: - return ("Dual CPU, 4MB cache"); - - case TLDEV_DTYPE_DCPU16: - return ("Dual CPU, 16MB cache"); - - default: - bzero(tmp, sizeof(tmp)); - snprintf(tmp, sizeof(tmp), "unknown, type 0x%x", dtype); - return (tmp); - } - /* NOTREACHED */ -} -DRIVER_MODULE(tlsb, root, tlsb_driver, tlsb_devclass, 0, 0); diff --git a/sys/alpha/tlsb/tlsbcpu.c b/sys/alpha/tlsb/tlsbcpu.c deleted file mode 100644 index 68fa84a..0000000 --- a/sys/alpha/tlsb/tlsbcpu.c +++ /dev/null @@ -1,130 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * Node for TLSB CPU Modules found on - * AlphaServer 8200 and 8400 systems. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/malloc.h> - -#include <machine/rpb.h> -#include <machine/cpuconf.h> - -#include <alpha/tlsb/tlsbreg.h> -#include <alpha/tlsb/tlsbvar.h> - -#define KV(_addr) ((caddr_t)ALPHA_PHYS_TO_K0SEG((_addr))) - -/* - * Device methods - */ -static int tlsbcpu_probe(device_t); - -static device_method_t tlsbcpu_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, tlsbcpu_probe), - DEVMETHOD(device_attach, bus_generic_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, bus_generic_read_ivar), - DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - { 0, 0 } -}; - -static devclass_t tlsbcpu_devclass; -static driver_t tlsbcpu_driver = { - "tlsbcpu", tlsbcpu_methods, 1 -}; - -static int -tlsbcpu_probe(device_t dev) -{ - u_int32_t vid; - device_t child; - static int inst = 0; - struct tlsb_device *tdev = DEVTOTLSB(dev); - - /* - * Deal with hooking CPU instances to TurboLaser nodes. - */ - if (!TLDEV_ISCPU(tdev->td_tldev)) { - return (-1); - } - - vid = TLSB_GET_NODEREG(tdev->td_node, TLVID) & TLVID_VIDA_MASK; - vid >>= TLVID_VIDA_SHIFT; - - /* - * If this is the primary CPU (unit 0 for us), then - * attach a gbus. Otherwise don't. This is bogus, - * but sufficent for now. - */ - if (device_get_unit(dev) != 0) { - return (0); - } - - /* - * Hook in the first CPU unit. - */ - if (device_get_unit(dev) == 0) { - tlsb_primary_cpu = tdev; - } - /* - * Make this CPU a candidate for receiving interrupts. - */ - TLSB_PUT_NODEREG(tdev->td_node, TLCPUMASK, - TLSB_GET_NODEREG(tdev->td_node, TLCPUMASK) | (1 << vid)); - - /* - * Attach gbus for first instance. - */ - if (device_get_unit(dev) == 0) { - child = device_add_child(dev, "gbus", inst++); - if (child == NULL) { - return (-1); - } - device_set_ivars(child, tdev); - } - return (0); -} -DRIVER_MODULE(tlsbcpu, tlsb, tlsbcpu_driver, tlsbcpu_devclass, 0, 0); diff --git a/sys/alpha/tlsb/tlsbmem.c b/sys/alpha/tlsb/tlsbmem.c deleted file mode 100644 index 778601f..0000000 --- a/sys/alpha/tlsb/tlsbmem.c +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * Copyright (c) 1997, 2000 by Matthew Jacob - * NASA AMES Research Center. - * 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 immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * Dummy Node for TLSB Memory Modules found on - * AlphaServer 8200 and 8400 systems. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/malloc.h> - -#include <machine/rpb.h> - -#include <alpha/tlsb/tlsbreg.h> -#include <alpha/tlsb/tlsbvar.h> - -/* - * Device methods - */ -static int tlsbmem_probe(device_t); - -static device_method_t tlsbmem_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, tlsbmem_probe), - DEVMETHOD(device_attach, bus_generic_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - - /* Bus interface */ - DEVMETHOD(bus_print_child, bus_generic_print_child), - DEVMETHOD(bus_read_ivar, bus_generic_read_ivar), - DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - { 0, 0 } -}; - -static devclass_t tlsbmem_devclass; -static driver_t tlsbmem_driver = { - "tlsbmem", tlsbmem_methods, 1 -}; - -static int -tlsbmem_probe(device_t dev) -{ - struct tlsb_device *tdev = DEVTOTLSB(dev); - if (!TLDEV_ISMEM(tdev->td_tldev)) { - return (-1); - } - return (0); -} - -DRIVER_MODULE(tlsbmem, tlsb, tlsbmem_driver, tlsbmem_devclass, 0, 0); diff --git a/sys/alpha/tlsb/tlsbreg.h b/sys/alpha/tlsb/tlsbreg.h deleted file mode 100644 index cfff1c8..0000000 --- a/sys/alpha/tlsb/tlsbreg.h +++ /dev/null @@ -1,376 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: tlsbreg.h,v 1.5 2000/01/27 22:27:50 mjacob Exp $ */ - -/*- - * Copyright (c) 1997, 2000 by Matthew Jacob - * NASA AMES Research Center. - * All rights reserved. - * - * Based in part upon a prototype version by Jason Thorpe - * Copyright (c) 1996 by Jason Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice immediately at the beginning of the file, without modification, - * 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. - */ - -/* - * Definitions for the TurboLaser System Bus found on - * AlphaServer 8200/8400 systems. - */ - -/* - * There are 9 TurboLaser nodes, 0 though 8. Their uses are defined as - * follows: - * - * Node Module - * ---- ------ - * 0 CPU, Memory - * 1 CPU, Memory - * 2 CPU, Memory - * 3 CPU, Memory - * 4 CPU, Memory, I/O - * 5 CPU, Memory, I/O - * 6 CPU, Memory, I/O - * 7 CPU, Memory, I/O - * 8 I/O - * - * A node occurs every 0x00400000 bytes. - * - * Note, the AlphaServer 8200 only has nodes 4 though 8. - */ - -#define TLSB_NODE_BASE 0x000000ff88000000 /* Dense */ -#define TLSB_NODE_SIZE 0x00400000 -#define TLSB_NODE_MAX 8 /* inclusive */ - -/* Translate a node number to an address. */ -#define TLSB_NODE_ADDR(_node) \ - (long)(TLSB_NODE_BASE + ((_node) * TLSB_NODE_SIZE)) - -#define TLSB_NODE_REG_ADDR(_node, _reg) \ - KV((long)TLSB_NODE_ADDR((_node)) + (_reg)) - -/* Access the specified register on the specified node. */ -#define TLSB_GET_NODEREG(_node, _reg) \ - *(volatile u_int32_t *)(TLSB_NODE_REG_ADDR((_node), (_reg))) -#define TLSB_PUT_NODEREG(_node, _reg, _val) \ - *(volatile u_int32_t *)(TLSB_NODE_REG_ADDR((_node), (_reg))) = (_val) - -/* - * Some registers are shared by all TurboLaser nodes, and appear in - * the TurboLaser Broadcast space. - */ -#define TLSB_BCAST_BASE 0x000000ff8e000000 /* Dense */ - -#define TLSB_BCAST_REG_ADDR(_reg) KV((long)(TLSB_BCASE_BASE + (_reg))) - -/* Access the specified register in the broadcast space. */ -#define TLSB_GET_BCASTREG(_reg) \ - *(volatile u_int32_t *)(TLSB_BCAST_REG_ADDR + (_reg)) -#define TLSB_PUT_BCASTREG(_reg, _val) \ - *(volatile u_int32_t *)(TLSB_BCAST_REG_ADDR + (_reg)) = (_val) - -/* - * Location of the Gbus, the per-CPU bus containing the clock and - * console hardware. - */ -#define TLSB_GBUS_BASE 0x000000ff90000000 /* Dense */ - -/* - * Note that not every module type supports each TurboLaser register. - * The following defines the keys used to denote module support for - * a given register: - * - * C Supported by CPU module - * M Supported by Memory module - * I Supported by I/O module - */ - -/* - * Per-node TurboLaser System Bus registers, offsets from the - * base of the node. - */ -#define TLDEV 0x0000 /* CMI: Device Register */ -#define TLBER 0x0040 /* CMI: Bus Error Register */ -#define TLCNR 0x0080 /* CMI: Congfiguration Register */ -#define TLVID 0x00c0 /* CM: Virtual ID Register */ -#define TLMMR0 0x0200 /* CM: Memory Mapping Register 0 */ -#define TLMMR1 0x0240 /* CM: Memory Mapping Register 1 */ -#define TLMMR2 0x0280 /* CM: Memory Mapping Register 2 */ -#define TLMMR3 0x02c0 /* CM: Memory Mapping Register 3 */ -#define TLMMR4 0x0300 /* CM: Memory Mapping Register 4 */ -#define TLMMR5 0x0340 /* CM: Memory Mapping Register 5 */ -#define TLMMR6 0x0380 /* CM: Memory Mapping Register 6 */ -#define TLMMR7 0x03c0 /* CM: Memory Mapping Register 7 */ -#define TLFADR0 0x0600 /* MI: Failing Address Register 0 */ -#define TLFADR1 0x0640 /* MI: Failing Address Register 1 */ -#define TLESR0 0x0680 /* CMI: Error Syndrome Register 0 */ -#define TLESR1 0x06c0 /* CMI: Error Syndrome Register 1 */ -#define TLESR2 0x0700 /* CMI: Error Syndrome Register 2 */ -#define TLESR3 0x0740 /* CMI: Error Syndrome Register 3 */ -#define TLILID0 0x0a00 /* I: Int. Level 0 IDENT Register */ -#define TLILID1 0x0a40 /* I: Int. Level 1 IDENT Register */ -#define TLILID2 0x0a80 /* I: Int. Level 2 IDENT Register */ -#define TLILID3 0x0ac0 /* I: Int. Level 3 IDENT Register */ -#define TLCPUMASK 0x0b00 /* I: CPU Interrupt Mask Register */ -#define TLMBPTR 0x0c00 /* I: Mailbox Pointer Register */ -#define TLINTRMASK0 0x1100 /* C: Interrupt Mask Register CPU 0 */ -#define TLINTRMASK1 0x1140 /* C: Interrupt Mask Register CPU 1 */ -#define TLINTRSUM0 0x1180 /* C: Interrupt Sum Register CPU 0 */ -#define TLINTRSUM1 0x11C0 /* C: Interrupt Sum Register CPU 1 */ -#define TLEPAERR 0x1500 /* C: ADG error register */ -#define TLEPDERR 0x1540 /* C: DIGA error register */ -#define TLEPMERR 0x1580 /* C: MMG error register */ -#define TLDMCMD 0x1600 /* C: Data Mover Command */ -#define TLDMADRA 0x1680 /* C: Data Mover Source */ -#define TLDMADRB 0x16C0 /* C: Data Mover Destination */ - -/* - * Registers shared between TurboLaser nodes, offsets from the - * TurboLaser Broadcast Base. - */ -#define TLPRIVATE 0x0000 /* CMI: private "global" space */ -#define TLIPINTR 0x0040 /* C: Interprocessor Int. Register */ -#define TLIOINTR4 0x0100 /* C: I/O Interrupt Register 4 */ -#define TLIOINTR5 0x0140 /* C: I/O Interrupt Register 5 */ -#define TLIOINTR6 0x0180 /* C: I/O Interrupt Register 6 */ -#define TLIOINTR7 0x01c0 /* C: I/O Interrupt Register 7 */ -#define TLIOINTR8 0x0200 /* C: I/O Interrupt Register 8 */ -#define TLWSDQR4 0x0400 /* C: Win Spc Dcr Que Ctr Reg 4 */ -#define TLWSDQR5 0x0440 /* C: Win Spc Dcr Que Ctr Reg 5 */ -#define TLWSDQR6 0x0480 /* C: Win Spc Dcr Que Ctr Reg 6 */ -#define TLWSDQR7 0x04c0 /* C: Win Spc Dcr Que Ctr Reg 7 */ -#define TLWSDQR8 0x0500 /* C: Win Spc Dcr Que Ctr Reg 8 */ -#define TLRMDQRX 0x0600 /* C: Mem Chan Dcr Que Ctr Reg X */ -#define TLRMDQR8 0x0640 /* C: Mem Chan Dcr Que Ctr Reg 8 */ -#define TLRDRD 0x0800 /* C: CSR Read Data Rtn Data Reg */ -#define TLRDRE 0x0840 /* C: CSR Read Data Rtn Error Reg */ -#define TLMCR 0x1880 /* M: Memory Control Register */ - -/* - * TLDEV - Device Register - * - * Access: R/W - * - * Notes: - * Register is loaded during initialization with information - * that identifies a node. A zero value indicates a non-initialized - * (slot empty) node. - * - * Bits 0-15 contain the hardware device type, bits 16-23 - * the board's software revision, and bits 24-31 the board's - * hardware revision. - * - * The device type portion is laid out as follows: - * - * Bit 15: identifies a CPU - * Bit 14: identifies a memory board - * Bit 13: identifies an I/O board - * Bits 0-7: specify the ID of a node type - */ -#define TLDEV_DTYPE_MASK 0x0000ffff -#define TLDEV_DTYPE_KFTHA 0x2000 /* KFTHA board, I/O */ -#define TLDEV_DTYPE_KFTIA 0x2020 /* KFTIA board, I/O */ -#define TLDEV_DTYPE_MS7CC 0x5000 /* Memory board */ -#define TLDEV_DTYPE_SCPU4 0x8011 /* 1 CPU, 4mb cache */ -#define TLDEV_DTYPE_SCPU16 0x8012 /* 1 CPU, 16mb cache */ -#define TLDEV_DTYPE_DCPU4 0x8014 /* 2 CPU, 4mb cache */ -#define TLDEV_DTYPE_DCPU16 0x8015 /* 2 CPU, 16mb cache */ - -#define TLDEV_DTYPE(_val) ((_val) & TLDEV_DTYPE_MASK) -# define TLDEV_ISCPU(_val) (TLDEV_DTYPE(_val) & 0x8000) -# define TLDEV_ISMEM(_val) (TLDEV_DTYPE(_val) & 0x4000) -# define TLDEV_ISIOPORT(_val) (TLDEV_DTYPE(_val) & 0x2000) -#define TLDEV_SWREV(_val) (((_val) >> 16) & 0xff) -#define TLDEV_HWREV(_val) (((_val) >> 24) & 0xff) - -/* - * TLBER - Bus Error Register - * - * Access: R/W - * - * Notes: - * This register contains information about TLSB errors detected by - * nodes on the TLSB. The register will become locked when: - * - * * Any error occurs and the "lock on first error" - * bit of the Configuration Register is set. - * - * * Any bit other than 20-23 (DS0-DS3) becomes set. - * - * and will remain locked until either: - * - * * All bits in the TLBER are cleared. - * - * * The "lock on first error" bit is cleared. - * - * TLBER locking is intended for diagnosic purposes only, and - * not for general use. - */ -#define TLBER_ATCE 0x00000001 /* Addr Transmit Ck Error */ -#define TLBER_APE 0x00000002 /* Addr Parity Error */ -#define TLBER_BAE 0x00000004 /* Bank Avail Violation Error */ -#define TLBER_LKTO 0x00000008 /* Bank Lock Timeout */ -#define TLBER_NAE 0x00000010 /* No Ack Error */ -#define TLBER_RTCE 0x00000020 /* Read Transmit Ck Error */ -#define TLBER_ACKTCE 0x00000040 /* Ack Transmit Ck Error */ -#define TLBER_MMRE 0x00000080 /* Mem Mapping Register Error */ -#define TLBER_FNAE 0x00000100 /* Fatal No Ack Error */ -#define TLBER_REQDE 0x00000200 /* Request Deassertion Error */ -#define TLBER_ATDE 0x00000400 /* Addredd Transmitter During Error */ -#define TLBER_UDE 0x00010000 /* Uncorrectable Data Error */ -#define TLBER_CWDE 0x00020000 /* Correctable Write Data Error */ -#define TLBER_CRDE 0x00040000 /* Correctable Read Data Error */ -#define TLBER_CRDE2 0x00080000 /* ...ditto... */ -#define TLBER_DS0 0x00100000 /* Data Synd 0 */ -#define TLBER_DS1 0x00200000 /* Data Synd 1 */ -#define TLBER_DS2 0x00400000 /* Data Synd 2 */ -#define TLBER_DS3 0x00800000 /* Data Synd 3 */ -#define TLBER_DTDE 0x01000000 /* Data Transmitter During Error */ -#define TLBER_FDTCE 0x02000000 /* Fatal Data Transmit Ck Error */ -#define TLBER_UACKE 0x04000000 /* Unexpected Ack Error */ -#define TLBER_ABTCE 0x08000000 /* Addr Bus Transmit Error */ -#define TLBER_DCTCE 0x10000000 /* Data Control Transmit Ck Error */ -#define TLBER_SEQE 0x20000000 /* Sequence Error */ -#define TLBER_DSE 0x40000000 /* Data Status Error */ -#define TLBER_DTO 0x80000000 /* Data Timeout Error */ - -/* - * TLCNR - Configuration Register - * - * Access: R/W - */ -#define TLCNR_CWDD 0x00000001 /* Corr Write Data Err INTR Dis */ -#define TLCNR_CRDD 0x00000002 /* Corr Read Data Err INTR Dis */ -#define TLCNR_LKTOD 0x00000004 /* Bank Lock Timeout Disable */ -#define TLCNR_DTOD 0x00000008 /* Data Timeout Disable */ -#define TLCNR_STF_A 0x00001000 /* Self-Test Fail A */ -#define TLCNR_STF_B 0x00002000 /* Self-Test Fail B */ -#define TLCNR_HALT_A 0x00100000 /* Halt A */ -#define TLCNR_HALT_B 0x00200000 /* Halt B */ -#define TLCNR_RSTSTAT 0x10000000 /* Reset Status */ -#define TLCNR_NRST 0x40000000 /* Node Reset */ -#define TLCNR_LOFE 0x80000000 /* Lock On First Error */ - -#define TLCNR_NODE_MASK 0x000000f0 /* Node ID mask */ -#define TLCNR_NODE_SHIFT 4 - -#define TLCNR_VCNT_MASK 0x00000f00 /* VCNT mask */ -#define TLCNR_VCNT_SHIFT 8 - -/* - * TLVID - Virtual ID Register - * - * Access: R/W - * - * Notes: - * Virtual units can be CPUs or Memory boards. The units are - * are addressed using virtual IDs. These virtual IDs are assigned - * by writing to the TLVID register. The upper 24 bits of this - * register are reserved and must be written as `0'. - */ -#define TLVID_VIDA_MASK 0x0000000f /* Virtual ID for unit 0 */ -#define TLVID_VIDA_SHIFT 0 - -#define TLVID_VIDB_MASK 0x000000f0 /* Virtual ID for unit 1 */ -#define TLVID_VIDB_SHIFT 4 - -/* - * TLMMRn - Memory Mapping Registers - * - * Access: W - * - * Notes: - * Contains mapping information for doing a bank-decode. - */ -#define TLMMR_INTMASK 0x00000003 /* Valid bits in Interleave */ -#define TLMMR_ADRMASK 0x000000f0 /* Valid bits in Address */ -#define TLMMR_SBANK 0x00000800 /* Single-bank indicator */ -#define TLMMR_VALID 0x80000000 /* Indicated mapping is valid */ - -#define TLMMR_INTLV_MASK 0x00000700 /* Mask for interleave value */ -#define TLMMR_INTLV_SHIFT 8 - -#define TLMMR_ADDRESS_MASK 0x03fff000 /* Mask for address value */ -#define TLMMR_ADDRESS_SHIFT 12 - -/* - * TLFADRn - Failing Address Registers - * - * Access: R/W - * - * Notes: - * These registers contain status information for a failed address. - * Not all nodes preserve this information. The validation bits - * indicate the validity of a given field. - */ - - -/* - * CPU Interrupt Mask Register - * - * The PAL code reads this register for each CPU on a TLSB CPU board - * to see what is or isn't enabled. - */ -#define TLINTRMASK_CONHALT 0x100 /* Enable ^P Halt */ -#define TLINTRMASK_HALT 0x080 /* Enable Halt */ -#define TLINTRMASK_CLOCK 0x040 /* Enable Clock Interrupts */ -#define TLINTRMASK_XCALL 0x020 /* Enable Interprocessor Interrupts */ -#define TLINTRMASK_IPL17 0x010 /* Enable IPL 17 Interrupts */ -#define TLINTRMASK_IPL16 0x008 /* Enable IPL 16 Interrupts */ -#define TLINTRMASK_IPL15 0x004 /* Enable IPL 15 Interrupts */ -#define TLINTRMASK_IPL14 0x002 /* Enable IPL 14 Interrupts */ -#define TLINTRMASK_DUART 0x001 /* Enable GBUS Duart0 Interrupts */ - -/* - * CPU Interrupt Summary Register - * - * The PAL code reads this register at interrupt time to figure out - * which interrupt line to assert to the CPU. Note that when the - * interrupt is actually vectored through the PAL code, it arrives - * here already presorted as to type (clock, halt, iointr). - */ -#define TLINTRSUM_HALT (1 << 28) /* Halted via TLCNR register */ -#define TLINTRSUM_CONHALT (1 << 27) /* Halted via ^P (W1C) */ -#define TLINTRSUM_CLOCK (1 << 6) /* Clock Interrupt (W1C) */ -#define TLINTRSUM_XCALL (1 << 5) /* Interprocessor Int (W1C) */ -#define TLINTRSUM_IPL17 (1 << 4) /* IPL 17 Interrupt Summary */ -#define TLINTRSUM_IPL16 (1 << 3) /* IPL 16 Interrupt Summary */ -#define TLINTRSUM_IPL15 (1 << 2) /* IPL 15 Interrupt Summary */ -#define TLINTRSUM_IPL14 (1 << 1) /* IPL 14 Interrupt Summary */ -#define TLINTRSUM_DUART (1 << 0) /* Duart Int (W1C) */ -/* after checking the summaries, you can get the source node for each level */ -#define TLINTRSUM_IPL17_SOURCE(x) ((x >> 22) & 0x1f) -#define TLINTRSUM_IPL16_SOURCE(x) ((x >> 17) & 0x1f) -#define TLINTRSUM_IPL15_SOURCE(x) ((x >> 12) & 0x1f) -#define TLINTRSUM_IPL14_SOURCE(x) ((x >> 7) & 0x1f) - -/* - * (some of) TurboLaser CPU ADG error register defines. - */ -#define TLEPAERR_IBOX_TMO 0x1800 /* window space read failed */ -#define TLEPAERR_WSPC_RD 0x0600 /* window space read failed */ - -/* - * (some of) TurboLaser CPU DIGA error register defines. - */ -#define TLEPDERR_GBTMO 0x4 /* GBus timeout */ diff --git a/sys/alpha/tlsb/tlsbvar.h b/sys/alpha/tlsb/tlsbvar.h deleted file mode 100644 index 238f908..0000000 --- a/sys/alpha/tlsb/tlsbvar.h +++ /dev/null @@ -1,87 +0,0 @@ -/* $FreeBSD$ */ -/* $NetBSD: tlsbvar.h,v 1.5 1998/05/13 23:23:23 thorpej Exp $ */ - -/*- - * Copyright (c) 1997, 2000 by Matthew Jacob - * NASA AMES Research Center. - * All rights reserved. - * - * Based in part upon a prototype version by Jason Thorpe - * Copyright (c) 1996 by Jason Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice immediately at the beginning of the file, without modification, - * 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. 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 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. - */ - -/* - * Definitions for the TurboLaser System Bus found on - * AlphaServer 8200/8400 systems. - */ - -enum tlsb_device_instvars { - TLSB_IVAR_NODE, - TLSB_IVAR_DTYPE, - TLSB_IVAR_SWREV, - TLSB_IVAR_HWREV -}; - -/* - * Simplified accessors for turbolaser devices - */ - -#define TLSB_ACCESSOR(A, B, T) \ - \ -static __inline T tlsb_get_ ## A(device_t dev) \ -{ \ - u_long v; \ - BUS_READ_IVAR(device_get_parent(dev), dev, TLSB_IVAR_ ## B, &v); \ - return v; \ -} - -TLSB_ACCESSOR(node, NODE, int) -TLSB_ACCESSOR(dtype, DTYPE, u_int16_t) -TLSB_ACCESSOR(hwrev, HWREV, u_int8_t) -TLSB_ACCESSOR(swrev, SWREV, u_int8_t) - -/* - * Bus-dependent structure for CPUs. This is dynamically allocated - * for each CPU on the TurboLaser, and glued into the cpu_softc - * as sc_busdep (when there is a cpu_softc to do this to). - */ -struct tlsb_cpu_busdep { - u_int8_t tcpu_vid; /* virtual ID of CPU */ - int tcpu_node; /* TurboLaser node */ -}; - -/* - * The structure used to attach devices to the TurboLaser. - */ -struct tlsb_device { - int td_node; /* node number (TLSB slot) */ - u_int32_t td_tldev; /* tl device id */ -}; -#define DEVTOTLSB(dev) ((struct tlsb_device *) device_get_ivars(dev)) -#ifdef _KERNEL -extern struct tlsb_device *tlsb_primary_cpu; -#endif diff --git a/sys/alpha/tlsb/zs_tlsb.c b/sys/alpha/tlsb/zs_tlsb.c deleted file mode 100644 index a603449..0000000 --- a/sys/alpha/tlsb/zs_tlsb.c +++ /dev/null @@ -1,526 +0,0 @@ -/*- - * 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. - * - */ - -/* - * This driver is a somewhat hack. A real driver might use the zs driver - * source from NetBSD, except that it's no real winner either. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/kernel.h> -#include <sys/systm.h> -#include <sys/kdb.h> -#include <sys/module.h> -#include <sys/bus.h> -#include <sys/conf.h> -#include <sys/tty.h> -#include <sys/proc.h> -#include <sys/cons.h> -#include <machine/clock.h> - -#include <alpha/tlsb/gbusvar.h> -#include <alpha/tlsb/tlsbreg.h> -#include <alpha/tlsb/zsreg.h> -#include <alpha/tlsb/zsvar.h> - -#define KV(_addr) ((caddr_t)ALPHA_PHYS_TO_K0SEG((_addr))) - -static int zsc_get_channel(device_t dev); -static caddr_t zsc_get_base(device_t dev); - -struct zs_softc { - struct tty * tp; - device_t dev; - int channel; - caddr_t base; - struct callout_handle zst; -}; -#define ZS_SOFTC(unit) \ - ((struct zs_softc *) devclass_get_softc(zs_devclass, (unit))) - -static d_open_t zsopen; -static d_close_t zsclose; - -static struct cdevsw zs_cdevsw = { - .d_version = D_VERSION, - .d_open = zsopen, - .d_close = zsclose, - .d_name = "zs", - .d_flags = D_TTY | D_NEEDGIANT, -}; - -static void zsstart(struct tty *); -static int zsparam(struct tty *, struct termios *); -static void zsstop(struct tty *tp, int flag); - -/* - * Helpers for console support. - */ - -static int zs_probe(device_t); -static int zs_attach(device_t); - -static devclass_t zs_devclass; -static devclass_t zsc_devclass; - -static device_method_t zs_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, zs_probe), - DEVMETHOD(device_attach, zs_attach), - { 0, 0 } -}; - -static driver_t zs_driver = { - "zs", zs_methods, sizeof (struct zs_softc), -}; - -static void zs_poll_intr(void *); -static int zspolltime; - - -static int -zs_probe(device_t dev) -{ - return 0; -} - -static int -zs_attach(device_t dev) -{ - struct zs_softc *sc = device_get_softc(dev); - struct cdev *cdev; - struct tty *tp; - int unit; - - sc->dev = dev; - sc->channel = zsc_get_channel(dev); - sc->base = zsc_get_base(dev); - unit = device_get_unit(dev); - cdev = make_dev(&zs_cdevsw, unit, UID_ROOT, GID_WHEEL, 0600, - "zs%d", unit); - tp = sc->tp = cdev->si_tty = ttyalloc(); - cdev->si_drv1 = sc; - cdev->si_tty = tp; - tp->t_oproc = zsstart; - tp->t_param = zsparam; - tp->t_stop = zsstop; - tp->t_dev = cdev; - return 0; -} - -static caddr_t -zs_statusreg(caddr_t base, int chan) -{ - if (chan == 0) - return base + ZSC_CHANNELA + ZSC_STATUS; - if (chan == 1) - return base + ZSC_CHANNELB + ZSC_STATUS; - panic("zs_statusreg: bogus channel"); -} - -static caddr_t -zs_datareg(caddr_t base, int chan) -{ - if (chan == 0) - return base + ZSC_CHANNELA + ZSC_DATA; - if (chan == 1) - return base + ZSC_CHANNELB + ZSC_DATA; - panic("zs_statusreg: bogus channel"); -} - -static int -zs_get_status(caddr_t base, int chan) -{ - return *(u_int32_t*) zs_statusreg(base, chan) & 0xff; -} - -#ifdef IF_RR3_WORKED -static void -zs_put_status(caddr_t base, int chan, int v) -{ - *(u_int32_t*) zs_statusreg(base, chan) = v; - alpha_mb(); -} - -static int -zs_get_rr3(caddr_t base, int chan) -{ - if (chan != 0) - panic("zs_get_rr3: bad channel"); - zs_put_status(base, chan, 3); - return zs_get_status(base, chan); -} -#endif - -static int -zs_get_data(caddr_t base, int chan) -{ - return *(u_int32_t*) zs_datareg(base, chan) & 0xff; -} - -static void -zs_put_data(caddr_t base, int chan, int v) -{ - *(u_int32_t*) zs_datareg(base, chan) = v; - alpha_mb(); -} - -static int -zs_getc(caddr_t base, int chan) -{ - while (!(zs_get_status(base, chan) & 1)) - DELAY(5); - return zs_get_data(base, chan); -} - -static int -zs_maygetc(caddr_t base, int chan) -{ - if (zs_get_status(base, chan) & 1) - return zs_get_data(base, chan); - else - return (-1); -} - -static void -zs_putc(caddr_t base, int chan, int c) -{ - while (!(zs_get_status(base, chan) & 4)) - DELAY(5); - zs_put_data(base, chan, c); -} - -/* - * Console support - */ -cn_getc_t zs_cngetc; -cn_checkc_t zs_cncheckc; -cn_putc_t zs_cnputc; - -static caddr_t zs_console_addr; -CONS_DRIVER(zs, NULL, NULL, NULL, zs_cngetc, zs_cncheckc, zs_cnputc, NULL); - -int -zs_cnattach(vm_offset_t base, vm_offset_t offset) -{ - /* should really bet part of ivars */ - zs_console_addr = (caddr_t) ALPHA_PHYS_TO_K0SEG(base + offset); - - sprintf(zs_consdev.cn_name, "zs0"); - zs_consdev.cn_unit = 0; - zs_consdev.cn_pri = CN_NORMAL; - cnadd(&zs_consdev); - return (0); -} - -int -zs_cngetc(struct consdev *cp) -{ - int s = spltty(); - int c = zs_getc(zs_console_addr, cp->cn_unit); - splx(s); - return c; -} - -int -zs_cncheckc(struct consdev *cp) -{ - int s = spltty(); - int c = zs_maygetc(zs_console_addr, cp->cn_unit); - splx(s); - return c; -} - -void -zs_cnputc(struct consdev *cp, int c) -{ - int s = spltty(); - zs_putc(zs_console_addr, cp->cn_unit, c); - splx(s); -} - - -static int -zsopen(struct cdev *dev, int flag, int mode, struct thread *td) -{ - struct zs_softc *sc; - struct tty *tp; - int error = 0, setuptimeout = 0; - int s; - - sc = dev->si_drv1; - if (!sc) - return ENXIO; - - s = spltty(); - tp = dev->si_tty; - if ((tp->t_state & TS_ISOPEN) == 0) { - tp->t_state |= TS_CARR_ON; - ttyconsolemode(tp, 0); - setuptimeout = 1; - } else if ((tp->t_state & TS_XCLUDE) && suser(td)) { - splx(s); - return EBUSY; - } - - splx(s); - - error = ttyld_open(tp, dev); - - if (error == 0 && setuptimeout) { - zspolltime = hz / 50; - if (zspolltime < 1) - zspolltime = 1; - /* XXX we're not set up to do interrupts yet */ - sc->zst = timeout(zs_poll_intr, sc, zspolltime); - } - - return (error); -} - -static int -zsclose(struct cdev *dev, int flag, int mode, struct thread *td) -{ - struct zs_softc *sc = ZS_SOFTC(minor(dev)); - struct tty *tp; - int s; - - if (sc == NULL) - return (ENXIO); - - tp = sc->tp; - - s = spltty(); - untimeout(zs_poll_intr, sc, sc->zst); - ttyld_close(tp, flag); - tty_close(tp); - splx(s); - - return (0); -} - -static int -zsparam(struct tty *tp, struct termios *t) -{ - return (0); -} - -static void -zsstart(struct tty *tp) -{ - struct zs_softc *sc = ZS_SOFTC(minor(tp->t_dev)); - int s = spltty(); - - if (tp->t_state & (TS_TIMEOUT | TS_TTSTOP)) { - ttwwakeup(tp); - splx(s); - return; - } - - tp->t_state |= TS_BUSY; - while (tp->t_outq.c_cc != 0) - zs_putc(sc->base, minor(tp->t_dev), getc(&tp->t_outq)); - tp->t_state &= ~TS_BUSY; - - ttwwakeup(tp); - splx(s); -} - -/* - * Stop output on a line. - */ -static void -zsstop(struct tty *tp, int flag) -{ - int s = spltty(); - if (tp->t_state & TS_BUSY) - if ((tp->t_state & TS_TTSTOP) == 0) - tp->t_state |= TS_FLUSH; - splx(s); -} - -DRIVER_MODULE(zs, zsc, zs_driver, zs_devclass, 0, 0); - -/* - * The zsc bus holds two zs devices, one for channel A, one for channel B. - */ - -struct zsc_softc { - caddr_t base; - struct zs_softc *sc_a; - struct zs_softc *sc_b; - void *intr; -}; -static driver_intr_t zsc_tlsb_intr; - -static int zsc_tlsb_probe(device_t dev); -static int zsc_tlsb_attach(device_t dev); -static int zsc_tlsb_print_child(device_t dev, device_t child); - -static device_method_t zsc_tlsb_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, zsc_tlsb_probe), - DEVMETHOD(device_attach, zsc_tlsb_attach), - DEVMETHOD(device_detach, bus_generic_detach), - DEVMETHOD(device_shutdown, bus_generic_shutdown), - - /* Bus interface */ - DEVMETHOD(bus_print_child, zsc_tlsb_print_child), - DEVMETHOD(bus_read_ivar, bus_generic_read_ivar), - DEVMETHOD(bus_write_ivar, bus_generic_write_ivar), - DEVMETHOD(bus_setup_intr, bus_generic_setup_intr), - DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), - - { 0, 0 } -}; - -static driver_t zsc_tlsb_driver = { - "zsc", zsc_tlsb_methods, sizeof(struct zsc_softc), -}; - -static int -zsc_get_channel(device_t dev) -{ - return (long) device_get_ivars(dev); -} - -static caddr_t -zsc_get_base(device_t dev) -{ - device_t bus = device_get_parent(dev); - struct zsc_softc *sc = device_get_softc(bus); - return sc->base; -} - -static int -zsc_tlsb_probe(device_t dev) -{ - static int zs_unit = 0; - struct zsc_softc *sc = device_get_softc(dev); - - device_set_desc(dev, "Z8530 uart"); - sc->base = (caddr_t) - ALPHA_PHYS_TO_K0SEG(TLSB_GBUS_BASE + gbus_get_offset(dev)); - /* - * Add channel A and channel B - */ - device_add_child(dev, "zs", zs_unit++); - device_add_child(dev, "zs", zs_unit++); - return (0); -} - -static int -zsc_tlsb_attach(device_t dev) -{ - struct zsc_softc *sc = device_get_softc(dev); - device_t parent = device_get_parent(dev); - - bus_generic_attach(dev); - - /* XXX */ - sc->sc_a = ZS_SOFTC(device_get_unit(dev)); - sc->sc_b = ZS_SOFTC(device_get_unit(dev)+1); - - /* XXX should use resource argument to communicate vector */ - return BUS_SETUP_INTR(parent, dev, NULL, INTR_TYPE_TTY, - zsc_tlsb_intr, sc, &sc->intr); -} - -static int -zsc_tlsb_print_child(device_t bus, device_t dev) -{ - int retval = 0; - - retval += bus_print_child_header(bus, dev); - retval += printf(" on %s channel %c\n", device_get_nameunit(bus), - 'A' + (device_get_unit(dev) & 1)); - - return (retval); -} - -static void -zs_poll_intr(void *arg) -{ - struct zs_softc *sc = arg; - int s = spltty(); - zsc_tlsb_intr(device_get_softc(device_get_parent(sc->dev))); - sc->zst = timeout(zs_poll_intr, sc, zspolltime); - splx(s); -} - -static void -zsc_tlsb_intr(void *arg) -{ - struct zsc_softc *sc = arg; - caddr_t base = sc->base; - int rr3; - - if (base == NULL) - panic("null base in zsc_tlsb_intr"); - - -#ifdef IF_RR3_WORKED - rr3 = zs_get_rr3(base, 0); -#else - rr3 = 0x20; -#endif - - if (rr3 & 0x20) { - struct tty *tp = sc->sc_a->tp; - int c; - - while (zs_get_status(base, 0) & 1) { - c = zs_get_data(base, 0); -#ifdef KDB - if (c == CTRL('\\')) - kdb_enter("manual escape to debugger"); -#endif - if (tp && (tp->t_state & TS_ISOPEN)) - ttyld_rint(tp, c); - DELAY(5); - } - } - if (rr3 & 0x04) { - struct tty *tp = sc->sc_b->tp; - int c; - - while (zs_get_status(base, 1) & 1) { - c = zs_get_data(base, 1); -#ifdef KDB - if (c == CTRL('\\')) - kdb_enter("manual escape to debugger"); -#endif - if (tp && (tp->t_state & TS_ISOPEN)) - ttyld_rint(tp, c); - DELAY(5); - } - } -} -DRIVER_MODULE(zsc, gbus, zsc_tlsb_driver, zsc_devclass, 0, 0); diff --git a/sys/alpha/tlsb/zsreg.h b/sys/alpha/tlsb/zsreg.h deleted file mode 100644 index f087a7b..0000000 --- a/sys/alpha/tlsb/zsreg.h +++ /dev/null @@ -1,33 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -#define ZSC_CHANNELA 0x80 -#define ZSC_CHANNELB 0x00 - -#define ZSC_STATUS 0x00 -#define ZSC_DATA 0x40 diff --git a/sys/alpha/tlsb/zsvar.h b/sys/alpha/tlsb/zsvar.h deleted file mode 100644 index 8470154..0000000 --- a/sys/alpha/tlsb/zsvar.h +++ /dev/null @@ -1,29 +0,0 @@ -/*- - * 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. - * - * $FreeBSD$ - */ - -int zs_cnattach(vm_offset_t base, vm_offset_t offset); |