Commit Graph

45 Commits

Author SHA1 Message Date
ad
0dc71691a0 Fix the qemu (?) problem. 2008-05-11 22:18:08 +00:00
ad
75ada79f33 Improve x86 tsc handling:
- Ditch the cross-CPU calibration stuff. It didn't work properly, and it's
  near impossible to synchronize the CPUs in a running system, because bus
  traffic will interfere with any calibration attempt, messing up the
  timings.

- Only enable the TSC on CPUs where we are sure it does not drift. If we are
  On a known good CPU, give the TSC high timecounter quality, making it the
  default.

- When booting CPUs, detect TSC skew and account for it. Most Intel MP
  systems have synchronized counters, but that need not be true if the
  system has a complicated bus structure. As far as I know, AMD systems
  do not have synchronized TSCs and so we need to handle skew.

- While an AP is waiting to be set running, try and make the TSC drift by
  entering a reduced power state. If we detect drift, ensure that the TSC
  does not get a high timecounter quality. This should not happen and is
  only for safety.

- Make cpu_counter() stuff LKM safe.
2008-05-10 16:12:32 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
cherry
f493ba9c7e Correct comment about struct timecounter field 2008-04-06 12:19:36 +00:00
cube
49f644ac35 Cosmetics: use device_t and cfdata_t. 2008-03-05 22:47:53 +00:00
cube
e42e7941c2 sysbeep has no softc, use CFATTACH_DECL_NEW. 2008-03-04 14:38:05 +00:00
kardel
7e076be4ab unbreak i8254_get_timecount() in environments where the
clock interrupt is derived from other sources (e.g. lapic)
and the i8254 timer is running the full cycle without
being used as clock interrupt source.
2008-01-19 15:06:52 +00:00
lukem
14c9fc8ffa Remove unnecessary references to config_time.h. 2008-01-17 01:56:02 +00:00
chuck
50278d718a fix clock accounting problem in i8254_get_timecount that caused
the auich auich_calibrate() function to get the wrong ac97 freq
(may cause audio to play at wrong speed on some systems).  this
error was inadvertently introduced in rev 1.98 of the old
src/sys/arch/i386/isa/clock.c (2006/09/03) and manifests itself
on systems that do not use an alternate timecounter (e.g. ACPI-Fast).

the basic problem is that the code that handled when the i8254
counter wrapped was firing in cases when it shouldn't have,
causing the counter to run fast.   a more detailed discussion
can be found here:
  http://mail-index.netbsd.org/tech-kern/2008/01/15/0001.html
  http://mail-index.netbsd.org/tech-kern/2008/01/16/0000.html
2008-01-16 18:38:24 +00:00
dyoung
46aba2a3d0 Remove superfluous #if (NPCPPI > 0). 2008-01-04 22:28:20 +00:00
dyoung
482c583bd7 Move #endif to the place where it belongs. Thanks, Chavdar Ivanov,
for noticing this.
2008-01-04 22:10:34 +00:00
ad
0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
christos
5fa6e7c2d4 add missing includes 2008-01-04 20:38:01 +00:00
he
46a379e692 Declare sysbeepdetach(), and protect a small additional section
with #if (NPCPPI > 0).
2008-01-03 21:30:16 +00:00
dyoung
69d7a3e831 Support detachment of pchb(4) and sysbeep(4). 2008-01-03 04:50:19 +00:00
joerg
02d07b4e9d Remove delaytab and just compute the reminder directly. This requires
two muls and a shift, which needs at most 2ms on a 25MHz i386 and should
end up as fast as delay(1) was before due to using a reminder of 2.
Discussed with ad@.
2007-12-28 14:05:22 +00:00
jmcneill
4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
ad
83caeda725 - Fix the locking around the i8254. Values for the TSC clock and lapic
delay function were wildly inaccurate due to multiple CPUs competing
  in DELAY() during calibration, confusing the clock chip.
- Use i8254_delay() explictly in a few more places.
2007-12-04 16:05:34 +00:00
ad
9014362808 - Remove I486_CPU, I586_CPU, I686_CPU options. They buy us nothing and
clutter the code significantly.
- Remove pccons.
2007-11-14 17:54:56 +00:00
joerg
930e1f6e1d Match delay/DELAY on x86 with delay(9). It takes an unsigned int as
argument. Use this and replace the inline assembly (mul + div using the
64bit intermediate result) with normal 32bit multiplication and
division. The compiler can turn the division into a multiplication and
shift, making it even cheaper then the original assembly. For extreme
long delays, just use 64bit arithmetic.
2007-10-26 13:24:39 +00:00
garbled
d974db0ada Merge the ppcoea-renovation branch to HEAD.
This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree.  Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches.  The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
2007-10-17 19:52:51 +00:00
ad
9c412e0cbf x86 changes for pcc and LKMs.
- Replace most inline assembly with proper functions. As a side effect
  this reduces the size of amd64 GENERIC by about 120kB, and i386 by a
  smaller amount. Nearly all of the inlines did something slow, or something
  that does not need to be fast.
