Commit Graph

1151 Commits

Author SHA1 Message Date
Olivier Houchard
43e23d1b4c Fixes for ARM9/ARM10 :
Call uma_sel_align() there at well.
Set CPU_CONTROL_VECRELOC if we're using the high vectors page.

Submitted by:	Rafal Jaworowski <raj AT semihalf DOT com>
MFC After:	1 week
2007-11-28 22:55:55 +00:00
Olivier Houchard
85d18774de Correct the logic : we can just invalidate the cache lines, and not
write-back them, only if PREWRITE is not set, and if the buffer is
cache-line aligned.

MFC After:	1 week
2007-11-28 22:21:17 +00:00
Olivier Houchard
9acb0e651b In atomic_fetchadd_32(), do not blindly increase the value of %3.
It should just contain the value we want to add, as if we're interrupted
between the add and the str, we will restart from the beginning. Just use
a register we can scratch instead.

MFC After:	1 week
2007-11-27 22:12:05 +00:00
John Baldwin
23d34db956 Remove the 'needbounce' variable from the _bus_dmamap_load_buffer()
routine.  It is not needed as the existing tests for segment coalescing
already handle bounced addresses and it prevents legal segment coalescing
in certain edge cases.

MFC after:	1 week
Reviewed by:	scottl
2007-11-27 17:28:12 +00:00
Alan Cox
59677d3c0e Prevent the leakage of wired pages in the following circumstances:
First, a file is mmap(2)ed and then mlock(2)ed.  Later, it is truncated.
Under "normal" circumstances, i.e., when the file is not mlock(2)ed, the
pages beyond the EOF are unmapped and freed.  However, when the file is
mlock(2)ed, the pages beyond the EOF are unmapped but not freed because
they have a non-zero wire count.  This can be a mistake.  Specifically,
it is a mistake if the sole reason why the pages are wired is because of
wired, managed mappings.  Previously, unmapping the pages destroys these
wired, managed mappings, but does not reduce the pages' wire count.
Consequently, when the file is unmapped, the pages are not unwired
because the wired mapping has been destroyed.  Moreover, when the vm
object is finally destroyed, the pages are leaked because they are still
wired.  The fix is to reduce the pages' wired count by the number of
wired, managed mappings destroyed.  To do this, I introduce a new pmap
function pmap_page_wired_mappings() that returns the number of managed
mappings to the given physical page that are wired, and I use this
function in vm_object_page_remove().

Reviewed by: tegge
MFC after: 6 weeks
2007-11-17 22:52:29 +00:00
Olivier Houchard
49ec6888e2 Add a kernel config file for the Hot-e HL200 (AT91RM92 based).
Many thanks to John Nicholls from Thinklinx for sending sample hardware.
2007-11-17 17:25:22 +00:00
Marcel Moolenaar
0c3967e7fe o Rename cpu_thread_setup() to cpu_thread_alloc() to better
communicate that it relates to (is called by) thread_alloc()
o  Add cpu_thread_free() which is called from thread_free()
   to counter-act cpu_thread_alloc().

i386:	Have cpu_thread_free() call cpu_thread_clean() to
	preserve behaviour.
ia64:	Have cpu_thread_free() call mtx_destroy() for the
	mutex initialized in cpu_thread_alloc().

PR: ia64/118024
2007-11-14 20:21:54 +00:00
Julian Elischer
431f890614 generally we are interested in what thread did something as
opposed to what process. Since threads by default have teh name of the
process unless over-written with more useful information, just print the
thread name instead.
2007-11-14 06:21:24 +00:00
Olivier Houchard
0559b904bc Add entries for the L2 cache-related functions for armv5.
Spotted out by: Rafal Jaworowski
2007-11-08 13:19:08 +00:00
Konstantin Belousov
89b57fcf01 Fix for the panic("vm_thread_new: kstack allocation failed") and
silent NULL pointer dereference in the i386 and sparc64 pmap_pinit()
when the kmem_alloc_nofault() failed to allocate address space. Both
functions now return error instead of panicing or dereferencing NULL.

As consequence, vmspace_exec() and vmspace_unshare() returns the errno
int. struct vmspace arg was added to vm_forkproc() to avoid dealing
with failed allocation when most of the fork1() job is already done.

The kernel stack for the thread is now set up in the thread_alloc(),
that itself may return NULL. Also, allocation of the first process
thread is performed in the fork1() to properly deal with stack
allocation failure. proc_linkup() is separated into proc_linkup()
called from fork1(), and proc_linkup0(), that is used to set up the
kernel process (was known as swapper).

In collaboration with:	Peter Holm
Reviewed by:	jhb
2007-11-05 11:36:16 +00:00
Olivier Houchard
64a2135deb Remove a staled comment, NPE-C should work fine.
Reviewed by:	sam
2007-11-04 21:54:52 +00:00
Kevin Lo
92e7748daf __CPU_XSCALE_PXA2XX -> CPU_XSCALE_PXA2X0 2007-11-01 10:01:15 +00:00
Kevin Lo
0c6faf446d Don't define get_cachetype() for CPU_ARM9E unless it's going to be used. 2007-10-31 07:27:31 +00:00
Warner Losh
855f957fc1 kill commented out line of code. 2007-10-29 21:01:50 +00:00
Olivier Houchard
ed0b604f1f Add an option to be able to override the value of the AT91 master clock
frequency. It'd be better to be able to calculate it at runtime, but we need
the information very early, to setup the uart.
2007-10-25 23:02:42 +00:00
Olivier Houchard
2b953358ed Move some KB920x-specific options into the KB920x file. 2007-10-25 22:57:19 +00:00
Olivier Houchard
9e753c174f Oooops, get the end of the memory right. 2007-10-25 22:43:17 +00:00
Olivier Houchard
cb3d8b2510 KERNBASE should really be KERNVIRTADDR there too.
MFC after:	1 week
2007-10-24 23:41:46 +00:00
Olivier Houchard
b7630a1145 In ate_get_mac(), try to get the mac address in the right order, at least
in the same order as it's set in ate_set_mac.
I remember a discussion about this on -arm, but apparently nothing was done.
Warner, is this wrong ?

X-MFC After:	proper review
2007-10-24 23:12:19 +00:00
Olivier Houchard
12e12ab1a8 Handle the case where PHYSADDR != KERNPHYSADDR (ie we do not load the kernel
at the beginning of the RAM).

MFC After:	1 week
2007-10-24 22:26:54 +00:00
Olivier Houchard
b2c9a0439a Correct a comment, this was not true anymore. 2007-10-24 22:24:32 +00:00
Warner Losh
5a4eb2d84b correct guard variable names. 2007-10-18 05:43:44 +00:00
Warner Losh
63b2597849 Merge support from p4 (from NetBSD) for arm9e and arm10, arm11 cores. Not
yet connected to the build, but reduces diffs to p4 repo.

Obtained from: NetBSD
2007-10-18 05:33:06 +00:00
Warner Losh
dfb7d4cdef Merge definitions for ARM9E, ARM10 and ARM11 processors from p4 (which
got them from NetBSD).
2007-10-18 05:06:58 +00:00
Olivier Houchard
f60a7dc355 Use the direct mapping, if available, for pmap_zero_page_xscale() as well. 2007-10-16 20:40:04 +00:00
Olivier Houchard
0f7432f516 Do not use __XSCALE__ to detect if pld/strd/ldrd is available, use
_ARM_ARCH_5E instead.

MFC After:	3 days
2007-10-13 12:05:03 +00:00
Olivier Houchard
258f866cbf Define _ARM_ARCH_5E too, so that we know if pld/strd/ldrd are available.
MFC After:	3 days
2007-10-13 12:04:10 +00:00
Kevin Lo
976b010645 Spelling fix for interupt -> interrupt 2007-10-12 06:03:46 +00:00
Marius Strobl
55aaf894e8 Make the PCI code aware of PCI domains (aka PCI segments) so we can
support machines having multiple independently numbered PCI domains
and don't support reenumeration without ambiguity amongst the
devices as seen by the OS and represented by PCI location strings.
This includes introducing a function pci_find_dbsf(9) which works
like pci_find_bsf(9) but additionally takes a domain number argument
and limiting pci_find_bsf(9) to only search devices in domain 0 (the
only domain in single-domain systems). Bge(4) and ofw_pcibus(4) are
changed to use pci_find_dbsf(9) instead of pci_find_bsf(9) in order
to no longer report false positives when searching for siblings and
dupe devices in the same domain respectively.
Along with this change the sole host-PCI bridge driver converted to
actually make use of PCI domain support is uninorth(4), the others
continue to use domain 0 only for now and need to be converted as
appropriate later on.
Note that this means that the format of the location strings as used
by pciconf(8) has been changed and that consumers of <sys/pciio.h>
potentially need to be recompiled.

Suggested by:	jhb
Reviewed by:	grehan, jhb, marcel
Approved by:	re (kensmith), jhb (PCI maintainer hat)
2007-09-30 11:05:18 +00:00
Olivier Houchard
f530d4f06d Ok I hope I got it right this time.
After discussion with Sam, switch back to use firmware(9) instead of
having the firmware in hex format.
Put the binary firmware uuencoded into sys/contrib/dev/npe, and slap a
LICENSE file, as found on the Intel website.

Approved by:	re (blanket), mux (mentor)
MFC After:	1 week
2007-09-27 22:39:49 +00:00
Olivier Houchard
88af309a0b Now that Intel changed the license for the NPE firmware, import it directly
hexed into our tree, instead of requiring the user to download it.

Approved by:	re (blanket)
MFC after:	1 week
2007-09-27 21:18:34 +00:00
Olivier Houchard
857539e578 Fix a comment to reflect the truth.
Spotted out by:	Marius Nuennerich <marius.nuennerich AT gmx D0T de>
Approved by:	re (blanket)
2007-09-27 20:52:17 +00:00
Alan Cox
7bfda801a8 Change the management of cached pages (PQ_CACHE) in two fundamental
ways:

(1) Cached pages are no longer kept in the object's resident page
splay tree and memq.  Instead, they are kept in a separate per-object
splay tree of cached pages.  However, access to this new per-object
splay tree is synchronized by the _free_ page queues lock, not to be
confused with the heavily contended page queues lock.  Consequently, a
cached page can be reclaimed by vm_page_alloc(9) without acquiring the
object's lock or the page queues lock.

This solves a problem independently reported by tegge@ and Isilon.
Specifically, they observed the page daemon consuming a great deal of
CPU time because of pages bouncing back and forth between the cache
queue (PQ_CACHE) and the inactive queue (PQ_INACTIVE).  The source of
this problem turned out to be a deadlock avoidance strategy employed
when selecting a cached page to reclaim in vm_page_select_cache().
However, the root cause was really that reclaiming a cached page
required the acquisition of an object lock while the page queues lock
was already held.  Thus, this change addresses the problem at its
root, by eliminating the need to acquire the object's lock.

Moreover, keeping cached pages in the object's primary splay tree and
memq was, in effect, optimizing for the uncommon case.  Cached pages
are reclaimed far, far more often than they are reactivated.  Instead,
this change makes reclamation cheaper, especially in terms of
synchronization overhead, and reactivation more expensive, because
reactivated pages will have to be reentered into the object's primary
splay tree and memq.

(2) Cached pages are now stored alongside free pages in the physical
memory allocator's buddy queues, increasing the likelihood that large
allocations of contiguous physical memory (i.e., superpages) will
succeed.

Finally, as a result of this change long-standing restrictions on when
and where a cached page can be reclaimed and returned by
vm_page_alloc(9) are eliminated.  Specifically, calls to
vm_page_alloc(9) specifying VM_ALLOC_INTERRUPT can now reclaim and
return a formerly cached page.  Consequently, a call to malloc(9)
specifying M_NOWAIT is less likely to fail.

Discussed with: many over the course of the summer, including jeff@,
   Justin Husted @ Isilon, peter@, tegge@
Tested by: an earlier version by kris@
Approved by: re (kensmith)
2007-09-25 06:25:06 +00:00
Olivier Houchard
afecb69ae1 Make sure we do not call _arm_bzero() or _arm_memcpy() if the size is not at
least the minimum asked by the driver.

Approved by:	re (blanket)
2007-09-22 22:47:48 +00:00
Olivier Houchard
4c865ababe Add various macros for the ADMA unit.
Approved by:	re (blanket)
2007-09-22 22:25:24 +00:00
Olivier Houchard
16dcd342a9 Add a driver for the 7seg found on the CRB board, largely based on the
IQ31244 version.

Approved by:	re (blanket)
2007-09-22 16:25:43 +00:00
Olivier Houchard
75f66155bf Twist the RAS logic a bit to avoid branching.
MFC After:	1 week
Approved by:	re (blanket)
2007-09-22 14:23:52 +00:00
Olivier Houchard
ea8979747e Remove dead code.
Approved by:	re (blanket)
Beer from:	jadawin
2007-09-19 15:30:25 +00:00
Warner Losh
94ab036295 Kill bogus printf debugs.
Approved by: re@ (blanket)
2007-09-16 07:51:02 +00:00
Warner Losh
f672b4aee5 Kill overly verbose messages about setting bus width.
Approved by: re@ (blanket)
2007-09-16 07:48:58 +00:00
Alan Cox
6bce07ae73 It has been observed on the mailing lists that the different categories
of pages don't sum to anywhere near the total number of pages on amd64.
This is for the most part because uma_small_alloc() pages have never been
counted as wired pages, like their kmem_malloc() brethren.  They should
be.  This changes fixes that.

