Commit Graph

1063 Commits

Author SHA1 Message Date
Rafal Jaworowski
f4e42148d7 ARM interrupts improvements.
- Fix nexus_setup_intr() abuse of setting up multiple IRQs in one go. Calling
  arm_setup_irqhandler() in loop is bogus, as there's just one cookie given
  from the caller and it is overwritten in each iteration so that only the
  last handler's cookie value prevails.

- Proper intr masking/unmasking handling: the IRQ source is masked at PIC level
  only after the last handler has been removed from the list.

Reviewed by:	cognet, imp, sam, stass
Obtained from:	Grzegorz Bernacki gjb ! semihalf dot com
2008-09-11 12:36:13 +00:00
Rafal Jaworowski
e29b1b389b IXP425: split handling of the two QMGR interrupts so they are separately
managed. Adjust ixpqmgr_{attach,detach} to comply with device_* interface.

Reviewed by:	cognet, imp, sam, stass
Tested by:	cognet
2008-09-11 12:17:21 +00:00
Warner Losh
7217c39672 Commit the no-brainer parts of my space saving kernel experiments. We
don't inline the locking primitives, and only grab those parts of mii
that we really need.  Other space optimizations are too agressive for
the generic file (removing all of usb, and loading it as kernel
modules).
2008-09-08 00:41:32 +00:00
Warner Losh
33b4ae7d79 Minor cleanup of this config file:
o It has been tested only on KB9202, KB9202A and KB9202B boards
o Better comments about hints
o option<space><tab>
o Add newer SX_NOINLINE option.
o Fix a few comments
2008-09-07 18:55:55 +00:00
Warner Losh
8691fc004b Turn some lame pseudo-code into a less lame comment. 2008-09-05 22:30:59 +00:00
Warner Losh
5fdde3724c Kill bogus #if 0'd stuff for interrupts. They don't happen, and this
driver will need more serious help to work with an interrupt driven
path.  There's many subtleties in driving the DMA engine with
interrupts in many configurations.  Best to not "guess" what the right
way would be and mislead people.
2008-09-05 22:29:50 +00:00
Warner Losh
e704206e27 Kill vestiges of the special case code we once had in place for usb
memory allocation.  It was change to include the range in the normal
memory area, so these ifdef'd out special cases are no longer useful
to keep around.
2008-09-05 22:27:10 +00:00
Warner Losh
9df90e6ba5 Kill bogus #if 1. There's no need for it since usb works these days. 2008-09-05 22:23:41 +00:00
Warner Losh
fcce278bf2 Use a locally assigned address rather than stealing Atmel's which
might cause a conflict...
2008-08-31 18:20:01 +00:00
Stanislav Sedov
a0ac6fc0bc - Fix comment.
- Set U/L bit of generated ethernet address to 1 to not
  clash with Atmel assigned addresses.

Suggested by:	yar
Approved by:	kib (mentor)
2008-08-31 09:28:49 +00:00
Stanislav Sedov
0787c9a03f - Try to look for MAC address in all SA registers, not only in the
first one. U-boot, for example, uses the second register to store
  MAC.[1]
- Use random MAC address if none configured instead of failing.

Submitted by:	Bjorn Konig <bkoenig@alpha-tierchen.de> [1]
Reviewed by:	imp
Approved by:	kib (mentor)
MFC after:	1 week
2008-08-30 15:16:40 +00:00
Stanislav Sedov
ae8b75dddb - Style fix.
Approved by:	kib (mentor)
MFC after:	1 week
2008-08-30 15:04:53 +00:00
Warner Losh
5f00fec406 Whitespace nit. 2008-08-23 23:35:08 +00:00
Warner Losh
5385196376 Provide hooks into the GPIO lines and the ability to set/clear
interrupts from them.  This should be more generalized, but is
sufficient for now.

Submitted by:	Hans Petter Selasky
2008-08-19 22:17:14 +00:00
Warner Losh
86f88de002 Use the proper clock domain for the usb host controller.
Submitted by:	Hans Petter Selasky
2008-08-19 22:16:10 +00:00
Warner Losh
5d8e2080ac Add IRQ line for usb device. I'm not 100% sure this is the right
place to add this connection, since the interrupt is for a GPIO pin,
but since we have no alternative at the moment...

Submitted by:	Hans Petter Selasky
2008-08-19 22:15:14 +00:00
John Baldwin
70d12a18f2 Export 'struct pcpu' to userland w/o requiring _KERNEL. A few ports
already define _KERNEL to get to this and I'm about to add hooks to
libkvm to access per-CPU data.

MFC after:	1 week
2008-08-19 19:53:52 +00:00
Bjoern A. Zeeb
603724d3ab Commit step 1 of the vimage project, (network stack)
virtualization work done by Marko Zec (zec@).

