浏览代码

[efi] Add NII / UNDI driver

Some UEFI network drivers provide a software UNDI interface which is
exposed via the Network Interface Identifier Protocol (NII), rather
than providing a Simple Network Protocol (SNP).

The UEFI platform firmware will usually include the SnpDxe driver,
which attaches to NII and provides an SNP interface.  The SNP
interface is usually provided on the same handle as the underlying NII
device.  This causes problems for our EFI driver model: when
efi_driver_connect() detaches existing drivers from the handle it will
cause the SNP interface to be uninstalled, and so our SNP driver will
not be able to attach to the handle.  The platform firmware will
eventually reattach the SnpDxe driver and may attach us to the SNP
handle, but we have no way to prevent other drivers from attaching
first.

Fix by providing a driver which can attach directly to the NII
protocol, using the software UNDI interface to drive the network
device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 年前
父节点
当前提交
047baaba38

+ 1134
- 0
src/drivers/net/efi/nii.c
文件差异内容过多而无法显示
查看文件


+ 663
- 0
src/include/ipxe/efi/IndustryStandard/Acpi10.h 查看文件

@@ -0,0 +1,663 @@
1
+/** @file
2
+  ACPI 1.0b definitions from the ACPI Specification, revision 1.0b
3
+
4
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
5
+This program and the accompanying materials are licensed and made available under
6
+the terms and conditions of the BSD License that accompanies this distribution.
7
+The full text of the license may be found at
8
+http://opensource.org/licenses/bsd-license.php.
9
+
10
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
+**/
13
+
14
+#ifndef _ACPI_1_0_H_
15
+#define _ACPI_1_0_H_
16
+
17
+FILE_LICENCE ( BSD3 );
18
+
19
+#include <ipxe/efi/IndustryStandard/AcpiAml.h>
20
+
21
+///
22
+/// Common table header, this prefaces all ACPI tables, including FACS, but
23
+/// excluding the RSD PTR structure.
24
+///
25
+typedef struct {
26
+  UINT32  Signature;
27
+  UINT32  Length;
28
+} EFI_ACPI_COMMON_HEADER;
29
+
30
+#pragma pack(1)
31
+///
32
+/// The common ACPI description table header.  This structure prefaces most ACPI tables.
33
+///
34
+typedef struct {
35
+  UINT32  Signature;
36
+  UINT32  Length;
37
+  UINT8   Revision;
38
+  UINT8   Checksum;
39
+  UINT8   OemId[6];
40
+  UINT64  OemTableId;
41
+  UINT32  OemRevision;
42
+  UINT32  CreatorId;
43
+  UINT32  CreatorRevision;
44
+} EFI_ACPI_DESCRIPTION_HEADER;
45
+#pragma pack()
46
+
47
+//
48
+// Define for Desriptor
49
+//
50
+#define ACPI_SMALL_ITEM_FLAG                   0x00
51
+#define ACPI_LARGE_ITEM_FLAG                   0x01
52
+
53
+//
54
+// Small Item Descriptor Name
55
+//
56
+#define ACPI_SMALL_IRQ_DESCRIPTOR_NAME                       0x04
57
+#define ACPI_SMALL_DMA_DESCRIPTOR_NAME                       0x05
58
+#define ACPI_SMALL_START_DEPENDENT_DESCRIPTOR_NAME           0x06
59
+#define ACPI_SMALL_END_DEPENDENT_DESCRIPTOR_NAME             0x07
60
+#define ACPI_SMALL_IO_PORT_DESCRIPTOR_NAME                   0x08
61
+#define ACPI_SMALL_FIXED_IO_PORT_DESCRIPTOR_NAME             0x09
62
+#define ACPI_SMALL_VENDOR_DEFINED_DESCRIPTOR_NAME            0x0E
63
+#define ACPI_SMALL_END_TAG_DESCRIPTOR_NAME                   0x0F
64
+
65
+//
66
+// Large Item Descriptor Name
67
+//
68
+#define ACPI_LARGE_24_BIT_MEMORY_RANGE_DESCRIPTOR_NAME       0x01
69
+#define ACPI_LARGE_VENDOR_DEFINED_DESCRIPTOR_NAME            0x04
70
+#define ACPI_LARGE_32_BIT_MEMORY_RANGE_DESCRIPTOR_NAME       0x05
71
+#define ACPI_LARGE_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR_NAME 0x06
72
+#define ACPI_LARGE_DWORD_ADDRESS_SPACE_DESCRIPTOR_NAME       0x07
73
+#define ACPI_LARGE_WORD_ADDRESS_SPACE_DESCRIPTOR_NAME        0x08
74
+#define ACPI_LARGE_EXTENDED_IRQ_DESCRIPTOR_NAME              0x09
75
+#define ACPI_LARGE_QWORD_ADDRESS_SPACE_DESCRIPTOR_NAME       0x0A
76
+
77
+//
78
+// Small Item Descriptor Value
79
+//
80
+#define ACPI_IRQ_NOFLAG_DESCRIPTOR                0x22
81
+#define ACPI_IRQ_DESCRIPTOR                       0x23
82
+#define ACPI_DMA_DESCRIPTOR                       0x2A
83
+#define ACPI_START_DEPENDENT_DESCRIPTOR           0x30
84
+#define ACPI_START_DEPENDENT_EX_DESCRIPTOR        0x31
85
+#define ACPI_END_DEPENDENT_DESCRIPTOR             0x38
86
+#define ACPI_IO_PORT_DESCRIPTOR                   0x47
87
+#define ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR    0x4B
88
+#define ACPI_END_TAG_DESCRIPTOR                   0x79
89
+
90
+//
91
+// Large Item Descriptor Value
92
+//
93
+#define ACPI_24_BIT_MEMORY_RANGE_DESCRIPTOR       0x81
94
+#define ACPI_32_BIT_MEMORY_RANGE_DESCRIPTOR       0x85
95
+#define ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR 0x86
96
+#define ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR       0x87
97
+#define ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR        0x88
98
+#define ACPI_EXTENDED_INTERRUPT_DESCRIPTOR        0x89
99
+#define ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR       0x8A
100
+#define ACPI_ADDRESS_SPACE_DESCRIPTOR             0x8A
101
+
102
+//
103
+// Resource Type
104
+//
105
+#define ACPI_ADDRESS_SPACE_TYPE_MEM   0x00
106
+#define ACPI_ADDRESS_SPACE_TYPE_IO    0x01
107
+#define ACPI_ADDRESS_SPACE_TYPE_BUS   0x02
108
+
109
+///
110
+/// Power Management Timer frequency is fixed at 3.579545MHz.
111
+///
112
+#define ACPI_TIMER_FREQUENCY       3579545
113
+
114
+//
115
+// Ensure proper structure formats
116
+//
117
+#pragma pack(1)
118
+
119
+///
120
+/// The commond definition of QWORD, DWORD, and WORD
121
+/// Address Space Descriptors.
122
+///
123
+typedef PACKED struct {
124
+  UINT8   Desc;
125
+  UINT16  Len;
126
+  UINT8   ResType;
127
+  UINT8   GenFlag;
128
+  UINT8   SpecificFlag;
129
+  UINT64  AddrSpaceGranularity;
130
+  UINT64  AddrRangeMin;
131
+  UINT64  AddrRangeMax;
132
+  UINT64  AddrTranslationOffset;
133
+  UINT64  AddrLen;
134
+} EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR;
135
+
136
+typedef PACKED union {
137
+  UINT8     Byte;
138
+  PACKED struct {
139
+    UINT8 Length : 3;
140
+    UINT8 Name : 4;
141
+    UINT8 Type : 1;
142
+  } Bits;
143
+} ACPI_SMALL_RESOURCE_HEADER;
144
+
145
+typedef PACKED struct {
146
+  PACKED union {
147
+    UINT8 Byte;
148
+    PACKED struct {
149
+      UINT8 Name : 7;
150
+      UINT8 Type : 1;
151
+    }Bits;
152
+  } Header;
153
+  UINT16 Length;
154
+} ACPI_LARGE_RESOURCE_HEADER;
155
+
156
+///
157
+/// IRQ Descriptor.
158
+///
159
+typedef PACKED struct {
160
+  ACPI_SMALL_RESOURCE_HEADER   Header;
161
+  UINT16                       Mask;
162
+} EFI_ACPI_IRQ_NOFLAG_DESCRIPTOR;
163
+
164
+///
165
+/// IRQ Descriptor.
166
+///
167
+typedef PACKED struct {
168
+  ACPI_SMALL_RESOURCE_HEADER   Header;
169
+  UINT16                       Mask;
170
+  UINT8                        Information;
171
+} EFI_ACPI_IRQ_DESCRIPTOR;
172
+
173
+///
174
+/// DMA Descriptor.
175
+///
176
+typedef PACKED struct {
177
+  ACPI_SMALL_RESOURCE_HEADER   Header;
178
+  UINT8                        ChannelMask;
179
+  UINT8                        Information;
180
+} EFI_ACPI_DMA_DESCRIPTOR;
181
+
182
+///
183
+/// I/O Port Descriptor
184
+///
185
+typedef PACKED struct {
186
+  ACPI_SMALL_RESOURCE_HEADER   Header;
187
+  UINT8                        Information;
188
+  UINT16                       BaseAddressMin;
189
+  UINT16                       BaseAddressMax;
190
+  UINT8                        Alignment;
191
+  UINT8                        Length;
192
+} EFI_ACPI_IO_PORT_DESCRIPTOR;
193
+
194
+///
195
+/// Fixed Location I/O Port Descriptor.
196
+///
197
+typedef PACKED struct {
198
+  ACPI_SMALL_RESOURCE_HEADER   Header;
199
+  UINT16                       BaseAddress;
200
+  UINT8                        Length;
201
+} EFI_ACPI_FIXED_LOCATION_IO_PORT_DESCRIPTOR;
202
+
203
+///
204
+/// 24-Bit Memory Range Descriptor
205
+///
206
+typedef PACKED struct {
207
+  ACPI_LARGE_RESOURCE_HEADER    Header;
208
+  UINT8                         Information;
209
+  UINT16                        BaseAddressMin;
210
+  UINT16                        BaseAddressMax;
211
+  UINT16                        Alignment;
212
+  UINT16                        Length;
213
+} EFI_ACPI_24_BIT_MEMORY_RANGE_DESCRIPTOR;
214
+
215
+///
216
+/// 32-Bit Memory Range Descriptor
217
+///
218
+typedef PACKED struct {
219
+  ACPI_LARGE_RESOURCE_HEADER    Header;
220
+  UINT8                         Information;
221
+  UINT32                        BaseAddressMin;
222
+  UINT32                        BaseAddressMax;
223
+  UINT32                        Alignment;
224
+  UINT32                        Length;
225
+} EFI_ACPI_32_BIT_MEMORY_RANGE_DESCRIPTOR;
226
+
227
+///
228
+/// Fixed 32-Bit Fixed Memory Range Descriptor
229
+///
230
+typedef PACKED struct {
231
+  ACPI_LARGE_RESOURCE_HEADER    Header;
232
+  UINT8                         Information;
233
+  UINT32                        BaseAddress;
234
+  UINT32                        Length;
235
+} EFI_ACPI_32_BIT_FIXED_MEMORY_RANGE_DESCRIPTOR;
236
+
237
+///
238
+/// QWORD Address Space Descriptor
239
+///
240
+typedef PACKED struct {
241
+  ACPI_LARGE_RESOURCE_HEADER    Header;
242
+  UINT8                         ResType;
243
+  UINT8                         GenFlag;
244
+  UINT8                         SpecificFlag;
245
+  UINT64                        AddrSpaceGranularity;
246
+  UINT64                        AddrRangeMin;
247
+  UINT64                        AddrRangeMax;
248
+  UINT64                        AddrTranslationOffset;
249
+  UINT64                        AddrLen;
250
+} EFI_ACPI_QWORD_ADDRESS_SPACE_DESCRIPTOR;
251
+
252
+///
253
+/// DWORD Address Space Descriptor
254
+///
255
+typedef PACKED struct {
256
+  ACPI_LARGE_RESOURCE_HEADER    Header;
257
+  UINT8                         ResType;
258
+  UINT8                         GenFlag;
259
+  UINT8                         SpecificFlag;
260
+  UINT32                        AddrSpaceGranularity;
261
+  UINT32                        AddrRangeMin;
262
+  UINT32                        AddrRangeMax;
263
+  UINT32                        AddrTranslationOffset;
264
+  UINT32                        AddrLen;
265
+} EFI_ACPI_DWORD_ADDRESS_SPACE_DESCRIPTOR;
266
+
267
+///
268
+/// WORD Address Space Descriptor
269
+///
270
+typedef PACKED struct {
271
+  ACPI_LARGE_RESOURCE_HEADER    Header;
272
+  UINT8                         ResType;
273
+  UINT8                         GenFlag;
274
+  UINT8                         SpecificFlag;
275
+  UINT16                        AddrSpaceGranularity;
276
+  UINT16                        AddrRangeMin;
277
+  UINT16                        AddrRangeMax;
278
+  UINT16                        AddrTranslationOffset;
279
+  UINT16                        AddrLen;
280
+} EFI_ACPI_WORD_ADDRESS_SPACE_DESCRIPTOR;
281
+
282
+///
283
+/// Extended Interrupt Descriptor
284
+///
285
+typedef PACKED struct {
286
+  ACPI_LARGE_RESOURCE_HEADER    Header;
287
+  UINT8                         InterruptVectorFlags;
288
+  UINT8                         InterruptTableLength;
289
+  UINT32                        InterruptNumber[1];
290
+} EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR;
291
+
292
+#pragma pack()
293
+
294
+///
295
+/// The End tag identifies an end of resource data.
296
+///
297
+typedef struct {
298
+  UINT8 Desc;
299
+  UINT8 Checksum;
300
+} EFI_ACPI_END_TAG_DESCRIPTOR;
301
+
302
+//
303
+// General use definitions
304
+//
305
+#define EFI_ACPI_RESERVED_BYTE  0x00
306
+#define EFI_ACPI_RESERVED_WORD  0x0000
307
+#define EFI_ACPI_RESERVED_DWORD 0x00000000
308
+#define EFI_ACPI_RESERVED_QWORD 0x0000000000000000
309
+
310
+//
311
+// Resource Type Specific Flags
312
+// Ref ACPI specification 6.4.3.5.5
313
+//
314
+// Bit [0]    : Write Status, _RW
315
+//
316
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_WRITE                (1 << 0)
317
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_READ_ONLY                 (0 << 0)
318
+//
319
+// Bit [2:1]  : Memory Attributes, _MEM
320
+//
321
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_NON_CACHEABLE             (0 << 1)
322
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE                 (1 << 1)
323
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_WRITE_COMBINING (2 << 1)
324
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_CACHEABLE_PREFETCHABLE    (3 << 1)
325
+//
326
+// Bit [4:3]  : Memory Attributes, _MTP
327
+//
328
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_MEMORY      (0 << 3)
329
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_RESERVED    (1 << 3)
330
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_ACPI        (2 << 3)
331
+#define EFI_APCI_MEMORY_RESOURCE_SPECIFIC_FLAG_ADDRESS_RANGE_NVS         (3 << 3)
332
+//
333
+// Bit [5]    : Memory to I/O Translation, _TTP
334
+//
335
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_TRANSLATION          (1 << 5)
336
+#define EFI_ACPI_MEMORY_RESOURCE_SPECIFIC_FLAG_TYPE_STATIC               (0 << 5)
337
+
338
+//
339
+// IRQ Information
340
+// Ref ACPI specification 6.4.2.1
341
+//
342
+#define EFI_ACPI_IRQ_SHARABLE_MASK                      0x10
343
+#define   EFI_ACPI_IRQ_SHARABLE                         0x10
344
+
345
+#define EFI_ACPI_IRQ_POLARITY_MASK                      0x08
346
+#define   EFI_ACPI_IRQ_HIGH_TRUE                        0x00
347
+#define   EFI_ACPI_IRQ_LOW_FALSE                        0x08
348
+
349
+#define EFI_ACPI_IRQ_MODE                               0x01
350
+#define   EFI_ACPI_IRQ_LEVEL_TRIGGERED                  0x00
351
+#define   EFI_ACPI_IRQ_EDGE_TRIGGERED                   0x01
352
+
353
+//
354
+// DMA Information
355
+// Ref ACPI specification 6.4.2.2
356
+//
357
+#define EFI_ACPI_DMA_SPEED_TYPE_MASK                    0x60
358
+#define   EFI_ACPI_DMA_SPEED_TYPE_COMPATIBILITY         0x00
359
+#define   EFI_ACPI_DMA_SPEED_TYPE_A                     0x20
360
+#define   EFI_ACPI_DMA_SPEED_TYPE_B                     0x40
361
+#define   EFI_ACPI_DMA_SPEED_TYPE_F                     0x60
362
+
363
+#define EFI_ACPI_DMA_BUS_MASTER_MASK                    0x04
364
+#define   EFI_ACPI_DMA_BUS_MASTER                       0x04
365
+
366
+#define EFI_ACPI_DMA_TRANSFER_TYPE_MASK                 0x03
367
+#define   EFI_ACPI_DMA_TRANSFER_TYPE_8_BIT              0x00
368
+#define   EFI_ACPI_DMA_TRANSFER_TYPE_8_BIT_AND_16_BIT   0x01
369
+#define   EFI_ACPI_DMA_TRANSFER_TYPE_16_BIT             0x10
370
+
371
+//
372
+// IO Information
373
+// Ref ACPI specification 6.4.2.5
374
+//
375
+#define EFI_ACPI_IO_DECODE_MASK                         0x01
376
+#define   EFI_ACPI_IO_DECODE_16_BIT                     0x01
377
+#define   EFI_ACPI_IO_DECODE_10_BIT                     0x00
378
+
379
+//
380
+// Memory Information
381
+// Ref ACPI specification 6.4.3.4
382
+//
383
+#define EFI_ACPI_MEMORY_WRITE_STATUS_MASK               0x01
384
+#define   EFI_ACPI_MEMORY_WRITABLE                      0x01
385
+#define   EFI_ACPI_MEMORY_NON_WRITABLE                  0x00
386
+
387
+//
388
+// Ensure proper structure formats
389
+//
390
+#pragma pack(1)
391
+//
392
+// ACPI 1.0b table structures
393
+//
394
+
395
+///
396
+/// Root System Description Pointer Structure.
397
+///
398
+typedef struct {
399
+  UINT64  Signature;
400
+  UINT8   Checksum;
401
+  UINT8   OemId[6];
402
+  UINT8   Reserved;
403
+  UINT32  RsdtAddress;
404
+} EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER;
405
+
406
+//
407
+// Root System Description Table
408
+// No definition needed as it is a common description table header, the same with
409
+// EFI_ACPI_DESCRIPTION_HEADER, followed by a variable number of UINT32 table pointers.
410
+//
411
+
412
+///
413
+/// RSDT Revision (as defined in ACPI 1.0b specification).
414
+///
415
+#define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_REVISION 0x01
416
+
417
+///
418
+/// Fixed ACPI Description Table Structure (FADT).
419
+///
420
+typedef struct {
421
+  EFI_ACPI_DESCRIPTION_HEADER Header;
422
+  UINT32                      FirmwareCtrl;
423
+  UINT32                      Dsdt;
424
+  UINT8                       IntModel;
425
+  UINT8                       Reserved1;
426
+  UINT16                      SciInt;
427
+  UINT32                      SmiCmd;
428
+  UINT8                       AcpiEnable;
429
+  UINT8                       AcpiDisable;
430
+  UINT8                       S4BiosReq;
431
+  UINT8                       Reserved2;
432
+  UINT32                      Pm1aEvtBlk;
433
+  UINT32                      Pm1bEvtBlk;
434
+  UINT32                      Pm1aCntBlk;
435
+  UINT32                      Pm1bCntBlk;
436
+  UINT32                      Pm2CntBlk;
437
+  UINT32                      PmTmrBlk;
438
+  UINT32                      Gpe0Blk;
439
+  UINT32                      Gpe1Blk;
440
+  UINT8                       Pm1EvtLen;
441
+  UINT8                       Pm1CntLen;
442
+  UINT8                       Pm2CntLen;
443
+  UINT8                       PmTmLen;
444
+  UINT8                       Gpe0BlkLen;
445
+  UINT8                       Gpe1BlkLen;
446
+  UINT8                       Gpe1Base;
447
+  UINT8                       Reserved3;
448
+  UINT16                      PLvl2Lat;
449
+  UINT16                      PLvl3Lat;
450
+  UINT16                      FlushSize;
451
+  UINT16                      FlushStride;
452
+  UINT8                       DutyOffset;
453
+  UINT8                       DutyWidth;
454
+  UINT8                       DayAlrm;
455
+  UINT8                       MonAlrm;
456
+  UINT8                       Century;
457
+  UINT8                       Reserved4;
458
+  UINT8                       Reserved5;
459
+  UINT8                       Reserved6;
460
+  UINT32                      Flags;
461
+} EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE;
462
+
463
+///
464
+/// FADT Version (as defined in ACPI 1.0b specification).
465
+///
466
+#define EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION  0x01
467
+
468
+#define EFI_ACPI_1_0_INT_MODE_DUAL_PIC         0
469
+#define EFI_ACPI_1_0_INT_MODE_MULTIPLE_APIC    1
470
+
471
+//
472
+// Fixed ACPI Description Table Fixed Feature Flags
473
+// All other bits are reserved and must be set to 0.
474
+//
475
+#define EFI_ACPI_1_0_WBINVD               BIT0
476
+#define EFI_ACPI_1_0_WBINVD_FLUSH         BIT1
477
+#define EFI_ACPI_1_0_PROC_C1              BIT2
478
+#define EFI_ACPI_1_0_P_LVL2_UP            BIT3
479
+#define EFI_ACPI_1_0_PWR_BUTTON           BIT4
480
+#define EFI_ACPI_1_0_SLP_BUTTON           BIT5
481
+#define EFI_ACPI_1_0_FIX_RTC              BIT6
482
+#define EFI_ACPI_1_0_RTC_S4               BIT7
483
+#define EFI_ACPI_1_0_TMR_VAL_EXT          BIT8
484
+#define EFI_ACPI_1_0_DCK_CAP              BIT9
485
+
486
+///
487
+/// Firmware ACPI Control Structure.
488
+///
489
+typedef struct {
490
+  UINT32  Signature;
491
+  UINT32  Length;
492
+  UINT32  HardwareSignature;
493
+  UINT32  FirmwareWakingVector;
494
+  UINT32  GlobalLock;
495
+  UINT32  Flags;
496
+  UINT8   Reserved[40];
497
+} EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE;
498
+
499
+///
500
+/// Firmware Control Structure Feature Flags.
501
+/// All other bits are reserved and must be set to 0.
502
+///
503
+#define EFI_ACPI_1_0_S4BIOS_F             BIT0
504
+
505
+///
506
+/// Multiple APIC Description Table header definition.  The rest of the table
507
+/// must be defined in a platform-specific manner.
508
+///
509
+typedef struct {
510
+  EFI_ACPI_DESCRIPTION_HEADER Header;
511
+  UINT32                      LocalApicAddress;
512
+  UINT32                      Flags;
513
+} EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER;
514
+
515
+///
516
+/// MADT Revision (as defined in ACPI 1.0b specification).
517
+///
518
+#define EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION 0x01
519
+
520
+///
521
+/// Multiple APIC Flags
522
+/// All other bits are reserved and must be set to 0.
523
+///
524
+#define EFI_ACPI_1_0_PCAT_COMPAT           BIT0
525
+
526
+//
527
+// Multiple APIC Description Table APIC structure types
528
+// All other values between 0x05 an 0xFF are reserved and
529
+// will be ignored by OSPM.
530
+//
531
+#define EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC           0x00
532
+#define EFI_ACPI_1_0_IO_APIC                        0x01
533
+#define EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE      0x02
534
+#define EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE  0x03
535
+#define EFI_ACPI_1_0_LOCAL_APIC_NMI                 0x04
536
+
537
+//
538
+// APIC Structure Definitions
539
+//
540
+
541
+///
542
+/// Processor Local APIC Structure Definition.
543
+///
544
+typedef struct {
545
+  UINT8   Type;
546
+  UINT8   Length;
547
+  UINT8   AcpiProcessorId;
548
+  UINT8   ApicId;
549
+  UINT32  Flags;
550
+} EFI_ACPI_1_0_PROCESSOR_LOCAL_APIC_STRUCTURE;
551
+
552
+///
553
+/// Local APIC Flags.  All other bits are reserved and must be 0.
554
+///
555
+#define EFI_ACPI_1_0_LOCAL_APIC_ENABLED      BIT0
556
+
557
+///
558
+/// IO APIC Structure.
559
+///
560
+typedef struct {
561
+  UINT8   Type;
562
+  UINT8   Length;
563
+  UINT8   IoApicId;
564
+  UINT8   Reserved;
565
+  UINT32  IoApicAddress;
566
+  UINT32  SystemVectorBase;
567
+} EFI_ACPI_1_0_IO_APIC_STRUCTURE;
568
+
569
+///
570
+/// Interrupt Source Override Structure.
571
+///
572
+typedef struct {
573
+  UINT8   Type;
574
+  UINT8   Length;
575
+  UINT8   Bus;
576
+  UINT8   Source;
577
+  UINT32  GlobalSystemInterruptVector;
578
+  UINT16  Flags;
579
+} EFI_ACPI_1_0_INTERRUPT_SOURCE_OVERRIDE_STRUCTURE;
580
+
581
+///
582
+/// Non-Maskable Interrupt Source Structure.
583
+///
584
+typedef struct {
585
+  UINT8   Type;
586
+  UINT8   Length;
587
+  UINT16  Flags;
588
+  UINT32  GlobalSystemInterruptVector;
589
+} EFI_ACPI_1_0_NON_MASKABLE_INTERRUPT_SOURCE_STRUCTURE;
590
+
591
+///
592
+/// Local APIC NMI Structure.
593
+///
594
+typedef struct {
595
+  UINT8   Type;
596
+  UINT8   Length;
597
+  UINT8   AcpiProcessorId;
598
+  UINT16  Flags;
599
+  UINT8   LocalApicInti;
600
+} EFI_ACPI_1_0_LOCAL_APIC_NMI_STRUCTURE;
601
+
602
+///
603
+/// Smart Battery Description Table (SBST)
604
+///
605
+typedef struct {
606
+  EFI_ACPI_DESCRIPTION_HEADER Header;
607
+  UINT32                      WarningEnergyLevel;
608
+  UINT32                      LowEnergyLevel;
609
+  UINT32                      CriticalEnergyLevel;
610
+} EFI_ACPI_1_0_SMART_BATTERY_DESCRIPTION_TABLE;
611
+
612
+//
613
+// Known table signatures
614
+//
615
+
616
+///
617
+/// "RSD PTR " Root System Description Pointer.
618
+///
619
+#define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER_SIGNATURE  SIGNATURE_64('R', 'S', 'D', ' ', 'P', 'T', 'R', ' ')
620
+
621
+///
622
+/// "APIC" Multiple APIC Description Table.
623
+///
624
+#define EFI_ACPI_1_0_APIC_SIGNATURE  SIGNATURE_32('A', 'P', 'I', 'C')
625
+
626
+///
627
+/// "DSDT" Differentiated System Description Table.
628
+///
629
+#define EFI_ACPI_1_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('D', 'S', 'D', 'T')
630
+
631
+///
632
+/// "FACS" Firmware ACPI Control Structure.
633
+///
634
+#define EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE  SIGNATURE_32('F', 'A', 'C', 'S')
635
+
636
+///
637
+/// "FACP" Fixed ACPI Description Table.
638
+///
639
+#define EFI_ACPI_1_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('F', 'A', 'C', 'P')
640
+
641
+///
642
+/// "PSDT" Persistent System Description Table.
643
+///
644
+#define EFI_ACPI_1_0_PERSISTENT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('P', 'S', 'D', 'T')
645
+
646
+///
647
+/// "RSDT" Root System Description Table.
648
+///
649
+#define EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('R', 'S', 'D', 'T')
650
+
651
+///
652
+/// "SBST" Smart Battery Specification Table.
653
+///
654
+#define EFI_ACPI_1_0_SMART_BATTERY_SPECIFICATION_TABLE_SIGNATURE  SIGNATURE_32('S', 'B', 'S', 'T')
655
+
656
+///
657
+/// "SSDT" Secondary System Description Table.
658
+///
659
+#define EFI_ACPI_1_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE  SIGNATURE_32('S', 'S', 'D', 'T')
660
+
661
+#pragma pack()
662
+
663
+#endif

