Spelling in comments. No functional change.

This commit is contained in:
skrll 2006-07-08 16:07:47 +00:00
parent b36308b48b
commit e5a112d805
3 changed files with 49 additions and 49 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: i82596.c,v 1.11 2005/12/11 12:21:26 christos Exp $ */
/* $NetBSD: i82596.c,v 1.12 2006/07/08 16:07:47 skrll Exp $ */
/*
* Copyright (c) 2003 Jochen Kunz.
@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.11 2005/12/11 12:21:26 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: i82596.c,v 1.12 2006/07/08 16:07:47 skrll Exp $");
/* autoconfig and device stuff */
#include <sys/param.h>
@ -112,10 +112,10 @@ sc_iee_cmd(): send a command to the i82596 by writing the cmd parameter
to the SCP cmd word and issuing a Channel Attention.
sc_iee_reset(): initiate a reset, supply the address of the SCP to the
chip, wait for the chip to initialize and ACK interrupts that
this may have caused by caling (sc->sc_iee_cmd)(sc, IEE_SCB_ACK);
this may have caused by calling (sc->sc_iee_cmd)(sc, IEE_SCB_ACK);
This functions must carefully bus_dmamap_sync() all data they have touched!
sc_mediastatus() and sc_mediachange() are just MD hooks to the according
sc_mediastatus() and sc_mediachange() are just MD hooks to the according
MI functions. The MD frontend may set this pointers to NULL when they
are not needed.
@ -124,26 +124,26 @@ This is for printing out the correct chip type at attach time only. The
MI backend doesn't distinguish different chip types when programming
the chip.
sc->sc_flags has to be set to 0 on litle endian hardware and to
IEE_NEED_SWAP on big endian hardware, when endianes conversion is not
sc->sc_flags has to be set to 0 on little endian hardware and to
IEE_NEED_SWAP on big endian hardware, when endianess conversion is not
done by the bus attachment. Usually you need to set IEE_NEED_SWAP
when IEE_SYSBUS_BE is set in the sysbus byte.
sc->sc_cl_align bust be set to 1 or to the cache line size. When set to
sc->sc_cl_align must be set to 1 or to the cache line size. When set to
1 no special alignment of DMA descriptors is done. If sc->sc_cl_align != 1
it forces alignment of the data structres in the shared memory to a multiple
it forces alignment of the data structures in the shared memory to a multiple
of sc->sc_cl_align. This is needed on archs like hp700 that have non DMA
I/O coherent caches and are unable to map the shared memory uncachable.
(At least pre PA7100LC CPUs are unable to map memory uncachable.)
sc->sc_cl_align MUST BE INITIALIZED BEFORE THE FOLOWING MACROS ARE USED:
sc->sc_cl_align MUST BE INITIALIZED BEFORE THE FOLLOWING MACROS ARE USED:
SC_* IEE_*_SZ IEE_*_OFF IEE_SHMEM_MAX (shell style glob(3) pattern)
The MD frontend has to allocate a piece of DMA memory at least of
IEE_SHMEM_MAX bytes size. All communication with the chip is done via
this shared memory. If possible map this memory non-cachable on
archs with non DMA I/O coherent caches. The base of the memory needs
to be aligend to an even address if sc->sc_cl_align == 1 and aligend
to be aligned to an even address if sc->sc_cl_align == 1 and aligned
to a cache line if sc->sc_cl_align != 1.
An interrupt with iee_intr() as handler must be established.
@ -159,21 +159,21 @@ nmedia and defmedia are ignored when media == NULL.
The MD backend may call iee_detach() to detach the device.
See sys/arch/hp700/gsc/if_iee.c for an example.
See sys/arch/hp700/gsc/if_iee_gsc.c for an example.
*/
/*
How frame reception is done:
Each Recieve Frame Descriptor has one associated Recieve Buffer Descriptor.
Each RBD points to the data area of a mbuf cluster. The RFDs are linked
Each Receive Frame Descriptor has one associated Receive Buffer Descriptor.
Each RBD points to the data area of an mbuf cluster. The RFDs are linked
together in a circular list. sc->sc_rx_done is the count of RFDs in the
list already processed / the number of the RFD that has to be checked for
a new frame first at the next RX interrupt. Upon successful reception of
a frame the mbuf cluster is handled to upper protocol layers, a new mbuf
cluster is allocated and the RFD / RBD are reinitialized accordingly.
When a RFD list overrun occured the whole RFD and RBD lists are reinitialized
When a RFD list overrun occurred the whole RFD and RBD lists are reinitialized
and frame reception is started again.
*/
int
@ -289,7 +289,7 @@ iee_intr(void *intarg)
/* CMD list finished */
ifp->if_timer = 0;
if (sc->sc_next_tbd != 0) {
/* A TX CMD list finished, clenup */
/* A TX CMD list finished, cleanup */
for (n = 0 ; n < sc->sc_next_cb ; n++) {
m_freem(sc->sc_tx_mbuf[n]);
sc->sc_tx_mbuf[n] = NULL;
@ -326,7 +326,7 @@ iee_intr(void *intarg)
| IEE_CB_I);
(sc->sc_iee_cmd)(sc, IEE_SCB_CUC_EXE);
} else
/* Try to get defered packets going. */
/* Try to get deferred packets going. */
iee_start(ifp);
}
if (IEE_SWAP(SC_SCB->scb_crc_err) != sc->sc_crc_err) {
@ -370,42 +370,42 @@ iee_intr(void *intarg)
/*
How Command Block List Processing is done.
A runing CBL is never manipulated. If there is a CBL already runing,
further CMDs are deferd until the current list is done. A new list is
setup when the old has finished.
This eases programming. To manipulate a runing CBL it is neccesary to
A running CBL is never manipulated. If there is a CBL already running,
further CMDs are deferred until the current list is done. A new list is
setup when the old one has finished.
This eases programming. To manipulate a running CBL it is necessary to
suspend the Command Unit to avoid race conditions. After a suspend
is sent we have to wait for an interrupt that ACKs the suspend. Then
we can manipulate the CBL and resume operation. I am not sure that this
is more effective then the current, much simpler approach. => KISS
See i82596CA data sheet page 26.
A CBL is runing or on the way to be set up when (sc->sc_next_cb != 0).
A CBL is running or on the way to be set up when (sc->sc_next_cb != 0).
A CBL may consist of TX CMDs, and _only_ TX CMDs.
A TX CBL is runing or on the way to be set up when
A TX CBL is running or on the way to be set up when
((sc->sc_next_cb != 0) && (sc->sc_next_tbd != 0)).
A CBL may consist of other non-TX CMDs like IAS or CONF, and _only_
non-TX CMDs.
This comes mostly through the way how an Ethernet driver works and
because runing CBLs are not manipulated when they are on the way. If
if_start() is called there will be TX CMDs enqueued so we have a runing
CBL and other CMDs from e.g. if_ioctl() will be deferd and vice versa.
because running CBLs are not manipulated when they are on the way. If
if_start() is called there will be TX CMDs enqueued so we have a running
CBL and other CMDs from e.g. if_ioctl() will be deferred and vice versa.
The Multicast Setup Command is special. A MCS needs more space then
a single CB has. Actual space requiement depends on the length of the
multicast list. So we allways defer MCS until other CBLs are finished,
The Multicast Setup Command is special. A MCS needs more space than
a single CB has. Actual space requirement depends on the length of the
multicast list. So we always defer MCS until other CBLs are finished,
then we setup a CONF CMD in the first CB. The CONF CMD is needed to
turn ALLMULTI on the hardware on or off. The MCS is the 2nd CB and may
use all the remaining space in the CBL and the Transmit Buffer Descriptor
List. (Therefore CBL and TBDL must be continious in pysical and virtual
List. (Therefore CBL and TBDL must be continuous in physical and virtual
memory. This is guaranteed through the definitions of the list offsets
in i82596reg.h and because it is only a single DMA segment used for all
lists.) When ALLMULTI is enabled via the CONF CMD, the MCS is run with
a multicast list length of 0, thus disabling the multicast filter.
A defered MCS is signaled via ((sc->sc_flags & IEE_WANT_MCAST) != 0)
A deferred MCS is signaled via ((sc->sc_flags & IEE_WANT_MCAST) != 0)
*/
void
iee_cb_setup(struct iee_softc *sc, uint32_t cmd)
@ -477,7 +477,7 @@ iee_cb_setup(struct iee_softc *sc, uint32_t cmd)
case IEE_CB_CMD_TR: /* Transmit */
cb->cb_transmit.tx_tbd_addr = IEE_PHYS_SHMEM(IEE_TBD_OFF
+ IEE_TBD_SZ * sc->sc_next_tbd);
cb->cb_cmd |= IEE_CB_SF; /* Allways use Flexible Mode. */
cb->cb_cmd |= IEE_CB_SF; /* Always use Flexible Mode. */
break;
case IEE_CB_CMD_TDR: /* Time Domain Reflectometry */
break;
@ -610,7 +610,7 @@ iee_start(struct ifnet *ifp)
int n;
if (sc->sc_next_cb != 0)
/* There is already a CMD runing. Defer packet enqueueing. */
/* There is already a CMD running. Defer packet enqueuing. */
return;
for (t = 0 ; t < IEE_NCB ; t++) {
IFQ_DEQUEUE(&ifp->if_snd, sc->sc_tx_mbuf[t]);
@ -893,7 +893,7 @@ iee_stop(struct ifnet *ifp, int disable)
(sc->sc_iee_reset)(ifp->if_softc);
/* Issue a Channel Attention to ACK interrupts we may have caused. */
(sc->sc_iee_cmd)(ifp->if_softc, IEE_SCB_ACK);
/* Release any dynamically allocated ressources. */
/* Release any dynamically allocated resources. */
for (n = 0 ; n < IEE_NCB ; n++) {
if (sc->sc_tx_map[n] != NULL)
bus_dmamap_destroy(sc->sc_dmat, sc->sc_tx_map[n]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: i82596reg.h,v 1.2 2005/12/11 12:21:26 christos Exp $ */
/* $NetBSD: i82596reg.h,v 1.3 2006/07/08 16:07:47 skrll Exp $ */
/*
* Copyright (c) 2003 Jochen Kunz.
@ -33,8 +33,8 @@
#define IEE_SYSBUS_BE 0x80 /* == 1 32 bit pointers are big endian */
#define IEE_SYSBUS_INT 0x20 /* == 1 interrupt pin is active low */
#define IEE_SYSBUS_LOCK 0x10 /* == 1 lock funtion disabled */
#define IEE_SYSBUS_TRG 0x08 /* == 1 external triggering of bus throtle */
#define IEE_SYSBUS_LOCK 0x10 /* == 1 lock function disabled */
#define IEE_SYSBUS_TRG 0x08 /* == 1 external triggering of bus throttle */
#define IEE_SYSBUS_M1 0x04 /* M1 == 0 && M0 == 0 82586 mode */
#define IEE_SYSBUS_M0 0x02 /* M1 == 0 && M0 == 1 32 bit segmented mode */
/* M1 == 1 && M0 == 0 linear mode */
@ -62,8 +62,8 @@
#define IEE_SCB_CUC_RES 0x0200 /* Resume operat. of CU after suspend */
#define IEE_SCB_CUC_SUS 0x0300 /* Suspend exec. of cmds on CBL */
#define IEE_SCB_CUC_ABR 0x0400 /* Abort current command */
#define IEE_SCB_CUC_BT 0x0500 /* Load Bus Throtle */
#define IEE_SCB_CUC_BTI 0x0600 /* Load Bus Throtle immediately */
#define IEE_SCB_CUC_BT 0x0500 /* Load Bus Throttle */
#define IEE_SCB_CUC_BTI 0x0600 /* Load Bus Throttle immediately */
#define IEE_SCB_CUC 0x0700 /* Command mask */
#define IEE_SCB_RESET 0x0080 /* Reset the Chip */
@ -95,16 +95,16 @@
#define IEE_SCB_RUS_NR3 0x00c0 /* No more RBDs */
#define IEE_SCB_RUS 0x00f0 /* RU status bit mask */
#define IEE_SCB_T 0x0008 /* Bus Throtle timers loaded */
#define IEE_SCB_T 0x0008 /* Bus Throttle timers loaded */
#define IEE_SCB_TON 0x0000ffff /* Bus Throtle TON mask */
#define IEE_SCB_TOFF 0xffff0000 /* Bus Throtle TOFF mask */
#define IEE_SCB_TON 0x0000ffff /* Bus Throttle TON mask */
#define IEE_SCB_TOFF 0xffff0000 /* Bus Throttle TOFF mask */
/* Bits in the Command Block Command word. */
#define IEE_CB_EL 0x8000 /* End of List, cmd is last on CBL */
#define IEE_CB_S 0x4000 /* Suspend after exec of this CB */
#define IEE_CB_I 0x2000 /* generate Interrupt after exec */
#define IEE_CB_NC 0x0010 /* No CRC insertaton disable */
#define IEE_CB_NC 0x0010 /* No CRC insertion disable */
#define IEE_CB_SF 0x0008 /* Flexible Mode, data in TCB and TBD */
/* Bits in the Command Block Status word. */
@ -112,7 +112,7 @@
#define IEE_CB_B 0x4000 /* Command running or fetching CB */
#define IEE_CB_OK 0x2000 /* Command finished without error */
#define IEE_CB_A 0x1000 /* CU Abort control cmd was issued */
#define IEE_CB_F 0x0800 /* self test faild */
#define IEE_CB_F 0x0800 /* self test failed */
#define IEE_CB_EOF 0x8000 /* End Of Frame */
#define IEE_CB_STAT 0xf800 /* Status bit mask */
#define IEE_CB_COL 0x0020 /* TX stopped because of to much collisions */
@ -133,10 +133,10 @@
#define IEE_RFD_S 0x4000 /* Suspend after this RFD is filled */
#define IEE_RFD_SF 0x0008 /* Flexible Mode, data in RFD and RBD */
#define IEE_RFD_C 0x8000 /* Frame reception has completed */
#define IEE_RFD_B 0x4000 /* i82596 is bussy on this RFD */
#define IEE_RFD_B 0x4000 /* i82596 is busy on this RFD */
#define IEE_RFD_OK 0x2000 /* Frame received without error */
#define IEE_RFD_STAT 0x1fff /* Status bits */
#define IEE_RFD_STAT_LEN 0x1000 /* Lenghth error */
#define IEE_RFD_STAT_LEN 0x1000 /* Length error */
#define IEE_RFD_STAT_CRC 0x0800 /* CRC error */
#define IEE_RFD_STAT_ALIGN 0x0400 /* Alignment error */
#define IEE_RFD_STAT_NORES 0x0200 /* Ran out of buffer space */
@ -177,7 +177,7 @@
#define IEE_CF_3_ADDRLEN(x) ((x) & 0x07) /* Address Length */
#define IEE_CF_3_ADDRLEN_DEF 0x06 /* Address Length Default */
#define IEE_CF_3_NSAI 0x08 /* No Source Address Insertation */
#define IEE_CF_3_NSAI 0x08 /* No Source Address Insertion */
#define IEE_CF_3_ALLOC 0x08 /* == AL_LOC */
#define IEE_CF_3_PREAMLEN(x) (((x) & 0x3) << 4) /* Preamble Length */
#define IEE_CF_3_PREAMLEN_DEF 0x20 /* */

View File

@ -1,4 +1,4 @@
/* $NetBSD: i82596var.h,v 1.5 2005/12/11 12:21:27 christos Exp $ */
/* $NetBSD: i82596var.h,v 1.6 2006/07/08 16:07:47 skrll Exp $ */
/*
* Copyright (c) 2003 Jochen Kunz.
@ -122,7 +122,7 @@ struct iee_rfd {
volatile uint32_t rfd_rbd_addr; /* Address of first free RBD */
volatile uint16_t rfd_count; /* Actual Count */
volatile uint16_t rfd_size; /* Size */
volatile uint8_t rfd_dest_addr[6]; /* Destiantion Address */
volatile uint8_t rfd_dest_addr[6]; /* Destination Address */
volatile uint8_t rfd_src_addr[6]; /* Source Address */
volatile uint16_t rfd_length; /* Length Field */
volatile uint16_t rfd_pad; /* Optional Data */
@ -151,7 +151,7 @@ struct iee_rbd {
struct iee_softc {
struct device sc_dev; /* common device data */
struct ifmedia sc_ifmedia; /* media interface */
struct ethercom sc_ethercom; /* ethernet speciffic stuff */
struct ethercom sc_ethercom; /* ethernet specific stuff */
enum i82596_types sc_type;
bus_dma_tag_t sc_dmat;
bus_dmamap_t sc_shmem_map;