This is the first in a series of commits over the course
of the next few weeks.

Mark all uses of global variables to be virtualized
with a V_ prefix.
Use macros to map them back to their global names for
now, so this is a NOP change only.

We hope to have caught at least 85-90% of what is needed
so we do not invalidate a lot of outstanding patches again.

Obtained from:	//depot/projects/vimage-commit2/...
Reviewed by:	brooks, des, ed, mav, julian,
		jamie, kris, rwatson, zec, ...
		(various people I forgot, different versions)
		md5 (with a bit of help)
Sponsored by:	NLnet Foundation, The FreeBSD Foundation
X-MFC after:	never
V_Commit_Message_Reviewed_By:	more people than the patch
2008-08-17 23:27:27 +00:00
John Baldwin
13e3657b7b Add locking to the various iicbus(4) bridge drivers:
- Just grab Giant in the ixp425_iic(4) driver since this driver uses
  a shared address/data register window pair to access the actual
  I2C registers.  None of the other ixp425 drivers lock access to these
  shared address/data registers yet and that would need to be done before
  this could use any meaningful locking.
- Add locking to the interrupt handler and 'iicbus_reset' methods of the
  at91_twi(4) driver.
- Add locking to the pcf(4) driver.  Other pcf(4) fixes include:
  - Don't needlessly zero the softc.
  - Use bus_foo rather than bus_space_foo and remove bus space tag and
    handle from softc.
- The lpbb(4) driver just grabs Giant for now.  This will be refined later
  when ppbus(4) is locked.
- As was done with smbus earlier, move the DRIVER_MODULE() lines to match
  the bus driver (either iicbus or iicbb) to the bridge driver into the
  bridge drivers.

Tested by:	sam (arm/ixp425)
2008-08-04 20:46:15 +00:00
Olivier Houchard
c611e0d78c Do not modify td->td_intr_nesting_level, it is now done in the MI code.
This fixes the cpu time being falsely reported as interrupt time.

MFC after:	3 days
2008-08-04 20:29:39 +00:00
Rafal Jaworowski
1cba14c456 Fix ARM nocache allocator:
- let the loop iterate every page (as intended), and not some multiplies
  (which led to a fake exhaustion of the ARM_NOCACHE_KVA_SIZE)

- eliminate using MIN(): it compared number of pages vs. address
  (ARM_TP_ADDRESS), which was bogus

Reviewed by:	cognet, imp
Obtained from:	Piotr Ziecik kosmo ! semihalf dot com
MFC after:	3 days
2008-08-04 14:47:49 +00:00
Olivier Houchard
cf1f6a4da0 Remove unneeded #include <stdlib.h> (?)
MFC after:	3 days
2008-08-04 14:37:32 +00:00
Olivier Houchard
f0fe5e9127 Add "add pc, whatever" as a branch instruction, we use it in memcpy().
MFC after:	3 days
2008-08-03 15:35:32 +00:00
Ed Schouten
200d80cd74 Disconnect drivers that haven't been ported to MPSAFE TTY yet.
As clearly mentioned on the mailing lists, there is a list of drivers
that have not been ported to the MPSAFE TTY layer yet. Remove them from
the kernel configuration files. This means people can now still use
these drivers if they explicitly put them in their kernel configuration
file, which is good.

