Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 This file is dead. It has ceased to be. It ...
details: https://anonhg.NetBSD.org/src/rev/371210f47806
branches: trunk
changeset: 555807:371210f47806
user: fvdl <fvdl%NetBSD.org@localhost>
date: Sat Nov 29 00:27:58 2003 +0000
description:
This file is dead. It has ceased to be. It has gone to meet it's maker. It
is a late file.
Any rumours of it pining for the fjords are totally unsubstantiated.
diffstat:
sys/arch/x86/x86/bus_machdep.c | 1115 ----------------------------------------
1 files changed, 0 insertions(+), 1115 deletions(-)
diffs (truncated from 1119 to 300 lines):
diff -r 41be52b2c5e2 -r 371210f47806 sys/arch/x86/x86/bus_machdep.c
--- a/sys/arch/x86/x86/bus_machdep.c Sat Nov 29 00:11:18 2003 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1115 +0,0 @@
-/* $NetBSD: bus_machdep.c,v 1.5 2003/11/28 23:47:42 jhawk Exp $ */
-
-/*-
- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
- * All rights reserved.
- *
- * This code is derived from software contributed to The NetBSD Foundation
- * by Charles M. Hannum and 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.
- */
-
-#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_machdep.c,v 1.5 2003/11/28 23:47:42 jhawk Exp $");
-
-#include "opt_largepages.h"
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/extent.h>
-#include <sys/proc.h>
-
-#include <uvm/uvm_extern.h>
-
-#define _X86_BUS_DMA_PRIVATE
-#include <machine/bus.h>
-
-#include <dev/isa/isareg.h>
-#include <machine/isa_machdep.h>
-
-/*
- * Extent maps to manage I/O and memory space. Allocate
- * storage for 8 regions in each, initially. Later, ioport_malloc_safe
- * will indicate that it's safe to use malloc() to dynamically allocate
- * region descriptors.
- *
- * N.B. At least two regions are _always_ allocated from the iomem
- * extent map; (0 -> ISA hole) and (end of ISA hole -> end of RAM).
- *
- * The extent maps are not static! Machine-dependent ISA and EISA
- * routines need access to them for bus address space allocation.
- */
-static long ioport_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
-static long iomem_ex_storage[EXTENT_FIXED_STORAGE_SIZE(8) / sizeof(long)];
-struct extent *ioport_ex;
-struct extent *iomem_ex;
-static int ioport_malloc_safe;
-
-int x86_mem_add_mapping __P((bus_addr_t, bus_size_t,
- int, bus_space_handle_t *));
-
-int _bus_dmamap_load_buffer __P((bus_dma_tag_t, bus_dmamap_t, void *,
- bus_size_t, struct proc *, int, paddr_t *, int *, int));
-
-void
-x86_bus_space_init()
-{
- /*
- * Initialize the I/O port and I/O mem extent maps.
- * Note: we don't have to check the return value since
- * creation of a fixed extent map will never fail (since
- * descriptor storage has already been allocated).
- *
- * N.B. The iomem extent manages _all_ physical addresses
- * on the machine. When the amount of RAM is found, the two
- * extents of RAM are allocated from the map (0 -> ISA hole
- * and end of ISA hole -> end of RAM).
- */
- ioport_ex = extent_create("ioport", 0x0, 0xffff, M_DEVBUF,
- (caddr_t)ioport_ex_storage, sizeof(ioport_ex_storage),
- EX_NOCOALESCE|EX_NOWAIT);
- iomem_ex = extent_create("iomem", 0x0, 0xffffffff, M_DEVBUF,
- (caddr_t)iomem_ex_storage, sizeof(iomem_ex_storage),
- EX_NOCOALESCE|EX_NOWAIT);
-}
-
-void
-x86_bus_space_mallocok()
-{
-
- ioport_malloc_safe = 1;
-}
-
-int
-x86_memio_map(t, bpa, size, flags, bshp)
- bus_space_tag_t t;
- bus_addr_t bpa;
- bus_size_t size;
- int flags;
- bus_space_handle_t *bshp;
-{
- int error;
- struct extent *ex;
-
- /*
- * Pick the appropriate extent map.
- */
- if (t == X86_BUS_SPACE_IO) {
- if (flags & BUS_SPACE_MAP_LINEAR)
- return (EOPNOTSUPP);
- ex = ioport_ex;
- } else if (t == X86_BUS_SPACE_MEM)
- ex = iomem_ex;
- else
- panic("x86_memio_map: bad bus space tag");
-
- /*
- * Before we go any further, let's make sure that this
- * region is available.
- */
- error = extent_alloc_region(ex, bpa, size,
- EX_NOWAIT | (ioport_malloc_safe ? EX_MALLOCOK : 0));
- if (error)
- return (error);
-
- /*
- * For I/O space, that's all she wrote.
- */
- if (t == X86_BUS_SPACE_IO) {
- *bshp = bpa;
- return (0);
- }
-
- if (bpa >= IOM_BEGIN && (bpa + size) <= IOM_END) {
- *bshp = (bus_space_handle_t)ISA_HOLE_VADDR(bpa);
- return(0);
- }
-
- /*
- * For memory space, map the bus physical address to
- * a kernel virtual address.
- */
- error = x86_mem_add_mapping(bpa, size,
- (flags & BUS_SPACE_MAP_CACHEABLE) != 0, bshp);
- if (error) {
- if (extent_free(ex, bpa, size, EX_NOWAIT |
- (ioport_malloc_safe ? EX_MALLOCOK : 0))) {
- printf("x86_memio_map: pa 0x%lx, size 0x%lx\n",
- bpa, size);
- printf("x86_memio_map: can't free region\n");
- }
- }
-
- return (error);
-}
-
-int
-_x86_memio_map(t, bpa, size, flags, bshp)
- bus_space_tag_t t;
- bus_addr_t bpa;
- bus_size_t size;
- int flags;
- bus_space_handle_t *bshp;
-{
-
- /*
- * For I/O space, just fill in the handle.
- */
- if (t == X86_BUS_SPACE_IO) {
- if (flags & BUS_SPACE_MAP_LINEAR)
- return (EOPNOTSUPP);
- *bshp = bpa;
- return (0);
- }
-
- /*
- * For memory space, map the bus physical address to
- * a kernel virtual address.
- */
- return (x86_mem_add_mapping(bpa, size,
- (flags & BUS_SPACE_MAP_CACHEABLE) != 0, bshp));
-}
-
-int
-x86_memio_alloc(t, rstart, rend, size, alignment, boundary, flags,
- bpap, bshp)
- bus_space_tag_t t;
- bus_addr_t rstart, rend;
- bus_size_t size, alignment, boundary;
- int flags;
- bus_addr_t *bpap;
- bus_space_handle_t *bshp;
-{
- struct extent *ex;
- u_long bpa;
- int error;
-
- /*
- * Pick the appropriate extent map.
- */
- if (t == X86_BUS_SPACE_IO) {
- if (flags & BUS_SPACE_MAP_LINEAR)
- return (EOPNOTSUPP);
- ex = ioport_ex;
- } else if (t == X86_BUS_SPACE_MEM)
- ex = iomem_ex;
- else
- panic("x86_memio_alloc: bad bus space tag");
-
- /*
- * Sanity check the allocation against the extent's boundaries.
- */
- if (rstart < ex->ex_start || rend > ex->ex_end)
- panic("x86_memio_alloc: bad region start/end");
-
- /*
- * Do the requested allocation.
- */
- error = extent_alloc_subregion(ex, rstart, rend, size, alignment,
- boundary,
- EX_FAST | EX_NOWAIT | (ioport_malloc_safe ? EX_MALLOCOK : 0),
- &bpa);
-
- if (error)
- return (error);
-
- /*
- * For I/O space, that's all she wrote.
- */
- if (t == X86_BUS_SPACE_IO) {
- *bshp = *bpap = bpa;
- return (0);
- }
-
- /*
- * For memory space, map the bus physical address to
- * a kernel virtual address.
- */
- error = x86_mem_add_mapping(bpa, size,
- (flags & BUS_SPACE_MAP_CACHEABLE) != 0, bshp);
- if (error) {
- if (extent_free(iomem_ex, bpa, size, EX_NOWAIT |
- (ioport_malloc_safe ? EX_MALLOCOK : 0))) {
- printf("x86_memio_alloc: pa 0x%lx, size 0x%lx\n",
- bpa, size);
- printf("x86_memio_alloc: can't free region\n");
- }
- }
-
- *bpap = bpa;
-
- return (error);
-}
-
-int
-x86_mem_add_mapping(bpa, size, cacheable, bshp)
- bus_addr_t bpa;
- bus_size_t size;
- int cacheable;
- bus_space_handle_t *bshp;
-{
- u_long pa, endpa;
- vaddr_t va;
- pt_entry_t *pte;
- int32_t cpumask = 0;
-
- pa = x86_trunc_page(bpa);
- endpa = x86_round_page(bpa + size);
-
-#ifdef DIAGNOSTIC
- if (endpa <= pa)
- panic("x86_mem_add_mapping: overflow");
-#endif
-
- va = uvm_km_valloc(kernel_map, endpa - pa);
- if (va == 0)
- return (ENOMEM);
Home |
Main Index |
Thread Index |
Old Index