Commit Graph

7503 Commits

Author SHA1 Message Date
John Baldwin
55d79ad0db The x86 atomic operations are already locked, so they do not need an
additional locked instruction to guarantee a write barrier for the acquire
variants.

Approved by:	dfr
Pointy hat to:	jhb
2000-10-28 00:28:15 +00:00
John Baldwin
7c0cb49a64 Fix a couple of whitespace nits. 2000-10-27 21:45:50 +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
Doug Barton
c9e6ddc6af Expand on the reasons for and against defining NO_F00F_HACK. This is one of
those options that is frequently misunderstood, and ends up on -questions.

PR:		21852
2000-10-27 10:57:33 +00:00
Bruce Evans
4a3bb59944 Declare or #define per-cpu globals in <machine/globals.h> in all cases.
The i386 UP case was messily different.
2000-10-27 08:30:59 +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
John Baldwin
660d1e3a9d Add and document the WITNESS_SKIPSPIN and WITNESS_DDB kernel options. 2000-10-27 03:00:28 +00:00
Roger Hardiman
870b024f5d Add new ioctls for userland access to the MSP device 2000-10-26 16:41:48 +00:00
Hellmuth Michaelis
d1dad62933 Add infrastructure for Cologne Chip HFC-S PCI driver.
Increment isdn4bsd step.
2000-10-26 06:58:43 +00:00
Dag-Erling Smørgrav
f8c05e5019 Bring cpuinfo closer to what it looks like in Linux 2.2.
Submitted by:	R Bradford Jones <brad@kazrak.com>
2000-10-25 22:38:23 +00:00
Dag-Erling Smørgrav
886a6f6fca Add /proc/<pid>/status and /proc/<pid>/stat (the latter being mostly
zeroes for the time being).

Prompted by:	Nathan Boeger <nathan@khmere.com>
2000-10-25 22:12:59 +00:00
John Baldwin
ee8f2f372c - Add atomic_cmpset_{acq_,rel_,}_long
- Add in atomic operations for 8-bit, 16-bit, and 32-bit integers
2000-10-25 21:56:16 +00:00
John Baldwin
fbc9c4f042 Catch up to the new software interrupt code.
Noticed by:	phk
2000-10-25 21:24:08 +00:00
John Baldwin
49e0078b0f - Catch up to new software interrupt code.
- Add a missing curly brace.

Noticed by:	phk
2000-10-25 21:13:42 +00:00
John Baldwin
62a010fecf - Remove unneeded machine/ipl.h #include.
- Change the softintr() macro to do nothing on FreeBSD.  Previously,
  this macro would set a bit in spending and schedule the softinterrupt
  thread to run.  However, the bs driver never actually registers a
  a software interrupt handler, so all this work achieved nothing.  From
  the code it is not clear what exactly the softintr() macro is actually
  supposed to be doing.  It looks like it is supposed to be possibly
  running the hardware interrupt handler maybe?  This handler is only
  present in the #ifdef __NetBSD__ code however.  I have no idea how this
  driver handles interrupts at all, but at least it compiles now.
2000-10-25 20:38:08 +00:00
Paul Saab
fbdfe15620 Fast interrupts have no associated process, therefore do not try
and schedule it.  This fixes booting machines with broken MP tables.
2000-10-25 10:40:20 +00:00
Nick Hibma
2fd84f56d5 The USB scanner driver. To be used together with SANE. 2000-10-25 10:34:38 +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
David E. O'Brien
780ba1bcc0 * Update comments
* convert decimal constants to hex
Submitted by:	bde

* Add ISO-C99 long long limits
2000-10-24 10:48:50 +00:00
Sergey Babkin
821c54a1eb Added lines for the wds driver.
Approved by:	gibbs
2000-10-24 03:38:28 +00:00
John Baldwin
a555b1468d Don't dink with interrupts in vm_page_zero_idle(). This code assumed it
was being called with interrupts disabled, when it was actually being called
with them enabled.

Pointed out by:	tegge
2000-10-23 23:32:36 +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
Noriaki Mitsunaga
ae94720d12 Add PC-Card/ISA SCSI host adpater drivers from NetBSD/pc98
(a NetBSD port for NEC PC-98x1 machines). They are ncv for NCR 53C500,
nsp for Workbit Ninja SCSI-3, and stg for TMC 18C30 and 18C50.