+ 177
- 0
src/include/ipxe/efi/IndustryStandard/AcpiAml.h 查看文件

@@ -0,0 +1,177 @@
1
+/** @file
2
+  This file contains AML code definition in the latest ACPI spec.
3
+
4
+  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
5
+  This program and the accompanying materials
6
+  are licensed and made available under the terms and conditions of the BSD License
7
+  which accompanies this distribution.  The full text of the license may be found at
8
+  http://opensource.org/licenses/bsd-license.php
9
+
10
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
+
13
+**/
14
+
15
+#ifndef _ACPI_AML_H_
16
+#define _ACPI_AML_H_
17
+
18
+FILE_LICENCE ( BSD3 );
19
+
20
+//
21
+// ACPI AML definition
22
+//
23
+
24
+//
25
+// Primary OpCode
26
+//
27
+#define AML_ZERO_OP                  0x00
28
+#define AML_ONE_OP                   0x01
29
+#define AML_ALIAS_OP                 0x06
30
+#define AML_NAME_OP                  0x08
31
+#define AML_BYTE_PREFIX              0x0a
32
+#define AML_WORD_PREFIX              0x0b
33
+#define AML_DWORD_PREFIX             0x0c
34
+#define AML_STRING_PREFIX            0x0d
35
+#define AML_QWORD_PREFIX             0x0e
36
+#define AML_SCOPE_OP                 0x10
37
+#define AML_BUFFER_OP                0x11
38
+#define AML_PACKAGE_OP               0x12
39
+#define AML_VAR_PACKAGE_OP           0x13
40
+#define AML_METHOD_OP                0x14
41
+#define AML_DUAL_NAME_PREFIX         0x2e
42
+#define AML_MULTI_NAME_PREFIX        0x2f
43
+#define AML_NAME_CHAR_A              0x41
44
+#define AML_NAME_CHAR_B              0x42
45
+#define AML_NAME_CHAR_C              0x43
46
+#define AML_NAME_CHAR_D              0x44
47
+#define AML_NAME_CHAR_E              0x45
48
+#define AML_NAME_CHAR_F              0x46
49
+#define AML_NAME_CHAR_G              0x47
50
+#define AML_NAME_CHAR_H              0x48
51
+#define AML_NAME_CHAR_I              0x49
52
+#define AML_NAME_CHAR_J              0x4a
53
+#define AML_NAME_CHAR_K              0x4b
54
+#define AML_NAME_CHAR_L              0x4c
55
+#define AML_NAME_CHAR_M              0x4d
56
+#define AML_NAME_CHAR_N              0x4e
57
+#define AML_NAME_CHAR_O              0x4f
58
+#define AML_NAME_CHAR_P              0x50
59
+#define AML_NAME_CHAR_Q              0x51
60
+#define AML_NAME_CHAR_R              0x52
61
+#define AML_NAME_CHAR_S              0x53
62
+#define AML_NAME_CHAR_T              0x54
63
+#define AML_NAME_CHAR_U              0x55
64
+#define AML_NAME_CHAR_V              0x56
65
+#define AML_NAME_CHAR_W              0x57
66
+#define AML_NAME_CHAR_X              0x58
67
+#define AML_NAME_CHAR_Y              0x59
68
+#define AML_NAME_CHAR_Z              0x5a
69
+#define AML_ROOT_CHAR                0x5c
70
+#define AML_PARENT_PREFIX_CHAR       0x5e
71
+#define AML_NAME_CHAR__              0x5f
72
+#define AML_LOCAL0                   0x60
73
+#define AML_LOCAL1                   0x61
74
+#define AML_LOCAL2                   0x62
75
+#define AML_LOCAL3                   0x63
76
+#define AML_LOCAL4                   0x64
77
+#define AML_LOCAL5                   0x65
78
+#define AML_LOCAL6                   0x66
79
+#define AML_LOCAL7                   0x67
80
+#define AML_ARG0                     0x68
81
+#define AML_ARG1                     0x69
82
+#define AML_ARG2                     0x6a
83
+#define AML_ARG3                     0x6b
84
+#define AML_ARG4                     0x6c
85
+#define AML_ARG5                     0x6d
86
+#define AML_ARG6                     0x6e
87
+#define AML_STORE_OP                 0x70
88
+#define AML_REF_OF_OP                0x71
89
+#define AML_ADD_OP                   0x72
90
+#define AML_CONCAT_OP                0x73
91
+#define AML_SUBTRACT_OP              0x74
92
+#define AML_INCREMENT_OP             0x75
93
+#define AML_DECREMENT_OP             0x76
94
+#define AML_MULTIPLY_OP              0x77
95
+#define AML_DIVIDE_OP                0x78
96
+#define AML_SHIFT_LEFT_OP            0x79
97
+#define AML_SHIFT_RIGHT_OP           0x7a
98
+#define AML_AND_OP                   0x7b
99
+#define AML_NAND_OP                  0x7c
100
+#define AML_OR_OP                    0x7d
101
+#define AML_NOR_OP                   0x7e
102
+#define AML_XOR_OP                   0x7f
103
+#define AML_NOT_OP                   0x80
104
+#define AML_FIND_SET_LEFT_BIT_OP     0x81
105
+#define AML_FIND_SET_RIGHT_BIT_OP    0x82
106
+#define AML_DEREF_OF_OP              0x83
107
+#define AML_CONCAT_RES_OP            0x84
108
+#define AML_MOD_OP                   0x85
109
+#define AML_NOTIFY_OP                0x86
110
+#define AML_SIZE_OF_OP               0x87
111
+#define AML_INDEX_OP                 0x88
112
+#define AML_MATCH_OP                 0x89
113
+#define AML_CREATE_DWORD_FIELD_OP    0x8a
114
+#define AML_CREATE_WORD_FIELD_OP     0x8b
115
+#define AML_CREATE_BYTE_FIELD_OP     0x8c
116
+#define AML_CREATE_BIT_FIELD_OP      0x8d
117
+#define AML_OBJECT_TYPE_OP           0x8e
118
+#define AML_CREATE_QWORD_FIELD_OP    0x8f
119
+#define AML_LAND_OP                  0x90
120
+#define AML_LOR_OP                   0x91
121
+#define AML_LNOT_OP                  0x92
122
+#define AML_LEQUAL_OP                0x93
123
+#define AML_LGREATER_OP              0x94
124
+#define AML_LLESS_OP                 0x95
125
+#define AML_TO_BUFFER_OP             0x96
126
+#define AML_TO_DEC_STRING_OP         0x97
127
+#define AML_TO_HEX_STRING_OP         0x98
128
+#define AML_TO_INTEGER_OP            0x99
129
+#define AML_TO_STRING_OP             0x9c
130
+#define AML_COPY_OBJECT_OP           0x9d
131
+#define AML_MID_OP                   0x9e
132
+#define AML_CONTINUE_OP              0x9f
133
+#define AML_IF_OP                    0xa0
134
+#define AML_ELSE_OP                  0xa1
135
+#define AML_WHILE_OP                 0xa2
136
+#define AML_NOOP_OP                  0xa3
137
+#define AML_RETURN_OP                0xa4
138
+#define AML_BREAK_OP                 0xa5
139
+#define AML_BREAK_POINT_OP           0xcc
140
+#define AML_ONES_OP                  0xff
141
+
142
+//
143
+// Extended OpCode
144
+//
145
+#define AML_EXT_OP                   0x5b
146
+
147
+#define AML_EXT_MUTEX_OP             0x01
148
+#define AML_EXT_EVENT_OP             0x02
149
+#define AML_EXT_COND_REF_OF_OP       0x12
150
+#define AML_EXT_CREATE_FIELD_OP      0x13
151
+#define AML_EXT_LOAD_TABLE_OP        0x1f
152
+#define AML_EXT_LOAD_OP              0x20
153
+#define AML_EXT_STALL_OP             0x21
154
+#define AML_EXT_SLEEP_OP             0x22
155
+#define AML_EXT_ACQUIRE_OP           0x23
156
+#define AML_EXT_SIGNAL_OP            0x24
157
+#define AML_EXT_WAIT_OP              0x25
158
+#define AML_EXT_RESET_OP             0x26
159
+#define AML_EXT_RELEASE_OP           0x27
160
+#define AML_EXT_FROM_BCD_OP          0x28
161
+#define AML_EXT_TO_BCD_OP            0x29
162
+#define AML_EXT_UNLOAD_OP            0x2a
163
+#define AML_EXT_REVISION_OP          0x30
164
+#define AML_EXT_DEBUG_OP             0x31
165
+#define AML_EXT_FATAL_OP             0x32
166
+#define AML_EXT_TIMER_OP             0x33
167
+#define AML_EXT_REGION_OP            0x80
168
+#define AML_EXT_FIELD_OP             0x81
169
+#define AML_EXT_DEVICE_OP            0x82
170
+#define AML_EXT_PROCESSOR_OP         0x83
171
+#define AML_EXT_POWER_RES_OP         0x84
172
+#define AML_EXT_THERMAL_ZONE_OP      0x85
173
+#define AML_EXT_INDEX_FIELD_OP       0x86
174
+#define AML_EXT_BANK_FIELD_OP        0x87
175
+#define AML_EXT_DATA_REGION_OP       0x88
176
+
177
+#endif

