Commit Graph

15105 Commits

Author SHA1 Message Date
Prafulla Deuskar
219de4f9d8 Revert back changes to made in rev 1.109 of if_em.c which were unnecessary.
This makes it easier for us to get the changes into -current and to -stable quickly.
2006-08-03 19:05:04 +00:00
Gleb Smirnoff
66ebe2912f Merge in new driver from Intel, version 6.0.5. It adds support for
80003 NICs and NICs found on ICH8 mobos, and improves support for
already known chips.

Details:
  - if_em.c. Merged manually, viewing diff between new vendor
    driver and previous one. This was an easy task, because
    most changes between 5.1.5 and 6.0.5 are bugfixes taken
    from FreeBSD.
  - if_em_hw.h. Dropped in from vendor, and then restored
    revisions 1.16, 1.17, 1.18.
  - if_em_hw.c. Dropped in from vendor, and then restored
    revision 1.15.
  - if_em_osdep.h. Added new required macros from vendor file
    and add a hack against define namespace mangling in
    if_em_hw.h. Intel made another hack, but I prefer mine.
2006-08-03 09:20:11 +00:00
Pyun YongHyeon
be09900714 Fix re(4) breakge introduced in tree from rev 1.68.
This should fix incorrect configuration of station address on
big-endian architectures.

Reviewed by:	wpaul
Tested on:	sparc64
2006-08-03 00:15:19 +00:00
John Baldwin
1c902cc136 - Use m_getcl(), m_get(), and m_gethdr() rather than the older macros for
alloc'ing mbufs so that there is less error handling required.
- Go ahead and account for the data space in the first mbuf before entering
  the loop to alloc more mbuf's.  This simplifies the loop logic and avoids
  confusing Coverity.

CID:		817
Reviewed by:	sam
Tested by:	pjd
Found by:	Coverity Prevent (tm)
2006-08-02 17:41:58 +00:00
Pyun YongHyeon
07c4a8dfa6 Replace hard-coded magic constants to system defined constants
(BUS_PROBE_DEFAULT, BUS_PROBE_GENERIC etc). These pseudo PHY
drivers were forgotten from the conversion due to the repo copy
to dc driver location.
2006-08-02 05:28:52 +00:00
Sam Leffler
4350e12f23 remove unneccessary null ptr check
Coverity ID:	173918
2006-08-02 04:55:04 +00:00
Sam Leffler
7cb3a39dc0 remove unnecessary null ptr check
Coverity ID:	173911
2006-08-02 04:54:14 +00:00
Pyun YongHyeon
3b234fcbab Fix incorrect busy check for PHY write operation.
While I'm here remove unnecessary return statement.
2006-08-02 02:36:59 +00:00
Maxim Sobolev
e5d34218fb Add device to access and modify Open Firmware NVRAM settings in
PowerPC-based Apple's machines and small utility to do it from
userland modelled after the similar utility in Darwin/OSX.

Only tested on 1.25GHz G4 Mac Mini.

MFC after:	1 month
2006-08-01 22:19:01 +00:00
Bill Paul
0fc4974f79 Another small update to the re(4) driver:
- Change the workaround for the autopad/checksum offload bug so that
  instead of lying about the map size, we actually create a properly
  padded mbuf and map it as usual. The other trick works, but is ugly.
  This approach also gives us a chance to zero the pad space to avoid
  possibly leaking data.

- With the PCIe devices, it looks issuing a TX command while there's
  already a transmission in progress doesn't have any effect. In other
  words, if you send two packets in rapid succession, the second one may
  end up sitting in the TX DMA ring until another transmit command is
  issued later in the future. Basically, if re_txeof() sees that there
  are still descriptors outstanding, it needs to manually resume the
  TX DMA channel by issuing another TX command to make sure all
  transmissions are flushed out. (The PCI devices seem to keep the
  TX channel moving until all descriptors have been consumed. I'm not
  sure why the PCIe devices behave differently.)

  (You can see this issue if you do the following test: plug an re(4)
  interface into another host via crossover cable, and from the other
  host do 'ping -c 2 <host with re(4) NIC>' to prime the ARP cache,
  then do 'ping -c 1 -s 1473 <host with re(4) NIC>'. You're supposed
  to see two packets sent in response, but you may only see one. If
  you do 'ping -c 1 -s 1473 <host with re(4) NIC>' again, you'll
  see two packets, but one will be the missing fragment from the last
  ping, followed by one of the fragments from this ping.)

