Commit Graph

10201 Commits

Author SHA1 Message Date
Poul-Henning Kamp
c711aea6ca Make a bunch of malloc types static.
Found by:	src/tools/tools/kernxref
2005-02-10 12:02:37 +00:00
Warner Losh
969eaf2179 Break out obscure ISA cards into their own files, as well as ne2000
and wd80x3 support.  Make the obscure ISA cards optional, and add
those options to NOTES on i386 (note: the ifdef around the whole code
is for module building).  Tweak pc98 ed support to include wd80x3 too.
Add goo for alpha too.

The affected cards are the 3Com 3C503, HP LAN+ and SIC (whatever that
is).  I couldn't find any of these for sale on ebay, so they are
untested.  If you have one of these cards, and send it to me, I'll
ensure that you have no future problems with it...

Minor cleanups as well by using functions rather than cut and paste
code for some probing operations (where the function call overhead is
lost in the noise).

Remove use of kvtop, since they aren't required anymore.  This driver
needs to get its memory mapped act together, however, and use bus
space.  It doesn't right now.

This reduces the size of if_ed.ko from about 51k to 33k on my laptop.
2005-02-09 20:03:40 +00:00
Pawel Jakub Dawidek
647ceb6a94 - Add debug.watchdog tunable, so we can specify watchdog CPU from loader
which will help to debug hangs on boot.
- Remove 'U' from debug.watchdog sysctl definition, so if we set it to '-1'
  it really shows '-1'.
- Fix comment.

Reviewed by:	rwatson
2005-02-08 22:15:24 +00:00
John Baldwin
e8ce55117b Use the local APIC timer to drive the various kernel clocks on SMP machines
rather than forwarding interrupts from the clock devices around using IPIs:
- Add an IDT vector that pushes a clock frame and calls
  lapic_handle_timer().
- Add functions to program the local APIC timer including setting the
  divisor, and setting up the timer to either down a periodic countdown
  or one-shot countdown.
- Add a lapic_setup_clock() function that the BSP calls from
  cpu_init_clocks() to setup the local APIC timer if it is going to be
  used.  The setup uses a one-shot countdown to calibrate the timer.  We
  then program the timer on each CPU to fire at a frequency of hz * 3.
  stathz is defined as freq / 23 (hz * 3 / 23), and profhz is defined as
  freq / 2 (hz * 3 / 2).  This gives the clocks relatively prime divisors
  while keeping a low LCM for the frequency of the clock interrupts.
  Thanks to Peter Jeremy for suggesting this approach.
- Remove the hardclock and statclock forwarding code including the two
  associated IPIs.  The bitmap IPI handler has now effectively degenerated
  to just IPI_AST.
- When the local APIC timer is used we don't turn the RTC on at all, but
  we still enable interrupts on the ISA timer 0 (i8254) for timecounting
  purposes.
2005-02-08 20:25:07 +00:00
John Baldwin
0ba59a6f70 - Implement ibcs2_emul_find() using kern_alternate_path(). This changes
the semantics in that the returned filename to use is now a kernel
  pointer rather than a user space pointer.  This required changing the
  arguments to the CHECKALT*() macros some and changing the various system
  calls that used pathnames to use the kern_foo() functions that can accept
  kernel space filename pointers instead of calling the system call
  directly.
- Use kern_open(), kern_access(), kern_execve(), kern_mkfifo(), kern_mknod(),
  kern_setitimer(), kern_getrusage(), kern_utimes(), kern_unlink(),
  kern_chdir(), kern_chmod(), kern_chown(), kern_symlink(), kern_readlink(),
  kern_select(), kern_statfs(), kern_fstatfs(), kern_stat(), kern_lstat(),
  kern_fstat().
- Drop the unused 'uap' argument from spx_open().
- Replace a stale duplication of vn_access() in xenix_access() lacking
  recent additions such as MAC checks, etc. with a call to kern_access().