It is no longer necessary for the page queues lock to be held to free
pages allocated by uma_small_alloc().  I removed the acquisition and
release of the page queues lock from uma_small_free() on amd64 and ia64
weeks ago.  This patch updates the other architectures that have
uma_small_alloc() and uma_small_free().

Approved by: re (kensmith)
2007-09-15 18:47:02 +00:00
Olivier Houchard
6037400b5a It's probably time I learn C.
Fix a few while (!uart_getreg() & SR1_TNF) when
while (!(uart_getreg() & SR18TNF)) was really meant.
This driver should die anyway, it's awful, and uart_ns8250 should be fine
for the StrongArm 1110. I'll kill it later.

Submitted by:	Mikhael Skvorts
Approved by:	re (blanket)
2007-09-12 18:28:09 +00:00
Olivier Houchard
4168e66b1f In __bswap16_var(), make sure the 16 upper bits are cleared; while
optimizing, gcc4 doesn't always do so.

Reported by:	Nathan Whitehorn
Approved by:	re (blanket)
2007-09-09 11:58:38 +00:00
Olivier Houchard
33321c8166 There's no need to re-read PCIR_COMMAND once we set it.
Approved by:	re (blanket)
2007-09-04 18:45:27 +00:00
Olivier Houchard
d3973c98d5 Just wbinv if both PREREAD and PREWRITE are set.
In PREREAD, just invalidate the cache lines, and do not write back them, if
the buffer is properly aligned.

Approved by:	re (blanket)
2007-08-18 16:47:28 +00:00
Olivier Houchard
4739da977b Ooops, we need to define TD_LOCK here.
Approved by:	re (blanket)
Pointy hat to:	cognet
2007-08-08 09:27:52 +00:00
Olivier Houchard
f7b55b6053 Add cast to silent gcc warnings.
Approved by:	re (blanket)
2007-08-07 18:37:21 +00:00
Olivier Houchard
362a46e4f6 Use the third argument of cpu_switch(), as done for i386/amd63, as it is
required for ULE.

Approved by:	re (blanket)
2007-08-07 18:20:55 +00:00
Warner Losh
e8b7ad8c05 Add in all the USB devices and all the wireless goo. The KB9202 has
only USB 1.1 speeds available, but this shouldn't hurt.  Now that we have
working usb support for this board, this is a natural followup.

Approved by: re (kensmith)
2007-07-31 17:45:54 +00:00
Warner Losh
3f0fd37320 Make USB work on the KB9202{,A,B} boards. This has been in p4 for about
7 months.  You must have JP6 in the 1-2 position to supply power to the
USB devices, but I've used uftdi, uplcom and umass successfully.  If you
have it in 2-3, then nothing will show up.  Also, if you have the FQPA
packaging for the AT91RM9200 (like the KN9202 boards have), you will get
the following message

uhub0: device problem (IOERROR), disabling port 2

due to a hardware erratum.  It is safe to ignore as it is about pins that
aren't brought out on the FQPA package and aren't proeprly terminated either.
Alas, there's no register to read to tell the FQPA from the BGA versions.

Submitted by: Daan Vreeken
Approved by: re (kensmith)
2007-07-31 17:43:18 +00:00
Olivier Houchard
6308183c5d MFppc:
revision 1.66
date: 2007/07/31 06:23:26;  author: marcel;  state: Exp;  lines: +2 -2
Fix backward compatibility of the "old" (i.e. FreeBSD6) lseek
syscall. It was broken when a new lseek syscall was introduced.
The problem is that we need to swap the 32-bit td_retval values
for the __syscall indirect syscall when the actual syscall has
a 32-bit return value. Hence, we need to exclude lseek(2). And
this means the "old" lseek(2) as well -- which we didn't.

Based on a patch from: grehan@

Approved by:	re (blanket)
2007-07-31 17:09:05 +00:00
Olivier Houchard
122e1e5e24 CRB config file.
Approved by:	re (blanket)
2007-07-27 14:57:03 +00:00
Olivier Houchard
5f78cb4a35 XScale core 3 definitions.
Approved by:	re (blanket)
2007-07-27 14:54:27 +00:00
Olivier Houchard
0566a63ff3 Cleanup
Approved by:	re (blanket)
2007-07-27 14:53:42 +00:00
Olivier Houchard
55f9380c2c Do not define NIRQ, it is already defined in include/intr.h
Approved by:	re (blanket)
2007-07-27 14:53:06 +00:00
Olivier Houchard
b93e48d2f9 Share the timer and watchdog drivers with the i81342. It's the same,
except it uses different registers.

Approved by:	re (blanket)
2007-07-27 14:52:04 +00:00
Olivier Houchard
e26a6af3af Add initial IOP342 support.
Thanks to Intel for providing sample hardware.

Approved by:	re (blanket)
2007-07-27 14:50:57 +00:00
Olivier Houchard
62e70f1b69 Say if the L2 cache is enabled or disabled as well.
Approved by:	re (blanket)
2007-07-27 14:49:11 +00:00
Olivier Houchard
72d383c331 Handle supersections and L2 cache.
Approved by:	re (blanket)
2007-07-27 14:46:43 +00:00
Olivier Houchard
fcd373ffb8 Use supersection instead of standard sections to map the whole memory
when available.

Approved by:	re (blanket)
2007-07-27 14:46:15 +00:00
Olivier Houchard
e905513c06 Fix the cache mode description.
Approved by:	re (blanket)
2007-07-27 14:45:33 +00:00
Olivier Houchard
b4db6fd942 Properly handle supersections.
Make sure we cache entries in the L2 cache.

Approved by:	re (blanket)
2007-07-27 14:45:04 +00:00
Olivier Houchard
23f9626539 Bring in two bandaids to get the elf trampoline to work again, until I find
a proper solution.
- Add a dummy entry point which just calls the C entry points, and try to make
sure it's the first code in the binary.
- Copy a bit more than func_end to try to copy the whole load_kernel()
function. gcc4 puts code behind the func_end symbol.

Approved by:	re (blanket)
2007-07-27 14:42:25 +00:00
Olivier Houchard
425b5be335 Add a new set of functions to handle L2 cache. Make them no-op for every
CPU except Xscale core 3.

Approved by:	re (blanket)
2007-07-27 14:39:41 +00:00
Olivier Houchard
03631d9998 Import xscale core 3 cache management functions.
Approved by:	re (blanket)
2007-07-27 14:28:15 +00:00
Olivier Houchard
43a2baaf1c INTR_FILTER bits for arm
Approved by:	re (blanket)
2007-07-27 14:26:42 +00:00
Olivier Houchard
d076bcf203 The iop34x has 128 interrupts. 2007-06-16 15:03:33 +00:00
Olivier Houchard
10d8c18005 Introduce pmap_kenter_supersection(), which maps 16MB super-sections into
the kernel pmap.
Document a bit more the behavior of the xscale core 3.
2007-06-11 21:29:26 +00:00
Warner Losh
a27980ccad Fix a spacing nit. 2007-06-11 19:36:37 +00:00
Olivier Houchard
9f547eadb7 Initialize the dma tag's bounce_zone to NULL if we didn't allocate it. 2007-06-10 12:33:01 +00:00
Marcel Moolenaar
01bd17cc99 Add kdb_cpu_sync_icache(), intended to synchronize instruction
caches with data caches after writing to memory. This typically
is required to make breakpoints work on ia64 and powerpc. For
those architectures the function is implemented.
2007-06-09 21:55:17 +00:00
Olivier Houchard
d3cdd95ce0 There's no nobounce_dmamap on arm. 2007-06-07 21:51:09 +00:00
Jeff Roberson
4736604759 - PCPU_ADD is no longer spelled with LAZY_ in the middle.
Submitted by:	attilio
2007-06-06 23:23:47 +00:00
Jeff Roberson
1b1618fb12 - Change comments and asserts to reflect the removal of the global
scheduler lock.

Tested by:      kris, current@
Tested on:      i386, amd64, ULE, 4BSD, libthr, libkse, PREEMPTION, etc.
Discussed with: kris, attilio, kmacy, jhb, julian, bde (small parts each)
2007-06-04 23:57:32 +00:00
Attilio Rao
6759608248 Rework the PCPU_* (MD) interface:
- Rename PCPU_LAZY_INC into PCPU_INC
- Add the PCPU_ADD interface which just does an add on the pcpu member
  given a specific value.

Note that for most architectures PCPU_INC and PCPU_ADD are not safe.
This is a point that needs some discussions/work in the next days.

Reviewed by: alc, bde
Approved by: jeff (mentor)
2007-06-04 21:38:48 +00:00
Marcel Moolenaar
e59febd747 Revert to the previous version where the return value of uart_getenv()
is being ignored. It's optional and the lack of environment variable
is not an error condition.
2007-06-04 17:53:42 +00:00
Alan Cox
9211deca08 Add the machine-specific definitions for configuring the new physical
memory allocator.

Approved by:	re
2007-06-04 08:02:22 +00:00
Attilio Rao
2feb50bf7d Revert VMCNT_* operations introduction.
Probabilly, a general approach is not the better solution here, so we should
solve the sched_lock protection problems separately.

Requested by: alc
Approved by: jeff (mentor)
2007-05-31 22:52:15 +00:00
Paolo Pisati
3401f2c1df In some particular cases (like in pccard and pccbb), the real device
handler is wrapped in a couple of functions - a filter wrapper and an
ithread wrapper. In this case (and just in this case), the filter
wrapper could ask the system to schedule the ithread and mask the
interrupt source if the wrapped handler is composed of just an ithread
handler: modify the "old" interrupt code to make it support
this situation, while the "new" interrupt code is already ok.

Discussed with: jhb
2007-05-31 19:25:35 +00:00
John Hay
aeefab2b98 Remove the hardcoded IXP425_UART?_VBASE values in the
uart_ixp425_probe() and uart_cpu_getdev(). Change
uart_cpu_getdev() to use hints to find the console.

Reviewed by:	marcel
2007-05-29 18:10:42 +00:00
Pyun YongHyeon
590f73f72e Honor maxsegsz of less than a page size in a DMA tag. Previously it
used to return PAGE_SIZE without respect to restrictions of a DMA tag.
This affected all of the busdma load functions that use
_bus_dmamap_loader_buffer() as their back-end.

Reviewed by:	scottl
2007-05-29 06:30:26 +00:00
Alan Cox
66ab556097 Eliminate some unused definitions that came from NetBSD. 2007-05-28 21:04:22 +00:00
John Hay
728c8470f1 We do not need to get the irq out of ivars in ixp425_setup_intr(). By
this time they have already been set. In fact trying to set it here too
breaks irqs for pci devices.
2007-05-28 18:54:08 +00:00
John Hay
e6c51bdace Optimize a bit more, both the Avila and Pronghorn Metro boards work with
GPIO_TYPE_EDG_RISING.

Reviewed by:	sam
2007-05-28 18:45:16 +00:00
Sam Leffler
56b5a9c2a7 Search for a proper ucode image to use by incrementing the minor
release number up to the max.  This should eliminate the need to
tweak the default imageid define for later releases that are found
on the Intel web site.

MFC after:	1 month
2007-05-24 16:31:22 +00:00
Sam Leffler
c1fd78f884 o add hints for avila boards; brings back i2c devices lost when iicbus
started using hints instead of wired down device enumeration
o add usb commented out; will enable when support works

MFC after:	1 month
2007-05-24 16:27:48 +00:00
Sam Leffler
640edef54d Move to hints for configuring numerous devices so we can eliminate various
quirky code: uarts, led, cf/ide, ixpqmgr, npe are now specified with hints.

May want to put some of these devices back in the code and just use hints
to override/specify configuration.

MFC after:	1 month
2007-05-24 16:25:49 +00:00
Sam Leffler
dbbeaafca4 Don't muck with the internal state of a uart during probe, all we
should setup is the class.  This corrects an issue where enabling
uart1 on the avila board caused uart0 to stop working during boot
(no msgs generated by rc scripts were displayed).

Reviewed by:	imp
MFC after:	3 weeks
2007-05-24 16:17:51 +00:00
Sam Leffler
9fcef51546 Fix interrupt setup; rev 1.3 switched the irq to GPIO_TYPE_ACT_LOW
but this does not work on avila boards; special case them to use
GPIO_TYPE_EDG_RISING.

MFC after:	3 weeks
Submitted by:	jhay
2007-05-24 16:15:20 +00:00
Olivier Houchard
9d480d9ede Remove duplicate includes.
Submitted by:   Cyril Nguyen Huu <cyril ci0 org>
2007-05-23 13:21:57 +00:00
Alexander Kabaev
23a29e45cd Allow FreeBSD's native ELF image activators to execute shared libraries the
same way it was enabled for Linux binares in linuxulator.