- Add the PCI ID for the US Robotics 997902 NIC, which is based on
  the RTL8169S.

- Add a tsleep() of 1 second in re_detach() after the interrupt handler
  is disconnected. This should allow any tasks queued up by the ISR
  to drain. Now, I know you're supposed to use taskqueue_drain() for
  this, but something about the way taskqueue_drain() works with
  taskqueue_fast queues doesn't seem quite right, and I refuse to be
  tricked into fixing it.
2006-08-01 17:18:25 +00:00
Andrew Gallatin
091feecd12 - add read only sysctl to indicate if write-combining was enabled
- enable mxge_dummy_rdma() right after reset, and make sure to disable
  when detaching the driver.
2006-08-01 14:02:54 +00:00
Bill Paul
498bd0d326 Fix the following bugs in re(4)
- Correct the PCI ID for the 8169SC/8110SC in the device list (I added
  the macro for it to if_rlreg.h before, but forgot to use it.)

- Remove the extra interrupt spinlock I added previously. After giving it
  some more thought, it's not really needed.

- Work around a hardware bug in some versions of the 8169. When sending
  very small IP datagrams with checksum offload enabled, a conflict can
  occur between the TX autopadding feature and the hardware checksumming
  that can corrupt the outbound packet. This is the reason that checksum
  offload sometimes breaks NFS: if you're using NFS over UDP, and you're
  very unlucky, you might find yourself doing a fragmented NFS write where
  the last fragment is smaller than the minimum ethernet frame size (60
  bytes). (It's rare, but if you keep NFS running long enough it'll
  happen.) If checksum offload is enabled, the chip will have to both
  autopad the fragment and calculate its checksum header. This confuses
  some revs of the 8169, causing the packet that appears on the wire
  to be corrupted. (The IP addresses and the checksum field are mangled.)
  This will cause the NFS write to fail. Unfortunately, when NFS retries,
  it sends the same write request over and over again, and it keeps
  failing, so NFS stays wedged.

  (A simple way to provoke the failure is to connect the failing system
  to a network with a known good machine and do "ping -s 1473 <badhost>"
  from the good system. The ping will fail.)

  Someone had previously worked around this using the heavy-handed
  approahch of just disabling checksum offload. The correct fix is to
  manually pad short frames where the TCP/IP stack has requested
  checksum offloading. This allows us to have checksum offload turned
  on by default but still let NFS work right.

- Not a bug, but change the ID strings for devices with hardware rev
  0x30000000 and 0x38000000 to both be 8168B/8111B. According to RealTek,
  they're both the same device, but 0x30000000 is an earlier silicon spin.
2006-07-30 23:25:21 +00:00
Nate Lawson
d1b16e1864 Add a new sysctl, hw.acpi.handle_reboot. If set, acpi will attempt to
perform the reboot action via the reset register instead of our legacy
method.  Default is 0 (use legacy).  This is needed because some systems
hang on reboot even though they claim to support the reset register.

MFC after:	2 days
2006-07-29 21:46:16 +00:00
Alexander Leidinger
347edd7ee6 - fix memory leak after "kldunload snd_ak452x.ko"
- fix "No sound in KDE":
  The problem is related to the implementation of Envy24(1712) hardware
  mixer support in the driver. Envy24(1712) has very precise 36bit wide
  hardware mixer, which is superior that vchans (software sound mixer in
  the kernel). The driver supports Envy24(1712) hardware mixer, so up to
  10 channels (5 stereo pairs) can be playback simultaneously.
  However, there are problems with the implementation of Envy24(1712)
  hardware mixer support in the driver, one of them is the problem with
  "no sound in KDE":
      When playing back several channels simultaneously and
      stoping one of the channels, sound starts to stutter and
      plays at very low speed.
  Another problem is:
      Playing back simultaneously more than one 24bit/32bit
      sound file or 16bit sound file and 24bit/32bit sound
      file doesn't work as expected.

