Kaynağa Gözat

[natsemi] Replace driver for National Semicondutor NICs

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 12 yıl önce
ebeveyn
işleme
2c1e8d2cb1
4 değiştirilmiş dosya ile 1108 ekleme ve 1682 silme
  1. 804
    481
      src/drivers/net/natsemi.c
  2. 291
    194
      src/drivers/net/natsemi.h
  3. 0
    1007
      src/drivers/net/ns83820.c
  4. 13
    0
      src/include/ipxe/threewire.h

+ 804
- 481
src/drivers/net/natsemi.c
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 291
- 194
src/drivers/net/natsemi.h Dosyayı Görüntüle

@@ -1,232 +1,329 @@
1
-FILE_LICENCE ( GPL_ANY );
1
+#ifndef _NATSEMI_H
2
+#define _NATSEMI_H
2 3
 
3
-#define NATSEMI_HW_TIMEOUT 400
4
+/** @file
5
+ *
6
+ * National Semiconductor "MacPhyter" network card driver
7
+ *
8
+ */
9
+
10
+FILE_LICENCE ( GPL2_OR_LATER );
4 11
 
5
-#define TX_RING_SIZE 4
6
-#define NUM_RX_DESC  4
7
-#define RX_BUF_SIZE 1536
8
-#define OWN       0x80000000
9
-#define DSIZE     0x00000FFF
10
-#define CRC_SIZE  4
12
+#include <stdint.h>
13
+#include <ipxe/spi.h>
14
+#include <ipxe/spi_bit.h>
11 15
 
12
-struct natsemi_tx {
16
+/** BAR size */
17
+#define NATSEMI_BAR_SIZE 0x100
18
+
19
+/** A 32-bit packet descriptor */
20
+struct natsemi_descriptor_32 {
21
+	/** Link to next descriptor */
13 22
 	uint32_t link;
23
+	/** Command / status */
14 24
 	uint32_t cmdsts;
25
+	/** Buffer pointer */
15 26
 	uint32_t bufptr;
16
-};
27
+} __attribute__ (( packed ));
17 28
 
18
-struct natsemi_rx {
19
-	uint32_t link;
29
+/** A 64-bit packet descriptor */
30
+struct natsemi_descriptor_64 {
31
+	/** Link to next descriptor */
32
+	uint64_t link;
33
+	/** Buffer pointer */
34
+	uint64_t bufptr;
35
+	/** Command / status */
20 36
 	uint32_t cmdsts;
21
-	uint32_t bufptr;
22
-};
37
+	/** Extended status */
38
+	uint32_t extsts;
39
+} __attribute__ (( packed ));
23 40
 
