david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

Merge from Etherboot 5.4

This commit is contained in:
Michael Brown 2006-03-16 18:30:54 +00:00
commit 7e0a7a2e08
9 changed files with 7616 additions and 14 deletions

View File

@ -116,8 +116,9 @@ os_regs_ptr:
movl %esp, %ebp
subl $os_regs, %ebp
/* Load the stack pointer */
/* Load the stack pointer and convert it to physical address */
movl 52(%esp), %esp
addl %ebp, %esp
/* Enable the virtual addresses */
leal _phys_to_virt(%ebp), %eax

View File

@ -242,6 +242,7 @@ typedef struct
/*** Global variables ***/
static struct
{
unsigned int is3c556;
unsigned char isBrev;
unsigned char CurrentWindow;
unsigned int IOAddr;
@ -305,7 +306,15 @@ a3c90x_internal_ReadEeprom(int ioaddr, int address)
while((1<<15) & inw(ioaddr + regEepromCommand_0_w));
/** Read the value. **/
outw(address + ((0x02)<<6), ioaddr + regEepromCommand_0_w);
if (INF_3C90X.is3c556)
{
outw(address + (0x230), ioaddr + regEepromCommand_0_w);
}
else
{
outw(address + ((0x02)<<6), ioaddr + regEepromCommand_0_w);
}
while((1<<15) & inw(ioaddr + regEepromCommand_0_w));
val = inw(ioaddr + regEepromData_0_w);
@ -710,6 +719,7 @@ static int a3c90x_probe ( struct nic *nic, struct pci_device *pci ) {
nic->ioaddr = pci->ioaddr;
nic->irqno = 0;
INF_3C90X.is3c556 = (pci->dev_id == 0x6055);
INF_3C90X.IOAddr = pci->ioaddr & ~3;
INF_3C90X.CurrentWindow = 255;
switch (a3c90x_internal_ReadEeprom(INF_3C90X.IOAddr, 0x03))
@ -795,6 +805,15 @@ static int a3c90x_probe ( struct nic *nic, struct pci_device *pci ) {
INF_3C90X.HWAddr[5] = eeprom[HWADDR_OFFSET + 2]&0xFF;
printf("MAC Address = %!\n", INF_3C90X.HWAddr);
/** 3C556: Invert MII power **/
if (INF_3C90X.is3c556) {
unsigned int tmp;
a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winAddressing2);
tmp = inw(INF_3C90X.IOAddr + regResetOptions_2_w);
tmp |= 0x4000;
outw(tmp, INF_3C90X.IOAddr + regResetOptions_2_w);
}
/* Test if the link is good, if not continue */
a3c90x_internal_SetWindow(INF_3C90X.IOAddr, winDiagnostics4);
mstat = inw(INF_3C90X.IOAddr + regMediaStatus_4_w);
@ -967,6 +986,7 @@ static struct nic_operations a3c90x_operations = {
static struct pci_id a3c90x_nics[] = {
/* Original 90x revisions: */
PCI_ROM(0x10b7, 0x6055, "3c556", "3C556"), /* Huricane */
PCI_ROM(0x10b7, 0x9000, "3c905-tpo", "3Com900-TPO"), /* 10 Base TPO */
PCI_ROM(0x10b7, 0x9001, "3c905-t4", "3Com900-Combo"), /* 10/100 T4 */
PCI_ROM(0x10b7, 0x9050, "3c905-tpo100", "3Com905-TX"), /* 100 Base TX / 10/100 TPO */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,551 @@
/**************************************************************************
*
* GPL net driver for Level 5 Etherfabric network cards
*
* Written by Michael Brown <mbrown@fensystems.co.uk>
*
* Copyright Fen Systems Ltd. 2005
* Copyright Level 5 Networks Inc. 2005
*
* This software may be used and distributed according to the terms of
* the GNU General Public License (GPL), incorporated herein by
* reference. Drivers based on or derived from this code fall under
* the GPL and must retain the authorship, copyright and license
* notice. This file is not a complete program and may only be used
* when the entire operating system is licensed under the GPL.
*
**************************************************************************
*/
#ifndef EFAB_BITFIELD_H
#define EFAB_BITFIELD_H
/** @file
*
* Etherfabric bitfield access
*
* Etherfabric NICs make extensive use of bitfields up to 128 bits
* wide. Since there is no native 128-bit datatype on most systems,
* and since 64-bit datatypes are inefficient on 32-bit systems and
* vice versa, we wrap accesses in a way that uses the most efficient
* datatype.
*
* The NICs are PCI devices and therefore little-endian. Since most
* of the quantities that we deal with are DMAed to/from host memory,
* we define our datatypes (efab_oword_t, efab_qword_t and
* efab_dword_t) to be little-endian.
*
* In the less common case of using PIO for individual register
* writes, we construct the little-endian datatype in host memory and
* then use non-swapping equivalents of writel/writeq, rather than
* constructing a native-endian datatype and relying on the implicit
* byte-swapping done by writel/writeq. (We use a similar strategy
* for register reads.)
*/
/** Dummy field low bit number */
#define EFAB_DUMMY_FIELD_LBN 0
/** Dummy field width */
#define EFAB_DUMMY_FIELD_WIDTH 0
/** Dword 0 low bit number */
#define EFAB_DWORD_0_LBN 0
/** Dword 0 width */
#define EFAB_DWORD_0_WIDTH 32
/** Dword 1 low bit number */
#define EFAB_DWORD_1_LBN 32
/** Dword 1 width */
#define EFAB_DWORD_1_WIDTH 32
/** Dword 2 low bit number */
#define EFAB_DWORD_2_LBN 64
/** Dword 2 width */
#define EFAB_DWORD_2_WIDTH 32
/** Dword 3 low bit number */
#define EFAB_DWORD_3_LBN 96
/** Dword 3 width */
#define EFAB_DWORD_3_WIDTH 32
/** Specified attribute (e.g. LBN) of the specified field */
#define EFAB_VAL(field,attribute) field ## _ ## attribute
/** Low bit number of the specified field */
#define EFAB_LOW_BIT( field ) EFAB_VAL ( field, LBN )
/** Bit width of the specified field */
#define EFAB_WIDTH( field ) EFAB_VAL ( field, WIDTH )
/** High bit number of the specified field */
#define EFAB_HIGH_BIT(field) ( EFAB_LOW_BIT(field) + EFAB_WIDTH(field) - 1 )
/** Mask equal in width to the specified field.
*
* For example, a field with width 5 would have a mask of 0x1f.
*
* The maximum width mask that can be generated is 64 bits.
*/
#define EFAB_MASK64( field ) \
( EFAB_WIDTH(field) == 64 ? ~( ( uint64_t ) 0 ) : \
( ( ( ( ( uint64_t ) 1 ) << EFAB_WIDTH(field) ) ) - 1 ) )
/** Mask equal in width to the specified field.
*
* For example, a field with width 5 would have a mask of 0x1f.
*
* The maximum width mask that can be generated is 32 bits. Use
* EFAB_MASK64 for higher width fields.
*/
#define EFAB_MASK32( field ) \
( EFAB_WIDTH(field) == 32 ? ~( ( uint32_t ) 0 ) : \
( ( ( ( ( uint32_t ) 1 ) << EFAB_WIDTH(field) ) ) - 1 ) )
/** A doubleword (i.e. 4 byte) datatype
*
* This datatype is defined to be little-endian.
*/
typedef union efab_dword {
uint32_t u32[1];
uint32_t opaque; /* For bitwise operations between two efab_dwords */
} efab_dword_t;
/** A quadword (i.e. 8 byte) datatype
*
* This datatype is defined to be little-endian.
*/
typedef union efab_qword {
uint64_t u64[1];
uint32_t u32[2];
efab_dword_t dword[2];
} efab_qword_t;
/**
* An octword (eight-word, i.e. 16 byte) datatype
*
* This datatype is defined to be little-endian.
*/
typedef union efab_oword {
uint64_t u64[2];
efab_qword_t qword[2];
uint32_t u32[4];
efab_dword_t dword[4];
} efab_oword_t;
/** Format string for printing an efab_dword_t */
#define EFAB_DWORD_FMT "%08x"
/** Format string for printing an efab_qword_t */
#define EFAB_QWORD_FMT "%08x:%08x"
/** Format string for printing an efab_oword_t */
#define EFAB_OWORD_FMT "%08x:%08x:%08x:%08x"
/** printk parameters for printing an efab_dword_t */
#define EFAB_DWORD_VAL(dword) \
( ( unsigned int ) le32_to_cpu ( (dword).u32[0] ) )
/** printk parameters for printing an efab_qword_t */
#define EFAB_QWORD_VAL(qword) \
( ( unsigned int ) le32_to_cpu ( (qword).u32[1] ) ), \
( ( unsigned int ) le32_to_cpu ( (qword).u32[0] ) )
/** printk parameters for printing an efab_oword_t */
#define EFAB_OWORD_VAL(oword) \
( ( unsigned int ) le32_to_cpu ( (oword).u32[3] ) ), \
( ( unsigned int ) le32_to_cpu ( (oword).u32[2] ) ), \
( ( unsigned int ) le32_to_cpu ( (oword).u32[1] ) ), \
( ( unsigned int ) le32_to_cpu ( (oword).u32[0] ) )
/**
* Extract bit field portion [low,high) from the native-endian element
* which contains bits [min,max).
*
* For example, suppose "element" represents the high 32 bits of a
* 64-bit value, and we wish to extract the bits belonging to the bit
* field occupying bits 28-45 of this 64-bit value.
*
* Then EFAB_EXTRACT ( element, 32, 63, 28, 45 ) would give
*
* ( element ) << 4
*
* The result will contain the relevant bits filled in in the range
* [0,high-low), with garbage in bits [high-low+1,...).
*/
#define EFAB_EXTRACT_NATIVE( native_element, min ,max ,low ,high ) \
( ( ( low > max ) || ( high < min ) ) ? 0 : \
( ( low > min ) ? \
( (native_element) >> ( low - min ) ) : \
( (native_element) << ( min - low ) ) ) )
/**
* Extract bit field portion [low,high) from the 64-bit little-endian
* element which contains bits [min,max)
*/
#define EFAB_EXTRACT64( element, min, max, low, high ) \
EFAB_EXTRACT_NATIVE ( le64_to_cpu(element), min, max, low, high )
/**
* Extract bit field portion [low,high) from the 32-bit little-endian
* element which contains bits [min,max)
*/
#define EFAB_EXTRACT32( element, min, max, low, high ) \
EFAB_EXTRACT_NATIVE ( le32_to_cpu(element), min, max, low, high )
#define EFAB_EXTRACT_OWORD64( oword, low, high ) \
( EFAB_EXTRACT64 ( (oword).u64[0], 0, 63, low, high ) | \
EFAB_EXTRACT64 ( (oword).u64[1], 64, 127, low, high ) )
#define EFAB_EXTRACT_QWORD64( qword, low, high ) \
( EFAB_EXTRACT64 ( (qword).u64[0], 0, 63, low, high ) )
#define EFAB_EXTRACT_OWORD32( oword, low, high ) \
( EFAB_EXTRACT32 ( (oword).u32[0], 0, 31, low, high ) | \
EFAB_EXTRACT32 ( (oword).u32[1], 32, 63, low, high ) | \
EFAB_EXTRACT32 ( (oword).u32[2], 64, 95, low, high ) | \
EFAB_EXTRACT32 ( (oword).u32[3], 96, 127, low, high ) )
#define EFAB_EXTRACT_QWORD32( qword, low, high ) \
( EFAB_EXTRACT32 ( (qword).u32[0], 0, 31, low, high ) | \
EFAB_EXTRACT32 ( (qword).u32[1], 32, 63, low, high ) )
#define EFAB_EXTRACT_DWORD( dword, low, high ) \
( EFAB_EXTRACT32 ( (dword).u32[0], 0, 31, low, high ) )
#define EFAB_OWORD_FIELD64( oword, field ) \
( EFAB_EXTRACT_OWORD64 ( oword, EFAB_LOW_BIT ( field ), \
EFAB_HIGH_BIT ( field ) ) & \
EFAB_MASK64 ( field ) )
#define EFAB_QWORD_FIELD64( qword, field ) \
( EFAB_EXTRACT_QWORD64 ( qword, EFAB_LOW_BIT ( field ), \
EFAB_HIGH_BIT ( field ) ) & \
EFAB_MASK64 ( field ) )
#define EFAB_OWORD_FIELD32( oword, field ) \
( EFAB_EXTRACT_OWORD32 ( oword, EFAB_LOW_BIT ( field ), \
EFAB_HIGH_BIT ( field ) ) & \
EFAB_MASK32 ( field ) )
#define EFAB_QWORD_FIELD32( qword, field ) \
( EFAB_EXTRACT_QWORD32 ( qword, EFAB_LOW_BIT ( field ), \
EFAB_HIGH_BIT ( field ) ) & \
EFAB_MASK32 ( field ) )
#define EFAB_DWORD_FIELD( dword, field ) \
( EFAB_EXTRACT_DWORD ( dword, EFAB_LOW_BIT ( field ), \
EFAB_HIGH_BIT ( field ) ) & \
EFAB_MASK32 ( field ) )
#define EFAB_OWORD_IS_ZERO64( oword ) \
( ! ( (oword).u64[0] || (oword).u64[1] ) )
#define EFAB_QWORD_IS_ZERO64( qword ) \
( ! ( (qword).u64[0] ) )
#define EFAB_OWORD_IS_ZERO32( oword ) \
( ! ( (oword).u32[0] || (oword).u32[1] || \
(oword).u32[2] || (oword).u32[3] ) )
#define EFAB_QWORD_IS_ZERO32( qword ) \
( ! ( (qword).u32[0] || (qword).u32[1] ) )
#define EFAB_DWORD_IS_ZERO( dword ) \
( ! ( (dword).u32[0] ) )
#define EFAB_OWORD_IS_ALL_ONES64( oword ) \
( ( (oword).u64[0] & (oword).u64[1] ) == ~( ( uint64_t ) 0 ) )
#define EFAB_QWORD_IS_ALL_ONES64( qword ) \
( (qword).u64[0] == ~( ( uint64_t ) 0 ) )
#define EFAB_OWORD_IS_ALL_ONES32( oword ) \
( ( (oword).u32[0] & (oword).u32[1] & \
(oword).u32[2] & (oword).u32[3] ) == ~( ( uint32_t ) 0 ) )
#define EFAB_QWORD_IS_ALL_ONES32( qword ) \
( ( (qword).u32[0] & (qword).u32[1] ) == ~( ( uint32_t ) 0 ) )
#define EFAB_DWORD_IS_ALL_ONES( dword ) \
( (dword).u32[0] == ~( ( uint32_t ) 0 ) )
#if ( BITS_PER_LONG == 64 )
#define EFAB_OWORD_FIELD EFAB_OWORD_FIELD64
#define EFAB_QWORD_FIELD EFAB_QWORD_FIELD64
#define EFAB_OWORD_IS_ZERO EFAB_OWORD_IS_ZERO64
#define EFAB_QWORD_IS_ZERO EFAB_QWORD_IS_ZERO64
#define EFAB_OWORD_IS_ALL_ONES EFAB_OWORD_IS_ALL_ONES64
#define EFAB_QWORD_IS_ALL_ONES EFAB_QWORD_IS_ALL_ONES64
#else
#define EFAB_OWORD_FIELD EFAB_OWORD_FIELD32
#define EFAB_QWORD_FIELD EFAB_QWORD_FIELD32
#define EFAB_OWORD_IS_ZERO EFAB_OWORD_IS_ZERO32
#define EFAB_QWORD_IS_ZERO EFAB_QWORD_IS_ZERO32
#define EFAB_OWORD_IS_ALL_ONES EFAB_OWORD_IS_ALL_ONES32
#define EFAB_QWORD_IS_ALL_ONES EFAB_QWORD_IS_ALL_ONES32
#endif
/**
* Construct bit field portion
*
* Creates the portion of the bit field [low,high) that lies within
* the range [min,max).
*/
#define EFAB_INSERT_NATIVE64( min, max, low, high, value ) \
( ( ( low > max ) || ( high < min ) ) ? 0 : \
( ( low > min ) ? \
( ( ( uint64_t ) (value) ) << ( low - min ) ) : \
( ( ( uint64_t ) (value) ) >> ( min - low ) ) ) )
#define EFAB_INSERT_NATIVE32( min, max, low, high, value ) \
( ( ( low > max ) || ( high < min ) ) ? 0 : \
( ( low > min ) ? \
( ( ( uint32_t ) (value) ) << ( low - min ) ) : \
( ( ( uint32_t ) (value) ) >> ( min - low ) ) ) )
#define EFAB_INSERT_NATIVE( min, max, low, high, value ) \
( ( ( ( max - min ) >= 32 ) || \
( ( high - low ) >= 32 ) ) \
? EFAB_INSERT_NATIVE64 ( min, max, low, high, value ) \
: EFAB_INSERT_NATIVE32 ( min, max, low, high, value ) )
/**
* Construct bit field portion
*
* Creates the portion of the named bit field that lies within the
* range [min,max).
*/
#define EFAB_INSERT_FIELD_NATIVE( min, max, field, value ) \
EFAB_INSERT_NATIVE ( min, max, EFAB_LOW_BIT ( field ), \
EFAB_HIGH_BIT ( field ), value )
/**
* Construct bit field
*
* Creates the portion of the named bit fields that lie within the
* range [min,max).
*/
#define EFAB_INSERT_FIELDS_NATIVE( min, max, \
field1, value1, \
field2, value2, \
field3, value3, \
field4, value4, \
field5, value5, \
field6, value6, \
field7, value7, \
field8, value8, \
field9, value9, \
field10, value10 ) \
( EFAB_INSERT_FIELD_NATIVE ( min, max, field1, value1 ) | \
EFAB_INSERT_FIELD_NATIVE ( min, max, field2, value2 ) | \
EFAB_INSERT_FIELD_NATIVE ( min, max, field3, value3 ) | \
EFAB_INSERT_FIELD_NATIVE ( min, max, field4, value4 ) | \
EFAB_INSERT_FIELD_NATIVE ( min, max, field5, value5 ) | \
EFAB_INSERT_FIELD_NATIVE ( min, max, field6, value6 ) | \
EFAB_INSERT_FIELD_NATIVE ( min, max, field7, value7 ) | \
EFAB_INSERT_FIELD_NATIVE ( min, max, field8, value8 ) | \
EFAB_INSERT_FIELD_NATIVE ( min, max, field9, value9 ) | \
EFAB_INSERT_FIELD_NATIVE ( min, max, field10, value10 ) )
#define EFAB_INSERT_FIELDS64( ... ) \
cpu_to_le64 ( EFAB_INSERT_FIELDS_NATIVE ( __VA_ARGS__ ) )
#define EFAB_INSERT_FIELDS32( ... ) \
cpu_to_le32 ( EFAB_INSERT_FIELDS_NATIVE ( __VA_ARGS__ ) )
#define EFAB_POPULATE_OWORD64( oword, ... ) do { \
(oword).u64[0] = EFAB_INSERT_FIELDS64 ( 0, 63, __VA_ARGS__ );\
(oword).u64[1] = EFAB_INSERT_FIELDS64 ( 64, 127, __VA_ARGS__ );\
} while ( 0 )
#define EFAB_POPULATE_QWORD64( qword, ... ) do { \
(qword).u64[0] = EFAB_INSERT_FIELDS64 ( 0, 63, __VA_ARGS__ );\
} while ( 0 )
#define EFAB_POPULATE_OWORD32( oword, ... ) do { \
(oword).u32[0] = EFAB_INSERT_FIELDS32 ( 0, 31, __VA_ARGS__ );\
(oword).u32[1] = EFAB_INSERT_FIELDS32 ( 32, 63, __VA_ARGS__ );\
(oword).u32[2] = EFAB_INSERT_FIELDS32 ( 64, 95, __VA_ARGS__ );\
(oword).u32[3] = EFAB_INSERT_FIELDS32 ( 96, 127, __VA_ARGS__ );\
} while ( 0 )
#define EFAB_POPULATE_QWORD32( qword, ... ) do { \
(qword).u32[0] = EFAB_INSERT_FIELDS32 ( 0, 31, __VA_ARGS__ );\
(qword).u32[1] = EFAB_INSERT_FIELDS32 ( 32, 63, __VA_ARGS__ );\
} while ( 0 )
#define EFAB_POPULATE_DWORD( dword, ... ) do { \
(dword).u32[0] = EFAB_INSERT_FIELDS32 ( 0, 31, __VA_ARGS__ );\
} while ( 0 )
#if ( BITS_PER_LONG == 64 )
#define EFAB_POPULATE_OWORD EFAB_POPULATE_OWORD64
#define EFAB_POPULATE_QWORD EFAB_POPULATE_QWORD64
#else
#define EFAB_POPULATE_OWORD EFAB_POPULATE_OWORD32
#define EFAB_POPULATE_QWORD EFAB_POPULATE_QWORD32
#endif
/* Populate an octword field with various numbers of arguments */
#define EFAB_POPULATE_OWORD_10 EFAB_POPULATE_OWORD
#define EFAB_POPULATE_OWORD_9( oword, ... ) \
EFAB_POPULATE_OWORD_10 ( oword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_OWORD_8( oword, ... ) \
EFAB_POPULATE_OWORD_9 ( oword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_OWORD_7( oword, ... ) \
EFAB_POPULATE_OWORD_8 ( oword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_OWORD_6( oword, ... ) \
EFAB_POPULATE_OWORD_7 ( oword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_OWORD_5( oword, ... ) \
EFAB_POPULATE_OWORD_6 ( oword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_OWORD_4( oword, ... ) \
EFAB_POPULATE_OWORD_5 ( oword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_OWORD_3( oword, ... ) \
EFAB_POPULATE_OWORD_4 ( oword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_OWORD_2( oword, ... ) \
EFAB_POPULATE_OWORD_3 ( oword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_OWORD_1( oword, ... ) \
EFAB_POPULATE_OWORD_2 ( oword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_ZERO_OWORD( oword ) \
EFAB_POPULATE_OWORD_1 ( oword, EFAB_DUMMY_FIELD, 0 )
#define EFAB_SET_OWORD( oword ) \
EFAB_POPULATE_OWORD_4 ( oword, \
EFAB_DWORD_0, 0xffffffff, \
EFAB_DWORD_1, 0xffffffff, \
EFAB_DWORD_2, 0xffffffff, \
EFAB_DWORD_3, 0xffffffff )
/* Populate a quadword field with various numbers of arguments */
#define EFAB_POPULATE_QWORD_10 EFAB_POPULATE_QWORD
#define EFAB_POPULATE_QWORD_9( qword, ... ) \
EFAB_POPULATE_QWORD_10 ( qword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_QWORD_8( qword, ... ) \
EFAB_POPULATE_QWORD_9 ( qword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_QWORD_7( qword, ... ) \
EFAB_POPULATE_QWORD_8 ( qword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_QWORD_6( qword, ... ) \
EFAB_POPULATE_QWORD_7 ( qword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_QWORD_5( qword, ... ) \
EFAB_POPULATE_QWORD_6 ( qword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_QWORD_4( qword, ... ) \
EFAB_POPULATE_QWORD_5 ( qword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_QWORD_3( qword, ... ) \
EFAB_POPULATE_QWORD_4 ( qword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_QWORD_2( qword, ... ) \
EFAB_POPULATE_QWORD_3 ( qword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_QWORD_1( qword, ... ) \
EFAB_POPULATE_QWORD_2 ( qword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_ZERO_QWORD( qword ) \
EFAB_POPULATE_QWORD_1 ( qword, EFAB_DUMMY_FIELD, 0 )
#define EFAB_SET_QWORD( qword ) \
EFAB_POPULATE_QWORD_2 ( qword, \
EFAB_DWORD_0, 0xffffffff, \
EFAB_DWORD_1, 0xffffffff )
/* Populate a dword field with various numbers of arguments */
#define EFAB_POPULATE_DWORD_10 EFAB_POPULATE_DWORD
#define EFAB_POPULATE_DWORD_9( dword, ... ) \
EFAB_POPULATE_DWORD_10 ( dword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_DWORD_8( dword, ... ) \
EFAB_POPULATE_DWORD_9 ( dword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_DWORD_7( dword, ... ) \
EFAB_POPULATE_DWORD_8 ( dword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_DWORD_6( dword, ... ) \
EFAB_POPULATE_DWORD_7 ( dword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_DWORD_5( dword, ... ) \
EFAB_POPULATE_DWORD_6 ( dword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_DWORD_4( dword, ... ) \
EFAB_POPULATE_DWORD_5 ( dword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_DWORD_3( dword, ... ) \
EFAB_POPULATE_DWORD_4 ( dword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_DWORD_2( dword, ... ) \
EFAB_POPULATE_DWORD_3 ( dword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_POPULATE_DWORD_1( dword, ... ) \
EFAB_POPULATE_DWORD_2 ( dword, EFAB_DUMMY_FIELD, 0, __VA_ARGS__ )
#define EFAB_ZERO_DWORD( dword ) \
EFAB_POPULATE_DWORD_1 ( dword, EFAB_DUMMY_FIELD, 0 )
#define EFAB_SET_DWORD( dword ) \
EFAB_POPULATE_DWORD_1 ( dword, EFAB_DWORD_0, 0xffffffff )
/*
* Modify a named field within an already-populated structure. Used
* for read-modify-write operations.
*
*/
#define EFAB_INSERT_FIELD64( ... ) \
cpu_to_le64 ( EFAB_INSERT_FIELD_NATIVE ( __VA_ARGS__ ) )
#define EFAB_INSERT_FIELD32( ... ) \
cpu_to_le32 ( EFAB_INSERT_FIELD_NATIVE ( __VA_ARGS__ ) )
#define EFAB_INPLACE_MASK64( min, max, field ) \
EFAB_INSERT_FIELD64 ( min, max, field, EFAB_MASK64 ( field ) )
#define EFAB_INPLACE_MASK32( min, max, field ) \
EFAB_INSERT_FIELD32 ( min, max, field, EFAB_MASK32 ( field ) )
#define EFAB_SET_OWORD_FIELD64( oword, field, value ) do { \
(oword).u64[0] = ( ( (oword).u64[0] \
& ~EFAB_INPLACE_MASK64 ( 0, 63, field ) ) \
| EFAB_INSERT_FIELD64 ( 0, 63, field, value ) ); \
(oword).u64[1] = ( ( (oword).u64[1] \
& ~EFAB_INPLACE_MASK64 ( 64, 127, field ) ) \
| EFAB_INSERT_FIELD64 ( 64, 127, field, value ) ); \
} while ( 0 )
#define EFAB_SET_QWORD_FIELD64( qword, field, value ) do { \
(qword).u64[0] = ( ( (qword).u64[0] \
& ~EFAB_INPLACE_MASK64 ( 0, 63, field ) ) \
| EFAB_INSERT_FIELD64 ( 0, 63, field, value ) ); \
} while ( 0 )
#define EFAB_SET_OWORD_FIELD32( oword, field, value ) do { \
(oword).u32[0] = ( ( (oword).u32[0] \
& ~EFAB_INPLACE_MASK32 ( 0, 31, field ) ) \
| EFAB_INSERT_FIELD32 ( 0, 31, field, value ) ); \
(oword).u32[1] = ( ( (oword).u32[1] \
& ~EFAB_INPLACE_MASK32 ( 32, 63, field ) ) \
| EFAB_INSERT_FIELD32 ( 32, 63, field, value ) ); \
(oword).u32[2] = ( ( (oword).u32[2] \
& ~EFAB_INPLACE_MASK32 ( 64, 95, field ) ) \
| EFAB_INSERT_FIELD32 ( 64, 95, field, value ) ); \
(oword).u32[3] = ( ( (oword).u32[3] \
& ~EFAB_INPLACE_MASK32 ( 96, 127, field ) ) \
| EFAB_INSERT_FIELD32 ( 96, 127, field, value ) ); \
} while ( 0 )
#define EFAB_SET_QWORD_FIELD32( qword, field, value ) do { \
(qword).u32[0] = ( ( (qword).u32[0] \
& ~EFAB_INPLACE_MASK32 ( 0, 31, field ) ) \
| EFAB_INSERT_FIELD32 ( 0, 31, field, value ) ); \
(qword).u32[1] = ( ( (qword).u32[1] \
& ~EFAB_INPLACE_MASK32 ( 32, 63, field ) ) \
| EFAB_INSERT_FIELD32 ( 32, 63, field, value ) ); \
} while ( 0 )
#define EFAB_SET_DWORD_FIELD( dword, field, value ) do { \
(dword).u32[0] = ( ( (dword).u32[0] \
& ~EFAB_INPLACE_MASK32 ( 0, 31, field ) ) \
| EFAB_INSERT_FIELD32 ( 0, 31, field, value ) ); \
} while ( 0 )
#if ( BITS_PER_LONG == 64 )
#define EFAB_SET_OWORD_FIELD EFAB_SET_OWORD_FIELD64
#define EFAB_SET_QWORD_FIELD EFAB_SET_QWORD_FIELD64
#else
#define EFAB_SET_OWORD_FIELD EFAB_SET_OWORD_FIELD32
#define EFAB_SET_QWORD_FIELD EFAB_SET_QWORD_FIELD32
#endif
/* Used to avoid compiler warnings about shift range exceeding width
* of the data types when dma_addr_t is only 32 bits wide.
*/
#define DMA_ADDR_T_WIDTH ( 8 * sizeof ( dma_addr_t ) )
#define EFAB_DMA_TYPE_WIDTH( width ) \
( ( (width) < DMA_ADDR_T_WIDTH ) ? (width) : DMA_ADDR_T_WIDTH )
#define EFAB_DMA_MAX_MASK ( ( DMA_ADDR_T_WIDTH == 64 ) ? \
~( ( uint64_t ) 0 ) : ~( ( uint32_t ) 0 ) )
#define EFAB_DMA_MASK(mask) ( (mask) & EFAB_DMA_MAX_MASK )
#endif /* EFAB_BITFIELD_H */
/*
* Local variables:
* c-basic-offset: 8
* c-indent-level: 8
* tab-width: 8
* End:
*/

View File

@ -0,0 +1,23 @@
diff -ru ../../orig/dhcp-3.0.4b2/common/options.c ./common/options.c
--- ../../orig/dhcp-3.0.4b2/common/options.c 2005-11-02 01:19:03.000000000 +0200
+++ ./common/options.c 2005-12-06 14:38:17.000000000 +0200
@@ -537,6 +537,7 @@
priority_list [priority_len++] = DHO_DHCP_LEASE_TIME;
priority_list [priority_len++] = DHO_DHCP_MESSAGE;
priority_list [priority_len++] = DHO_DHCP_REQUESTED_ADDRESS;
+ priority_list [priority_len++] = DHO_DHCP_CLIENT_IDENTIFIER;
priority_list [priority_len++] = DHO_FQDN;
if (prl && prl -> len > 0) {
diff -ru ../../orig/dhcp-3.0.4b2/includes/site.h ./includes/site.h
--- ../../orig/dhcp-3.0.4b2/includes/site.h 2002-03-12 20:33:39.000000000 +0200
+++ ./includes/site.h 2005-12-06 14:36:55.000000000 +0200
@@ -135,7 +135,7 @@
the aforementioned problems do not matter to you, or if no other
API is supported for your system, you may want to go with it. */
-/* #define USE_SOCKETS */
+#define USE_SOCKETS
/* Define this to use the Sun Streams NIT API.

View File

@ -0,0 +1,56 @@
# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
# option definitions common to all supported networks...
DHCPD_INTERFACE = "ib0";
# if you do not use dynamical DNS updates:
#
# this statement is needed by dhcpd-3 needs at least this statement.
# you have to delete it for dhcpd-2, because it does not know it.
#
# if you want to use dynamical DNS updates, you should first read
# read /usr/share/doc/packages/dhcp-server/DDNS-howto.txt
ddns-update-style none; ddns-updates off;
filename "pxelinux.bin";
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
# No service will be given on this subnet, but declaring it helps the
# DHCP server to understand the network topology.
subnet 10.152.187.0 netmask 255.255.255.0 {
}
# This declaration allows BOOTP clients to get dynamic addresses,
# which we don't really recommend.
shared-network "ipoib_network" {
subnet 11.4.8.0 netmask 255.255.255.0 {
option dhcp-client-identifier = option dhcp-client-identifier;
option subnet-mask 255.255.255.0;
option domain-name "yok.mtl.com";
option domain-name-servers 10.0.0.1;
default-lease-time 28800;
max-lease-time 86400;
next-server 11.4.8.99;
}
}
# You need one such entry for each client
host swlab35 {
fixed-address 11.4.8.35; # the IP address to be assigned to the client
# The value of the client identifier must be comprised from the prefix 20:00:
# folowed by the client's ipoib qp number - 55:04:01 in this example -
# followed by the GID of the port
option dhcp-client-identifier = 20:00:55:04:01:fe:80:00:00:00:00:00:00:00:02:c9:00:01:70:8a:81;
}

View File

@ -434,6 +434,7 @@ static void pcnet32_reset(struct nic *nic)
if (lp->options & PCNET32_PORT_ASEL)
val |= 2;
lp->a.write_bcr(ioaddr, 2, val);
/* handle full duplex setting */
if (lp->full_duplex) {
val = lp->a.read_bcr(ioaddr, 9) & ~3;
@ -483,6 +484,19 @@ static void pcnet32_reset(struct nic *nic)
lp->a.write_csr(ioaddr, 3, val);
}
#endif
if (1)
{
//disable interrupts
val = lp->a.read_csr(ioaddr, 3);
val = val
| (1 << 14) //BABLM intr disabled
| (1 << 12) //MISSM missed frame mask intr disabled
| (1 << 10) //RINTM receive intr disabled
| (1 << 9) //TINTM transmit intr disabled
| (1 << 8) //IDONM init done intr disabled
;
lp->a.write_csr(ioaddr, 3, val);
}
if (lp->ltint) { /* Enable TxDone-intr inhibitor */
val = lp->a.read_csr(ioaddr, 5);
@ -625,10 +639,10 @@ static void pcnet32_disable ( struct nic *nic __unused ) {
lp->a.write_csr(ioaddr, 0, 0x0004);
/*
* Switch back to 16-bit mode to avoid problesm with dumb
* Switch back to 16-bit mode to avoid problems with dumb
* DOS packet driver after a warm reboot
*/
lp->a.write_bcr(ioaddr, 20, 4);
lp->a.write_bcr(ioaddr, 20, 0);
}
/**************************************************************************
@ -691,7 +705,7 @@ static int pcnet32_probe ( struct nic *nic, struct pci_device *pci ) {
chip_version =
a->read_csr(ioaddr, 88) | (a->read_csr(ioaddr, 89) << 16);
dprintf(("PCnet chip version is %0xhX\n", chip_version));
dprintf(("PCnet chip version is 0x%X\n", chip_version));
if ((chip_version & 0xfff) != 0x003)
return 0;
@ -753,6 +767,7 @@ static int pcnet32_probe ( struct nic *nic, struct pci_device *pci ) {
mii = 1;
break;
default:
chipname = "UNKNOWN";
printf("PCnet version %#x, no PCnet32 chip.\n",
chip_version);
return 0;
@ -785,7 +800,7 @@ static int pcnet32_probe ( struct nic *nic, struct pci_device *pci ) {
nic->node_addr[i] = promaddr[i];
}
/* Print out some hardware info */
printf("%s: %! at ioaddr %hX, ", pci->name, nic->node_addr,
printf("%s: %! at ioaddr 0x%hX, ", chipname, nic->node_addr,
ioaddr);
/* Set to pci bus master */
@ -872,7 +887,6 @@ static int pcnet32_probe ( struct nic *nic, struct pci_device *pci ) {
/* switch pcnet32 to 32bit mode */
a->write_bcr(ioaddr, 20, 2);
a->write_csr(ioaddr, 1, (virt_to_bus(&lp->init_block)) & 0xffff);
a->write_csr(ioaddr, 2, (virt_to_bus(&lp->init_block)) >> 16);
@ -883,15 +897,16 @@ static int pcnet32_probe ( struct nic *nic, struct pci_device *pci ) {
*/
/* Trigger an initialization just for the interrupt. */
a->write_csr(ioaddr, 0, 0x41);
mdelay(1);
// a->write_csr(ioaddr, 0, 0x41);
// mdelay(1);
cards_found++;
/* point to NIC specific routines */
pcnet32_reset(nic);
if (1) {
int tmp;
if (mii) {
int tmp;
int phy, phy_idx = 0;
u16 mii_lpa;
lp->phys[0] = 1; /* Default Setting */
@ -928,6 +943,13 @@ static int pcnet32_probe ( struct nic *nic, struct pci_device *pci ) {
printf("10Mbps Half-Duplex\n");
else
printf("\n");
} else {
/* The older chips are fixed 10Mbps, and some support full duplex,
* although not via autonegotiation, but only via configuration. */
if (fdx)
printf("10Mbps Full-Duplex\n");
else
printf("10Mbps Half-Duplex\n");
}
nic->nic_op = &pcnet32_operations;
@ -979,9 +1001,9 @@ static struct nic_operations pcnet32_operations = {
};
static struct pci_id pcnet32_nics[] = {
PCI_ROM(0x1022, 0x2000, "lancepci", "AMD Lance/PCI"),
PCI_ROM(0x1022, 0x2625, "pcnetfastiii", "AMD Lance/PCI PCNet/32"),
PCI_ROM(0x1022, 0x2001, "amdhomepna", "AMD Lance/HomePNA"),
PCI_ROM(0x1022, 0x2000, "pcnet32", "AMD PCnet/PCI"),
PCI_ROM(0x1022, 0x2625, "pcnetfastiii", "AMD PCNet FAST III"),
PCI_ROM(0x1022, 0x2001, "amdhomepna", "AMD PCnet/HomePNA"),
};
PCI_DRIVER ( pcnet32_driver, pcnet32_nics, PCI_NO_CLASS );

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff