Commit Graph

21206 Commits

Author SHA1 Message Date
tsutsui bc366d3166 Tweak TX descriptor setup code in re_encap() to make it more readable a bit. 2006-10-21 21:29:14 +00:00
bouyer 76694b5d3f Regen: addded i82563 PHY 2006-10-21 17:19:21 +00:00
bouyer 5b9f1ed038 Regen: added some Intel gigabit ethernet products 2006-10-21 17:18:49 +00:00
tsutsui 587d5e790a Fix hardware VLAN tagging support on vge(4):
- On TX, vge(4) seems to assume that tags are written in little endian.
  We already use htole32() to write values into descriptors,
  so extra byteswap by htons() is not needed there.

- On RX, vge(4) seems to store tags in network byteorder.
  We have to swap byteorder regardless of host's byteorder
  (i.e. we have to use bswap16() rather than ntohs())
  because we already use le32toh() to read values from descriptors.

Anyway, no need to use htons()/ntohs() because there is no stream data.

Tested on both i386 and macppc, and OK'ed by Pavel Cahyna.
2006-10-21 16:26:35 +00:00
tsutsui f89487b7e5 Use aprint_error(9) to print error messages. 2006-10-21 16:13:21 +00:00
bouyer 154d613f0b Add support for the Intel 80003 Gigabit Ethernet controller (found e.g. in
newer server chipsets) to wm(4), from the FreeBSD em(4) driver.
While there, add a few other Intel Ethernet controller that should work as
is.
Properly update the RX error and TX collision counters.
Add ikphy(4), a driver for the Intel i82563 Kumeran 10/100/1000 Ethernet PHYs
2006-10-21 14:10:32 +00:00
bouyer 7bdd26b810 Restart negotiation when we change media even if autoneg is not enabled.
Otherwise switching from a fixed media to another fixed media isn't noticed
by the switch and the effective speed doesn't change.
2006-10-21 13:55:30 +00:00
tsutsui 5227317a1e Use CSR_WRITE_1() to write RTK_TXSTART register because it is localted
at an odd address (0xd9) and noted "8 bit" in rtl81x9reg.h.

XXX: FreeBSD and OpenBSD also use CSR_WRITE_1() to write RTK_GTXSTART
XXX: for 8169 even though there is a "16 bits" comment at GTXSTART macro.
XXX: Which is correct?
2006-10-21 03:44:47 +00:00
reinoud f64c33e88b Define DPRINTF(x) as an empty block to prevent gcc from complaining about
empty statements. This is still an empty statement but it will be filtered
out still.
2006-10-20 18:14:59 +00:00
tsutsui f236f53515 In re_newbuf():
- adjust m_data and m_len directly rather than calling m_adj(9)
- more cosmetics
2006-10-20 17:11:36 +00:00
tsutsui 2cc86b486f KNF, remove register decls, TAB/space cosmetics etc. 2006-10-20 16:46:47 +00:00
tsutsui 572ce0789f u_intNN_t -> uintNN_t 2006-10-20 16:31:08 +00:00
tsutsui d27d349474 Use BUS_DMA_COHERENT on mapping DMA memory for TX/RX descriptors.
I can't think of a good way to avoid race condition between writeback and
DMA write against descriptors if cachelinesize > sizeof(struct rtk_desc)...

Anyway, now re(4) is functional on O2 (and probably other mips ports).
2006-10-20 15:44:00 +00:00
tsutsui a7ca335bad Try to avoid race condition between cache writeback from CPU and DMA write
from re(4) chip as much as possible.
2006-10-20 15:19:01 +00:00
tsutsui 620e93c99c while (1) -> for (;;) 2006-10-20 14:51:06 +00:00
tsutsui d2c63dd7b9 - bcopy -> memcpy
- bcmp -> memcmp
2006-10-20 14:28:55 +00:00
tsutsui 55b9847900 There is no particular reason to use BUS_DMA_ALLOCNOW on bus_dmamap_create(9). 2006-10-20 14:00:49 +00:00
tsutsui 920add0c28 Tweak a for() loop a bit in re_rxeof(). 2006-10-20 13:44:31 +00:00
tsutsui 38e9d649da Sync RX mbufs before setting up RX DMA descriptor. 2006-10-20 13:39:47 +00:00
tsutsui e9a7d245ed - call bus_dmamap_sync(9) against DMA descriptors more properly
- make DMA descripter members volatile
Now re(4) works on sgimips O2.