This allows binaries built with -pie. Many ports auto-detect -fPIE support
in GCC 4.2 and build binaries FreeBSD was unable to run.
2007-05-22 02:22:58 +00:00
Olivier Houchard
705fda849d Use __mcount() instead of _mcount() to reduce diffs with NetBSD. 2007-05-19 16:20:37 +00:00
Olivier Houchard
3de2f9db98 Constify to please gcc 4.2. 2007-05-19 13:32:58 +00:00
Olivier Houchard
10c33eae44 Do not try to inline pmap_kremove(), as it's exported. 2007-05-19 13:21:41 +00:00
Olivier Houchard
a994b16d7d Do not try to inline bus_dmamap_sync_buf(), gcc 4.2 doesn't want to do so
because it uses alloca().
Initialize lastaddr in bus_dmamap_load_uio().
2007-05-19 13:17:31 +00:00
Olivier Houchard
fe85f6cee8 Switch the kernel's pmap domain from 15 to 0.
This should be a no-op, and this is needed for xscale core 3 supersections
support, as they are always part of the domain 0
2007-05-19 12:47:34 +00:00
Jeff Roberson
222d01951f - define and use VMCNT_{GET,SET,ADD,SUB,PTR} macros for manipulating
vmcnts.  This can be used to abstract away pcpu details but also changes
   to use atomics for all counters now.  This means sched lock is no longer
   responsible for protecting counts in the switch routines.

Contributed by:		Attilio Rao <attilio@FreeBSD.org>
2007-05-18 07:10:50 +00:00
Alan Cox
04a18977c8 Define every architecture as either VM_PHYSSEG_DENSE or
VM_PHYSSEG_SPARSE depending on whether the physical address space is
densely or sparsely populated with memory.  The effect of this
definition is to determine which of two implementations of
vm_page_array and PHYS_TO_VM_PAGE() is used.  The legacy
implementation is obtained by defining VM_PHYSSEG_DENSE, and a new
implementation that trades off time for space is obtained by defining
VM_PHYSSEG_SPARSE.  For now, all architectures except for ia64 and
sparc64 define VM_PHYSSEG_DENSE.  Defining VM_PHYSSEG_SPARSE on ia64
allows the entirety of my Itanium 2's memory to be used.  Previously,
only the first 1 GB could be used.  Defining VM_PHYSSEG_SPARSE on
sparc64 allows USIIIi-based systems to boot without crashing.

This change is a combination of Nathan Whitehorn's patch and my own
work in perforce.

Discussed with: kmacy, marius, Nathan Whitehorn
PR:		112194
2007-05-05 19:50:28 +00:00
Kevin Lo
3eeb00692a Remove sa1_cache_clean_addr. It isn't needed. 2007-05-03 09:51:12 +00:00
Marcel Moolenaar
f8100ce2a7 Don't expose the uart_ops structure directly, but instead have
it obtained through the uart_class structure. This allows us
to declare the uart_class structure as weak and as such allows
us to reference it even when it's not compiled-in.
It also allows is to get the uart_ops structure by name, which
makes it possible to implement the dt tag handling in uart_getenv().
The side-effect of all this is that we're using the uart_class
structure more consistently which means that we now also have
access to the size of the bus space block needed by the hardware
when we map the bus space, eliminating any hardcoding.
2007-04-02 22:00:22 +00:00
Nick Hibma
f29fa1dfa4 Revisit the watchdogs: Resetting the error to EINVAL after failing to set the
watchdog might hide the succesful arming of an earlier one. Accept that on
failing to arm any watchdog (because of non-supported timeouts) EOPNOTSUPP is
returned instead of the more appropriate EINVAL.

MFC after:	3 days
2007-03-27 21:03:37 +00:00
Kevin Lo
45c4f0cbc3 Don't map mini-data cache page since ARM920T doesn't have it. 2007-03-27 06:29:19 +00:00
Warner Losh
657c256c31 Default to booting off the SD card. It is more useful, and a full
FreeBSD/arm installworld install is only 170MB.  The smallest SD card
I could find at the store today was 512MB (and it was only $10 after
rebate), with a 2GB card for as low as $25.00...

Now that the IIC stuff has been sorted out, include that as well.
Include hints for the icee 16kb 16-bit i2c device.  It should include
info about the temperature sensor as well, but that driver isn't quite
ready.

Add bpf for dhclient happiness.

MFC After: 1 week
2007-03-23 23:47:59 +00:00
Warner Losh
bac394d579 MFp4: A bunch of patches from myself and Tisco to improve the
robustness of IIC transactions when parts aren't present.  This also
removes a bunch of debug.  This also moves this driver to 7-1
addressing rather than 6-0 addressing, which is more inline with all
the other iic drivers in the tree.  I've tested this for about a
million years on the systems at work.
2007-03-23 22:57:24 +00:00
Kevin Lo
75f30232c5 Fix a comment 2007-03-21 07:49:56 +00:00
Kevin Lo
4eaa43e6f4 Remove __P 2007-03-21 03:28:16 +00:00
John Hay
142f4ed4b1 Map the second CS of the compact flash too. This allow us access to
the alternate status and the control registers. Remove the local
version of ata_reset.

Add support for the ADI Pronghorn Metro boards. They use CS3 and CS4
instead of Avila's CS1 and CS2.
2007-03-14 19:03:07 +00:00
John Hay
b4078e515f Map the second CS of the compact flash too. This allow us access to
the alternate status and the control registers. Remove the local
version of ata_reset.

Add support for the ADI Pronghorn Metro boards. They use CS3 and CS4
instead of Avila's CS1 and CS2.

OKed by: sam, cognet
2007-03-14 18:05:04 +00:00
Alan Cox
c640357f04 Push down the implementation of PCPU_LAZY_INC() into the machine-dependent
header file.  Reimplement PCPU_LAZY_INC() on amd64 and i386 making it
atomic with respect to interrupts.

Reviewed by: bde, jhb
2007-03-11 05:54:29 +00:00
Paolo Pisati
15eab674d8 Wrap ixppcib_setup_intr() at 80. 2007-03-06 10:58:22 +00:00
Paolo Pisati
9ca5d390d4 Wrap a BUS_SETUP_INTR() line at 80. 2007-03-06 10:56:54 +00:00
Paolo Pisati
856e1ae84c o substitute INTR_FAST with FILTER in a panic message.
o wrap a BUS_SETUP_INTR() line at 80.
2007-03-06 10:55:57 +00:00
Kevin Lo
4cd84059be Reverse this change. malloc() with M_WAITOK never fails.
Noted by: cognet, brian and thompsa
2007-03-06 01:15:28 +00:00
Kevin Lo
2f0275579d Check for malloc return value 2007-03-05 06:33:08 +00:00
Paolo Pisati
b07b4f1229 Update bus_setup_intr().
Pointed by: Krassimir Slavchev
2007-03-01 09:10:55 +00:00
John Baldwin
552e9b06bb Use tsleep() rather than msleep() with a NULL mtx. 2007-02-27 17:15:39 +00:00
Paolo Pisati
2e35649225 Correct return code (int) for at91_rtc_intr() prototype.
Approved by: cognet
2007-02-27 13:39:34 +00:00
Kevin Lo
82003b276a Remove unused header file <machine/katelib.h> 2007-02-26 05:17:47 +00:00
Olivier Houchard
0dcd646d88 Define FLASHADDR and LOADERRAMADDR for the Avila, so that we can boot a
kernel from the onboard flash.
2007-02-26 02:04:24 +00:00
Olivier Houchard
f96b290333 Erm we can't change the value of arm_memcpy if we're running from flash.
Instead, make memcpy() check if we're running from flash, and avoid
using arm_memcpy if we're doing so.
2007-02-26 02:03:48 +00:00
Olivier Houchard
902222e77c Update for the new prototype of bus_setup_intr(). 2007-02-25 22:17:54 +00:00
Paolo Pisati
23b5f6dc07 Fix attach of at91_pio() after bus_setup_intr() modification.
Reported and tested by: Krassimir Slavchev
2007-02-25 14:34:59 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
Olivier Houchard
f59ae8e84a Add two new options, FLASHADDR, which defines the address the flash is
mapped at, and LOADERRAMADDR, the address at which the loader maps the ram at
at the time the kernel is booted.
They are used to detect if the kernel is booted from the onboard flash.
Define those for the IQ31244
2007-02-19 01:03:08 +00:00
Olivier Houchard
db599c2f20 Teach the kernel and the ELF trampoline how to boot from onboard flash. 2007-02-19 00:57:27 +00:00
Olivier Houchard
0d9fc1e6e1 There's no such thing as a GENERIC kernel on arm.
Spotted out by:	csjp
MFC After:	3 days
2007-02-19 00:37:25 +00:00
Luigi Rizzo
33d5497079 Cleanup and document the implementation of firmware(9) based on
a version that i posted earlier on the -current mailing list,
and subsequent feedback received.

The core of the change is just in sys/firmware.h and kern/subr_firmware.c,
while other files are just adaptation of the clients to the ABI change
(const-ification of some parameters and hiding of internal info,
so this is fully compatible at the binary level).

In detail:
- reduce the amount of information exported to clients in struct firmware,
  and constify the pointer;

- internally, document and simplify the implementation of the various
  functions, and make sure error conditions are dealt with properly.

The diffs are large, but the code is really straightforward now (i hope).

Note also that there is a subtle issue with the implementation of
firmware_register(): currently, as in the previous version, we just
store a reference to the 'imagename' argument, but we should rather
copy it because there is no guarantee that this is a static string.
I realised this while testing this code, but i prefer to fix it in
a later commit -- there is no regression with respect to the past.

Note, too, that the version in RELENG_6 has various bugs including
missing locks around the module release calls, mishandling of modules
loaded by /boot/loader, and so on, so an MFC is absolutely necessary
there.  I was just postponing it until this cleanup to avoid doing
things twice.

MFC after: 1 week
2007-02-15 17:21:31 +00:00
Kevin Lo
65a92876a4 Add KTR tracing 2007-02-14 04:41:28 +00:00
Kevin Lo
9c21f7691e style(9) cleanup. 2007-02-14 01:25:41 +00:00
Kevin Lo
a894419d37 In sendsig:
- Add sigacts locking.
- Add a mutex to struct sigacts that protects all the members of the struct.
- Create and log events via the CTRx macros.

Reviewed by: cognet
2007-02-14 01:08:42 +00:00
Olivier Houchard
4cc9ecf6cb Make sure the address is valid before mapping it.
MFC after:	1 week
2007-02-13 15:35:57 +00:00
Kevin Lo
3d9e8ab862 Fix typo: MacPPC -> ARM 2007-02-13 07:19:26 +00:00
Olivier Houchard
7d24f6f049 Use uma_set_align(). 2007-02-11 22:24:54 +00:00
Max Laier
a1529123d9 Fix small altq related copy and paste error. 2007-02-10 15:43:58 +00:00
Warner Losh
984a9ada81 Add sanity check to make sure that the MAC address isn't all 0's. Bad
boot loaders can do this, and this leads to all kinds of ill effects
downstream.  Also, minor formatting nits.
2007-02-08 21:42:10 +00:00
Marcel Moolenaar
1d3aed33e8 Evolve the ctlreq interface added to geom_gpt into a generic
partitioning class that supports multiple schemes. Current
schemes supported are APM (Apple Partition Map) and GPT.
Change all GEOM_APPLE anf GEOM_GPT options into GEOM_PART_APM
and GEOM_PART_GPT (resp).

The ctlreq interface supports verbs to create and destroy
partitioning schemes on a disk; to add, delete and modify
partitions; and to commit or undo changes made.
2007-02-07 18:55:31 +00:00
Warner Losh
21389c94d9 at91_twi depends on the iicbus module to satisfy its symbols when
loaded, so make that explicit.  Works for the monolithic kernel case,
won't work for the kldload case.
2007-02-06 12:07:14 +00:00
Kevin Lo
e4d87be479 <sys/sx.h> is unneeded. 2007-02-05 10:33:39 +00:00
Kevin Lo
1f35d9bfbd ether_ifattach() sets if_mtu to ETHERMTU, don't bother set it again.
Approved by: imp, cognet
2007-02-03 07:46:26 +00:00
Kevin Lo
8c605560c4 Remove a bogus i = 0
Approved by: cognet
2007-02-02 05:14:21 +00:00
Kevin Lo
25777ce331 Use our own timer that piggybacks on npe_tick() callout instead of
if_watchdog/if_timer interface.

Approved by: sam, cognet
2007-01-30 01:18:29 +00:00
Kevin Lo
27864bcad8 Fix comments.
Approved by: cognet
2007-01-26 01:37:32 +00:00
Marius Strobl
97202af2dc - Add a uart_rxready() and corresponding device-specific implementations
that can be used to check whether receive data is ready, i.e. whether
  the subsequent call of uart_poll() should return a char, and unlike
  uart_poll() doesn't actually receive data.
- Remove the device-specific implementations of uart_poll() and implement
  uart_poll() in terms of uart_getc() and the newly added uart_rxready()
  in order to minimize code duplication.
- In sunkbd(4) take advantage of uart_rxready() and use it to implement
  the polled mode part of sunkbd_check() so we don't need to buffer a
  potentially read char in the softc.
- Fix some mis-indentation in sunkbd_read_char().

Discussed with:	marcel
2007-01-18 22:01:19 +00:00
Olivier Houchard
ebfaa05056 Create bus dma tags for both the PCI bus and the IXP425 root bus. Set the
PCI bus' one as the default one, and explicitely use the other one for
non-PCI devices.
This is needed because the PCI bus can only address 64MB of RAM, while some
IXP425 boards have 128MB or more, and most of the PCI drivers do not bother
providing the parent dma tag.
2007-01-17 00:58:25 +00:00
Olivier Houchard
47010239a8 - Add bounce pages for arm, largely based on the i386 implementation.
- Add a default parent dma tag, similar to what has been done for sparc64.
- Before invalidating the dcache in POSTREAD, save the bits which are in the
same cachelines than our buffers, but not part of it, and restore them after
the invalidation.
2007-01-17 00:53:05 +00:00
Bernd Walter
03d0aa10bc Hints are handled differently on -current
Don't include hints.at91rm9200 for now
2007-01-05 10:30:51 +00:00
Bernd Walter
dde6da66c5 MFp4: Use the next possible value for hz instead of defaulting to 128
Update tick value after modifying hz.
2007-01-05 02:52:06 +00:00
Bernd Walter
69b40f4db3 MFp4: Add missing atomic functions
Based on a patch by: des
2007-01-05 02:50:27 +00:00
Bernd Walter
ecfa9e8ded MFp4: add BWCT kernel configuration 2007-01-05 02:08:35 +00:00
Bernd Walter
2e54a4ac40 MFp4: Make at91_rtc optional to allow other RTC choices 2007-01-05 02:06:53 +00:00
Bernd Walter
05a3e0db5c MFp4: Read access require PDC to be setup first otherwise we might get
overrun errors.
	Write access however need cmd first, so keep the existing order
	for them.
2007-01-05 01:18:32 +00:00
Bernd Walter
f291c40a40 MFp4: BWCT boards are using an 16MHz xtal 2007-01-05 01:14:14 +00:00
Bernd Walter
bd55b92b0e MFp4: Add VLAN_MTU support 2007-01-05 01:07:59 +00:00
Bernd Walter
3bb40db608 MFp4: fix a race in transmit buffer handling 2007-01-05 01:01:14 +00:00
Warner Losh
e79c6a301d MFp4: Fix bit name for SPI SR register 2007-01-01 00:50:25 +00:00
Warner Losh
5434a91804 MFp4: Remove watchdog timeout that appears to be unused. 2007-01-01 00:48:25 +00:00
Warner Losh
c36172be39 Merge from FreeBSD-tsf-6 by way of p4:
correct values for PIO registers

	submitted by: patrick schweiger
2007-01-01 00:46:54 +00:00
Nick Hibma
9079fff550 Align the interfaces for the various watchdogs and make the interface
behave as expected.

Also:
- Return an error if WD_PASSIVE is passed in to the ioctl as only
  WD_ACTIVE is implemented at the moment. See sys/watchdog.h for an
  explanation of the difference between WD_ACTIVE and WD_PASSIVE.
- Remove the I_HAVE_TOTALLY_LOST_MY_SENSE_OF_HUMOR define. If you've
  lost your sense of humor, than don't add a define.

Specific changes:

i80321_wdog.c
  Don't roll your own passive watchdog tickle as this would defeat the
  purpose of an active (userland) watchdog tickle.

ichwd.c / ipmi.c:
  WD_ACTIVE means active patting of the watchdog by a userland process,
  not whether the watchdog is active. See sys/watchdog.h.

kern_clock.c:
  (software watchdog) Remove a check for WD_ACTIVE as this does not make
  sense here. This reverts r1.181.
2006-12-15 21:44:49 +00:00
Sam Leffler
81319550dd Handle a missing NPE firmware file better; if it's missing print a
(somewhat) meaningful message and terminate the build.  It'd be
nice to print a proper URL from which to fetch the file but that
seems problematic.  Leave a suggested starting point in this file
(TBD: add it to the man page).

Submitted by:	ru
2006-12-07 00:49:33 +00:00
Olivier Houchard
ae89920ab9 Unbreak build for Skyeye: do not attempt to do any DMA, as Skyeye doesn't
emulate it.

Reported by:	ru
2006-12-07 00:24:15 +00:00
Julian Elischer
ad1e7d285a Threading cleanup.. part 2 of several.
Make part of John Birrell's KSE patch permanent..
Specifically, remove:
Any reference of the ksegrp structure. This feature was
never fully utilised and made things overly complicated.
All code in the scheduler that tried to make threaded programs
fair to unthreaded programs.  Libpthread processes will already
do this to some extent and libthr processes already disable it.

Also:
Since this makes such a big change to the scheduler(s), take the opportunity
to rename some structures and elements that had to be moved anyhow.
This makes the code a lot more readable.

The ULE scheduler compiles again but I have no idea if it works.

The 4bsd scheduler still reqires a little cleaning and some functions that now do
ALMOST nothing will go away, but I thought I'd do that as a separate commit.

Tested by David Xu, and Dan Eischen using libthr and libpthread.
2006-12-06 06:34:57 +00:00
Olivier Houchard
8cd2513ee1 Do not forget to call pmap_free_l2_bucket() in pmap_remove_pages().
This can fix the pmap-related panics reported on arm.

MFC After:	3 days
2006-12-04 12:55:00 +00:00
Olivier Houchard
7f7ba6ec05 Provide stream operations. 2006-12-02 13:37:29 +00:00
Olivier Houchard
5b3e7496e6 We can have no PV entry here if the previous mapping was unmanaged, and the new
one is unmanaged too, so update the KASSERT to reflect this.
2006-12-01 12:29:55 +00:00
Olivier Houchard
92c930f4ec In pmap_ts_referenced(), don't attempt to do anything if the page is
fictitious, and just return 0.
2006-11-30 23:35:34 +00:00
Olivier Houchard
73dcd92598 First bits of Xscale core 3 support (the VM bits are far from being optimal
yet).
2006-11-30 23:34:07 +00:00
Olivier Houchard
2feb83cec2 Introduce CPU_XSCALE_CORE3, as XScale Core 3 is significally different than
regular Xscale (it has no mini data cache, has armv6-style 16MB
supersections, and can address 36bits).
Define it for i81342.
2006-11-30 23:30:40 +00:00
Kevin Lo
561d953686 Better i2c bit definitions.
Approved by: cognet
2006-11-30 06:30:01 +00:00
John Birrell
e0b651251d Turn console printf buffering into a kernel option and only on
by default for sun4v where it is absolutely required.

This change moves the buffer from struct pcpu to the stack to avoid
using the critical section which created a LOR in a couple of cases
due to interaction with the tty code and kqueue. The LOR can't be
fixed with the critical section and the pcpu buffer can't be used
without the critical section.

Putting the buffer on the stack was my initial solution, but it was
pointed out that the stress on the stack might cause problems
depending on the call path. We don't have a way of creating tests
for those possible cases, so it's best to leave this as an option
for the time being. In time we may get enough data to enable this
option more generally.
2006-11-30 04:17:05 +00:00
Warner Losh
435620f10d MFp4:
formatting nit
2006-11-29 08:17:40 +00:00
Warner Losh
e8c8e11c08 Make this work a lot better:
Remove a lot of older cruft not needed.
	Improve ISR support, but it is still unused since polling is faster
	Properly initalize the speed register to get 90kb/s, not 400b/s.
	Try to catch NACK
	Allow 0 length read transfers to generate start/top pairs.
2006-11-29 08:15:59 +00:00
Warner Losh
ab45d28ce3 MFp4:
correct data counts so that we clock enough data for the spi
	transaction.  This allows complete spi transactions to happen.
