Commit Graph

342 Commits

Author SHA1 Message Date
Scott Long
b50569b71d Prepare for future integration between CAM and newbus. xpt_bus_register
now takes a device_t to be the parent of the bus that is being created.
Most SIMs have been updated with a reasonable argument, but a few exceptions
just pass NULL for now.  This argument isn't used yet and the newbus
integration likely won't be ready until after 7.0-RELEASE.
2007-06-17 05:55:54 +00:00
Hidetoshi Shimokawa
99b242f354 - Lock sbp_write_cmd() and ORB_POINTER_ACTIVE flag.
- Remove unnecessary timestamps.
- Return CAM_RESRC_UNAVAIL for ORB shortage.
- Fix a lock problem when doorbell is used.
- Fix a potential bug for unordered execution.
2007-06-16 00:59:41 +00:00
Hidetoshi Shimokawa
9b33b1ab38 - Suppress compiler optimization so that orb[1] must be written first.
We may need an explicit memory barrier for other architectures other than i386/amd64.

MFC after: 3 days
2007-06-14 12:52:13 +00:00
Hidetoshi Shimokawa
c59557f5d4 Timestamp after sent. 2007-06-08 09:04:30 +00:00
Hidetoshi Shimokawa
7acf69638a Fix a race after a bus reset.
- We are in FWBUSINIT state just after SID interrupt.
- Do not pass normal xfers before bus probe is done.
2007-06-08 07:53:59 +00:00
Matt Jacob
ea47b6c8d2 Include now unused var within #if 0 where it come back if the other
#if 0 code comes back- quiets gcc 4.2
2007-06-08 01:34:04 +00:00
Hidetoshi Shimokawa
ac2d2894b4 Add a tunable hw.firewire.phydma_enable.
This is enabled by default.  It should be disabled for
those who are uneasy with peeking/poking from FireWire.

Please note sbp(4) and dcons(4) over FireWire need
this feature.
2007-06-07 13:20:48 +00:00
Andrew Gallatin
4930d13c50 Fix a typo to make this file compile 2007-06-06 18:33:38 +00:00
Hidetoshi Shimokawa
9950b741e9 MFp4: MPSAFE firewire stack.
- lock its own locks and drop Giant.
- create its own taskqueue thread.
- split interrupt routine
- use interrupt filter as a fast interrupt.
- run watchdog timer in taskqueue so that it should be
   serialized with the bottom half.
- add extra sanity check for transaction labels.
   disable ad-hoc workaround for unknown tlabels.
- add sleep/wakeup synchronization primitives
- don't reset OHCI in fwohci_stop()
2007-06-06 14:31:36 +00:00
Hidetoshi Shimokawa
bebdf94c45 Make sure fwsid is not NULL.
MFC after: 3 days
2007-05-21 12:17:54 +00:00
Hidetoshi Shimokawa
9404513cfa MFp4: Simplify the bus probe routin using a kthread.
MFC after: 1 week
2007-05-21 02:18:50 +00:00
Hidetoshi Shimokawa
c6cf3e202a - Initialize login->id and fix problem for non-zero login id.
- Increase maxopenings for multiple lun/initiators.

MFC after: 3 days
2007-05-11 14:51:13 +00:00
Hidetoshi Shimokawa
0cf4488ab4 MFp4: Improve asynchronous packet receive process.
- Wake up DMA engine after adding a new receive buffer.
- Skip buffers which have unknown state after error.
- More rigid error detection.

MFC after: 1 week
2007-04-30 14:06:30 +00:00
Hidetoshi Shimokawa
2c70b09005 MFp4:
- Update state in fw_xferq_dorain() after removed from the send queue.
- Remove unnecessary 'goto err;".

MFC after: 1 week
2007-04-30 13:51:13 +00:00
Hidetoshi Shimokawa
0892f4c5ec MFp4: Fix broken userland API for async packets.
- Introduce fw_xferlist_add/remove().
- Introduce fw_read/write_async().
- Remove unused FWACT_CH.

MFC after: 1 week
2007-04-30 13:41:40 +00:00
Hidetoshi Shimokawa
5cc9512ae2 MFp4: Fix typo in recv spd.
MFC after: 1 week
2007-04-30 12:55:03 +00:00
Hidetoshi Shimokawa
6b3ecf71ea MFp4: Add a sysctl knob to disable cycle master mode and add some comments.
MFC after: 1 week
2007-04-30 12:38:50 +00:00
Hidetoshi Shimokawa
78b1168bd8 MFp4: remove unused fw_asybusy().
MFC after: 1 week
2007-04-30 12:30:21 +00:00
Hidetoshi Shimokawa
89cad4614f MFp4: Simplify tlabel handling
- Remove struct tl_label and runtime malloc() for it.
- Include tl_lable list in struct fw_xfer.
- Don't free unallocated tlabel.

