Commit Graph

9691 Commits

Author SHA1 Message Date
Jeff Roberson
1419773de3 - Hide more #ifdef logic in a new invlcaddr inline. This function flushes
the full tlb if you're on an I386or does an invlpg otherwise.

Glanced at by:	peter
2003-10-01 05:56:46 +00:00
Jeff Roberson
043407f803 - Define an inline pagezero() to select the appropriate full-page zeroing
function from one of bzero, i686_pagezero, or sse2_pagezero.
 - Use pagezero() in the three pmap functions that need to zero full pages.
2003-10-01 05:42:58 +00:00
Jeff Roberson
977f9ab515 - Add ss2_pagezero() for zeroing pages using the movnti instruction. This
instruction is enabled with SSE2 but does not use SSE registers.  It is a
   "non-temporal" move which bypasses the cache and does not dirty lines.
2003-10-01 05:25:27 +00:00
Jeff Roberson
fb9bde2d2b - Correct a problem with the last commit. The CMAP ptes need to be zeroed
prior to invalidating the TLB to be certain that the processor doesn't
   keep a cached copy.

Discussed with:	pete
Paniced:	tegge
Pointy Hat:	The usual spot
2003-10-01 00:27:09 +00:00
Jeff Roberson
fa3f9daae5 - On my Pentium4-M laptop, invalpg takes ~1100 cycles if the page is found in
the TLB and ~1600 if it is not.  Therefore, it is more effecient to
   invalidate the TLB after operations that use CMAP rather than before.
 - So that the tlb is invalidated prior to switching off of a processor, we
   must change the switchin functions to switchout functions.
 - Remove td_switchout from the thread and move it to the x86 pcb.
 - Move the code that calls switchout into swtch.s.  These changes make this
   optimization truely x86 specific.
2003-09-30 08:11:36 +00:00
Jeff Roberson
f75766288d - Correct a typo in a comment. 2003-09-30 04:51:12 +00:00
Bruce Evans
fa2e26c437 MFsio (sio.c 1.413: cleaned up and fixed setting of speeds in comparam()).
This is just a cleanup here (modulo rev.1.108 of kern/tty.c), since the
input speed can be different from to output speed and extra code to
handle both speeds naturally handled all cases.
2003-09-27 12:40:23 +00:00
Poul-Henning Kamp
70cd771337 The present defaults for the open and close for device drivers which
provide no methods does not make any sense, and is not used by any
driver.

It is a pretty hard to come up with even a theoretical concept of
a device driver which would always fail open and close with ENODEV.

Change the defaults to be nullopen() and nullclose() which simply
does nothing.

Remove explicit initializations to these from the drivers which
already used them.
2003-09-27 12:01:01 +00:00
Bruce Evans
7872ac5542 Quick fix for bitrot in locking in the SMP case. cd_getreg() and
cd_setreg() were still using !(read_eflags() & PSL_I) as the condition
for the lock hidden by COM_LOCK() (if any) being held.  This worked
when spin mutexes and/or critical_enter() used hard interrupt disablement,
but it has caused recursion on the non-recursive mutex com_mtx since
all relevant interrupt disablement became soft.  The recursion is
harmless unless there are other bugs, but it breaks an invariant so
it is fatal if spinlocks are witnessed.
2003-09-27 10:30:03 +00:00
Alan Cox
4487ff65db Addendum to the previous revision: If vm_page_alloc() for the page
table page fails, perform a VM_WAIT; update some comments in
_pmap_allocpte().
2003-09-27 05:44:53 +00:00
Poul-Henning Kamp
3623186cbc Initialize cn_name, ignore cn_dev. 2003-09-26 08:51:54 +00:00
Alan Cox
f3fd831cdd - Eliminate the pte object.
- Use kmem_alloc_nofault() rather than kmem_alloc_pageable() to allocate
   KVA space for the page directory page(s).  Submitted by: tegge
2003-09-25 02:51:06 +00:00
Peter Wemm
c460ac3a00 Add sysentvec->sv_fixlimits() hook so that we can catch cases on 64 bit
systems where the data/stack/etc limits are too big for a 32 bit process.

Move the 5 or so identical instances of ELF_RTLD_ADDR() into imgact_elf.c.

Supply an ia32_fixlimits function.  Export the clip/default values to
sysctl under the compat.ia32 heirarchy.

Have mmap(0, ...) respect the current p->p_limits[RLIMIT_DATA].rlim_max
value rather than the sysctl tweakable variable.  This allows mmap to
place mappings at sensible locations when limits have been reduced.

Have the imgact_elf.c ld-elf.so.1 placement algorithm use the same
method as mmap(0, ...) now does.

Note that we cannot remove all references to the sysctl tweakable
maxdsiz etc variables because /etc/login.conf specifies a datasize
of 'unlimited'.  And that causes exec etc to fail since it can no
longer find space to mmap things.
2003-09-25 01:10:26 +00:00
Warner Losh
00dc18b5a8 Per TRB vote: restore the aquire_timer0 and associated goo. This will
be gone in FreeBSD 6, so put BURN_BRIDGES around it.  The TRB also
felt that if something better comes along sooner, it can be used to
replace this code.

Delayed by: BSDcon and subsequent disk crash.
2003-09-24 15:33:33 +00:00
Yoshihiro Takahashi
33e38a2cc8 Implement the bus_space_map() function to allocate resources and initialize
a bus_handle, but currently it does only initializing a bus_handle.
2003-09-23 08:22:34 +00:00
Peter Wemm
795a3f5279 Microoptimization to allow the compiler to evaluate ntohl() etc on
known constants at compile time rather than at run time.  We have a number
of nasty hacks around the place to cache ntohl() of constants (eg: nfs).
This change allows the compiler to compile-time evaluate ntohl(1) as
0x01000000 rather than having to emit assembler code to do it.  This
has other smaller flow-on effects because the compiler can see that
ntohl(constant) itself has a constant value now and can propagate the
compile time evaluation.

Obtained from:  Ideas from NetBSD and Linux, and some code from NetBSD
2003-09-22 21:46:47 +00:00
Alan Cox
be19fdd17e Allocate the page table directory page(s) as "no object" pages. (This
leaves one explicit use of the pte object.)
2003-09-21 21:36:13 +00:00
Alan Cox
f8363bdee9 Reimplement pmap_release() such that it uses the page table rather than the
pte object to locate the page table directory pages.  (This is another step
toward the elimination of the pte object.)
2003-09-20 23:54:36 +00:00
Joerg Wunsch
9678710b1f Mention the puc(4) glue driver in a commented-out example so the user
of "dumb" PCI-based serial/parallel boards get a hint how to enable
them.

I wasn't sure about the ia64, pc98, powerpc, and sparc64 archs whether
they'd support puc(4) or not.
2003-09-19 20:04:55 +00:00
Sam Leffler
f4659f863c add Atheros driver 2003-09-19 01:42:24 +00:00
John Baldwin
eb975edd06 Fix a busted constant related to PCI configuration acess method #1. The
reserved bits in the port that must be zero are 24:30, not 20:30.  Bits
16:23 are used to set the bus number.  This meant that when we tested for
config mechanism #1, if the previous PCI configuration transaction sent
used a bus number greater than 15, one of the bits in 20:23 would be
non-zero and we would fail to use config mechanism #1 and thus fail to see
that PCI existed on the machine at all.

Obtained from:	Shanley's PCI System Architecture book
Tested by:	des
Proxied through:	njl
2003-09-18 17:00:03 +00:00
Bruce Evans
b6fab1eae2 Don't forget to reenable interrupts after a breakpoint and trace traps from
user mode.  This goes with rev.1.468 of machdep.c which changed the gates
for these traps to interrupt gates.  Having the interrupts disabled for
these traps from user mode is just an unwanted side effect.

This fixes at least 1 case of "panic: absolutely cannot call
smp_ipi_shootdown with interrupts already disabled".  Too much code was
run with interrupts disabled, and it sometimes hit a sanity check.

Fix verified by:	deischen
2003-09-18 07:01:30 +00:00
Mitsuru IWASAKI
d099a9d164 Add final adjustment code of battery status based on the battery capacity
rather than returning unknown status.
2003-09-17 08:47:39 +00:00
Alan Cox
6d66d714c7 Simplify (and micro-optimize) pmap_unuse_pt(): Only one caller,
pmap_remove_pte(), passed NULL instead of the required page table
page to pmap_unuse_pt().  Compute the necessary page table page
in pmap_remove_pte().  Also, remove some unreachable code from
pmap_remove_pte().
2003-09-13 21:57:38 +00:00
Alan Cox
b9850eb224 Add a new parameter to pmap_extract_and_hold() that is needed to eliminate
Giant from vmapbuf().

Idea from:	tegge
2003-09-12 07:07:49 +00:00
David E. O'Brien
3fc40c2484 Sort 'bge' correctly. 2003-09-10 18:54:59 +00:00
John Baldwin
bbdaad6fee Whitespace. 2003-09-10 07:09:16 +00:00
John Baldwin
810cb9ef5e We represent PCI intpin's two different ways. One is the way that the
intpin register is expressed in hardware where 0 means none, 1 means INTA,
2 INTB, etc.  The other way is commonly used in loops where 0 means INTA,
1 means INTB, etc.  The matchpin argument to pci_cfgintr_search() is
supposed to be the first form, but we passsed in a loop index of the
second.  This fix adds one to the loop index to convert to the first form.

Reported by:	Pavlin Radoslavov <pavlin@icir.org>
2003-09-10 06:00:53 +00:00
John Baldwin
a7321ecb19 Finish an earlier commit:
Add a acpi_SetDefaultIntrModel() method to allow drivers to set the
interrupt model prior to the acpi0 device being probed and attached.
2003-09-10 05:29:30 +00:00
John Baldwin
a547af297d Remove an XXX comment by using the per CPU mask added after this comment
was added.
2003-09-10 01:36:48 +00:00
John Baldwin
4c93af3788 Add a acpi_SetDefaultIntrModel() method to allow drivers to set the
interrupt model prior to the acpi0 device being probed and attached.
2003-09-10 01:14:42 +00:00
John Baldwin
f03cb48d41 Fix a typo. 2003-09-10 01:11:58 +00:00
John Baldwin
674e1d4532 Add comments to the members of the timecounter struct similar to other
timecounters.
2003-09-10 01:10:24 +00:00
John Baldwin
0e85b19ba9 Add constants for entries in the IDT and use those instead of magic
numbers.
2003-09-10 01:07:04 +00:00
Bill Paul
b9f78d2b4a Add a device driver for the Broadcom BCM4401 ethernet controller,
written by Stuart Walsh and Duncan Barclay (with some kibbitzing by
me). I'm checking it in on Stuart's behalf.

The BCM4401 is built into several x86 laptop and desktop systems. For the
moment, I have only enabled it in the x86 kernel config because although
it's a PCI device, I haven't heard of any standalone NICs that use it. If
somebody knows of one, we can easily add it to the other arches.

This driver uses register/structure data gleaned from the Linux
driver released by Broadcom, but does not contain any of the code
from the Linux driver itself. It uses busdma.
2003-09-09 18:17:23 +00:00
Scott Long
5fdcb0a62e Re-arrange the raid section a small bit and put drivers into their proper
category.
2003-09-09 06:36:32 +00:00
Eric Anholt
a1810e1513 Hook the SiS DRM up to the build
Sponsored by:	LinuxFund
2003-09-09 00:29:02 +00:00
Nate Lawson
bf10d4f8c4 Don't disable interrupts a second time. Remove an extraneous interrupt
enable (that happens elsewhere).  Clarify the interrupt disabling point
by using ACPI_DISABLE_IRQS().