+ 1
- 0
src/include/ipxe/errfile.h 查看文件

@@ -156,6 +156,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
156 156
 #define ERRFILE_intelx		     ( ERRFILE_DRIVER | 0x00670000 )
157 157
 #define ERRFILE_snp		     ( ERRFILE_DRIVER | 0x00680000 )
158 158
 #define ERRFILE_netfront	     ( ERRFILE_DRIVER | 0x00690000 )
159
+#define ERRFILE_nii		     ( ERRFILE_DRIVER | 0x006a0000 )
159 160
 
160 161
 #define ERRFILE_scsi		     ( ERRFILE_DRIVER | 0x00700000 )
161 162
 #define ERRFILE_arbel		     ( ERRFILE_DRIVER | 0x00710000 )

+ 2
- 0
src/include/ipxe/ethernet.h 查看文件

@@ -80,6 +80,8 @@ static inline int is_valid_ether_addr ( const void *addr ) {
80 80
 }
81 81
 
82 82
 extern uint8_t eth_broadcast[];
83
+extern struct ll_protocol ethernet_protocol __ll_protocol;
84
+
83 85
 extern int eth_push ( struct net_device *netdev, struct io_buffer *iobuf,
84 86
 		      const void *ll_dest, const void *ll_source,
85 87
 		      uint16_t net_proto );

正在加载...
取消
保存