Commit graph

1382 commits

Author SHA1 Message Date
Marcel Moolenaar ec79304f0f Make osendsig global. It's used by the Linuxulator. 2000-12-05 09:04:25 +00:00
Jake Burkholder 1eb44f0270 Remove the last of the MD netisr code. It is now all MI. Remove
spending, which was unused now that all software interrupts have
their own thread.  Make the legacy schednetisr use an atomic op
for setting bits in the netisr mask.

Reviewed by:	jhb
2000-12-05 00:36:00 +00:00
Matt Jacob b741a1c581 Fix for vanilla PC164 systems to use a slightly different PALcode magic
tweak to enable/disable interrupt sources. Seems to work. It is unclear
how many of the PC164 models actually might needs this, and whether or
not there are other hidden issues.

Obtained from:Bernd Walter <ticso@cicely8.cicely.de>
2000-12-04 17:21:46 +00:00
Matt Jacob bd1c746647 Comment out debug printfs about enable/disable ints.
Current now appears to work at least fitfully on one Rawhide.
2000-12-04 01:33:44 +00:00
David Malone ea8b5a9ae9 More M_ZERO patches.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
Approved by:	mjacob
2000-12-03 20:46:54 +00:00
Marcel Moolenaar b4c6727a3a Don't auto-generate the syscalls. 2000-12-03 01:30:31 +00:00
Marcel Moolenaar a7e693e3a0 Don't auto-generate syscalls. 2000-12-03 01:28:51 +00:00
Andrew Gallatin 6e4708aa12 exec_osf1_imgact() should return -1 for non OSF1/ECOFF binaries, it should
not return ENOEXEC.  This is because image activators should return -1 if they
don't claim an image. They should return ENOEXEC if they do claim it,
but cannot load it due to sime problem with the image.   This bug was
preventing static compilation of the osf/1 module.  I'm surprised it
did not cause more problems.
2000-12-02 04:15:17 +00:00
Andrew Gallatin 6e01adb67f Alter isa interrupt behaviour on alpha. Rather than send a non-specific
EOI after the ithread runs, send the EOI when we get the interrupt and
disable the source.  After the ithread is run, the source is renabled.
Also, add isa_handle_fast_intr() which handles fast interrupts by sending
an EOI after the handler is run.

This fixes the chronic missing interrupt problems under heavy NFS load
on my UP1000 and should result in greater stability for alphas which
route all irqs through an isa pic.

