- Introduce a helper function if_setflag() containing the code common
to ifpromisc() and if_allmulti() instead of duplicating the code poorly,
with different bugs.
- Call ifp->if_ioctl() in a consistent way: always use more compatible C
syntax and check whether ifp->if_ioctl is not NULL prior to the call.
MFC after: 1 month
statistics via a binary structure stream:
- Add structure 'malloc_type_stream_header', which defines a stream
version, definition of MAXCPUS used in the stream, and a number of
malloc_type records in the stream.
- Add structure 'malloc_type_header', which defines the name of the
malloc type being reported on.
- When the sysctl is queried, return a stream header, followed by a
series of type descriptions, each consisting of a type header
followed by a series of MAXCPUS malloc_type_stats structures holding
per-CPU allocation information. Typical values of MAXCPUS will be 1
(UP compiled kernel) and 16 (SMP compiled kernel).
This query mechanism allows user space monitoring tools to extract
memory allocation statistics in a machine-readable form, and to do so
at a per-CPU granularity, allowing monitoring of allocation patterns
across CPUs in order to better understand the distribution of work and
memory flow over multiple CPUs.
While here:
- Bump statistics width to uint64_t, and hard code using fixed-width
type in order to be more sure about structure layout in the stream.
We allocate and free a lot of memory.
- Add kmemcount, a counter of the number of registered malloc types,
in order to avoid excessive manual counting of types. Export via a
new sysctl to allow user-space code to better size buffers.
- De-XXX comment on no longer maintaining the high watermark in old
sysctl monitoring code.
A follow-up commit of libmemstat(3), a library to monitor kernel memory
allocation, will occur in the next few days. Likewise, similar changes
to UMA.
process that caused the clone event to take place for the device driver
creating the device. This allows cloned device drivers to adapt the
device node based on security aspects of the process, such as the uid,
gid, and MAC label.
- Add a cred reference to struct cdev, so that when a device node is
instantiated as a vnode, the cloning credential can be exposed to
MAC.
- Add make_dev_cred(), a version of make_dev() that additionally
accepts the credential to stick in the struct cdev. Implement it and
make_dev() in terms of a back-end make_dev_credv().
- Add a new event handler, dev_clone_cred, which can be registered to
receive the credential instead of dev_clone, if desired.
- Modify the MAC entry point mac_create_devfs_device() to accept an
optional credential pointer (may be NULL), so that MAC policies can
inspect and act on the label or other elements of the credential
when initializing the skeleton device protections.
- Modify tty_pty.c to register clone_dev_cred and invoke make_dev_cred(),
so that the pty clone credential is exposed to the MAC Framework.
While currently primarily focussed on MAC policies, this change is also
a prerequisite for changes to allow ptys to be instantiated with the UID
of the process looking up the pty. This requires further changes to the
pty driver -- in particular, to immediately recycle pty nodes on last
close so that the credential-related state can be recreated on next
lookup.
Submitted by: Andrew Reisse <andrew.reisse@sparta.com>
Obtained from: TrustedBSD Project
Sponsored by: SPAWAR, SPARTA
MFC after: 1 week
MFC note: Merge to 6.x, but not 5.x for ABI reasons
o Add two new ioctl's KBADDKBD and KBRELKBD. These are used to add and remove
keyboard to (and from) kbdmux(4) keyboard multiplexer;
o Introduce new kbd_find_keyboard2() function. It does exactly the same job
as kbd_find_keyboard() function except it allows to specify starting index.
This function can be used to iterate over keyboards array;
o Re-implement kbd_find_keyboard() as call to kbd_find_keyboard2() with starting
index of zero;
o Make sure syscons(4) passed KBADDKBD and KBRELKBD ioctl's onto currently
active keyboard.
These changes should not have any visible effect.
MFC after: 1 week
syscalls.master for the master list and the Alpha/OSF1 compat ABI to be
consistent with all the other compat ABIs where 'make sysent' already
works.
MFC after: 3 days
we can only bridge interfaces with the same value it meant that all members had
to be set at ETHERMTU as well.
Allow the first member to be added to define the MTU for the bridge, the check
still applies to all additional members.
Print an informative message if the MTU is incorrect [1]
Requested by: Niki Denev [1]
Approved by: mlaier (mentor)
MFC after: 3 days
- Make sure timer0_max_count is set to a correct value in the lapic case.
- Revert i8254_restore() to explicitly reprogram timer 0 rather than
calling set_timer_freq() to do it. set_timer_freq() only reprograms
the counter if the max count changes which it never does on resume. This
unbreaks suspend/resume for several people.
Tested by: marks, others
Reviewed by: bde
MFC after: 3 days
in the PCI config registers) that are > 15 as $PIR can only route PCI
interrupts to ISA IRQs which are limited to the 0 to 15 range.
- Remove an extra word from a printf.
Reported by: othermark atkin901 at yahoo dot com
MFC after: 3 days
since it calls into VFS and VM. This makes the freebsd32_mmap() routine
MP safe and the extra Giants here can be revisited later.
Glanced at by: marcel
MFC after: 3 days
o Use pf more consistantly for pccard_function.
o Make sure we quote the strings properly (maybe this function belongs in
subr_bus.c)
o Tweak a comment to be more accurate after code changed.
and combine the old xe_pccard_{probe,attach} into one routine _attach.
Create a lookup function to lookup items in the table. Eliminate the
check for network cards, since many modems were eliminated by it.
Tweak a few printfs as well.
This gets many of my older cards working again CEM2, CEM28, CEM36,
etc.
support for them can really be added. Eliminate the check for network
card, because many of the cards in the commented out section are combo
cards and report themselves as either multifunction or modem. They
will be added back as I obtain hardware and test them more fully.
few other cards need. This firmware was obtained from the Linux
pcmica-cs project, but Ositech Communications, Inc has been kind
enough to grant permission to change the license to a pure BSDL type.
enabling of interrupts inside of trap(). Fix a typo in a comment.
Revert rev 1.113 of "sys/i386/i386/exception.s" as it is no longer
needed.
Reviewed by: bde
MFC after: 3 days
we bailed if we couldn't collect the 16-bytes of data required
for an aes block cipher in 2 mbufs; now we deal with it. While
here make space accounting signed so a sanity check does the
right thing for malformed mbuf chains.
Approved by: re (scottl)
address, writting non-canonical address can cause kernel a panic,
by restricting base values to 0..VM_MAXUSER_ADDRESS, ensuring
only canonical values get written to the registers.
Reviewed by: peter, Josepha Koshy < joseph.koshy at gmail dot com >
Approved by: re (scottl)
o Add timeout error recovery (from a thread context to avoid
the deferral of other critical interrupts).
o Properly recover commands across controller reset events.
o Update the driver to handle events and status codes that
have been added to the MPI spec since the driver was
originally written.
o Make the driver more modular to improve maintainability and
support dynamic "personality" registration (e.g. SCSI Initiator,
RAID, SAS, FC, etc).
o Shorten and simplify the common I/O path to improve driver
performance.
o Add RAID volume and RAID member state/settings reporting.
o Add periodic volume resynchronization status reporting.
o Add support for sysctl tunable resync rate, member write cache
enable, and volume transaction queue depth.
Sponsored by
----------------
Avid Technologies Inc:
SCSI error recovery, driver re-organization, update of MPI library
headers, portions of dynamic personality registration, and misc bug
fixes.
Wheel Open Technologies:
RAID event notification, RAID member pass-thru support, firmware
upload/download support, enhanced RAID resync speed, portions
of dynamic personality registration, and misc bug fixes.
Detailed Changes
================
mpt.c mpt_cam.c mpt_raid.c mpt_pci.c:
o Add support for personality modules. Each module exports
load, and unload module scope methods as well as probe, attach,
event, reset, shutdown, and detach per-device instance
methods
mpt.c mpt.h mpt_pci.c:
o The driver now associates a callback function (via an
index) with every transaction submitted to the controller.
This allows the main interrupt handler to absolve itself
of any knowledge of individual transaction/response types
by simply calling the callback function "registered" for
the transaction. We use a callback index instead of a
callback function pointer in each requests so we can
properly handle responses (e.g. event notifications)
that are not associated with a transaction. Personality
modules dynamically register their callbacks with the
driver core to receive the callback index to use for their
handlers.
o Move the interrupt handler into mpt.c. The ISR algorithm
is bus transport and OS independent and thus had no reason
to be in mpt_pci.c.
o Simplify configuration message reply handling by copying
reply frame data for the requester and storing completion
status in the original request structure.
o Add the mpt_complete_request_chain() helper method and use
it to implement reset handlers that must abort transactions.
o Keep track of all pending requests on the new
requests_pending_list in the softc.
o Add default handlers to mpt.c to handle generic event
notifications and controller reset activities. The event
handler code is largely the same as in the original driver.
The reset handler is new and terminates any pending transactions
with a status code indicating the controller needs to be
re-initialized.
o Add some endian support to the driver. A complete audit is
still required for this driver to have any hope of operating
in a big-endian environment.
o Use inttypes.h and __inline. Come closer to being style(9)
compliant.
o Remove extraneous use of typedefs.
o Convert request state from a strict enumeration to a series
of flags. This allows us to, for example, tag transactions
that have timed-out while retaining the state that the
transaction is still in-flight on the controller.
o Add mpt_wait_req() which allows a caller to poll or sleep
for the completion of a request. Use this to simplify
and factor code out from many initialization routines.
We also use this to sleep for task management request
completions in our CAM timeout handler.
mpt.c:
o Correct a bug in the event handler where request structures were
freed even if the request reply was marked as a continuation
reply. Continuation replies indicate that the controller still owns
the request and freeing these replies prematurely corrupted
controller state.
o Implement firmware upload and download. On controllers that do
not have dedicated NVRAM (as in the Sun v20/v40z), the firmware
image is downloaded to the controller by the system BIOS. This
image occupies precious controller RAM space until the host driver
fetches the image, reducing the number of concurrent I/Os the
controller can processes. The uploaded image is used to
re-program the controller during hard reset events since the
controller cannot fetch the firmware on its own. Implementing this
feature allows much higher queue depths when RAID volumes
are configured.
o Changed configuration page accessors to allow threads to sleep
rather than busy wait for completion.
o Removed hard coded data transfer sizes from configuration page
routines so that RAID configuration page processing is possible.
mpt_reg.h:
o Move controller register definitions into a separate file.
mpt.h:
o Re-arrange includes to allow inlined functions to be
defined in mpt.h.
o Add reply, event, and reset handler definitions.
o Add softc fields for handling timeout and controller
reset recovery.
mpt_cam.c:
o Move mpt_freebsd.c to mpt_cam.c. Move all core functionality,
such as event handling, into mpt.c leaving only CAM SCSI
support here.
o Revamp completion handler to provide correct CAM status for
all currently defined SCSI MPI message result codes.
o Register event and reset handlers with the MPT core. Modify
the event handler to notify CAM of bus reset events. The
controller reset handler will abort any transactions that
have timed out. All other pending CAM transactions are
correctly aborted by the core driver's reset handler.
o Allocate a single request up front to perform task management
operations. This guarantees that we can always perform a
TMF operation even when the controller is saturated with other
operations. The single request also serves as a perfect
mechanism of guaranteeing that only a single TMF is in flight
at a time - something that is required according to the MPT
Fusion documentation.
o Add a helper function for issuing task management requests
to the controller. This is used to abort individual requests
or perform a bus reset.
o Modify the CAM XPT_BUS_RESET ccb handler to wait for and
properly handle the status of the bus reset task management
frame used to reset the bus. The previous code assumed that
the reset request would always succeed.
o Add timeout recovery support. When a timeout occurs, the
timed-out request is added to a queue to be processed by
our recovery thread and the thread is woken up. The recovery
thread processes timed-out command serially, attempting first
to abort them and then falling back to a bus reset if an
abort fails.
o Add calls to mpt_reset() to reset the controller if any
handshake command, bus reset attempt or abort attempt
fails due to a timeout.
o Export a secondary "bus" to CAM that exposes all volume drive
members as pass-thru devices, allowing CAM to perform proper
speed negotiation to hidden devices.
o Add a CAM async event handler tracking the AC_FOUND_DEVICE event.
Use this to trigger calls to set the per-volume queue depth once
the volume is fully registered with CAM. This is required to avoid
hitting firmware limits on volume queue depth. Exceeding the
limit causes the firmware to hang.
mpt_cam.h:
o Add several helper functions for interfacing to CAM and
performing timeout recovery.
mpt_pci.c:
o Disable interrupts on the controller before registering and
enabling interrupt delivery to the OS. Otherwise we risk
receiving interrupts before the driver is ready to receive
them.
o Make use of compatibility macros that allow the driver to
be compiled under 4.x and 5.x.
mpt_raid.c:
o Add a per-controller instance RAID thread to perform settings
changes and query status (minimizes CPU busy wait loops).
o Use a shutdown handler to disable "Member Write Cache Enable"
(MWCE) setting for RAID arrays set to enable MWCE During Rebuild.
o Change reply handler function signature to allow handlers to defer
the deletion of reply frames. Use this to allow the event reply
handler to queue up events that need to be acked if no resources
are available to immediately ack an event. Queued events are
processed in mpt_free_request() where resources are freed. This
avoids a panic on resource shortage.
o Parse and print out RAID controller capabilities during driver probe.
o Define, allocate, and maintain RAID data structures for volumes,
hidden member physical disks and spare disks.
o Add dynamic sysctls for per-instance setting of the log level, array
resync rate, array member cache enable, and volume queue depth.
mpt_debug.c:
o Add mpt_lprt and mpt_lprtc for printing diagnostics conditioned on
a particular log level to aid in tracking down driver issues.
o Add mpt_decode_value() which parses the bits in an integer
value based on a parsing table (mask, value, name string, tuples).
mpilib/*:
o Update mpi library header files to latest distribution from LSI.
Submitted by: gibbs
Approved by: re
- Add a missing "ATI" in one of the device descriptions.
- In machfb_init_engine() adjust a wait_for_fifo() call to the
actual number of operations.
- As a speed optimization cache setting the foreground and back-
ground colors.
- I got the meaning of V_DISPLAY_BLANK wrong, it's blank like turn
off and not blank like turn on and clear the screen. So move
clearing the screen to machfb_clear() were it hopefully belongs.
- Properly implement V_DISPLAY_BLANK, V_DISPLAY_STAND_BY and
V_DISPLAY_SUSPEND. This makes blank_saver.ko and green_saver.ko
work. [1]
- Implement machfb_load_palette() and machfb_save_palette() and
set the V_ADP_PALETTE flag. This makes fade_saver.ko work. [2]
- Install our 16-color color map only once and with an offset of
16 as the OBP driver expects white to be at index 0 and black at
255. This fixes the inversion of the colors back at the boot
prompt after shutting down FreeBSD. This will also be handy if
we ever want to implement breaking into OFW. Unfortunately there
doesn't seem to be a better way to achieve this as e.g. bypassing
the color map isn't supported by all Mach64 chips.
- Move invalidating the cache variables to machfb_set_mode() and
set the V_ADP_MODECHANGE flag. This causes machfb_set_mode() to
be called when the X server shuts down. This hopefully will fix
the screen corruption happening occasionally when shutting down
the X server and which is present until switching to another VTY.
Inspired by: NetBSD [1]
Based on: Xorg [2]
Approved by: re (scottl)
- Let creator_bitblt() return ENODEV as it's not implemented (missed
in sys/dev/fb/creator.c rev. 1.6).
- As a speed optimization inline the creator_ras_wait() etc. helper
functions and also cache setting the font increment, font width
and plane mask. [1]
- I got the meaning of V_DISPLAY_BLANK wrong, it's blank like turn
off and not blank like turn on and clear the screen. So move
clearing the screen to creator_clear() were it hopefully belongs.
- Properly implement V_DISPLAY_BLANK, V_DISPLAY_STAND_BY and
V_DISPLAY_SUSPEND. This makes blank_saver.ko and green_saver.ko
work. [1]
- Change the order of operations in creator_fill_rect(), i.e. write
y before x and cy before cx. This fixes drawing the top part of
the border with Elite3D cards when switching from Xorg to a VTY.
- Move setting the chip configuration we use and invalidating the
cache variables to creator_set_mode() and set the V_ADP_MODECHANGE
flag. This causes creator_set_mode() to be called when the X server
shuts down which fixes the screen corruption caused most of the
time by Xorg not restoring the original configuration present at
startup.
Inspired by/based on: Xorg [1]
Approved by: re (scottl)
after sys/dev/sound/pcm/channel.c rev. 1.99, i.e. when there's no
existing KERNBUILDDIR with an opt_isa.h defined.
- Sync with sys/dev/sound/pcm/channel.c rev. 1.99 (sort of), i.e.
never compile in isadma support on sparc64 as we just never need
it there. This allows to use the "generic" module with a custom
kernel that is built without isa(4).
Reviewed by: ru
Approved by: re (scottl)
variant to allocating a fixed set of 5 banks that the EBus variant
is documented to have (and also has in reality). Trying to allocate
up to 8 banks is a remnant from experiments during the development
of this driver.
Discussed with: joerg, yongari
Reviewed by: yongari
Approved by: re (scottl)