Commit Graph

315 Commits

Author SHA1 Message Date
Julian Elischer
5b8c0a2993 Catch up with i386 change I forgot to commit. 2002-02-19 03:23:28 +00:00
Mike Barcroft
fd8e4ebc8c o Move NTOHL() and associated macros into <sys/param.h>. These are
deprecated in favor of the POSIX-defined lowercase variants.
o Change all occurrences of NTOHL() and associated marcros in the
  source tree to use the lowercase function variants.
o Add missing license bits to sparc64's <machine/endian.h>.
  Approved by: jake
o Clean up <machine/endian.h> files.
o Remove unused __uint16_swap_uint32() from i386's <machine/endian.h>.
o Remove prototypes for non-existent bswapXX() functions.
o Include <machine/endian.h> in <arpa/inet.h> to define the
  POSIX-required ntohl() family of functions.
o Do similar things to expose the ntohl() family in libstand, <netinet/in.h>,
  and <sys/param.h>.
o Prepend underscores to the ntohl() family to help deal with
  complexities associated with having MD (asm and inline) versions, and
  having to prevent exposure of these functions in other headers that
  happen to make use of endian-specific defines.
o Create weak aliases to the canonical function name to help deal with
  third-party software forgetting to include an appropriate header.
o Remove some now unneeded pollution from <sys/types.h>.
o Add missing <arpa/inet.h> includes in userland.

Tested on:	alpha, i386
Reviewed by:	bde, jake, tmm
2002-02-18 20:35:27 +00:00
Garrett Wollman
3b7a4c4b1d Resurrect one of the easiest changes from my big include files roll-up
patch from a year ago: give file flags their own type.  This does not
(yet) change the type used by system calls or library functions.
The underlying type was chosen to match what is returned by stat().
2002-02-15 22:15:39 +00:00
Thomas Moestl
5dc4151c36 Add a delta missed in the last iommu.c commit. This unbreaks the sparc64
kernel build.

Pointy hat to:	tmm
2002-02-15 14:48:54 +00:00
Thomas Moestl
89a87417d6 Calculate physmem before calling init_param2().
Submitted by:	jake
2002-02-13 17:05:56 +00:00
Thomas Moestl
9a60579c15 Avoid crashing in early boot when WITNESS is enabled by moving the
mtx_init() for intr_table_lock after the globaldata pointer
initialization.
2002-02-13 16:36:44 +00:00
Thomas Moestl
54a7de96bc Add the counter-timer node to the exclusion list, as it is handled
specially. While being there, sort that list.
2002-02-13 16:28:40 +00:00
Thomas Moestl
fac409f6bf Use stxa_sync() when accessing the LSU control register to avoid undefined
behaviour.
2002-02-13 16:25:33 +00:00
Thomas Moestl
fd2ee897e4 Use stxa_sync() when accessing the diagnostic registers to invalidate
caches; this is needed to avoid undefined behaviour.
Clean up a bit.
2002-02-13 16:20:38 +00:00
Thomas Moestl
bb2b9370c7 Add support for the counter-timer which is included in the Sun U2S and
U2P bridges as a time counter.
2002-02-13 16:16:36 +00:00
Thomas Moestl
633541ac6e Add support for the SBus, which is used in early Sun UltraSPARC machines.
Ported from NetBSD.
2002-02-13 16:11:36 +00:00
Thomas Moestl
e37d222c43 Merge r1.39 from NetBSD (manage both streaming caches for psycho pairs).
Use explicit bus space accesses instead of mapping the device memory
into kva.
Fix support for psycho pairs, and catch up with iommu code changes.
2002-02-13 16:07:59 +00:00
Thomas Moestl
e6c7af37bc Merge r1.42 of iommu.c and r1.9 of iommuvar.h from NetBSD (this adds
support for managing both streaming caches on psycho pairs).
Use explicit bus space accesses instead of mapping the device memory into
kva.
Move DVMA allocation to the map creation/dma memory allocation functions.
2002-02-13 15:59:17 +00:00
Thomas Moestl
64bc899300 Clean up bus space debugging support; change sparc64_bus_mem_map() to
take a bus tag and handle as argument instead of a i/o space id and a
physical address, now that nexus handles device memory resource
allocations.
2002-02-13 15:51:57 +00:00
Thomas Moestl
68716de3ec Define constants for the CPU implementation id; export the dectected id
as cpu_impl.
2002-02-13 15:47:12 +00:00
Thomas Moestl
95c7d7d47e Don't panic when no interrupt map can be found for a PCI bus; this seems
to happen on some models, like the Netra T1.
2002-02-13 15:44:58 +00:00
Thomas Moestl
f4a4c79dc0 Fix typos in a comment. 2002-02-13 15:43:42 +00:00
Thomas Moestl
9fb2b0d55e Add a few new functions/macros: intr_disable() and intr_restore() to
disable interrupts completely, and stxa_sync(), which performs a store
immediately followed by a membar #Sync with interrupts disabled (this
is needed for writes to diagnostic registers).
2002-02-13 15:40:05 +00:00
Thomas Moestl
c51aa38906 Minor bug fixes (add a missing break, correct the resource ranges, remove
a memory leak).
2002-02-13 15:35:22 +00:00
David E. O'Brien
837d5e7485 Add this FreeBSD standard header. 2002-02-10 14:27:20 +00:00
Julian Elischer
079b7badea Pre-KSE/M3 commit.
this is a low-functionality change that changes the kernel to access the main
thread of a process via the linked list of threads rather than
assuming that it is embedded in the process. It IS still embeded there
but remove all teh code that assumes that in preparation for the next commit
which will actually move it out.