Tested by:	Kevin Oberman
2003-09-08 06:22:54 +00:00
Alan Cox
ba2157f218 Introduce a new pmap function, pmap_extract_and_hold(). This function
atomically extracts and holds the physical page that is associated with the
given pmap and virtual address.  Such a function is needed to make the
memory mapping optimizations used by, for example, pipes and raw disk I/O
MP-safe.

Reviewed by:	tegge
2003-09-08 02:45:03 +00:00
Bill Paul
a94100fa9b Take the support for the 8139C+/8169/8169S/8110S chips out of the
rl(4) driver and put it in a new re(4) driver. The re(4) driver shares
the if_rlreg.h file with rl(4) but is a separate module. (Ultimately
I may change this. For now, it's convenient.)

rl(4) has been modified so that it will never attach to an 8139C+
chip, leaving it to re(4) instead. Only re(4) has the PCI IDs to
match the 8169/8169S/8110S gigE chips. if_re.c contains the same
basic code that was originally bolted onto if_rl.c, with the
following updates:

- Added support for jumbo frames. Currently, there seems to be
  a limit of approximately 6200 bytes for jumbo frames on transmit.
  (This was determined via experimentation.) The 8169S/8110S chips
  apparently are limited to 7.5K frames on transmit. This may require
  some more work, though the framework to handle jumbo frames on RX
  is in place: the re_rxeof() routine will gather up frames than span
  multiple 2K clusters into a single mbuf list.

- Fixed bug in re_txeof(): if we reap some of the TX buffers,
  but there are still some pending, re-arm the timer before exiting
  re_txeof() so that another timeout interrupt will be generated, just
  in case re_start() doesn't do it for us.

- Handle the 'link state changed' interrupt

- Fix a detach bug. If re(4) is loaded as a module, and you do
  tcpdump -i re0, then you do 'kldunload if_re,' the system will
  panic after a few seconds. This happens because ether_ifdetach()
  ends up calling the BPF detach code, which notices the interface
  is in promiscuous mode and tries to switch promisc mode off while
  detaching the BPF listner. This ultimately results in a call
  to re_ioctl() (due to SIOCSIFFLAGS), which in turn calls re_init()
  to handle the IFF_PROMISC flag change. Unfortunately, calling re_init()
  here turns the chip back on and restarts the 1-second timeout loop
  that drives re_tick(). By the time the timeout fires, if_re.ko
  has been unloaded, which results in a call to invalid code and
  blows up the system.

  To fix this, I cleared the IFF_UP flag before calling ether_ifdetach(),
  which stops the ioctl routine from trying to reset the chip.

- Modified comments in re_rxeof() relating to the difference in
  RX descriptor status bit layout between the 8139C+ and the gigE
  chips. The layout is different because the frame length field
  was expanded from 12 bits to 13, and they got rid of one of the
  status bits to make room.

- Add diagnostic code (re_diag()) to test for the case where a user
  has installed a broken 32-bit 8169 PCI NIC in a 64-bit slot. Some
  NICs have the REQ64# and ACK64# lines connected even though the
  board is 32-bit only (in this case, they should be pulled high).
  This fools the chip into doing 64-bit DMA transfers even though
  there is no 64-bit data path. To detect this, re_diag() puts the
  chip into digital loopback mode and sets the receiver to promiscuous
  mode, then initiates a single 64-byte packet transmission. The
  frame is echoed back to the host, and if the frame contents are
  intact, we know DMA is working correctly, otherwise we complain
  loudly on the console and abort the device attach. (At the moment,
  I don't know of any way to work around the problem other than
  physically modifying the board, so until/unless I can think of a
  software workaround, this will have do to.)

- Created re(4) man page

- Modified rlphy.c to allow re(4) to attach as well as rl(4).

Note that this code works for the sample 8169/Marvell 88E1000 NIC
that I have, but probably won't work for the 8169S/8110S chips.
RealTek has sent me some sample NICs, but they haven't arrived yet.
I will probably need to add an rlgphy driver to handle the on-board
PHY in the 8169S/8110S (it needs special DSP initialization).
2003-09-08 02:11:25 +00:00
Bruce Evans
4df0520624 clock.c:
Quick fix for calling DELAY() for ddb input in some (atkbd-based)
console drivers.  ddb must not use any normal locks, but DELAY()
normally calls getit() which needs clock_lock.  One problem with using
normal locks in ddb is that deadlock is possible, but deadlock on
clock_lock is unlikely becaluse clock_lock is bogusly recursive,
apparently just to hide the problem of ddb using it.  The i8254 clock
hardware has mostly write-only registers so it is important for it to
use a lock that gives exclusive access.  (atkbd hardware is also
unfriendly to reentrant software but that problem is more local and
already solved.)  I mostly saw the symptoms of the bug caused by
unlocking in getit() running cpu_unpend().  cpu_unpend() should not
be called while in ddb and Debugger() calls for failing assertions
about this caused a breakpoint within ddb.

ddb must also not call getit() because ddb may be being used to step
through clock initialization code that has stopped or otherwise mangled
the clock.  If the clock is stopped, then getit() always returns the
same value and DELAY() takes forever if it trusts getit().

The quick fix is implement DELAY(n) as (n * timer_freq / 1000000)
inb(0x84)'s if ddb is active.

machdep.c:
Don't permit recursion on clock_lock.
2003-09-07 14:23:08 +00:00
Bruce Evans
8aa1e716af Moved stop/start code for other CPUs to near the beginning/end of
kdb_trap().  Stopping the other CPUs acts like locking them out, but
it wasn't done early enough or held long enough to prevent concurrent
accesses to shared data.  In particular, the saved regs could be
clobbered.
2003-09-07 13:43:01 +00:00
Bruce Evans
2cf50c62a6 Restored non-egregious casts so that this file compiles on i386's with
64-bit longs again.
2003-09-07 13:23:45 +00:00
David Xu
75764c27a8 Turning on warning for static LDT allocation. 2003-09-07 05:23:28 +00:00
Peter Wemm
116b8c8695 Mark the isa compat shims for BURN_BRIDGES for 6.0 2003-09-05 14:55:11 +00:00
Peter Wemm
b324e86370 Clean up some antique stuff. We do not support Weitek FPUs etc, and never
did.
2003-09-05 14:54:26 +00:00
Poul-Henning Kamp
753374dad4 Give the ELAN timecounter better quality than i8254 2003-09-03 08:13:12 +00:00
Alexander Kabaev
1d49585050 Standardize idempotentcy ifdefs. Consistently use _MACHINE_VARARGS_H_
symbol.
2003-09-01 03:01:45 +00:00
Poul-Henning Kamp
f633e00615 Detect Geode CPUs and initialize the 27MHz timecounter "Geode".
This timecounter is 2usec faster than the i8254 and has 22 times
better resolution.
2003-08-31 16:20:34 +00:00
Alan Cox
411d10a600 Migrate the sf_buf allocator that is used by sendfile(2) and zero-copy
sockets into machine-dependent files.  The rationale for this
migration is illustrated by the modified amd64 allocator.  It uses the
amd64's direct map to avoid emphemeral mappings in the kernel's
address space.  On an SMP, the emphemeral mappings result in an IPI
for TLB shootdown for each transmitted page.  Yuck.

Maintainers of other 64-bit platforms with direct maps should be able
to use the amd64 allocator as a reference implementation.
2003-08-29 20:04:10 +00:00
Nate Lawson
ad1fdf57d2 Use the ACPICA AcpiEnterSleepStateS4bios instead of rolling our own. This
change also disables interrupts around non-S4 suspends whereas before we
did not do this.  Our version of AcpiEnterSleepStateS4bios was almost
identical to the ACPICA version.
2003-08-29 04:02:19 +00:00
John Baldwin
729d7ffbcf - Rename PCIx_HEADERTYPE* to PCIx_HDRTYPE* so the constants aren't so long.
- Add a new PCIM_HDRTYPE constant for the field in PCIR_HDRTYPE that holds
  the header type.
- Replace several magic numbers with appropriate constants for the header
  type register and a couple of PCI_FUNCMAX.
- Merge to amd64 the fix to the i386 bridge code to skip devices with
  unknown header types.

Requested by:	imp (1, 2)
2003-08-28 21:22:25 +00:00
Nate Lawson
cacbbaa703 Style cleanups. 2003-08-28 16:26:24 +00:00
David E. O'Brien
a7b60ab26e Fix copyright comment & FBSDID style nits.
Requested by:	bde
2003-08-25 09:48:48 +00:00
Yoshihiro Takahashi
f2a610fa25 Fix compile error. 2003-08-25 08:13:07 +00:00
Søren Schmidt
9250b177b5 Add device ataraid, this is now seperate and not pulled in by atadisk. 2003-08-24 09:30:13 +00:00
Warner Losh
afe1c7ba84 Even though this driver says it is broken, fix the location of the pci
include files.
2003-08-23 16:59:16 +00:00
Warner Losh
19b7ffd1b8 Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 07:20:27 +00:00
Alan Cox
3c5a69f7d0 Eliminate the last (direct) use of vm_page_lookup() on the pte object. 2003-08-22 05:49:29 +00:00
Alan Cox
1e584e46be Eliminate a possible race condition for multithreaded applications in
_pmap_allocpte(): Guarantee that the page table page is zero filled before
adding it to the directory.  Otherwise, a 2nd, 3rd, etc. thread could
access a nearby virtual address and use garbage for the address
translation.

Discussed with:	peter, tegge
2003-08-19 18:20:34 +00:00
Sam Leffler
d5882c1117 remove #define no longer used 2003-08-19 17:12:21 +00:00
John Baldwin
f13ba3ccc0 Add missing header include for MSR macros.
Submitted by:	bde
2003-08-18 17:01:04 +00:00
Alan Cox
90ca070d69 Acquire the pte object's mutex when performing vm_page_grab(). Note: It is
my long-term objective to eliminate the pte object.  In the near term, this
does, however, enable the addition of some vm object locking assertions.
2003-08-17 22:27:30 +00:00
Gordon Tetlow
df3d69c217 Fixup the ELF branding information to point to the new home of rtld. 2003-08-17 08:08:38 +00:00
Alan Cox
365b27ea29 In pmap_copy(), since we have the page table page's physical address
in hand, use PHYS_TO_VM_PAGE() rather than vm_page_lookup().
2003-08-17 04:48:21 +00:00
Marcel Moolenaar
710338e94f In vm_thread_swap{in|out}(), remove the alpha specific conditional
compilation and replace it with a call to cpu_thread_swap{in|out}().
This allows us to add similar code on ia64 without cluttering the
code even more.
2003-08-16 23:15:15 +00:00
Marcel Moolenaar
26502503e5 Further cleanup <machine/cpu.h> and <machine/md_var.h>: move the MI
prototypes of cpu_halt(), cpu_reset() and swi_vm() from md_var.h to
cpu.h. This affects db_command.c and kern_shutdown.c.

ia64: move all MD prototypes from cpu.h to md_var.h. This affects
madt.c, interrupt.c and mp_machdep.c. Remove is_physical_memory().
It's not used (vm_machdep.c).

alpha: the MD prototypes have been left in cpu.h with a comment
that they should be there. Moving them is left for later. It was
expected that the impact would be significant enough to be done in
a seperate commit.

powerpc: MD prototypes left in cpu.h. Comment added.

Suggested by: bde
Tested with: make universe (pc98 incomplete)
2003-08-16 16:57:57 +00:00
Poul-Henning Kamp
78a49a45bc Give timecounters a numeric quality field.
A timecounter will be selected when registered if its quality is
not negative and no less than the current timecounters.

Add a sysctl to report all available timecounters and their qualities.

Give the dummy timecounter a solid negative quality of minus a million.

Give the i8254 zero and the ACPI 1000.

The TSC gets 800, unless APM or SMP forces it negative.

Other timecounters default to zero quality and thereby retain current
selection behaviour.
2003-08-16 08:23:53 +00:00
Poul-Henning Kamp
8dcee923b5 remove acquire_timer0() and release_timer0() and related stuff. 2003-08-15 15:50:49 +00:00
John Baldwin
77f7a374d6 - Fix a typo in a comment.
- Use macros for MSR register indexes as well as the bitfields in the
  APICBASE MSR.
2003-08-15 15:25:19 +00:00
John Baldwin
6d84ef820f - Add macros describing some new MSR's in the Pentium 4 and some older
MSR's in the original Pentium.
- Add macros describing the bit fields in the APICBASE MSR.
2003-08-15 15:24:23 +00:00
John Baldwin
594dfbc391 - Fix a duplicated typo.
- Add a macro for the logical shift needed to extract an APIC ID from
  either from the local APIC ICR Hi register or the APIC ID registers of
  the local and IO APICs.
2003-08-15 15:23:13 +00:00
John Baldwin
426db9b60f - Remove redundant <sys/sysctl.h> include.
- Move the <machine/vm86.h> include up to the other <machine/*> includes.
2003-08-15 15:20:27 +00:00
John Baldwin
b37e8a903c Adjust the style of the #ifdef SMP in casuptr() so that the #ifdef SMP
just covers the lock prefix to match the existing style in other asm files
in i386.
2003-08-15 15:19:21 +00:00
John Baldwin
1b1a896518 - Update location of PCI headers.
- Use macros for PCI config registers instead of magic numbers.
- Small whitespace nits.
2003-08-15 15:18:29 +00:00
Poul-Henning Kamp
c43001fc56 As warned: Initiate deorbit burn for the pcaudio driver. 2003-08-15 14:56:05 +00:00
John Baldwin
606c689b95 Remove a few ushorts I missed in my earlier pass.
Requested by:	bde
2003-08-15 14:55:50 +00:00
Warner Losh
3cc12f33f4 Improve the C3 CPU identification. I didn't notice that the CPU id
was masked.  However KIMURA Yasuhiro-san noticed my mistake and was
kind enough to provide a better patch in PR 55581.  I've merged that
into the routine.  Hopefully I've not overlooked anything this time.

MFC After: 5 days
2003-08-15 06:02:24 +00:00
Warner Losh
0d210565df Add many new VIA C3 CPU types now that they appear to be available in
machines (at least in Japan).

Submitted by: Masahiko KIMOTO-san
PR: 55578
2003-08-14 15:17:49 +00:00
Alan Cox
d8df7ab7ea Eliminate pmap_page_lookup() and its uses. Instead, use PHYS_TO_VM_PAGE()
to convert the pte's physical address into a vm page.

Reviewed by:	peter
2003-08-14 05:18:38 +00:00
Warner Losh
06b4bf3e55 Expand inline the relevant parts of src/COPYRIGHT for Matt Dillon's
copyrighted files.

Approved by: Matt Dillon
2003-08-12 23:24:05 +00:00
John Baldwin
9bddab5c4b Fixup comment. 2003-08-12 20:20:23 +00:00
Paul Saab
77c39e17fa Halted CPU's should not accumulate time.
Reviewed by:	jhb
2003-08-12 17:01:10 +00:00
Paul Saab
f487e0e2df Fix the busdma support in twe to support EINPROGRESS and enable it for
use with PAE kernels.
2003-08-12 06:38:55 +00:00
Jacques Vidrine
e059b0f016 The iBCS2 system call translator for statfs(2) did not check the
length parameter for validity.

Submitted by:	David Rhodus <drhodus@catpa.com>
2003-08-10 23:26:16 +00:00
Jacques Vidrine
007e25d95a Add or correct range checking of signal numbers in system calls and
ioctls.

In the particular case of ptrace(), this commit more-or-less reverts
revision 1.53 of sys_process.c, which appears to have been erroneous.

Reviewed by:	iedowse, jhb
2003-08-10 23:04:55 +00:00
Alan Cox
ba97fd8a78 Rename pmap_changebit() to pmap_clear_ptes() and remove the last
parameter.  The new name better reflects what the function does and
how it is used.  The last parameter was always FALSE.

Note: In theory, gcc would perform constant propagation and dead code
elimination to achieve the same effect as removing the last parameter,
which is always FALSE.  In practice, recent versions do not.  So, there
is little point in letting unused code pessimize execution.
2003-08-10 21:53:55 +00:00
Warner Losh
1513d7ed42 Remove trailing newlines (from the right branch this time) 2003-08-07 04:33:47 +00:00
Alan Cox
2c2464cb27 Correct a mistake in the previous revision: Reduce the scope of the page
queues lock such that it isn't held around the call to get_pv_entry(),
which calls uma_zalloc().  At the point of the call to get_pv_entry(), the
lock isn't necessary and holding it could lead to recursive acquisition,
which isn't allowed.
2003-08-06 19:18:08 +00:00
Alan Cox
b0b2803a3b Acquire the page queues lock in pmap_insert_entry(). (I used to believe
that the page's busy flag could be relied upon to synchronize access to the
pv list.  I don't any longer.  See, for example, the call to
pmap_insert_entry() from pmap_copy().)
2003-08-06 18:46:47 +00:00
Bruce Evans
90630944c8 Backed out previous commit. This restores the warning about pessimized
(short) types for the port arg of inb() (rev.1.56).  The warning started
working for u_short types with gcc-3.3.  The pessimizations exposed
by this been fixed except for the cx and oltr drivers where the breakage
of the warning has been pushed to the drivers.
2003-08-06 18:21:27 +00:00
Poul-Henning Kamp
2fbc275447 Dont initialize a TSC timecounter until we know if it is broken or not. 2003-08-06 15:05:27 +00:00
Poul-Henning Kamp
f9e4b94aac Update to recognize Geode and note that the TSC seems broken. 2003-08-06 15:03:47 +00:00
Bruce Evans
1c5fa550e8 Broke the warning that the cx driver (cronyx.c, cx,c and if_cx.c) uses
pessimal (u_short) types for i/o ports.  I don't understand the data
structures in this driver well enough to unpessimize the types.
2003-08-06 11:05:42 +00:00
Bruce Evans
55a6f50b8d Don't use pessimal (u_short) types for i/o ports. This is mainly for
completenss.  The pessimization is tiny compared with i/o port slowness
except on very old machines, but code that used signed short types for
i/o ports was unpessimized long ago, and the macro that detected it
recently started working for u_short types too.  Use of bus space
should have made this moot long ago.

Not tested at runtime by:  bde
2003-08-05 20:11:50 +00:00
Scott Long
477327b5c5 In _bus_dmamap_load_buffer(), only count the number of bounce pages needed if
they haven't been counted before.  This test was ommitted when bus_dmamap_load()
was merged into this function, and results in the pagesneeded field growing
without bounds when multiple deferrals happen.

Thanks to Paul Saab for beating his head against this for a few hours =-)
2003-08-04 23:40:35 +00:00
John Baldwin
912133cbce - GC unused cpu_thread_link().
- Move the enabling of interrupts out of assembly and into C a few
  instructions later at cpu_critical_fork_exit().  This puts more of the
  MD critical section implementation under the MD critical section API
  making it easier to test and develop alternative implementations.
2003-08-04 20:34:25 +00:00
Julian Elischer
5774db75bd Allow foot shooting as Linux emulation needs it.
Also change "Auto mode" to use a "special" value
instead of 0, and define and document it.
I had thought libpthread had already been switched to use auto mode but
it appears that patch hasn't been committed yet.

Discussed with:	 Davidxu
2003-08-04 19:11:56 +00:00
David E. O'Brien
a98a5f06d3 Style sync. 2003-08-03 07:50:19 +00:00
Julian Elischer
e4e2c61313 fix braino in last commit.
Beaten with clue-stick by: Davidxu
2003-08-02 16:45:32 +00:00
Julian Elischer
f09fc81c31 Relax the check for bad LDTE allocations. It turns out that
there is code that blindly allocates LDTEs starting at slot 6
and I quess it doesn't really matter to us if they overwrite the BSDI
syscall slot, since it isn't a BSDI binary. Also add some code to help track
down other such users (commented out for now).

Reviewed by:	deischen@
2003-08-02 06:52:36 +00:00
Alan Cox
195d68e5af - Use kmem_alloc_nofault() rather than kmem_alloc_pageable() in
pmap_mapdev().  See revision 1.140 of kern/sys_pipe.c for a detailed
   rationale.  Submitted by: tegge
 - Remove GIANT_REQUIRED from pmap_mapdev().
2003-08-02 06:17:01 +00:00
Yoshihiro Takahashi
126ef7fcd6 PC98 uses different mask of IRQ. 2003-08-02 05:14:17 +00:00
Warner Losh
353adf7e7f The MI code was modified to filter the devices based on its header
type.  We know about header types 0, 1 and 2.  Ignore the rest in the
MD i386 code when we're looking for bridges.  You cannot look at the
vendor tag.  And if you don't you certainly can't look at function > 0
if the device isn't there.

The new soekris boards' GEODE cpu has issues with the old way.  This
is reported to have fixed it.

MFC After: 2 days
2003-08-01 21:50:09 +00:00
Warner Losh
e86bd39aab Add hw.pci.irq_override_mask, which is a mask of interrupts that are
considered to be good to try when it otherwise has no clue about which
interrupts to try.  This is a band-aide and we really should try to
balance the IRQs that we arbitrarily pick, but it should help some
people that would otherwise get bad IRQs.
2003-08-01 21:31:36 +00:00
Julian Elischer
1716a1af0d Have a go at unbreaking the tinderbox by fixing a debug printf.
The other option would be to remove it, but I can imagine it may be useful
for the forseeable future as we fiddle with segments in KSE and thr libraries,
2003-07-31 08:20:24 +00:00
Scott Long
e8d4f10982 Allocate the S/G list in the tag, not on the stack. The enforces the rule
that while many maps can exist and be loaded per tag, bus_dmamap_load() and
friends can only be called on one map at a time from the tag.  This is
enforced via the mutex arguments in the tag.

Fixing this bug means that s/g lists can be arbitrarily long in length, and
also removes an ugly GNU-ism from the code.  No API or ABI change is
incurred.  Similar changes for other platforms is forthcoming.
2003-07-31 05:34:20 +00:00
Bosko Milekic
b053bc8407 Make sure that when the PV ENTRY zone is created in pmap, that it's
created not only with UMA_ZONE_VM but also with UMA_ZONE_NOFREE.  In
the i386 case in particular, the pmap code would hook a special
page allocation routine that allocated from kernel_map and not kmem_map,
and so when/if the pageout daemon drained the zones, it could actually
push out slabs from the PV ENTRY zone but call UMA's default page_free,
which resulted in pages allocated from kernel_map being freed to
kmem_map; bad.  kmem_free() ignores the return value of the
vm_map_delete and just returns.  I'm not sure what the exact
repercussions could be, but it doesn't look good.

In the PAE case on i386, we also set-up a zone in pmap, so be
conservative for now and make that zone also ZONE_NOFREE and
ZONE_VM.  Do this for the pmap zones for the other archs too,
although in some cases it may not be entirely necessarily.  We'd
rather be safe than sorry at this point.

Perhaps all UMA_ZONE_VM zones should by default be also
UMA_ZONE_NOFREE?

May fix some of silby's crashes on the PV ENTRY zone.
2003-07-31 03:39:51 +00:00
David Xu
dae8d52de5 Enhance i386_set_ldt to allow application to dynamic allocate
or free a LDT entry. The function has following prototype:
  int i386_set_ldt(int start_sel, union descriptor *descs, int num_sels);

Added Features:
o If start_sel is 0, num_sels is 1 and the descriptor pointed to by descs
  is legal, then i386_set_ldt() will allocate a descriptor and return its
  selector numbe

o If num_descs is 1, start_sels is valid, and descs is NULL, then
  i386_set_ldt() will free that descriptor (making it available to be real-
  located again later).

o If num_descs is 0, start_sels is 0 and descs is NULL then, as a special
  case, i386_set_ldt() will free all descriptors.

Reviewed by: julian
2003-07-31 02:11:04 +00:00
Peter Wemm
9fb1db7bc8 Cosmetic: fix disorder of opt_kstack_pages.h include. 2003-07-31 01:26:40 +00:00
Bruce Evans
1734c95cec Fixed style bugs in rev.1.94 before MFCing it (for large C asm statements,
use "\n\" instead of "\" at the end of each source line, and don't use
semicolons).  Fixed some older style bugs on the same lines (mainly
English errors in comments).
2003-07-30 20:16:04 +00:00
Nate Lawson
a7985e4feb Use ACPI_FLUSH_CPU_CACHE() instead of wbinvd(). Verified .o with md5.
Pointed out by:	Mark Santcroos <marks@ripe.net>
2003-07-30 17:20:33 +00:00
Peter Wemm
f3d3771beb Detour via (void *) to defeat gcc's strict-aliasing warnings when using
-O2 or -Os (such as 'make release').

This commit brought to you by the warning:
  dereferencing type-punned pointer will break strict-aliasing rules
2003-07-30 00:04:58 +00:00
Bruce Evans
f52ecc3346 Restored clearing of the bss, except for putting it in a correct place
with up to date comments.  This fixes booting kernels with boot2
(except for loss of the features provided by loader) and is suitable
for MFC.  Contrary to the old comments, most loaders don't clear the bss.
biosboot lost clearing of the bss in a code crunch in 1997, and boot2
never did it.

kan didn't notice the problem with gcc-3.3 putting variables that are
initialized to 0 in the bss until after committing gcc-3.3 because he
was already using essentially this patch.  Before gcc-3.3, only the
non-critical `bootdev' variable was clobbered by clearing the bss.

MFC after:	3 days
2003-07-29 21:57:01 +00:00
Bruce Evans
011a891406 Don't hide the name of tmpstk, since there is no need to do so and the
HIDENAME() macro seems to be unimplementable in C.  (HIDENAME() used
to use invalid token pasting using ## for the STDC case until gcc
started rejecting that; now it uses unportable token pasting using
juxtaposition in all cases.)  This reduces use of HIDENAME() in the
kernel to only i386 and amd64 profiling code so that it doesn't bite
most kernels whenever gcc becomes stricter.  Problems with HIDENAME()
in userland are smaller because userland mostly doesn't use strict
flags yet.  There are some advantages to hiding the name of mcount,
but newer arches shouldn't do it; only amd64 does.

MFC after:	3 days

On second thoughts hide tmpstk better by staticizing it.
2003-07-29 11:44:31 +00:00
Robert Drehmel
266c520a5a Changed the data types of three index variables, two of them
in the `video_state' structure, to larger ones (from u_char to
u_short).  Each can now hold values at least as large as the
size of the array it is meant to point into.

This eliminates warnings printed by GCC 3.3.1 and hence makes
pcvt compilable using -Werror.
2003-07-27 14:01:33 +00:00
Maxime Henrion
d5afecd068 - Introduce a new busdma flag BUS_DMA_ZERO to request for zero'ed
memory in bus_dmamem_alloc().  This is possible now that
  contigmalloc() supports the M_ZERO flag.
- Remove the locking of Giant around calls to contigmalloc() since
  contigmalloc() now grabs Giant itself.
2003-07-27 13:52:10 +00:00
Poul-Henning Kamp
a8d43c90af Add a "int fd" argument to VOP_OPEN() which in the future will
contain the filedescriptor number on opens from userland.

The index is used rather than a "struct file *" since it conveys a bit
more information, which may be useful to in particular fdescfs and /dev/fd/*

For now pass -1 all over the place.
2003-07-26 07:32:23 +00:00
Poul-Henning Kamp
8b30546120 Stop GCC from whining when people use a 16 bit port number for inb() and outb() 2003-07-23 20:28:23 +00:00
Alan Cox
3462150083 Annotate pmap_changebit() as __always_inline. This function was
written as a template that when inlined is specialized for the caller
through constant value propagation and dead code elimination.  Thus,
the specialized code that is generated for pmap_clear_reference() et
al. avoids several conditional branches inside of a loop.
2003-07-23 19:49:32 +00:00
John Baldwin
e47d4f0fc2 Use macros from apic.h to when writing to the ICR to send IPIs to startup
APs rather than magic numbers.

Tested by:	scottl
2003-07-23 19:04:28 +00:00
John Baldwin
55fb372edd Add a new macro APIC_ICRLO_RESV_MASK that contains all of the reserved
fields in the low 32 bits of the local APIC ICR register.  Use this macro
in place of APIC_RESV2_MASK when masking off existing bits from the ICR
when writing to it to send an IPI.

Tested by:	scottl
2003-07-23 18:59:38 +00:00
Peter Wemm
461d4da338 Remove _ARCH_INDIRECT, it was the glue to enable having both hardware
and software versions of the floating point code in libm.  The runtime
selection was done by reading the hw.floatingpoint sysctl via
__get_hw_float().
2003-07-23 04:28:51 +00:00
Peter Wemm
a35b33869d Initiate de-orbit burn for fpu-less operation. 386+387 is still
theoretically supportable, but you'd really be happier with FreeBSD 2.1.8
on it.
2003-07-22 08:11:17 +00:00
Sam Leffler
721efab91e add safe driver until we can verify it as machine-independent 2003-07-21 21:51:24 +00:00
Peter Wemm
5d2fc474c5 Commit Ian Dowse's workaround for acpi resume resetting after the
LAZY_SWITCH changes.  He pointed out the acpi code sets up an identity
mapping in the current vmspace and that got messed up by the %cr3 being
out of sync with the current page directory.  As a workaround, restore
%cr3 across the sleep/resume.  A more complete fix would be to undo the
lazy state and clear the pm_active bit from the borrowed pmap, but this
works and people are currently hurting.  I'll clean this up.
This is mostly Ian's patch, plus a PAE tweak from me.
2003-07-21 20:59:27 +00:00
Robert Drehmel
fcaec66af7 Make the 80x60, 132x25, 132x43, 132x50, and 132x60 VESA text modes
work when using a graphics chipset which identifies itself as
`VIA CLE266', used in some VIA EPIA boards.  Two values need to be
patched in the VESA mode information structure: the widths of the modes
mentioned above are encoded in a format which was unknown to the VESA
module (and to my copy of the VBE spec.) whereas the window memory
segment values seem to be just incorrect.

I tested this on a VIA EPIA-M9000 and -M10000.
2003-07-18 00:06:10 +00:00
Scott Long
476755ab25 Now that the dust has settled, make dflt_lock() always panic. 2003-07-17 16:07:46 +00:00
David Xu
20a2d71332 Rename thread_siginfo to cpu_thread_siginfo.
Suggested by: jhb
2003-07-15 00:11:04 +00:00
Peter Wemm
74ed31bfc0 Fix the gcc-3.3 boot problem. Gcc now optimizes 'int foo = 0' by moving
it to the bss section and skips the initialization.  This causes all
sorts of havoc because the bogus bss zero code clobbered previously set
variables.  All our supported boot loaders already zero the bss, even
kgzip for the elf case.  Since we dont generate a.out kernels, the old
a.out bootblocks and the a.out kgzip are not a factor anymore.
2003-07-11 21:39:25 +00:00
Mark Murray
c7b132c974 Protect lint(1) from a #error. 2003-07-10 18:05:02 +00:00
Peter Wemm
e95babf3a8 unifdef -DLAZY_SWITCH and start to tidy up the associated glue. 2003-07-10 01:02:59 +00:00
Alan Cox
90a7c7b671 In pmap_object_init_pt(), the pmap_invalidate_all() should be performed on
the caller-provided pmap, not the kernel_pmap.  Using the kernel_pmap
results in an unnecessary IPI for TLB shootdown on SMPs.

Reviewed by:	jake, peter
2003-07-08 19:40:35 +00:00
David Xu
e2e8935832 Fix LOR between scheduler lock and SMP rendezvous lock.
Reviewed by: jhb
2003-07-08 00:14:30 +00:00
Brian S. Dean
fa8ee6aca1 Woops - don't forget to declare locals needed for that last commit. 2003-07-06 16:56:16 +00:00
Brian S. Dean
6745e78cee Don't unconditionally reset the hardware debug registers in cpu_exit(),
reset them only if they were previously in use.  Unconditionally
resetting the registers wipes them out frequently, which interferes
with their use for kernel debugging.

While I'm here, be less verbose in the associated comment of a
neighboring function.

Noticed by:	bde
2003-07-06 16:52:18 +00:00
Alan Cox
4041408f4f Add vm object locking to pmap_prefault(). 2003-07-04 22:13:39 +00:00
Alan Cox
1f78f902a8 Background: pmap_object_init_pt() premaps the pages of a object in
order to avoid the overhead of later page faults.  In general, it
implements two cases: one for vnode-backed objects and one for
device-backed objects.  Only the device-backed case is really
machine-dependent, belonging in the pmap.

This commit moves the vnode-backed case into the (relatively) new
function vm_map_pmap_enter().  On amd64 and i386, this commit only
amounts to code rearrangement.  On alpha and ia64, the new machine
independent (MI) implementation of the vnode case is smaller and more
efficient than their pmap-based implementations.  (The MI
implementation takes advantage of the fact that objects in -CURRENT
are ordered collections of pages.)  On sparc64, pmap_object_init_pt()
hadn't (yet) been implemented.
2003-07-03 20:18:02 +00:00
John Baldwin
5cc1a74e77 Silly compile fixes from resource_disabled() commit.
Reported by:	tinderbox
Pointy hat to:	jhb
2003-07-03 14:33:17 +00:00
John Baldwin
8a9bc9c03b - Use the new resource_disabled() helper function to see if devices are
disabled.
- Change the apm driver to match the acpi driver's behavior by checking to
  see if the device is disabled in the identify routine instead of in the
  probe routine.  This way if the device is disabled it is never created.

Note that a few places (ips(4), Alpha SMP) used "disable" instead of
"disabled" for their hint names, and these hints must be changed to
"disabled".  If this is a big problem, resource_disabled() can always be
changed to honor both names.
2003-07-02 16:09:02 +00:00
Maxime Henrion
331e012396 Sync more things with other backends. 2003-07-01 19:16:48 +00:00
Maxime Henrion
4813f72a9b Honor the boundary of the busdma tag when allocating bounce pages.
This was fixed in revision 1.5 of alpha/alpha/busdma_machdep.c and
was never fixed in other busdma backends using bounce pages.
2003-07-01 16:54:54 +00:00
Scott Long
f6b1c44d1f Mega busdma API commit.
Add two new arguments to bus_dma_tag_create(): lockfunc and lockfuncarg.
Lockfunc allows a driver to provide a function for managing its locking
semantics while using busdma.  At the moment, this is used for the
asynchronous busdma_swi and callback mechanism.  Two lockfunc implementations
are provided: busdma_lock_mutex() performs standard mutex operations on the
mutex that is specified from lockfuncarg.  dftl_lock() is a panic
implementation and is defaulted to when NULL, NULL are passed to
bus_dma_tag_create().  The only time that NULL, NULL should ever be used is
when the driver ensures that bus_dmamap_load() will not be deferred.
Drivers that do not provide their own locking can pass
busdma_lock_mutex,&Giant args in order to preserve the former behaviour.

sparc64 and powerpc do not provide real busdma_swi functions, so this is
largely a noop on those platforms.  The busdma_swi on is64 is not properly
locked yet, so warnings will be emitted on this platform when busdma
callback deferrals happen.

If anyone gets panics or warnings from dflt_lock() being called, please
let me know right away.

Reviewed by:	tmm, gibbs
2003-07-01 15:52:06 +00:00
Alan Cox
dca96f1adc - Export pmap_enter_quick() to the MI VM. This will permit the
implementation of a largely MI pmap_object_init_pt() for vnode-backed
   objects.  pmap_enter_quick() is implemented via pmap_enter() on sparc64
   and powerpc.
 - Correct a mismatch between pmap_object_init_pt()'s prototype and its
   various implementations.  (I plan to keep pmap_object_init_pt() as
   the MD hook for device-backed objects on i386 and amd64.)
 - Correct an error in ia64's pmap_enter_quick() and adjust its interface
   to match the other versions.  Discussed with: marcel
2003-06-29 21:20:04 +00:00
Jeff Roberson
ab875ef896 - Construct a cpu topology map for Hyper Threading systems so that ULE may
take advantage of them.
2003-06-28 22:07:42 +00:00
David Xu
b8f480ab94 Add a machine depended function thread_siginfo, SA signal code
will use the function to construct a siginfo structure and use
the result to export to userland.

Reviewed by: julian
2003-06-28 06:34:08 +00:00
Peter Wemm
eabd19726f Tidy up leftover lazy_switch instrumentation that is no longer needed.
This cleans up some #ifdef hell.
2003-06-27 22:39:14 +00:00
Peter Wemm
813b1b3df7 *groan*. I can't win today. Fix manual transcription error so that the
PAE ifdef is correct.

Pointy hat assigned by:  kan
2003-06-27 22:20:18 +00:00
Peter Wemm
48eceb6213 Make LAZY_SWITCH work with PAE 2003-06-27 22:13:30 +00:00
Peter Wemm
b50953ccfa Fix the false IPIs on smp when using LAZY_SWITCH caused by pmap_activate()
not releasing the pm_active bit in the old pmap.
2003-06-27 21:50:52 +00:00
Scott Long
3eaffdf7e0 Do the first and mostly mechanical step of adding mutex support to the
bus_dma async callback scheme.  Note that sparc64 does not seem to do
async callbacks.  Note that ia64 callbacks might not be MPSAFE at the
moment.  Note that powerpc doesn't seem to do async callbacks due to
the implementation being incomplete.

Reviewed by:	mostly silence on arch@
2003-06-27 08:31:48 +00:00
Poul-Henning Kamp
3b6d965263 Add a f_vnode field to struct file.
Several of the subtypes have an associated vnode which is used for
stuff like the f*() functions.

By giving the vnode a speparate field, a number of checks for the specific
subtype can be replaced simply with a check for f_vnode != NULL, and
we can later free f_data up to subtype specific use.

At this point in time, f_data still points to the vnode, so any code I
might have overlooked will still work.
2003-06-22 08:41:43 +00:00
Matthew N. Dodd
c27e9c5100 Implement a loader tunable/sysctl to allow the user to request that
the APM driver byte-swap battery time values.  (For broken laptops.)

PR:		i386/42439
Submitted by:	Bruce M Simpson <bms@spc.org>
2003-06-22 05:08:10 +00:00
John-Mark Gurney
b9d3718a18 fix another LP64 problem. READ_IVAR takes a pointer to an uintptr_t, not
an int.
2003-06-20 07:22:54 +00:00
David Xu
0e2a4d3aeb Rename P_THREADED to P_SA. P_SA means a process is using scheduler
activations.
2003-06-15 00:31:24 +00:00
Alan Cox
49a2507bd1 Migrate the thread stack management functions from the machine-dependent
to the machine-independent parts of the VM.  At the same time, this
introduces vm object locking for the non-i386 platforms.

Two details:

1. KSTACK_GUARD has been removed in favor of KSTACK_GUARD_PAGES.  The
different machine-dependent implementations used various combinations
of KSTACK_GUARD and KSTACK_GUARD_PAGES.  To disable guard page, set
KSTACK_GUARD_PAGES to 0.

2. Remove the (unnecessary) clearing of PG_ZERO in vm_thread_new.  In
5.x, (but not 4.x,) PG_ZERO can only be set if VM_ALLOC_ZERO is passed
to vm_page_alloc() or vm_page_grab().
2003-06-14 23:23:55 +00:00
Alan Cox
89f4fca265 Move the *_new_altkstack() and *_dispose_altkstack() functions out of the
various pmap implementations into the machine-independent vm.  They were
all identical.
2003-06-14 06:20:25 +00:00
Alan Cox
b26ce6a4b4 Add vm object locking to pmap_object_init_pt(). 2003-06-13 19:27:52 +00:00
Alan Cox
8630c1173e Add vm object locking to various pagers' "get pages" methods, i386 stack
management functions, and a u area management function.
2003-06-13 03:02:28 +00:00
Matthew N. Dodd
d7522df29c Conditionally attach the MCA bus device. 2003-06-13 00:43:57 +00:00
Matthew N. Dodd
cba6ce369d Despite my best efforts the Linux way of doing this is the only
way that works correctly.

- Remove unused function.
- Move declaration of variables to .S file.
2003-06-13 00:36:03 +00:00
Matt Jacob
132ba32ac2 Remove mpt from the nodevice list. This was tested by the submitter.
Submitted by:	Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp>
2003-06-12 17:11:01 +00:00
Peter Wemm
77e2a274d0 GC unused cpu_wait() function 2003-06-11 05:20:33 +00:00
David E. O'Brien
e9f0aa0360 Use __FBSDID(). 2003-06-10 05:05:54 +00:00
Juli Mallett
d196a10856 Note that scbus is required for SCSI, not just "required" in general.
Submitted by:	Edward Kaplan (tmbg37 on IRC)
Reviewed by:	rwatson (in principle)
2003-06-08 02:03:02 +00:00
John Baldwin
9dc9d63d01 Reinstate the bug fix in revision 1.2 as it is correct. The errors I saw
on my laptop after this change were the result of a bug in the ACPICA code.
2003-06-07 14:34:18 +00:00
John Baldwin
ba40a03417 - Rename nexus_pcib to legacy_pcib. I've been meaning to do this for a
while after the legacy device was added since this driver hangs from
  legacy and not nexus.
- Make several methods non-static so they can be reused in a mptable
  host -> pci bridge driver that will be added at a later date.
- Let legacy_pcib() use pcibios_pcib_route_interrupt() directly instead of
  wrapping it in a private function.  Originally, I thought I was going to
  have the nexus_pcib() driver make a runtime APIC vs. 8259A check and call
  the appropriate routing method (MPTable vs. PIR) that way, but it ended
  up being cleaner to make nexus_pcib() just work with PIR and have a
  separate host -> pci bridge driver for the mptable/apic case.
2003-06-06 17:56:30 +00:00
John Baldwin
6b9691f103 - Use IDTVEC() to declare IPI handlers since they are also IDT vectors.
- Make handlers for IPI's used by SMP kernels #ifdef SMP.
2003-06-06 17:45:25 +00:00
John Baldwin
cdd83b0ad1 Use the secondary bus number instead of the number of the bus the PCI-PCI
bridge lives on (i.e., the parent bus) when probing the PIR table for a
bus.  This could cause the PCIBIOS PCI-PCI bridge driver to bogusly attach
to bridges that weren't in the PIR but whose parent bus was in the PIR.
2003-06-06 17:27:18 +00:00
John Baldwin
e59ae32f18 - Document the thermal and performance counter LVT entries in the local
APIC.
- Add a lvt_thermal member to the LAPIC struct.
- Add constants for the SMI and INIT LVT delivery modes.
2003-06-06 17:22:15 +00:00
Marcel Moolenaar
11e0f8e16d Change the second (and last) argument of cpu_set_upcall(). Previously
we were passing in a void* representing the PCB of the parent thread.
Now we pass a pointer to the parent thread itself.
The prime reason for this change is to allow cpu_set_upcall() to copy
(parts of) the trapframe instead of having it done in MI code in each
caller of cpu_set_upcall(). Copying the trapframe cannot always be
done with a simply bcopy() or may not always be optimal that way. On
ia64 specifically the trapframe contains information that is specific
to an entry into the kernel and can only be used by the corresponding
exit from the kernel. A trapframe copied verbatim from another frame
is in most cases useless without some additional normalization.

Note that this change removes the assignment to td->td_frame in some
implementations of cpu_set_upcall(). The assignment is redundant.
A previous call to cpu_thread_setup() already did the exact same
assignment. An added benefit of removing the redundant assignment is
that we can now change td_pcb without nasty side-effects.

This change officially marks the ability on ia64 for 1:1 threading.

Not tested on: amd64, powerpc
Compile & boot tested on: alpha, sparc64
Functionally tested on: i386, ia64
2003-06-04 21:13:21 +00:00
John Baldwin
8375d3a4bc Bah, revert the previous commit for the time being due to inadequate testing
on my part.  The output asm looks correct with the previous commit in place
and it works on amd64, but on my laptop I got a spew of AE_BAD_PARAMETER
errors trying to unlock the acpi global lock.
2003-06-03 18:44:31 +00:00
John Baldwin
d234ea4e0b Fix the asm constraints so that we use the correct constants when acquiring
and releasing ACPI global locks instead of (ab)using the pointers to those
locks as the constants.  Also, rather than require that the address of
the lock be stored in a register, use a memory constraint allowing the
memory address to be used directly.

Noticed by:	peter
2003-06-03 14:46:16 +00:00
Tor Egge
c7251aede7 Initialize td->td_pcb->pcb_ext in cpu_thread_setup() since a garbage
value (e.g. 0xd0d0d0d0) can cause a kernel panic.
2003-06-02 20:43:28 +00:00
David E. O'Brien
71c5a90130 Use __FBSDID(). 2003-06-02 17:01:49 +00:00
David E. O'Brien
27e0099c4a Use __FBSDID(). 2003-06-02 16:56:40 +00:00
David E. O'Brien
006124d811 Use __FBSDID(). 2003-06-02 16:32:55 +00:00
David E. O'Brien
db31907c73 Use __FBSDID(). 2003-06-02 06:48:51 +00:00
David E. O'Brien
9676a785e7 Use __FBSDID(). 2003-06-02 06:43:15 +00:00
David E. O'Brien
cef2a2e364 Use __FBSDID(). 2003-06-02 06:16:45 +00:00
David E. O'Brien
0f0f21c394 Use __FBSDID(). 2003-06-02 06:02:49 +00:00
David E. O'Brien
8d19a0584b Don't use ## to concatinate to two things that don't together make a C token.
Two tokens that don't together form a vaid preprocssor token cannot be
pasted together using ANSI-C token concatinatation.  GCC 3.2's cpp, at least,
produces the desired result w/o using "##".
2003-06-02 02:41:38 +00:00
David E. O'Brien
69bb404192 Use C99 compatable asm statements. 2003-06-02 00:29:35 +00:00
David E. O'Brien
4b620ec03d Shorten long comment. 2003-06-01 20:28:20 +00:00
Poul-Henning Kamp
670966596b Remove unused variable(s).
Found by:       FlexeLint
2003-05-31 20:29:34 +00:00
Poul-Henning Kamp
618b80ddcf Avoid unbalancing the { } count in the source file with #ifdef by
putting the opening { after the #ifdef ... #endif sequence.

Found by:       FlexeLint
2003-05-31 20:25:53 +00:00
Poul-Henning Kamp
7d4220518e Remove break after return;
Found by:       FlexeLint
2003-05-31 20:24:30 +00:00
Poul-Henning Kamp
9a3454805e Don't rely on boolean expression evaluating to 1 or 0 by default.
Found by:       FlexeLint
2003-05-31 20:23:46 +00:00
Poul-Henning Kamp
8aa2b5ce7e We cannot use the normal strlen() and strcpy, but don't #define strlen and
strcpy to get private versions, use private versions directly.

Found by:       FlexeLint
2003-05-31 19:06:38 +00:00
Poul-Henning Kamp
76e4a2dc72 Add missing break;
Found by:       FlexeLint
2003-05-31 19:04:37 +00:00
Poul-Henning Kamp
c9e61fbb81 Protect macro with do { ... } while (0)
Found by:       FlexeLint
2003-05-31 19:04:07 +00:00
Poul-Henning Kamp
80fcafb161 Remove unused variable.
Found by:       FlexeLint
2003-05-31 19:03:20 +00:00
Poul-Henning Kamp
78b52202d0 Fix indentation.
Found by:       FlexeLint
2003-05-31 19:02:20 +00:00
Poul-Henning Kamp
e64f402ff1 Hang softc from dev_t 2003-05-31 18:56:58 +00:00
Poul-Henning Kamp
d6b602d4b2 Remove unused variable.
Found by:       FlexeLint
2003-05-31 18:55:18 +00:00
Poul-Henning Kamp
03841f4eec Eliminate potential overflows by allocating softc dynamically,
removing at the same time the need for this to be a "count" config
option.

Found by:       FlexeLint
2003-05-31 17:06:20 +00:00
Hiten Pandya
b77c32a07e Rename BUS_DMAMEM_NOSYNC to BUS_DMA_COHERENT.
The current name is confusing, because it indicates to
the client that a bus_dmamap_sync() operation is not
necessary when the flag is specified, which is wrong.

The main purpose of this flag is to hint the underlying
architecture that DMA memory should be mapped in a coherent
way, but the architecture can ignore it.  But if the
architecture does supports coherent mapping of memory, then
it makes bus_dmamap_sync() calls cheap.

This flag is the same as the one in NetBSD's Bus DMA.

Reviewed by: gibbs, scottl, des (implicitly)
Approved by: re@ (jhb)
2003-05-30 20:40:33 +00:00
Scott Long
7e71df9339 Bring back bus_dmasync_op_t. It is now a typedef to an int, though the
BUS_DMASYNC_ definitions remain as before.  The does not change the ABI,
and reverts the API to be a bit more compatible and flexible.  This has
survived a full 'make universe'.

Approved by:	re (bmah)
2003-05-27 04:59:59 +00:00
Scott Long
c87d464f28 De-orbit bus_dmamem_alloc_size(). It's a hack and was never used anyways.
No need for it to pollute the 5.x API any further.

Approved by:	re (bmah)
2003-05-26 04:00:52 +00:00
Paul Saab
3284b9ee87 Make ciss usable under PAE
Approved by:	re (scottl)
2003-05-21 07:17:06 +00:00
Paul Saab
487a8c7e61 - Make this work with PAE.
- atomically load and clear the status block so we dont miss an
  update.
  Submitted by: jdp

Approved by:	re (scottl)
2003-05-21 07:00:49 +00:00
John Baldwin
7f4725bd09 The per-CPU spinlocks list is only maintained when WITNESS is enabled.
Thus, treat all page faults while in a critical section as fatal rather
than just those that occur with a non-empty spinlocks list.  All such page
faults are fatal anyways.  Calling trap_fatal() earlier increases the
chances of getting more useful panic messages and a possible DDB prompt.

Approved by:	re (scottl)
2003-05-20 20:50:33 +00:00
Alexander Kabaev
980ded9a7d sys/sys/limits.h:
- Fix visibilty test for LONG_BIT and WORD_BIT.  `#if defined(__FOO_VISIBLE)'
   is alays wrong because __FOO_VISIBLE is always defined (to 0 for
   invisibility).

sys/<arch>/include/limits.h
sys/<arch>/include/_limits.h:

 - Style fixes.

Submitted by:	bde
Reviewed by:	bsdmike
Approved by:	re (scottl)
2003-05-19 20:29:07 +00:00
Ruslan Ermilov
517f3f1ae5 There's just no reason to not have these in GENERIC.
Found by:	release/*/drivers.conf cleaning script
Approved by:	re (scottl)
2003-05-18 20:39:15 +00:00
Thomas Moestl
a93b6bf5e9 In cpu_fork(), initialize pcb_psl for the new process to PSL_KERNEL,
instead of taking the (userland) eflags from the trap frame and masking
out PSL_I. There is no need to inherit any flags from the forking process;
the old method however can cause flags set in userland for the forking
process to be bogusly set in kernel mode when the newly forked process
runs for the first time (in particular PSL_T, which is set for userland
when the process is single-stepped; this would cause trace traps in
kernel mode).

Approved by:	re (jhb)
2003-05-16 01:10:33 +00:00
Alan Cox
4a0d6dfd2c Initialize logical_cpus_mask when the logical CPUs are enumerated in
the mptable.  (Previously, logical_cpus_mask was only initialized if
the hyperthreading fixup was executed.)

Approved by:	re (jhb)
Reviewed by:	ps
2003-05-15 05:12:24 +00:00
Juli Mallett
7bbf05a2c3 Clear up that COMPAT_43 may not do the same thing on every architecture
and clear up that COMPAT_SUNOS is similarly MI, and does something
relatively similar.

Approved by:	re/rwatson
2003-05-15 02:10:30 +00:00
John Baldwin
90af4afacb - Merge struct procsig with struct sigacts.
- Move struct sigacts out of the u-area and malloc() it using the
  M_SUBPROC malloc bucket.
- Add a small sigacts_*() API for managing sigacts structures: sigacts_alloc(),
  sigacts_free(), sigacts_copy(), sigacts_share(), and sigacts_shared().
- Remove the p_sigignore, p_sigacts, and p_sigcatch macros.
- Add a mutex to struct sigacts that protects all the members of the struct.
- Add sigacts locking.
- Remove Giant from nosys(), kill(), killpg(), and kern_sigaction() now
  that sigacts is locked.
- Several in-kernel functions such as psignal(), tdsignal(), trapsignal(),
  and thread_stopped() are now MP safe.

Reviewed by:	arch@
Approved by:	re (rwatson)
2003-05-13 20:36:02 +00:00
John Baldwin
dea7cce585 Add some extra #ifdef stubs so that this compiles on 4.8.
Approved by:	re (rwatson/bmah)
2003-05-13 16:59:46 +00:00
Matthew N. Dodd
598d45be84 Provide exec_linux_setregs() to override exec_setregs().
Linux initializes %gs to 0.  Mimic this behavior.

Submitted by:	 Christian Zander <zander@minion.de>
Reviewed by:	 jake
Approved by:	 re
2003-05-11 21:51:11 +00:00
Scott Long
1b20702e45 Add notes about the 'ips' driver. 2003-05-11 06:39:05 +00:00
John Baldwin
ace85d0a3c Style nits.
Approved by:	re (bmah)
2003-05-07 17:21:38 +00:00
Alexander Kabaev
0eda4c08a5 Style fixes.
Remove DBL_DIG, DBL_MIN, DBL_MAX and their FLT_ counterparts, they
were marked for deprecation ever since SUSv1 at least.
Only define ULLONG_MIN/MAX and LLONG_MAX if long long type is
supported.
Restore a lost comment in MI _limits.h file and remove it from
sys/limits.h where it does not belong.
2003-05-04 22:13:04 +00:00
Peter Wemm
cda4b241e2 Hack to enable getting two different elf32 and elf64 loaders in the
same i386 loader binary.
2003-05-01 03:46:12 +00:00
Peter Wemm
e7d32e949b <b30> is 'IA64' - ie: you're running on an ia64 in 32 bit mode. 2003-05-01 03:44:40 +00:00
Peter Wemm
7f47668191 Slight reorg and added AMD64 support. A couple of the MODINFOMD_* values
that were added to sparc64 and later powerpc, really should have been in
the MI area.  But changing that now with insufficient preperation will
just cause too much pain.

Move MD_FETCH() to the MI sys/linker.h file to avoid another two copies
of it.
2003-05-01 03:31:18 +00:00
Peter Wemm
4580c352e1 KPT_MIN_ADDRESS and KPT_MAX_ADDRESS are not used anywhere. And if they
were, they are not safe to use outside of the kernel since these values
can change at kernel compile time - ie: we do not want them compiled into
userland binaries.
2003-05-01 00:10:38 +00:00
John Baldwin
d90e753aa8 Range check the syscall number before looking it up in the syscallnames[]
array.

Submitted by:	pho
2003-04-30 17:59:27 +00:00
Mark Murray
51da11a27a Fix some easy, global, lint warnings. In most cases, this means
making some local variables static. In a couple of cases, this means
removing an unused variable.
2003-04-30 12:57:40 +00:00
Mark Murray
f17615daca Warns fixing. Protect against inappropriate linting, and mark
GCC-specific assemble code as such (in #ifdefs). Fix an easy
static variable warning while I'm here.
2003-04-30 12:23:58 +00:00
Alexander Kabaev
104a9b7e3e Deprecate machine/limits.h in favor of new sys/limits.h.
Change all in-tree consumers to include <sys/limits.h>

Discussed on:	standards@
Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
2003-04-29 13:36:06 +00:00
Jake Burkholder
14ce5bd49b Use inlines for loading and storing page table entries. Use cmpxchg8b for
the PAE case to ensure idempotent 64 bit loads and stores.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-28 20:35:36 +00:00
Warner Losh
1ba3f9e2da Update to reflect tw removal. 2003-04-27 05:35:10 +00:00
Warner Losh
5899148189 After careful review of this driver, I'm pretty sure it would take a
lot of work to make this driver work under current.  In the past when
people wanted to remove xten, I was the only one in the way.  After
talking to fsmp@ (last person to make real changes to this driver)
about this, I'm convinced it is better left in the dust-bin of history

Approved by: re@ (scottl)
2003-04-27 05:30:52 +00:00
Johan Karlsson
00ffb51ea5 Add nodevice axe, since usb isn't supported by PAE.
Submitted by:	harti@
Approved by:	jake@
2003-04-25 21:49:35 +00:00
John Baldwin
7ff022c485 - Push down Giant into the sysarch() calls that still need Giant.
- Standardize on EINVAL rather than EOPNOTSUPP if the sysarch op value is
  invalid.
2003-04-25 20:04:02 +00:00
Jake Burkholder
ffad008fcd Remove harmless invalid cast.
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-25 15:07:58 +00:00
Daniel Eischen
1328e1c4be Add an argument to get_mcontext() which specified whether the
syscall return values should be cleared.  The system calls
getcontext() and swapcontext() want to return 0 on success
but these contexts can be switched to at a later time so
the return values need to be cleared in the saved register
sets.  Other callers of get_mcontext() would normally want
the context without clearing the return values.

Remove the i386-specific context saving from the KSE code.
get_mcontext() is not i386-specific any more.

Fix a bad pointer in the alpha get_mcontext() code.  The
context was being bcopy()'d from &td->tf_frame, but tf_frame
is itself a pointer, so the thread was being copied instead.
Spotted by jake.

Glanced at by:  jake
Reviewed by:    bde (months ago)
2003-04-25 01:50:30 +00:00
Eric Anholt
42da33c444 Update the DRM to the latest from DRI CVS. Includes some bugfixes and removal
of the infrastructure for the gamma driver which was removed a while back.
The DRM_LINUX option is removed because the handler is now provided by the
linux compat code itself.
2003-04-25 01:18:47 +00:00
David Xu
e63c419732 Don't print anything for fault at cpu_switch_load_gs, just like other
code to recover fault in doreti because of invalid segment registers,
silently push error to userland.
2003-04-24 01:48:59 +00:00
Alexander Kabaev
6fd839f9c7 Add a new sys/limits.h file which in turn depends on machine/_limits.h
to get actual constant values. This is in preparation for machine/limits.h
retirement.

Discussed on:	standards@
Submitted by:	Craig Rodrigues <rodrigc@attbi.com>  (*)
Modified by:	kan
2003-04-23 21:41:59 +00:00
John Baldwin
eeec6bab2e Prefer the proc lock to sched_lock when testing PS_INMEM now that it is
safe to do so.
2003-04-22 20:01:56 +00:00
John Baldwin
fe8cdcae87 - Replace inline implementations of sigprocmask() with calls to
kern_sigprocmask() in the various binary compatibility emulators.
- Replace calls to sigsuspend(), sigaltstack(), sigaction(), and
  sigprocmask() that used the stackgap with calls to the corresponding
  kern_sig*() functions instead without using the stackgap.
2003-04-22 18:23:49 +00:00
David Xu
97637bcfb2 Move down intr level testing code a bit, cpu_switch_load_gs fault can be at
interrupt nested time.
2003-04-22 08:12:03 +00:00
David Xu
5515888875 Fix some problems for cpu_switch_load_gs. when fault address is at
cpu_switch_load_gs, cpu is in context switch, so don't enable interrupt.
because it is in context switch, it is expected sched_lock was held,
so don't PROC_LOCK(p) and psignal, it is LOR, probably we can
set a P_XSIGBUS like flag in p_sflags, and set TDF_ASTPENDING in
td_flags, in ast(), post a SIGBUS to process if P_XSIGBUS was set.
2003-04-22 07:45:47 +00:00
David Xu
5b70587b8a Remove single threading detecting code, these code really should be
replaced by thread_user_enter(), but current we don't want to enable
this in trap.
2003-04-22 03:17:41 +00:00
Hidetoshi Shimokawa
092cd06fcd Add FireWire drivers to GENERIC. 2003-04-21 16:44:05 +00:00
David E. O'Brien
40373d8796 Assembly files put thru the C preprocessor need to have C style comments. 2003-04-21 16:30:12 +00:00
David Xu
6625036082 Reset pcb_gs and %gs before possibly invalidating it. 2003-04-21 15:05:05 +00:00
Bill Paul
87b4a25958 Add device driver support for the ASIX Electronics AX88172 USB 2.0
ethernet controller. The driver has been tested with the LinkSys
USB200M adapter. I know for a fact that there are other devices out
there with this chip but don't have all the USB vendor/device IDs.

Note: I'm not sure if this will force the driver to end up in the
install kernel image or not. Special magic needs to be done to exclude
it to keep the boot floppies from bloating again, someone please
advise.
2003-04-20 19:05:33 +00:00
David Xu
d1fc2022c3 Backout my last commit.
Requested by: bde
2003-04-20 01:35:21 +00:00
David Xu
2bdf11638e Don't return garbage in high 16 bits. 2003-04-19 02:40:39 +00:00
John Baldwin
9eb78fcfd9 Synchronize the two linux_clone() implementations which includes a few
minor cleanups in both.
2003-04-18 20:54:41 +00:00
John Baldwin
889a6b5845 Use the proc lock to protect p_singlethread and a P_WEXIT test. This
fixes a couple of potential KSE panics on non-i386 arch's that weren't
holding the proc lock when calling thread_exit().
2003-04-18 20:20:00 +00:00
John Baldwin
ee6c1d2ed2 Hold the proc lock for curproc around sigonstack(). 2003-04-18 20:09:04 +00:00
John Baldwin
aff1d36ceb Add some missing proc mutex unlocks. 2003-04-17 22:19:47 +00:00
John Baldwin
e5567180fb Don't drop the proc lock just to reacquire it after a few simple assignment
statements.  Just hold the lock the entire time.
2003-04-17 22:18:07 +00:00
John Baldwin
8365f5bf7c Remove a couple of unused symbols. 2003-04-17 22:17:28 +00:00
Poul-Henning Kamp
a300701213 Don't include <sys/disklabel.h> 2003-04-16 20:57:35 +00:00
Matthew N. Dodd
2836b6d03e - Set if_unit, if_init, and ifq_maxlen.
- Remove unnecessary initializations; ether_ifattach() takes care of them.
- Change function argument types to avoid nasty casts.
2003-04-16 06:27:39 +00:00
John Baldwin
f265002902 Sync up with changes to ptrace() and use P_SHOULDSTOP instead of
a duplicate P_TRACED check.

Submitted by:	marcel
2003-04-15 16:29:39 +00:00
Maxime Henrion
0cb112309a style(9) 2003-04-15 03:11:03 +00:00
Hidetoshi Shimokawa
c8990f0d8e Restore delayed load support for the resource shortage case.
It was missed in the previous change.
Now, _bus_dmamap_load_buffer() accepts BUS_DMA_WAITOK/BUS_DMA_NOWAIT flags.

Original idea from: jake
2003-04-14 13:21:40 +00:00
Hidetoshi Shimokawa
f5270431be * Use _bus_dmamap_load_buffer() and respect maxsegsz in bus_dmamap_load().
Ignoring maxsegsz may lead to fatal data corruption for some devices.
ex. SBP-2/FireWire
We should apply this change to other platforms except for sparc64.

MFC after: 1 week
2003-04-14 04:19:42 +00:00
David Xu
2257a44ffd Copy %gs from current CPU not from a stale PCB backup. 2003-04-11 14:47:34 +00:00
David Xu
d8c586e73a set_user_ldt_rv() should check same proc not thread,
this commit fixes an user LDT smp rendezvous bug.
2003-04-11 14:45:07 +00:00
Dag-Erling Smørgrav
0da46d776b Convert the SMP_TSC kernel option into a loader tunable. Also enable
the TSC timecounter on single-CPU systems even when they are running
an SMP kernel.
2003-04-10 23:07:24 +00:00
Maxime Henrion
141bacb048 Change the operation parameter of bus_dmamap_sync() from an
enum to an int and redefine the BUS_DMASYNC_* constants as
flags.  This allows us to specify several operations in one
call to bus_dmamap_sync() as in NetBSD.
2003-04-10 23:03:33 +00:00
Julian Elischer
060563ec50 Move the _oncpu entry from the KSE to the thread.
The entry in the KSE still exists but it's purpose will change a bit
when we add the ability to lock a KSE to a cpu.
2003-04-10 17:35:44 +00:00
Wes Peters
c2ff1e1682 Add a sysctl that records and reports the CPU clock rate calculated
at boot.  Funny how often this trivial piece of information crops up
in embedded boxen.

Sponsored by:   St. Bernard Software
2003-04-10 07:05:24 +00:00
Jake Burkholder
87b91b10ef Add ahd. 2003-04-09 14:58:28 +00:00
Jake Burkholder
ac00210525 Remove invalid cast to vm_offset_t to avoid truncating a physical address
when doing pmap_kextract on a 2MB page.

Spotted by:	peter
Sponsored by:	DARPA, Network Associates Laboratories
2003-04-08 18:22:41 +00:00
Jake Burkholder
a3b3689ff3 Add a PAE kernel config. This includes GENERIC through the config include
mechanism, and then excludes device drivers which have not been tested or
are known to not work with more than 4G of ram.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-07 16:23:14 +00:00
Jake Burkholder
fce2287796 Add support for bounce buffers to _bus_dmamap_load_buffer, which is the
backend for bus_dmamap_load_mbuf and bus_dmamap_load_uio.

- Increaes MAX_BPAGES to 512.  Less than this causes fxp to quickly runs out
  of bounce pages.
- Add an argument to reserve_bounce_pages indicating wether this operation
  should fail or be queued for later processing if we run out of memory.
  The EINPROGRESS return value is not handled properly by consumers of
  bus_dmamap_load_mbuf.
- If bounce buffers are required allocate minimum 1 bounce page at map
  creation time.  If maxsize was small previously this could get truncated
  to 0 and the drivers would quickly run out of bounce pages.
- Fix a bug handling the return value of alloc_bounce_pages at map creation
  time.  It returns the number of pages allocated, not 0 on success.
- Use bus_addr_t for physical addresses to avoid truncation.
- Assert that the map is non-null and not the no bounce map in
  add_bounce_pages.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-07 16:08:32 +00:00
Jake Burkholder
46ea68dd10 Better fix for previous previous which still allows the 4megs of kva at
the top of the address space to be reclaimed.  The problem is that with
the APTD gone the mapable kernel address space runs right to the end of
the 32 bit address space.  As a max this is 0x100000000, which can't be
represented in 32 bits, so we have to use ptd entry n-1 and pte offset
n-1, instead of ptd entry n and pte offset 0.  There's still 1 page we
can't use, but we gain just under 4 megs of kva (8 megs with PAE).

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-07 14:27:19 +00:00
Matthew N. Dodd
acdf797d1a Retire these files. 2003-04-07 01:25:40 +00:00
Dag-Erling Smørgrav
093395d3d5 Initialize the PIIX timecounter in piix_attach(), which is called only
once, instead of doing it in piix_probe(), which is called every time
the PCI bus is rescanned.
2003-04-06 18:42:22 +00:00
Peter Wemm
c81e825f6c Unbreak the !LAZY_SWITCH case. I #ifdef'ed too much when I added
the ifdefs prior to commit and killed the same-address-space test.

Submitted by:	bde
2003-04-05 22:18:14 +00:00
Olivier Houchard
18a6505b16 Use vm_paddr_t instead of vm_offset_t for the paddr parameter of vesa_mmap. 2003-04-05 18:08:22 +00:00
Tor Egge
fd6d48b8e8 Add SMP_TSC option, which can be used on SMP systems where the TSCs
are synchronized to reduce context switch cost.
2003-04-04 23:54:46 +00:00
Dag-Erling Smørgrav
9f45b2da8f Define ovbcopy() as a macro which expands to the equivalent bcopy() call,
to take care of the KAME IPv6 code which needs ovbcopy() because NetBSD's
bcopy() doesn't handle overlap like ours.

Remove all implementations of ovbcopy().

Previously, bzero was a function pointer on i386, to save a jmp to
bzero_vector.  Get rid of this microoptimization as it only confuses
things, adds machine-dependent code to an MD header, and doesn't really
save all that much.

This commit does not add my pagezero() / pagecopy() code.
2003-04-04 17:29:55 +00:00
Poul-Henning Kamp
197e5e73ef Libdisk does not need to include <sys/diskslice.h> any more.
Move the remaining bits of <sys/diskslice.h> to <i386/include/bootinfo.h>

Move i386/pc98 specific bits from <sys/reboot.h> to
<i386/include/bootinfo.h> as well.

Adjust includes in sys/boot accordingly.
2003-04-04 16:35:16 +00:00
Jake Burkholder
d1d03c2b72 Bandaid fix for previous commit while I figure out why it broke. This
caused crashes early in boot on i386 UP machines.

Reported by:	phk
Pointy hat to:	jake
2003-04-04 10:09:44 +00:00
Jake Burkholder
163529c2b3 - Removed APTD and associated macros, it is no longer used.
BANG BANG BANG etc.

Sponsored by:	DARPA, Network Associates Laboratories
2003-04-03 23:44:35 +00:00
Peter Wemm
cc66ebe2a9 Commit a partial lazy thread switch mechanism for i386. it isn't as lazy
as it could be and can do with some more cleanup.  Currently its under
options LAZY_SWITCH.  What this does is avoid %cr3 reloads for short
context switches that do not involve another user process.  ie: we can
take an interrupt, switch to a kthread and return to the user without
explicitly flushing the tlb.  However, this isn't as exciting as it could
be, the interrupt overhead is still high and too much blocks on Giant
still.  There are some debug sysctls, for stats and for an on/off switch.

The main problem with doing this has been "what if the process that you're
running on exits while we're borrowing its address space?" - in this case
we use an IPI to give it a kick when we're about to reclaim the pmap.

Its not compiled in unless you add the LAZY_SWITCH option.  I want to fix a
few more things and get some more feedback before turning it on by default.

This is NOT a replacement for Bosko's lazy interrupt stuff.  This was more
meant for the kthread case, while his was for interrupts.  Mine helps a
little for interrupts, but his helps a lot more.

The stats are enabled with options SWTCH_OPTIM_STATS - this has been a
pseudo-option for years, I just added a bunch of stuff to it.

One non-trivial change was to select a new thread before calling
cpu_switch() in the first place.  This allows us to catch the silly
case of doing a cpu_switch() to the current process.  This happens
uncomfortably often.  This simplifies a bit of the asm code in cpu_switch
(no longer have to call choosethread() in the middle).  This has been
implemented on i386 and (thanks to jake) sparc64.  The others will come
soon.  This is actually seperate to the lazy switch stuff.

Glanced at by:  jake, jhb
2003-04-02 23:53:30 +00:00
Jake Burkholder
cef57e7624 - Make casuptr return the old value of the location we're trying to update,
and change the umtx code to expect this.

Reviewed by:	jeff
2003-04-02 08:02:27 +00:00
Poul-Henning Kamp
09bf42f50f Don't include <sys/buf.h> needlessly. 2003-04-01 09:02:58 +00:00
Jeff Roberson
b8db34d280 - Define a new md function 'casuptr'. This atomically compares and sets
a pointer that is in user space.  It will be used as the basic primitive
   for a kernel supported user space lock implementation.
 - Implement this function in x86's support.s
 - Provide stubs that return -1 in all other architectures.  Implementations
   will follow along shortly.

Reviewed by:	jake
2003-04-01 00:18:55 +00:00
Jeff Roberson
fb8aaa76c7 - In npxgetregs() use the td argument to save the fpu state from and not
curthread.  Nothing currently depends on this behavior.
 - Clean up an extra newline.

Obtained from:	bde
2003-04-01 00:16:32 +00:00
Jeff Roberson
4093529dee - Move p->p_sigmask to td->td_sigmask. Signal masks will be per thread with
a follow on commit to kern_sig.c
 - signotify() now operates on a thread since unmasked pending signals are
   stored in the thread.
 - PS_NEEDSIGCHK moves to TDF_NEEDSIGCHK.
2003-03-31 22:49:17 +00:00
Jeff Roberson
a35394bd84 - Fix two calls to trapsignal() that were still passing in 'struct proc'.
These were missed in my last commit.
2003-03-31 22:41:32 +00:00
Jeff Roberson
1bf4700bff - Change trapsignal() to accept a thread and not a proc.
- Change all consumers to pass in a thread.

Right now this does not cause any functional changes but it will be important
later when signals can be delivered to specific threads.
2003-03-31 22:02:38 +00:00
Jeff Roberson
4c8a7679d0 - In npxsetregs don't set the floating point if td == fpcurthread not if
curthread == fpcurthread.  This is important when we're saving the fp
   state for a thread other than curthread as in from set_mcontext.
2003-03-31 00:32:43 +00:00
Jake Burkholder
7ab9b220d9 - Add support for PAE and more than 4 gigs of ram on x86, dependent on the
kernel opition 'options PAE'.  This will only work with device drivers which
  either use busdma, or are able to handle 64 bit physical addresses.

Thanks to Lanny Baron from FreeBSD Systems for the loan of a test machine
with 6 gigs of ram.

Sponsored by:	DARPA, Network Associates Laboratories, FreeBSD Systems
2003-03-30 05:24:52 +00:00
Jake Burkholder
de54353fb8 - Remove invalid casts.
Sponsored by:	DARPA, Network Associates Laboratories
2003-03-30 01:44:16 +00:00
Jake Burkholder
aea57872f0 - Convert all uses of pmap_pte and get_ptbase to pmap_pte_quick. When
accessing an alternate address space this causes 1 page table page at
  a time to be mapped in, rather than using the recursive mapping technique
  to map in an entire alternate address space.  The recursive mapping
  technique changes large portions of the address space and requires global
  tlb flushes, which seem to cause problems when PAE is enabled.  This will
  also allow IPIs to be avoided when mapping in new page table pages using
  the same technique as is used for pmap_copy_page and pmap_zero_page.

Sponsored by:	DARPA, Network Associates Laboratories
2003-03-30 01:16:19 +00:00
Matthew N. Dodd
50e960d918 - Move driver to newbus.
- Provide identify methods for EtherExpress and 3c507 cards; this
  means these cards no longer need wired configs.
- Provide a detach method.
2003-03-29 13:36:41 +00:00
Matthew N. Dodd
3330d5fb09 - Change ELINK_ID_PORT; the 3c507 likes 0x100 better.
- Add module metadata.
2003-03-29 13:18:20 +00:00
John Baldwin
0f9d6538bb Add missing includes from previous commit.
Reported by:	des
2003-03-27 18:18:35 +00:00
Paul Saab
90836fcf7d Nuke HTT from here too.
Spotted by:	jhb
2003-03-26 19:55:03 +00:00
Paul Saab
87437b0b89 Nuke options HTT infavor of machdep.hlt_logical_cpus tunable/sysctl.
This keeps the logical cpu's halted in the idle loop.  By default
the logical cpu's are halted at startup.  It is also possible to
halt any cpu in the idle loop now using machdep.hlt_cpus.

Examples of how to use this:
machdep.hlt_cpus=1	halt cpu0
machdep.hlt_cpus=2	halt cpu1
machdep.hlt_cpus=4	halt cpu2
machdep.hlt_cpus=3	halt cpu0,cpu1

Reviewed by:	jhb, peter
2003-03-26 19:49:34 +00:00
Peter Wemm
bb9cca1c2f Halt the cpus in the idle loop for SMP as well for several reasons:
1) Its critical for HTT.  There's less foot-shooting opportunity.
2) I've seen significant improvements in interactive response to commands
over ssh sessions.  I assume this is less lock contention.
3) As incentive to finish the idle cpu IPI wakeup stuff.
4) The machine on my desk was blowing hot air in my general direction
because somebody forgot to turn the hlt on, and it saves 50 watts per
cpu..

The machdep.cpu_idle_hlt sysctl is still available, but now the default
is the same as on UP kernels.
2003-03-26 19:40:29 +00:00
John Baldwin
35eb8c5aa2 Add a cleanup function to destroy the osname_lock and call it on module
unload.

Submitted by:	gallatin
Reported by:	Martin Karlsson <mk-freebsd@bredband.net>
2003-03-26 18:29:44 +00:00
John Baldwin
84b7dcad85 Add an options entry for HTT in SMP and GENERIC similar to the SMP and
APIC_IO options.

Requested by:	John Cagle <john.cagle@hp.com>
2003-03-25 23:31:14 +00:00
John Baldwin
c0109e50ec Put a newline in between APIC_IO and HTT to try and show that HTT is not
mandatory.
2003-03-25 23:29:44 +00:00
Matthew N. Dodd
91d631e536 Print the return value from mmap() in the DEBUG case. 2003-03-25 20:02:55 +00:00
Matthew N. Dodd
94c35e0af2 Merge PC98 support. 2003-03-25 05:19:18 +00:00
Jake Burkholder
227f9a1c58 - Add vm_paddr_t, a physical address type. This is required for systems
where physical addresses larger than virtual addresses, such as i386s
  with PAE.
- Use this to represent physical addresses in the MI vm system and in the
  i386 pmap code.  This also changes the paddr parameter to d_mmap_t.
- Fix printf formats to handle physical addresses >4G in the i386 memory
  detection code, and due to kvtop returning vm_paddr_t instead of u_long.

Note that this is a name change only; vm_paddr_t is still the same as
vm_offset_t on all currently supported platforms.

Sponsored by:	DARPA, Network Associates Laboratories
Discussed with:	re, phk (cdevsw change)
2003-03-25 00:07:06 +00:00
Matthew N. Dodd
257427efe3 Retire sys/pc98/pc98/spkr.c 2003-03-24 21:01:54 +00:00
Matthew N. Dodd
1352a54255 Use __packed; 2003-03-24 20:44:39 +00:00