Submitted by:	"Konstantin Dimitrov" <kosio.dimitrov@gmail.com>
2006-07-28 18:06:39 +00:00
Maksim Yevmenkin
04c1ba9b05 Add extra code into kbdmux(4)s read_char() method to
poll (i.e. call read_char() method) slave keyboards.

This workaround should fix problem with kbdmux(4) and
atkbd(4) not working in ddb(4) and mid-boot.

MFC after:	1 week
2006-07-27 20:33:48 +00:00
Pyun YongHyeon
7b4e72633e Add device ID for second generation D-Link DGE-530T.
PR:	kern/99903
2006-07-27 05:06:43 +00:00
Pyun YongHyeon
aaef1f52af Prepending an mbuf after loading a DMA map results in unexpected
result. So, modify mbuf chains before loading a DMA map.
2006-07-27 00:43:34 +00:00
Pyun YongHyeon
68fb31fc2b Nuke invalid use of BUS_DMA_ALLOCNOW. 2006-07-27 00:29:44 +00:00
Pyun YongHyeon
c2044727ab Make sure to use the same DMA map in DMA map load/unload operations
by remembering a map used in bus_dmamap_load_mbuf_sg(9). I have
no idea how it could ever worked before.
This fixes a warning generated by a diagnostic check in sun4v
iommu driver.

Reported by:	jb
Tested by:	jb(sun4v)
2006-07-27 00:26:20 +00:00
Marcel Moolenaar
dd5b096f42 Properly propagate overrun conditions to the TTY layer.
MFC after: 3 days
2006-07-27 00:07:10 +00:00
Marcel Moolenaar
54cfafcf98 On PowerPC the clock for the BRG comes from RTxC, not PCLK. Add a
quick hack to deal with this. We may need to formalize this better
and have this information come from the bus attachments.
2006-07-26 17:29:37 +00:00
Marcel Moolenaar
afd396ac93 Implement UART_IOCTL_BAUD for the Z8530. This allows a serial console
on PowerPC use the current setting of the hardware and not second
guess what the OFW does on various machines.
2006-07-26 17:21:59 +00:00
Marcel Moolenaar
e997db5d3a Implement uart_cpu_eqres() and uart_cpu_getdev(). This allows
FreeBSD to use a serial console, as per the OFW settings.
2006-07-26 17:17:23 +00:00
Sam Leffler
d95eaaf3ed add missing \n's
Submitted by:	avatar@
MFC after:	1 week
2006-07-26 04:09:04 +00:00
Sam Leffler
f3af83f7cf check tim is present in the beacon before defer'ing the mcast buffer bit;
insures we don't do this when operating in adhoc mode

Submitted by:	avatar@
MFC after:	1 week
2006-07-26 03:48:41 +00:00
Sam Leffler
9ee0e22742 support for 802.11 packet injection via bpf
Reviewed by:	arch@
MFC after:	1 month
2006-07-26 03:30:50 +00:00
Marcel Moolenaar
cbd038e738 Fix braino: The cl_range field should not hold the shifted I/O
space range per channel, but rather the unshifted range. The
shifting depends on the bus. The hardcoded shift was specific
to the SBus on sparc64. The shifted range is now determined at
run-time. This fixes the mac-io attachment.
2006-07-26 03:10:01 +00:00
Sam Leffler
bb98624ad5 set default beacon miss threshold to 10 beacons
Submitted by:	Henrik Brix Andersen <henrik@brixandersen.dk>
MFC after:	2 weeks
2006-07-26 03:09:32 +00:00
Nate Lawson
cf90f178b9 Add support for overriding the values for _CRT, _HOT, and _PSV via sysctl.
Prevent casual modification by requiring hw.acpi.thermal.user_override to
be set first.  Fix printing of negative temperatures in the K->C conversion.
Document the remaining thermal sysctls.