Reviewed by: peter@freebsd.org, gallatin@cs.duke.edu, benno rice,
2002-02-07 20:58:47 +00:00
Bruce Evans
55a9536b65 Compile osigreturn() unconditionally since it will always be needed on
some arches and the syscall table is machine-independent.  It was
(bogusly) conditional on COMPAT_43, so this usually makes no difference.

ia64: in addition:
- replace the bogus cloned comment before osigreturn() by a correct one.
  osigreturn() is just a stub fo ia64's.
- fix the formatting of cloned comment before sigreturn().
- fix the return code.  use nosys() instead of returning ENOSYS to get
  the same semantics as if the syscall is not in the syscall table.
  Generating SIGSYS is actually correct here.
- fix style bugs.

powerpc: copy the cleaned up ia64 stub.  This mainly fixes a bogus comment.

sparc64: copy the cleaned up the ia64 stub, since there was no stub before.
2002-02-01 15:44:03 +00:00
Jake Burkholder
d2d3e8a55a Add extern to avoid sloppy common style declarations.
Tripped over by:	jhb, mux@sneakerz.org
2002-01-16 14:28:50 +00:00
Thomas Moestl
d7ff50a055 Add upa.h, which I had previously forgotten, to unbreak the sparc64
kernel build.

Pointy hat to:	tmm
2002-01-08 16:25:51 +00:00
Jake Burkholder
8e4609db35 Catch up to the latest and greatest. 2002-01-08 05:53:31 +00:00
Jake Burkholder
6deb695c1d Add initial smp support. This gets as far as allowing the secondary
cpu(s) into the kernel, and sync-ing them up to "kernel" mode so we can
send them ipis, which also work.

Thanks to John Baldwin for providing me with access to the hardware
that made this possible.

Parts obtained from:	bsd/os
2002-01-08 05:50:26 +00:00
Jake Burkholder
33bcea4eff Setup the normal global pcb register as well on entry from user land.
Call critical_enter/critical_exit around (fast) interrupt handlers.  All
non-threaded interrupts are fast, and the threaded interrupt scheduler is
itself a fast interrupt.
Assert that an interrupt handler we are about to call is non-zero.
Be paranoid about restoring the users global registers.  Do it as the
last thing before switching to alternate globals (when we magically get
our preloaded registers back), and do it with interrupts disabled.  Any
kind of kernel trap when the globals are not setup properly is bad news.
Don't save and restore the kernel g6, it invariably points to the current
pcb now.
2002-01-08 05:37:52 +00:00
Jake Burkholder
81f295da38 Adapt the vectored interrupt handler for receiving ipis. If the second
data word in an interrupt packet is non-zero, it points to code to execute
to handle the ipi, so jump to it instead of enqueueing the packet.  It
is unclear if we will need queued ipis.
Interrupt g7 now points to pcpu, instead of to the per-cpu interrupt queue
itself, so use that instead.  Interrupt g6 is no longer reserved.
2002-01-08 05:27:13 +00:00
Jake Burkholder
91b9d75edc Use the per-cpu panic stack in the case of a fault with a bad kernel
stack.
2002-01-08 05:20:40 +00:00
Jake Burkholder
180ba71605 Remove ATOMIC_INC_INT macro which has moved elsewhere. 2002-01-08 05:17:28 +00:00
Jake Burkholder
cdfe70829c Catch up to change in compile time assertion interface. 2002-01-08 05:15:31 +00:00
Jake Burkholder
417a101b45 Make this code more robust in the event of stray interrupts. Handle
stray level interrupts as well.
2002-01-08 05:13:29 +00:00
Jake Burkholder
90a801d702 Use cpufunc macros instead of using inline asm directly. 2002-01-08 05:10:58 +00:00
Jake Burkholder
79dba4cb34 Set the normal global pcb register when context switching. 2002-01-08 05:10:07 +00:00
Jake Burkholder
01cad5de12 Add a macro for getting the tlbs (itlb and/or dtlb) which the given
tte may be mapped by.
2002-01-08 05:07:58 +00:00
Jake Burkholder
70f550ae58 Prototype pmap_map_tsb(). 2002-01-08 05:06:39 +00:00
Jake Burkholder
dff34dde25 Remove PANIC_STACK_PAGES which is no longer used.
Redefine the compile time assertion macro to take one parameter.
2002-01-08 05:05:42 +00:00
Jake Burkholder
d2746ddb32 Add declarations needed by last commit. 2002-01-08 05:03:36 +00:00
Jake Burkholder
c0be70d7e2 Update comments about _start, the kernel entry point, to reflect new
parameters needed for smp support.
If we are not the boot processor, jump to the smp startup code instead.
Implement a per-cpu panic stack, which is used for bootstrapping both
primary and secondary processors and during faults on the kernel stack.
Arrange the per-cpu page like the pcb, with the struct pcpu at the end
of the page and the panic stack before it.
Use the boot processor's panic stack for calling sparc64_init.
Split the code to set preloaded global registers and to map the kernel
tsb out into functions, which non-boot processors can call.
Allocate the kstack for thread0 dynamically in pmap_bootstrap, and give
it a guard page too.
2002-01-08 05:02:13 +00:00
Jake Burkholder
77a240d5da Fix qsort callouts used for sorting memory regions during boot. vm_offset_t
is unsigned, so we can't use signed arithmetic.

