Bill Paul [Tue, 23 Dec 2003 04:08:22 +0000 (04:08 +0000)]
Re-do the handling of ndis_buffers. The NDIS_BUFFER structure is
supposed to be opaque to the driver, however it is exposed through
several macros which expect certain behavior. In my original
implementation, I used the mappedsystemva member of the structure
to hold a pointer to the buffer and bytecount to hold the length.
It turns out you must use the startva pointer to point to the
page containing the start of the buffer and set byteoffset to
the offset within the page where the buffer starts. So, for a buffer
with address 'baseva,' startva is baseva & ~(PAGE_SIZE -1) and
byteoffset is baseva & (PAGE_SIZE -1). We have to maintain this
convention everywhere that ndis_buffers are used.
Fortunately, Microsoft defines some macros for initializing and
manipulating NDIS_BUFFER structures in ntddk.h. I adapted some
of them for use here and used them where appropriate.
This fixes the discrepancy I observed between how RX'ed packet sizes
were being reported in the Broadcom wireless driver and the sample
ethernet drivers that I've tested. This should also help the
Intel Centrino wireless driver work.
Also try to properly initialize the 802.11 BSS and IBSS channels.
(Sadly, the channel value is meaningless since there's no way
in the existing NDIS API to get/set the channel, but this should
take care of any 'invalid channel (NULL)' messages printed on
the console.
Peter Wemm [Tue, 23 Dec 2003 03:50:43 +0000 (03:50 +0000)]
Remove the namespace column from the syscalls tables. We don't actually
use it, if we ever did. They have been been VERY poorly maintained for
some time, possibly because they were a NOP. FWIW, This brings our table
formats back closer to the other *BSD's.
Peter Wemm [Tue, 23 Dec 2003 03:20:49 +0000 (03:20 +0000)]
Rather than screw around with the (unsafe) stackgap, call vn_stat/fo_stat
directly for stat/fstat/lstat syscall emulation. It turns out not only
safer, but the code is smaller this way too.
Peter Wemm [Tue, 23 Dec 2003 02:48:11 +0000 (02:48 +0000)]
Eliminate stackgap usage for the (woefully incomplete) path translations
since it isn't needed here anymore.
Use standard open(2)/access(2) and chflags(2) syscalls now.
Peter Wemm [Tue, 23 Dec 2003 02:45:24 +0000 (02:45 +0000)]
Forced commit; previous commit also included:
- eliminate a malloc()/snprintf()/free() in the native exec(2) case and
in the easy emulation environments.
- Allow the brand emul_path (ie: /compat/xxx) to be NULL rather than
needing it to be an empty string that is always referenced.
Peter Wemm [Tue, 23 Dec 2003 02:42:39 +0000 (02:42 +0000)]
Add an additional field to the elf brandinfo structure to support
quicker exec-time replacement of the elf interpreter on an emulation
environment where an entire /compat/* tree isn't really warranted.
Peter Wemm [Tue, 23 Dec 2003 02:34:25 +0000 (02:34 +0000)]
Don peril sensitive sunglasses and set NULL to an actual pointer type,
but *only* for the kernel. We can do this because the kernel is not a
standard C application environment. This would have stopped the recent
mtx_* arg NULL/MTX_DEF mixups from going unnoticed for so long.
Fixed incomplete initialization in some ohci controllers with
broken BIOS. Separate ohci_controller_init() from ohci_init(),
and call ohci_controller_init() at resume process once more.
Discussed on [bsd-nomads:16737] - [bsd-nomads:16746].
Submitted by Hiroyuki Aizu <eyes@navi.org> [bsd-nomads:16741]
Scott Long [Mon, 22 Dec 2003 15:19:45 +0000 (15:19 +0000)]
Put the em and vx drivers back into the kernel so that the mfsroot stops
overflowing. We are one again on the brink of the floppies having major
overflow problems.
Enable support for DEVICE_SUSPEND, DEVICE_RESUME and DEVICE_SHUTDOWN
methods for USB devices in the same way of uhci driver. But this change
is not complete because some ohci controlers are not initialized completely.
So "kernel: usb0: 1 scheduling overruns" interrupt will generate many times.
This change will be same one in PR kern/60099.
Discussed on [bsd-nomads:16737] - [bsd-nomads:16746].
Bill Paul [Mon, 22 Dec 2003 08:24:32 +0000 (08:24 +0000)]
Now that I finally have power back, implement a couple more NDIS API
routines: NdisUnchainBufferAtBack(), NdisGetFirstBufferFromPacketSafe()
and NdisGetFirstBufferFromPacket(). This should bring us a little
closer to getting the Intel centrino wireless NIC to work.
Note: I have not actually tested these additions since I don't
have a driver that calls them, however they're pretty simple, and
one of them is taken pretty much directly from the Windows ndis.h
header file, so I'm fairly confident they work, but disclaimers
apply.
Alexander Kabaev [Mon, 22 Dec 2003 04:27:17 +0000 (04:27 +0000)]
Fix ASM_OUTPUT_LABELREF to deal with TSL model prefixes GCC
started to use internally. They need to be stripped before
the name of the label or symbol is printed.
Alan Cox [Mon, 22 Dec 2003 02:04:08 +0000 (02:04 +0000)]
- Create an unmapped guard page to trap access to vm_page_array[-1].
This guard page would have trapped the problems with the MFC of the PAE
support to RELENG_4 at an earlier point in the sequence of events.
Alan Cox [Mon, 22 Dec 2003 01:01:32 +0000 (01:01 +0000)]
- Significantly reduce the number of preallocated pv entries in
pmap_init(). Such a large preallocation is unnecessary and wastes
nearly eight megabytes of kernel virtual address space per gigabyte
of managed physical memory.
- Increase UMA_BOOT_PAGES by two. This enables the removal of
pmap_pv_allocf(). (Note: this function was only used during
initialization, specifically, after pmap_init() but before
pmap_init2(). During pmap_init2(), a new allocator is installed.)
Scott Long [Sun, 21 Dec 2003 17:16:44 +0000 (17:16 +0000)]
Teach the Fixit environment how to deal with a dynamic root. Symlink
/libexec to /mnt2/libexec, and execute /mnt2/rescue/ldconfig to add
the /mnt2/lib and /mnt2/usr/lib library directories. Thanks to John Baldwin
for working to track this down.
Peter Grehan [Sun, 21 Dec 2003 12:38:25 +0000 (12:38 +0000)]
- Add ':' as a separator between the OpenFirmware device space and
the file path. Commonly used on Macs e.g. "hd:9".
- Update the ofw_setcurrdev routine to match libstand setenv prototype
Peter Grehan [Sun, 21 Dec 2003 12:27:01 +0000 (12:27 +0000)]
Make __elfN(ofw_loadfile) match parameter declaration for file_format
in boot/common/bootstrap.h. Having a 32-bit size when a 64-bit param
is declared wreaks havoc on PPC.
Peter Grehan [Sun, 21 Dec 2003 12:11:31 +0000 (12:11 +0000)]
- use correct pointer arithmetic in heapsize calculation
- handle multiple Ofw memory regions when determining mem size
- allow currdev to be set as a loader command-line option.
parse() is used to allow future options to be processed.
Alan Cox [Sun, 21 Dec 2003 06:03:40 +0000 (06:03 +0000)]
- Correct an error in mincore(2) that has existed since its introduction:
mincore(2) should check that the page is valid, not just allocated.
Otherwise, it can return a false positive for a page that is not yet
resident because it is being read from disk.
Bill Paul [Sun, 21 Dec 2003 00:00:08 +0000 (00:00 +0000)]
Big round of updates:
- Make ndis_get_info()/ndis_set_info() sleep on the setdone/getdone
routines if they get back NDIS_STATUS_PENDING.
- Add a bunch of net80211 support so that 802.11 cards can be twiddled
with ifconfig. This still needs more work and is not guaranteed to
work for everyone. It works on my 802.11b/g card anyway.
The problem here is Microsoft doesn't provide a good way to a) learn
all the rates that a card supports (if it has more than 8, you're
kinda hosed) and b) doesn't provide a good way to distinguish between
802.11b, 802.11b/g an 802.11a/b/g cards, so you sort of have to guess.
Setting the SSID and switching between infrastructure/adhoc modes
should work. WEP still needs to be implemented. I can't find any API
for getting/setting the channel other than the registry/sysctl keys.
Jeff Roberson [Sat, 20 Dec 2003 22:35:20 +0000 (22:35 +0000)]
- Make our transfer decisions based on load and not transferable load. A
cpu could have been bogged down with non-transferable load and still not
migrated a new thread to an idle cpu. This required some benchmarking and
tuning to get right as the comment above it suggests.
Jeff Roberson [Sat, 20 Dec 2003 20:36:19 +0000 (20:36 +0000)]
- Enable ithread migration on x86. This is done to work around a bug in the
IO APIC on Xeons that prevents round-robin interrupt assignment from
working.
Sam Leffler [Sat, 20 Dec 2003 18:32:48 +0000 (18:32 +0000)]
o move mutex init/destroy logic to the module load/unload hooks;
otherwise they are initialized twice when the code is statically
configured in the kernel because the module load method gets
invoked before the user application calls ip_mrouter_init
o add a mutex to synchronize the module init/done operations; this
sort of was done using the value of ip_mroute but X_ip_mrouter_done
sets it to NULL very early on which can lead to a race against
ip_mrouter_init--using the additional mutex means this is safe now
o don't call ip_mrouter_reset from ip_mrouter_init; this now happens
once at module load and X_ip_mrouter_done does the appropriate
cleanup work to insure the data structures are in a consistent
state so that a subsequent init operation inherits good state
John Baldwin [Sat, 20 Dec 2003 16:34:45 +0000 (16:34 +0000)]
Do an update mount operation to mount the mfsroot as read/write rather
than read/only when sysinstall is running as init. This fixes several
install issues.
Jeff Roberson [Sat, 20 Dec 2003 14:03:14 +0000 (14:03 +0000)]
- In kseq_transfer() return if smp has not been started.
- In sched_add(), do the idle check prior to the transfer check so that we
don't try to transfer load from an idle cpu. This fixes panics caused by
IPIs on UP machines running SMP kernels.
Jeff Roberson [Sat, 20 Dec 2003 12:54:35 +0000 (12:54 +0000)]
- Running interactive tasks with the minimum time-slice is fine for vi and
sh, but not so great for mozilla, X, etc. Add a fixed define for the slice
size granted to interactive KSEs.
Justin T. Gibbs [Fri, 19 Dec 2003 18:34:30 +0000 (18:34 +0000)]
Move all of the recovery thread routines next
to each other.
Correct the recovery thread's loop so that it
will terminate properly on shutdown. We also
clear the recovery_thread proc pointer so that
any additional calls to aic_terminate_recovery_thread()
will not attempt to kill a thread that doesn't
exist. Lastly, code the loop so that termination
will still be successfull even if the termination
request occurs just prior to us entering the loop
or while the recovery thread is off recovering
commands.
Alexander Kabaev [Fri, 19 Dec 2003 18:20:48 +0000 (18:20 +0000)]
Use __cxa_atexit, rather than atexit, to register C++ destructors for local
statics and global objects. This is essential for fully standards-compliant
handling of destructors, and requires __cxa_atexit in libc.
Yaroslav Tykhiy [Fri, 19 Dec 2003 16:03:28 +0000 (16:03 +0000)]
The default value of net.graph.nonstandard_pppoe is changed to -1,
which means "always stay in the standard mode of PPPoE operation
regardless of any junk floating around."
As the referenced PR stated clearly, the old default setting of 0
was extremely dangerous because it opened a possibility for a
spurious frame not only to put down a single PPPoE node running
FreeBSD, but to plague *every* FreeBSD node in a PPPoE network in
such a way that those nodes would keep poisoning each other until
rebooted simultaneously.
Justin T. Gibbs [Fri, 19 Dec 2003 04:17:43 +0000 (04:17 +0000)]
In ahd_run_qoutfifos, correct a !=/== logic bug
that would cause an infinite loop any time we
manually flush the good status FIFO. Also make
our loop delay unconditional to ensure we don't
miss any FIFO allocations by the hardware.
Bill Paul [Thu, 18 Dec 2003 21:47:14 +0000 (21:47 +0000)]
Make ndiscvt(8) emit the binary image array as inline assembly code rather
than a char array. Emitting the data as a big char array works fine in
the typical case, where a .sys file may be ~50K in size. Unfortunately,
some .sys files can be several hundred Kbytes in size, or even several
megabytes in size. One extreme case is the Intel centrino wireless
driver, which is 2.4MB. This causes us to emit an ndis_driver_data.h
file that's on the order of 15MB in size, and gcc consumes enormous
amounts of virtual memory while trying to compile it. On my laptop,
with 128MB of RAM and 256MB of swap space, gcc consumed all available
VM and crashed without being able to compile if_ndis.o.
By emitting the array as assembler, we bypass the C compiler and consume
much less memory. I was able to easily test compile if_ndis.ko with the
centrino driver on my laptop after this change.
This is merely a convenience, and should not have any operational effect
on the NDISulator itself.
Yaroslav Tykhiy [Thu, 18 Dec 2003 16:38:35 +0000 (16:38 +0000)]
There are two modes of ng_pppoe operation, standard and
nonstandard. They differ in the values of certain fields in
the PPPoE frame. Previously, ng_pppoe would start in standard
mode, yet switch to nonstandard one upon reception of a single
nonstandard frame. After having done so, ng_pppoe would be unable
to interact with standard PPPoE peers. Thus, a DoS condition
existed that could be triggered by a buggy peer or malicious party.
Since few people have expressed their displeasure WRT this problem,
the default operation of ng_pppoe is left untouched for now. However,
a new value for the sysctl net.graph.nonstandard_pppoe is introduced,
-1, which will force ng_pppoe stay in standard mode regardless of any
bogus frames floating around.
Now I understand what Bruce was getting at - -1 can be parsed as two
tokens, so it does indeed need to be parenthesized. Duh. Sometimes
it can stare you right and the face and you still don't see it. Thanks, bde.