MFC after: 1 week
2007-04-30 12:26:29 +00:00
Hidetoshi Shimokawa
ad9cf50615 Initialize configuration ROM before a bus reset.
MFC: after 3 days
2007-04-30 10:50:53 +00:00
Hidetoshi Shimokawa
e340a7ac14 Configuration ROM length should be unsigned.
MFC: 1 week
2007-04-24 12:15:05 +00:00
Pawel Jakub Dawidek
6b3d6017e8 s/destory/destroy/ (except for the code in contrib/). 2007-04-16 12:31:35 +00:00
Scott Long
2b83592fdc Remove Giant from CAM. Drivers (SIMs) now register a mutex that CAM will
use to synchornize and protect all data objects that are used for that
SIM.  Drivers that are not yet MPSAFE register Giant and operate as
usual.  RIght now, no drivers are MPSAFE, though a few will be changed
in the coming week as this work settles down.

The driver API has changed, so all CAM drivers will need to be recompiled.
The userland API has not changed, so tools like camcontrol do not need to
be recompiled.
2007-04-15 08:49:19 +00:00
Hidetoshi Shimokawa
437a3435c5 Teardown interrupt only when sc->ih is not NULL.
MFC after: 3 days
2007-03-30 22:25:26 +00:00
Hidetoshi Shimokawa
b34b30c5af Free tlabel in fw_xfer_done(). 2007-03-30 15:43:56 +00:00
Hidetoshi Shimokawa
f8d062cf84 - Don't call fw_busreset() in firewire_attach().
This should fix the problem that the first bus reset is
sometimes ignored because of FWBUSRESET status.

MFC after: 3 days
2007-03-30 14:41:24 +00:00
Hidetoshi Shimokawa
06767d306b Poll only while interrupt is disabled.
MFC: 3 days after
2007-03-19 03:41:27 +00:00
Hidetoshi Shimokawa
33662e369c Wait SCLK to be stable after LPS enabled.
This should fix NMI problem in fwphy_rddata().

PR: kern/94146 kern/100356
MFC: after 3 days
2007-03-19 03:35:45 +00:00
Hidetoshi Shimokawa
801167a869 Replace xfer->act.hand with xfer->hand. 2007-03-16 05:39:33 +00:00
Hidetoshi Shimokawa
f7cb7d5dd0 Remove retry_count. 2007-03-16 05:17:23 +00:00
Hidetoshi Shimokawa
976c8eadc9 * Remove xfer->retry_req.
It is unnecessary because retry is done by OHCI.
   Further retry should be done by applications.
2007-03-16 05:11:42 +00:00
Hidetoshi Shimokawa
ac44778260 Less verbose debug messages. 2007-03-16 04:26:58 +00:00
Hidetoshi Shimokawa
d0581de84e Detect cycle lost. 2007-03-16 04:25:02 +00:00
Hidetoshi Shimokawa
c6c2738201 Print warning for large DFLTPHYS. 2007-03-16 02:29:36 +00:00
Hidetoshi Shimokawa
319222274a Support MAXPHYS up to 512KB
- We need at least two OCBs with indirect pointers allocated in a 4KB page.
- SBP_MAXPHYS can increase to 1MB once we separate management OCB/ORB
  which usually does not need indirect pointers.
- We have to increase SBP_DMA_SIZE for MAXPHYS larger than 1MB.

MFC after: 3 days
2007-03-16 01:23:36 +00:00
Hidetoshi Shimokawa
4813ecc362 Don't mess with PCIM_CMD_SERRESPEN and PCIM_CMD_PERRESPEN.
This will fix 'NMI RAM parity error' while booting on some machines.

PR: kern/95077
MFC after: 3 days
2007-03-15 14:11:46 +00:00
John Baldwin
4d70511ac3 Use pause() rather than tsleep() on stack variables and function pointers. 2007-02-27 17:23:29 +00:00
Paolo Pisati
ef544f6312 o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@
2007-02-23 12:19:07 +00:00
Marius Strobl
c2175ff5ca Change the remainder of the drivers for DMA'ing devices enabled in the
sparc64 GENERIC and the sound device drivers known working on sparc64
to use bus_get_dma_tag() to obtain the parent DMA tag so we can get rid
of the sparc64_root_dma_tag kludge eventually. Except for ath(4), sk(4),
stge(4) and ti(4) these changes are runtime tested (unless I booted up
the wrong kernels again...).
2007-01-21 19:32:51 +00:00
John Baldwin
0dea849ae9 Various bpf(4) related fixes to catch places up to the new bpf(4)
semantics.
- Stop testing bpf pointers for NULL.  In some cases use
  bpf_peers_present() and then call the function directly inside the
  conditional block instead of the macro.
- For places where the entire conditional block is the macro, remove the
  test and make the macro unconditional.
- Use BPF_MTAP() in if_pfsync on FreeBSD instead of an expanded version of
  the old semantics.

Reviewed by:	csjp (older version)
2006-12-29 13:59:50 +00:00
Colin Percival
8b0a738288 Correct a signedness bug which allowed members of the operator
group to read kernel memory.

Security:	FreeBSD-SA-06:25.kmem
2006-12-06 09:13:51 +00:00
Matt Jacob
bd3fd815a7 2nd and final commit that moves us to CAM_NEW_TRAN_CODE
as the default.

Reviewed by multitudes.
2006-11-02 00:54:38 +00:00
Matt Jacob
fa9ed86506 The first of 3 major steps to move the CAM layer forward to using
the CAM_NEW_TRAN_CODE that has been in the tree for some years now.

This first step consists solely of adding to or correcting
CAM_NEW_TRAN_CODE pieces in the kernel source tree such
that a both a GENERIC (at least on i386) and a LINT build
with CAM_NEW_TRAN_CODE as an option will compile correctly
and run (at least with some the h/w I have).

After a short settle time, the other pieces (making
CAM_NEW_TRAN_CODE the default and updating libcam
and camcontrol) will be brought in.

This will be an incompatible change in that the size of structures
related to XPT_PATH_INQ and XPT_{GET,SET}_TRAN_SETTINGS change
in both size and content. However, basic system operation and
basic system utilities work well enough with this change.

Reviewed by:	freebsd-scsi and specific stakeholders
2006-10-31 05:53:29 +00:00
Warner Losh
d47f76464a Better printf 2006-06-12 04:00:33 +00:00
Warner Losh
ed3eb6ebe2 Don't type pun accidentally. Instead, be explicit that we're type
punning with an union so that the compiler knows.
2006-02-04 21:37:39 +00:00
Tom Rhodes
09c00166e4 Make tv_sec a time_t on all platforms but alpha. Brings us more in line with
POSIX.  This also makes the struct correct we ever implement an i386-time64
architecture.  Not that we need too.

Reviewed by:	imp, brooks
Approved by:	njl (acpica), des (no objects, touches procfs)
Tested with:	make universe
2005-12-24 22:22:17 +00:00
Hidetoshi Shimokawa
9e2cdfd1d1 Fix panic when we cannot find self-id of probing nodes.
This shouldn't happen as far as the self-id buffer is vaild but
some people have this problem.

PR: kern/83999
Submitted by: Markus Wild <fbsd-lists@dudes.ch>
MFC after: 3 days
2005-11-25 14:29:24 +00:00
Gleb Smirnoff
b7d59baad1 Fix typo.
Submitted by:	maxim
MFC after:	3 days
2005-10-11 07:30:06 +00:00
Gleb Smirnoff
f0796cd26c - Don't pollute opt_global.h with DEVICE_POLLING and introduce
opt_device_polling.h
- Include opt_device_polling.h into appropriate files.
- Embrace with HAVE_KERNEL_OPTION_HEADERS the include in the files that
  can be compiled as loadable modules.

Reviewed by:	bde
2005-10-05 10:09:17 +00:00
Gleb Smirnoff
4092996774 Big polling(4) cleanup.
o Axe poll in trap.

o Axe IFF_POLLING flag from if_flags.

o Rework revision 1.21 (Giant removal), in such a way that
  poll_mtx is not dropped during call to polling handler.
  This fixes problem with idle polling.

o Make registration and deregistration from polling in a
  functional way, insted of next tick/interrupt.

o Obsolete kern.polling.enable. Polling is turned on/off
  with ifconfig.

Detailed kern_poll.c changes:
  - Remove polling handler flags, introduced in 1.21. The are not
    needed now.
  - Forget and do not check if_flags, if_capenable and if_drv_flags.
  - Call all registered polling handlers unconditionally.
  - Do not drop poll_mtx, when entering polling handlers.
  - In ether_poll() NET_LOCK_GIANT prior to locking poll_mtx.
  - In netisr_poll() axe the block, where polling code asks drivers
    to unregister.
  - In netisr_poll() and ether_poll() do polling always, if any
    handlers are present.
  - In ether_poll_[de]register() remove a lot of error hiding code. Assert
    that arguments are correct, instead.
  - In ether_poll_[de]register() use standard return values in case of
    error or success.
  - Introduce poll_switch() that is a sysctl handler for kern.polling.enable.
    poll_switch() goes through interface list and enabled/disables polling.
    A message that kern.polling.enable is deprecated is printed.

Detailed driver changes:
  - On attach driver announces IFCAP_POLLING in if_capabilities, but
    not in if_capenable.
  - On detach driver calls ether_poll_deregister() if polling is enabled.
  - In polling handler driver obtains its lock and checks IFF_DRV_RUNNING
    flag. If there is no, then unlocks and returns.
  - In ioctl handler driver checks for IFCAP_POLLING flag requested to
    be set or cleared. Driver first calls ether_poll_[de]register(), then
    obtains driver lock and [dis/en]ables interrupts.
  - In interrupt handler driver checks IFCAP_POLLING flag in if_capenable.
    If present, then returns.This is important to protect from spurious
    interrupts.

Reviewed by:	ru, sam, jhb
2005-10-01 18:56:19 +00:00