Discussed with: jhb, bde (sending non-specific EOIs early was bde's idea)
2000-12-01 22:28:04 +00:00
Andrew Gallatin 4c0b7a9327 acquire/release Giant in vm_page_zero_idle(), like on i386
Discused with: jhb
2000-12-01 18:55:58 +00:00
Andrew Gallatin 689634a3ea Convert the pcib_{read,write}_config args from signed to unsigned,
like the args to the config space accessors these functions replaced.

This reduces the likelyhood of overflow when the args are used in
macros on the alpha.  This prevents memory management faults when
probing the pci bus on sables, multias and nonames.

Approved by: dfr
Tested by: Bernd Walter <ticso@cicely8.cicely.de>
2000-12-01 15:27:48 +00:00
Alfred Perlstein 82625cf321 remove unneded sys/ucred.h includes 2000-11-30 18:52:32 +00:00
Marcel Moolenaar d034d459da Don't use p->p_sigstk.ss_flags to keep state of whether the
process is on the alternate stack or not. For compatibility
with sigstack(2) state is being updated if such is needed.

We now determine whether the process is on the alternate
stack by looking at its stack pointer. This allows a process
to siglongjmp from a signal handler on the alternate stack
to the place of the sigsetjmp on the normal stack. When
maintaining state, this would have invalidated the state
information and causing a subsequent signal to be delivered
on the normal stack instead of the alternate stack.

PR: 22286
2000-11-30 05:23:49 +00:00
Jonathan Lemon 9528be94e8 Add 'mpsafe' parameter to callout_init() in MD bits.
Reminded by:  jake
2000-11-26 13:52:17 +00:00
Marcel Moolenaar 466b14d758 Don't unregister the ioctl handlers before we verified we
can unload. Doing so leaves the linuxulator in a crippled
state (no ioctl support) when Linux binaries are run at
unload time.

While here, consistently spell ELF in capitals and perform
some minor style improvements.

ELF spelling submitted by: asmodai
2000-11-23 03:21:58 +00:00
Jake Burkholder 553629ebc9 Protect the following with a lockmgr lock:
allproc
	zombproc
	pidhashtbl
	proc.p_list
	proc.p_hash
	nextpid

Reviewed by:	jhb
Obtained from:	BSD/OS and netbsd
2000-11-22 07:42:04 +00:00
Doug Rabson 8707b6f032 Protect the bounce page list with a mutex instead of using splhigh(). 2000-11-22 07:16:51 +00:00
Mark Murray 5855006767 Add a consistent API to a feature that most modern CPUs have; a fast
counter register in-CPU.

This is to be used as a fast "timer", where linearity is more important
than time, and multiple lines in the linearity caused by multiple CPUs
in an SMP machine is not a problem.

This adds no code whatsoever to the FreeBSD kernel until it is actually
used, and then as a single-instruction inline routine (except for the
80386 and 80486 where it is some more inline code around nanotime(9).

Reviewed by:	bde, kris, jhb
2000-11-21 19:55:21 +00:00
Andrew Gallatin c75fa7f70c fix isa DMA on pyxis based machines:
- move the call to cia_init_sgmap() to after we've determined if we're a pyxis
- convert needed splhigh() in cia_sgmap_invalidate_pyxis() to disable_intr()

Previously, any isa DMA on a pyxis based machine would cause a panic
in cia_sgmap_invalidate_pyxis() because the pyxis workaround was never
setup.

- while i'm at it, convert needed splhigh() in cia_swiz_set_hae_mem to
disable_intr()
2000-11-21 03:25:31 +00:00
Poul-Henning Kamp d7450ce6d5 Make programs which still #include <machine/{mouse,console}.h> fail
at compiletime, with an explanatory error message.  Previously they
would only get a warning.

These files will be finally removed 2001-01-15
2000-11-20 22:00:25 +00:00
Doug Rabson 35cd89e7e5 Convert various calls to splhigh() to disable_intr() since splhigh() is
now a no-op.
2000-11-19 12:28:42 +00:00
Doug Rabson bcc542cb4e We don't need <stddef.h> for offsetof() any more. 2000-11-19 12:26:14 +00:00
Jake Burkholder fa2fbc3dac - Protect the callout wheel with a separate spin mutex, callout_lock.
- Use the mutex in hardclock to ensure no races between it and
  softclock.
- Make softclock be INTR_MPSAFE and provide a flag,
  CALLOUT_MPSAFE, which specifies that a callout handler does not
  need giant.  There is still no way to set this flag when
  regstering a callout.

Reviewed by:	-smp@, jlemon
2000-11-19 06:02:32 +00:00
Jake Burkholder 7da6f97772 - Split the run queue and sleep queue linkage, so that a process
may block on a mutex while on the sleep queue without corrupting
it.
- Move dropping of Giant to after the acquire of sched_lock.

Tested by:	John Hay <jhay@icomtek.csir.co.za>
		jhb
2000-11-17 18:09:18 +00:00
John Baldwin 20cdcc5b73 Don't release and acquire Giant in mi_switch(). Instead, release and
acquire Giant as needed in functions that call mi_switch().  The releases
need to be done outside of the sched_lock to avoid potential deadlocks
from trying to acquire Giant while interrupts are disabled.

Submitted by:	witness
2000-11-16 02:16:44 +00:00
Andrew Gallatin 930a65fe47 Use the linux_connect() on alpha rather than passing directly through
to our native connect().  This is required to deal with the differences
in the way linux handles connects on non-blocking sockets.

This gets the private beta of the Compaq Linux/alpha JDK working
on FreeBSD/alpha

Approved by: marcel
2000-11-16 01:05:53 +00:00
Andrew Gallatin e652fd8417 make the fcntl() flags match what the linux/alpha port uses, not
what linux/i386 uses
2000-11-16 00:58:07 +00:00
John Baldwin 4b2c46fab1 Add the 'witness_spin_check' per-CPU variable. 2000-11-15 21:58:02 +00:00
John Baldwin 651c378316 - Don't acquire/release Giant during an interrupt context for machine
checks, clock interrupts, and device interrupts.
- Assert that Giant is not owned during the main loop of ithd_loop().
2000-11-15 21:56:50 +00:00
John Baldwin a436e6e696 Fix all the interrupt enabled/disabled assertions which were backwards. 2000-11-15 19:45:10 +00:00
John Baldwin 7e4b7c97de Don't perform an mi_switch() when we release Giant during cpu_exit(). We
are about to call cpu_switch() anyways.

Found by:	witness
2000-11-15 19:44:38 +00:00
John Baldwin 8b9d6e94af Enable all interrupts in switch_trampoline after releasing the sched_lock.
This is needed so that kernel threads created before interrupts are
enabled do not run with interrupts disabled once the system is up and
running.
2000-11-15 01:48:49 +00:00
Matt Jacob 78f3dc6530 Pick up kernelname for bootinfo structure (if possible), otherwise
from environment.
2000-11-14 08:12:15 +00:00
Andrew Gallatin 922683e01a Enable linux thread support on the alpha. The guts of linux_clone was
mainly cut-n-pasted from the i386 port, except for the method of setting
the child's stack which is the only MD part of this function.

I've tested with the example apps shipped with the linux threads source
code (ex1-ex6) and with several binary builds of Mozilla.
2000-11-10 23:04:31 +00:00
Andrew Gallatin f16647740e Simplify and correct OSF/1 signal handling.
- No signal translation is needed.  Our signals match the OSF/1 signals
- an OSF/1 sigset_t is 64 bits.  Make certain to use all 64-bits of it.
  We'd previously only used the lower 32 bits.   This was mostly harmless
  as I don't know of an OSF/1 apps which use any signals > 31.  However,
  the alpha Linux ABI uses the osf/1 signal routines and threaded linux
  apps tyically use signals 32 and 33 to comminicate with the manager
  thread, so it is important we preserve the upper 32-bits.

Reviewed by: marcel (at least in principal)
2000-11-10 23:00:54 +00:00
Matt Jacob 259515a1ec Fix typo in END macro (END'ed enable twice)
PR:		22713
Submitted by:	Bernd Walter <ticso@cicely5.cicely.de>
2000-11-09 17:01:21 +00:00
Marcel Moolenaar 806d7daafe Make MINSIGSTKSZ machine dependent, and have the sigaltstack
syscall compare against a variable sv_minsigstksz in struct
sysentvec as to properly take the size of the machine- and
ABI dependent struct sigframe into account.

The SVR4 and iBCS2 modules continue to have a minsigstksz of
8192 to preserve behavior. The real values (if different) are
not known at this time. Other ABI modules use the real
values.

The native MINSIGSTKSZ is now defined as follows:

Arch		MINSIGSTKSZ
----		-----------
alpha		    4096
i386		    2048
ia64		   12288

Reviewed by: mjacob
Suggested by: bde
2000-11-09 08:25:48 +00:00
Andrew Gallatin 3598c2665c back out 1.66 -- the Elfxx_Brandinfo compat_3_brand field doesn't exist
in -current
2000-11-09 01:53:05 +00:00
Matt Jacob 328b7df026 Clean this is up a bit for multiple MIDs... We can figure out which MID
for an interrupt to enable/disable from the vector (and GID too, if we
had multiple GIDs)- so, stupidly for now, search for the right mcpcia's
softc so we have the right base address for the bridge CSR to apply
IRQ bit-twiddle's to. Alas- this doesn't yet allow us to run, but it's
the right direction.
2000-11-08 18:48:21 +00:00
Jeroen Ruigrok van der Werven 6b1d8ceabe Fix CMSG and ALIGN macro usage.
Previously we had to include <machine/param.h> or <sys/param.h> bogusly
due to the fact that <sys/socket.h> CMSG macros needed the ALIGN macro,
which was defined in param.h.  However, including param.h was a disaster
for namespace pollution.
This solution, as contributed by shin a while ago, fixes it elegantly
by wrapping the definitions around some namespace pollution preventer
definitions.
This patch was long overdue.
This should allow any network programmer to use <sys/socket.h> as
before.

PR:		19971, 20530
Submitted by:	Martin Kaeske <MartinKaeske@lausitz.net>
		Mark Andrews <Mark.Andrews@nominum.com>
Patch submitted by:	shin
Reviewed by:	bde
2000-11-08 16:59:25 +00:00
Matt Jacob 2ac2ed8a51 (KTR debugging) Say when we're disabling a vector. 2000-11-07 22:29:21 +00:00
David E. O'Brien a5b64787e2 Sync with i386's GENERIC rev 1.287 (Minor ordering changes to make more
sections strictly alphabetical.)
2000-11-07 22:09:33 +00:00
David E. O'Brien 9d9615d81d Sync with i386/conf/GENERIC rev 1.288 (add comments for some ISA devices). 2000-11-07 22:07:07 +00:00
Bill Paul f425f328cd The vx driver no longer needs the PCI compat shims. Also should now
work on the alpha (at least the PCI part should).
2000-11-07 00:58:35 +00:00
David E. O'Brien 66e7b133fe Fix generated include path.
Approved by:	JKH
2000-11-04 07:21:37 +00:00
David E. O'Brien 43cc92233d Fix the Elf64 branding initialization. 2000-11-04 05:04:47 +00:00
David E. O'Brien 896fc61a66 Sort. 2000-11-02 04:13:51 +00:00
Andrew Gallatin f11610e091 Support for the linux ipc syscalls on the alpha, where each one has
its own syscall rather than going through a demux function like
linux_ipc() on i386
2000-11-01 23:17:31 +00:00
Andrew Gallatin d0ce99c874 use DUMMY macro and support from linux_util.h 2000-11-01 23:13:49 +00:00
Andrew Gallatin b36abb04e5 Move the linux abi's alpha md files over to using David's build-time
syscall generation method
2000-11-01 23:07:25 +00:00
Andrew Gallatin e70ce4d9c5 fix linux_termio and linux_termios structs on alpha. alpha differences
are in the termios struct (probably because linux wants to be compatible
with the osf/1 termios struct), not the termio struct.
2000-11-01 22:36:41 +00:00
John Baldwin a07b7a4e35 Pass in the new-bus flags to alpha_setup_intr(). 2000-11-01 18:40:42 +00:00
John Baldwin 90652ed180 - Modify alpha_setup_intr() to take interrupt handler flags as an additional
argument.  These flags include INTR_FAST, INTR_MPSAFE, etc.
- Properly handle INTR_EXCL when it is passed in to allow an interrupt
  handler to claim exclusive ownership of an interrupt thread.
- Add support for psuedo-fast interrupts on the alpha.  For fast interrupts,
  we don't allocate an interrupt thread; instead, during dispatching of an
  interrupt, we run the handler directly instead of scheduling the thread
  to run.  Note that the handler is currently run without Giant and must be
  MP safe.  The only fast handler currently is for the sio driver.

Requested by:	dfr
2000-11-01 18:40:02 +00:00
David E. O'Brien ac4c54948c Apply style(9). 2000-11-01 16:38:40 +00:00
David E. O'Brien 7b4cc3fd44 Minimal set of diffs from the i386 bits to the AlphaLinux.
(based on a patch to sys/i386/linux/linux_dummy.c by gallatin)
2000-11-01 16:34:16 +00:00
David E. O'Brien 23d3a6fe6e Need to dummy-out rt_sigreturn.
submitted by:	gallatin
2000-11-01 08:52:24 +00:00
David E. O'Brien 60f618a04d Need to include sys/proc.h. 2000-11-01 08:49:48 +00:00
David E. O'Brien 727fba5373 I don't know why this used to compile for me, but now struct
linux_sigcontext seems to have changed and some members are gone.
2000-11-01 08:48:53 +00:00
David E. O'Brien 83d2913008 Make the target a little bit more generic. 2000-11-01 08:47:34 +00:00
Matt Jacob 2170c2d960 Remember to decrement interrupt nesting level if leaving early
(in the unlikely case we get a clock interrupt on a non-primary CPU).
2000-10-30 04:18:54 +00:00
Andrew Gallatin a415ada785 remove a stddef.h missed by phk 2000-10-27 18:57:31 +00:00
Matt Jacob 657e6b0d78 Add M_ZERO to malloc calls where the result is just bzeroed.
PR:		22188
Submitted (partially) by:	josh@zipperup.org
2000-10-27 16:36:26 +00:00
Poul-Henning Kamp 46aa3347cb Convert all users of fldoff() to offsetof(). fldoff() is bad
because it only takes a struct tag which makes it impossible to
use unions, typedefs etc.

Define __offsetof() in <machine/ansi.h>

Define offsetof() in terms of __offsetof() in <stddef.h> and <sys/types.h>

Remove myriad of local offsetof() definitions.

Remove includes of <stddef.h> in kernel code.

NB: Kernelcode should *never* include from /usr/include !

Make <sys/queue.h> include <machine/ansi.h> to avoid polluting the API.

Deprecate <struct.h> with a warning.  The warning turns into an error on
01-12-2000 and the file gets removed entirely on 01-01-2001.

Paritials reviews by:   various.
Significant brucifications by:  bde
2000-10-27 11:45:49 +00:00
Roger Hardiman 5d4152e3e8 Merge from i386: Add MSP ioctl 2000-10-27 07:07:24 +00:00
Mark Murray 5f3431b5ad As the blocking model has seems to be troublesome for many, disable
it for now with an option.

This option is already deprecated, and will be removed when the
entropy-harvesting code is fast enough to warrant it.
2000-10-27 06:06:04 +00:00
Andrew Gallatin 382e2ab4b1 add a version tag for the alpha linulator to depend on 2000-10-26 16:31:29 +00:00
Andrew Gallatin af06b8d8a5 Update osf1_setuid() and osf1_setgid() to use the new change_euid() and
change_ruid() in kern_prot.c.  This fixes an incorrect use
of chgproccnt().

Update both osf1_setuid() and osf1_setgid() to use setsugid() instead
of just frobbing the flag.

(mostly) submitted by: truckman
2000-10-26 15:53:00 +00:00
John Baldwin 8088699f79 - Overhaul the software interrupt code to use interrupt threads for each
type of software interrupt.  Roughly, what used to be a bit in spending
  now maps to a swi thread.  Each thread can have multiple handlers, just
  like a hardware interrupt thread.
- Instead of using a bitmask of pending interrupts, we schedule the specific
  software interrupt thread to run, so spending, NSWI, and the shandlers
  array are no longer needed.  We can now have an arbitrary number of
  software interrupt threads.  When you register a software interrupt
  thread via sinthand_add(), you get back a struct intrhand that you pass
  to sched_swi() when you wish to schedule your swi thread to run.
- Convert the name of 'struct intrec' to 'struct intrhand' as it is a bit
  more intuitive.  Also, prefix all the members of struct intrhand with
  'ih_'.
- Make swi_net() a MI function since there is now no point in it being
  MD.

Submitted by:	cp
2000-10-25 05:19:40 +00:00
Andrew Gallatin 2acbb2b129 fix bogus cast in osf1_getrlimit/osf1_setrlimit 2000-10-25 00:37:34 +00:00
John Baldwin 2a1c4d6378 Only use 1 set of memory barrier operations with the atomic_*_{acq,rel}_ptr
functions.
2000-10-25 00:15:21 +00:00
Andrew Gallatin 785640153d teach the osf1_getsysinfo() function about a few more fields
submitted by: Jim.Pirzyk@disney.com
PR: alpha/22263
2000-10-25 00:14:11 +00:00
David E. O'Brien 2d26708326 Adjust comments
Submitted by:	bde

Add ISO C99's long long type limits.
Reviewed by:	bde
2000-10-24 10:49:56 +00:00
Matt Jacob eb661345a9 Move bogus proc reference stuff into <machine/globals.h>. There is no
more include file including <sys/proc.h>, but there still is this wonky
and (causes warnings on i386) reference in globals.h.

CURTHD is now defined in <machine/globals.h> as well. The correct thing
to do is provide a platform function for this.
2000-10-23 18:36:03 +00:00
David E. O'Brien 45428438f7 Apply style(9). [best I could] 2000-10-23 08:46:25 +00:00
David E. O'Brien e413f7bf97 Apply style(9).
(best I could)
2000-10-23 08:36:59 +00:00
David E. O'Brien 30e3f60f75 Sort the #define's. 2000-10-23 08:29:04 +00:00
David E. O'Brien 683713f8e9 Minimal set of diffs from the i386 bits to the AlphaLinux. 2000-10-23 08:15:58 +00:00
David E. O'Brien d1121275d5 Re-order the #define's into a more logical one. 2000-10-23 08:13:19 +00:00
David E. O'Brien 2159c8905f We need to explicitly tell the args struct for COMPAT functions we use
that use the same args struct as their non-COMPAT counter parts.
2000-10-23 02:20:01 +00:00
David E. O'Brien b608e3ff66 Somehow I left out sycall #98 2000-10-22 21:47:07 +00:00
David E. O'Brien dd3ccfd92e Minor whitespace cleanup. 2000-10-22 21:42:03 +00:00
David E. O'Brien 8c2c12607a Minimal set of diffs from the i386 bits to the AlphaLinux.
Submitted by:	gallatin (content, minimization by me)
2000-10-22 21:36:27 +00:00
John Baldwin bd4635599d Define the mtx_legal2block() macro used in the witness code that managed
to get lost during the MI mutex conversion.

Reported by:    Steve Kargl <sgk@troutmask.apl.washington.edu>
2000-10-20 22:44:06 +00:00
John Baldwin 9aea17a792 Fix a braino in the ASS_SIEN() macro in the MUTEX_DEBUG case by using
mtx_saveintr instead of saveintr.
2000-10-20 20:27:12 +00:00
John Baldwin 8a6149a3a3 Don't bother setting the saved IPL in the sched_lock mutex as it doesn't
really do anything since the first mtx_enter() will overwrite the value
saved here.
2000-10-20 20:14:55 +00:00
John Baldwin 8cc99fae9a Catch up to some of the changes to _getlock_spin_block. Specifically,
use _obtain_lock() instead of a manual atomic_cmpset_ptr.
2000-10-20 19:54:47 +00:00
John Baldwin bb352e20a2 Grrrr. Fix the order of the #define's so atomic_cmpset_{acq,rel}_long
are defined before atomic_cmpset_{acq,rel}_ptr tries to call them.
2000-10-20 19:53:52 +00:00
John Baldwin 6d02703c2f Fix the atomic_cmpset_{acq,rel}_ptr() functions to do proper type-casting. 2000-10-20 19:46:02 +00:00
John Baldwin 35e0e5b311 Catch up to moving headers:
- machine/ipl.h -> sys/ipl.h
- machine/mutex.h -> sys/mutex.h
2000-10-20 07:58:15 +00:00
John Baldwin bce7f05af8 - machine/mutex.h -> sys/mutex.h
- Catch up to the MI mutex structure due to saveflags,saveipl,savepsr
  becoming saveintr.
2000-10-20 07:38:44 +00:00
John Baldwin 557b927eca - machine/mutex.h -> sys/mutex.h
- Use MUTEX_DECLARE() and MTX_COLD for Giant and sched_lock.
2000-10-20 07:32:48 +00:00
John Baldwin 36412d79b4 - Make the mutex code almost completely machine independent. This greatly
reducues the maintenance load for the mutex code.  The only MD portions
  of the mutex code are in machine/mutex.h now, which include the assembly
  macros for handling mutexes as well as optionally overriding the mutex
  micro-operations.  For example, we use optimized micro-ops on the x86
  platform #ifndef I386_CPU.
- Change the behavior of the SMP_DEBUG kernel option.  In the new code,
  mtx_assert() only depends on INVARIANTS, allowing other kernel developers
  to have working mutex assertiions without having to include all of the
  mutex debugging code.  The SMP_DEBUG kernel option has been renamed to
  MUTEX_DEBUG and now just controls extra mutex debugging code.
- Abolish the ugly mtx_f hack.  Instead, we dynamically allocate
  seperate mtx_debug structures on the fly in mtx_init, except for mutexes
  that are initiated very early in the boot process.   These mutexes
  are declared using a special MUTEX_DECLARE() macro, and use a new
  flag MTX_COLD when calling mtx_init.  This is still somewhat hackish,
  but it is less evil than the mtx_f filler struct, and the mtx struct is
  now the same size with and without mutex debugging code.
- Add some micro-micro-operation macros for doing the actual atomic
  operations on the mutex mtx_lock field to make it easier for other archs
  to override/optimize mutex ops if needed.  These new tiny ops also clean
  up the code in some places by replacing long atomic operation function
  calls that spanned 2-3 lines with a short 1-line macro call.
- Don't call mi_switch() from mtx_enter_hard() when we block while trying
  to obtain a sleep mutex.  Calling mi_switch() would bogusly release
  Giant before switching to the next process.  Instead, inline most of the
  code from mi_switch() in the mtx_enter_hard() function.  Note that when
  we finally kill Giant we can back this out and go back to calling
  mi_switch().
2000-10-20 07:26:37 +00:00
John Baldwin ccbdd9ee59 - Expand the set of atomic operations to optionally include memory barriers
in most of the atomic operations.  Now for these operations, you can
  use the normal atomic operation, you can use the operation with a read
  barrier, or you can use the operation with a write barrier.  The function
  names follow the same semantics used in the ia64 instruction set.  An
  atomic operation with a read barrier has the extra suffix 'acq', due to
  it having "acquire" semantics.  An atomic operation with a write barrier
  has the extra suffix 'rel'.  These suffixes are inserted between the
  name of the operation to perform and the typename.  For example, the
  atomic_add_int() function now has 3 variants:
  - atomic_add_int() - this is the same as the previous function
  - atomic_add_acq_int() - this function combines the add operation with a
    read memory barrier
  - atomic_add_rel_int() - this function combines the add operation with a
    write memory barrier
- Add 'ptr' to the list of types that we can perform atomic operations
  on.  This allows one to do atomic operations on uintptr_t's.  This is
  useful in the mutex code, for example, because the actual mutex lock is
  a pointer.
- Add two new operations for doing loads and stores with memory barriers.
  The new load operations use a read barrier before the load, and the
  new store operations use a write barrier after the load.  For example,
  atomic_load_acq_int() will atomically load an integer as well as
  enforcing a read barrier.
2000-10-20 07:00:48 +00:00
John Baldwin 3f4809dd0d Axe the barrier_{read,write,rw}() helper functions as this method of
doing memory barriers doesn't really scale well for the ia64.  Also,
memory barriers are more a property of the CPU than bus space.

Requested by:	dfr
2000-10-20 06:45:48 +00:00
John Baldwin 25f3f7c530 Add in a simple API for memory barriers to machine/bus.h:
- barrier_read() enforces a memory read barrier
- barrier_write() enforces a memory write barrier
- barrier_rw() enforces a memory read/write barrier
2000-10-18 10:30:12 +00:00
Paul Saab c794ceb56a Implement write combining for crashdumps. This is useful when
write caching is disabled on both SCSI and IDE disks where large
memory dumps could take up to an hour to complete.

Taking an i386 scsi based system with 512MB of ram and timing (in
seconds) how long it took to complete a dump, the following results
were obtained:

Before:				After:
	WCE           TIME		WCE           TIME
	------------------		------------------
	1	141.820972		1	 15.600111
	0	797.265072		0	 65.480465

Obtained from:	Yahoo!
Reviewed by:	peter
2000-10-17 10:05:49 +00:00
Andrew Gallatin 7936339495 A start at an implemention of linux_rt_sendsig & linux_rt_sigreturn
and associated user-level signal trampoline glue.

Without this patch, an SA_SIGINFO style handler can be installed by a linux
app, but if the handler accesses its sip argument, it will get a garbage
pointer and likely segfault.

We currently supply a valid pointer, but its contents are mainly
garbage.  Filling this in properly is future work.

This is the second of 3 commits that will get IBM's JDK 1.3 working with
FreeBSD ...
2000-10-17 00:00:20 +00:00
Andrew Gallatin 1e78526274 Fix problems booting large kernels on alphas. The symptom is that the kernel
loads, prints the copyright, and either hangs or locks solid.  The
PC tends to be in the data segment and the RA is in XentMM

Doug really came up with the fix, I'm just the monkey typing.  Doug says:
	The alpha can only support 64k of globals with $gp pointing at
	base+32k so that the code can use 16bit signed offsets from $gp to
	access it. ....  it is possible to have multiple .got subsections
	and the linker handles this with the relocations for 'ldgp' pseudo
	instructions.  [Without this patch] the code in exception.s has been
	linked  to use a different gp from locore.s (where pal_kgp is set).

Reviewed by: dfr
2000-10-16 20:15:43 +00:00
Poul-Henning Kamp 398bc678aa Move DELAY() from <machine/clock.h> to <sys/systm.h> 2000-10-15 09:51:49 +00:00
Bill Fumerola 80e3ea2097 Remove 'device tx'. In wilko's testing it traps on bringing the interface
up. Even though this has recieved all the right MI treatment (newbus, miibus)
it stands for now a i386 only driver.
2000-10-12 06:10:12 +00:00
Andrew Gallatin 9e7c752771 kmem transfers were being double-counted due to a missing continue.
This silences the dreaded "swapinfo:cannot read blmeta_t" messages at boot.
I'm really suprised there were no PRs open about this...
2000-10-11 01:01:54 +00:00
Andrew Gallatin acadb17f53 kernacc() only knows about mapped memory, not K0SEG addresses.
Before calling kernacc(), make sure that we're not calling it
with a K0SEG address.

This gets alphas booting with SMP_DEBUG & INVARIANTS options

approved by: jhb
2000-10-09 18:47:49 +00:00
Andrew Gallatin c199657754 fix a typo & allow softclock to run on alphas.
This gets my AS500 and UP1000 booting again.
2000-10-09 14:20:09 +00:00
Poul-Henning Kamp f6b5c74c35 Initiate deorbit burn sequence for <machine/mouse.h>.
Replace all in-tree uses with <sys/mouse.h> which repo-copied a few
moments ago from src/sys/i386/include/mouse.h by peter.
This is also the appropriate fix for exo-tree sources.

Put warnings in <machine/mouse.h> to discourage use.
November 15th 2000 the warnings will be converted to errors.
January 15th 2001 the <machine/mouse.h> files will be removed.
2000-10-09 08:08:36 +00:00
Poul-Henning Kamp 00d25f512c Initiate deorbit burn sequence for <machine/console.h>.
Replace all in-tree uses with necessary subset of <sys/{fb,kb,cons}io.h>.
This is also the appropriate fix for exo-tree sources.

Put warnings in <machine/console.h> to discourage use.
November 15th 2000 the warnings will be converted to errors.
January 15th 2001 the <machine/console.h> files will be removed.
2000-10-08 21:34:00 +00:00
Bosko Milekic ec222a71d9 Cleanup comment in machine/param.h regarding mbuf-related sizes, and get rid
of MCLOFSET, which does not appear to be used anywhere anymore, and if it is,
it probably shouldn't be.
2000-10-08 03:52:27 +00:00
Bruce Evans cc46dff67f Work around a bug by adding struct tags. gcc-2.95 apparently gets the
check in the [basic.link] section of the C++ standard wrong.  gcc-2.7.2.3
apparently doesn't do the check, so the bug doesn't affect RELENG_3.

PR:		16170, 21427
Submitted by:	Max Khon <fjoe@lark.websci.ru> (i386 version)
Discussed with:	jdp
2000-10-06 11:53:32 +00:00
John Baldwin 6c56727456 - Change fast interrupts on x86 to push a full interrupt frame and to
return through doreti to handle ast's.  This is necessary for the
  clock interrupts to work properly.
- Change the clock interrupts on the x86 to be fast instead of threaded.
  This is needed because both hardclock() and statclock() need to run in
  the context of the current process, not in a separate thread context.
- Kill the prevproc hack as it is no longer needed.
- We really need Giant when we call psignal(), but we don't want to block
  during the clock interrupt.  Instead, use two p_flag's in the proc struct
  to mark the current process as having a pending SIGVTALRM or a SIGPROF
  and let them be delivered during ast() when hardclock() has finished
  running.
- Remove CLKF_BASEPRI, which was #ifdef'd out on the x86 anyways.  It was
  broken on the x86 if it was turned on since cpl is gone.  It's only use
  was to bogusly run softclock() directly during hardclock() rather than
  scheduling an SWI.
- Remove the COM_LOCK simplelock and replace it with a clock_lock spin
  mutex.  Since the spin mutex already handles disabling/restoring
  interrupts appropriately, this also lets us axe all the *_intr() fu.
- Back out the hacks in the APIC_IO x86 cpu_initclocks() code to use
  temporary fast interrupts for the APIC trial.
- Add two new process flags P_ALRMPEND and P_PROFPEND to mark the pending
  signals in hardclock() that are to be delivered in ast().

Submitted by:	jakeb (making statclock safe in a fast interrupt)
Submitted by:	cp (concept of delaying signals until ast())
2000-10-06 02:20:21 +00:00
John Baldwin 1931cf940a - Heavyweight interrupt threads on the alpha for device I/O interrupts.
- Make softinterrupts (SWI's) almost completely MI, and divorce them
  completely from the x86 hardware interrupt code.
  - The ihandlers array is now gone.  Instead, there is a MI shandlers array
    that just contains SWI handlers.
  - Most of the former machine/ipl.h files have moved to a new sys/ipl.h.
- Stub out all the spl*() functions on all architectures.

Submitted by:	dfr
2000-10-05 23:09:57 +00:00
John Baldwin b4645202b5 Add atomic_readandclear_int and atomic_readandclear_long. 2000-10-05 22:19:50 +00:00
Jason Evans 645b8b81f0 Reduce userland namespace polution. 2000-10-04 01:21:58 +00:00
Jason Evans d389654761 Fix spelling error ("exits" should be "exists"). 2000-10-04 01:20:49 +00:00
Doug Rabson c703143638 Clear pcb_schednest in cpu_fork() for the child process. This is
is necessary since the child's call stack only includes one recursive
hold of sched_lock.
2000-10-03 08:03:03 +00:00
Bosko Milekic 7d03271452 Big mbuf subsystem diff #1: incorporate mutexes and fix things up somewhat
to accomodate the changes.

 Here's a list of things that have changed (I may have left out a few); for a
 relatively complete list, see http://people.freebsd.org/~bmilekic/mtx_journal

   * Remove old (once useful) mcluster code for MCLBYTES > PAGE_SIZE which
     nobody uses anymore. It was great while it lasted, but now we're moving
     onto bigger and better things (Approved by: wollman).

   * Practically re-wrote the allocation macros in sys/sys/mbuf.h to accomodate
     new allocations which grab the necessary lock.

   * Make sure that necessary mbstat variables are manipulated with
     corresponding atomic() routines.

   * Changed the "wait" routines, cleaned it up, made one routine that does
     the job.

   * Generalized MWAKEUP() macro. Got rid of m_retry and m_retryhdr, as they
     are now included in the generalized "wait" routines.

   * Sleep routines now use msleep().

   * Free lists have locks.

   * etc... probably other stuff I'm missing...

  Things to look out for and work on later:

   * find a better way to (dynamically) adjust EXT_COUNTERS

   * move necessity to recurse on a lock from drain routines by providing
     lock-free lower-level version of MFREE() (and possibly m_free()?).

   * checkout include of mutex.h in sys/sys/mbuf.h - probably violating
     general philosophy here.

   The code has been reviewed quite a bit, but problems may arise... please,
   don't panic! Send me Emails: bmilekic@freebsd.org

Reviewed by: jlemon, cp, alfred, others?
2000-09-30 06:30:39 +00:00
Paul Saab 92b123a002 Move MAXCPU from machine/smp.h to machine/param.h to fix breakage
with !SMP kernels.  Also, replace NCPUS with MAXCPU since they are
redundant.
2000-09-23 12:18:06 +00:00
Jason Evans c6d1d1cf5d #include <sys/proc.h> in order to get curproc. This seems to be the lesser
of two evils; the greater evil is requiring sys/proc.h to be included
before including machine/mutex.h.
2000-09-23 00:00:50 +00:00
Paul Saab 7321545f26 Remove the NCPU, NAPIC, NBUS, NINTR config options. Make NAPIC,
NBUS, NINTR dynamic and set NCPU to a maximum of 16 under SMP.

Reviewed by:	peter
2000-09-22 23:40:10 +00:00
Doug Rabson 8a90ed65a6 Remove atomic_*_{32,64} since they are now inline. If you haven't rebuilt
modules since atomic.h was updated, now is the time.
2000-09-22 08:30:59 +00:00
Bill Paul 73334a4329 Add a new driver for the AMD PCnet/FAST, FAST+ and Home PCI adapters.
Previously, these cards were supported by the lnc driver (and they
still are, but the pcn driver will claim them first), which is fine
except the lnc driver runs them in 16-bit LANCE compatibility mode.
The pcn driver runs these chips in 32-bit mode and uses the RX alignment
feature to achieve zero-copy receive. (Which puts it in the same
class as the xl, fxp and tl chipsets.) This driver is also MI, so it
will work on the x86 and alpha platforms. (The lnc driver is still
needed to support non-PCI cards. At some point, I'll need to newbusify
it so that it too will me MI.)

The Am79c978 HomePNA adapter is also supported.
2000-09-20 17:30:22 +00:00
Poul-Henning Kamp 1534d6d899 Remove a few leftover CLBYTES related bits.
This was in the good old days to patch up a logical pagesize on hardware
with stupid VM pagesize.  Vaxen I belive.
2000-09-16 18:28:24 +00:00
John Baldwin f46305730e Grab the scheduler lock before calling setrunqueue() and mi_switch(). 2000-09-14 22:17:34 +00:00
John Baldwin 606f8eb27a Remove the mtx_t, witness_t, and witness_blessed_t types. Instead, just
use struct mtx, struct witness, and struct witness_blessed.

Requested by:	bde
2000-09-14 20:15:16 +00:00
Doug Rabson c090a2b4e5 Don't release Giant for db_nofault exceptions since it isn't held when
kdb_trap is called.
2000-09-14 13:04:38 +00:00
John Baldwin 9a94c9c5c3 - Remove the inthand2_t type and use the equivalent driver_intr_t type from
newbus for referencing device interrupt handlers.
- Move the 'struct intrec' type which describes interrupt sources into
  sys/interrupt.h instead of making it just be a x86 structure.
- Don't create 'ithd' and 'intrec' typedefs, instead, just use 'struct ithd'
  and 'struct intrec'
- Move the code to translate new-bus interrupt flags into an interrupt thread
  priority out of the x86 nexus code and into a MI ithread_priority()
  function in sys/kern/kern_intr.c.
- Remove now-uneeded x86-specific headers from sys/dev/ata/ata-all.c and
  sys/pci/pci_compat.c.
2000-09-13 18:33:25 +00:00
John Baldwin 220ca3ff5e - Fix spinlock exiting to handle recursion properly and only enable
interrupts at the proper time.
- Remove an uneeded test and just always set the MTX_RECURSE bit when
  recursing on a sleep lock.
2000-09-13 18:28:14 +00:00
John Baldwin 699fbdc2ab - Fix spinlock exits to properly handle the recursion count and only
re-enable interrupts when actually releasing the lock.
- Bring across some fixes to propagate_priority from the x86 code.
  (It still doesn't work properly, however.)
- Use the SMTX state when putting a process that blocks on a mutex to sleep.
- Use mi_switch instead of cpu_switch so that accounting works properly as
  well as other things.
- Bring across DDB protection of the spinlock timeout panic which is useful
  in a multiple CPU system when 1 CPU enters the debugger holding the
  sched_lock so that the other CPU doesn't panic as well resulting in all
  sorts of fun things.
- Bring across various other small changes in format strings and comments
  to sync up with the x86 code.
2000-09-13 18:26:33 +00:00
John Baldwin 5010ef836a Import the global sched_lock variable instead of using a private copy. This
fixes a problem where cpu_switch() wasn't properly saving and restoring
the recursion count for sched_lock.
2000-09-13 18:22:53 +00:00
John Baldwin 7ce7aa2a0b Fix a comment, we have mutexes now instead of a single lock. 2000-09-13 18:22:07 +00:00
John Baldwin 8dc1deec65 Add back in obtaining/releasing Giant around interrupt handlers. 2000-09-13 18:21:33 +00:00
Doug Rabson 14580e383c Merge changes from the i386 port to allow userret() to be called both
with and without holding the Giant mutex.
2000-09-12 22:47:10 +00:00
Doug Rabson 7a0758ab68 * Redo the cmpset inlines to use one less register. This incidentally
fixes a serious problem with the previous version where an input could
  have been placed in the same register as an output which would stop
  the inline from working properly.

* Redo atomic_{set,clear,add,subtract}_{32,64} as inlines since the code
  sequence is shorter than the call sequence to the code in atomic.s.
  I will remove the functions from atomic.s after a grace period to allow
  people to rebuild kernel modules.
2000-09-12 22:45:44 +00:00
Doug Rabson 569185f256 Really disable interrupts for spin mutexes instead of just pretending. 2000-09-12 22:40:29 +00:00
Mark Murray ac519db05b Turn the /dev/random device into a (pseudo-)device, not an option.
(I didn't realise that it was this easy!)
Submitted by:	jhb
2000-09-12 13:21:40 +00:00
Bill Fumerola 8f8f11aa99 Add tx to the list of miibus using network drivers. We already build tx in
/sys/modules for alpha, and it compiles on beast.
2000-09-11 21:21:37 +00:00
Matt Jacob 86b9bd5cdc Well, this works for me and I can now boot my PC164 again.
Nobody said it broke their system.
2000-09-11 21:10:25 +00:00
John Baldwin d742034d88 The alpha doesn't have a eflags register, so don't refer to it here. 2000-09-11 06:42:50 +00:00
John Baldwin 43e585ce84 Don't tell printf() to output a sign when printing out a value as hex.
kvprintf() doesn't print out a sign for hex anyways.
2000-09-11 05:28:52 +00:00
John Baldwin 3f7ca8f3d2 - Remove duplicate cp_time declaration.
- Use extended printf format string version of KTR trace points.
2000-09-11 05:23:21 +00:00
John Baldwin 131568fdb5 Relocate sys/systm.h #include to quiet warning. 2000-09-11 05:19:37 +00:00
Doug Rabson 28c4f9b685 Remove the manipulation of the Giant mutex from the interrupt entry
points. This can't work right anyway and needs to happen in the irq thread.
2000-09-10 15:39:23 +00:00
Doug Rabson 2604bbc62c Fix printf warnings. 2000-09-10 13:32:39 +00:00
Doug Rabson 5a81a9aef0 Fix printf warnings in CTRx calls. 2000-09-10 13:04:20 +00:00
Doug Rabson 6d8131b4c0 Update to work with the current version of KTR. 2000-09-10 13:03:24 +00:00
Jason Evans 5340642a2e Style cleanups. No functional changes. 2000-09-09 23:18:48 +00:00
Jason Evans 46bf3fe5a6 Add file and line arguments to WITNESS_ENTER() and WITNESS_EXIT, since
__FILE__ and __LINE__ don't get expanded usefully in inline functions.

Add const to all witness*() arguments that are filenames.
2000-09-09 22:43:22 +00:00
Alexander Langer e4b20971a6 LINT -> NOTES 2000-09-09 16:07:15 +00:00
John Baldwin cc198001ee Add missing \'s to multline macros used for assertions. 2000-09-09 00:14:27 +00:00
Jason Evans d0b01efdeb Use inline functions instead of macros for mtx_enter(), mtx_try_enter(),
and mtx_exit().  This change tracks the i386 version.

Rename mtx_enter(), mtx_try_enter(), and mtx_exit() and wrap them with cpp
macros that expand to pass filename and line number information.  This is
necessary since we're using inline functions instead of macros now.

Add const to the filename pointers passed througout the mtx and witness
code.
2000-09-08 21:47:29 +00:00
Jason Evans c3b8f29aea Only call kdb_trap() if the DDB config option is specified. 2000-09-08 09:51:16 +00:00
David E. O'Brien ab721da874 Minimal set of diffs from the i386 bits to the AlphaLinux.
Submitted by:	gallatin (content, minimization by me)
2000-09-07 06:12:41 +00:00
Jason Evans 0384fff8c5 Major update to the way synchronization is done in the kernel. Highlights
include:

* Mutual exclusion is used instead of spl*().  See mutex(9).  (Note: The
  alpha port is still in transition and currently uses both.)

* Per-CPU idle processes.

* Interrupts are run in their own separate kernel threads and can be
  preempted (i386 only).

Partially contributed by:	BSDi (BSD/OS)
Submissions by (at least):	cp, dfr, dillon, grog, jake, jhb, sheldonh
2000-09-07 01:33:02 +00:00
Jason Evans 62ae6c89ad Add KTR, a facility that logs kernel events in order to to facilitate
debugging.

Acquired from:	BSDi (BSD/OS)
Submitted by:	dfr, grog, jake, jhb
2000-09-07 01:29:44 +00:00
David E. O'Brien 78a7c549ee Minimal set of diffs from the i386 bits to the AlphaLinux.
Submitted by:	gallatin (content, minimization by me)
2000-09-06 19:26:17 +00:00
David E. O'Brien a66b981248 Add the AlphaLinux locore support.
Submitted by:	gallatin
2000-09-06 18:26:29 +00:00
Peter Wemm 1becb98646 Revive these files in their new location. These were repo copied from
the old files before Marcel lost the history on them.

Requested by:	obrien
2000-09-06 17:59:21 +00:00
Poul-Henning Kamp 819e370c3b Introduce atomic_cmpset_int() and atomic_cmpset_long() from SMPng a
few hours earlier than the rest.

The next DEVFS commit needs these functions.

Alpha versions by: dfr
i386 versions by: jakeb

Approved by:    SMPng
2000-09-06 11:21:14 +00:00
Marcel Moolenaar dee4ec33cf When sigaltstack is called with a stack size that's not smaller
than LINUX_MINSIGSTKSZ but smaller than MINSIGSTKSZ, cheat and
pass MINSIGSTKSZ to the kernel. This is a workaround.

Submitted through: nate
2000-09-06 06:08:54 +00:00
Wilko Bulte 1b2f17352d Add AS1200 (Tincup) to description 2000-09-04 20:47:35 +00:00
Wilko Bulte 8c14ef3a31 LINT -> NOTES 2000-09-04 20:45:15 +00:00
Peter Wemm da65de1dee Complain if we cannot find loader(8) metadata. 2000-09-03 04:13:03 +00:00
Peter Wemm ca3ae8c2c0 Find the module metadata before the console init rather than after.
This should repair consoles on the Alpha when using dynamic hints.
2000-09-03 04:07:41 +00:00
Andrew Gallatin 72f21cf2c5 A quick fix to get around a problem (described below) with cia based
machines.  The patch uses an existing global variable in place of the
newbus accessor to get at use_bwx.

This is a quick fix to get miatas booting again; somebody
with more newbus skills than I can muster will have to correct it.

Matt Jacob's description of the problem from the -alpha list:

The IVAR accessor stuff for pcib is incompletely specified for CIA. There's
only one accessor defined, and that's to get the BUS instance number.
<..>
The device methods that try and get at the use_bwx get overriden because
there's only one ivar for CIA's pcib, and that's for hose #, and it's always
zero.
2000-09-02 01:05:37 +00:00
Andrew Gallatin cae70b8d4c Introduce explicit break statements in the various chipsets'
foo_pcib_[read|write]_config() functions rather than relying on
a break or return being in the CFG macro.

This fixes a panic later in the boot process on a UP1000.  From
inspection, it looks like this fixes a similar problem in the tsunami code.

Approved by: dfr
2000-08-31 16:19:27 +00:00
Andrew Gallatin 2d47df31fb fix a typo introduced by Doug's busspace changes that causes UP1000s to
crash very early in the boot process with a ksp not valid halt to the SRM.

submitted by: dfr
2000-08-31 16:11:20 +00:00
Doug Rabson 7d9c133636 Remove a vestige of an older attempt at implementing this. 2000-08-29 08:50:17 +00:00
Doug Rabson 21c3015a24 * Completely rewrite the alpha busspace to hide the implementation from
the drivers.
* Remove legacy inx/outx support from chipset and replace with macros
  which call busspace.
* Rework pci config accesses to route through the pcib device instead of
  calling a MD function directly.

With these changes it is possible to cleanly support machines which have
more than one independantly numbered PCI busses. As a bonus, the new
busspace implementation should be measurably faster than the old one.
2000-08-28 21:48:13 +00:00
Matt Jacob 170fecb13c *fix* commented out DEVFS 2000-08-27 21:57:31 +00:00
Matt Jacob 8669ad2fe3 add commented out DEVFS 2000-08-27 21:56:40 +00:00
Marcel Moolenaar bc34729c47 Fix typo in license. 2000-08-25 07:32:24 +00:00
Peter Wemm 2422dd7973 Comment out the static wiring of hints for GENERIC - the release process
now installs the hints file into /boot.
2000-08-24 18:56:54 +00:00
Marcel Moolenaar 3ed7f6a56f Finish the Linuxulator MD/MI split.
In summary:
o  This file has been moved to sys/compat/linux,
o  Any MD syscalls in this file are moved to
   linux_machdep.c in sys/i386/linux,
o  Include directives, makefiles and config files
   have been updated.
2000-08-22 07:08:33 +00:00
Marcel Moolenaar 322bfdc330 Update include directives for Linuxulator headers after the
MD/MI split.
2000-08-22 05:57:55 +00:00
Marcel Moolenaar 146aad745b Collect the MD syscalls from /sys/compat/linux here. Since this
is a new file, fix most of the style bugs at the same time.
2000-08-22 02:24:02 +00:00
David Malone a5c4836d39 Replace the mbuf external reference counting code with something
that should be better.

The old code counted references to mbuf clusters by using the offset
of the cluster from the start of memory allocated for mbufs and
clusters as an index into an array of chars, which did the reference
counting. If the external storage was not a cluster then reference
counting had to be done by the code using that external storage.

NetBSD's system of linked lists of mbufs was cosidered, but Alfred
felt it would have locking issues when the kernel was made more
SMP friendly.

The system implimented uses a pool of unions to track external
storage. The union contains an int for counting the references and
a pointer for forming a free list. The reference counts are
incremented and decremented atomically and so should be SMP friendly.
This system can track reference counts for any sort of external
storage.

Access to the reference counting stuff is now through macros defined
in mbuf.h, so it should be easier to make changes to the system in
the future.

The possibility of storing the reference count in one of the
referencing mbufs was considered, but was rejected 'cos it would
often leave extra mbufs allocated. Storing the reference count in
the cluster was also considered, but because the external storage
may not be a cluster this isn't an option.

The size of the pool of reference counters is available in the
stats provided by "netstat -m".

PR:		19866
Submitted by:	Bosko Milekic <bmilekic@dsuper.net>
Reviewed by:	alfred (glanced at by others on -net)
2000-08-19 08:32:59 +00:00
Peter Wemm 3a285cc807 Regen. (Fix SYS_exit) 2000-07-29 10:07:38 +00:00
Peter Wemm 4e0f152bbe Sigh. Fix SYS_exit problems. I misunderstood the significance of these
trailing options.
2000-07-29 10:05:25 +00:00
David E. O'Brien f6dc8d17b1 Move RAID controllers to the same position as in i386 GENERIC. 2000-07-29 02:13:42 +00:00
David E. O'Brien 73c9daf94f Add the RAID controller that are known to work (or did on last test).
Reviewed by: 	msmith
2000-07-29 01:59:32 +00:00
David E. O'Brien cf10fa4fcd Comment out ncr' as sym' handles all that `ncr' does.
(only commented out to make it easy for people to find it that really
 wants it.)

Asked for by:	Peter
2000-07-29 01:31:09 +00:00
Peter Wemm 69065e880a Regenerate with makesyscalls.sh 2000-07-29 00:21:50 +00:00
Peter Wemm ac2b067b9a Change the 'exit()' system call to 'sys_exit()'. This avoids overlapping
gcc's internal exit() prototypes and the (futile) hackery that we did to
try and avoid warnings.  main() was renamed for similar reasons.
Remove an exit related hack from makesyscalls.sh.
2000-07-29 00:16:28 +00:00
Marcel Moolenaar 4c02bded00 Remove the only use of SCARG and perform dead code elimination. 2000-07-27 01:22:24 +00:00
Marcel Moolenaar a603fe5a07 Revert implementation of setfsuid and setfsgid due to security
issues.

Requested by: rwatson
Backed by: kris
2000-07-20 05:37:41 +00:00
David E. O'Brien 433364bb77 Remove an OBE comment. 2000-07-18 18:27:06 +00:00
David E. O'Brien 6b02e06806 KNF'ize. 2000-07-18 18:26:03 +00:00
Matt Jacob e2f7ff26d3 oops- need reboot.h file 2000-07-18 16:47:49 +00:00
Matt Jacob 116da9daa7 Add case that David missed about setting RB_SERIAL. 2000-07-18 16:25:14 +00:00
David E. O'Brien 628224b176 Set `boothowto' approapiately if our console is a serial one.
The "debug.boothowto" sysctl can now be used (as on the i386) to determine
if the console is a serial one.
2000-07-18 10:05:10 +00:00
Marcel Moolenaar d5124417a7 Implement pread and pwrite.
PR: 17991
Submitted by: Geoffrey Speicher <geoff@caribbean.sea-incorporated.com>
2000-07-17 00:17:07 +00:00
Marcel Moolenaar 6037da7d24 Add prototypes for linux_pread and linux_pwrite.
PR: 17991
Submitted by: Geoffrey Speicher <geoff@caribbean.sea-incorporated.com>
2000-07-17 00:13:38 +00:00
Marcel Moolenaar ddb48608ab Implement setfsuid and setfsgid. Implementation derived from patch
in PR.

PR: 16993
Submitted by: Bjoern Groenvall <bg@sics.se>
2000-07-16 21:23:34 +00:00
David E. O'Brien 53d52f0b40 Add SOFTUPDATES to GENERIC (BOOTMFS has this filtered out) 2000-07-15 06:06:42 +00:00
Archie Cobbs 21b8ebd926 Make all Ethernet drivers attach using ether_ifattach() and detach using
ether_ifdetach().

The former consolidates the operations of if_attach(), ng_ether_attach(),
and bpfattach(). The latter consolidates the corresponding detach operations.

Reviewed by:	julian, freebsd-net
2000-07-13 22:54:34 +00:00
Andrew Gallatin 73acacf4ca magnetic tape support
Submitted by: Clem Cole <clemc@mro.dec.com>
2000-07-13 20:04:21 +00:00
Matt Jacob e8ad1d0707 Handle (for now) trivial one level bridge case so we can get the
slot that the bridge happens to be in so we get interrupts working
on bridged cards.
2000-07-13 03:45:11 +00:00
Matt Jacob 08a7e04845 Removing commented out devices I added. 2000-07-10 15:18:20 +00:00
Kris Kennaway 26eaf5dcb8 Don't call printf with no format string.
Reviewed by:	msmith
2000-07-10 05:51:56 +00:00
Matt Jacob f919331938 Do the same thing for TurboLaser that was done for Rawhide- make room
for secondary (bridged) PCI busses by making primary PCI instances
16 units apart.
2000-07-10 02:40:49 +00:00
Matt Jacob aa5904a62a Coordinate with change to mcpcia_pci.c- major primary busses on each
hose are 16 PCI instances apart. This allows us to recognize secondary
PCI busses (at least to a first level) until the pci infrastructure is
fixed.

Turn on support for secondary cycles, too.  Redo debug printouts.
2000-07-10 00:34:18 +00:00
Matt Jacob bc08581099 Don't let the infrastructure assign the 'next' PCI bus for us.
Instead, for now (until we get a pci infrastructure cleanup),
assign the PCI bus number to be mcpcia bus instance << 4. This
is to allow secondary bridges some room to be recongnized on
4100 systems.
2000-07-10 00:32:02 +00:00
Matt Jacob a4846ce28f Add in the commented out SCSI device entries of
#device         ses             # SCSI Environmental Services (and SAF-TE)
#device         targ            # SCSI Target Mode Code
#device         targbh          # SCSI Target Mode Blackhole Device
#define         pt              # SCSI Processor Target Device

so that people know that they are there.
2000-07-08 07:05:06 +00:00
John Baldwin 9701cd40b4 Support for unsigned integer and long sysctl variables. Update the
SYSCTL_LONG macro to be consistent with other integer sysctl variables
and require an initial value instead of assuming 0.  Update several
sysctl variables to use the unsigned types.

PR:		15251
Submitted by:	Kelly Yancey <kbyanc@posi.net>
2000-07-05 07:46:41 +00:00
Poul-Henning Kamp 77978ab8bc Previous commit changing SYSCTL_HANDLER_ARGS violated KNF.
Pointed out by:	bde
2000-07-04 11:25:35 +00:00
Poul-Henning Kamp 82d9ae4e32 Style police catches up with rev 1.26 of src/sys/sys/sysctl.h:
Sanitize SYSCTL_HANDLER_ARGS so that simplistic tools can grog our
sources:

        -sysctl_vm_zone SYSCTL_HANDLER_ARGS
        +sysctl_vm_zone (SYSCTL_HANDLER_ARGS)
2000-07-03 09:35:31 +00:00
Andrew Gallatin d8cbedb6b0 remove breakage that snuck in with my last commit
pointed out by: peter
2000-06-29 02:26:48 +00:00
Peter Wemm 1bce768912 Report the line number where gethints.pl does not understand something
in an old device line.
2000-06-26 09:08:23 +00:00
Mark Murray 06d9723a00 Get the memory range stuff properly declared. 2000-06-25 21:07:43 +00:00
Mark Murray 14a994f94a Replace variable removed by overly sharp South African panga. 2000-06-25 21:02:10 +00:00
Mark Murray f66590042b Sort out headers and silence warnings. 2000-06-25 20:56:21 +00:00
Andrew Gallatin b39de2c700 - print out the correct cputype & string for unconfigured API systems
- print out the correct cputype for unsupported API systems
2000-06-25 20:41:49 +00:00
Doug Rabson 913ed684c1 Remove offensive language. 2000-06-25 09:30:53 +00:00
Doug Rabson 2ed44774d6 Fix typo in comment. 2000-06-25 09:30:17 +00:00
Mark Murray 15bbdecf2e Get the build bits right for the new Architecture Independant null- and
entropy drivers.
Reviewed by:	dfr(mostly)
2000-06-25 09:18:13 +00:00
Mark Murray 2ccabb1720 Strip out the machine-independant parts of the memory device.
/dev/(u)random, /dev/null, /dev/zero are all moving to machine-independant
drivers.
2000-06-25 09:03:20 +00:00
Matt Jacob 8c14a611a4 Fix the breakage that occurred when somebody didn't do a complete
checkin of the changes to kern_prot.c.
2000-06-23 22:44:04 +00:00
Andrew Gallatin 126a0c9569 Add UP1000 to GENERIC 2000-06-19 21:55:42 +00:00
Andrew Gallatin 475804707d unbreak kernels without UP1000 support 2000-06-19 21:49:47 +00:00
Andrew Gallatin 72e9d2e8a2 Add support for the Alpha Processor, Inc. UP1000 system.
Reviewed by: dfr
Thanks to:  Alpha Processor Inc. for supplying the hardware.
2000-06-19 21:15:45 +00:00
Andrew Gallatin 49c0f52e11 Support bounce buffers for ISA DMA on the alpha. This is required for the
irongate chipset (used in the UP1000) which does not support scatter/gather
DMA.  We'll still use scatter gather if the core logic chipset supports it.

Reviewed by: dfr
2000-06-19 18:41:27 +00:00
Peter Wemm c46d792d58 Deal with quoted arguments. This hack parser uses whitespace to delimit
fields, not lex/yacc grammar so it is not an exact match but should be
close enough for most cases.
Deal with 'port?', 'irq?' style specifications.  These are parsed as
seperate values in lex/yacc in config(8) but tripped up this helper tool.
2000-06-17 20:10:55 +00:00
Peter Wemm 7ebe1c3acf Use while (<>) instead of while(<STDIN>) so that perl will automagically
deal with filename arguments.  It is amazing how much you forget over time.

Thanks to the people that reminded me this.  I knew there was an easy way
that didn't involve messing with $argv, filehandles, etc, but just could
not remember - all of my books are on the opposite side of the planet..
2000-06-17 19:06:13 +00:00
Peter Wemm 2c7c3a91e9 Print error messages to stderr, not stdout. 2000-06-14 02:45:11 +00:00
Peter Wemm f71c01cc52 Borrow phk's axe and apply the next stage of config(8)'s evolution.
Use Warner Losh's "hint" driver to decode ascii strings to fill the
resource table at boot time.

config(8) no longer generates an ioconf.c table - ie: the configuration
no longer has to be compiled into the kernel.  You can reconfigure your
isa devices with the likes of this at loader(8) time:
  set hint.ed.0.port=0x320

userconfig will be rewritten to use this style interface one day and will
move to /boot/userconfig.4th or something like that.

It is still possible to statically compile in a set of hints into a kernel
if you do not wish to use loader(8).  See the "hints" directive in GENERIC
as an example.

All device wiring has been moved out of config(8).  There is a set of
helper scripts (see i386/conf/gethints.pl, and the same for alpha and pc98)
that extract the 'at isa? port foo irq bar' from the old files and produces
a hints file.  If you install this file as /boot/device.hints (and update
/boot/defaults/loader.conf - You can do a build/install in sys/boot) then
loader will load it automatically for you.  You can also compile in the
hints directly with:  hints "device.hints"  as well.

There are a few things that I'm not too happy with yet.  Under this scheme,
things like LINT would no longer be useful as "documentation" of settings.
I have renamed this file to 'NOTES' and stored the example hints strings
in it.  However... this is not something that config(8) understands, so
there is a script that extracts the build-specific data from the
documentation file (NOTES) to produce a LINT that can be config'ed and
built.  A stack of man4 pages will need updating. :-/

Also, since there is no longer a difference between 'device' and
'pseudo-device' I collapsed the two together, and the resulting 'device'
takes a 'number of units' for devices that still have it statically
allocated.  eg:  'device fe 4' will compile the fe driver with NFE set
to 4.  You can then set hints for 4 units (0 - 3).  Also note that
'device fe0' will be interpreted as "zero units of 'fe'" which would be
bad, so there is a config warning for this.  This is only needed for
old drivers that still have static limits on numbers of units.
All the statically limited drivers that I could find were marked.

Please exercise EXTREME CAUTION when transitioning!

Moral support by: phk, msmith, dfr, asmodai, imp, and others
2000-06-13 22:28:50 +00:00
Matt Jacob 79a4bee867 Sometimes there isn't an ISA bus configured. 2000-06-12 17:07:57 +00:00
Alan Cox 6fba331424 cpu_fork(): Check "flags" before dereferencing "p2". Otherwise,
the call "vm_fork(p1, 0, flags);" early in fork1 can cause a kernel
panic.
2000-06-11 06:22:01 +00:00
David E. O'Brien 6313c97e77 It is not necessary to wrap usage of $f28 with ".set noat/at" pairs.
A very bogus gas warning gave people the impression it was.  noat/at had
no useful affect here.
2000-06-10 20:42:27 +00:00
Alexander Langer 821f9a8eba Avoid useless check against NULL, since we assign the checked value
to the var anyways.

Reviewed by:	bde
2000-06-10 19:48:19 +00:00
John Baldwin 9369c9fb75 Enable USB in GENERIC on the Alpha.
Reviewed by:	deathly silence on -alpha
2000-06-08 01:17:51 +00:00
Matt Jacob 5ce3b01ace Do an explicit getenv on boot_verbose. Now that we have a real FICL boot
loader for alpha (Yay!) we still need to explicitly look for boot_verbose-
I assume because the boothowto flags aren't passed to us at boot like x86.

Do some minor cosmetics as well.
2000-06-07 17:36:17 +00:00
David E. O'Brien 7a0e3a90cb Consistently protect f28 with noat/at pairs.
This may be be necessary.  But we are taking the conservative approach at
the moment.

Reviewed by:	mjacob, gallatin
2000-06-05 23:05:22 +00:00
Brian Feldman c0c5a953c0 Change sl(4) configuration lines to reflect its new dynamic nature. 2000-05-30 23:01:37 +00:00
Doug Rabson 1536418a84 Brucify the pmap_enter_temporary() changes. 2000-05-29 19:21:01 +00:00
Andrew Gallatin 4e5adf5f4a Part of AS2100 support that I neglected to commit last night
pointed out by: dfr
2000-05-28 17:52:08 +00:00
Doug Rabson 31891bc2bd Add a new pmap entry point, pmap_enter_temporary() to be used during
dumps to create temporary page mappings. This replaces the use of CADDR1
which is fairly x86 specific.

Reviewed by: dillon
2000-05-28 15:49:55 +00:00
Doug Rabson ca2e05343b Add taskqueue system for easy-to-use SWIs among other things.
Reviewed by: arch
2000-05-28 15:45:30 +00:00
Andrew Gallatin 6ab09a6376 Add AlphaServer 2000 (demi-sable), 2100 (sable), and 2100A (lynx) support.
Only PCI and on-board ISA peripherials are supported at this time.

This support has been only lightly tested due to a lack of response to my
call for testers on the freebsd-alpha mailing list.  It works quite well
on the one AS2100 on which it has been tested, but it may not work on
an AS2100A and should therefore be regarded as experimental.
2000-05-28 02:52:54 +00:00
Andrew Gallatin 521ff6f1b9 Allow platform specific isa interrupt setup & teardown routines in
preparation for sable/lynx support
2000-05-28 02:40:53 +00:00
Doug Rabson 44eb1261b4 Use bus_space_handle_t instead of bus_space_tag_t to hold the result
from rman_get_bushandle().
2000-05-27 10:02:32 +00:00
Jake Burkholder e39756439c Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by:		msmith and others
2000-05-26 02:09:24 +00:00
Jake Burkholder 740a1973a6 Change the way that the queue(3) structures are declared; don't assume that
the type argument to *_HEAD and *_ENTRY is a struct.

Suggested by:	phk
Reviewed by:	phk
Approved by:	mdodd
2000-05-23 20:41:01 +00:00
Dan Moschuk 4f14ee00f2 sysctl'ize ICMP_BANDLIM and ICMP_BANDLIM_SUPPRESS_OUTPUT.
Suggested by: des/nbm
2000-05-22 16:12:28 +00:00
Peter Wemm bb7df05f67 Ack, I made a typo moments before commit. :-( 2000-05-21 13:00:21 +00:00
Peter Wemm 0385347c1a Implement an optimization of the VM<->pmap API. Pass vm_page_t's directly
to various pmap_*() functions instead of looking up the physical address
and passing that.  In many cases, the first thing the pmap code was doing
was going to a lot of trouble to get back the original vm_page_t, or
it's shadow pv_table entry.

Inspired by: John Dyson's 1998 patches.

Also:
Eliminate pv_table as a seperate thing and build it into a machine
dependent part of vm_page_t.  This eliminates having a seperate set of
structions that shadow each other in a 1:1 fashion that we often went to
a lot of trouble to translate from one to the other. (see above)
This happens to save 4 bytes of physical memory for each page in the
system.  (8 bytes on the Alpha).

Eliminate the use of the phys_avail[] array to determine if a page is
managed (ie: it has pv_entries etc).  Store this information in a flag.
Things like device_pager set it because they create vm_page_t's on the
fly that do not have pv_entries.  This makes it easier to "unmanage" a
page of physical memory (this will be taken advantage of in subsequent
commits).

Add a function to add a new page to the freelist.  This could be used
for reclaiming the previously wasted pages left over from preloaded
loader(8) files.

Reviewed by:	dillon
2000-05-21 12:50:18 +00:00
Peter Wemm 0fd66c1d39 Eliminate a couple of evil common declarations. 2000-05-18 23:38:33 +00:00
Doug Rabson 5c885c3f83 Port ppc driver to alpha.
Submitted by: Andrew M. Miklic <miklic@ibm.net>
2000-05-14 13:47:57 +00:00
Archie Cobbs 2e2de7f23f Move code to handle BPF and bridging for incoming Ethernet packets out
of the individual drivers and into the common routine ether_input().
Also, remove the (incomplete) hack for matching ethernet headers
in the ip_fw code.

The good news: net result of 1016 lines removed, and this should make
bridging now work with *all* Ethernet drivers.

The bad news: it's nearly impossible to test every driver, especially
for bridging, and I was unable to get much testing help on the mailing
lists.

Reviewed by:	freebsd-net
2000-05-14 02:18:43 +00:00
Doug Rabson e3227bc7a6 Enable EISA interrupts if the mcpcia has an attached EISA bus. 2000-05-13 21:33:57 +00:00
Tim Vanderhoek 214d1c55f7 Change to comments only: spell FreeBSD.org correctly 2000-05-13 11:21:19 +00:00
Peter Wemm 59a9500cfa Make /dev/[k]mem work after last commit. Transfers were being double
counted due to break/continue changes that were missed.  There are
still too many diffs relative to the i386 version.
2000-05-13 07:43:00 +00:00
Mike Smith 6d7d302695 Fix a leak where a scratch buffer was not freed when reading from the
/dev/?random devices.  This appears to have been missed when the code
was brought across from the i386.  (This should fix the "world build
hangs with everything waiting on 'temp' problem.)

Also add some iovec fixup code in the error path which seems to have
been similarly fixed.

There are a number of other differences between the i386 and alpha
version which have not been examined.  This code should still be
considered suspect.
2000-05-13 05:38:25 +00:00
Andrew Gallatin a60dc62ec7 Some white-box (NT) systems have SRM which reports a systype that's
the negative of their blue-box (UNIX/OVMS) counterpart.  This was
causing us to panic early in the boot process because we weren't
expecting a negative index into the cpuinit[] array.

Obtained from: NetBSD
Reported by: Brett Bump <bbump@mail.enetis.net>
2000-05-11 13:31:05 +00:00
John Baldwin bde8875a06 Finish moving all IEEE fp types to be the same on all arch's. 2000-05-10 19:41:40 +00:00
John Baldwin 7b7f33c4c3 Handle PCI devices that actually use an ISA IRQ for the cia and tsunami
chipsets.  An example of this is the USB controller on these chipsets.
With this, I can now use USB devices on the test Alpha I am borrowing at
the moment.

Reviewed by:	dfr, obrien
2000-05-10 18:54:28 +00:00
Bruce Evans 9114579d7a Regenerated (fixed the calculation of sy_nargs in sysent tables). 2000-05-09 21:52:02 +00:00
Bruce Evans 29270d20bc Fixed the return type for exit() and the args struct tag several NOPROTO
syscalls including exit().  These entries were unused, so the bugs had no
effect, but the the args struct tag will be used to calculate sy_nargs
correctly.  exit() was wrong in all emulators.
2000-05-09 18:23:16 +00:00
David E. O'Brien 0cc9df7d62 Change floating point exception type to match the i386 one.
Submitted by:	Mark Abene <phiber@radicalmedia.com>
2000-05-09 17:43:20 +00:00
Matt Jacob f66ed5ddfa Change references/comments about 'secondary' to reflect that while we'd
like to see the true SRM bus number be passed to us, instead, we get FreeBSD's
PCI bus instance number (Brzzt! Wrong Answer!).

Also, once we've seen the MCPCIA that has the EISA bus on it, call
dec_kn300_cons_init just before configuring devices on this bus.
2000-05-09 02:20:44 +00:00
Matt Jacob b7f041a89d Unhide dec_kn300_cons_init and don't make it something we call early.
We'll call it later when, in the natural order of things, we configure
the MCPCIA that has the EISA bus that a serial console and/or VGA and/or
keyboard.
2000-05-09 02:19:04 +00:00
Matt Jacob 2d41e34a07 Fix DELAY function to use the RPCC cycle counter register. 2000-05-07 22:44:27 +00:00
Matt Jacob 3920b84004 oops! final piece for Rawhides 2000-05-07 17:44:50 +00:00
Paul Saab 274254e1f1 Fix checksum calculations. This should fix the network problems
in current where all packets were returning with bad checksums.
(observed with netstat -s).

Reviewed by:	alfred
2000-05-07 16:41:15 +00:00
Matt Jacob a9036c1818 Well, for now at least, we'll also have the 4100 also have a prom console. 2000-05-07 06:15:37 +00:00
Matt Jacob 4d8f2e9a35 Add option for Rawhide (AlphaServer 4100 systems). 2000-05-07 05:50:27 +00:00
Matt Jacob 157ffa95ef Pass the vector on thru instead of checking EISA/ISA ints. It turns
out the FreeBSD code did the right thing by starting EISA/ISA vectors
at 0x800.
2000-05-07 05:49:27 +00:00
Matt Jacob d55ab6af0d EISA/ISA memory space is any pa < 8MB. 2000-05-07 05:31:39 +00:00
Matt Jacob db187f1d6f add in dec_kn300 (Alpha 4100) case 2000-05-07 05:00:26 +00:00
Matt Jacob a9b64eeadb add in stubbie mcpcia_pci that will parent PCI busses 2000-05-07 04:59:30 +00:00
Matt Jacob 34255ec554 Add in a first pass at Alpha 4100 (Rawhide) support. It doesn't quite
boot all the way yet, but it's darn close (blows up somewhere probing
the PS/2 mouse on the EISA bus).
2000-05-07 04:53:04 +00:00
Jonathan Lemon cb1a6557e1 Make in_cksum() a macro call to in_cksum_skip(), since it provides the
same functionality.  Sharing code should help cache issues.

Remove in_cksum_partial, since its not being used, and we now have
a way to compute partial checksums on mbuf chains.
2000-05-06 18:18:32 +00:00
Peter Wemm 1d91482db9 Add a version tag for the rtc port to depend on. 2000-05-06 01:36:04 +00:00
Poul-Henning Kamp 9626b608de Separate the struct bio related stuff out of <sys/buf.h> into
<sys/bio.h>.

<sys/bio.h> is now a prerequisite for <sys/buf.h> but it shall
not be made a nested include according to bdes teachings on the
subject of nested includes.

Diskdrivers and similar stuff below specfs::strategy() should no
longer need to include <sys/buf.> unless they need caching of data.

Still a few bogus uses of struct buf to track down.

Repocopy by:    peter
2000-05-05 09:59:14 +00:00
Poul-Henning Kamp 33a0a551d4 remove unneeded #include <sys/buf.h> 2000-05-05 09:24:00 +00:00
Peter Wemm 365c5db0a7 Add $FreeBSD$ 2000-05-01 20:32:07 +00:00
Peter Wemm ab063af911 Move the MSG* and SEM* options to opt_sysvipc.h
Remove evil allocation macros from machdep.c (why was that there???) and
use malloc() instead.
Move paramters out of param.h and into the code itself.
Move a bunch of internal definitions from public sys/*.h headers (without
#ifdef _KERNEL even) into the code itself.

I had hoped to make some of this more dynamic, but the cost of doing
wakeups on all sleeping processes on old arrays was too frightening.
The other possibility is to initialize on the first use, and allow
dynamic sysctl changes to parameters right until that point. That would
allow /etc/rc.sysctl to change SEM* and MSG* defaults as we presently
do with SHM*, but without the nightmare of changing a running system.
2000-05-01 13:33:56 +00:00
Doug Rabson 0163d0f514 Include <sys/random.h> for rand_initialize(). 2000-04-30 09:41:35 +00:00
David E. O'Brien b870c55839 Hookup /dev/[u]random on the Alpha. 2000-04-28 17:18:48 +00:00
David E. O'Brien 5af5e4c773 Initialise entropy pool.
Submitted by:	dfr
2000-04-28 17:17:41 +00:00
Matthew Dillon d323ddf317 Fix #! script exec under linux emulation. If a script is exec'd from a
program running under linux emulation, the script binary is checked for
    in /compat/linux first.  Without this patch the wrong script binary
    (i.e. the FreeBSD binary) will be run instead of the linux binary.
    For example, #!/bin/sh, thus breaking out of linux compatibility mode.

    This solves a number of problems people have had installing linux
    software on FreeBSD boxes.
2000-04-26 20:58:40 +00:00
Matt Jacob e467e8a4ee Remove dummy read_random function since we now have a real one. 2000-04-26 06:49:39 +00:00
Matt Jacob 09dc0c8c21 Well, make intrhand2_t take a void * arg then. Matches i386. 2000-04-26 06:48:54 +00:00
Poul-Henning Kamp ed6aff7387 Remove unneeded <sys/buf.h> includes.
Due to some interesting cpp tricks in lockmgr, the LINT kernel shrinks
by 924 bytes.
2000-04-18 15:15:39 +00:00
David E. O'Brien c815a20cb2 Change our ELF binary branding to something more acceptable to the Binutils
maintainers.

After we established our branding method of writing upto 8 characters of
the OS name into the ELF header in the padding; the Binutils maintainers
and/or SCO (as USL) decided that instead the ELF header should grow two new
fields -- EI_OSABI and EI_ABIVERSION.  Each of these are an 8-bit unsigned
integer.  SCO has assigned official values for the EI_OSABI field.  In
addition to this, the Binutils maintainers and NetBSD decided that a better
ELF branding method was to include ABI information in a ".note" ELF
section.

With this set of changes, we will now create ELF binaries branded using
both "official" methods.  Due to the complexity of adding a section to a
binary, binaries branded with ``brandelf'' will only brand using the
EI_OSABI method.  Also due to the complexity of pulling a section out of an
ELF file vs. poking around in the ELF header, our image activator only
looks at the EI_OSABI header field.

Note that a new kernel can still properly load old binaries except for
Linux static binaries branded in our old method.

  *
  * For a short period of time, ``ld'' will also brand ELF binaries
  * using our old method.  This is so people can still use kernel.old
  * with a new world.  This support will be removed before 5.0-RELEASE,
  * and may not last anywhere upto the actual release.  My expiration
  * time for this is about 6mo.
  *
2000-04-18 02:39:26 +00:00
Roger Hardiman 15c204466e Add include files to alpha/include directory.
Eventually the i386/include and alpha/include header files for the bktr
driver will be moved to a common directory.
2000-04-15 08:07:56 +00:00
Poul-Henning Kamp 8177437d85 Complete the bio/buf divorce for all code below devfs::strategy
Exceptions:
        Vinum untouched.  This means that it cannot be compiled.
        Greg Lehey is on the case.

        CCD not converted yet, casts to struct buf (still safe)

        atapi-cd casts to struct buf to examine B_PHYS
2000-04-15 05:54:02 +00:00
Doug Rabson f7b7769172 * Factor out the object system from new-bus so that it can be used by
non-device code.
* Re-implement the method dispatch to improve efficiency. The new system
  takes about 40ns for a method dispatch on a 300Mhz PII which is only
  10ns slower than a direct function call on the same hardware.

This changes the new-bus ABI slightly so make sure you re-compile any
driver modules which you use.
2000-04-08 14:17:18 +00:00
Poul-Henning Kamp c244d2de43 Move B_ERROR flag to b_ioflags and call it BIO_ERROR.
(Much of this done by script)

Move B_ORDERED flag to b_ioflags and call it BIO_ORDERED.

Move b_pblkno and b_iodone_chain to struct bio while we transition, they
will be obsoleted once bio structs chain/stack.

Add bio_queue field for struct bio aware disksort.

Address a lot of stylistic issues brought up by bde.
2000-04-02 15:24:56 +00:00
Bill Fumerola df38713c24 Avoid dividing by zero when beeping with a zero pitch. This was bad.
PR:		alpha/17637
Submitted by:	Bosko Milekic <bmilekic@dsuper.net>
Reported by:	Dennis Lindroos <lindroos@nls.fi>
2000-03-30 22:39:48 +00:00
Peter Wemm 255108f385 Make sysv-style shared memory tuneable params fully runtime adjustable
via sysctl.  It's done pretty simply but it should be quite adequate.
Also move SHMMAXPGS from $machine/include/vmparam.h as the comments that
went with it were wrong... we don't allocate KVM space for the pages so
that comment is bogus..  The only practical limit is how much physical
ram you want to lock up as this stuff isn't paged out or swap backed.
2000-03-30 07:17:05 +00:00
Peter Wemm 27361f297c Try and make the Alpha kernel compile. There are still some loose ends
(eg: common declarations in includes that I think are causing gensetdefs
 warnings) that need to be tied up, but it compiles and runs.
2000-03-30 06:44:50 +00:00
Matthew Dillon 36e9f877df Commit major SMP cleanups and move the BGL (big giant lock) in the
syscall path inward.  A system call may select whether it needs the MP
    lock or not (the default being that it does need it).

    A great deal of conditional SMP code for various deadended experiments
    has been removed.  'cil' and 'cml' have been removed entirely, and the
    locking around the cpl has been removed.  The conditional
    separately-locked fast-interrupt code has been removed, meaning that
    interrupts must hold the CPL now (but they pretty much had to anyway).
    Another reason for doing this is that the original separate-lock for
    interrupts just doesn't apply to the interrupt thread mechanism being
    contemplated.

    Modifications to the cpl may now ONLY occur while holding the MP
    lock.  For example, if an otherwise MP safe syscall needs to mess with
    the cpl, it must hold the MP lock for the duration and must (as usual)
    save/restore the cpl in a nested fashion.

    This is precursor work for the real meat coming later: avoiding having
    to hold the MP lock for common syscalls and I/O's and interrupt threads.
    It is expected that the spl mechanisms and new interrupt threading
    mechanisms will be able to run in tandem, allowing a slow piecemeal
    transition to occur.

    This patch should result in a moderate performance improvement due to
    the considerable amount of code that has been removed from the critical
    path, especially the simplification of the spl*() calls.  The real
    performance gains will come later.

Approved by: jkh
Reviewed by: current, bde (exception.s)
Some work taken from: luoqi's patch
2000-03-28 07:16:37 +00:00
Matthew Dillon 7c58e473f5 Commit the buffer cache cleanup patch to 4.x and 5.x. This patch fixes a
fragmentation problem due to geteblk() reserving too much space for the
    buffer and imposes a larger granularity (16K) on KVA reservations for
    the buffer cache to avoid fragmentation issues.  The buffer cache size
    calculations have been redone to simplify them (fewer defines, better
    comments, less chance of running out of KVA).

    The geteblk() fix solves a performance problem that DG was able reproduce.

    This patch does not completely fix the KVA fragmentation problems, but
    it goes a long way

Mostly Reviewed by: bde and others
Approved by: jkh
2000-03-27 21:29:33 +00:00
Jonathan Lemon db4f9cc703 Add support for offloading IP/TCP/UDP checksums to NIC hardware which
supports them.
2000-03-27 19:14:27 +00:00
Matt Jacob 8e3a167c1d It's the parent that is a CPU node- not GBus itself. 2000-03-27 08:22:23 +00:00
Matt Jacob 4cf46078d1 complain when you do not create a TLSB node 2000-03-27 08:20:44 +00:00
Bruce Evans ca04fd5f6f Fixed my breakage of SPLASSERT() in rev.1.15. There was a stray semicolon
after "if ()".
2000-03-23 18:46:44 +00:00
David E. O'Brien 4c3ecb0f88 Switch to the new time counter code to follow the i386.
Assisted by:	phk
2000-03-23 10:22:52 +00:00
Poul-Henning Kamp 21144e3bf1 Remove B_READ, B_WRITE and B_FREEBUF and replace them with a new
field in struct buf: b_iocmd.  The b_iocmd is enforced to have
exactly one bit set.

B_WRITE was bogusly defined as zero giving rise to obvious coding
mistakes.

Also eliminate the redundant struct buf flag B_CALL, it can just
as efficiently be done by comparing b_iodone to NULL.

Should you get a panic or drop into the debugger, complaining about
"b_iocmd", don't continue.  It is likely to write on your disk
where it should have been reading.

This change is a step in the direction towards a stackable BIO capability.

A lot of this patch were machine generated (Thanks to style(9) compliance!)

Vinum users:  Greg has not had time to test this yet, be careful.
2000-03-20 10:44:49 +00:00
Paul Saab 891c64630d Make SPLASSERT sysctl and boot time tunable with kern.splassertmode.
The following values are understood:  0 (ignore), 1 (log), and 2
(panic).

The default value is 1.

Reviewed by:	peter
2000-03-19 14:55:42 +00:00
Peter Wemm 085beaf862 Add the COMPAT_OLDPCI option for the alpha so GENERIC compiles. 2000-03-19 13:57:09 +00:00
Kazutaka YOKOTA 3346e881c1 - Add Support for the following PS/2 mice:
- Microsoft IntelliMouse Explorer: 2 buttons on top, 2 side buttons
    and a wheel which also acts as the middle button.  The mouse is
    recognized as "IntelliMouse Explorer".
  - Genius NetScroll Optical: 2 buttons on top, 2 side buttons and a
    wheel which also acts as the middle button.  The mouse is recognized
    as "NetMouse/NetScroll Optical".
  - MouseSystems SmartScroll Mouse (OEM from Genius?): 3 buttons on top,
    1 side button and a wheel.  The mouse is recognized as Genius
    "NetScroll".
  - IBM ScrollPoint: 2 buttons on top and a stick between the buttons.
    The stick can perform "horizontal scroll" in W*ndows environment.
    The horizontal movement of the stick is detected.  It is currently
    mapped to the Z axis movement in the same way as the first wheel.
    The mouse is recognized as "MouseMan+", as it is considered to be
    a variation of MouseMan.
  - A4 Tech 4D and 4D+ mice. These mice have two wheels! The movement
    of the second wheel is reported as the Z axis movement in the
    same way as the first wheel. These mice are recognized as "4D
    Mouse" and "4D+ Mouse".
  - Tweak IntelliMouse support code a bit so that less-than-compatible
    wheel mice can work properly with the psm driver.
- Add driver configuration flags which correspond to the kernel
  options PSM_HOOKRESUME and PSM_RESETAFTERSUSPEND, so that we don't
  need to recompile the kernel when we need these functions.
- Properly keep track of the irq resource.
- Add a watchdog timer in case interrupts are lost (experimental).
- Add `detach' function (experimental).
2000-03-18 15:21:40 +00:00
Matt Jacob d06b99eb3f Alpha 8200: remove the SIMOS usage of zs_cnattach- we have a real
zs_cnattach now.
2000-03-18 08:04:23 +00:00
Matt Jacob c7790ceee2 Alpha 8200: Redo console attachment to be more 'normal'. Make sure the
halt function *stays* halted.
2000-03-18 08:03:48 +00:00
Matt Jacob d0366c9108 Alpha 8200: redo prom console code to be more up to date, etc. This
is now a functional PROM console (previously broken). Do the correct
promcnatach && CONS_DRIVER dance.
2000-03-18 08:02:35 +00:00
Matt Jacob 583759a807 Alpha 8200: add DEC_KN8AE (TurboLaser) platform option. 2000-03-18 08:01:34 +00:00
Matt Jacob e562365e1e Alpha 8200: Add prototype from promcnattach. 2000-03-18 08:00:51 +00:00
Matt Jacob 6499b39e60 Alpha 8200: Add in a dummy child of dwlpx so that we can make the leap
from DWLPX to PCI space. Just a methods holder such that we have a parent
which is a "pcib" and we create a child which is a "pci". Add the appropriate
ivar code (which is for a hose #).
2000-03-18 08:00:13 +00:00
Matt Jacob 9ca20275e0 Alpha 8200: Do some compilation cleanup. Conditionalize some IDE stuff
based upon presence/absence of ISA (there is no ISA bus on an 8200- okay,
well, there *could* be one in a DWLPX tray, but we don't support it)).

Most importantly change the interrupt resource map to cover a whole 16
bits. The 8200 uses 16 bit interrupt vectors which we construct that
contain the I/O-board, hose, an pci slot in them, and then we write these
vectors into the appropriate DWLPX registers. At any rate, a flat array
of 64 'IRQs' isn't enough.
2000-03-18 07:57:58 +00:00
Matt Jacob 8ad895a6a9 Alpha 8200: Reinsert licence from NetBSD that should have been there
to begin with. Redo newbus attachment code so that all the DMA mapping
and further pci attachment is done right. Insert config space functions
(jeez- how do you do type 1 cycles?). Do the interrupt setups, etc.
Basically, this is the core I/O module for 8200s, even though logically
it's the 3rd level down from the nominal principle backplane bus
(turbolaser). Still to be done here: S/G code isn't done yet, so we
better live with 2GB or less primary memory.
2000-03-18 07:54:11 +00:00
Matt Jacob c6c4384666 Alpha 8200: Remove clause 3 of licence. Clean up code slightly. 2000-03-18 07:50:58 +00:00
Matt Jacob 6beeb2a4cd Alpha 8200: Remove clause 3 of licence. Redo KFTXX bus attachment
code (merge in progress made in NetBSD since the initial import to
FreeBSD). Create dwlpx as the child device. Of course, if we had
more h/w and time, we could find out whether the child device was
a FutureBus module, etc...Anyone ever actually seen one?
2000-03-18 07:49:53 +00:00
Matt Jacob 3c87339922 Alpha 8200: Remove clause 3 of licence and and some KFTXX defines. 2000-03-18 07:48:15 +00:00
Matt Jacob 9132772537 Alpha 8200: minor formatting tweaks; removal of clause 3 of licence. 2000-03-18 07:46:34 +00:00
Matt Jacob eaef8d3ef1 Alpha 8200: Rework to get working properly with real h/w. This isn't a
clean MI/MD driver, but it *does* actually work at this time. Updated
to use new make_dev stuff. A CONS_DRIVER declaration is also put in
so that this can be the real console for the 8200s.
2000-03-18 07:46:05 +00:00
Matt Jacob cf80414e14 Alpha 8200: Ooops on last delta- real changes include redoing bus attachment
code and interrupt mapping code.
2000-03-18 07:44:18 +00:00
Matt Jacob db50341ca1 Alpha 8200: Some minor formatting tweaks and removal of clause 3 of licence. 2000-03-18 07:42:13 +00:00
Matt Jacob 34a2da7f9a Alpha 8200: add a dummy driver for TLSB CPU nodes. Not so dummy, actually,
as you have to hook a GBus into it.
2000-03-18 07:40:17 +00:00
Matt Jacob 23959069d6 Alpha 8200: Add in variables and defines for DWLPX PCI controllers. 2000-03-18 07:30:06 +00:00
Matt Jacob 67795722e9 Alpha8200: Update this stub memory board driver for using newbus. 2000-03-18 07:28:27 +00:00
Poul-Henning Kamp db5f635acc Eliminate the undocumented, experimental, non-delivering and highly
dangerous MAX_PERF option.
2000-03-16 08:51:55 +00:00
Nick Sayer c36837a8d8 Fix some style bugs. The long line is in a chunk of code that's
being rewritten, though.

Submitted by:	bde
2000-03-13 15:27:19 +00:00
Poul-Henning Kamp 4108e7b995 Remove #ifdef UVM stuff which will never be relevant. 2000-03-13 11:12:30 +00:00
Poul-Henning Kamp d8b47cbb70 Stop isadma from abusing the B_READ, B_RAW and B_WRITE flags.
Define ISADMA_{READ,WRITE,RAW} macros with the same numeric
values as the B_{READ,WRITE,RAW} and use them instead throughout.
2000-03-13 10:19:32 +00:00
Nick Sayer 9deb82d478 Implement Linux BLKGETSIZE ioctl, and open the door to implementing
other BLK.* ioctls should the desire arize.

Approved by:	jkh (via dufault)
2000-03-09 15:14:14 +00:00
Peter Dufault 6d9a8d3e8f I applied the wrong patch set. Back out anything associated
with the known bogus currtpriority.  This undoes the previous changes to
sys/i386/i386/trap.c, sys/alpha/alpha/trap.c, sys/sys/systm.h

Now we have the patch set approved by bde.

Approved by:	bde
2000-03-02 22:03:49 +00:00
Peter Dufault 383774c417 Patches that eliminate extra context switches in FIFO case.
Fixes p1003_1b regression test in the simple case of no RR and
FIFO processes competing.

Reviewed by:	jkh, bde
2000-03-02 16:20:07 +00:00
Doug Rabson db1d02f417 * Fix the memory probing code so that it sees all memory clusters, not
just the first one.
* Don't reserve extra memory for the prom console unless the platform
  actually uses it.
* Fix some historical confusion and a minor bug in the message buffer
  initialisation.

Submitted by: gallatin for the prom console part
Approved by: jkh
2000-02-29 08:48:10 +00:00
Brian Feldman 60bfc3b09b Do some cleanups of the IPv6 stuff. This is a non-functional change.
Approved by:	jkh
2000-02-27 07:35:42 +00:00
Jordan K. Hubbard 2217c725f9 Enable IPv6 options 2000-02-26 22:13:21 +00:00
John Polstra 7e4977c94e Fix two bugs in the fault handler for copy{in,out} and friends.
First, it was failing to reset the PCB's pcb_onfault member to NULL.
Under some really obscure circumstances this might cause a wild jump
within the kernel when a panic would otherwise occur.  Second, the
handler was loading the GP register needlessly and with an incorrect
value.

Reviewed by:	Doug Rabson <dfr>
Approved by:	Jordan Hubbard <jkh>
2000-02-25 03:26:10 +00:00
Søren Schmidt 47351d2774 Update the ata driver to take more advantage of newbus, this
was needed to make attach/detach of devices work, which is
needed for the PCCARD support.
(PCCARD support is still not working though, more to come on that)

Support the CMD646 chip which is used on many alphas, sadly only
in WDMA2 mode, as the silicon is broken beyond belief for UDMA modes.

Lots of cosmetic fixes here and there.

Sorry for the size of this megapatchfromhell but it was not
possible otherwise...

newbus patches based on work from: dfr (Doug Rabson)
2000-02-18 20:57:33 +00:00
Bruce Evans 90bb57afd9 Don't include <machine/ipl.h> in <sys/systm.h> in the i386 case. This
fixes some namespace pollution in general and breakage of modules that
aren't in the sys tree in particular (<machine/ipl.h> includes further
headers that aren't installed under /usr/include).

Reimplemented SPLASSERT() so that it is more machine independent and
less bloated and doesn't require the <machine/ipl.h> include spam.
In particular, don't assume that `cpl' can be printed using %08x
format.  The alpha arch doesn't even have `cpl'.  SPLASSERT() was
harmless on alphas because it isn't actually used.
2000-02-17 18:37:45 +00:00
Andrew Gallatin 128f43c891 o Wilko Bulte has tested our AlphaServer 1000A ("Noritake") support
code & it survives a buildworld.  So remove the dire warnings about
  Noritake support being untested.

o Remove a disconserting printf() left over from NetBSD

Approved by: 	jkh
2000-02-15 18:47:51 +00:00
Peter Wemm 56d8a1e30d Oops, forgot this from the previous commit. Remove obsolete #ifdef ISO.
Approved by:	jkh
2000-02-13 03:55:16 +00:00
Peter Wemm 242c5536ea Clean up some loose ends in the network code, including the X.25 and ISO
#ifdefs.  Clean out unused netisr's and leftover netisr linker set gunk.
Tested on x86 and alpha, including world.

Approved by:	jkh
2000-02-13 03:32:07 +00:00
Doug Rabson eb06360f04 Add functions which allow i/o memory to be accessed without forcing a
memory barrier (needed for XFree86 4.0).

Approved by: jkh
2000-02-12 14:57:01 +00:00
Jordan K. Hubbard 4a04162824 Clean up POSIX options, syncronize generics. 2000-02-04 07:02:53 +00:00
Peter Wemm 68b538c712 Remove 'conflicts' token - it has been effectively doing absolutely
nothing for quite some time.  The only thing that cared was userconfig,
but it was for one invisible device so we never saw it's effects.
2000-01-29 18:07:07 +00:00
Matt Jacob baea546e44 update copyright 2000-01-29 17:23:41 +00:00
Matt Jacob 186f1be198 Wrong patch had been applied. 2000-01-29 16:57:03 +00:00
Matt Jacob c8f742acd8 Update copyright and pull some newer definitions from NetBSD version. 2000-01-29 16:41:08 +00:00
Matt Jacob cd6421ca76 Put tslb_device structure in this file. Put a pointer to to primary
CPU's structure.
2000-01-29 16:40:17 +00:00
Matt Jacob 602d8494a9 Clean up some compilation warnings and errors. 2000-01-29 16:39:21 +00:00
Peter Wemm edfd254255 Regen after pointing to the real setres[ug]id(). Remove dummy function.
(Note: getres[ug]id is still a dummy as it returns via pointers to a
 different sized integer and does need real wrappers.)
2000-01-29 12:45:36 +00:00
Peter Wemm 11247956d8 Use the real setres[ug]id(2) rather than dummy stubs. Newer glibc's
call this.
2000-01-29 12:43:29 +00:00
Andrew Gallatin 2f970b91c7 changes to osf1_wait4()
- only allocate rusage struct when caller wants rusage info
- fix a stupid paren mismatch bug that was causing EPERM to get returned
  to callers rather then ECHILD
2000-01-29 06:31:27 +00:00
Warner Losh 173c0f9f5c Mitigate the stream.c attacks
o Drop all broadcast and multicast source addresses in tcp_input.
o Enable ICMP_BANDLIM in GENERIC.
o Change default to 200/s from 100/s.  This will still stop the attack, but
  is conservative enough to do this close to code freeze.

This is not the optimal patch for the problem, but is likely the least
intrusive patch that can be made for this.

Obtained from: Don Lewis and Matt Dillon.
Reviewed by: freebsd-security
2000-01-28 06:13:09 +00:00
Peter Wemm 6bd284603b Remove a no-op "port ?" declaration. 2000-01-24 08:51:16 +00:00
Peter Wemm 3936eee2ff Update GENERIC/SIMOS to leave out the useless trailing digit in pci
and other unwired devices.
2000-01-23 12:22:25 +00:00
Wilko Bulte 29429dde38 updated comments 2000-01-21 20:19:18 +00:00
Andrew Gallatin e1364adbae Make devices behind PPBs work on DS10s (and any other single pchip tsunamis)
I was wagering on DEC being elegant & numbering PCI buses normally on
machines with one pchip.  It looks like they went with consistent -- buses
behind ppbs begin with bus 2.
2000-01-20 16:49:18 +00:00