I thank NetBSD/pc98 and bsd-nomads people.

Obtained from:	NetBSD/pc98
2000-10-23 12:55:51 +00:00
Poul-Henning Kamp
416282b562 Get rid of the last traces of ACTUALLY_LKM_NOT_KERNEL 2000-10-23 08:35:41 +00:00
Yoshihiro Takahashi
97ae0fe84c Moved prototypes of isa_alloc_resourcev() and isa_load_resourcev() to
isa/isavar.h, and added needed includes.
2000-10-22 16:48:08 +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
Andrey A. Chernov
c07f6a2dd1 Return -10000 in pci_hostb_probe to allow agp driver (disabled otherwise) 2000-10-20 15:40:05 +00:00
Andrey A. Chernov
da0f52e1ea Add i815 Host to Hub 2000-10-20 15:14:51 +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
d1182da2cf Actually harvest interrupt threads when the last handler is removed from a
thread.
2000-10-20 07:46:12 +00:00
John Baldwin
13b0500f02 - machine/mutex.h -> sys/mutex.h
- Use cpu_throw() instead of cpu_switch() during cpu_exit() since we don't
  need to save our previous state.
2000-10-20 07:43:55 +00:00
John Baldwin
ab4f2c187a Catch up to SMP_DEBUG -> MUTEX_DEBUG. 2000-10-20 07:41:50 +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
02660e29a8 - machine/mutex.h -> sys/mutex.h
- machine/ipl.h -> sys/ipl.h
- Use MUTEX_DECLARE() for clock_lock
2000-10-20 07:31:00 +00:00
John Baldwin
1e9b3e8eb0 - machine/mutex.h -> sys/mutex.h
- Use MUTEX_DECLARE() and MTX_COLD for vm86pcb_lock
2000-10-20 07:30:11 +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
KATO Takenori
1ae7243298 Convert the type of bus_space_handle_t of pc98 from structure into
pointer to structure.

Reviewed by:	nyan
2000-10-20 02:42:06 +00:00
Mike Smith
9d55863400 Call the BIOS to route the selected interrupt. Correctly calculate the
interrupt from the PCI routing table (ffs returns 1 for the rightmost
bit, not 0).
2000-10-19 08:06:50 +00:00
Mike Smith
4bbbd5e215 Add PCI BIOS function codes for IRQ routing fetch and route. 2000-10-19 08:02:46 +00:00
John Baldwin
dc13e6dfbb Axe the idle_event eventhandler, and add a MD cpu_idle function used
for things such as halting CPU's, idling CPU's, etc.

Discussed with:	msmith
2000-10-19 07:47:16 +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
Hellmuth Michaelis
8ccc600fa4 Add ifpnp driver to list of i4b hardware drivers. 2000-10-18 09:16:30 +00:00
Hellmuth Michaelis
5682901b52 Add a debug flag bit for a new driver. 2000-10-18 08:39:24 +00:00
Matthew N. Dodd
a4a64f2f0a Use appropriate resource management accessors instead of directly
referencing structure members.

Use rman_get_size() instead of end - start + 1.
2000-10-18 00:09:26 +00:00
John Baldwin
ffc2c9e3ee - Catch up to moving headers, machine/ipl.h -> sys/ipl.h
- Fix some whitespace bogons.

Submitted by:	bde (2)
2000-10-17 23:10:23 +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
242fae60f0 Some linux apps, such as IBM's JDK 1.3, will attempt to mmap thread
stacks near the top of their address space.  If their TOS is greater
than vm_maxsaddr, vm_map_growstack() will confuse the thread stack
with the process stack and deliver a SEGV if they attempt to grow the
thread stack past their current stacksize rlimit.  To avoid this,
adjust vm_maxsaddr upwards to reflect the current stacksize rlimit
rather than the maximum possible stacksize.  It would be better to
adjust the mmap'ed region, but some apps (again, IBM's JDK 1.3) do not
check mmap's return value..

This commit (in conjunction with setting MINSIGSTKSZ to 2048 &
rebuilding your kernel and modules) will get IBM's JDK 1.3 working
with FreeBSD at least well enough to run many of the example applets.

Reviewed by: marcel
Tested by:   sto@stat.duke.edu, many others on freebsd-java@
2000-10-17 00:25:43 +00:00