Commit Graph

1354 Commits

Author SHA1 Message Date
pk 70f20a1217 Replace the traditional buffer memory management -- based on fixed per buffer
virtual memory reservation and a private pool of memory pages -- by a scheme
based on memory pools.

This allows better utilization of memory because buffers can now be allocated
with a granularity finer than the system's native page size (useful for
filesystems with e.g. 1k or 2k fragment sizes).  It also avoids fragmentation
of virtual to physical memory mappings (due to the former fixed virtual
address reservation) resulting in better utilization of MMU resources on some
platforms.  Finally, the scheme is more flexible by allowing run-time decisions
on the amount of memory to be used for buffers.

On the other hand, the effectiveness of the LRU queue for buffer recycling
may be somewhat reduced compared to the traditional method since, due to the
nature of the pool based memory allocation, the actual least recently used
buffer may release its memory to a pool different from the one needed by a
newly allocated buffer. However, this effect will kick in only if the
system is under memory pressure.
2003-12-30 12:33:13 +00:00
bjh21 8907f89465 speaker_ctl() is optional, and vidcaudio_speaker_ctl() did nothing, so kill it. 2003-12-29 16:49:31 +00:00
bjh21 0a64302931 Control debugging with VIDCAUDIO_DEBUG rather that DEBUG, to avoid confusion
with the global kernel macro called DEBUG.
2003-12-29 16:45:58 +00:00
bjh21 1b64799344 Minor KNF. 2003-12-29 16:41:22 +00:00
bjh21 32cf38df51 Fix a DEBUG printf. 2003-12-29 16:36:48 +00:00
bjh21 87bcc196e1 Use NULL rather than 0 to initialise unused function pointers. 2003-12-29 16:25:30 +00:00
bjh21 8dcadd2b7c KNF. 2003-12-29 16:20:46 +00:00
bjh21 b64c13c96f ANSIfy, un-__P(). 2003-12-29 16:11:38 +00:00
gavan f2c2467d5c Correct masks for PCIXSR decomposition 2003-12-19 10:08:11 +00:00
bsh 7020653430 add a function to initialize variables used by splfoo().
This should be called in bootstrap so that splfoo() doesn't touch illegal address.
2003-12-17 13:20:04 +00:00
gavan 5232db351e The PIRSR is at location 0xffffe1ec, not 0xffffe2ec.
Source: Intel(R) 80321 I/O Processor Developer's Manual, page 578
2003-12-16 00:04:09 +00:00
scw 5f0d6f1b24 Work-around an obscure bug (reported by a couple of people, and reproduced
exactly twice by me) which causes the code at the top of copyin which
word-aligns the destination pointer to copy more bytes than necessary,
resulting in an alignment fault later on.

The bug is difficult to reproduce, but as far as I can tell it seems
to be as a result of the condition codes being corrupted, possibly
following a page fault caused by the first ldrbt/strb instructions.
The subsequent ldr<cc>bt/str<cc>b instructions then _always_ execute.
I can't think of any obvious reason why this would happen, though.
2003-12-15 09:27:18 +00:00
scw fbdf861fac The last cpsr_all change was misguided. Just use cpsr_c wherever possible. 2003-12-15 09:18:21 +00:00
rearnsha 94c1474569 The machdep.debug sysctl variable uses code CPU_DEBUG
(not CPU_CONSDEV).
2003-12-13 12:07:41 +00:00
thorpej 648d5e6e22 Add a default case to avoid an uninitialized variable warning. 2003-12-12 16:42:44 +00:00
atatat 74b1767b3c The machdep.debug node is an int, not a struct 2003-12-12 03:52:56 +00:00
jmc 695a2a2f9f Change reference at bottom from sys/dev/majors to sys/conf/majors to match
reality
2003-12-10 02:04:00 +00:00
scw 2107fae815 Scoot the SDRAM controller's mapping forward to the next 1MB boundary
so it can be mapped easily at startup.
2003-12-08 16:14:16 +00:00
scw 40db825e26 Add support for picking up the size of SDRAM by reading the memory
controller's config register.
2003-12-08 14:41:11 +00:00
scw c2415a0dc3 Oops, map PCI memory space at VA 0xf8000000 instead of in the middle
of user VM space at 0x48000000.
2003-12-08 13:40:33 +00:00
bjh21 df8ccd8d1b Undo last change: The "iomd" driver has its own bus_space tag, so it didn't
rely on the brokenness of the mainbus one.
2003-12-06 22:31:16 +00:00
bjh21 ed4b80b144 Fix the ARM mainbus version of bus_space_subregion() to correctly shift the
base offset before using it.  This makes it work the same as every other
implementation, and makes wdc at pioc on acorn32 work again.  Fix the only
caller I found which depended on the old behaviour.
2003-12-06 22:05:33 +00:00
bjh21 3f1dc2b013 Don't complain if we're asked for != 8 channels. There's no actual support
for fewer channels yet, but this is necessary just to avoid a boot-time panic.
2003-12-06 19:59:32 +00:00
atatat 13f8d2ce5f Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 19:38:21 +00:00
scw ef87776bdb As per the recent ixp425 fix (which is based on this code):
In the interrupt dispatch loop, make sure to handle any pending interrupts
which came in while we were dealing with the first interrupt(s), and which
are enabled at the current spl.