MFC after:	3 days
2006-07-25 02:27:38 +00:00
Matt Jacob
163c429fbb bus_alloc_resource_any is actually defined in the
RELENG_4 branch, so there's no need to have a compilation
difference here any more.
2006-07-25 01:01:09 +00:00
Matt Jacob
1dad8bb0ba When probing to attach the CAM functionality, check against
desired role configuration instead of existing role. This gets
us out of the mess where we configured a role of NONE (or were
LAN only, for example), but didn't continue to attach the CAM
module (because we had neither initiator nor target role
set). Unfortunately, the code that rewrites NVRAM to match
actual to desired role only works if the CAM module attaches.

MFC after:	2 weeks
2006-07-25 00:59:54 +00:00
Pyun YongHyeon
5780825180 Add stge(4), a driver for Sundance/Tamarack TC9021 Gigabit Ethernet
controller ported from NetBSD. It supports the following Gigabit
Ethernet adapters.
o Antares Microsystems Gigabit Ethernet
o ASUS NX1101 Gigabit Ethernet
o D-Link DL-4000 Gigabit Ethernet
o IC Plus IP1000A Gigabit Ethernet
o Sundance ST-2021 Gigabit Ethernet
o Sundance ST-2023 Gigabit Ethernet
o Sundance TC9021 Gigabit Ethernet
o Tamarack TC9021 Gigabit Ethernet
The IP1000A Gigabit Ethernet is also found on some motherboards
(LOM) from ABIT.

Unlike NetBSD stge(4) it does not require promiscuous mode operation
to revice packet and it supports all hardware features(TCP/UDP/IP
checksum offload, VLAN tag stripping/insertion features and JUMBO
frame) and polling(4).
Due to lack of hardware, hardwares that have TBI trantransceivers
were not tested at all.

Special thanks to wpaul who provided valauble datasheet for the
controller and helped to debug jumbo frame related issues. Whitout
his datasheet I would have spent many hours to debug this chip.

Tested on:	i386, sparc64
2006-07-25 00:37:09 +00:00
Marcel Moolenaar
c074ebba10 Revert previous commit. Spinlocks hold interrupts disabled, so
preemption is not possible.

Pointed out by: jhb@
2006-07-25 00:23:54 +00:00
Pyun YongHyeon
60a05afef9 Add ip1000 PHY driver for IC Plus IP1000A integrated PHY. 2006-07-25 00:16:09 +00:00
Pyun YongHyeon
ee6accfcc5 Add IC Plus IP1000A integrated PHY id. 2006-07-25 00:14:00 +00:00
Pyun YongHyeon
972fbe5ae5 Add gentbi, a generic TBI(teb-bit interface) PHY driver ported
from NetBSD.
2006-07-25 00:08:32 +00:00
Marcel Moolenaar
8f3b6a62b5 If we have multiple interrupt resources, like for Z8530 clones on the
mac-io bus, we cannot setup FAST interrupt handlers. This because we
use spinlocks to protect the hardware and all interrupt resources are
assigned the same interrupt handler. When the interrupt handler is
invoked for interrupt X, it could be preempted for interrupt Y while
it was holding the lock (where X and Y are the interrupt resources
corresponding a single instance of this driver). This is a deadlock.
By only using a MPSAFE handler in that case we prevent preemption.
2006-07-24 22:25:16 +00:00
Warner Losh
dbde02fe74 Add a few more devices to the supported list. Specifically, the PHAROS and
the silly dongly I just bought at Radio Shack.
2006-07-24 19:47:00 +00:00
Søren Schmidt
30ea1fb138 Finally fix support for the newer MCP51/MCP55 nVidia chipsets.
The register layout has changed since the original NV4 - sigh.
Hotplug support has been fixed for all nVidia chipsets that supports it
(including the MCP51/55).

HW donated by: Kingsley College
2006-07-24 10:44:50 +00:00
John Baldwin
e0569c0798 Clean up the svr4 socket cache and streams code some to make it more easily
locked.
- Move all the svr4 socket cache code into svr4_socket.c, specifically
  move svr4_delete_socket() over from streams.c.  Make the socket cache
  entry structure and svr4_head private to svr4_socket.c as a result.