2006-11-29 07:57:02 +00:00
Kevin Lo
f1b6520619 Bring in status led support for /dev/led/gpioled on Avila.
Approved by: cognet
2006-11-22 12:57:17 +00:00
Warner Losh
ff7447dae1 MFp4: Make it work :-)
o Don't delay when checking the done bits.  There's no gain other
	  than a small performance hit.
	o calculate the clock divisors better (things are still way slow,
	  so maybe there's more here?)
	o don't always fail reset.  Always succeed instead.
	o fix inverted logic around at91_twi_wait() return value
	o remove debug code
	o remove unneeded, unworking junk
2006-11-22 06:51:59 +00:00
Kevin Lo
681efe0834 Match bus space unmap prototype.
Approved by: cognet
2006-11-20 13:21:02 +00:00
Warner Losh
111bcda150 MFp4: Tweak descriptions in preparation for porting to other members of
the AT91 arm9 family.
2006-11-20 06:27:15 +00:00
Sam Leffler
d4593bb04f config for Gateworks Avila board booting with NFS-mounted root on npe0
Reviewed by:	cognet, imp
MFC after:	1 month
2006-11-19 23:58:12 +00:00
Sam Leffler
e67f80fd20 Gateworks Avila board support:
o ixp425 support
o NPE network driver (requires Intel microcode)
o h/w qmgr support
o True IDE compact flash over expansion bus
o pci (ath and hifn795x parts tested)
o xscale watchdog timer
o ds1672 RTC on i2c bus
o ad7418 voltage + temp monitoring on i2c bus
o uart

Work done together with cognet, kevlo, and jmg.  Parts of
the ixp425 support obtaine/derived from netbsd.

Reviewed by:	cognet, imp
MFC after:	1 month
2006-11-19 23:55:23 +00:00
Sam Leffler
faad47108d change bus space unmap protoype
Reviewed by:	cognet, imp
MFC After:	1 month
2006-11-19 23:47:51 +00:00
Sam Leffler
588a2322a9 correct bus space unmap prototype
Reviewed by:	cognet, imp
MFC after:	1 month
2006-11-19 23:46:50 +00:00
Sam Leffler
7fb399a7e5 elaborate on stepping names; add intel terminology to help
people cross-referencing intel docs

Reviewed by:	imp, cognet
MFC after:	1 month
2006-11-19 23:45:33 +00:00
Olivier Houchard
1ea7de37f9 Erm we really want to mask all interrupts in the range, just not the first
one.

Submitted by:	ru
2006-11-17 11:56:56 +00:00
Kevin Lo
f43f0196a9 Compile -- remove an unused global variable avail_end.
Approved by: cognet
2006-11-17 00:53:39 +00:00
Ruslan Ermilov
26af9ac7d0 Fix a comment. 2006-11-13 06:26:57 +00:00
Alan Cox
44b8bd66f9 Make pmap_enter() responsible for setting PG_WRITEABLE instead
of its caller.  (As a beneficial side-effect, a high-contention
acquisition of the page queues lock in vm_fault() is eliminated.)
2006-11-12 21:48:34 +00:00
Alan Cox
cc0d48ffb6 Eliminate unused global variables. 2006-11-11 20:57:52 +00:00
Alan Cox
e288d71672 MFamd64/ia64/i386/sun4v
Use cnt.v_page_count, the actual count of available physical pages,
  instead of vm_page_array_size to compute the maximum number of pv
  entries.
2006-11-08 06:31:28 +00:00
Olivier Houchard
c162ce855c Increate cnt.v_intr on interrupt. 2006-11-08 01:32:24 +00:00
Olivier Houchard
676b1fbdbf Identify the xscale 81342. 2006-11-07 22:36:57 +00:00
Olivier Houchard
08b91759f3 In the ARM_USE_SMALL_ALLOC case, vm_page_t may have an address < KERNBASE,
so adjust the KASSERT to reflect this.
2006-11-07 22:35:30 +00:00
Olivier Houchard
2c7b82c9dd Add atomic_cmpset_acq_32. 2006-11-07 11:53:44 +00:00
Warner Losh
8cd5dc08c3 MFp4:
o Fix the packet statistics
	o Make sure we set the FD bit when in full duplex
	o Improve TX side efficency by eliminating a data copy for
	  unfragmented mbufs (the hardware can't do s/g).
	o Minor busdma pedantry
	o better comments in some places, more XXX in others
	o Minor style nits.

This solves a problem I was seeing where I'd get no ethernet when not
booting with a NFS root.  Well, unless I unplugged the cable and
plugged it back in first so I'd get the same up down up messages I get
for NFS root...

Thanks to sam and scottl for suggestions on making this driver more
efficient through better use of approrpiate APIs.
2006-11-03 07:39:37 +00:00
Olivier Houchard
da834c5711 Do not include both <sys/types.h> and <sys/param.h>, it is a style bug as
sys/types.h is included in sys/param.h, so instead just move the
#include <sys/param.h> before the headers that need it.

Spotted out by:	bde
2006-11-01 12:41:43 +00:00
John Birrell
3d068827c2 Add a cnputs() function to write a string to the console with
a lock to prevent interspersed strings written from different CPUs
at the same time.

To avoid putting a buffer on the stack or having to malloc one,
space is incorporated in the per-cpu structure. The buffer
size if 128 bytes; chosen because it's the next power of 2 size
up from 80 characters.

String writes to the console are buffered up the end of the line
or until the buffer fills. Then the buffer is flushed to all
console devices.

Existing low level console output via cnputc() is unaffected by
this change. ithread calls to log() are also unaffected to avoid
blocking those threads.

A minor change to the behaviour in a panic situation is that
console output will still be buffered, but won't be written to
a tty as before. This should prevent interspersed panic output
as a number of CPUs panic before we end up single threaded
running ddb.

Reviewed by:	scottl, jhb
MFC after:	2 weeks
2006-11-01 04:54:51 +00:00
Olivier Houchard
c3248b4002 Include <sys/types.h>, to get definition for uint32_t.
Submitted by:	David Sharp
2006-10-30 23:23:00 +00:00
John Birrell
3750d1ecad Remove the KSE option now that it's in DEFAULTS on these arches/machines.
The 'nooption' kernel config entry has to be used to turn KSE off now.
This isn't my preferred way of dealing with this, but I'll defer to
scottl's experience with the io/mem kernel option change and the grief
experienced over that.

Submitted by:	scottl@
2006-10-26 22:11:35 +00:00
John Birrell
8460a577a4 Make KSE a kernel option, turned on by default in all GENERIC
kernel configs except sun4v (which doesn't process signals properly
with KSE).

Reviewed by:	davidxu@
2006-10-26 21:42:22 +00:00
Olivier Houchard
4e52d86822 Let allow to teardown multiple irqs as well. 2006-10-25 21:11:46 +00:00
Olivier Houchard
0a7b049096 Setup multiple interrupts if needed. 2006-10-25 21:00:08 +00:00
Warner Losh
bc8fe52e6d MFp4: Move the parameters that are basically dictated by the AT91
organization to that file.
2006-10-25 08:00:11 +00:00
Warner Losh
1b104c589a MFp4: Status register bits 2006-10-25 07:58:18 +00:00
Olivier Houchard
d370f1f482 Ooops, dump_avail[i] can be 0 if the RAM starts at 0x00000000, so check that
dump_avail[i + 1] is == 0 as a stop condition instead.
MFC after: 3 days
2006-10-24 23:27:52 +00:00
Kevin Lo
24ef8c83ee style(9) cleanup.
Approved by: cognet
2006-10-21 04:25:00 +00:00
Olivier Houchard
06e28eec94 Ok I am an idiot. On 32 bits big-endian systems, it is needed to handle the
syscalls using __syscall but only actually returning 32bits, such as mmap(),
specially : they set the return value in td->td_retval[0], but the userland
functions will expect this in r1, and not in r0 as it is normally done, as it
is the LSB. So add a special case for all these syscalls (all except lseek,
which truly returns 64bits).

Many thanks to Peter Grehan for his patience while explaining me the issue.
2006-10-21 00:46:56 +00:00
Olivier Houchard
38b3d206f4 Use __QUAD_LOWWORD for __syscall, to always use the good word, whatever the
endianness is.
2006-10-20 22:40:31 +00:00
Olivier Houchard
40594b3305 There's no need to special-case lseek for arm/big-endian. 2006-10-20 11:00:03 +00:00
Warner Losh
0f1c5aca64 MFp4: Working SPI driver. 2006-10-20 07:10:13 +00:00
Warner Losh
89975186a3 Commit WIP SSC driver, more work is needed here, but it configures
things OK.
2006-10-20 07:08:59 +00:00
Warner Losh
bfa94035b0 More register definitions. 2006-10-20 07:08:15 +00:00
Warner Losh
5f9c612ae7 Progress commit for getting TWI working 2006-10-20 07:06:39 +00:00
Warner Losh
56878d42da Add sysctl to export current state of rmii vs mii configuraiton.
Fix a typo in resource allocation.
2006-10-20 07:04:56 +00:00
Warner Losh
e352ac0afb Add configuration of the SSC lines for second SSC. 2006-10-20 07:03:57 +00:00
Warner Losh
e41e815e5c MMC/SD bridge driver (host adapter) for AT91RM9200's MCI interface.
This interface also appears in the AT91SAM9260 and '61 as well as the
AVR32 based micros from Atmel.  We don't yet support write protect or
hot-swap in this bridge driver.
2006-10-20 06:44:04 +00:00
David Xu
5f641fc0fb o Add keyword volatile for user mutex owner field.
o Fix type consistent problem by using type long for old
  umtx and wait channel.
o Rename casuptr to casuword.
2006-10-17 02:24:47 +00:00
John Birrell
6825d60738 PR:
Submitted by:
Reviewed by:
Approved by:
Obtained from:
MFC after:
Security:
Move the relocation definitions to the common elf header so that DTrace
can use them on one architecture targeted to a different one.

Add the additional ELF types defines in Sun's "Linker and Libraries"
manual.
2006-10-04 21:37:10 +00:00
Poul-Henning Kamp
f645b0b51c First part of a little cleanup in the calendar/timezone/RTC handling.
Move relevant variables to <sys/clock.h> and fix #includes as necessary.

Use libkern's much more time- & spamce-efficient BCD routines.
2006-10-02 12:59:59 +00:00
Alexander Kabaev
d9cb97ff9d Use __builtin_va_start instead of __builtin_stdarg_start. GCC4 obsoletes
the former and  __builtin_va_start was present in all GCC version 3.1 and
later.
2006-09-21 01:37:02 +00:00
Warner Losh
656595aa63 MFp4: first cut at getting I2C transfers working (generically). I'm
unsure if this driver correctly implements all the start/stop junk
right (but it did or didn't before I made this commit).
2006-09-07 21:53:28 +00:00
Warner Losh
5dced01e59 MFp4: berndt pointed me at an errata that shows that the stat register
offsets were originally documented incorrectly.  This fixes that.  It
shouldn't affect anything other than error stat reporting.
2006-09-07 21:50:01 +00:00
Olivier Houchard
4731df1ee7 Remove dead code, already defined in sys/cdef.h
Spotted out by:	bde
2006-08-30 11:45:07 +00:00
Olivier Houchard
d50cc5583f Use ENTRY_NP for alternate entry points instead of ENTRY to avoid calling
mcount twice when profiling.

Spotted out by:	bde
2006-08-30 11:44:37 +00:00
Olivier Houchard
1b980732bb Use ENTRY instead of ALTENTRY, it doesn't exist on arm. 2006-08-29 23:53:34 +00:00
Olivier Houchard
89413e6217 Ooops m->md.pvh_attrs can't be used to know if the page is writeable, because
it only remembers if the page is modified or referenced.

Bad review from:	cognet
2006-08-28 21:43:34 +00:00
Olivier Houchard
f35ea630e9 Relocate the vector page for AT91, to work around bugs with the LOW_VECTOR
code.
2006-08-28 20:05:00 +00:00
David Xu
66e1c26dba Implement casuword32, compare and set user integer, thank Marcel Moolenarr
who wrote the IA64 version of casuword32.
2006-08-28 02:28:15 +00:00
Olivier Houchard
2df5885cb9 Fill in dump_avail[] before pmap_boostrap() is called so that
ARM_USE_SMALL_ALLOC work.
2006-08-27 13:23:51 +00:00
Alan Cox
b554f899bd Eliminate unused definitions. (They came from NetBSD.)
Discussed with: cognet, grehan, marcel
2006-08-25 23:51:11 +00:00
Olivier Houchard
5bbbbe1b2a Explicitely set the "allocbuffer" field to NULL when creating a new dmamap. 2006-08-25 15:10:45 +00:00
Olivier Houchard
223d2768ad Do not create dma maps with bus_dmamap_create, as we call
bus_dmamem_alloc later which will overwrite the value, leading to a small
memory leak.
2006-08-25 13:38:42 +00:00
Olivier Houchard
11d1528ce0 Finally bring it support for the i80219 XScale processor.
Submitted by:	Max M. Boyarov <m.boyarov bsd by>
2006-08-24 23:51:28 +00:00
Olivier Houchard
ba282be9f3 Use ELFDATA2MSB if we're building big endian.
Noticed by:	Oleksandr Tymoshenko <gonzo freebsd org>
2006-08-24 23:00:03 +00:00
Warner Losh
751a10df01 add comment about why we include opt_global.h 2006-08-15 18:11:25 +00:00
Olivier Houchard
0638c88517 Ooops we need to include <machine/vmparam.h> to get the definition of
KERNBASE and VM_MAXUSER_ADDRESS.
Remove the useless include of opt_global.h, as noticed by netchild@ (the one
in arm/elf_trampoline.c is legit, because this file is compiled outside the
kernel, and doesn't use the standard CFLAGS).
2006-08-15 16:43:07 +00:00
Warner Losh
27e13f2b3e Hook into the watchdog device, if present. Also, turn off the
watchdog timer stuff when we boot because the boot blocks are turning
it on...
2006-08-09 20:58:55 +00:00
Olivier Houchard
49953e11d7 Rewrite ARM_USE_SMALL_ALLOC so that instead of the current behavior, it maps
whole the physical memory, cached, using 1MB section mappings. This reduces
the address space available for user processes a bit, but given the amount of
memory a typical arm machine has, it is not (yet) a big issue.
It then provides a uma_small_alloc() that works as it does for architectures
which have a direct mapping.
2006-08-08 20:59:38 +00:00
Kevin Lo
400e3077d8 Remove a bogus i = 0.
Approved by: cognet
2006-08-08 01:18:18 +00:00
Alan Cox
78985e424a Complete the transition from pmap_page_protect() to pmap_remove_write().
Originally, I had adopted sparc64's name, pmap_clear_write(), for the
function that is now pmap_remove_write().  However, this function is more
like pmap_remove_all() than like pmap_clear_modify() or
pmap_clear_reference(), hence, the name change.

The higher-level rationale behind this change is described in
src/sys/amd64/amd64/pmap.c revision 1.567.  The short version is that I'm
trying to clean up and fix our support for execute access.

Reviewed by: marcel@ (ia64)
2006-08-01 19:06:06 +00:00
John Baldwin
cb76d9b05c Retire SYF_ARGMASK and remove both SYF_MPSAFE and SYF_ARGMASK. sy_narg is
now back to just being an argument count.
2006-07-28 20:22:58 +00:00
John Baldwin
af5bf12239 Now that all system calls are MPSAFE, retire the SYF_MPSAFE flag used to
mark system calls as being MPSAFE:
- Stop conditionally acquiring Giant around system call invocations.
- Remove all of the 'M' prefixes from the master system call files.
- Remove support for the 'M' prefix from the script that generates the
  syscall-related files from the master system call files.
- Don't explicitly set SYF_MPSAFE when registering nfssvc.
2006-07-28 19:05:28 +00:00
John Baldwin
22ea1bc57a Unify the checking for lock misbehavior in the various syscall()
implementations and adjust some of the checks while I'm here:
- Add a new check to make sure we don't return from a syscall in a critical
  section.
- Add a new explicit check before userret() to make sure we don't return
  with any locks held.  The advantage here is that we can include the
  syscall number and name in syscall() whereas that info is not available
  in userret().
- Drop the mtx_assert()'s of sched_lock and Giant.  They are replaced by
  the more general checks just added.

MFC after:	2 weeks
2006-07-27 22:32:30 +00:00
Olivier Houchard
9c8cab3814 Define BYTE_MSF if we're compiling a big endian kernel, so that DDB can
correctly disassemble instructions on big endian.
2006-07-27 11:41:37 +00:00
Olivier Houchard
f9ad2af361 Use virtual_avail instead of freemempos as the starting point of the available
physical memory, as the vm uses the memory between freemempos and
virtual_avail.

MFC After:	3 days
2006-07-25 23:07:35 +00:00
Kevin Lo
c4a6fb0610 Cleanup.
Approved by: cognet
2006-07-25 01:08:41 +00:00
Alan Cox
7e8041d356 Implement pmap_clear_write().
Discussed with: cognet@
2006-07-20 23:26:22 +00:00
Olivier Houchard
bba93a0066 Fix ALT_BREAK_TO_DEBUGGER on the AT91 :
The core uart code expects the receive method to actually puts the
characters read into its buffers. For AT91, it's done in the ipend routine,
so also check if we have the alternate break sequence here.

MFC after:	3 days
2006-07-20 21:03:43 +00:00
Olivier Houchard
8067ea809e Make sure we use REDUCE32 on the result of do_cksum(), as in_cksum_skip()
expects this. If we do not, this could result in wrong checksums.

MFC after:	1 day
2006-07-18 00:07:05 +00:00
Olivier Houchard
9488796360 If we can't defrag a packet, re-queue it instead of dropping it. 2006-07-17 21:36:08 +00:00
Olivier Houchard
0769e20256 #if => #ifdef 2006-07-17 21:20:00 +00:00
Olivier Houchard
5fdfd0f9fc at91_spi won't compile without spibus, so add it. 2006-07-17 21:17:20 +00:00
Olivier Houchard
dcbed85b6e Oops bring back code that shouldn't have been removed by the previous
commit.
2006-07-15 23:15:31 +00:00
Olivier Houchard
ac6eccb3ec Make sure that if uma_small_alloc() gets called recursively, we just give up
and call kmem_malloc(), to avoid a deadlock.
2006-07-15 23:01:54 +00:00
Olivier Houchard
22e1aadef7 Add a comment explaining why the OHCI mapping has been commented out. 2006-07-15 00:09:53 +00:00
Warner Losh
8397a1b15c MFp4: this now depends on new spi bus stuff 2006-07-14 22:41:54 +00:00
Warner Losh
382ff28ef2 MFp4: tweaks 2006-07-14 22:40:24 +00:00
Warner Losh
2b85629b2f MFp4: elevate quality of slow clock a little 2006-07-14 22:31:12 +00:00
Warner Losh
872a109182 MFp4: paren police 2006-07-14 22:30:44 +00:00
Warner Losh
546bbbb56f MFp4:
Introduce framework to configure the multiplexed pins on boot.

	Since the USART supprots RS-485 multidrop mode, it allows the
	TX pins to float.  However, for RS-232 operations, we don't
	want these pins to float.  Instead, they should be pulled up
	to avoid mismatches.  Linux does something similar when it
	configures the TX lines.  This implies that we also allow the
	RX lines to float rather than be in the state they are left in
	by the boot loader.  Since they are input pins, I think that
	this is the right thing to do.

	Plus minor for our board.
2006-07-14 22:22:57 +00:00
Warner Losh
fa543fe2fa MFp4:
Fix typo in RTC_CALR_MK.
2006-07-14 22:06:01 +00:00
Warner Losh
92c23aea4a The TSC board uses a 16MHz base clock for the AT91RM9200, while the Kwikbyte
board uses a 10MHz base clock.  Cope with this difference.
2006-07-14 22:01:51 +00:00
Warner Losh
375906f555 Implement the set_time function. Rather pointless with this RTC, as it
resets when the core resets, but there may be some use for it...
2006-07-14 21:37:19 +00:00
Warner Losh
21caaf799a MF p4:
Adapt to forthcoming spi framework.  The ioctls for SPI commands and such
belong in the higher level driver.
2006-07-14 21:35:59 +00:00
Warner Losh
567314271b Be sure to flush the cache after a partial read on timeout. Expand
comments about timeouts.  Fix a style nit.  Sometimes small messages
were getting corrupted.
2006-07-14 21:33:04 +00:00
Warner Losh
7d73db6491 Move some of the common parameters into the std. files for this platform.
Also migrate from MD disk to NFS boot.
2006-07-14 15:20:31 +00:00
Olivier Houchard
3fffb1631a Remove prototype for the undefined function counterhandler().
Submitted by:	kevlo
2006-07-14 13:37:47 +00:00
Olivier Houchard
be050429a3 Add remote GDB bits for arm. 2006-07-14 00:50:51 +00:00
John Baldwin
19e9205a23 Simplify the pager support in DDB. Allowing different db commands to
install custom pager functions didn't actually happen in practice (they
all just used the simple pager and passed in a local quit pointer).  So,
just hardcode the simple pager as the only pager and make it set a global
db_pager_quit flag that db commands can check when the user hits 'q' (or a
suitable variant) at the pager prompt.  Also, now that it's easy to do so,
enable paging by default for all ddb commands.  Any command that wishes to
honor the quit flag can do so by checking db_pager_quit.  Note that the
pager can also be effectively disabled by setting $lines to 0.

Other fixes:
- 'show idt' on i386 and pc98 now actually checks the quit flag and
  terminates early.
- 'show intr' now actually checks the quit flag and terminates early.
2006-07-12 21:22:44 +00:00
Olivier Houchard
8f395fae42 Comment out the mapping of the OHCI controller registers va == pa. This
address is in the userland address space. The proper thing is either to choose
a virtual address in the kernel address space beyond the KVA, or to use
pmap_mapdev().
2006-07-12 00:48:50 +00:00
Olivier Houchard
8f68b4a607 Add a new flag to pmap_enter_locked() to say if it's OK to wait. If it is, and
we're unable to allocate the memory for a PTE, we'll wait until we can. If not,
we'll just return.
Use M_NOWAIT|M_USE_RESERVE to allocate PTEs, it is less aggressive than
M_NOWAIT alone.

Suggested by:   alc
2006-07-11 11:22:06 +00:00
Warner Losh
7fd083a540 Add support for configuring pins to be one of {GPIO, PERIPHERAL A or
PERIPHERAL B}, as well as direction of GPIO pin.  Add defines for all
the pins.
2006-07-02 03:50:44 +00:00
Warner Losh
d8927f1396 MFp4:
Make serial ports more robust and reliable.  Make non-console ports
work.  This might have broken skyeye stuff.

o Introduce ping-pong receive buffers.
o Use DMA to copy characters directly into memory.
o Support baud rates other than 115200
o Use 1 stop bit when 1 stop bit is requested (otherwise 2 were used,
  which caused dropped characters when received in bursts).
o Use 1.5 stop bits for 5-bit bytes, and 2 stop bits otherwise when 2
  stop bits were requested.
o Actually update line parameters.
o Fix comments
o Move init into attach
o Tweaks to TX interrupt registers to get them reliable and non-storming.
o harvest data in ipend since the latency between it and the callback
  was too long.  This likely is how it should be, I don't know why I deferred
  things to the callback before.
o disable all interrupts in console init.  We don't want interrupts until
  we turn on an ISR.
o cosmetic tweaks
o Automatically detect of the TIMEOUT interrupt is supported.  If so, use
  it so we get better CPU utilization.  Otherwise do a character at a time
  RX.  Good news here is that it seems we have enough CPU and low enough
  fast interrupt latency to do this reliably.
o Don't read USART_CR.  It is a write-only register.
o start to implement bus_ioctl.  Do BAUD now...
2006-07-02 03:45:33 +00:00
Olivier Houchard
39a0c069fa Backout previous commit, Warner committed at91_pio.c... 2006-06-23 23:07:11 +00:00
Olivier Houchard
9effaba942 There's no need to allocate that much phdr/shdr from the stack. 2006-06-23 22:45:35 +00:00
Olivier Houchard
211d1ec5a8 Add the arm9_setup() prototype. 2006-06-23 22:37:15 +00:00
Olivier Houchard
e45fb59abe Comment out at91_pio.c, it's not in CVS. 2006-06-23 22:30:55 +00:00
Olivier Houchard
f8910b42c8 arm9_setup() is now needed even if we're not using a gzipped kernel, so move
it outside the #ifdef KZIP

Pointy Hat to:	cognet
2006-06-22 22:33:21 +00:00
Warner Losh
a64011a08b Nitsville: the routine is called initarm, not init_arm, correct it in
a comment.
2006-06-21 23:47:25 +00:00
Olivier Houchard
d0a6d18d1a Don't forget to define uart_sa1110_vaddr.
Submitted by:	kevlo
2006-06-21 10:56:59 +00:00
Warner Losh
c0386612b8 Compute physmem so we can print it correctly on boot.
Slightly optimize while I'm here.
2006-06-20 23:40:04 +00:00
Warner Losh
57dc2664ef Probe the memory size of the board better. Look at the bus width,
number of banks, rows and columns the SDRAMC is programmed to access
to determine the RAM size for the board, rather than hard-wiring it to
be 32MB.  My company's board with 64MB now probes correctly, as does
the KB9202 with only 32MB.  This means that to detect the right memory
size, our boot loader must correctly initialize these values.  This is
a fairly safe assumption because the boot loader has to initialize
SDRAM already, and it isn't really possible to change this register
after we've accessed SDRAM.
2006-06-20 20:13:40 +00:00
Olivier Houchard
08459723d8 Make sure the stack is properly aligned.
Enable the MMU when relocating as well, and use write-through cache.
2006-06-18 22:46:30 +00:00
Warner Losh
a1295da1fd comment out twi for now: no iicbus in KB920X: it breaks booting 2006-06-17 23:34:59 +00:00
Warner Losh
aee1351504 Carefully note the RMII bit in the config register at attach time.
The boot loader is supposed to leave this bit set to the right value
for the board.  If this bit was set at attach time, use it to init the
config register correctly.

Note: this means the boot loader has to properly initialize it.
2006-06-17 23:24:35 +00:00
Warner Losh
0ca5ce8fee improve reporting of clocks 2006-06-17 23:22:10 +00:00
Alexander Leidinger
28a3ae7f88 Remove COMPAT_43 from GENERIC (and other kernel configs). For amd64 there's
an explicit comment that it's needed for the linuxolator. This is not the
case anymore. For all other architectures there was only a "KEEP THIS".
I'm (and other people too) running a COMPAT_43-less kernel since it's not
necessary anymore for the linuxolator. Roman is running such a kernel for a
for longer time. No problems so far. And I doubt other (newer than ia32
or alpha) architectures really depend on it.

This may result in a small performance increase for some workloads.

If the removal of COMPAT_43 results in a not working program, please
recompile it and all dependencies and try again before reporting a
problem.

The only place where COMPAT_43 is needed (as in: does not compile without
it) is in the (outdated/not usable since too old) svr4 code.

Note: this does not remove the COMPAT_43TTY option.

Nagging by:	rdivacky
2006-06-15 19:58:53 +00:00
Stephan Uphoff
2053c12705 Remove mpte optimization from pmap_enter_quick().
There is a race with the current locking scheme and removing
it should have no measurable performance impact.
This fixes page faults leading to panics in pmap_enter_quick_locked()
on amd64/i386.

Reviewed by: alc,jhb,peter,ps
2006-06-15 01:01:06 +00:00
Olivier Houchard
ee8ecea34b MFp4:
- Try hard to calculate a safe sp, so that the stack doesn't get smashed
while uncompressing or relocating the kernel.
- Bring in code needed to calculate the cacheline size etc, needed for
arm9_idcache_wbinv_all.
2006-06-12 22:58:50 +00:00
Olivier Houchard
9464ffd0a4 MFp4: Increase the L1 pagetable needed for the kernel from 8 to 22, to be
able to boot fat kernels.
2006-06-12 22:57:24 +00:00
Alan Cox
fd5cb69756 Remove pmap_pagedaemon_waken and update pmap_get_pv_entry() to match the
current interface with the machine-independent layer.  Without this change,
the page daemon would only have been awakened the first time that the
number of pv entries went above the high water mark, not each time.
2006-06-11 04:53:06 +00:00
Alan Cox
2087cafb70 Eliminate spl calls. 2006-06-11 04:14:36 +00:00
Alan Cox
8bf9b9233d Add a lock assertion. Remove dead (locking) code. Change some white
space.

Reviewed by: cognet@
2006-06-10 05:20:18 +00:00
Alan Cox
24ea27ad1a Add pmap locking to pmap_extract().
Tested by: cognet@
2006-06-09 03:54:20 +00:00
Olivier Houchard
2d0105632f Oops it seems I forgot to remove ARM32_NEW_VM_LAYOUT from here. 2006-06-07 22:41:14 +00:00
Alan Cox
f6ed7d306b Add pmap locking to pmap_fault_fixup().
Add an assertion to pmap_vac_me_harder().

Tested by: cognet@
2006-06-07 20:54:31 +00:00
Alan Cox
7a5f63430e Properly synchronize access to the pmap in pmap_extract_and_hold().
Eliminate an unneeded variable from pmap_extract_and_hold().

Tested by: cognet@
2006-06-07 17:14:48 +00:00
Olivier Houchard
c1bfc47fa7 Now that we use pmap_mapdev_boostrap(), we can get ride of the got_mmu
hack.

Submitted by:	kevlo
2006-06-07 11:28:17 +00:00
Warner Losh
3dcdad9a11 Remove sa1_cache_clean_addr. It isn't needed.
Submitted by: kevlo
2006-06-07 05:36:10 +00:00
Olivier Houchard
d661dc8070 Convert the last offender, the SA1110 port, to ARM32_NEW_VM_LAYOUT, and
completely nuke the !ARM32_NEW_VM_LAYOUT case.
2006-06-06 21:06:57 +00:00
Olivier Houchard
410a42a1b6 Remove a bogus, useless, "i++". 2006-06-06 20:47:59 +00:00
Alan Cox
d39d8f0f8c Add partial pmap locking.
Tested by: cognet@
2006-06-06 17:27:53 +00:00
Alan Cox
ed48a217f6 Add partial pmap locking.
Eliminate the unused allpmaps list.

Tested by: cognet@
2006-06-06 04:32:20 +00:00
Olivier Houchard
f14c3a8aac Make VERBOSE_INIT_ARM compile by fixing various printf formats, and add it
as an option.

Submitted by:   Max N. Boyarov <m.boyarov at bsd dot by>
2006-06-06 01:14:12 +00:00
Olivier Houchard
ceff114886 vm_page_alloc_contig() can sleep, so don't even think about using it
in the M_NOWAIT case.
2006-06-05 23:42:47 +00:00
Alan Cox
ce142d9ec0 Introduce the function pmap_enter_object(). It maps a sequence of resident
pages from the same object.  Use it in vm_map_pmap_enter() to reduce the
locking overhead of premapping objects.

Reviewed by: tegge@
2006-06-05 20:35:27 +00:00
Olivier Houchard
b2adc703fd Don't #error if no CPU is defined but we're not compiling the kernel. 2006-06-02 09:39:06 +00:00
Olivier Houchard
27b45ae819 Don't enable the FIQ in enable_interrupts() if F32_bit is not specified.
This has been committed by mistake.

Reported by:	ssouhlal
2006-06-01 16:17:44 +00:00
Alan Cox
d49e4d3f55 Introduce pmap_enter_locked() and use it to reimplement pmap_enter_quick().
Tested by: cognet@
2006-06-01 01:31:07 +00:00
Olivier Houchard
c7f17eb45c Avoid a LOR by unlocking the vm_page_queue_mtx before calling uma_zalloc,
and freeing the allocated memory if another thread already did the same.
2006-05-31 15:52:11 +00:00
Olivier Houchard
4cd3385ee3 If our buffer is not aligned on the cache line size, write back/invalidate
the first and last cache line in PREREAD, and just invalidate the cache
lines in POSTREAD, instead of write-back/invalidating in POSTREAD, which
could lead to stale data overriding what has been transfered by DMA.
2006-05-31 15:50:33 +00:00
Olivier Houchard
c712f1ef5b Ooops arm10 is armv5, not armv4.
Submitted by:	kevlo
2006-05-31 13:06:08 +00:00
Olivier Houchard
87adbb81cc Include machine/cpuconf.h in pmap.h in order to get ARM_NMMUS defined,
to appease -Wundef.
2006-05-31 11:57:37 +00:00
Olivier Houchard
1dbb640331 Protect the mapping used for pmap_copy_page/pmap_zero_page with a
mutex.
2006-05-30 23:50:45 +00:00
Olivier Houchard
b64b87c8bd To avoid problems, invalidate the data cache and disable the MMU once
we're done uncompressing the kernel.
2006-05-30 21:13:47 +00:00
Olivier Houchard
51036d9b71 In pmap_is_prefaultable(), assert that the pte isn't NULL if
pmap_get_pde_pte() returns TRUE.

Suggested by:   ssouhlal
2006-05-30 16:55:38 +00:00
Olivier Houchard
29d1651fc5 The Assabet has 32MB of RAM, not 16.
Submitted by:	kevlo
2006-05-30 15:47:55 +00:00
Benno Rice
1108c31908 In pmap_mapdev we correctly round the address off to the nearest page
boundary, but we must also add the offset back on to the va we return.
2006-05-30 14:21:09 +00:00
Olivier Houchard
ec4c4a14f5 Uncomment the call to cpu_idcache_wbinv_all() after the MMU has been
enabled. It has been commented out for a reason I forgot but I suspect
does not apply anymore.
Technically speaking it's not required to do it, has the data and the
instruction cache have been disabled in _start(). However, it may change
in the future, so I don't want to rely on this behavior.

Submitted by:	kevlo
2006-05-30 11:51:58 +00:00
Olivier Houchard
e1f01b09a6 Nuke sa11x0_attach_args. It's a NetBSDIsm, and we have no use for it.
Submitted by:	kevlo
2006-05-29 19:32:32 +00:00
Olivier Houchard
c212f0efe9 Remove any reference to enable_mmu(), it's been gone for a long time.
Submitted by:	kevlo
2006-05-26 01:41:47 +00:00
Olivier Houchard
fb350a0d6a Use pmap_devmap_bootstrap(), instead of mapping the SACOM1 registers
with pmap_map_entry.
More use of macros instead of hardcoding the addr.

Submitted by:	kevlo
2006-05-23 12:14:14 +00:00
Olivier Houchard
9c8c02e7a0 Use macros instead of hardcoding the address for SACOM1. Also don't
pretend we're working with SACOM3, as we're really mapping SACOM1.

Submitted by:   kevlo
2006-05-22 23:25:34 +00:00
Olivier Houchard
d3e6e0e6f6 We have an implementation of generic_bs_rr_1, so use it, as some drivers use
it.

Submitted by:	kevlo
2006-05-19 11:27:02 +00:00
Olivier Houchard
c166cceecc Comment out SYSCTL_OMIT_DESCR until it's committed. 2006-05-19 00:11:21 +00:00
Olivier Houchard
ac895519de Implement sa11x0_bs_unmap.
Submitted by:	kevlo
2006-05-18 22:03:47 +00:00
Olivier Houchard
b012edd4ed Make this compile (UART_IPEND_* => SER_INT_*). 2006-05-18 22:02:33 +00:00
Olivier Houchard
ec21307611 Add definitions for atomic_subtract_rel_32, atomic_add_rel_32 and
atomic_load_acq_32, needed for hwpmc.
2006-05-15 13:08:12 +00:00
Benno Rice
0b6d552a34 Display real/avail memory as per other platforms.
Approved by:	cognet
2006-05-15 10:40:37 +00:00
Olivier Houchard
ef4d5877dd Switch to a 64bit time_t, while it's not a big problem to do so.
Suggested by:	imp
2006-05-15 00:17:27 +00:00
Olivier Houchard
d5d776c16b Resurrect Skyeye support :
Add a new option, SKYEYE_WORKAROUNDS, which as the name suggests adds
workarounds for things skyeye doesn't simulate. Specifically :
- Use USART0 instead of DBGU as the console, make it not use DMA, and           manually provoke an interrupt when we're done in the transmit function.
- Skyeye maintains an internal counter for clock, but apparently there's
no way to access it, so hack the timecounter code to return a value which
is increased at every clock interrupts. This is gross, but I didn't find a
better way to implement timecounters without hacking Skyeye to get the
counter value.
- Force the write-back of PTEs once we're done writing them, even if they
are supposed to be write-through. I don't know why I have to do that.
2006-05-13 23:41:16 +00:00
Warner Losh
9c5b312952 Tidy up a bit... 2006-05-13 02:47:39 +00:00
Poul-Henning Kamp
5405ab4889 Clean out sysctl machdep.* related defines.
The cmos clock related stuff should really be in MI code.
2006-05-11 17:29:25 +00:00
Olivier Houchard
053105371f Get this to compile :
- The prototype of uart_bus_probe() hasn't been changed in cvs yet, so use the
old one.
- Add at91_pdcreg.h, needed by uart_dev_at91usart.c.
2006-05-11 14:30:28 +00:00
Olivier Houchard
04091343f6 Move the call to cpu_setup() before the call to vm_ksubmap_init().
vm_ksubmap_init() calls pmap_copy_page(), which uses the mini data cache
to do the copy, but we're running uncaching before cpu_setup().
For some reason it hasn't been a problem so far, but it is for the
PXA255.

Spotted out by: benno
2006-05-10 13:39:10 +00:00
Olivier Houchard
4687ab54e3 Setting the rid of the resource is a good idea, but we still need to return
the resource after.
2006-05-05 19:14:57 +00:00
Olivier Houchard
477d836c4d MFother arches :
date: 2006/04/12 04:22:50;  author: alc;  state: Exp;  lines: +14 -41
Retire pmap_track_modified().  We no longer need it because we do not
create managed mappings within the clean submap.  To prevent regressions,
add assertions blocking the creation of managed mappings within the clean
submap.

Reviewed by: tegge
2006-04-22 22:51:32 +00:00
Warner Losh
018dc558f6 When returning a resource that we've allocated with rman_reserve_resource,
go ahead and set the rid for that resource.
2006-04-20 04:12:02 +00:00
Olivier Houchard
eb66942114 We need to adjust the bus handle if the resource is SYS_RES_MEMORY, NOT
SYS_RES_IOPORT.
2006-04-13 15:07:59 +00:00
Olivier Houchard
b8986f5675 Disable/enable fiqs as well as irqs. 2006-04-13 14:25:28 +00:00
Olivier Houchard
123a5345c1 MFp4: Use CPU_CONTROL_ROUNDROBIN for arm9, it seems to give marginally
better performances.
2006-04-09 23:07:31 +00:00
Olivier Houchard
43293c6937 Not only disable/enable interrupts, do it for FIQs as well, when needed. 2006-04-09 20:16:47 +00:00
Olivier Houchard
174329aff2 MFp4: Don't write-back the PTEs if they are mapped write-through, this was
apparently only needed because skyeye has bugs in its cache emulation.
2006-04-09 20:03:03 +00:00
Olivier Houchard
602c85541e MFp4: Catchup with recent UART changes. 2006-04-06 20:47:54 +00:00
Olivier Houchard
1ac232117c Add a new option, XSCALE_DISABLE_CCNT, to not use the xscale ccnt as a
timecounter (because gxemul doesn't emule it yet).
2006-04-06 17:11:08 +00:00
Warner Losh
5ec7256cb1 Add debug writes in error cases that, in theory, should never happen 2006-04-06 04:32:29 +00:00
Warner Losh
723c740a55 Connect twi to the FreeBSD iicbus infrastructure. 2006-04-06 04:31:19 +00:00
Warner Losh
222c969f16 Pull in numerous fixes from myself and cognet. With these fixes the
KB9202 eval board is finally stable with a nfs root.
2006-04-06 04:30:23 +00:00
Warner Losh
f535b19502 Remove unused bit definitions.
Minor style cleanup while I'm here.
2006-04-06 04:29:24 +00:00
Warner Losh
b2e16e9338 Optimize the TX side of the part by using the PDC to move bytes out to
the wire.  This increases the speed considerably.  Start to put
infrastructure in place to do RX side, but that requires more study
before it can be done.
2006-04-06 04:27:19 +00:00
Peter Wemm
b9eee07e36 Remove the unused sva and eva arguments from pmap_remove_pages(). 2006-04-03 21:16:10 +00:00
Olivier Houchard
ac2bfec884 Implement pmap_object_init_pt() the way it is on sparc64/alpha, by doing
nothing except asserting the vm object is locked, and a device object,
instead of a useless printf.
2006-03-26 22:03:43 +00:00
Warner Losh
e40dc9a60d Skeleton support for the SSC device, which implements I2S interfaces,
amoung others.
2006-03-24 07:42:33 +00:00
Warner Losh
60a5289836 Skeleton PIO support. 2006-03-24 07:39:29 +00:00
Warner Losh
c44fe487c2 Add the sekelton of support for the Power Management Controller. 2006-03-24 07:37:56 +00:00
Warner Losh
72ec44a573 Add rtc to files.at91 2006-03-24 07:36:23 +00:00
Warner Losh
74e4c374f2 Add RTC support. This may be of dubious value since the RTC is reset
to 1998 every reboot.
2006-03-24 07:35:30 +00:00
Olivier Houchard
5207a211b3 MFp4: Don't force single-user now we can go multi-user.
Call cninit() only after the pagetable has been set, as locore.S won't
map the system device for us anymore.
2006-03-22 22:31:31 +00:00
Olivier Houchard
e9f654ba90 MFp4: More special casing of when vector_page == 0x00000000 :
catch attempts to write to vector_page earlier in pmap_fault_fixup(),
and deny it.
2006-03-22 22:11:10 +00:00
Olivier Houchard
6f4640d092 MFp4: If we're mapping the vector page (this will happen if we didn't
relocate it), do not attempt to call pmap_vac_me_harder() on the page.
At this point m will be NULL, and we know we won't have any cache
issues with this page.
2006-03-22 21:23:27 +00:00
Olivier Houchard
a1de0396bd MFp4: teach the KB920x bits how to know where the ELF trampoline puts the
strtab and the symtab.
2006-03-22 21:16:51 +00:00
Olivier Houchard
eea877f42d MFp4: Handle break interrupts (it seems to only work for USART, not DBGU). 2006-03-22 21:16:09 +00:00
Warner Losh
36dd3fdf9e MFp4:
Add bus attachment for the ohci device on this chip.  The bus and hub
are detected correctly, but the children devices aren't detected
correctly for reasons unknown.
2006-03-18 01:45:29 +00:00
Warner Losh
1b0561a15d Add ohci controller mapping. 2006-03-18 01:43:54 +00:00
Warner Losh
2dc738a640 MFp4:
o update TODO list
o Better use of busdma
o mark RX dtors as COHERENT.  This helps performance a lot by not requiring
  so many EXPENSIVE cache flushes.  The cost of accessing it non-cached
  is much smaller.
o Copy data from Rx buffers to make IP header 4 byte aligned.
o CRC length included in reported length, so cope
o Don't free TX buffer twice
o Manage TX buffers better.
o Enable just the interrupts we want.
o Manage OACTIVE better

# Some of these done by cognet
# These changes let us get to # via NFS root.
2006-03-18 01:43:25 +00:00
Warner Losh
a9e7d93f31 MFP4:
Gratuitously sort alphabetically.
2006-03-18 01:39:23 +00:00
Warner Losh
f54a134552 MFP4:
GC and fix definitions.

# some of this may have been done by cognet
2006-03-18 01:38:25 +00:00
Warner Losh
f3de38a73d MFp4:
o Add memory barrier to bus space
o Allow for up to 3 IRQs per device
o Move to table driven population of children devices.
o Add support for usb ohci memory mapped controller resource allocation.
o Clean up a bunch of extra writes to disable interrupts that are now
  done elsewhere.
o Force all system interrupt handlers be fast.  We get deadlock if they
  aren't.
2006-03-18 01:35:49 +00:00
Warner Losh
5bcedfaa73 MFp4:
o Disable all interrupts that the ST can generate until we have an ISR
  to service them.
o Correct clock calculation to make DELAY the right length...

Submitted by: cognet (#2)
2006-03-18 01:30:31 +00:00
Olivier Houchard
c0e239dead MFp4: Forget the asm inlined version of in_cksum_hdr(). It doesn't work if
the pointer is unaligned, and it just doesn't worth it.
2006-03-09 23:33:59 +00:00
Olivier Houchard
5adfa73930 Use BUS_DMA_COHERENT. 2006-03-02 14:06:38 +00:00
Olivier Houchard
db45b073f7 Use 8 * sizeof(int) instead of hardcoding 32, for the unlikely case this
code ever get used on a plateform where sizeof(int) != 4.

Suggested by:	jmg
2006-03-02 00:37:40 +00:00
Olivier Houchard
2456c0ea88 Try to honor BUS_DMA_COHERENT : if the flag is set, normally allocate memory
with malloc() or contigmalloc() as usual, but try to re-map the allocated
memory into a VA outside the KVA, non-cached, thus making the calls to
bus_dmamap_sync() for these buffers useless.
2006-03-01 23:04:25 +00:00
Olivier Houchard
4cb8778630 Use a better panic message than lol. 2006-03-01 20:43:51 +00:00
Olivier Houchard
12ce8511ba Make sure we decrement p_lock before leaving prefetch_abort_handler() 2006-03-01 20:42:47 +00:00
Olivier Houchard
c2d5c96b29 userret() now only takes 2 parameters. 2006-03-01 18:33:45 +00:00
Olivier Houchard
493be2ca17 Get this to compile with the recent UART changes. 2006-02-27 23:19:13 +00:00
John Baldwin
06ad42b2f7 Close some races between procfs/ptrace and exit(2):
- Reorder the events in exit(2) slightly so that we trigger the S_EXIT
  stop event earlier.  After we have signalled that, we set P_WEXIT and
  then wait for any processes with a hold on the vmspace via PHOLD to
  release it.  PHOLD now KASSERT()'s that P_WEXIT is clear when it is
  invoked, and PRELE now does a wakeup if P_WEXIT is set and p_lock drops
  to zero.
- Change proc_rwmem() to require that the processing read from has its
  vmspace held via PHOLD by the caller and get rid of all the junk to
  screw around with the vmspace reference count as we no longer need it.
- In ptrace() and pseudofs(), treat a process with P_WEXIT set as if it
  doesn't exist.
- Only do one PHOLD in kern_ptrace() now, and do it earlier so it covers
  FIX_SSTEP() (since on alpha at least this can end up calling proc_rwmem()
  to clear an earlier single-step simualted via a breakpoint).  We only
  do one to avoid races.  Also, by making the EINVAL error for unknown
  requests be part of the default: case in the switch, the various
  switch cases can now just break out to return which removes a _lot_ of
  duplicated PRELE and proc unlocks, etc.  Also, it fixes at least one bug
  where a LWP ptrace command could return EINVAL with the proc lock still
  held.
- Changed the locking for ptrace_single_step(), ptrace_set_pc(), and
  ptrace_clear_single_step() to always be called with the proc lock
  held (it was a mixed bag previously).  Alpha and arm have to drop
  the lock while the mess around with breakpoints, but other archs
  avoid extra lock release/acquires in ptrace().  I did have to fix a
  couple of other consumers in kern_kse and a few other places to
  hold the proc lock and PHOLD.

Tested by:	ps (1 mostly, but some bits of 2-4 as well)
MFC after:	1 week
2006-02-22 18:57:50 +00:00
Warner Losh
2f415ac34d These files apply to all the atmel parts that freebsd is going to run on,
so name them more generically.  If we do support the MMU-less ARM7 parts,
then we'll need to, at that time, expand the files we have.
2006-02-17 22:33:13 +00:00
Warner Losh
77017e63bb This file was obsolete when committed. Catchup and delete it. 2006-02-17 22:23:36 +00:00
Warner Losh
e1fa2d9556 Use the correct address for the ohci device. 2006-02-11 03:58:07 +00:00
Poul-Henning Kamp
eb2da9a51f Simplify system time accounting for profiling.
Rename struct thread's td_sticks to td_pticks, we will need the
other name for more appropriately named use shortly.  Reduce it
from uint64_t to u_int.

Clear td_pticks whenever we enter the kernel instead of recording
its value as reference for userret().  Use the absolute value of
td->pticks in userret() and eliminate third argument.
2006-02-08 08:09:17 +00:00
Olivier Houchard
e56b7f20a0 Set the MAC address after we just read it at attach time, as it seems needed. 2006-02-07 21:31:13 +00:00
Olivier Houchard
9bfe35c80d Set m_pkthdr.len and m_pkthdr.rcvif. 2006-02-07 20:48:52 +00:00
Warner Losh
37a395c110 This file isn't GENERIC, so change the header 2006-02-07 18:45:54 +00:00
Warner Losh
e51680a229 Rather than pull in all the phy, just pull in the lxt phy that we need
for this board (although our lxtphy driver isn't claiming it, but that's
a different problem).

This saves 57k in this kernel.
2006-02-07 18:43:46 +00:00
Olivier Houchard
ea9f99ddcd - Call mii_phy_probe() after we allocated an ifp. mii has this evil
hack where it assumes the first field of the driver softc is the struct
ifnet, and it copies its value in mii_phy_probe().
- In the interrupt handler, set the mbuf m_len field on packet receive.
2006-02-06 22:17:42 +00:00
Olivier Houchard
123f34932c Use memory clobbers, to be on the safe side.
Suggested by:	jhb
2006-02-06 18:29:05 +00:00
Olivier Houchard
697e7cb715 Backout rev 1.12. It would have been a good thing, if gcc was smart enough
not to generate bad code.
2006-02-05 22:06:12 +00:00
Warner Losh
1248f2322b Import support for the Atmel AT91RM9200 CPU/Microcontroller. This SoC
is a ARM920T based CPU with a bunch of built-in peripherals.  The
inital import supports the SPI bus, the TWI bus (although iicbus
integration is not complete), the uarts, the system timer and the
onboard ethernet.  Support for the Kwikbyte KB9202
(http://www.kwikbyte.com) board is also included, although there's no
reason why the 9200 and the 9201 wouldn't also work.  Primitive
support for running under the skyeye emulator is also provided
(although skyeye's support for the AT91RM9200 is a little weak).

The code has been structured so that other members of Atmel's arm family can
be supported in the future.  The AT91SAM9260 is not presently supported
due to lack of hardware.  The arm7tdmi families are also not supported
becasue they lack an MMU.

Many thanks to cognet@ for his help and assistance in bringing up this
board.  He did much of the vm work and wrote parts of the uart and
system timer code as well as the bus space implementation.

The system boots to single user w/o problem, although the serial
console is a little slow and the ethernet driver is still in flux.

This work was sponsored by Timing Solutions, Corporation.  I am
grateful to their support of the FreeBSD project in this manner.
2006-02-04 23:32:13 +00:00
Olivier Houchard
0cc56a19e1 Don't forget to set the address of the next descriptor to 0 when we're
zeroing a physical page, or we could end up re-zeroing portions of
memory we have zeroed before, which is clearly not wanted.
2006-02-04 18:01:15 +00:00
Olivier Houchard
19d5d0da40 MFi386:
revision 1.288
date: 2006/02/04 14:11:33;  author: wsalamon;  state: Exp;  lines: +4 -1
Hook up the audit system to system call entry and exit. System calls will
now be audited.

Obtained from:  TrustedBSD Project
Approved by: rwatson (mentor)
2006-02-04 17:01:19 +00:00
Warner Losh
d0e50224e8 MFp4: Small cleanup of cpu messages at boot. 2006-02-03 06:39:57 +00:00
Warner Losh
f037afb7ea Merge from p4: minor formatting nits. 2006-02-03 06:27:51 +00:00
Olivier Houchard
eeac0e83b3 Try harder not to recurse. 2006-01-27 21:07:04 +00:00
Olivier Houchard
2eff8c6814 Donc recompute the io port address if it's already the good one. 2006-01-23 14:03:14 +00:00
Olivier Houchard
0e187240e1 Build a minimal pagetables, with only section mappings, mapped write through,
to speed up the decompression.
2006-01-20 00:46:44 +00:00
Warner Losh
d5e61c97a6 By popular demand, move __HAVE_ACPI and __PCI_REROUTE_INTERRUPT into
param.h.  Per request, I've placed these just after the
_NO_NAMESPACE_POLLUTION ifndef.  I've not renamed anything yet, but
may since we don't need the __.

Submitted by: bde, jhb, scottl, many others.
2006-01-09 06:05:57 +00:00
John Baldwin
360c3c2d1a Fix various places that were testing td_critnest to see if interrupts
should remain disabled during a trap or not to check
td_md.md_spinlock_count instead.
2006-01-06 18:02:12 +00:00
Warner Losh
501755f4f6 Define __HAVE_ACPI and/or __PCI_REROUTE_INTERRUPT, as appropriate for
each platform.  These will be used in the pci code in preference to
the complicated #ifdefs we have there now.
2006-01-01 20:59:28 +00:00
Alexander Leidinger
ef39c05baa MI changes:
- provide an interface (macros) to the page coloring part of the VM system,
   this allows to try different coloring algorithms without the need to
   touch every file [1]
 - make the page queue tuning values readable: sysctl vm.stats.pagequeue
 - autotuning of the page coloring values based upon the cache size instead
   of options in the kernel config (disabling of the page coloring as a
   kernel option is still possible)

MD changes:
 - detection of the cache size: only IA32 and AMD64 (untested) contains
   cache size detection code, every other arch just comes with a dummy
   function (this results in the use of default values like it was the
   case without the autotuning of the page coloring)
 - print some more info on Intel CPU's (like we do on AMD and Transmeta
   CPU's)

Note to AMD owners (IA32 and AMD64): please run "sysctl vm.stats.pagequeue"
and report if the cache* values are zero (= bug in the cache detection code)
or not.

Based upon work by:	Chad David <davidc@acns.ab.ca> [1]
Reviewed by:		alc, arch (in 2004)
Discussed with:		alc, Chad David, arch (in 2004)
2005-12-31 14:39:20 +00:00
Maxim Sobolev
900b28f9f6 Remove kern.elf32.can_exec_dyn sysctl. Instead extend Brandinfo structure
with flags bitfield and set BI_CAN_EXEC_DYN flag for all brands that usually
allow executing elf dynamic binaries (aka shared libraries). When it is
requested to execute ET_DYN elf image check if this flag is on after we
know the elf brand allowing execution if so.

PR:		kern/87615
Submitted by:	Marcin Koziej <creep@desk.pl>
2005-12-26 21:23:57 +00:00
John Baldwin
b439e431bf Tweak how the MD code calls the fooclock() methods some. Instead of
passing a pointer to an opaque clockframe structure and requiring the
MD code to supply CLKF_FOO() macros to extract needed values out of the
opaque structure, just pass the needed values directly.  In practice this
means passing the pair (usermode, pc) to hardclock() and profclock() and
passing the boolean (usermode) to hardclock_cpu() and hardclock_process().
Other details:
- Axe clockframe and CLKF_FOO() macros on all architectures.  Basically,
  all the archs were taking a trapframe and converting it into a clockframe
  one way or another.  Now they can just extract the PC and usermode values
  directly out of the trapframe and pass it to fooclock().
- Renamed hardclock_process() to hardclock_cpu() as the latter is more
  accurate.
- On Alpha, we now run profclock() at hz (profhz == hz) rather than at
  the slower stathz.
- On Alpha, for the TurboLaser machines that don't have an 8254
  timecounter, call hardclock() directly.  This removes an extra
  conditional check from every clock interrupt on Alpha on the BSP.
  There is probably room for even further pruning here by changing Alpha
  to use the simplified timecounter we use on x86 with the lapic timer
  since we don't get interrupts from the 8254 on Alpha anyway.
- On x86, clkintr() shouldn't ever be called now unless using_lapic_timer
  is false, so add a KASSERT() to that affect and remove a condition
  to slightly optimize the non-lapic case.
- Change prototypeof  arm_handler_execute() so that it's first arg is a
  trapframe pointer rather than a void pointer for clarity.
- Use KCOUNT macro in profclock() to lookup the kernel profiling bucket.

Tested on:	alpha, amd64, arm, i386, ia64, sparc64
Reviewed by:	bde (mostly)
2005-12-22 22:16:09 +00:00