Cleanup
This commit is contained in:
parent
20c7e5582c
commit
c148a69816
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: obio.c,v 1.14 1994/12/12 18:59:22 gwr Exp $ */
|
||||
/* $NetBSD: obio.c,v 1.15 1995/01/11 20:38:23 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
|
@ -160,8 +160,8 @@ static void save_prom_mappings()
|
|||
}
|
||||
|
||||
/*
|
||||
* These are all the OBIO address that are required early
|
||||
* in the life of the kernel. All are less one page long.
|
||||
* These are all the OBIO address that are required early in
|
||||
* the life of the kernel. All are less than one page long.
|
||||
*/
|
||||
static vm_offset_t required_mappings[] = {
|
||||
/* Basically the first six OBIO devices. */
|
||||
|
@ -222,7 +222,7 @@ caddr_t obio_alloc(obio_addr, obio_size)
|
|||
panic("obio_alloc: attempt to allocate 0 pages for obio");
|
||||
va = high_segment_alloc(npages);
|
||||
if (!va)
|
||||
va = (vm_offset_t) obio_vm_alloc(npages);
|
||||
va = (vm_offset_t) dvma_vm_alloc(npages);
|
||||
if (!va)
|
||||
panic("obio_alloc: unable to allocate va for obio mapping");
|
||||
/* Drivers always get writable, non-cached mappings. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: zs.c,v 1.18 1994/12/21 23:56:43 gwr Exp $ */
|
||||
/* $NetBSD: zs.c,v 1.19 1995/01/11 20:38:25 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
|
@ -230,7 +230,6 @@ zs_match(struct device *parent, void *vcf, void *args)
|
|||
if (ca->ca_intpri == -1)
|
||||
ca->ca_intpri = ZSHARD_PRI;
|
||||
|
||||
/* The peek returns non-zero on error. */
|
||||
x = bus_peek(ca->ca_bustype, ca->ca_paddr, 1);
|
||||
return (x != -1);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: autoconf.h,v 1.8 1994/12/13 18:26:39 gwr Exp $ */
|
||||
/* $NetBSD: autoconf.h,v 1.9 1995/01/11 20:38:33 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
|
@ -58,3 +58,4 @@ int always_match __P((struct device *, void *, void *));
|
|||
void bus_scan __P((struct device *, void *, int));
|
||||
int bus_print __P((void *, char *));
|
||||
int bus_peek __P((int, int, int));
|
||||
char * bus_mapin __P((int, int, int));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $NetBSD: isr.h,v 1.7 1994/12/12 18:59:40 gwr Exp $ */
|
||||
/* $NetBSD: isr.h,v 1.8 1995/01/11 20:38:34 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
* Copyright (c) 1993 Adam Glass
|
||||
* Copyright (c) 1982 Regents of the University of California.
|
||||
* All rights reserved.
|
||||
|
@ -37,16 +38,6 @@
|
|||
* isr.h,v 1.2 1993/05/22 07:57:26 cgd Exp
|
||||
*/
|
||||
|
||||
struct isr {
|
||||
struct isr *isr_forw;
|
||||
struct isr *isr_back;
|
||||
int (*isr_intr)();
|
||||
void *isr_arg;
|
||||
int isr_ipl;
|
||||
};
|
||||
|
||||
#define NISR 8
|
||||
|
||||
void isr_init __P((void));
|
||||
void isr_cleanup __P((void));
|
||||
void isr_add_custom __P((int, void (*handler)()));
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: autoconf.c,v 1.19 1994/12/20 05:30:29 gwr Exp $ */
|
||||
/* $NetBSD: autoconf.c,v 1.20 1995/01/11 20:39:14 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
|
@ -108,7 +108,6 @@ void configure()
|
|||
/* Install non-device interrupt handlers. */
|
||||
isr_add_autovect(nmi_intr, 0, 7);
|
||||
isr_add_autovect(soft1intr, 0, 1);
|
||||
isr_cleanup();
|
||||
|
||||
/* Now ready for interrupts. */
|
||||
(void)spl0();
|
||||
|
@ -210,6 +209,15 @@ bus_print(args, name)
|
|||
return(QUIET);
|
||||
}
|
||||
|
||||
extern vm_offset_t tmp_vpages[];
|
||||
extern int fubyte(), fusword(), fuword();
|
||||
static const int bustype_to_ptetype[4] = {
|
||||
PGT_OBMEM,
|
||||
PGT_OBIO,
|
||||
PGT_VME_D16,
|
||||
PGT_VME_D32,
|
||||
};
|
||||
|
||||
/*
|
||||
* Read addr with size len (1,2,4) into val.
|
||||
* If this generates a bus error, return -1
|
||||
|
@ -218,8 +226,6 @@ bus_print(args, name)
|
|||
* Try the access using fu{byte,sword,word}
|
||||
* Clean up temp. mapping
|
||||
*/
|
||||
extern vm_offset_t tmp_vpages[];
|
||||
extern int fubyte(), fusword(), fuword();
|
||||
int bus_peek(bustype, paddr, sz)
|
||||
int bustype, paddr, sz;
|
||||
{
|
||||
|
@ -227,28 +233,14 @@ int bus_peek(bustype, paddr, sz)
|
|||
vm_offset_t pgva;
|
||||
caddr_t va;
|
||||
|
||||
if (bustype & ~3)
|
||||
return -1;
|
||||
|
||||
off = paddr & PGOFSET;
|
||||
paddr -= off;
|
||||
pte = PA_PGNUM(paddr);
|
||||
|
||||
#define PG_PEEK PG_VALID | PG_WRITE | PG_SYSTEM | PG_NC
|
||||
switch (bustype) {
|
||||
case BUS_OBMEM:
|
||||
pte |= (PG_PEEK | PGT_OBMEM);
|
||||
break;
|
||||
case BUS_OBIO:
|
||||
pte |= (PG_PEEK | PGT_OBIO);
|
||||
break;
|
||||
case BUS_VME16:
|
||||
pte |= (PG_PEEK | PGT_VME_D16);
|
||||
break;
|
||||
case BUS_VME32:
|
||||
pte |= (PG_PEEK | PGT_VME_D32);
|
||||
break;
|
||||
default:
|
||||
return (-1);
|
||||
}
|
||||
#undef PG_PEEK
|
||||
pte |= bustype_to_ptetype[bustype];
|
||||
pte |= (PG_VALID | PG_WRITE | PG_SYSTEM | PG_NC);
|
||||
|
||||
pgva = tmp_vpages[0];
|
||||
va = (caddr_t)pgva + off;
|
||||
|
@ -275,3 +267,40 @@ int bus_peek(bustype, paddr, sz)
|
|||
|
||||
return rv;
|
||||
}
|
||||
|
||||
static const int bustype_to_pmaptype[4] = {
|
||||
0,
|
||||
PMAP_OBIO,
|
||||
PMAP_VME16,
|
||||
PMAP_VME32,
|
||||
};
|
||||
|
||||
extern caddr_t dvma_vm_alloc();
|
||||
|
||||
char *
|
||||
bus_mapin(bustype, paddr, sz)
|
||||
int bustype, paddr, sz;
|
||||
{
|
||||
int off, pa, pgs;
|
||||
caddr_t va;
|
||||
|
||||
if (bustype & ~3)
|
||||
return (NULL);
|
||||
|
||||
off = paddr & PGOFSET;
|
||||
pa = paddr & ~PGOFSET;
|
||||
pa |= bustype_to_pmaptype[bustype];
|
||||
pa |= PMAP_NC;
|
||||
|
||||
/* Get some DVMA space. */
|
||||
pgs = btoc(sz);
|
||||
va = dvma_vm_alloc(pgs);
|
||||
if (va == NULL)
|
||||
return (NULL);
|
||||
|
||||
/* Map it to the specified bus. */
|
||||
pmap_map((int)va, pa, pa + ctob(pgs),
|
||||
VM_PROT_READ | VM_PROT_WRITE);
|
||||
|
||||
return (va + off);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locore2.c,v 1.29 1994/12/13 18:43:03 gwr Exp $ */
|
||||
/* $NetBSD: locore2.c,v 1.30 1995/01/11 20:39:19 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
|
@ -85,17 +85,18 @@ vm_offset_t proc0_user_pa;
|
|||
struct user *proc0paddr; /* proc[0] pcb address (u-area VA) */
|
||||
extern struct pcb *curpcb;
|
||||
|
||||
/*
|
||||
* Switch to our own interrupt vector table, but
|
||||
* keep the PROM's NMI handler until clock_init
|
||||
*/
|
||||
static void initialize_vector_table()
|
||||
{
|
||||
int i;
|
||||
|
||||
int nmivec = AUTO_VECTOR_BASE + 7;
|
||||
|
||||
old_vector_table = getvbr();
|
||||
for (i = 0; i < NVECTORS; i++) {
|
||||
if (vector_table[i] == COPY_ENTRY)
|
||||
set_vector_entry(i, (void(*)())old_vector_table[i]);
|
||||
}
|
||||
orig_nmi_vector = old_vector_table[nmivec];
|
||||
vector_table[nmivec] = (void (*)()) orig_nmi_vector;
|
||||
setvbr((unsigned int *) vector_table);
|
||||
orig_nmi_vector = get_vector_entry(AUTO_VECTOR_BASE+7);
|
||||
}
|
||||
|
||||
vm_offset_t high_segment_alloc(npages)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: obio.c,v 1.14 1994/12/12 18:59:22 gwr Exp $ */
|
||||
/* $NetBSD: obio.c,v 1.15 1995/01/11 20:38:23 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
|
@ -160,8 +160,8 @@ static void save_prom_mappings()
|
|||
}
|
||||
|
||||
/*
|
||||
* These are all the OBIO address that are required early
|
||||
* in the life of the kernel. All are less one page long.
|
||||
* These are all the OBIO address that are required early in
|
||||
* the life of the kernel. All are less than one page long.
|
||||
*/
|
||||
static vm_offset_t required_mappings[] = {
|
||||
/* Basically the first six OBIO devices. */
|
||||
|
@ -222,7 +222,7 @@ caddr_t obio_alloc(obio_addr, obio_size)
|
|||
panic("obio_alloc: attempt to allocate 0 pages for obio");
|
||||
va = high_segment_alloc(npages);
|
||||
if (!va)
|
||||
va = (vm_offset_t) obio_vm_alloc(npages);
|
||||
va = (vm_offset_t) dvma_vm_alloc(npages);
|
||||
if (!va)
|
||||
panic("obio_alloc: unable to allocate va for obio mapping");
|
||||
/* Drivers always get writable, non-cached mappings. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pmap.c,v 1.42 1994/12/12 19:00:06 gwr Exp $ */
|
||||
/* $NetBSD: pmap.c,v 1.43 1995/01/11 20:39:16 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
|
@ -15,21 +15,21 @@
|
|||
* 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
|
||||
* This product includes software developed by:
|
||||
* Adam Glass, Gordon Ross
|
||||
* 4. The name 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 Adam Glass ``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.
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -38,9 +38,6 @@
|
|||
* debugging support
|
||||
* locking protocols
|
||||
*
|
||||
* Make a call for the trap handler to use to quickly reload
|
||||
* a PMEG that is in pm_segmap but not in HW segmap.
|
||||
* (just call pmeg_cache(), and if found, load it)
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -1560,8 +1557,8 @@ pmap_init()
|
|||
vm_offset_t
|
||||
pmap_map(virt, start, end, prot)
|
||||
vm_offset_t virt;
|
||||
vm_offset_t start;
|
||||
vm_offset_t end;
|
||||
vm_offset_t start; /* physical */
|
||||
vm_offset_t end; /* physical */
|
||||
int prot;
|
||||
{
|
||||
while (start < end) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sun3_startup.c,v 1.29 1994/12/13 18:43:03 gwr Exp $ */
|
||||
/* $NetBSD: sun3_startup.c,v 1.30 1995/01/11 20:39:19 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
|
@ -85,17 +85,18 @@ vm_offset_t proc0_user_pa;
|
|||
struct user *proc0paddr; /* proc[0] pcb address (u-area VA) */
|
||||
extern struct pcb *curpcb;
|
||||
|
||||
/*
|
||||
* Switch to our own interrupt vector table, but
|
||||
* keep the PROM's NMI handler until clock_init
|
||||
*/
|
||||
static void initialize_vector_table()
|
||||
{
|
||||
int i;
|
||||
|
||||
int nmivec = AUTO_VECTOR_BASE + 7;
|
||||
|
||||
old_vector_table = getvbr();
|
||||
for (i = 0; i < NVECTORS; i++) {
|
||||
if (vector_table[i] == COPY_ENTRY)
|
||||
set_vector_entry(i, (void(*)())old_vector_table[i]);
|
||||
}
|
||||
orig_nmi_vector = old_vector_table[nmivec];
|
||||
vector_table[nmivec] = (void (*)()) orig_nmi_vector;
|
||||
setvbr((unsigned int *) vector_table);
|
||||
orig_nmi_vector = get_vector_entry(AUTO_VECTOR_BASE+7);
|
||||
}
|
||||
|
||||
vm_offset_t high_segment_alloc(npages)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: trap.c,v 1.35 1994/12/02 06:20:54 gwr Exp $ */
|
||||
/* $NetBSD: trap.c,v 1.36 1995/01/11 20:39:21 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
|
@ -380,8 +380,7 @@ trap(type, code, v, frame)
|
|||
}
|
||||
/*FALLTHROUGH*/
|
||||
|
||||
case T_MMUFLT|T_USER: /* page fault */
|
||||
{
|
||||
case T_MMUFLT|T_USER: { /* page fault */
|
||||
register vm_offset_t va;
|
||||
register struct vmspace *vm = p->p_vmspace;
|
||||
register vm_map_t map;
|
||||
|
@ -397,14 +396,14 @@ trap(type, code, v, frame)
|
|||
|
||||
/*
|
||||
* It is only a kernel address space fault iff:
|
||||
* 1. (type & T_USER) == 0 and
|
||||
* 1. (type & T_USER) == 0 and: (2 or 3)
|
||||
* 2. pcb_onfault not set or
|
||||
* 3. pcb_onfault set but supervisor space data fault
|
||||
* The last can occur during an exec() copyin where the
|
||||
* argument space is lazy-allocated.
|
||||
*/
|
||||
map = &vm->vm_map;
|
||||
if (type == T_MMUFLT) {
|
||||
if ((type & T_USER) == 0) {
|
||||
/* supervisor mode fault */
|
||||
if ((p->p_addr->u_pcb.pcb_onfault == NULL) || KDFAULT(code))
|
||||
map = kernel_map;
|
||||
|
@ -453,7 +452,6 @@ trap(type, code, v, frame)
|
|||
if (mmudebug & MDB_WBFAILED)
|
||||
Debugger();
|
||||
#endif /* DDB */
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
#ifdef VMFAULT_TRACE
|
||||
printf("vm_fault(%x, %x, %x, 0) -> %x\n",
|
||||
|
@ -482,7 +480,8 @@ trap(type, code, v, frame)
|
|||
if (rv == KERN_SUCCESS)
|
||||
goto finish;
|
||||
|
||||
if (type == T_MMUFLT) {
|
||||
if ((type & T_USER) == 0) {
|
||||
/* supervisor mode fault */
|
||||
if (p->p_addr->u_pcb.pcb_onfault) {
|
||||
#ifdef DEBUG
|
||||
if (mmudebug & MDB_CPFAULT) {
|
||||
|
@ -499,8 +498,8 @@ trap(type, code, v, frame)
|
|||
ucode = v;
|
||||
sig = (rv == KERN_PROTECTION_FAILURE) ? SIGBUS : SIGSEGV;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} /* T_MMUFLT */
|
||||
} /* switch */
|
||||
|
||||
finish:
|
||||
/* If trap was from supervisor mode, just return. */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: vm_machdep.c,v 1.21 1994/11/28 19:17:14 gwr Exp $ */
|
||||
/* $NetBSD: vm_machdep.c,v 1.22 1995/01/11 20:39:22 gwr Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1994 Gordon W. Ross
|
||||
|
@ -283,21 +283,23 @@ caddr_t dvma_malloc(size)
|
|||
return new_mem;
|
||||
}
|
||||
|
||||
caddr_t obio_vm_alloc(npages)
|
||||
caddr_t dvma_vm_alloc(npages)
|
||||
int npages;
|
||||
{
|
||||
vm_size_t size;
|
||||
vm_offset_t addr;
|
||||
int result;
|
||||
|
||||
if (npages == 0);
|
||||
if (npages <= 0)
|
||||
panic("dvma_vm_alloc(0)");
|
||||
|
||||
/* XXX - Should this use kmem_alloc_wait() instead? -gwr */
|
||||
size = npages*NBPG;
|
||||
addr = vm_map_min(phys_map);
|
||||
result = vm_map_find(phys_map, NULL, (vm_offset_t) 0, &addr, size, TRUE);
|
||||
if (result != KERN_SUCCESS) return NULL;
|
||||
vm_map_lock(phys_map);
|
||||
vm_map_delete(phys_map, addr, addr+size);
|
||||
vm_map_unlock(phys_map);
|
||||
if (result != KERN_SUCCESS)
|
||||
return NULL;
|
||||
vm_map_remove(phys_map, addr, addr+size);
|
||||
return (caddr_t) addr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue