doesn't give them enough stack to do much before blowing away the pcb.
This adds MI and MD code to allow the allocation of an alternate kstack
who's size can be speficied when calling kthread_create. Passing the
value 0 prevents the alternate kstack from being created. Note that the
ia64 MD code is missing for now, and PowerPC was only partially written
due to the pmap.c being incomplete there.
Though this patch does not modify anything to make use of the alternate
kstack, acpi and usb are good candidates.
Reviewed by: jake, peter, jhb
supported option and it disabled a whole 2 lines of bootverbose messages.
I wanted to see 1 of the messages (about the latency timers). This
is a wrong place to decode pci configurations, but the code is already
here and handles more details than pciconf(8).
A number of functions in this driver still use the unit number in their
printouts because they pass the unit directly as a function argument
instead of passing a softc or struct ifnet pointer. This should be
resolved at a future date.
code path to fix a bug in the non USB_USE_SOFTINTR path that caused
the usb bus to hang and generally misbehave when devices were unplugged.
In the process though it also reduced the throughput of usb devices because
of a less than optimal implementation under FreeBSD.
This commit fixes the non USB_USE_SOFTINTR code in uhci and ohci
so that it works again, and switches back to using this code path.
The uhci code has been tested, but the ohci code hasn't. It's
essentially the same anyway and so I don't envisage any difficulties.
Code for uhci submitted by: Maksim Yevmenkin <myevmenk@exodus.net>
testing any modifications to them, they shouldn't even bother with
disklabels in the first place and they are just plain obsolete old
hardware which should be axed entirely before 5.0-R IMO.
Sponsored by: DARPA & NAI Labs.
The advanced stage of computer assisted hardware design and
verification is aptly illustrated by the fact that this is necessary
because only the first ports in a single-chip, dual-port async
PC-Card product lacks this register.
aic79xx.c:
o Remove redundant ahd_update_modes() call.
o Correct panic in diagnostic should state corruption cause
the SCB Id to be invalid during a selection timeout.
o Add workaround for missing BUSFREEREV feature in Rev A silicon.
o Corect formatting nits.
o Use register pretty printing in more places.
o Save and restore our SCB pointer when updating the waiting queue
list for an "expected" LQ-out busfree.
o In ahd_clear_intstat, deal with the missing autoclear in the
CLRLQO* registers.
o BE fixup in a diagnostic printf.
o Make sure that we are in the proper mode before disabling
selections in ahd_update_pending_scbs.
o Add more diagnostics.
o task_attribute_nonpkt_tag -> task_attribute: we don't need a
nonpkt_tag field anymore for allowing all 512 SCBs to be
used in non-packetized connections.
o Negotiate HOLD_MCS to U320 devices.
o Add a few additional mode assertions.
o Restore the chip mode after clearing out the qinfifo so that
code using ahd_abort_scbs sees a consistent mode.
o Simplify the DMA engine shutdown routine prior to performing
a bus reset.
o Perform the sequencer restart after a chip reset prior to
setting up our timer to poll for the reset to be complete.
On some OSes, the timer could actually pre-empt us and order
is important here.
o Have our "reset poller" set the expected mode since there is
no guarantee of what mode will be in force when we are called
from the OS timer.
o Save and restore the SCB pointer in ahd_dump_card_state(). This
routine must not modify card state.
o Ditto for ahd_dump_scbs().
aic79xx.h:
o Add a few more chip bug definitions.
o Align our tag on a 32bit boundary.
aic79xx.reg:
aic79xx.seq:
o Start work on removing workarounds for Rev B.
o Use a special location in scratch from for stroring
our SCBPTR during legacy FIFO allocations. This corrects
problems in mixed packetized/non-packetized configurations
where calling into a FIFO task corrupted our SCBPTR.
o Don't rely on DMA priority to guarantee that all data in
our FIFOs will flush prior to a command completion notification
going out of the command channel. We've never seen this assumption
fail, but better safe than sorry.
o Deal with missing BUSFREEREV feature in H2A.
o Simplify disconnect list code now that the list will always
have only a single entry.
o Implement the AHD_REG_SLOW_SETTLE_BUG workaround.
o Swith to using "REG_ISR" for local mode scratch during
our ISR.
o Add a missing jmp to the data_group_dma_loop after our
data pointers have been re-initialized by the kernel.
o Correct test in the bitbucket code so that we actually
wait for the bitbucket to complete before signaling the
kernel of the overrun condition.
o Reposition pkt_saveptrs to avoid a jmp instruction.
o Update a comment to reflect that the code now waits for
a FIFO to drain prior to issuing a CLRCHN.
aic79xx_inline.h:
o Remove unused untagged queue handling code.
o Don't attempt to htole64 what could be a 32bit value.
aic79xx_pci.c:
o Set additional bug flags for rev A chips.
aac driver dependent on the linux emulation module. This was
especially bad for the release engineers who tried to move the
aac driver from the kernel onto the drivers floppy. The linux
compat bits for this driver are now in their own driver, aac_linux.
It can be loaded as a module or compiled into the kernel. For
the latter case, the AAC_COMPAT_LINUX option is needed, along with
the COMPAT_LINUX option.
I've tested this in every configuration I can think of. This is an
MFC candidate for 4.7.
Idea from: rwatson
MFC after: 3 days
Linux driver defines 0x103[B-E] so add those as well.
Obtained from: Intel Linux e100 driver
MFC: Immediately if re@ allows it, otherwise after 4.7-RELEASE
of 1024- Ultra4 256). Rename 'requests' tag to 'request_pool' for clarity.
Make sure we do correct xpt_freeze_simq/CAM_RELEASE_SIMQ if we run out
of chip resources.
MFC after: 6 days
In mpttimeout, call mpt_intr just on the offchance that we missed
an interrupt. We can check to see whether or not the command that
is timing out got completed.
When we *do* decide to timeout a command, set the command state to
REQ_TIMEOUT and then invoke another timeout (hz/10)- mpttimeout2.
This allows us to catch a couple cases we've seen where the command
we timed out on in fact is ready to be completed by the firmware.
In any case, it's only after mpttimeout2 is called that we actually
take down the private state and free the request itself. CAM has
been notified in mpttimeout anyway. This whole area should be redone,
but that will take 105% of my available game time for this month.
Fix a couple of missing (and not useful, at presnet) CAMLOCK_2_MPTLOCK
and MPTLOCK_2_CAMLOCK locations.
Split mpt_notify into mpt_ctlop, which handles all reply completions
that have 0x800000000 or'd into the ContextID. This function can, in
fact, call mpt_event_notify_reply, which handles the traditional
async event notifications. While we're at it, put in the extremely
important (but currently untested) code that send back an Ack to
an Event Notification (if the Event Notification is marked with
AckRequired). Note that an Ack also generates another ctlop completion,
tra la.
Fix up mpt_done substantially to try and get how we plug into CAM
correctly done. Remove bogus CAM_RELEASE_SIMQ settings.
Do some cleanups in mpt_action that are related to speed negotiation
for Ultra4 cards. This is an area that is still quite fragile and
worrisome as config data being read back often doesn't make sense or
jibe with the documentation.
At any rate, after these changes were done, I was finally able to
get Lars Eggert's dual 320M disk system to stay up under load all
weekend- hopefully we're in good enough for now shape.
MFC after: 1 week
Define the CFG_DAGA_OFF offset as 128 bytes instead of 40- gives us
a more reasonable headroom.
When reading a config page, zero out the entire request area- not just
the length of the request. This is because we cleverly (cheezily) return
configuration data back into the allocated request area, so it's nice
to make sure we start with a clean area to write on.
MFC after: 1 week
Instead, based upon whether ISP_DAC_SUPPORTED is defined, typedef
isp_dma_addr_t appropriately.
If ISP_DAC_SUPPORTRED is defined, the DMA_WD2/DMA_WD3 macros do something
useful, else they define to '0'.
defined, we set the address space limitation to BUS_SPACE_UNRESTRICTED,
otherwise to BUS_SPACE_MAXADDR_32BIT.
If we have a 1240, ULTRA2 or better, or an FC card, the boundary limit
is BUS_SPACE_UNRESTRICTED and segment limit is BUS_SPACE_MAXADDR_32BIT.
The older 1020/1040 cards have boundary and segment limits of
BUS_SPACE_MAXADDR_24BIT.
disabling memory write invalidate unconditionally. It looks like
they've decided that MWI just doesn't work with these devices.
Also, remove now-irrelevant code that set PCI write boundary values
based on the cache line size.
MFC after: 2 weeks
and predictable way, and I apologize if I have gotten it wrong anywhere,
getting prior review on a patch like this is not feasible, considering
the number of people involved and hardware availability etc.)
If struct disklabel is the messenger: kill the messenger.
Inside struct disk we had a struct disklabel which disk drivers used to
communicate certain metrics to the disklayer above (GEOM or the disk
mini-layer). This commit changes this communication to use four
explicit fields instead.
Amongst the benefits is that the fields do not get overwritten by
wrong or bogus on-disk disklabels.
Once that is clear, <sys/disk.h> which is included in the drivers
no longer need to pull <sys/disklabel.h> and <sys/diskslice.h> in,
the few places that needs them, have gotten explicit #includes for
them.
The disklabel inside struct disk is now only for internal use in
the disk mini-layer, so instead of embedding it, we malloc it as
we need it.
This concludes (modulus any mistakes) the series of disklabel related
commits.
I belive it all amounts to a NOP for all the rest of you :-)
Sponsored by: DARPA & NAI Labs.
RXSTATE to STOPPED, but to WAIT. This should fix hangs which
could only be solved by replugging the cable.
Submitted by: jhb
Reviewed by: phk
MFC after: 2 weeks
Rename diskerr() to disk_err() for naming consistency.
Drop the by now entirely useless struct disklabel argument.
Add a flag argument for new-line termination.
Fix a couple of printf-format-casts to %j instead of %l.
Correctly print the name of all bio commands.
Move the function from subr_disklabel.c to subr_disk.c,
and from <sys/disklabel.h> to <sys/disk.h>.
Use the new disk_err() throughout, #include <sys/disk.h> as needed.
Bump __FreeBSD_version for the sake of the aac disk drivers #ifdefs.
Remove unused disklabel members of softc for aac, amr and mlx, which seem
to originally have been intended for diskerr() use, but which only rotted
and got Copy&Pasted at least two times to many.
Sponsored by: DARPA & NAI Labs.
previous commit:
Include <sys/mutex.h> and its prerequisite <sys/lock.h> instead of
depending on namespace pollution in <sys/buf.h>. Only do this in the
__FreeBSD_version > 500000 case although the __FreeBSD_version < 500000
case has already rotted.
(what we want to mask is the ATA interrupts, which run at level splbio),
and add interrupt masking around the statement that modifies the
request queue for a SIM.
This resolves problems reported by users under heavy ATAPI load.
Reviewed by: roberto
reprobe code working. This bogusness was thrust upon me.
o Don't delete the device if no drivers attach. I had thrust this bogusness
upon others.
These two changes make kldload of a pccard driver work again.
cards to test; however the submitter reports that this patch works
with the on-board interface on the IBM x235 server.
Submitted by: Jung-uk Kim <jkim@niksun.com>
MFC after: 1 month
- Get the initial mode from the prom settings and don't clobber the mode
on open.
- Copy output into an internal ring buffer instead of accessing the tty
outq directly in the interrupt handler. This fixes a problem where
garbage would show up in the output stream.
- Reset the console port completely and reprogram all the parameters
before enabling it. This fixes seemingly random hangs on startup
when using a fast interrupt handler.
- Add minimal locking in place of spls.
- Remove dead code and minor cleanups.
any machine dependent initialization. This allows the MD code to set the
interrupt routing model so that PCI interrupts are routed correctly when
using an APIC or SAPIC for example.
In this installment, we learn that it is bad to access registers that
are only defined for mfc cards in the interrupt handler when we do not
in fact have a mfc card. For MFC cards, we'll only call the ISR if
the this card interrupted bit is set. For non mfc cards (which are
basically 90% of pccards in use), we always call the ISR and avoid
touching the suspect registers. We always pacify the bit in the MFC
case on the off chance that will help in the itnerrupt handler not
being registed.
when the first PCI bus attaches.
- Create /dev/pci during MOD_LOAD as well.
- Destroy /dev/pci during MOD_UNLOAD (not that you can kldunload pci, but
might as well get the code right)
PUC devices live on pccard or pci so INTR_FAST is never really an option.
Don't try to register the interrupt as fast and don't allow the children
to do so either.
- add bus capabilities into the driver, so that it is possible for a radio
driver to attach to it to use shared resources of fm801 chip. The radio
driver itself will be committed later.
MFC after: 1 week
a) we don't believe what the board tells us all the time (if the BIOS
hasn't run, port page 2 and port page 0 tend to be garbage)
b) add the missing code to set parameters for the SPI cards.
MFC after: 0 days
on -current. Actually copy in data from userspace to kernel in the
linux-compat ioctl path. Make sure ioctl sizes are as expected in the handler
functions.
Reviewed by: rwatson
right places, and so it's sorted consistently with how all the other N-hundreds
of files ding this do it.
Submitted by: Hiten Pandya <hiten@uk.FreeBSD.org>
Don't expect all RIDs to be PCI rids. The previous code made at
least 1 mistake, even for PCI.
Give the card definitions a chance to specify a init function.
Use this instead of the gross superio hack.
Move the win877 init function to puc_pci.c where it belongs.
RIDs can actually be zero, don't set badmuxed if so.
Set a less incorrect end for the construct SYS_RES_IOPORT entries,
I guess both sio and lpt happen to use 8 IO ports, but that shouldn't
really be hardcoded this way.
Fixup puc_pccard.c to match.
We're getting closer.
Don't set the CCR_OPTION register when registering/deregistering
interrupts unless the card is a MFC card. This makes a lot of cards
work that didn't work before. These bits are only defined for MFC
cards.
Remove COOKIE_FOR_WARNER kludges that phk introduced.
Add more debug info.
Annoy the purists by committing two minor style nits at the same time.
Many thanks to phk. He tracked this problem down to what was screwing
things up, so fixing it became trivially easy once the problem was
understood.
This ensures that we don't enter our interrupt handler until
all OSM components it might reference have been fully initialized
during attach.
Remove vestiges of untagged queue handling.
Add hints to ahd_get_scb() so it knows what type of SCB collision
management to perform for each new transaction.
Properly disable/enable IU_REQ with changes in tagged queuing and
disconnection settings passed in by CAM.
Uninline some routines that are just too big to be inlined.
Add some helper macros for SCB ID collision management.
Use a hardware SCB rather than a full SCB for the "next
SCB to queue" sentinal.
Update for new "high SCBID bit" qoutfifo delivery scheme.
If interrupts are disabled on the card, don't bother running
our interrupt handler. Our handler was called due to a shared
interrupt, and the card's interrupts are explicitly disabled
to prevent entry into our interrupt handler.
functions for register pretty-printing.
Implement "top bit of SCBID is valid bit" qoutfifo delivery scheme.
"the the" -> "the".
Remove old and never used tag collision chain handling in the
sequencer. Tag collisions are never allowed to get as far as
on the controller.
Simplify busy target table handling routines.
Update comments to reflect reality.
Add support for catching more protocol violations.
Correct a bug in data fifo handling in mixed packetized and
non-packetized environments. SG_STATE must be cleared even
if an SG fetch is not in progress at the time of FIFO shutdown
or we may confuse the non-packetized transaction idle-loop.
busy target table addressing changes, our qoufifo scheme,
and long lun support.
Drop bus reset hold delay to 25us.
Remove chip workarounds for revisions that never went to
production.
Add aic7901A identification information.
Remove untagged queue logic.
Push protocol violation handler to its own routine. We now
properly detect and recovery from the following target induced
protocol violations:
o Unexpected or invalid non-packetized Relesection
o Command complete with no status message
o Good Status after incomplete cdb transfer
Add an SCB collision avoidance algorithm that allows us to
use all 512 SCBs for non-packetized operations. There is
still the possibility of running out of SCBs with non-colliding
tag identifiers, but the algorithm ensures that the stall will
be rare and short lived.
Convert to a read-only algorithm for validing entries in the
qoufifo. The sequencer now toggles the high bit of the SCB
identifier on each wrap around of the qinfifo. If the high
bit doesn't match the expected value for this pass of the
qoufifo, the entry is not valid. This has the benefit of
working on machines that have large granularity cache write
back semantics without requiring any additional memory.
Remove lots of code related to untagged SCB queues. Since
these controllers can keep a fully busy target table, we
will never have untagged SCB queues.
Lots of improvements to diagnostic logging.
Clarify some comments.
Don't clear BUSFREE interrupt enable in SIMODE1 in the SELTO
handler. Just clearing the interrupt status is sufficient and
this avoids the chance of disabling busfree detection in connection
that occurs while we are handling the busfree interrupt.
Clear all possible interrupt sources when handling a busfree
interrupt. The hardware clears some but not all of them.
Don't panic if we get into the default SCSIINT handler.
Dump the card state and clear all interrupt sources in the
hope that we can continue.
LASTPHASE != PREVPHASE. Use the correct PREVPHASE for testing
against values in the PERRDIAG register.
According to SPI4, the bus free that is required after certain
PPR negotiations will only occur at the end of all message phases.
Handle the bus free if it occurs after a transaction in either
the message-in or message-out phases. The busfree can also occur
if the status of IU_REQ changes due to a WDTR or SDTR message.
We now set the expect busfree flag in ahd_set_syncrate so that
it works regardless of message type.
Correct a problem with missing certain busfree events. The
chip supports single-stepping even if a SCSIINT is pending.
This obviates the need to clear all of the SCSI interrupt enables
prior to single stepping. Since ENBUSFREE can only be disabled
manually and not re-enabled, avoiding touching this bit in the
single-step case yields reliable bus free detection.
Enhance ahd_clear_intstat to clear all SCSIINT sources.
Only use ahd_update_pending_scbs() if we are active on the
bus. We cannot modify the "MK_MESSAGE" bits on SCBs in the
execution queue if a selection might be in process since
the sequencer uses this bit to detect PPR negotiation to
a target with an outstanding IU_REQ agreement.
Allocate the SCB delivery mechansim's sentinal SCB specially
so we don't waste a valid SCB for this task.
Move tranceive state settle logic to ahd_chip_init() since
this needs to occur after every chip reset, not just the
chip reset that happens during primary driver initialization.
Correct a bug with transmitting lun information in packetized
connections.
Restrict busy target table operations to the range of luns
that can be used for non-packetized connections. Larger luns
can only be accessed in packetized mode.
Correct a busy target table addressing bug.
Be more careful about how we shutdown the DMA engines during
bus reset events.
Only freeze the SIMQ once regardless of the number of bus
reset events that occur while we are polling for the resets
to stop.
Don't rely on the sequencer remaining paused() during our
reset poll. It is safe for the sequencer to run during this
time, and many callers to the bus reset code would need to
be modified to make this assumption universally true.
Even if we are not going to clobber SCB state when an auto-request
sense SCB has a check condition, we must still unfreeze the queue.
Re-arrange the BAD STATUS handler to handle this case appropriately.
Modify the SCB download size depending on whether long luns are
being stored in the SCB.
Add ahd_print_register() for pretty printing register diagnostics.
Don't trust that the flexport logic to detect the presence of
a seeprom is available. It may not be on some motherboard
implementations.
"the the" -> "the"
our interrupt handler. Our handler was called due to a shared
interrupt, and the card's interrupts are explicitly disabled
to prevent entry into our interrupt handler.
Set the AHC_LSCBS_ENABLED softc flag appropriately.
Convert to using softc storage for our seeprom data.
Break seeprom parsing out into a separate routine.
Change our policy in regards to AHC_SPIOCAP so that we
will allow auto-termination to take place on some aic7855
based cards.
Remove initialized but never really used variables.
Use "offset == 0" not "period == 0" to denote async trasnfers.
Implement TARG_IMMEDIATE_SCB non-disconnected target mode
SCB delivery scheme.
In our timeout handler, don't rely on the phase already being
set to denote an active connection. IDENTIFY_SEEN is more
than sufficient.
Verify that the softc passed in ahc_detach is still known
to the driver before blindly using it.
functions for register pretty-printing.
Only clear SELDO once we've recorded enough information for
the host to understand that the connection is valid. The
host uses the SELDO status as a handshake to close this
race window.
Correct a bug in target mode handling of non-disconnected
transactions. The host would indicate the correct SCB to
DMA by setting the SCB id in the currently selected hardware
SCB. Unfortunately, we would then immediated allocate a
hardware SCB which, depending on the access patern might not
be the same hardware SCB that the host setup for us. Avoid
this by having the host put the SCBID into scratch ram.
Document the SXFRCTL2 register found on U2 and U160 controllers.
Overload the MWI_RESIDUAL field for use as the SCB to be downloaded
for "immediate" (or those without the disconnect privledge)
transactions.
Add scratch ram locations for the 274X that give us a bit more
information including whether to enable extended translation.
value slipped in from a debugging session.
Add AHC_LSCBS_ENABLED and AHC_SCB_CONFIG_USED ahc_flags which
allow for some code to move to the core.
Remove extern for ahc_syncrates[]. The OSMs no longer need
direct access to this array.
Add serial eeprom field to the ahc softc.
Prototype ahc_search_untagged_queues() and ahc_print_register().
Convert to AHC_SHOW_XXX debug option format.
Switch to using the same AHC_SHOW_XXX format as the ahd driver.
Always give the target a MSG_INITIATOR_DET_ERR for unexpected
DT or ST phase errors.
Add AHC_SHOW_SELTO diagnostics.
Force renegotiation whenever an unexpected bus free occurs
to rule out a negotiation mismatch as the cause for the error.
Use "offset != 0" as an intenal indicator of "async" rather than
using a period of 0.
In ahc_fetch_devinfo(), correct a bug in getting "our id" as
target. We weren't looking at all the SEQ_FLAGS that indicate
that we are still in a selected rather than reselected state.
Add support for the AHC_SHOW_MESSAGES debugging option.
If ahc_parse_msg() tells us to terminate the message loop,
do so without acking the message. The message may be one
that the sequencer needs to handle on its own.
In ahc_parse_msg() return MSGLOOP_TERMINATED for all messages
the sequencer handles.
Allocate storage for, and track, seeprom contents in our softc.
Touch all SCB bytes to avoid parity errors should one of our
debugging routines read an otherwise uninitiatlized byte.
S/G lists must be 8 byte aligned. Reflect this in our DMA tag.
"the the" -> "the" in a comment
When pausing the card to perform error recovery, ensure that we
are not in the process of being selected or have just been selected
but have not yet handled that selection. This leaves only one other
race window, in the command complete handler, that needs to be fixed
to make recovery 100% bullet proof.
Convert a few straglers from bsd u_intX_t to inttypes uintX_t.
Remove unused variables.
Split out searching of the untagged holding queues to its own
routine. In certain recovery scenarios, we want to just
remove entries in the untagged queue without touching related
transactions that are in the QINFIFO or WAITING queues that are
searched by ahc_search_qinfifo().
Add an implementation of the ahc_print_register() routine which
"pretty prints" registers. The extra bloat in the form of string
tables for this feature is controlled by the AHC_REG_PRETTY_PRINT
option.
Fix a few bugs in ahc_enable_lun() that could prevent controllers
lacking the multiple-target-id feature from changing "our id" on
the fly. Add a large comment to this section while I'm here
describing the restrictions on "id switching".
Honor the extended translation setting for EISA cards now that
I've determined where this information is kept.
Defer card interrupt enabling to the OSM since it may have
some initialization to perform that must occur before interrupts
can be enabled.
Fix device hints entry for disabling acpi(4).
This also should fix the arbitration with apm(4) when both drivers
are enabled.
Note that your /boot/device.hints needs to be updated if you want to
stop auto-loading acpi.ko or disable acpi(4).
attach. If it can't get that (highly likely if loaded as a module on
a system that's been up for a while), give a more descriptive error
message.
Also clean up some nearby style nits.
MFC after: 2 days
Replace dual copyright with a plain BSD style copyright assigned
to LSI Logic. This is still within the intents of express consent
from LSI.
MFC after: 2 days