Commit graph

26970 commits

Author SHA1 Message Date
Peter Wemm dd84e9658b In order to bring about the end of the universe, delete the lines:
# DO NOT DELETE THIS LINE -- make depend uses it
2001-08-15 00:33:55 +00:00
Warner Losh dc2e861bdb Merge from stable (which seems to have been spammed at some point in current):
#ifdef the deltap pcic_set_memory_offset argument so that raylink
driver works.
2001-08-14 23:34:09 +00:00
Warner Losh a547ba9cce Implement PIOCSRESOURCE for mecia like we do for pcic. 2001-08-14 23:24:56 +00:00
Warner Losh cc3a07dbb3 Minor style(9) nits to make code more readable 2001-08-14 23:16:01 +00:00
Jason Evans 54db32e945 Implement kernel semaphores.
Reviewed by:	jhb
2001-08-14 22:13:14 +00:00
Bill Paul ee755665c2 Fix yet another "unconditionally free()ing memory without even checking
to see if it was malloc()ed first" bug. In bus_dmamap_create(), one of
two things can happen: either we need to allocate a special map due to
some manner of bounce buffering requirement, or we can DMA a buffer
in place. On the x86 platform, the "in place" case results in
bus_dmamap_create() returning a dmamap of NULL. The bus_dmamap_destroy()
routine later checks for NULL and won't bother free()ing the map if
it detects this condition.

But on the alpha, we don't use NULL, we use a statically allocated map
called nobounce_dmamap(). Unfortunately, bus_dmamap_destroy() does not
handle the condition where we attempt to destroy such a map: it tries
to free() the dmamap, which causes a panic.

Fix: test that map != &nobounce_dmamap before trying to free() it.

With this fix, my busdma-ified if_sis driver works on the alpha. I'm
a bit alarmed that I'm the first person ever to trip over this bug, since
we have been using busdma on the alpha for a while, and since it sort
of screams out "Hi! I'm a bug! Booga-booga!" when you look at it.

(Somewhere, somebody will say: "But Bill, why don't you just not bother
destroying the maps in this case." Because the API is supposed to be
a) symetrical and b) opaque to the caller. I can't know whether it's safe
to skip the bus_dmamap_destroy() step or not without sticking my fingers
into unsafe places, which is what I wanted to avoid in the first place.)
2001-08-14 21:56:53 +00:00
Warner Losh 482a667634 Treat min,max of 0,0 for IRQ special. Reject it if we didn't specifically
assing an IRQ.  Add better comments while I'm here.

MFC after: 1 day
# Note: That's merging all the -current pci pcic code, not just this one
# change for the Aug 15th code freeze.
2001-08-14 19:23:12 +00:00
Warner Losh e423aa38ba For TI12xx and newer, clear register 0x84. This is the "Multimedia"
register.  It enables Zoom Video.  It appears that on at least one
card that Monzoon is using sets these bits by default.  Nothing works
when these bits are set, everything works when they are clear.

Add commentary on some of the ti bits.  Make code a little clearer.
Also remove a call to pcic_pci_pd6729 which was prematurely added in
the last commit.
2001-08-14 07:31:47 +00:00
Poul-Henning Kamp 12d1aec26f linux ls fails on DEVFS /dev because linux_getdents fails because
linux_getdents uses VOP_READDIR( ..., &ncookies, &cookies ) instead of
     VOP_READDIR( ..., NULL, NULL ) because it seems to need the offsets for
     linux_dirent and sizeof(dirent) != sizeof(linux_dirent)...

PR:	29467
Submitted by:	Michael Reifenberger <root@nihil.plaut.de>
Reviewed by:	phk
2001-08-14 06:42:32 +00:00
Warner Losh 82c38f3a43 Try to support the Cirrus Logic PD6833 better in pci mode. This is
done from the datasheets since I'm ahving problems with my laptop that
has the 6833 in it...

Minor rework of TI code.  Should be the same as before.
2001-08-14 05:31:56 +00:00
Jake Burkholder c64e8a395b Add a GENERIC kernel config for sparc64. 2001-08-14 03:27:02 +00:00
Jake Burkholder 05ae93afbf Add some definitions that got left out, *blush*. 2001-08-14 03:10:41 +00:00
Jake Burkholder 39f004ea89 Don't define ELF_RTLD_ADDR twice. 2001-08-14 03:09:19 +00:00
John Baldwin 4f99f11257 In prom_halt(), set the halt restart flags on the current CPU, not the
boot CPU.  This was the reason reboots on SMP systems could result in
weird hangs.  Unlike the x86, we do not need to switch back to the boot
CPU in order to reboot the machine.  See Section 3.4.5 of Part III
(Console Interface Architecture) from the Alpha Architecture Reference
Manual (aka the Brown Book) for more info.
2001-08-13 22:44:55 +00:00
John Baldwin 6937ca29dc Remove IPI_HALT to make way for a more correct fix for halts and restarts
on SMP alphas.
2001-08-13 22:41:15 +00:00
John Baldwin 1c94cee872 Minor style nits: cleanup and add some function prototypes. 2001-08-13 22:38:36 +00:00
Jason Evans d55229b72e Add sx_try_upgrade() and sx_downgrade().
Submitted by:	Alexander Kabaev <ak03@gte.com>
2001-08-13 21:25:30 +00:00
Semen Ustimenko 395a636fb2 Fix an bug in FreeBSD attach routine - attaching MII interfaces before doing
common_attach is wrong as common attach initialize some fileds used by
mediainit routine. This was hard to notify because loading driver as kld
lead to mediainit routine being called after common_attach, though probe_phy
is called before.

MFC after:	1 week
2001-08-13 18:37:31 +00:00
Semen Ustimenko 2c9067b16f Add support for 802.1Q VLAN and oversized ethernet frames.
PR:		kern/29235
Submitted by:	Peter Jeremy <peter.jeremy@alcatel.com.au>
Reviewed by:	Yar Tikhiy <yar@FreeBSD.org>
MFC after:	1 week
2001-08-13 18:32:39 +00:00
Ruslan Ermilov c5e7e03a14 Spell "FreeBSD" with "F" and "BSD" in uppercase. 2001-08-13 16:33:00 +00:00
Bruce Evans 3d66f80905 Use interrupt gates instead of trap gates for breakpoint and trace
traps, so that ddb can keep control (almost) no matter how it is
entered.  This breaks time-critical interrupts while the system is
stopped in ddb, but I haven't noticed any significant problems except
that applications become confused about the time.  Lost time will be
adjusted for later.  Anyway, the half-baked disabling of interrupts in
Debugger() gives the same problems for the usual way of entering ddb.
2001-08-13 13:22:50 +00:00
Bruce Evans d072acf902 Removed he BPTTRAP() macro and its use. It was intended for restoring
bug for bug compatibility to ddb trap handlers after fixing the debugger
trap gates to be interrupt gates, but the fix was never committed.  Now
I want the fix to apply to ddb.
2001-08-13 12:42:13 +00:00
Bruce Evans 807ef07ea1 Fixed minor numbers when there is more than one cy card.
PR:		19256
Submitted by:	initial version by yokota
MFC after:	1 week
2001-08-13 10:52:15 +00:00
Bruce Evans 0ce18d0354 Use ttymalloc() instead of a static array of `struct tty'. This will
be a regression until `pstat -t' actually understands the results of
ttymalloc().

Submitted by:	mostly by yokota
2001-08-13 07:00:21 +00:00
Mitsuru IWASAKI dfc356335a Fix some trivial bugs.
- fix segment limit mis-calculation for GCODE_SEL, GDATA_SEL, GPRIV_SEL,
   LUCODE_SEL and LUDATA_SEL.
 - move `loader(8) metadata' related printf() after cninit().
 - use atop macro (address to pages) for segment limit calculation
   instead of i386_btop macro (bytes to pages).
 - fix style bugs for the declarations of ints.

Reviewed by:    bde, msmith (and arch & audit ML)
2001-08-12 08:37:39 +00:00
Mark Peek 53ab587043 Remove unused nmdmpoll function.
Approved by:	julian
2001-08-11 00:18:15 +00:00
John Baldwin 3f085c228e If we've panic'd already, then just bail in lockmgr rather than blocking or
possibly panic'ing again.
2001-08-10 23:29:15 +00:00
Julian Elischer 2b6a0c4fcd Make the protoswitch definitiosn checkable in the same way that
cdevsw entries have been for a long time.
Discover that we now have two version sof the same structure.
I will shoot one of them shortly when I figure out why someone thinks
they need it. (And I can prove they don't)
(netinet/ipprotosw.h should GO AWAY)
2001-08-10 23:17:22 +00:00
Bill Paul c214e6636e Fix some of the GDB linkage setup. The l_name member of the gdb linkage
structure is always free()ed yet only sometimes malloc()ed. In particular,
it was simply set to point to l_filename from the a linker_file_t in
link_elf_link_preload_finish(). The l_filename had been malloc()ed inside
the kern_linker.c module and was being free()ed twice: once by
link_elf_unload_file() and again by linker_file_unload(), leading to
a panic.

How to duplicate the problem:

- Pre-load a kernel module from the loader, i.e. if_sis.ko
- Boot system
- Attempt to unload module with kldunload if_sis
- Bewm

The problem here is that the case where the module was loaded with kldload
after system boot would work correctly, so this bug went unnoticed until
I stubbed my toe on it just now. (Also, you can only trip this bug if
you compile a kernel with options DDB, but that's the default now.)

Fix: remember to malloc() a separate copy of the module name for the
l_name member of the gdb linkage structure in three places where the
linkage structure can be initialized.
2001-08-10 23:15:13 +00:00
John Baldwin 0f345c4054 Add an optimization where we check hte PS_ASTPENDING and PS_NEEDRESCHED
flags with interrupts disabled to see if we should call ast() during
doreti.  This was mostly submitted by Bruce, but his original patch did
the looping in ast() in assembly rather than in the ast() function itself.
Once we've actually called into the ast() function, it's cheaper to just
loop inside the function rather than returning from the function,
performing the check, and then calling the function again.  However, we
can optimize the first check to avoid calling the function at all.
Other architectures may choose to implement this optimization if they
wish but it is not required for correct operation.

Submitted by:	bde
2001-08-10 23:00:07 +00:00
John Baldwin 688ebe120c - Close races with signals and other AST's being triggered while we are in
the process of exiting the kernel.  The ast() function now loops as long
  as the PS_ASTPENDING or PS_NEEDRESCHED flags are set.  It returns with
  preemption disabled so that any further AST's that arrive via an
  interrupt will be delayed until the low-level MD code returns to user
  mode.
- Use u_int's to store the tick counts for profiling purposes so that we
  do not need sched_lock just to read p_sticks.  This also closes a
  problem where the call to addupc_task() could screw up the arithmetic
  due to non-atomic reads of p_sticks.
- Axe need_proftick(), aston(), astoff(), astpending(), need_resched(),
  clear_resched(), and resched_wanted() in favor of direct bit operations
  on p_sflag.
- Fix up locking with sched_lock some.  In addupc_intr(), use sched_lock
  to ensure pr_addr and pr_ticks are updated atomically with setting
  PS_OWEUPC.  In ast() we clear pr_ticks atomically with clearing
  PS_OWEUPC.  We also do not grab the lock just to test a flag.
- Simplify the handling of Giant in ast() slightly.

Reviewed by:	bde (mostly)
2001-08-10 22:53:32 +00:00
John Baldwin 827dcaf663 Make witness compile w/o DDB.
Reported by:	wpaul
2001-08-10 22:33:59 +00:00
David E. O'Brien 9fd2cfcc2f Style cleanup. 2001-08-10 22:31:05 +00:00
Ian Dowse a9a8ba3d71 Arbitrarily limit to 64k the number of bytes that can be read at
a time using the ogetdirentries() compatibility syscall. This is a
hack to ensure that rediculous values don't get passed to MALLOC().

Reviewed by:	kris
2001-08-10 22:14:18 +00:00
John Baldwin 8791b43513 Work around a race between msleep() and endtsleep() where it was possible
for endtsleep() to be executing when msleep() resumed, for endtsleep()
to spin on sched_lock long enough for the other process to loop on
msleep() and sleep again resulting in endtsleep() waking up the "wrong"
msleep.

Obtained from:	BSD/OS
2001-08-10 21:08:56 +00:00
John Baldwin a45982d2ea Change callout_stop() to return an integer. If callout_stop() succeeds in
removing the callout entry, return 1.  If callout_stop() fails to remove
the callout entry because it is currently executing or has already been
executed, then the function returns 0.  The idea was obtained from BSD/OS,
however, BSD/OS changed untimeout(), and I've just changed callout_stop()
to be more conservative.

Obtained from:	BSD/OS
2001-08-10 21:06:59 +00:00
John Baldwin 4d33620270 Style nit: covert a couple of if (p_wchan) tests to if (p_wchan != NULL). 2001-08-10 20:56:25 +00:00
Ruslan Ermilov 94ba280c59 mdoc(7) police: join split punctuation to macro calls. 2001-08-10 17:35:21 +00:00
Julian Elischer d05a918fc3 Do NOT allocate a 1K buffer on the kernel stack.
Found by: Smashed u-area and hardware watch points.
MFC after: 1 week
2001-08-10 17:32:11 +00:00
Kazutaka YOKOTA 3863b6db4c Fix missing splx(). 2001-08-10 14:26:48 +00:00
Poul-Henning Kamp 4446bcb757 Eliminate the hot-spare 'r' in Arrray.
Submitted by:	Søren Schrøder <sch@chaos.dk>
2001-08-10 11:47:08 +00:00
Julian Elischer 3b82ede012 DO NOT ALLOCATE 2+K OBJECTS ON THE KERNEL STACK!!!!
found by: Getting my u-area overwritten
2001-08-10 07:50:14 +00:00
John Baldwin 02cd7c3cf2 - Remove asleep(), await(), and M_ASLEEP.
- Callers of asleep() and await() have been converted to calling tsleep().
  The only caller outside of M_ASLEEP was the ata driver, which called both
  asleep() and await() with spl-raised, so there was no need for the
  asleep() and await() pair.  M_ASLEEP was unused.

Reviewed by:	jasone, peter
2001-08-10 06:56:12 +00:00
John Baldwin c4a448100c - Remove asleep(), await(), and M_ASLEEP.
- Callers of asleep() and await() have been converted to calling tsleep().
  The only caller outside of M_ASLEEP was the ata driver, which called both
  asleep() and await() with spl-raised, so there was no need for the
  asleep() and await() pair.  M_ASLEEP was unused.

Reviewed by:	jasone, peter
2001-08-10 06:45:43 +00:00
John Baldwin 8ec48c6dbf - Remove asleep(), await(), and M_ASLEEP.
- Callers of asleep() and await() have been converted to calling tsleep().
  The only caller outside of M_ASLEEP was the ata driver, which called both
  asleep() and await() with spl-raised, so there was no need for the
  asleep() and await() pair.  M_ASLEEP was unused.

Reviewed by:	jasone, peter
2001-08-10 06:37:05 +00:00
Warner Losh 043b27b450 Move ISA interrupt ISR and timeout routines to pcic from pcic_isa so
that we can use them in the pci code when we have to fall back to ISA
interrupt routing.
2001-08-10 06:07:20 +00:00
Warner Losh e4db871961 Type sanity: use uintptr_t * for read_ivar and u_int8_t instead of u_char 2001-08-10 06:00:44 +00:00
Warner Losh f470b3bb56 Rearrange the pcic_irq_type enum (and specifically tag the first one
as being 1) in anticipation of documentation.
2001-08-10 05:42:08 +00:00
John Baldwin c37c2d03b8 Bump MAXCOMLEN from 16 to 19 to take advantage of 32-bit alignment.
Approved by:	peter, jasone
2001-08-10 05:34:48 +00:00
Jake Burkholder f02f55a8e3 Correct copyright language. 2001-08-10 04:51:19 +00:00