- Add a mutex to protect the svr4 socket cache.
- Change svr4_find_socket() to copy the sockaddr_un struct into a
  caller-supplied sockaddr_un rather than giving the caller a pointer to
  our internal one.  This removes the one case where code outside of
  svr4_socket.c could access data in the cache.
- Add an eventhandler for process_exit and process_exec to purge the cache
  of any entries for the exiting or execing process.
- Add methods to init and destroy the socket cache and call them from the
  svr4 ABI module's event handler.
- Conditionally grab Giant around socreate() in streamsopen().
- Use fdclose() instead of inlining it in streamsopen() when handling
  socreate() failure.
- Only allocate a stream structure and attach it to a socket in
  streamsopen().  Previously, if a svr4 program performed a stream
  operation on an arbitrary socket not opened via the streams device,
  we would attach streams state data to it and change f_ops of the
  associated struct file while it was in use.  The latter was especially
  not safe, and if a program wants a stream object it should open it via
  the streams device anyway.
- Don't bother locking so_emuldata in the streams code now that we only
  touch it right after creating a socket (in streamsopen()) or when
  tearing it down when the file is closed.
- Remove D_NEEDGIANT from the streams device as it is no longer needed.
2006-07-21 20:40:13 +00:00
Warner Losh
8fcb4ef1cf If we get an error w/o atapi sense information, just print a newline
to terminate the message we started.  I get non-terminated messages
when reading audio tracks w/o this patch.
2006-07-21 19:13:05 +00:00
Xin LI
12c4ea9abd The contents pointed by ssi_cables[] is never changed so explicitly
declare it as const char * instead of char *.

This change have no side impact to the code itself, and is a step
forward to WARNS=6 truss(1).
2006-07-21 08:45:00 +00:00
John Baldwin
12d08f315b Expand locking coverage slightly to cover if_drv_flags in a few places
where it wasn't locked.

MFC after:	3 days
Reviewed by:	davidch
2006-07-20 18:41:00 +00:00
Pyun YongHyeon
da84b3961f Since resetting hardware takes a very long time and results in link
renegotiation, we only initialize the hardware only when it is
absolutely required. Process SIOCGIFADDR ioctl in em(4) when we know
an IPv4 address is added. Handling SIOCGIFADDR in a driver is
layering violation but it seems that there is no easy way without
rewritting hardware initialization code to reduce settle time after
reset.

This should fix a long standing bug which didn't send ARP packet when
interface address is changed or an alias address is added. Another
effect of this fix is it doesn't need additional delays anymore when
adding an alias address to the interface.
While I'm here add a new if_flags into softc which remembers current
prgroammed interface flags and make use of it when we have to program
promiscuous mode.

Tested by:	Atanas <atanas AT asd DOT aplus DOT net>
Analyzed by:	rwatson
Discussed with:	-stable
2006-07-20 04:18:45 +00:00
Pyun YongHyeon
693d469eee Protect EEPROM access with the driver lock. 2006-07-20 04:01:54 +00:00
Pyun YongHyeon
fa799a4e7e Honor IFF_DRV_OACTIVE in em_start_locked(). 2006-07-20 03:57:58 +00:00
John Baldwin
9c2dc11465 Whitespace fix after s/dev_t/struct cdev */. 2006-07-19 18:52:33 +00:00
John Baldwin
a02f5c6204 Initialize svr4_head during MOD_LOAD rather than on demand. 2006-07-19 18:26:09 +00:00
Pyun YongHyeon
4425fc9453 Convert sk(4) to use the new bus_alloc_resources() API and
bus_{read,write}_* macros.

Submitted by:	Antoine Brodin <antoine.brodin AT laposte DOT net>
Reviewed by:	imp (initial version)
2006-07-19 04:12:59 +00:00
John Baldwin
0c6d6356ba Remove unnecessary locking for td_dupfd (it requires no locks). 2006-07-18 22:31:33 +00:00