diff options
author | Dale S. Rahn <rahnds@cvs.openbsd.org> | 1999-11-09 04:13:55 +0000 |
---|---|---|
committer | Dale S. Rahn <rahnds@cvs.openbsd.org> | 1999-11-09 04:13:55 +0000 |
commit | 03d4fb716427823837399569ed28e97ba72a2c87 (patch) | |
tree | 1cc2a7d33389cbb734eeebdfadf25b3aa635df9b | |
parent | 5e5bf313585557019b4eca25c977aa529dd6e86e (diff) |
autoconf.h
add mac hooks to the powerpc config structure, probably
a hack, and certainly needs to be cleaned up.
bus.h
p4e_ -> ppc_X
add write_multi and prototypes for bus_space_X_raw_multi functions.
intr.h
add structure for interrupt handler.
pio.h
remove the unnecessary and slowing "sync" instruction from
each pio access.
remove unnecessary newline characters from the generated asm.
eieio after writes, but before reads.
types.h
formatting change
vmparam.h
change powerpc kernel virtual memory sizing from a fixed segment
to a variable, initialized with a segment size, this is
so that the pmap allocator can steal virtual memory, if vm
is not yet set up. Necessary for mapping devices before the
kernel vm structures are initialized.
-rw-r--r-- | sys/arch/powerpc/include/autoconf.h | 14 | ||||
-rw-r--r-- | sys/arch/powerpc/include/bus.h | 110 | ||||
-rw-r--r-- | sys/arch/powerpc/include/intr.h | 17 | ||||
-rw-r--r-- | sys/arch/powerpc/include/pio.h | 31 | ||||
-rw-r--r-- | sys/arch/powerpc/include/types.h | 6 | ||||
-rw-r--r-- | sys/arch/powerpc/include/vmparam.h | 21 |
6 files changed, 123 insertions, 76 deletions
diff --git a/sys/arch/powerpc/include/autoconf.h b/sys/arch/powerpc/include/autoconf.h index 652bc8c0d16..b5a8618016d 100644 --- a/sys/arch/powerpc/include/autoconf.h +++ b/sys/arch/powerpc/include/autoconf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: autoconf.h,v 1.5 1999/07/05 21:01:19 rahnds Exp $ */ +/* $OpenBSD: autoconf.h,v 1.6 1999/11/09 04:13:54 rahnds Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -38,6 +38,8 @@ #ifndef _MACHINE_AUTOCONF_H_ #define _MACHINE_AUTOCONF_H_ +#include <machine/bus.h> + /* * System types. */ @@ -81,6 +83,16 @@ typedef struct bushook { struct confargs { char *ca_name; /* Device name. */ bushook_t *ca_bus; /* bus device resides on. */ + /* macobio hooks ?? */ + bus_space_tag_t ca_iot; + bus_space_tag_t ca_memt; /* XXX */ + u_int32_t ca_node; + int ca_nreg; + u_int32_t *ca_reg; + int ca_nintr; + int32_t *ca_intr; + u_int ca_baseaddr; + }; void set_clockintr __P((void (*)(struct clockframe *))); diff --git a/sys/arch/powerpc/include/bus.h b/sys/arch/powerpc/include/bus.h index 12c39ff87db..f1f1d7dbb05 100644 --- a/sys/arch/powerpc/include/bus.h +++ b/sys/arch/powerpc/include/bus.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bus.h,v 1.3 1998/08/25 07:43:40 pefo Exp $ */ +/* $OpenBSD: bus.h,v 1.4 1999/11/09 04:13:54 rahnds Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom. All rights reserved. @@ -50,25 +50,25 @@ typedef u_int32_t bus_addr_t; typedef u_int32_t bus_size_t; typedef u_int32_t bus_space_handle_t; -typedef struct p4e_bus_space *bus_space_tag_t; +typedef struct ppc_bus_space *bus_space_tag_t; -struct p4e_bus_space { +struct ppc_bus_space { u_int32_t bus_base; u_int8_t bus_reverse; /* Reverse bytes */ }; +#define POWERPC_BUS_TAG_BASE(x) ((x)->bus_base) -extern struct p4e_bus_space p4e_isa_io, p4e_isa_mem; +extern struct ppc_bus_space ppc_isa_io, ppc_isa_mem; /* * Access methods for bus resources */ -#define bus_space_map(t, addr, size, cacheable, bshp) \ - ((*(bshp) = (t)->bus_base + (addr)), 0) - -#define bus_space_unmap(t, bsh, size) - -#define bus_space_addr(bshp, offs) \ - ((vm_offset_t)((bshp) + (offs))) +int bus_space_map __P((bus_space_tag_t t, bus_addr_t addr, + bus_size_t size, int cacheable, bus_space_handle_t *bshp)); +void bus_space_unmap __P((bus_space_tag_t t, bus_space_handle_t bsh, + bus_size_t size)); +int bus_space_subregion __P((bus_space_tag_t t, bus_space_handle_t bsh, + bus_size_t offset, bus_size_t size, bus_space_handle_t *nbshp)); #define bus_space_read(n,m) \ static __inline CAT3(u_int,m,_t) \ @@ -87,20 +87,6 @@ bus_space_read(4,32) #define bus_space_read_8 !!! bus_space_read_8 unimplemented !!! -#define bus_space_read_multi_1(t, h, o, a, c) do { \ - insb((u_int8_t *)((h) + (o)), (a), (c)); \ - } while(0) - -#define bus_space_read_multi_2(t, h, o, a, c) do { \ - insw((u_int16_t *)((h) + (o)), (a), (c)); \ - } while(0) - -#define bus_space_read_multi_4(t, h, o, a, c) do { \ - insl((u_int32_t *)((h) + (o)), (a), (c)); \ - } while(0) - -#define bus_space_read_multi_8 !!! bus_space_read_multi_8 not implemented !!! - #define bus_space_write(n,m) \ static __inline void \ CAT(bus_space_write_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ @@ -118,48 +104,62 @@ bus_space_write(4,32) #define bus_space_write_8 !!! bus_space_write_8 unimplemented !!! +#define bus_space_read_multi(n, m) \ +static __inline void \ +CAT(bus_space_read_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ + bus_size_t ba, CAT3(u_int,m,_t) *buf, bus_size_t cnt) \ +{ \ + while (cnt--) \ + *buf++ = CAT(bus_space_read_,n)(bst, bsh, ba); \ +} -#define bus_space_write_multi_1(t, h, o, a, c) do { \ - outsb((u_int8_t *)((h) + (o)), (a), (c)); \ - } while(0) +bus_space_read_multi(1,8) +bus_space_read_multi(2,16) +bus_space_read_multi(4,32) -#define bus_space_write_multi_2(t, h, o, a, c) do { \ - outsw((u_int16_t *)((h) + (o)), (a), (c)); \ - } while(0) +#define bus_space_read_multi_8 !!! bus_space_read_multi_8 not implemented !!! -#define bus_space_write_multi_4(t, h, o, a, c) do { \ - outsl((u_int32_t *)((h) + (o)), (a), (c)); \ - } while(0) #define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!! -/* These are OpenBSD extensions to the general NetBSD bus interface. */ -#define bus_space_read_raw_multi(n,m,l) \ -static __inline void \ -CAT(bus_space_read_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ - bus_addr_t ba, u_int8_t *buf, bus_size_t cnt) \ +#define bus_space_write_multi(n, m) \ +static __inline void \ +CAT(bus_space_write_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh, \ + bus_size_t ba, const CAT3(u_int,m,_t) *buf, bus_size_t cnt) \ { \ - CAT(bus_space_read_multi_,n)(bst, bsh, ba, (CAT3(u_int,m,_t) *)buf, \ - cnt >> l); \ + while (cnt--) \ + CAT(bus_space_write_,n)(bst, bsh, ba, *buf++); \ } -bus_space_read_raw_multi(2,16,1) -bus_space_read_raw_multi(4,32,2) +bus_space_write_multi(1,8) +bus_space_write_multi(2,16) +bus_space_write_multi(4,32) -#define bus_space_read_raw_multi_8 \ - !!! bus_space_read_raw_multi_8 not implemented !!! +#define bus_space_write_multi_8 !!! bus_space_write_multi_8 not implemented !!! -#define bus_space_write_raw_multi(n,m,l) \ -static __inline void \ -CAT(bus_space_write_raw_multi_,n)(bus_space_tag_t bst, bus_space_handle_t bsh,\ - bus_addr_t ba, const u_int8_t *buf, bus_size_t cnt) \ -{ \ - CAT(bus_space_write_multi_,n)(bst, bsh, ba, \ - (const CAT3(u_int,m,_t) *)buf, cnt >> l); \ -} +/* These are OpenBSD extensions to the general NetBSD bus interface. */ +void +bus_space_read_raw_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh, + bus_addr_t ba, u_int8_t *dst, bus_size_t size); +void +bus_space_read_raw_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, + bus_addr_t ba, u_int16_t *dst, bus_size_t size); +void +bus_space_read_raw_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, + bus_addr_t ba, u_int32_t *dst, bus_size_t size); + +void +bus_space_write_raw_multi_1(bus_space_tag_t bst, bus_space_handle_t bsh, + bus_addr_t ba, const u_int8_t *src, bus_size_t size); +void +bus_space_write_raw_multi_2(bus_space_tag_t bst, bus_space_handle_t bsh, + bus_addr_t ba, const u_int16_t *src, bus_size_t size); +void +bus_space_write_raw_multi_4(bus_space_tag_t bst, bus_space_handle_t bsh, + bus_addr_t ba, const u_int32_t *src, bus_size_t size); -bus_space_write_raw_multi(2,16,1) -bus_space_write_raw_multi(4,32,2) +#define bus_space_read_raw_multi_8 \ + !!! bus_space_read_raw_multi_8 not implemented !!! #define bus_space_write_raw_multi_8 \ !!! bus_space_write_raw_multi_8 not implemented !!! diff --git a/sys/arch/powerpc/include/intr.h b/sys/arch/powerpc/include/intr.h index 286226404b2..0e6f948b670 100644 --- a/sys/arch/powerpc/include/intr.h +++ b/sys/arch/powerpc/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.3 1998/10/09 02:06:40 rahnds Exp $ */ +/* $OpenBSD: intr.h,v 1.4 1999/11/09 04:13:54 rahnds Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA. @@ -144,6 +144,21 @@ set_sint(pending) #define splhigh() splraise(0xffffffff) #define spl0() spllower(0) +/* + * Interrupt control struct used to control the ICU setup. + */ + +struct intrhand { + struct intrhand *ih_next; + int (*ih_fun) __P((void *)); + void *ih_arg; + u_long ih_count; + int ih_level; + int ih_irq; + char *ih_what; +}; + #endif /* _LOCORE */ + #endif /* _MACHINE_INTR_H_ */ diff --git a/sys/arch/powerpc/include/pio.h b/sys/arch/powerpc/include/pio.h index 4d411f3bef6..90be285be5e 100644 --- a/sys/arch/powerpc/include/pio.h +++ b/sys/arch/powerpc/include/pio.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pio.h,v 1.3 1998/08/25 07:45:28 pefo Exp $ */ +/* $OpenBSD: pio.h,v 1.4 1999/11/09 04:13:54 rahnds Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA. @@ -37,6 +37,7 @@ /* * I/O macros. */ +void *mapiodev(paddr_t pa, psize_t len); static __inline void __outb(a,v) @@ -44,7 +45,7 @@ __outb(a,v) int v; { *a = v; - __asm__ volatile("eieio\n sync"); + __asm__ volatile("eieio"); } static __inline void @@ -53,7 +54,7 @@ __outw(a,v) u_int16_t v; { *a = v; - __asm__ volatile("eieio\n sync"); + __asm__ volatile("eieio"); } static __inline void @@ -62,7 +63,7 @@ __outl(a,v) int v; { *a = v; - __asm__ volatile("eieio\n sync"); + __asm__ volatile("eieio"); } static __inline void @@ -72,8 +73,8 @@ __outwrb(a,v) { u_int32_t _p_ = (u_int32_t)a; - __asm__ volatile("sthbrx %0, 0, %1\n" :: "r"(v), "r"(_p_)); - __asm__ volatile("eieio\n sync"); + __asm__ volatile("sthbrx %0, 0, %1" :: "r"(v), "r"(_p_)); + __asm__ volatile("eieio"); } static __inline void @@ -83,8 +84,8 @@ __outlrb(a,v) { u_int32_t _p_ = (u_int32_t)a; - __asm__ volatile("stwbrx %0, 0, %1\n" :: "r"(v), "r"(_p_)); - __asm__ volatile("eieio\n sync"); + __asm__ volatile("stwbrx %0, 0, %1" :: "r"(v), "r"(_p_)); + __asm__ volatile("eieio"); } static __inline u_int8_t @@ -93,8 +94,8 @@ __inb(a) { u_int8_t _v_; + __asm__ volatile("eieio"); _v_ = *a; - __asm__ volatile("eieio\n sync"); return _v_; } @@ -104,8 +105,8 @@ __inw(a) { u_int16_t _v_; + __asm__ volatile("eieio"); _v_ = *a; - __asm__ volatile("eieio\n sync"); return _v_; } @@ -115,8 +116,8 @@ __inl(a) { u_int32_t _v_; + __asm__ volatile("eieio"); _v_ = *a; - __asm__ volatile("eieio\n sync"); return _v_; } @@ -127,8 +128,8 @@ __inwrb(a) u_int16_t _v_; u_int32_t _p_ = (u_int32_t)a; - __asm__ volatile("lhbrx %0, 0, %1\n" : "=r"(_v_) : "r"(_p_)); - __asm__ volatile("eieio\n sync"); + __asm__ volatile("eieio"); + __asm__ volatile("lhbrx %0, 0, %1" : "=r"(_v_) : "r"(_p_)); return _v_; } @@ -139,8 +140,8 @@ __inlrb(a) u_int32_t _v_; u_int32_t _p_ = (u_int32_t)a; - __asm__ volatile("lwbrx %0, 0, %1\n" : "=r"(_v_) : "r"(_p_)); - __asm__ volatile("eieio\n sync"); + __asm__ volatile("eieio"); + __asm__ volatile("lwbrx %0, 0, %1" : "=r"(_v_) : "r"(_p_)); return _v_; } diff --git a/sys/arch/powerpc/include/types.h b/sys/arch/powerpc/include/types.h index 523f06c7788..30f94d0dad1 100644 --- a/sys/arch/powerpc/include/types.h +++ b/sys/arch/powerpc/include/types.h @@ -1,5 +1,5 @@ /* $NetBSD: types.h,v 1.1 1996/09/30 16:34:36 ws Exp $ */ -/* $OpenBSD: types.h,v 1.8 1999/07/07 23:16:41 art Exp $ */ +/* $OpenBSD: types.h,v 1.9 1999/11/09 04:13:54 rahnds Exp $ */ /*- * Copyright (C) 1995 Wolfgang Solfrank. @@ -53,8 +53,8 @@ typedef unsigned long long uint64_t; typedef u_int32_t register_t; -typedef unsigned long vm_size_t; -typedef unsigned long vm_offset_t; +typedef unsigned long vm_size_t; +typedef unsigned long vm_offset_t; typedef unsigned long vaddr_t; typedef unsigned long paddr_t; diff --git a/sys/arch/powerpc/include/vmparam.h b/sys/arch/powerpc/include/vmparam.h index 234dc1ba566..0f70ea14760 100644 --- a/sys/arch/powerpc/include/vmparam.h +++ b/sys/arch/powerpc/include/vmparam.h @@ -90,11 +90,30 @@ #define VM_MAXUSER_ADDRESS ((vm_offset_t)0xfffff000) #define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS #define VM_MIN_KERNEL_ADDRESS ((vm_offset_t)(KERNEL_SR << ADDR_SR_SHFT)) + +/* ppc_kvm_size is so that vm space can be stolen before vm is fully + * initialized. + */ +#define VM_KERN_ADDR_SIZE_DEF SEGMENT_LENGTH +extern vm_offset_t ppc_kvm_size; +#define VM_KERN_ADDRESS_SIZE (ppc_kvm_size) #define VM_MAX_KERNEL_ADDRESS ((vm_offset_t)((KERNEL_SR << ADDR_SR_SHFT) \ - + SEGMENT_LENGTH)) + + VM_KERN_ADDRESS_SIZE)) #define MACHINE_NONCONTIG /* VM <=> pmap interface modifier */ #define VM_KMEM_SIZE (NKMEMCLUSTERS * CLBYTES) #define VM_MBUF_SIZE (NMBCLUSTERS * CLBYTES) #define VM_PHYS_SIZE (USRIOSIZE * CLBYTES) + +struct pmap_physseg { + /* NULL ??? */ +}; + +#define VM_PHYSSEG_MAX 32 /* actually we could have this many segments */ +#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH +#define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */ + +#define VM_NFREELIST 1 +#define VM_FREELIST_DEFAULT 0 + |