/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _RGE_H
#define _RGE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/ethernet.h>
#include <sys/mac_provider.h>
#include <sys/mac_ether.h>
/*
* Reconfiguring the network devices requires the net_config privilege
* in Solaris 10+.
*/
#include "rge_hw.h"
/*
* Name of the driver
*/
/*
*
* These are the values to use with LD_SET_MODE.
*/
#define RGE_LOOP_NONE 0
/*
* RGE-specific ioctls ...
*/
/*
*/
struct rge_mii_rw {
};
/*
* These diagnostic IOCTLS are enabled only in DEBUG drivers
*/
typedef struct {
/* input for poke */
/*
* RTL8169 CRC poly
*/
/*
*/
/*
* Driver chip operation parameters
*/
/*
* Named Data (ND) Parameter Management Structure
*/
typedef struct {
int ndp_info;
int ndp_min;
int ndp_max;
int ndp_val;
char *ndp_name;
/*
* NDD parameter indexes, divided into:
*
* read-only parameters describing the hardware's capabilities
* read-write parameters controlling the advertised capabilities
* read-only parameters describing the partner's capabilities
* read-only parameters describing the link state
*/
enum {
PARAM_AUTONEG_CAP = 0,
};
enum rge_chip_state {
};
enum rge_mac_state {
RGE_MAC_ATTACH = 0,
};
enum rge_sync_op {
};
/*
* (Internal) return values from ioctl subroutines
*/
enum ioc_reply {
};
/*
* (Internal) enumeration of this driver's kstats
*/
enum {
RGE_KSTAT_DRIVER = 0,
};
/*
* Basic data types, for clarity in distinguishing 'numbers'
* used for different purposes ...
*
* A <rge_regno_t> is a register 'address' (offset) in any one of
* various address spaces (PCI config space, PCI memory-mapped I/O
* register space, MII registers, etc). None of these exceeds 64K,
* so we could use a 16-bit representation but pointer-sized objects
* are more "natural" in most architectures; they seem to be handled
* more efficiently on SPARC and no worse on x86.
*
* RGE_REGNO_NONE represents the non-existent value in this space.
*/
/*
* Describes one chunk of allocated DMA-able memory
*
* In some cases, this is a single chunk as allocated from the system;
* but we also use this structure to represent slices carved off such
* a chunk. Even when we don't really need all the information, we
* use this structure as a convenient way of correlating the various
* ways of looking at a piece of memory (kernel VA, IO space DVMA,
* handle+offset, etc).
*/
typedef struct {
} dma_area_t;
/*
* Software version of the Receive Buffer Descriptor
*/
typedef struct {
/* buffer area */
} dma_buf_t;
typedef struct sw_rbd {
} sw_rbd_t;
/*
* Software version of the Send Buffer Descriptor
*/
typedef struct sw_sbd {
/* descriptor area */
/* buffer area */
} sw_sbd_t;
} else { \
} \
}
} else { \
} \
}
/*
* Describes the characteristics of a specific chip
*/
typedef struct {
} chip_id_t;
typedef struct rge_stats {
} rge_stats_t;
/*
* Per-instance soft-state structure
*/
typedef struct rge {
/*
* These structures describe the blocks of memory allocated during
* attach(). They remain unchanged thereafter, although the memory
* they describe is carved up into various separate regions and may
* therefore be described by other structures as well.
*/
/* describes hardware statistics area */
/* used for recv */
/* used for send */
/* mutex */
/*
* Miscellaneous operating variables (not synchronised)
*/
/*
* Physical layer
*/
/*
* NDD parameters (protected by genlock)
*/
/*
* Driver kstats, protected by <genlock> where necessary
*/
/* H/W statistics */
/*
* Polling
*/
} rge_t;
/*
* 'Progress' bit flags ...
*/
/* and mutexen initialised */
/*
* Special chip flags
*/
/*
* Shorthand for the NDD parameters
*/
/*
* Sync a DMA area described by a dma_area_t
*/
/*
* Find the (kernel virtual) address of block of memory
* described by a dma_area_t
*/
/*
* Zero a block of memory described by a dma_area_t
*/
/*
*/
/*
* Property lookups
*/
DDI_PROP_DONTPASS, (n))
DDI_PROP_DONTPASS, (n), -1)
/*
* Endian swap
*/
#ifdef _BIG_ENDIAN
(((x) & 0x00ff) << 8))
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24))
(RGE_BSWAP_32(x) << 32))
#else
#define RGE_BSWAP_16(x) (x)
#define RGE_BSWAP_32(x) (x)
#define RGE_BSWAP_64(x) (x)
#endif
/*
* Bit test macros, returning boolean_t values
*/
/*
* Bit flags in the 'debug' word ...
*/
/*
* Debugging ...
*/
#ifdef DEBUG
#else
#define RGE_DEBUGGING 0
#endif /* DEBUG */
/*
* 'Do-if-debugging' macro. The parameter <command> should be one or more
* C statements (but without the *final* semicolon), which will either be
* compiled inline or completely ignored, depending on the RGE_DEBUGGING
* compile-time flag.
*
* You should get a compile-time error (at least on a DEBUG build) if
* your statement isn't actually a statement, rather than unexpected
* run-time behaviour caused by unintended matching of if-then-elses etc.
*
* Note that the RGE_DDB() macro itself can only be used as a statement,
* not an expression, and should always be followed by a semicolon.
*/
#if RGE_DEBUGGING
{ command; } \
} while (0)
#else /* RGE_DEBUGGING */
} while (0)
#endif /* RGE_DEBUGGING */
/*
* These provide the primitive conditional-call capability required.
* Note: the parameter <args> is a parenthesised list of the actual
* printf-style arguments to be passed to the debug function ...
*/
/*
* Conditional-print macros.
*
* Define RGE_DBG to be the relevant member of the set of RGE_DBG_* values
* above before using the RGE_GDEBUG() or RGE_DEBUG() macros. The 'G'
* versions look at the Global debug flag word (rge_debug); the non-G
* versions look in the per-instance data (rgep->debug) and so require a
* variable called 'rgep' to be in scope (and initialised!) before use.
*
* You could redefine RGE_TRC too if you really need two different
* flavours of debugging output in the same area of code, but I don't
* really recommend it.
*
* Note: the parameter <args> is a parenthesised list of the actual
* arguments to be passed to the debug function, usually a printf-style
* format string and corresponding values to be formatted.
*/
/*
* Debug-only action macros
*/
/*
* Inter-source-file linkage ...
*/
/* rge_chip.c */
void rge_chip_cyclic(void *arg);
/* rge_kstats.c */
/* rge_log.c */
#if RGE_DEBUGGING
#endif /* RGE_DEBUGGING */
/* rge_main.c */
/* rge_ndd.c */
/* rge_rxtx.c */
#ifdef __cplusplus
}
#endif
#endif /* _RGE_H */