This fixes a problem where the intr_enabled/hw mask is not updated to
allow pending interrupts through until the next splx(). In some case,
interrupts could be delayed until the next clock tick.
2003-12-03 19:55:37 +00:00
scw 99df1a0ae1 In the interrupt dispatch loop, make sure to handle any pending interrupts
which came in while we were dealing with the first interrupt(s), and which
are enabled at the current spl.

This fixes a problem where the intr_enabled/hw mask is not updated to
allow pending interrupts through until the next splx(). In some case,
interrupts could be delayed until the next clock tick.
2003-12-03 13:20:34 +00:00
rearnsha e3cb92a81b Avoid alignment faults in fusword and fuswintr. Also handle big-endian
systems in susword and suswintr.
2003-12-01 13:34:44 +00:00
scw 7cf5104b5a - For consistency, use cpsr_all instead of cpsr.
- Make sure IRQs are enabled before handling ASTs.
2003-12-01 08:48:33 +00:00
bjh21 dd89bf7764 Use kdb_trap() rather than Debugger() to deal with unhandled undefined
instructions in the kernel, so that DDB gets a useful trapframe.  Also
panic if this happens when DDB's not around.
2003-11-29 22:21:29 +00:00
bsh ae462c19db fix typo pointed out by Olivier Houchard. thanks. 2003-11-26 12:17:18 +00:00
rearnsha 445d91a12e Reposition a couple of NOP instructions for better efficiency. 2003-11-26 10:31:53 +00:00
christos a21fdf3b43 bye, bye _MCONTEXT_TO_SIGCONTEXT and vice versa. 2003-11-25 23:11:52 +00:00
scw d657bddd8c In data_abort_handler(), honour pcb_onfault even in the case where
current_intr_depth > 0.
2003-11-20 14:44:36 +00:00
scw 61aab8b582 On a fatal fault, dump the trapframe's contents to the console.
This is useful when DDB is not available, or practical.
2003-11-18 22:39:05 +00:00
scw 5801c73162 - Remove ixpsip_bs_tag (ixp425_sip_io.c). It just duplicated some of
the functionality of ixp425_bs_tag.
 - Add missing stream_{read,write}_1 ops to ixp425_bs_tag.
 - Re-work the delay() implementation to use the free-running Time-
   Stamp counter. This removes the need to bootstrap TMR0 early on.
2003-11-16 12:41:03 +00:00
scw 07acf64710 Re-instate the behaviour of sending SIGKILL to a process if uvm_fault()
returns ENOMEM. SIGSEGV just doesn't cut it. The original code looks to
have been lost in revision 1.34.
2003-11-15 20:18:34 +00:00
scw a7533e4cdc - Add LOCKDEBUG-protected calls to sched_lock_idle() to cpu_switchto and
the idle loop. They seem to have gone AWOL sometime in the past.
   Fixes port-arm/23390.
 - While here, tidy up the idle loop.
 - Add a cheap DIAGNOSTIC check for run queue sanity.
