Commit Graph

9431 Commits

Author SHA1 Message Date
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