24
-struct natsemi_private {
25
-	unsigned short ioaddr;
26
-	unsigned short tx_cur;
27
-	unsigned short tx_dirty;
28
-	unsigned short rx_cur;
29
-	struct natsemi_tx tx[TX_RING_SIZE];
30
-	struct natsemi_rx rx[NUM_RX_DESC];
31
-
32
-	/* need to add iobuf as we cannot free iobuf->data in close without this 
33
-	 * alternatively substracting sizeof(head) and sizeof(list_head) can also 
34
-	 * give the same.
35
-	 */
36
-	struct io_buffer *iobuf[NUM_RX_DESC];
37
-
38
-	/* netdev_tx_complete needs pointer to the iobuf of the data so as to free 
39
-	 * it from the memory.
40
-	 */
41
-	struct io_buffer *tx_iobuf[TX_RING_SIZE];
42
-	struct spi_bit_basher spibit;
43
-	struct spi_device eeprom;
44
-	struct nvo_block nvo;
41
+/** A packet descriptor
42
+ *
43
+ * The 32-bit and 64-bit variants are overlaid such that "cmdsts" can
44
+ * be accessed as a common field, and the overall size is a power of
45
+ * two (to allow the descriptor ring length to be used as an
46
+ * alignment).
47
+ */
48
+union natsemi_descriptor {
49
+	/** Common fields */
50
+	struct {
51
+		/** Reserved */
52
+		uint8_t reserved_a[16];
53
+		/** Command / status */
54
+		uint32_t cmdsts;
55
+		/** Reserved */
56
+		uint8_t reserved_b[12];
57
+	} __attribute__ (( packed )) common;
58
+	/** 64-bit descriptor */
59
+	struct natsemi_descriptor_64 d64;
60
+	/** 32-bit descriptor */
61
+	struct {
62
+		/** Reserved */
63
+		uint8_t reserved[12];
64
+		/** Descriptor */
65
+		struct natsemi_descriptor_32 d32;
66
+	} __attribute__ (( packed )) d32pad;
45 67
 };
46 68
 
47
-/*
48
- * Support for fibre connections on Am79C874:
49
- * This phy needs a special setup when connected to a fibre cable.
50
- * http://www.amd.com/files/connectivitysolutions/networking/archivednetworking/22235.pdf
51
- */
52
-#define PHYID_AM79C874	0x0022561b
69
+/** Descriptor buffer size mask */
70
+#define NATSEMI_DESC_SIZE_MASK 0xfff
53 71
 
54
-enum {
55
-	MII_MCTRL	= 0x15,		/* mode control register */
56
-	MII_FX_SEL	= 0x0001,	/* 100BASE-FX (fiber) */
57
-	MII_EN_SCRM	= 0x0004,	/* enable scrambler (tp) */
72
+/** Packet descriptor flags */
73
+enum natsemi_descriptor_flags {
74
+	/** Descriptor is owned by NIC */
75
+	NATSEMI_DESC_OWN = 0x80000000UL,
76
+	/** Request descriptor interrupt */
77
+	NATSEMI_DESC_INTR = 0x20000000UL,
78
+	/** Packet OK */
79
+	NATSEMI_DESC_OK = 0x08000000UL,
58 80
 };
59 81
 
82
+/** Command Register */
83
+#define NATSEMI_CR 0x0000
84
+#define NATSEMI_CR_RST		0x00000100UL	/**< Reset */
85
+#define NATSEMI_CR_RXR		0x00000020UL	/**< Receiver reset */
86
+#define NATSEMI_CR_TXR		0x00000010UL	/**< Transmit reset */
87
+#define NATSEMI_CR_RXE		0x00000004UL	/**< Receiver enable */
88
+#define NATSEMI_CR_TXE		0x00000001UL	/**< Transmit enable */
89
+
90
+/** Maximum time to wait for a reset, in milliseconds */
91
+#define NATSEMI_RESET_MAX_WAIT_MS 100
92
+
93
+/** Configuration and Media Status Register */
94
+#define NATSEMI_CFG 0x0004
95
+#define NATSEMI_CFG_LNKSTS	0x80000000UL	/**< Link status */
96
+#define NATSEMI_CFG_SPDSTS1	0x40000000UL	/**< Speed status bit 1 */
97
+#define NATSEMI_CFG_MODE_1000	0x00400000UL	/**< 1000 Mb/s mode control */
98
+#define NATSEMI_CFG_PCI64_DET	0x00002000UL	/**< PCI 64-bit bus detected */
99
+#define NATSEMI_CFG_DATA64_EN	0x00001000UL	/**< 64-bit data enable */
100
+#define NATSEMI_CFG_M64ADDR	0x00000800UL	/**< 64-bit address enable */
101
+#define NATSEMI_CFG_EXTSTS_EN	0x00000100UL	/**< Extended status enable */
102
+
103
+/** EEPROM Access Register */
104
+#define NATSEMI_MEAR 0x0008
105
+#define NATSEMI_MEAR_EESEL	0x00000008UL	/**< EEPROM chip select */
106
+#define NATSEMI_MEAR_EECLK	0x00000004UL	/**< EEPROM serial clock */
107
+#define NATSEMI_MEAR_EEDO	0x00000002UL	/**< EEPROM data out */
108
+#define NATSEMI_MEAR_EEDI	0x00000001UL	/**< EEPROM data in */
109
+
110
+/** Size of EEPROM (in bytes) */
111
+#define NATSEMI_EEPROM_SIZE 32
112
+
113
+/** Word offset of MAC address within sane EEPROM layout */
114
+#define NATSEMI_EEPROM_MAC_SANE 0x0a
115
+
116
+/** Word offset of MAC address within insane EEPROM layout */
117
+#define NATSEMI_EEPROM_MAC_INSANE 0x06
118
+
119
+/** PCI Test Control Register */
120
+#define NATSEMI_PTSCR 0x000c
121
+#define NATSEMI_PTSCR_EELOAD_EN	0x00000004UL	/**< Enable EEPROM load */
122
+
123
+/** Maximum time to wait for a configuration reload, in milliseconds */
124
+#define NATSEMI_EELOAD_MAX_WAIT_MS 100
125
+
126
+/** Interrupt Status Register */
127
+#define NATSEMI_ISR 0x0010
128
+#define NATSEMI_IRQ_TXDESC	0x00000080UL	/**< TX descriptor */
129
+#define NATSEMI_IRQ_RXDESC	0x00000002UL	/**< RX descriptor */
130
+
131
+/** Interrupt Mask Register */
132
+#define NATSEMI_IMR 0x0014
133
+
134
+/** Interrupt Enable Register */
135
+#define NATSEMI_IER 0x0018
136
+#define NATSEMI_IER_IE		0x00000001UL	/**< Interrupt enable */
137
+
138
+/** Transmit Descriptor Pointer */
139
+#define NATSEMI_TXDP 0x0020
140
+
141
+/** Transmit Descriptor Pointer High Dword (64-bit) */
142
+#define NATSEMI_TXDP_HI_64 0x0024
143
+
144
+/** Number of transmit descriptors */
145
+#define NATSEMI_NUM_TX_DESC 4
60 146
 
147
+/** Transmit configuration register (32-bit) */
148
+#define NATSEMI_TXCFG_32 0x24
61 149
 
62
-/* values we might find in the silicon revision register */
63
-#define SRR_DP83815_C	0x0302
64
-#define SRR_DP83815_D	0x0403
65
-#define SRR_DP83816_A4	0x0504
66
-#define SRR_DP83816_A5	0x0505
150
+/** Transmit configuration register (64-bit) */
151
+#define NATSEMI_TXCFG_64 0x28
152
+#define NATSEMI_TXCFG_CSI	0x80000000UL	/**< Carrier sense ignore */
153
+#define NATSEMI_TXCFG_HBI	0x40000000UL	/**< Heartbeat ignore */
154
+#define NATSEMI_TXCFG_ATP	0x10000000UL	/**< Automatic padding */
155
+#define NATSEMI_TXCFG_ECRETRY	0x00800000UL	/**< Excess collision retry */
156
+#define NATSEMI_TXCFG_MXDMA(x)	( (x) << 20 )	/**< Max DMA burst size */
157
+#define NATSEMI_TXCFG_FLTH(x)	( (x) << 8 )	/**< Fill threshold */
158
+#define NATSEMI_TXCFG_DRTH(x)	( (x) << 0 )	/**< Drain threshold */
67 159
 
68
-/* NATSEMI: Offsets to the device registers.
69
- * Unlike software-only systems, device drivers interact with complex hardware.
70
- * It's not useful to define symbolic names for every register bit in the
71
- * device.
160
+/** Max DMA burst size (encoded value)
161
+ *
162
+ * This represents 256-byte bursts on 83815 controllers and 512-byte
163
+ * bursts on 83820 controllers.
72 164
  */
73
-enum register_offsets {
74
-    ChipCmd      = 0x00, 
75
-    ChipConfig   = 0x04, 
76
-    EECtrl       = 0x08, 
77
-    PCIBusCfg    = 0x0C,
78
-    IntrStatus   = 0x10, 
79
-    IntrMask     = 0x14, 
80
-    IntrEnable   = 0x18,
81
-    TxRingPtr    = 0x20, 
82
-    TxConfig     = 0x24,
83
-    RxRingPtr    = 0x30,
84
-    RxConfig     = 0x34, 
85
-    ClkRun       = 0x3C,
86
-    WOLCmd       = 0x40, 
87
-    PauseCmd     = 0x44,
88
-    RxFilterAddr = 0x48, 
89
-    RxFilterData = 0x4C,
90
-    BootRomAddr  = 0x50, 
91
-    BootRomData  = 0x54, 
92
-    SiliconRev   = 0x58, 
93
-    StatsCtrl    = 0x5C,
94
-    StatsData    = 0x60, 
95
-    RxPktErrs    = 0x60, 
96
-    RxMissed     = 0x68, 
97
-    RxCRCErrs    = 0x64,
98
-    PCIPM        = 0x44,
99
-    PhyStatus    = 0xC0, 
100
-    MIntrCtrl    = 0xC4, 
101
-    MIntrStatus  = 0xC8,
102
-
103
-    /* These are from the spec, around page 78... on a separate table. 
104
-     */
105
-    PGSEL        = 0xCC, 
106
-    PMDCSR       = 0xE4, 
107
-    TSTDAT       = 0xFC, 
108
-    DSPCFG       = 0xF4, 
109
-    SDCFG        = 0x8C,
110
-    BasicControl = 0x80,	
111
-    BasicStatus  = 0x84
112
-	    
113
-};
165
+#define NATSEMI_TXCFG_MXDMA_DEFAULT NATSEMI_TXCFG_MXDMA ( 0x7 )
114 166
 
115
-/* the values for the 'magic' registers above (PGSEL=1) */
116
-#define PMDCSR_VAL	0x189c	/* enable preferred adaptation circuitry */
117
-#define TSTDAT_VAL	0x0
118
-#define DSPCFG_VAL	0x5040
119
-#define SDCFG_VAL	0x008c	/* set voltage thresholds for Signal Detect */
120
-#define DSPCFG_LOCK	0x20	/* coefficient lock bit in DSPCFG */
121
-#define DSPCFG_COEF	0x1000	/* see coefficient (in TSTDAT) bit in DSPCFG */
122
-#define TSTDAT_FIXED	0xe8	/* magic number for bad coefficients */
167
+/** Fill threshold (in units of 32 bytes)
168
+ *
169
+ * Must be at least as large as the max DMA burst size, so use a value
170
+ * of 512 bytes.
171
+ */
172
+#define NATSEMI_TXCFG_FLTH_DEFAULT NATSEMI_TXCFG_FLTH ( 512 / 32 )
123 173
 
124
-/* Bit in ChipCmd.
174
+/** Drain threshold (in units of 32 bytes)
175
+ *
176
+ * Start transmission once we receive a conservative 1024 bytes, to
177
+ * avoid FIFO underrun errors.  (83815 does not allow us to specify a
178
+ * value of 0 for "wait until whole packet is present".)
179
+ *
180
+ * Fill threshold plus drain threshold must be less than the transmit
181
+ * FIFO size, which is 2kB on 83815 and 8kB on 83820.
125 182
  */
126
-enum ChipCmdBits {
127
-    ChipReset = 0x100, 
128
-    RxReset   = 0x20, 
129
-    TxReset   = 0x10, 
130
-    RxOff     = 0x08, 
131
-    RxOn      = 0x04,
132
-    TxOff     = 0x02, 
133
-    TxOn      = 0x01
134
-};
183
+#define NATSEMI_TXCFG_DRTH_DEFAULT NATSEMI_TXCFG_DRTH ( 1024 / 32 )
135 184
 
136
-enum ChipConfig_bits {
137
-	CfgPhyDis		= 0x200,
138
-	CfgPhyRst		= 0x400,
139
-	CfgExtPhy		= 0x1000,
140
-	CfgAnegEnable		= 0x2000,
141
-	CfgAneg100		= 0x4000,
142
-	CfgAnegFull		= 0x8000,
143
-	CfgAnegDone		= 0x8000000,
144
-	CfgFullDuplex		= 0x20000000,
145
-	CfgSpeed100		= 0x40000000,
146
-	CfgLink			= 0x80000000,
147
-};
185
+/** Receive Descriptor Pointer */
186
+#define NATSEMI_RXDP 0x0030
148 187
 
188
+/** Receive Descriptor Pointer High Dword (64-bit) */
189
+#define NATSEMI_RXDP_HI_64 0x0034
149 190
 
150
-/* Bits in the RxMode register.
151
- */
152
-enum rx_mode_bits {
153
-    AcceptErr          = 0x20,
154
-    AcceptRunt         = 0x10,
155
-    AcceptBroadcast    = 0xC0000000,
156
-    AcceptMulticast    = 0x00200000, 
157
-    AcceptAllMulticast = 0x20000000,
158
-    AcceptAllPhys      = 0x10000000, 
159
-    AcceptMyPhys       = 0x08000000,
160
-    RxFilterEnable     = 0x80000000
161
-};
191
+/** Number of receive descriptors */
192
+#define NATSEMI_NUM_RX_DESC 4
193
+
194
+/** Receive buffer length */
195
+#define NATSEMI_RX_MAX_LEN ( ETH_FRAME_LEN + 4 /* VLAN */ + 4 /* CRC */ )
162 196
 
163
-/* Bits in network_desc.status
197
+/** Receive configuration register (32-bit) */
198
+#define NATSEMI_RXCFG_32 0x34
199
+
200
+/** Receive configuration register (64-bit) */
201
+#define NATSEMI_RXCFG_64 0x38
202
+#define NATSEMI_RXCFG_ARP	0x40000000UL	/**< Accept runt packets */
203
+#define NATSEMI_RXCFG_ATX	0x10000000UL	/**< Accept transmit packets */
204
+#define NATSEMI_RXCFG_ALP	0x08000000UL	/**< Accept long packets */
205
+#define NATSEMI_RXCFG_MXDMA(x)	( (x) << 20 )	/**< Max DMA burst size */
206
+#define NATSEMI_RXCFG_DRTH(x)	( (x) << 1 )	/**< Drain threshold */
207
+
208
+/** Max DMA burst size (encoded value)
209
+ *
210
+ * This represents 256-byte bursts on 83815 controllers and 512-byte
211
+ * bursts on 83820 controllers.
164 212
  */
165
-enum desc_status_bits {
166
-    DescOwn   = 0x80000000, 
167
-    DescMore  = 0x40000000, 
168
-    DescIntr  = 0x20000000,
169
-    DescNoCRC = 0x10000000,
170
-    DescPktOK = 0x08000000, 
171
-    RxTooLong = 0x00400000
172
-};
213
+#define NATSEMI_RXCFG_MXDMA_DEFAULT NATSEMI_RXCFG_MXDMA ( 0x7 )
173 214
 
174
-/*Bits in Interrupt Mask register
215
+/** Drain threshold (in units of 8 bytes)
216
+ *
217
+ * Start draining after 64 bytes.
218
+ *
219
+ * Must be large enough to allow packet's accept/reject status to be
220
+ * determined before draining begins.
175 221
  */
176
-enum Intr_mask_register_bits {
177
-    RxOk       = 0x001,
178
-    RxErr      = 0x004,
179
-    TxOk       = 0x040,
180
-    TxErr      = 0x100 
181
-};	
182
-
183
-enum MIntrCtrl_bits {
184
-  MICRIntEn               = 0x2,
185
-};
222
+#define NATSEMI_RXCFG_DRTH_DEFAULT NATSEMI_RXCFG_DRTH ( 64 / 8 )
223
+
224
+/** Receive Filter/Match Control Register */
225
+#define NATSEMI_RFCR 0x0048
226
+#define NATSEMI_RFCR_RFEN	0x80000000UL	/**< RX filter enable */
227
+#define NATSEMI_RFCR_AAB	0x40000000UL	/**< Accept all broadcast */
228
+#define NATSEMI_RFCR_AAM	0x20000000UL	/**< Accept all multicast */
229
+#define NATSEMI_RFCR_AAU	0x10000000UL	/**< Accept all unicast */
230
+#define NATSEMI_RFCR_RFADDR( addr ) ( (addr) << 0 ) /**< Extended address */
231
+#define NATSEMI_RFCR_RFADDR_MASK NATSEMI_RFCR_RFADDR ( 0x3ff )
232
+
233
+/** Perfect match filter address base */
234
+#define NATSEMI_RFADDR_PMATCH_BASE 0x000
186 235
 
187
-/* CFG bits [13:16] [18:23] */
188
-#define CFG_RESET_SAVE 0xfde000
189
-/* WCSR bits [0:4] [9:10] */
190
-#define WCSR_RESET_SAVE 0x61f
191
-/* RFCR bits [20] [22] [27:31] */
192
-#define RFCR_RESET_SAVE 0xf8500000;
193
-
194
-/* Delay between EEPROM clock transitions.
195
-   No extra delay is needed with 33Mhz PCI, but future 66Mhz access may need
196
-   a delay. */
197
-#define eeprom_delay(ee_addr)   inl(ee_addr)
198
-
199
-enum EEPROM_Ctrl_Bits {
200
-	EE_ShiftClk   = 0x04,
201
-	EE_DataIn     = 0x01,
202
-	EE_ChipSelect = 0x08,
203
-	EE_DataOut    = 0x02
236
+/** Receive Filter/Match Data Register */
237
+#define NATSEMI_RFDR 0x004c
238
+#define NATSEMI_RFDR_BMASK	0x00030000UL	/**< Byte mask */
239
+#define NATSEMI_RFDR_DATA( value ) ( (value) & 0xffff ) /**< Filter data */
240
+
241
+/** National Semiconductor network card flags */
242
+enum natsemi_nic_flags {
243
+	/** EEPROM is little-endian */
244
+	NATSEMI_EEPROM_LITTLE_ENDIAN = 0x0001,
245
+	/** EEPROM layout is insane */
246
+	NATSEMI_EEPROM_INSANE = 0x0002,
247
+	/** Card supports 64-bit operation */
248
+	NATSEMI_64BIT = 0x0004,
249
+	/** Card supports 1000Mbps link */
250
+	NATSEMI_1000 = 0x0008,
204 251
 };
205 252
 
206
-#define EE_Write0 (EE_ChipSelect)
207
-#define EE_Write1 (EE_ChipSelect | EE_DataIn)
253
+/** A National Semiconductor descriptor ring */
254
+struct natsemi_ring {
255
+	/** Descriptors */
256
+	union natsemi_descriptor *desc;
257
+	/** Producer index */
258
+	unsigned int prod;
259
+	/** Consumer index */
260
+	unsigned int cons;
208 261
 
209
-/* The EEPROM commands include the alway-set leading bit. */
210
-enum EEPROM_Cmds {
211
-  EE_WriteCmd=(5 << 6), EE_ReadCmd=(6 << 6), EE_EraseCmd=(7 << 6),
262
+	/** Number of descriptors */
263
+	unsigned int count;
264
+	/** Descriptor start address register */
265
+	unsigned int reg;
212 266
 };
213 267
 
214
-/*  EEPROM access , values are devices specific
268
+/**
269
+ * Initialise descriptor ring
270
+ *
271
+ * @v ring		Descriptor ring
272
+ * @v count		Number of descriptors
273
+ * @v reg		Descriptor start address register
215 274
  */
216
-#define EE_CS		0x08	/* EEPROM chip select */
217
-#define EE_SK		0x04	/* EEPROM shift clock */
218
-#define EE_DI		0x01	/* Data in */
219
-#define EE_DO		0x02	/* Data out */
275
+static inline __attribute__ (( always_inline)) void
276
+natsemi_init_ring ( struct natsemi_ring *ring, unsigned int count,
277
+		    unsigned int reg ) {
278
+	ring->count = count;
279
+	ring->reg = reg;
280
+}
220 281
 
221
-/* Offsets within EEPROM (these are word offsets)
222
- */
223
-#define EE_MAC 7
224
-#define EE_REG  EECtrl
225
-
226
-static const uint8_t natsemi_ee_bits[] = {
227
-	[SPI_BIT_SCLK]	= EE_SK,
228
-	[SPI_BIT_MOSI]	= EE_DI,
229
-	[SPI_BIT_MISO]	= EE_DO,
230
-	[SPI_BIT_SS(0)]	= EE_CS,
282
+/** A National Semiconductor network card */
283
+struct natsemi_nic {
284
+	/** Flags */
285
+	unsigned int flags;
286
+	/** Registers */
287
+	void *regs;
288
+	/** SPI bit-bashing interface */
289
+	struct spi_bit_basher spibit;
290
+	/** EEPROM */
291
+	struct spi_device eeprom;
292
+
293
+	/** Transmit descriptor ring */
294
+	struct natsemi_ring tx;
295
+	/** Receive descriptor ring */
296
+	struct natsemi_ring rx;
297
+	/** Receive I/O buffers */
298
+	struct io_buffer *rx_iobuf[NATSEMI_NUM_RX_DESC];
299
+
300
+	/** Link status (cache) */
301
+	uint32_t cfg;
231 302
 };
232 303
 
304
+/**
305
+ * Check if card can access physical address
306
+ *
307
+ * @v natsemi		National Semiconductor device
308
+ * @v address		Physical address
309
+ * @v address_ok	Card can access physical address
310
+ */
311
+static inline __attribute__ (( always_inline )) int
312
+natsemi_address_ok ( struct natsemi_nic *natsemi, physaddr_t address ) {
313
+
314
+	/* In a 32-bit build, all addresses can be accessed */
315
+	if ( sizeof ( physaddr_t ) <= sizeof ( uint32_t ) )
316
+		return 1;
317
+
318
+	/* A 64-bit card can access all addresses */
319
+	if ( natsemi->flags & NATSEMI_64BIT )
320
+		return 1;
321
+
322
+	/* A 32-bit card can access all address below 4GB */
323
+	if ( ( address & 0xffffffffUL ) == 0 )
324
+		return 1;
325
+
326
+	return 0;
327
+}
328
+
329
+#endif /* _NATSEMI_H */

+ 0
- 1007
src/drivers/net/ns83820.c
Dosya farkı çok büyük olduğundan ihmal edildi
Dosyayı Görüntüle


+ 13
- 0
src/include/ipxe/threewire.h Dosyayı Görüntüle

@@ -61,6 +61,19 @@ init_at93cx6 ( struct spi_device *device, unsigned int organisation ) {
61 61
 	device->nvs.write = threewire_write;
62 62
 }
63 63
 
64
+/**
65
+ * Initialise Atmel AT93C06 serial EEPROM
66
+ *
67
+ * @v device		SPI device
68
+ * @v organisation	Word organisation (8 or 16)
69
+ */
70
+static inline __attribute__ (( always_inline )) void
71
+init_at93c06 ( struct spi_device *device, unsigned int organisation ) {
72
+	device->nvs.size = ( 256 / organisation );
73
+	device->address_len = ( ( organisation == 8 ) ? 7 : 6 );
74
+	init_at93cx6 ( device, organisation );
75
+}
76
+
64 77
 /**
65 78
  * Initialise Atmel AT93C46 serial EEPROM
66 79
  *

Loading…
İptal
Kaydet