Commit Graph

298 Commits

Author SHA1 Message Date
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
Hidetoshi Shimokawa
f9d9941f2d Don't output too many debug messages for bootverbose.
This driver seems to be fairly stable now.
2004-07-20 04:49:44 +00:00
Hidetoshi Shimokawa
f77993e5e0 Initialize ifp->if_output for FreeBSD-4. 2004-07-20 04:29:33 +00:00
Hidetoshi Shimokawa
af21fc1195 Adjust packet length correctly for FreeBSD-4.
Submitted by: Joerg Sonnenberger <joerg@britannica.bec.de>
2004-07-20 03:56:23 +00:00
Hidetoshi Shimokawa
6e2b0d0b25 Add some PCI IDs for OHCI chips.
Obtained from: DragonFly BSD
2004-07-17 09:41:20 +00:00
Poul-Henning Kamp
3e019deaed Do a pass over all modules in the kernel and make them return EOPNOTSUPP
for unknown events.

A number of modules return EINVAL in this instance, and I have left
those alone for now and instead taught MOD_QUIESCE to accept this
as "didn't do anything".
2004-07-15 08:26:07 +00:00
John Baldwin
39981fed82 Trim a few things from the dmesg output and stick them under bootverbose to
cut down on the clutter including PCI interrupt routing, MTRR, pcibios,
etc.

Discussed with:	USENIX Cabal
2004-07-01 07:46:29 +00:00
Warner Losh
794950069f Remove the setting of the pci config variables on power state changes.
The bus does this now.
2004-06-28 20:26:21 +00:00
Hidetoshi Shimokawa
e1ebf69098 Fix the description of hw.firewire.sbp.exclusive_login.
Submitted by: KIYOHARA Takashi <kiyohara@kk.iij4u.or.jp>
2004-06-18 08:02:49 +00:00
Poul-Henning Kamp
f3732fd15b Second half of the dev_t cleanup.
The big lines are:
	NODEV -> NULL
	NOUDEV -> NODEV
	udev_t -> dev_t
	udev2dev() -> findcdev()

Various minor adjustments including handling of userland access to kernel
space struct cdev etc.
2004-06-17 17:16:53 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Doug Rabson
c2216c0ac6 Fix spelling. 2004-06-15 16:03:49 +00:00
Doug Rabson
ee2f2ccc2f If we run out of transmission labels, just re-queue the packet for later
instead of printing endless error messages on the console and discarding
the packet.
2004-06-14 09:34:20 +00:00
Doug Rabson
04fa3b29f5 Add configuration rom entries for IP over firewire. 2004-06-13 13:58:00 +00:00
Doug Rabson
b8b3323469 Add a new driver to support IP over firewire. This driver is intended to
conform to the rfc2734 and rfc3146 standard for IP over firewire and
should eventually supercede the fwe driver. Right now the broadcast
channel number is hardwired and we don't support MCAP for multicast
channel allocation - more infrastructure is required in the firewire
code itself to fix these problems.
2004-06-13 10:54:36 +00:00
Poul-Henning Kamp
fe12f24bb0 Add missing <sys/module.h> includes 2004-05-30 20:08:47 +00:00
Doug Rabson
7b1f628606 Don't try to copy out the result payload if there isn't one. This ioctl
interface really needs changing to split out the various async request
types.
2004-05-23 18:43:44 +00:00
Maxime Henrion
866a788cc2 We don't need to initialize if_output, ether_ifattach() does it
for us.
2004-05-23 16:11:53 +00:00
Doug Rabson
c0e9efacfe Initialise OHCI_CROMHDR and OHCI_BUS_OPT in fwohci_ibr to make sure that
they have the right values at the first bus reset.
2004-05-23 14:22:11 +00:00
Doug Rabson
03161bbcf6 Change u_intXX_t to uintXX_t. Change a couple of 'unsigned long's to
uint32_t where appropriate.
2004-05-22 16:14:17 +00:00
Yaroslav Tykhiy
7560265c18 Mark the capability of this driver to receive VLAN frames >1500 bytes
as initially active in if_capenable since it is always on.

Reviewed by:	simokawa
2004-05-21 17:11:34 +00:00
Doug Rabson
95a2495411 Fix spelling. 2004-05-21 09:12:07 +00:00
Doug Rabson
c59285296e Don't use the node id as an index into the topology map. This breaks
if a node on the bus has more than three ports (like my cheapo six
port hub).
2004-05-16 11:26:39 +00:00