Commit Graph

320 Commits

Author SHA1 Message Date
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
Brooks Davis
d3c497e1c8 Remove an unnecessicary bzero that was zeroing the softc's struct ifnet
pointer.

Submitted by:	brueffer
Reviewed by:	dfr
2005-08-17 18:53:06 +00:00
Robert Watson
13f4c340ae Propagate rename of IFF_OACTIVE and IFF_RUNNING to IFF_DRV_OACTIVE and
IFF_DRV_RUNNING, as well as the move from ifnet.if_flags to
ifnet.if_drv_flags.  Device drivers are now responsible for
synchronizing access to these flags, as they are in if_drv_flags.  This
helps prevent races between the network stack and device driver in
maintaining the interface flags field.

Many __FreeBSD__ and __FreeBSD_version checks maintained and continued;
some less so.

Reviewed by:	pjd, bz
MFC after:	7 days
2005-08-09 10:20:02 +00:00
Robert Watson
6a113b3de7 Merge the dev_clone and dev_clone_cred event handlers into a single
event handler, dev_clone, which accepts a credential argument.
Implementors of the event can ignore it if they're not interested,
and most do.  This avoids having multiple event handler types and
fall-back/precedence logic in devfs.

This changes the kernel API for /dev cloning, and may affect third
party packages containg cloning kernel modules.

Requested by:	phk
MFC after:	3 days
2005-08-08 19:55:32 +00:00
Warner Losh
4143dbe3ea The Sony i.LINK CXD1947 device is a firewire bridge, but it doesn't
implement the OHCI programming interface.  Thus it probes, but fails
to attach because of an invalid OHCI version.  Rather than count on
the downstream tests properly failing, print a message that this
chipset isn't supported and fail the probe.
2005-07-17 19:59:07 +00:00
Brooks Davis
fc74a9f93a Stop embedding struct ifnet at the top of driver softcs. Instead the
struct ifnet or the layer 2 common structure it was embedded in have
been replaced with a struct ifnet pointer to be filled by a call to the
new function, if_alloc(). The layer 2 common structure is also allocated
via if_alloc() based on the interface type. It is hung off the new
struct ifnet member, if_l2com.

This change removes the size of these structures from the kernel ABI and
will allow us to better manage them as interfaces come and go.

Other changes of note:
 - Struct arpcom is no longer referenced in normal interface code.
   Instead the Ethernet address is accessed via the IFP2ENADDR() macro.
   To enforce this ac_enaddr has been renamed to _ac_enaddr.
 - The second argument to ether_ifattach is now always the mac address
   from driver private storage rather than sometimes being ac_enaddr.

Reviewed by:	sobomax, sam
2005-06-10 16:49:24 +00:00
Marius Strobl
c44123e174 Recognize the integrated (though not necessarily enabled) FireWire
controllers of Sun PCIO-2 chips which are used onboard in most of
the newer PCI-based sun4u machines (cosmetic change as they were also
already probed as generic FWOHCI without this). As with gem(4), hme(4)
and ohci(4) detect whether their intpin register is valid and correct
it if necessary, i.e. set the respective IVAR to the right value for
allocating the IRQ resource, as some of them come up having it set
to 0 (in fact in all machines I'm currently aware of the FireWire
part being enabled). This fixes attaching affected controllers.

Apporved by:	simokawa
Tested by:	Michiel Boland <michiel@boland.org>
MFC after:	1 month
2005-05-20 12:37:16 +00:00
Poul-Henning Kamp
f4f6abcb4e Explicitly hold a reference to the cdev we have just cloned. This
closes the race where the cdev was reclaimed before it ever made it
back to devfs lookup.
2005-03-31 12:19:44 +00:00
Sam Leffler
b083b7c98d fix potential null ptr deref
Submitted by:	Coverity Prevent analysis tool
2005-03-29 01:44:59 +00:00
Warner Losh
538565c4a5 Use BUS_PROBE_DEFAULT for pci probe return value 2005-03-05 18:30:12 +00:00
Hidetoshi Shimokawa
e726a7e116 Clear PCIM_CMD_SERRESPEN and PCIM_CMD_PERRESPEN for broken hardware.
Some amd64 laptops fail to boot with these flags.

PR: kern/75482
2005-01-06 07:40:34 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
John-Mark Gurney
d17d400489 return after freeing data element, instead of falling through, and using
the free'd element, and ultimate NULL deref of the failed allocation.

MFC after:	1 week
2005-01-04 18:15:27 +00:00
Hidetoshi Shimokawa
0fd466727c Fix malloc type in free(). 2004-11-10 06:21:47 +00:00
Hidetoshi Shimokawa
fcbe55a58d Respect _BOOT flag. 2004-10-22 15:39:39 +00:00
Hidetoshi Shimokawa
e794746d65 Add a missing splx(). 2004-09-06 20:42:34 +00:00
Hidetoshi Shimokawa
ce7bda463c Remove an unused variable. 2004-08-29 13:45:55 +00:00
Robert Watson
83bcc8bda0 Assert Giant in fwe_start(), as it is not yet MPSAFE. 2004-08-18 04:54:54 +00:00
Robert Watson
a1755216cf Since if_fwip doesn't contain locking or run with INTR_MPSAFE, mark
the interface as IFF_NEEDSGIANT so if_start is run holding Giant.

Approved by:	dfr
2004-08-13 23:09:41 +00:00
Robert Watson
52bc12b3da Set IFF_NEEDSGIANT for fwe network interface since the firewire
framework isn't yet MPSAFE.

Approved by:	simokawa
2004-08-12 03:02:16 +00:00
Hidetoshi Shimokawa
433dd56b71 Fix and add deivce ID's.
Obtained from: DragonFly BSD
2004-08-04 12:18:39 +00:00
Alexander Kabaev
eec256de79 Avoid casts as lvalues. 2004-07-28 06:21:53 +00:00
Doug Rabson
2f8e2ebbe2 Temporary fix for interoperability with Windows and OS X. A more complete
fix will follow when its ready.

Submitted by: simokawa
2004-07-20 08:58:27 +00:00