People should keep in mind that after August 10, these drivers will not
work anymore. Even though owners of the hardware are capable of getting
these drivers working again, I will see if I can at least get them to a
compilable state (if time permits).
2008-08-03 10:32:17 +00:00
Warner Losh
93757e6b48 Kernel config for the Linksys NSLU2. This is just a basic configuration,
with no support for the LED, buttons, realtime clock or flash support.
2008-08-03 07:10:25 +00:00
Olivier Houchard
fcfc49979c Handle ldr pc, [reg] in branch_taken().
Obtained from:	NetBSD
MFC after:	3 days
2008-08-03 01:53:14 +00:00
Olivier Houchard
697292d902 Add blx as a branch instruction.
MFC after:	3 days
2008-08-03 01:51:30 +00:00
Warner Losh
c65b00d158 Minor style nit. 2008-08-02 22:53:43 +00:00
Olivier Houchard
4ed897041f Add yet another branch instruction.
Obtained from:	NetBSD
MFC after:	3 days
2008-08-02 12:48:30 +00:00
Ed Schouten
6d09e4f1a8 Make the at91 uart(4) driver compile again.
As of r178766 this driver didn't compile anymore, because it missed a
switch()-statement. I'm getting tired of seeing this driver being broken
for two months already. When I run `make universe', everything passes,
except the BWCT kernel configuration file.
2008-08-02 08:01:56 +00:00
Warner Losh
504ff11df7 ixp425 parts aren't multicore, so remove the SMP option. They also
don't support the ioapic either, so remove that option too.  These
were commented out, but could never be enabled, unlike the other
options in the file that are commented out.
2008-08-02 07:20:30 +00:00
Warner Losh
319150067f Conform to the options<space><tab> convention everywhere in this file.
This is just a white space change, no functional change.
2008-08-02 07:18:12 +00:00
Olivier Houchard
939e434def Store the PC while context switching, for the benefits of DDB. 2008-08-02 00:10:38 +00:00
Stanislav Sedov
cde9cd82fe - Whitespace fixes.
Approved by:	gonzo
MFC after:	1 week
2008-07-22 14:04:06 +00:00
Alan Cox
7b4270021d Eliminate unused global variables. (These global variables became fields of
struct kva_md_info many years ago.)
2008-07-18 06:14:36 +00:00
Bernd Walter
fe228e4a7a fix multicast hash register definition 2008-07-12 23:40:07 +00:00
Ed Schouten
721351876c Remove the unused major/minor numbers from iodev and memdev.
Now that st_rdev is being automatically generated by the kernel, there
is no need to define static major/minor numbers for the iodev and
memdev. We still need the minor numbers for the memdev, however, to
distinguish between /dev/mem and /dev/kmem.

Approved by:	philip (mentor)
2008-06-25 07:45:31 +00:00
Kevin Lo
57deb21ad4 Fix a typo: i80321_pci_probe -> i81342_pci_probe 2008-06-12 01:46:06 +00:00
Kevin Lo
45c08eec9a Add the pxa_teardown_intr() bus method function to de-associate the
interrupt handler
2008-06-10 06:06:15 +00:00
Kevin Lo
43d8707e0f Pull all the code to deal with bus space methods into a shared set of
routines.
2008-06-10 03:44:14 +00:00
Wojciech A. Koszek
10170e4559 Since we create a DMA tag "mtag" for TX map with bus_dmamap_create(),
we must synchronize such a map against "mtag" with bus_dmamap_sync(),
not the tag designated for RX map.

Fix it.

Approved by:	cognet
2008-06-09 21:51:48 +00:00
Kevin Lo
247ac1530d Remove sa1_cache_clean_addr 2008-06-09 05:53:04 +00:00
Kevin Lo
6799ed5dd8 Unify arminit() and clean up 2008-06-09 05:50:42 +00:00
Benno Rice
9722a61504 Support for the XScale PXA255 SoC as found on the Gumstix Basix and Connex
boards.  This is enough to net-boot to multiuser.

Also supported is the SMSC LAN91C111 parts used on the netCF, netDUO and netMMC
add-on boards.

I'll be putting some instructions on how to boot this on the Gumstix boards
online soon.

This is still fairly rough and will be refined over time but I felt it was
better to get this out there where other people can help out.
2008-06-06 05:08:09 +00:00
Warner Losh
70311cad4b Release the resources for the registers for the TWI device with
SYS_RES_MEMORY to match how we allocate them...

Noticed by: Ian Lepore
2008-05-28 14:35:15 +00:00
Alan Cox
d1fdd63483 The VM system no longer uses setPQL2(). Remove it and its helpers. 2008-05-23 04:03:54 +00:00
Alan Cox
1ec1304bdb Retire pmap_addr_hint(). It is no longer used. 2008-05-18 04:16:57 +00:00
Alan Cox
2d17f90775 Add a stub for pmap_align_superpage() on machines that don't (yet)
implement pmap-level support for superpages.
2008-05-09 23:31:42 +00:00
Peter Wemm
43d7128c14 Expand kdb_alt_break a little, most commonly used with the option
ALT_BREAK_TO_DEBUGGER.  In addition to "Enter ~ ctrl-B" (to enter the
debugger), there is now "Enter ~ ctrl-P" (force panic) and
"Enter ~ ctrl-R" (request clean reboot, ala ctrl-alt-del on syscons).

We've used variations of this at work.  The force panic sequence is
best used with KDB_UNATTENDED for when you just want it to dump and
get on with it.

The reboot request is a safer way of getting into single user than
a power cycle.  eg: you've hosed the ability to log in (pam, rtld, etc).
It gives init the reboot signal, which causes an orderly reboot.

I've taken my best guess at what the !x86 and non-sio code changes
should be.

This also makes sio release its spinlock before calling KDB/DDB.
2008-05-04 23:29:38 +00:00
Jeff Roberson
6c47aaae12 - Add an integer argument to idle to indicate how likely we are to wake
from idle over the next tick.
 - Add a new MD routine, cpu_wake_idle() to wakeup idle threads who are
   suspended in cpu specific states.  This function can fail and cause the
   scheduler to fall back to another mechanism (ipi).
 - Implement support for mwait in cpu_idle() on i386/amd64 machines that
   support it.  mwait is a higher performance way to synchronize cpus
   as compared to hlt & ipis.
 - Allow selecting the idle routine by name via sysctl machdep.idle.  This
   replaces machdep.cpu_idle_hlt.  Only idle routines supported by the
   current machine are permitted.

Sponsored by:	Nokia
2008-04-25 05:18:50 +00:00
Poul-Henning Kamp
9b4a8ab7ba Now that all platforms use genclock, shuffle things around slightly
for better structure.

Much of this is related to <sys/clock.h>, which should really have
been called <sys/calendar.h>, but unless and until we need the name,
the repocopy can wait.

In general the kernel does not know about minutes, hours, days,
timezones, daylight savings time, leap-years and such.  All that
is theoretically a matter for userland only.

Parts of kernel code does however care: badly designed filesystems
store timestamps in local time and RTC chips almost universally
track time in a YY-MM-DD HH:MM:SS format, and sometimes in local
timezone instead of UTC.  For this we have <sys/clock.h>

<sys/time.h> on the other hand, deals with time_t, timeval, timespec
and so on.  These know only seconds and fractions thereof.

Move inittodr() and resettodr() prototypes to <sys/time.h>.
Retain the names as it is one of the few surviving PDP/VAX references.

Move startrtclock() to <machine/clock.h> on relevant platforms, it
is a MD call between machdep.c/clock.c.  Remove references to it
elsewhere.

Remove a lot of unnecessary <sys/clock.h> includes.

Move the machdep.disable_rtc_set sysctl to subr_rtc.c where it belongs.
XXX: should be kern.disable_rtc_set really, it's not MD.
2008-04-22 19:38:30 +00:00
Poul-Henning Kamp
0051271e12 Make genclock standard on all platforms.
Thanks to: grehan & marcel for platform support on ia64 and ppc.
2008-04-21 10:09:55 +00:00
Olivier Houchard
e19357d3a5 On the AT91, we need to write on the EOI register after we handle an
interrupt. So, add a new function pointer, arm_post_filter, which defaults
to NULL, and which will be used as the post_filter arg for
intr_event_create(). Set it properly for the AT91, so that it boots again.

Reported by:	hps
2008-04-20 23:29:06 +00:00
Sam Leffler
b032f27c36 Multi-bss (aka vap) support for 802.11 devices.
Note this includes changes to all drivers and moves some device firmware
loading to use firmware(9) and a separate module (e.g. ral).  Also there
no longer are separate wlan_scan* modules; this functionality is now
bundled into the wlan module.

Supported by:	Hobnob and Marvell
Reviewed by:	many
Obtained from:	Atheros (some bits)
2008-04-20 20:35:46 +00:00
Jeff Roberson
9b33b154b5 - Add the interrupt vector number to intr_event_create so MI code can
lookup hard interrupt events by number.  Ignore the irq# for soft intrs.
 - Add support to cpuset for binding hardware interrupts.  This has the
   side effect of binding any ithread associated with the hard interrupt.
   As per restrictions imposed by MD code we can only bind interrupts to
   a single cpu presently.  Interrupts can be 'unbound' by binding them
   to all cpus.

Reviewed by:	jhb
Sponsored by:	Nokia
2008-04-11 03:26:41 +00:00
Kevin Lo
97344c5281 Remove some long-dead code
Reviewed by: cognet
2008-04-08 10:24:42 +00:00
Olivier Houchard
a90c089ccd Remove bus_space_generic.c from the per-plarform files. Having it in the
per-cpu files should be enough.
2008-04-05 21:57:11 +00:00
Olivier Houchard
e5add3326c Add bus_space_generic.c for the i81342 as well. 2008-04-05 21:51:11 +00:00
John Baldwin
1ee1b68792 Add a MI intr_event_handle() routine for the non-INTR_FILTER case. This
allows all the INTR_FILTER #ifdef's to be removed from the MD interrupt
code.
- Rename the intr_event 'eoi', 'disable', and 'enable' hooks to
  'post_filter', 'pre_ithread', and 'post_ithread' to be less x86-centric.
  Also, add a comment describe what the MI code expects them to do.
- On amd64, i386, and powerpc this is effectively a NOP.
- On arm, don't bother masking the interrupt unless the ithread is
  scheduled in the non-INTR_FILTER case to match what INTR_FILTER did.
  Also, don't bother unmasking the interrupt in the post_filter case if
  we never masked it.  The INTR_FILTER case had been doing this by having
  arm_unmask_irq for the post_filter (formerly 'eoi') hook.
- On ia64, stray interrupts are now masked for the non-INTR_FILTER case.
  They were already masked in the INTR_FILTER case.
- On sparc64, use the a NULL pre_ithread hook and use intr_enable_eoi() for
  both the 'post_filter' and 'post_ithread' hooks to match what the
  non-INTR_FILTER code did.
- On sun4v, retire the ithread wrapper hack by using an appropriate
  'post_ithread' hook instead (it's what 'post_ithread'/'enable' was
  designed to do even in 5.x).

Glanced at by:	piso
Reviewed by:	marius
Requested by:	marius [1], [5]
Tested on:	amd64, i386, arm, sparc64
2008-04-05 19:58:30 +00:00
Warner Losh
1ff6c09714 Fix stupid typo 2008-04-04 18:22:16 +00:00
Rafal Jaworowski
367bbd3833 Make kernel.tramp build properly on ARM9E.
Reviewed by:	imp
Approved by:	cognet (mentor)
2008-04-04 17:35:24 +00:00
Rafal Jaworowski
15898edac1 Now really add the bus_space_generic.c file...
Reviewed by:	sam
Approved by:	cognet (mentor)
2008-04-03 18:28:34 +00:00
Rafal Jaworowski
47e972c91a Refactor certain ARM bus space methods: instead of having multiple copies of
the same code introduce sys/arm/arm/bus_space_generic.c for a shared set of
routines.

Reviewed by:	sam
Approved by:	cognet (mentor)
2008-04-03 18:22:08 +00:00
Rafal Jaworowski
b7170e5c34 Fix AVILA build.
Reviewed by:	sam
Approved by:	cognet(mentor)
2008-04-03 18:20:39 +00:00
Warner Losh
aa037d58ea Take the first baby step towards unifying and cleaning up arminit():
- Pull all the code to deal with the trampoline stuff into one
	  centeralized place and use it from everywhere.
	- Some minor style tidiness

Reviewed by: tinguely
2008-04-03 16:44:50 +00:00
Warner Losh
d93b192e7a KERNBASE + 0x00200000 is the same thing as KERNVIRTADDR on this
platform, so use the latter in preference to the former.  This makes
the fake_preload setup be the same between kb920x_machdep.c and
avila_machdep.c....
2008-04-03 06:14:23 +00:00
Warner Losh
e5a11098e8 Remove unnecessary #define. 2008-04-03 06:07:45 +00:00
Doug Rabson
fa9d9930ca Add kernel module support for nfslockd and krpc. Use the module system
to detect (or load) kernel NLM support in rpc.lockd. Remove the '-k'
option to rpc.lockd and make kernel NLM the default. A user can still
force the use of the old user NLM by building a kernel without NFSLOCKD
and/or removing the nfslockd.ko module.
2008-03-27 11:54:20 +00:00
John Birrell
e483943791 When building a kernel module, define MAXCPU the same as SMP so
that modules work with and without SMP.
2008-03-27 05:03:26 +00:00
Olivier Houchard
2c361379e4 We need to prototype _start() as well, as we use it to test if we're running
from flash or from RAM.

Reported by:	imp
MFC After:	3 days
2008-03-22 20:34:07 +00:00
Sam Leffler
dd5ac081b8 add hints to specify how NPE ports are mapped to MAC+PHY; these
could be commented out as they just duplicate the defaults that
are built into the code

Reviewed by:	imp
MFC after:	1 week
2008-03-22 16:55:51 +00:00
Sam Leffler
c7ad0d8736 Improve mac+phy configuration so that hints can be used to describe
layouts different than the defaults:
o hint.npe.0.mac="A", "B", etc. specifies the window for MAC register accesses
o hint.npe.0.mii="A", "B", etc. specifies PHY registers
o hint.npe.1.phy=%d specifies the PHY to map to a port

This allows devices like NSLU to be setup w/o code changes and will
also be used for forthcoming support for more Avila boards.

Reviewed by:	imp
MFC after	1 week
2008-03-22 16:53:28 +00:00
Sam Leffler
ef0e4fc4f5 add usb devices and more wlan stuff now that usb is functional
MFC after:	1 month
2008-03-20 17:44:58 +00:00
Sam Leffler
f9f98a6a18 map device 5; the optional USB controller on Gateworks 2348 boards
shows up here instead of the minipci slot at J4

Reviewed by:	cognet, imp
MFC after:	1 week
2008-03-20 15:54:19 +00:00
John Baldwin
6d2d1c044f Simplify the interrupt code a bit:
- Always include the ie_disable and ie_eoi methods in 'struct intr_event'
  and collapse down to one intr_event_create() routine.  The disable and
  eoi hooks simply aren't used currently in the !INTR_FILTER case.
- Expand 'disab' to 'disable' in a few places.
- Use function casts for arm and i386:intr_eoi_src() instead of wrapper
  routines since to trim one extra indirection.

Compiled on:	{arm,amd64,i386,ia64,ppc,sparc64} x {FILTER, !FILTER}
Tested on:	{amd64,i386} x {FILTER, !FILTER}
2008-03-17 22:42:01 +00:00
Robert Watson
237fdd787b In keeping with style(9)'s recommendations on macros, use a ';'
after each SYSINIT() macro invocation.  This makes a number of
lightweight C parsers much happier with the FreeBSD kernel
source, including cflow's prcc and lxr.

MFC after:	1 month
Discussed with:	imp, rink
2008-03-16 10:58:09 +00:00
John Baldwin
eaf86d1678 Add preliminary support for binding interrupts to CPUs:
- Add a new intr_event method ie_assign_cpu() that is invoked when the MI
  code wishes to bind an interrupt source to an individual CPU.  The MD
  code may reject the binding with an error.  If an assign_cpu function
  is not provided, then the kernel assumes the platform does not support
  binding interrupts to CPUs and fails all requests to do so.
- Bind ithreads to CPUs on their next execution loop once an interrupt
  event is bound to a CPU.  Only shared ithreads are bound.  We currently
  leave private ithreads for drivers using filters + ithreads in the
  INTR_FILTER case unbound.
- A new intr_event_bind() routine is used to bind an interrupt event to
  a CPU.
- Implement binding on amd64 and i386 by way of the existing pic_assign_cpu
  PIC method.
- For x86, provide a 'intr_bind(IRQ, cpu)' wrapper routine that looks up
  an interrupt source and binds its interrupt event to the specified CPU.
  MI code can currently (ab)use this by doing:

	intr_bind(rman_get_start(irq_res), cpu);

  however, I plan to add a truly MI interface (probably a bus_bind_intr(9))
  where the implementation in the x86 nexus(4) driver would end up calling
  intr_bind() internally.

Requested by:	kmacy, gallatin, jeff
Tested on:	{amd64, i386} x {regular, INTR_FILTER}
2008-03-14 19:41:48 +00:00
Rafal Jaworowski
507ea268f2 Respect RF_SHAREABLE flag in ARM nexus_setup_intr()
Reviewed by:	imp
Approved by:	cognet (mentor)
2008-03-12 15:46:25 +00:00
Rafal Jaworowski
1397332d85 Improve ARM bus_dmamap_load_buffer() error handling.
Reviewed by:	imp
Approved by:	cognet (mentor)
Spotted by:	Grzegorz Bernacki gjb AT semihalf DOT com
2008-03-12 15:31:37 +00:00
Jeff Roberson
6617724c5f Remove kernel support for M:N threading.
While the KSE project was quite successful in bringing threading to
FreeBSD, the M:N approach taken by the kse library was never developed
to its full potential.  Backwards compatibility will be provided via
libmap.conf for dynamically linked binaries and static binaries will
be broken.
2008-03-12 10:12:01 +00:00
Olivier Houchard
af9db76b65 MFi386:
revision 1.6
date: 2004/08/21 18:50:34;  author: alc;  state: Exp;  lines: +3 -1
Properly free the temporary sf_buf in uiomove_fromphys() if a copyin or
copyout fails.

Obtained from: DragonFlyBSD

Spotted out by:	Mark Tinguely
MFC After:	3 days
2008-03-06 22:27:35 +00:00
Olivier Houchard
41c0d2813b Remove unused pv_list_count from the vm_page, and pm_count from the struct
pmap.

Submitted by:	Mark Tinguely
2008-03-06 21:59:47 +00:00
Kevin Lo
cecb2ec213 Add rl(4) support 2008-03-05 07:55:45 +00:00
Kevin Lo
223a605ac5 Convert to be a 2-clause bsd-only license.
Pointed out by: rwatson
2008-03-03 06:39:36 +00:00
Robert Watson
1fb18eea38 Remove errant % in license comment.
MFC after:	3 days
2008-02-26 11:45:32 +00:00
Robert Watson
18d59070d6 On the ixp425, when we fail to initialize the memory rman instance, the
panic message should read "memory", not "IRQ".

MFC after:	3 days
2008-02-26 11:44:41 +00:00
Rafal Jaworowski
72c6438b52 ARM locore cosmetics.
Approved by:	cognet (mentor)
2008-02-05 10:23:42 +00:00
Rafal Jaworowski
e081d0ac19 Improve ARM_TP_ADDRESS and RAS area.
De-hardcode usage of ARM_TP_ADDRESS and RAS local storage, and move this
special purpose page to a more convenient place i.e. after the vectors high
page, more towards the end of address space. Previous location (0xe000_0000)
caused grief if KVA was to go beyond the default limit.

Note that ARM world rebuilding is required after this change since the
location of ARM_TP_ADDRESS is shared between kernel and userland.

Submitted by:	Grzegorz Bernacki (gjb AT semihalf dot com)
Reviewed by:	imp
Approved by:	cognet (mentor)
2008-02-05 10:22:33 +00:00
Olivier Houchard
8f2948f1c1 Bring in the nice work from Mark Tinguely on arm pmap.
The only downside is that it renames pmap_vac_me_harder() to pmap_fix_cache().
From Mark's email on -arm :
pmap_get_vac_flags(), pmap_vac_me_harder(), pmap_vac_me_kpmap(), and
pmap_vac_me_user() has been rewritten as pmap_fix_cache() to be more
efficient in the kernel map case. I also removed the reference to
the md.kro_mappings, md.krw_mappings, md.uro_mappings, and md.urw_mappings
counts.

In pmap_clearbit(), we can also skip over tests and writeback/invalidations
in the PVF_MOD and PVF_REF cases if those bits are not set in the pv_flag.
PVF_WRITE will turn caching back on and remove the PV_MOD bit.

In pmap_nuke_pv(), the vm_page_flag_clear(pg, PG_WRITEABLE) has been moved
to the pmap_fix_cache().

We can be more agressive in attempting to turn caching back on by calling
pmap_fix_cache() at times that may be appropriate to turn cache on
(a kernel mapping has been removed, a write has been removed or a read
has been removed and we know the mapping does not have multiple write
mappings to a page).

In pmap_remove_pages() the cpu_idcache_wbinv_all() is moved to happen
before the page tables are NULLed because the caches are virtually
indexed and virtually tagged.

In pmap_remove_all(), the pmap_remove_write(m) is added before the
page tables are NULLed because the caches are virtually indexed and
virtually tagged. This also removes the need for the caches fixing routine
(whichever is being used pmap_vac_me_harder() or pmap_fix_cache()) to be
called on any of these mappings.

In pmap_remove(), I simplified the cache cleaning process and removed
extra TLB removals. Basically if more than PMAP_REMOVE_CLEAN_LIST_SIZE
are removed, then just flush the entire cache.
2008-01-31 00:05:40 +00:00
Ruslan Ermilov
007b1b7bae Add a wrapper function that bound checks writes to the dump device. 2008-01-28 19:04:07 +00:00
John Baldwin
304a4c6fb1 - Retire npe_defrag(), gem_defrag(), msk_defrag(), nfe_defrag(), and
re_defrag() and use m_collapse() instead.
- Replace a reference to ath_defrag() in a comment in if_wpi.c with
  m_collapse().
2008-01-17 23:37:47 +00:00
Olivier Houchard
10457dbaf2 Unbreak build by adding the missing parameter to pmap_enter(). 2008-01-17 12:41:59 +00:00
Olivier Houchard
253d846886 Back when I committed the arm port, I've been asked to move
memcpy/memset/memcmp and friends from libkern/arm to arm/arm/support.S, and so
I did, but in the process, I didn't add the appropriate copyrights.
This is a major oversight from me, and I apology to the NetBSD people for it.

MFC After:	1 day
2008-01-12 21:11:43 +00:00
Olivier Houchard
b94ba2b9c4 Add a missing \n. 2008-01-07 00:36:09 +00:00
Alan Cox
eb2a051720 Add an access type parameter to pmap_enter(). It will be used to implement
superpage promotion.

Correct a style error in kmem_malloc(): pmap_enter()'s last parameter is
a Boolean.
2008-01-03 07:34:34 +00:00
Warner Losh
cd093614f3 Use correct function name in panic message 2008-01-03 06:44:12 +00:00
Warner Losh
409fe84319 Modernize comment about diagnostic. 2008-01-03 06:31:41 +00:00
Alan Cox
b8e7fc24fe Add configuration knobs for the superpage reservation system. Initially,
the reservation will only be enabled on amd64.
2007-12-27 16:45:39 +00:00
Robert Watson
3de213cc00 Add a new 'why' argument to kdb_enter(), and a set of constants to use
for that argument.  This will allow DDB to detect the broad category of
reason why the debugger has been entered, which it can use for the
purposes of deciding which DDB script to run.

Assign approximate why values to all current consumers of the
kdb_enter() interface.
2007-12-25 17:52:02 +00:00
Stanislav Sedov
05a824e9fa - Fix a typo in comments.
MFC after:	1 week
Approved by:	cognet
2007-12-23 23:31:27 +00:00
Warner Losh
1981bc3b8a Actually program the interrupt controller for priorities. As we
support more AT91 platforms, we'll need to move this into some
platform init routine.
2007-12-19 17:34:17 +00:00
Kevin Lo
5497f4c53e Use M_NOWAIT instead of M_WAITOK to cause malloc() to return NULL
Reviewed by: imp
2007-12-17 05:08:54 +00:00
Stanislav Sedov
1e6774a44e - Don't return 0xffff if PHY id isn't equal 0. This allows PHYs with
non-zero addresses to be used.

Approved by:	cognet
MFC after:	2 weeks
2007-12-16 12:57:12 +00:00
Olivier Houchard
c8ffd860a5 There's no need to call pmap_vac_me_harder() in pmap_protect(), as it
already happened in pmap_modify_pv().

Submitted by:	Mark Tinguely <tinguely AT casselton DOT net>
2007-12-11 20:35:44 +00:00
Joseph Koshy
0da7aa7a7d Add stubs to unbreak LINT. 2007-12-07 13:45:47 +00:00
Olivier Houchard
b358d3906a Fix style in previous commit.
Pointed out by:	njl
2007-12-07 10:42:11 +00:00
Olivier Houchard
91f2b6797a Erm, add a missing else, we do not want to increase the mapping counters for
both kernel and userland when we create a pv for pmap_kernel.

Reported by:	Mark Tinguely <tinguely AT casselton DOT net>
MFC After:	3 days
2007-12-06 23:17:24 +00:00
Robert Watson
3c90d1ea74 Break out stack(9) from ddb(4):
- Introduce per-architecture stack_machdep.c to hold stack_save(9).
- Introduce per-architecture machine/stack.h to capture any common
  definitions required between db_trace.c and stack_machdep.c.
- Add new kernel option "options STACK"; we will build in stack(9) if it is
  defined, or also if "options DDB" is defined to provide compatibility
  with existing users of stack(9).

Add new stack_save_td(9) function, which allows the capture of a stacktrace
of another thread rather than the current thread, which the existing
stack_save(9) was limited to.  It requires that the thread be neither
swapped out nor running, which is the responsibility of the consumer to
enforce.

Update stack(9) man page.

Build tested:	amd64, arm, i386, ia64, powerpc, sparc64, sun4v
Runtime tested:	amd64 (rwatson), arm (cognet), i386 (rwatson)
2007-12-02 20:40:35 +00:00
Olivier Houchard
18836eac48 Fix a potential bug in pmap :
We used to allocate the domains 0-14 for userland, and leave the domain 15
for the kernel. Now supersections requires the use of domain 0, so we
switched the kernel domain to 0, and use 1-15 for userland.
How it's done currently, the kernel domain could be allocated for a
userland process.
So switch back to the previous way we did things, set the first available
domain to 0, and just add 1 to get the real domain number in the struct pmap.

Reported by:	Mark Tinguely <tinguely AT casselton DOT net>
MFC After:	3 days
2007-12-02 15:26:30 +00:00
Olivier Houchard
35af41b0a6 Move the strongarm-specific files from conf/files.arm to sa11x0/files.sa11xO.
Submitted by:	Rafal Jaworowski <raj AT semihalf DOT com>
2007-12-02 13:12:21 +00:00
Olivier Houchard
f9af595fc3 Cleanup : make nexus standard, as it is mandatory anyway.
Garbage-collect unused nexus_io.c and nexus_io_asm.S

Submitted by:	Rafal Jaworowski <raj AT semihalf DOT com>
2007-12-02 13:10:42 +00:00
Olivier Houchard
b21a1da537 Close a race.
The RAS implementation would set the end address, then the start
address.  These were used by the kernel to restart a RAS sequence if
it was interrupted.  When the thread switching code ran, it would
check these values and adjust the PC and clear them if it did.

However, there's a small flaw in this scheme.  Thread T1, sets the end
address and gets preempted.  Thread T2 runs and also does a RAS
operation.  This resets end to zero.  Thread T1 now runs again and
sets start and then begins the RAS sequence, but is preempted before
the RAS sequence executes its last instruction.  The kernel code that
would ordinarily restart the RAS sequence doesn't because the PC isn't
between start and 0, so the PC isn't set to the start of the sequence.
So when T1 is resumed again, it is at the wrong location for RAS to
produce the correct results.  This causes the wrong results for the
atomic sequence.

The window for the first race is 3 instructions.  The window for the
second race is 5-10 instructions depending on the atomic operation.
This makes this failure fairly rare and hard to reproduce.

Mutexs are implemented in libthr using atomic operations.  When the
above race would occur, a lock could get stuck locked, causing many
downstream problems, as you might expect.

Also, make sure to reset the start and end address when doing a syscall, or
a malicious process could set them before doing a syscall.

Reviewed by: imp, ups (thanks guys)
Pointy hat to:	cognet
MFC After:	3 days
2007-12-02 12:49:28 +00:00
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