2003-11-15 08:44:18 +00:00
briggs dfa839f16b Make sure that L_SA_PAGEFAULT gets cleared from l_flag if pmap_fault_fixup
returns non-zero and we want to shortcut out.  This avoids a bogus pagefault
condition being detected in sa_switch().
Many thanks to Christian Limpach for finding this, obviating my band-aid
patch to kern_sa.c (posted on tech-kern).
2003-11-14 21:22:08 +00:00
scw 4eeb1be7e4 Check alignment of the fault PC before de-referencing it.
Give the process a Illegal Instruction fault if the PC is misaligned.
2003-11-14 19:03:17 +00:00
scw a590a31135 - In data_abort_handler(), move the fault pc alignment check to before
the call to data_abort_fixup() as the fixup routines also try to
   de-reference the fault pc.

 - If a fault came from kernel mode, and the fault address looks to be in
   the kernel's address space, and pcb_onfault is *set*, check the
   instruction which caused the fault. If it's LDR{B,}T or STR{B,}T
   then one of the copy in/out routines is trying to read/write a
   kernel address with the wrong privilege. If that address is actually
   mapped, we could end up in an infinite loop because we failed to
   notice that it's really a 'user mode' access. Yay for "crashme".
   I suspect this also fixes PR port-arm/23052.

   Note: This *could* be fixed by adding sanity checks to copyin et al,
   but that would add extra overhead to the non-error path...

 - Fix a couple of __predict_false cases.
2003-11-14 19:00:03 +00:00
scw 571f89c4ad Slight re-org of the alignment/ast exit macro to better mimic the
original behaviour WRT cpsr/I32_bit handling.
2003-11-14 16:57:28 +00:00
scw bb0221494d Since data_abort_handler() may have to decode the instruction at tf->tf_pc
to determine if a fault is read or write, make sure tf->tf_pc is 32-bit
aligned before dereferencing it.

Otherwise, deliver an illegal instruction signal to the process. We don't
support execution of Thumb code at this time.
2003-11-14 00:21:30 +00:00
chs e07f0b9362 eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed.  however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors.  most of
the callers of uvm_useracc() make the above incorrect assumption.  the
rest are all misguided optimizations, which optimize for the case
where an operation will fail.  we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors.  since there appear to be no good uses of uvm_useracc(), we'll
just remove it.
2003-11-13 03:09:28 +00:00
scw f99d0398fb The previous commit had a #endif in the wrong place. 2003-11-11 08:27:16 +00:00
wiz ee1b406595 Spell address with two d's. Inspired by similar changes in OpenBSD,
originating from Jonathon Gray and forwarded by jmc@openbsd.
2003-11-10 08:51:51 +00:00
scw 41d2057ea7 Pick the right value for {,_}MACHINE_ARCH according to endianness.
Spotted by mrg@.
2003-11-09 08:27:19 +00:00
tsutsui 112c91d583 Use #if defined(_KERNEL_OPT) to protect #include "opt_xxx.h"
from building LKM etc. Suggested by mrg.
2003-11-09 05:29:59 +00:00
he c45fa09365 Suppress apparently-bogus -Wunitialized warnings, the compiler does
not detect that set / use occur under equal conditions in following
if() statements.
2003-11-07 18:29:30 +00:00
scw f77bf2bb0c Enable/Restore alignment fault state on interrupt handler entry/exit. 2003-11-05 21:10:59 +00:00
scw aee833c0ee Add "options ARM32_DISABLE_ALIGNMENT_FAULTS" to forcibly disable
alignment fault checking if necessary.

This option gets the acorn32 port working again.

XXX: Richard Earnshaw suggested enabling alignment faults for
XXX: userland only on acorn32. Need to investigate this.
2003-11-05 12:53:15 +00:00