Tripped over by:	jhb
2002-01-08 04:43:04 +00:00
Jake Burkholder
338f7e3e47 Add a md field to pcpu for the upa module id.
Remove the alt_stack field.
Use the defines for the register variables declared in C, so that they
don't get out of sync with the assembler.
2002-01-08 04:40:13 +00:00
Jake Burkholder
f25af321eb Define CKLF_PC in terms of TRAPF_PC. 2002-01-08 04:36:53 +00:00
Jake Burkholder
c0e12e9356 Add a mov() macro, which is used in conjunction with the register defines
for setting reserved global registers from c.
2002-01-08 04:36:01 +00:00
Jake Burkholder
2a32c6cea1 Update comments and defines to reflect that normal and alternate g6 point
to the current pcb.
Remove interrupt global defines; they use PCPU_REG now.
Move ATOMIC_INC_INT here from exception.s, add ATOMIC_DEC_INT.
Add a KASSERT macro for use in assembler.
2002-01-08 04:34:20 +00:00
Jake Burkholder
3a3b7ddc5a Add asis for the upa config reg, which contains the hardware cpu id, and
for the interrupt send register, which is used for dispatching ipis.
2002-01-08 04:29:50 +00:00
Peter Wemm
ead8168ac0 Convert a bunch of 1 << PCPU_GET(cpuid) to PCPU_GET(cpumask). 2002-01-05 09:41:37 +00:00
Thomas Moestl
62ec4add59 1. Implement an optimization for pmap_remove() and pmap_protect(): if a
substantial fraction of the number of entries of tte's in the tsb
   would need to be looked up, traverse the tsb instead. This is crucial
   in some places, e.g. when swapping out a process, where a certain
   pmap_remove() call would take very long time to complete without this.
2. Implement pmap_qenter_flags(), which will become used later
3. Reactivate the instruction cache flush done when mapping as executable.
   This is required e.g. when executing files via NFS, but is known to
   cause problems on UltraSPARC-IIe CPU's. If you have such a CPU, you
   will need to comment this call out for now.

Submitted by:	jake (3)
2002-01-02 18:49:20 +00:00
Thomas Moestl
ca8712b098 Correct the defintion of struct ofw_upa_regs, and use it instead of
struct ofw_nexus_reg. Implement UPA device memory management in the
nexus driver.
Adapt the psycho driver to these changes, and do some minor cleanup work
while being there.
2002-01-02 18:27:13 +00:00
Thomas Moestl
477609fb13 Close a window of time during early boot in which an interrupt would
cause a panic.

Reported and tested (in another version) by: Jamey Wood <Jamey.Wood@Sun.COM>
2002-01-02 18:21:16 +00:00
Jake Burkholder
48cff2ea0b Correctly identify the cpu in certain ultra 1s.
Noticed by:	Jamey Wood <Jamey.Wood@Sun.COM>
Submitted by:	tmm
2002-01-01 21:26:57 +00:00