XXX: Still re(4) sometimes stalls on NFS load on sgimips,
XXX: but I'm not sure it's sgimips specific or not.
2006-10-20 11:30:54 +00:00
scw d269f28650 Force a reload of the EEPROM if the MAC address is all zeroes.
Fixes PR kern/34812.
2006-10-20 10:31:06 +00:00
scw 4526a898c6 Validate the sector size returned by READ CAPACITY. If it looks bogus
print a warning and fallback to a suitable default.

Fixes a problem on hp700 reported by skrll@
2006-10-20 07:11:50 +00:00
gdamore e8ac1cad77 This commit provides substantial fixes and functionality for SPI flash.
Specifically, the SPI flash now operates as a nearly fully functional block
device (other than lacking disklabel support).  It does some basic translation
stuff, so that if you attempt to write a block, the underlying flash sectors
(usually 64k in size) will be read, erased and rewritten.

To minize thrashing, the spiflash strategy routine attempts to gather writes
to the same sector together, so that in the typical case you will not have to
repeatedly erase/rewrite the sector.  It also attempts to check and verify
whether an erase cycle is truly needed.  There are still access patterns that
will cause multiple erases to occur, and so I heartily discourage the use
of these flash devices for storing anything other than small configuration
data, or write-once images.  If you want to do more than that, then someone
should try to write a real flash translation layer.

The drivers attempt to provide some level of asynchronous operation, so that
while you are erasing or writing to the flash, other things can reasonably
take place.

Note that spiflash does not do bad block remapping.  It also doesn't detect
when a device is in read-only mode, or if some sectors are read-only.  It
only supports uniform sectored NOR flash.  It lacks any code to deal with
disklabels, and does not offer any disk related ioctls.

These limitations aside, it would not be terribly hard, I think, to break
out the code I've done to create a generic "norflash" driver, backed by
a "common" spiflash module.  Then other flash drivers (e.g. athflash, etc.)
could benefit from the ability to use this as a block device.  I've tried
to architect it to support that, if someone else wants to do the work.
(Hi Jared!)

The primary reason that I've not added code to deal with disklabels is that
I had a difficult time figuring out which framework (disklabels or wedges)
to use, and which bits of code were necessary to implement.  In the case of
the flash devices I'm working with, a parser to deal with redboot FIS images
(partitions) would need to be added.  I was prepared to do this, but gave
up owing to the complete and total lack of any API or design documentation
pertaining to the requirements for disk drivers and disklabel management or
wedges.   I would strongly encourage someone who knows something about
wedges or disklabels to write a simple document (or even a dummy driver)
showing which interfaces should be provided in new mass storage drivers.

This work was funded by the Champaign-Urbana Community Wireless Network
Project.
2006-10-20 06:41:46 +00:00
wiz adba8fa9a7 Recognize a newer D-Link DWL-G122 as supported. 2006-10-17 23:42:18 +00:00
dogcow 372e6ef309 now that we have -Wno-unused-parameter, back out all the tremendously ugly
code to gratuitously access said parameters.
2006-10-17 18:21:29 +00:00
itohy f9212d6b4d Silence unused variable warning. 2006-10-17 15:16:30 +00:00
tsutsui 92846c53e2 Use "#ifdef __NO_STRICT_ALIGNMENT" rather than
"#if defined(__i386__) || defined(__x86_64__)".