2005-02-07 22:02:18 +00:00
John Baldwin
0311233ecc Use linux_emul_convpath() rather than linux_emul_find() as
linux_emul_find() is going away.
2005-02-07 18:37:51 +00:00
John Baldwin
d9e9747163 Use the LCONVPATHEXIST() macro rather than it's exact expansion to be
consistent.
2005-02-07 18:37:13 +00:00
Maxim Sobolev
aab8b1b55f Fix the problem with incorrect throttling level reported immediately after
reboot. Safter the reboot the TCC is usually in the Automatic mode, in which
reading current performance level is likely to produce bogus results make sure
to switch it to the On-Demand mode and set to some known performance level.
Unfortunately there is no reliable way to check that TCC is in the Automatic
mode. Reading bit 4 of ACPI Thermal Monitor Control Register produces 0
regardless of the current mode.

MFC after:	1 week
2005-02-07 11:35:24 +00:00
David Schultz
2a51b9b0aa When running Linux binaries, set up the initial FPU state as Linux
would.

PR:	28966
2005-02-06 17:29:20 +00:00
Poul-Henning Kamp
0c3c54da63 Since we are quite unlikely to ever face another platform which
uses the i8237 without trying to emulate the PC architecture move
the register definitions for the i8237 chip into the central include
file for the chip, except for the PC98 case which is magic.

Add new isa_dmatc() function which tells us as cheaply as possible
if the terminal count has been reached for a given channel.
2005-02-06 13:46:39 +00:00
Nate Lawson
3045c8af3f Staticize the legacy cpu devclasses and revert the name for the acpi_cpu
devclass.  As pointed out by dfr@, devclasses don't have to share the same
linkage if multiple drivers have the same name.  Newbus should match the
devclasses based on name and allocate non-conflicting unit numbers.
2005-02-06 07:36:08 +00:00
Nate Lawson
3888a87205 Finish the job of sorting all includes and fix the build by including
malloc.h before proc.h on sparc64.  Noticed by das@

Compiled on:	alpha, amd64, i386, pc98, sparc64
2005-02-06 01:55:08 +00:00
Nate Lawson
959c26396c Make cpu_est_clockrate() more accurate by disabling interrupts for the
millisecond it is calibrating.  Suggested by jhb@ and bde@.  Don't clobber
the tsc_freq with the new value since it isn't accurate enough for
timecounters and the timecounter system as a whole needs support for
changing rates before we do this.  Subtract 0.5% from our measurement
to account for overhead in DELAY.  Note that this interface is for
estimating the clockrate and needs to work well at runtime so doing a full
calibration including disabling interrupts for a second is not feasible.
2005-02-05 23:16:27 +00:00
Nate Lawson
69bc96f231 Build cpufreq and acpi_perf on platforms that are likely to be able to
use them.
2005-02-05 21:01:09 +00:00
Alan Cox
fb1b26da19 Implement proper handling of PG_G mappings in pmap_protect(). (I don't
believe that this omission mattered before the introduction of MemGuard.)

Reviewed by: tegge@
MFC after: 1 week
2005-02-05 19:21:54 +00:00
Yoshihiro Takahashi
f787023e5a Fix pc98 support (broken by previous change). 2005-02-04 13:37:21 +00:00
Nate Lawson
98aa9cd052 Update the CPU attachments to return CPU_IVAR_PCPU as well as pass on
appropriate requests to any children.
2005-02-04 05:36:40 +00:00
Nate Lawson
4c4381e288 Add an implementation of cpu_est_clockrate(9). This function estimates the
current clock frequency for the given CPU id in units of Hz.
2005-02-04 05:32:56 +00:00
Scott Long
176a8c17c6 Remove the entries for isp and ispfw instead of leaving them in an inconsistent
state.
2005-02-03 23:10:17 +00:00
John Baldwin
aa96fcdb61 Anytime we write to the RTC's status B register to possibly enable
interrupts, read from the interrupt status register to clear any pending
interrupts.  Otherwise in some rare cases the RTC would never fire any
interrupts as it constantly thinks it has an interrupt pending.

PR:		i386/17800
PR:		kern/76776
Submitted by:	Jose M. Alcaide jose at we dot lc dot ehu dot es
MFC after:	2 weeks
2005-02-03 19:06:03 +00:00
Maxim Sobolev
610ecfe035 o Split out kernel part of execve(2) syscall into two parts: one that
copies arguments into the kernel space and one that operates
  completely in the kernel space;

o use kernel-only version of execve(2) to kill another stackgap in
  linuxlator/i386.

Obtained from:  DragonFlyBSD (partially)
MFC after:      2 weeks
2005-01-29 23:12:00 +00:00
Maxim Sobolev
84569dff34 o Move copyin()/copyout() out of i386_{get,set}_ldt() and
i386_{get,set}_ioperm() and make those APIs visible in the kernel namespace;

o use i386_{get,set}_ldt() and i386_{get,set}_ioperm() instead of sysarch()
  in the linuxlator, which allows to kill another two stackgaps.

MFC after:	2 weeks
2005-01-26 13:59:46 +00:00
John Baldwin
d81080b30a If a valid ELCR was found, consult it for the trigger mode of ISA
interrupts that have a trigger mode of conforming.  This fixes problems on
some older machines that still route PCI devices via ISA interrupts when
using an I/O APIC.

Tested by:	Peter Trifonov pvtrifonov at mail dot ru
MFC after:	1 month
2005-01-18 20:27:24 +00:00
John Baldwin
42f0ddd465 Tweak the ELCR support slightly. Explicitly probe the ELCR during boot
instead of burying that in the atpic(4) code as atpic(4) is not the only
user of elcr(4).  Change the elcr(4) code to export a global elcr_found
variable that other code can check to see if a valid ELCR was found.

MFC after:	1 month
2005-01-18 20:24:47 +00:00
John Baldwin
bb5d43ae2a Unbreak stack traces across double faults. In a particular edge case
(calling a __dead2 function such as panic() at the end of a function), the
saved %eip on the stack will actually not be part of the function that
executed a call instruction but instead will be the first instruction of
the next function in the text.  This happens with dblfault_handler() and
syscall() for example.  Work around this in the one place it matters by
looking at the saved %eip - 1 to determine the calling function when we
check for "magic" frames.

MFC after:	2 weeks
2005-01-18 03:48:02 +00:00
Ruslan Ermilov
5c5d348b7c Fix a comment to match reality. 2005-01-17 08:35:50 +00:00
John Baldwin
eec137bd0c Bah, another whitespace fix. 2005-01-14 20:50:52 +00:00
John Baldwin
e5d60ca57f Remove an extraneous space. 2005-01-14 20:49:14 +00:00
John Baldwin
4cc99cf6b1 Remove redundant code to drop per-thread debug register state from
cpu_exit() as this is already performed in cpu_thread_exit() and the
debug state is per-thread rather than per-process.
2005-01-14 20:16:41 +00:00
John Baldwin
69eeed9abc Drop the 'active-' prefix from the polarity printf to be consistent with
the rest of the interrupt code.
2005-01-14 18:31:00 +00:00
Warner Losh
f66b047888 pcic is no more on i386 port, so remove it from the hints. 2005-01-14 06:54:59 +00:00
John Baldwin
565e3eb657 Try harder to work with MP table interrupt entries that claim that an
interrupt is wired up to all the I/O APICs in the system.  If the system
has only one I/O APIC, then just act as if the entry specified that APIC.
We still don't try to handle global entries in a system with multiple I/O
APICs.

Tested by:	Peter Trifonov pvtrifonov at mail dot ru
MFC after:	1 week
2005-01-12 18:24:32 +00:00
John Baldwin
dd08fca3b6 Fix support for machines with default MP Table configurations:
- Fix the MP Table pci bridge drivers to not probe the configuration table
  unless we actually have one.  Machines using a default configuration do
  not have such a table.
- Only allow default configuration types of 5 (ISA + PCI) and 6 (EISA +
  PCI) as the others are not likely to work.  Types 1 through 4 use an
  external APIC (probably with 80486 processors) which we certainly do not
  support, and type 7 uses an MCA bus which has not been tested with the
  new MP Table code.
