drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/oki-semi/pch_gbe/pch_gbe_param.c
Extension
.c
Size
14931 bytes
Lines
511
Domain
Driver Families
Bucket
drivers/net
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct pch_gbe_option {
	enum { enable_option, range_option, list_option } type;
	char *name;
	char *err;
	int  def;
	union {
		struct { /* range_option info */
			int min;
			int max;
		} r;
		struct { /* list_option info */
			int nr;
			const struct pch_gbe_opt_list { int i; char *str; } *p;
		} l;
	} arg;
};

static const struct pch_gbe_opt_list speed_list[] = {
	{ 0, "" },
	{ SPEED_10, "" },
	{ SPEED_100, "" },
	{ SPEED_1000, "" }
};

static const struct pch_gbe_opt_list dplx_list[] = {
	{ 0, "" },
	{ HALF_DUPLEX, "" },
	{ FULL_DUPLEX, "" }
};

static const struct pch_gbe_opt_list an_list[] =
	#define AA "AutoNeg advertising "
	{{ 0x01, AA "10/HD" },
	 { 0x02, AA "10/FD" },
	 { 0x03, AA "10/FD, 10/HD" },
	 { 0x04, AA "100/HD" },
	 { 0x05, AA "100/HD, 10/HD" },
	 { 0x06, AA "100/HD, 10/FD" },
	 { 0x07, AA "100/HD, 10/FD, 10/HD" },
	 { 0x08, AA "100/FD" },
	 { 0x09, AA "100/FD, 10/HD" },
	 { 0x0a, AA "100/FD, 10/FD" },
	 { 0x0b, AA "100/FD, 10/FD, 10/HD" },
	 { 0x0c, AA "100/FD, 100/HD" },
	 { 0x0d, AA "100/FD, 100/HD, 10/HD" },
	 { 0x0e, AA "100/FD, 100/HD, 10/FD" },
	 { 0x0f, AA "100/FD, 100/HD, 10/FD, 10/HD" },
	 { 0x20, AA "1000/FD" },
	 { 0x21, AA "1000/FD, 10/HD" },
	 { 0x22, AA "1000/FD, 10/FD" },
	 { 0x23, AA "1000/FD, 10/FD, 10/HD" },
	 { 0x24, AA "1000/FD, 100/HD" },
	 { 0x25, AA "1000/FD, 100/HD, 10/HD" },
	 { 0x26, AA "1000/FD, 100/HD, 10/FD" },
	 { 0x27, AA "1000/FD, 100/HD, 10/FD, 10/HD" },
	 { 0x28, AA "1000/FD, 100/FD" },
	 { 0x29, AA "1000/FD, 100/FD, 10/HD" },
	 { 0x2a, AA "1000/FD, 100/FD, 10/FD" },
	 { 0x2b, AA "1000/FD, 100/FD, 10/FD, 10/HD" },
	 { 0x2c, AA "1000/FD, 100/FD, 100/HD" },
	 { 0x2d, AA "1000/FD, 100/FD, 100/HD, 10/HD" },
	 { 0x2e, AA "1000/FD, 100/FD, 100/HD, 10/FD" },
	 { 0x2f, AA "1000/FD, 100/FD, 100/HD, 10/FD, 10/HD" }
};

static const struct pch_gbe_opt_list fc_list[] = {
	{ PCH_GBE_FC_NONE, "Flow Control Disabled" },
	{ PCH_GBE_FC_RX_PAUSE, "Flow Control Receive Only" },
	{ PCH_GBE_FC_TX_PAUSE, "Flow Control Transmit Only" },
	{ PCH_GBE_FC_FULL, "Flow Control Enabled" }
};

/**
 * pch_gbe_validate_option - Validate option
 * @value:    value
 * @opt:      option
 * @adapter:  Board private structure
 * Returns:
 *	0:			Successful.
 *	Negative value:		Failed.
 */
static int pch_gbe_validate_option(int *value,
				    const struct pch_gbe_option *opt,
				    struct pch_gbe_adapter *adapter)
{
	if (*value == OPTION_UNSET) {
		*value = opt->def;
		return 0;
	}

Annotation

Implementation Notes