XXX: What will happen if RTL8168B is used on !__NO_STRICT_ALIGNMENT hosts?
XXX: If 8168B can't handle RX DMA into 32bit-unaligned memory, should we
XXX: implement some code to copy RX buffers like vge(4)?
XXX: Or is 8168B available only for on-board NIC for PCs?
2006-10-17 14:16:06 +00:00
tsutsui aecd88d07b DMA memory for the TX ring should be aligned at RTK_RING_ALIGN,
not RTK_ETHER_ALIGN.
2006-10-17 14:03:26 +00:00
itohy bb09c44e46 Make pciide(4)-only configurations (without other DMA-capable driver) compile. 2006-10-17 13:45:05 +00:00
tsutsui 787b5230f5 Fix a typo in comment. 2006-10-17 09:55:12 +00:00
yamt de1da31163 re_diag: constify. 2006-10-17 09:19:57 +00:00
macallan 8668483161 detect video RAM size 2006-10-16 22:36:30 +00:00
macallan ba69d539e0 use vcons.
Works fine on sparc64, needs testing on sparc.
2006-10-16 22:27:16 +00:00
pooka 5005d343ec * __unused games + other relevant fixes
* give me ANSI C or give me death (at least where it could be easily spotted)
2006-10-16 13:00:36 +00:00
pooka 1810947bb4 make compile by using __unused & other necessary tricks
and remove <0 comparisons for bus_size_t.  if a port wants signed
bus_size_t, it just might have to accept it can't use this driver.  *snif*
2006-10-16 12:58:54 +00:00
martin 7815b7efa3 Missing initializers 2006-10-15 21:01:03 +00:00
martin 9128c4105e Missing initializer 2006-10-15 20:54:49 +00:00
martin c8982ceb2a Missing initializers 2006-10-15 20:50:29 +00:00
martin 9384ee0db9 Missing initializer 2006-10-15 19:53:27 +00:00
martin c335701fe5 Add missing initializer 2006-10-15 19:43:45 +00:00
martin ac4b729ce4 Add some initializers 2006-10-15 19:32:37 +00:00
martin 61baadbc7f Add missing initializer 2006-10-15 19:29:10 +00:00
tsutsui fec9e58b4d In vge_newbuf(), don't adjust packet length twice by m_adj(9)
in case of __NO_STRICT_ALIGNMENT. We can adjust m_data directly
since it's allocated by MCLGET(9) just above.
(though the length is not used anyway)
2006-10-15 11:52:36 +00:00
tsutsui 76a3c671ce Umm, remove a DELAY() added in previous. It seems to cause another problem. 2006-10-15 10:54:15 +00:00
tsutsui 2412a17a18 On sgimips (R5000 O2), it seems that the first EEPROM read data
right after vge_reset() could be corrupted. For workaround, add a
dummy EEPROM read in vge_reset() so that MAC address is properly
set on the machine.
While here, add a DELAY() in busy loop in vge_read_eeprom().
2006-10-15 10:33:25 +00:00
tsutsui 4751084399 Oops, use correct dmamap to sync DMA descriptors.
Found by DIAGNOSTIC code in sgimips/bus.c:_bus_dmamap_sync_mips3().
2006-10-15 09:37:27 +00:00
itohy b1d32ad8f3 white space police 2006-10-15 00:00:00 +00:00
itohy 65b52f68a1 Add ATAPI Pioneer (info from Linux) and ATA TDK (I have one)
as exceptions of string byte order.
Add string byte order shuffling for big-endian platforms.
2006-10-14 23:54:14 +00:00
bjh21 bafb9c4f84 The SEC uses the same page latch for both ROM and RAM, so we should arrange
to reset it to 0 on shutdown so that RISC OS gets to see the start of the
ROM.
2006-10-14 21:47:11 +00:00
tsutsui 657cf77ed2 - use MGETHDR() and MCLGET() rather than m_gethdr() and m_clget()
- KNF, ANSIfy, remove register decls
- some more cosmetics
2006-10-14 19:53:51 +00:00