- Correct the fact that the single I/O APIC in a default configuration has
  an ID of 2, not 0.
- Fix off by one errors in setting the bus types from the default_data[]
  arrays for default configurations.
- Explicitly configure each of the 16 interrupt pins on the sole I/O APIC
  when using a default configuration.  This is especially helpful for type
  6 (EISA + PCI) since the EISA interrupts need to have their polarity
  programmed based on the values in the ELCR.

Much thanks to the submitter and tester who endured several rounds of
testing to get this fixed.

MFC after:	1 week
Tested by:	Georg Schwarz georg dot schwarz at freenet dot de
2005-01-07 18:42:59 +00:00
Scott Long
e015dfcfd1 Introduce bus_dmamap_load_mbuf_sg(). Instead of taking a callback arg, this
cuts to the chase and fills in a provided s/g list.  This is meant to optimize
out the cost of the callback since the callback doesn't serve much purpose for
mbufs since mbuf loads will never be deferred.  This is just for amd64 and
i386 at the moment, other arches will be coming shortly.
2005-01-07 07:57:18 +00:00
Warner Losh
125f6d40bd These are no longer relevant. They are scripts for extracting hints
from 4.x kernel config files.  User's wishing to upgrade from 4.x to 6
will need to go through 5.x, or grab this script from there.  These
scripts will remain in RELENG_5...
2005-01-07 00:54:35 +00:00
Warner Losh
a2f7fd2549 This is no longer supported, so remove it from the tree. 2005-01-07 00:51:18 +00:00
Warner Losh
7ce2255642 /* -> /*- for license, add FreeBSD tag 2005-01-06 23:22:04 +00:00
Warner Losh
86cb007f9f /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 22:18:23 +00:00
Warner Losh
838d838f0b Remove left over include file from stallion driver. 2005-01-06 22:07:20 +00:00
Warner Losh
cf7fbde441 Expand indirect reference to BSD license with the current one. 2005-01-06 22:05:28 +00:00
Warner Losh
94306e4017 This doesn't seem to have been used since 386BSD days 2005-01-06 22:00:50 +00:00
John Baldwin
c88379381b - Move the function prototypes for kern_setrlimit() and kern_wait() to
sys/syscallsubr.h where all the other kern_foo() prototypes live.
- Resort kern_execve() while I'm there.
2005-01-05 22:19:44 +00:00
Warner Losh
0027ba028a These appear to be unused in our tree, so remove them. 2005-01-05 20:50:31 +00:00
Warner Losh
1520214745 Start all license/copyright notice comments with /*-, per tradition 2005-01-05 19:10:48 +00:00
Jun Kuriyama
6f4e528a8e o Use tab instead of spaces for puc(4) line.
o Use capitalized "Ethernet" for consistency.
2005-01-05 05:25:21 +00:00
John Baldwin
753d1af165 Use NULL instead of 0 in a few places as well as various whitespace fixes. 2004-12-30 19:26:23 +00:00
John Baldwin
1c622ae41e Small whitespace fixes. 2004-12-30 19:14:48 +00:00
John Baldwin
7174b63b19 - Indent the comments beside the SMP options to the same level as all the
other comments.  Clarify that the next two things needed for SMP are
  two lines.
- Expand mii abbreviation to miibus for clarity in the USB ethernet
  comment.
2004-12-30 15:30:23 +00:00
Nate Lawson
4260b00a7c Restore the cpu_reset proxy code. It is needed if you want to reset the
system from an AP at runtime (i.e., calling cpu_reset from ddb).  Someday,
if we move to an NMI for stopping cpus instead, we can do away with this.

Requested by:	jhb
2004-12-27 06:15:03 +00:00
Warner Losh
812fb8f294 Get rid of #ifdef for legacy system. Move that into the MD code.
Export minimal symbols to allow this to happen.
2004-12-24 23:03:17 +00:00