- Make curcpu() and curlwp functions proper, unless __GNUC__ && _KERNEL.
  In that case make them inlines. Makes curlwp LKM and preemption safe.
- Make bus_space and bus_dma more LKM friendly.
- Share a few more files between the ports.
- Other minor changes.
2007-09-26 19:48:34 +00:00
ad
88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
mrg
4410329b87 add a pair of new bus_dma(9) functions:
int _bus_dmatag_subregion(bus_dma_tag_t tag,
				  bus_addr_t min_addr,
				  bus_addr_t max_addr,
				  bus_dma_tag_t *newtag,
				  int flags)
	void _bus_dmatag_destroy(bus_dma_tag_t tag)

that allow a (normally broken/limited) device to restrict the bus address
range it can talk to.  this is used by bce(4) to limit DMA addresses to
1GB range, the maximum the chip can address.

all this is from Yorick Hardy <yhardy@uj.ac.za> with input from several
people on tech-kern.

XXX: bus_dma(9) needs an update still.
2007-02-21 20:41:23 +00:00
yamt
98cfc473c8 - pass intrframe by-pointer, not by-value.
- make i386 and xen use per-cpu interrupt stack.

xen part is reviewed by Manuel Bouyer.
2006-12-08 15:05:18 +00:00
christos
168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
hannken
a92696acd1 More __unused (NPCPPI == 0 case). 2006-10-13 10:09:36 +00:00
christos
4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
gdamore
229365fda3 Use common todr_settime_ymdhms/gettime_ymdhms.
While here, fix an incorrect test for timeset (that's in kern_todr already),
and an incorrect to time_second (instead of using the date passed in).
2006-09-07 00:18:50 +00:00
gdamore
a37acb1b52 Remove unused todr_setcal/todr_getcal and all the assorted stub
implementations.
2006-09-04 23:45:30 +00:00
perry
e2420ca184 Undo static declaration on gettick -- lapic.c uses it.
Pointed out by Geoff Wing (mason at primenet.com.au)
2006-09-04 03:07:52 +00:00
perry
225449e795 switch to a common clock.c 2006-09-04 02:16:03 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
yamt
fb4a1ff192 tweak x86 bus_dma code so that it can be used by xen port.
- distinguish paddr_t and bus_addr_t.
  for xen, use bus_addr_t in the sense of machine address.
- move _X86_BUS_DMA_PRIVATE part of bus.h into bus_private.h.
- remove special handling of xen_shm.  we can always grab
  machine address from pte.
2005-04-16 07:53:35 +00:00
thorpej
67e828e7d8 Remove the "ID" component of the x86 bus_dma flags, since these are no
longer "ISA DMA" specific flags.
2004-06-20 18:04:08 +00:00
fvdl
7d342b5852 * keep track of PCI buses that aren't known by firmware, but are found
by NetBSD
* use this info in in intr_find_mpmapping
* get rid of the last argument to intr_find_mpmapping, it was redundant
2003-10-30 21:19:54 +00:00
fvdl
6a6db3cbd9 Add hooks and structures to allow the MP table intr mapping code a
better shot at finding a mapping. For PCI interrupts, if a bus
has no mappings, try its parent, with the swizzled pin, and the
bridge's device number.
2003-10-16 22:56:29 +00:00
agc
aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
fvdl
799347472e Generalize bounce buffers, and use them for 32 bit PCI if needed.
Make ALLOCNOW the default iff bouncing might be needed (this has
no effect on i386 because ISA DMA devices already had to use
ALLOCNOW, and PCI isn't bounced (yet), since we don't do > 4G
at this point for i386.
2003-05-07 21:33:57 +00:00
fvdl
6bd0c9f44d Move definition of ISA_DMA_BOUNCE_THRESHOLD to dev/isa/isareg.h. 2003-05-05 12:55:41 +00:00
wiz
1ffa7b76c4 DMA, not dma nor Dma. 2003-05-03 18:10:37 +00:00
fvdl
a345044000 s/i386_isa_chipset/x86_isa_chipset/ 2003-03-04 01:07:36 +00:00
fvdl
7f72a2bff2 Clean up some unneeded "mca.h" and "eisa.h" includes, make one that is
needed dependent on !__x86_64__. To be revisited later.
2003-03-02 18:27:14 +00:00
fvdl
636c7ca859 x86_64 has no mca.h and eisa.h (should perhaps just generate empty ones) 2003-03-02 18:11:03 +00:00
fvdl
8556a55a8d Moved here from i386/isa 2003-02-27 00:28:08 +00:00