|
@@ -1,178 +0,0 @@
|
1
|
|
-/**************************************************************************
|
2
|
|
-Etherboot - BOOTP/TFTP Bootstrap Program
|
3
|
|
-UNDI NIC driver for Etherboot - header file
|
4
|
|
-
|
5
|
|
-This file Copyright (C) 2003 Michael Brown <mbrown@fensystems.co.uk>
|
6
|
|
-of Fen Systems Ltd. (http://www.fensystems.co.uk/). All rights
|
7
|
|
-reserved.
|
8
|
|
-
|
9
|
|
-$Id$
|
10
|
|
-***************************************************************************/
|
11
|
|
-
|
12
|
|
-/*
|
13
|
|
- * This program is free software; you can redistribute it and/or
|
14
|
|
- * modify it under the terms of the GNU General Public License as
|
15
|
|
- * published by the Free Software Foundation; either version 2, or (at
|
16
|
|
- * your option) any later version.
|
17
|
|
- */
|
18
|
|
-
|
19
|
|
-#include "pxe.h"
|
20
|
|
-#include "pic8259.h"
|
21
|
|
-
|
22
|
|
-/* A union that can function as the parameter block for any UNDI API call.
|
23
|
|
- */
|
24
|
|
-typedef t_PXENV_ANY pxenv_structure_t;
|
25
|
|
-
|
26
|
|
-/* BIOS PnP parameter block. We scan for this so that we can pass it
|
27
|
|
- * to the UNDI driver.
|
28
|
|
- */
|
29
|
|
-
|
30
|
|
-#define PNP_BIOS_SIGNATURE ( ('$'<<0) + ('P'<<8) + ('n'<<16) + ('P'<<24) )
|
31
|
|
-typedef struct pnp_bios {
|
32
|
|
- uint32_t signature;
|
33
|
|
- uint8_t version;
|
34
|
|
- uint8_t length;
|
35
|
|
- uint16_t control;
|
36
|
|
- uint8_t checksum;
|
37
|
|
- uint8_t dontcare[24];
|
38
|
|
-} PACKED pnp_bios_t;
|
39
|
|
-
|
40
|
|
-/* Structures within the PXE ROM.
|
41
|
|
- */
|
42
|
|
-
|
43
|
|
-#define ROM_SIGNATURE 0xaa55
|
44
|
|
-typedef struct rom {
|
45
|
|
- uint16_t signature;
|
46
|
|
- uint8_t unused[0x14];
|
47
|
|
- uint16_t undi_rom_id_off;
|
48
|
|
- uint16_t pcir_off;
|
49
|
|
- uint16_t pnp_off;
|
50
|
|
-} PACKED rom_t;
|
51
|
|
-
|
52
|
|
-#define PCIR_SIGNATURE ( ('P'<<0) + ('C'<<8) + ('I'<<16) + ('R'<<24) )
|
53
|
|
-typedef struct pcir_header {
|
54
|
|
- uint32_t signature;
|
55
|
|
- uint16_t vendor_id;
|
56
|
|
- uint16_t device_id;
|
57
|
|
-} PACKED pcir_header_t;
|
58
|
|
-
|
59
|
|
-#define PNP_SIGNATURE ( ('$'<<0) + ('P'<<8) + ('n'<<16) + ('P'<<24) )
|
60
|
|
-typedef struct pnp_header {
|
61
|
|
- uint32_t signature;
|
62
|
|
- uint8_t struct_revision;
|
63
|
|
- uint8_t length;
|
64
|
|
- uint16_t next;
|
65
|
|
- uint8_t reserved;
|
66
|
|
- uint8_t checksum;
|
67
|
|
- uint16_t id[2];
|
68
|
|
- uint16_t manuf_str_off;
|
69
|
|
- uint16_t product_str_off;
|
70
|
|
- uint8_t base_type;
|
71
|
|
- uint8_t sub_type;
|
72
|
|
- uint8_t interface_type;
|
73
|
|
- uint8_t indicator;
|
74
|
|
- uint16_t boot_connect_off;
|
75
|
|
- uint16_t disconnect_off;
|
76
|
|
- uint16_t initialise_off;
|
77
|
|
- uint16_t reserved2;
|
78
|
|
- uint16_t info;
|
79
|
|
-} PACKED pnp_header_t;
|
80
|
|
-
|
81
|
|
-#define UNDI_SIGNATURE ( ('U'<<0) + ('N'<<8) + ('D'<<16) + ('I'<<24) )
|
82
|
|
-typedef struct undi_rom_id {
|
83
|
|
- uint32_t signature;
|
84
|
|
- uint8_t struct_length;
|
85
|
|
- uint8_t struct_cksum;
|
86
|
|
- uint8_t struct_rev;
|
87
|
|
- uint8_t undi_rev[3];
|
88
|
|
- uint16_t undi_loader_off;
|
89
|
|
- uint16_t stack_size;
|
90
|
|
- uint16_t data_size;
|
91
|
|
- uint16_t code_size;
|
92
|
|
-} PACKED undi_rom_id_t;
|
93
|
|
-
|
94
|
|
-/* Nontrivial IRQ handler structure */
|
95
|
|
-typedef struct {
|
96
|
|
- segoff_t chain_to;
|
97
|
|
- uint8_t irq_chain, pad1, pad2, pad3;
|
98
|
|
- segoff_t entry;
|
99
|
|
- uint16_t count_all;
|
100
|
|
- uint16_t count_ours;
|
101
|
|
- t_PXENV_UNDI_ISR undi_isr;
|
102
|
|
- char code[0];
|
103
|
|
-} PACKED undi_irq_handler_t ;
|
104
|
|
-
|
105
|
|
-/* Storage buffers that we need in base memory. We collect these into
|
106
|
|
- * a single structure to make allocation simpler.
|
107
|
|
- */
|
108
|
|
-
|
109
|
|
-typedef struct undi_base_mem_xmit_data {
|
110
|
|
- MAC_ADDR destaddr;
|
111
|
|
- t_PXENV_UNDI_TBD tbd;
|
112
|
|
-} undi_base_mem_xmit_data_t;
|
113
|
|
-
|
114
|
|
-typedef struct undi_base_mem_data {
|
115
|
|
- pxenv_structure_t pxs;
|
116
|
|
- undi_base_mem_xmit_data_t xmit_data;
|
117
|
|
- char xmit_buffer[ETH_FRAME_LEN];
|
118
|
|
- /* Must be last in structure and paragraph-aligned */
|
119
|
|
- union {
|
120
|
|
- char e820mangler[0];
|
121
|
|
- char irq_handler[0];
|
122
|
|
- undi_irq_handler_t nontrivial_irq_handler;
|
123
|
|
- } __attribute__ ((aligned(16)));
|
124
|
|
-} undi_base_mem_data_t;
|
125
|
|
-
|
126
|
|
-/* Macros and data structures used when freeing bits of base memory
|
127
|
|
- * used by the UNDI driver.
|
128
|
|
- */
|
129
|
|
-
|
130
|
|
-#define FIRING_SQUAD_TARGET_SIZE 8
|
131
|
|
-#define FIRING_SQUAD_TARGET_INDEX(x) ( (x) / FIRING_SQUAD_TARGET_SIZE )
|
132
|
|
-#define FIRING_SQUAD_TARGET_BIT(x) ( (x) % FIRING_SQUAD_TARGET_SIZE )
|
133
|
|
-typedef struct firing_squad_lineup {
|
134
|
|
- uint8_t targets[ 640 / FIRING_SQUAD_TARGET_SIZE ];
|
135
|
|
-} firing_squad_lineup_t;
|
136
|
|
-typedef enum firing_squad_shoot {
|
137
|
|
- DONTSHOOT = 0,
|
138
|
|
- SHOOT = 1
|
139
|
|
-} firing_squad_shoot_t;
|
140
|
|
-
|
141
|
|
-/* Driver private data structure.
|
142
|
|
- */
|
143
|
|
-
|
144
|
|
-typedef struct undi {
|
145
|
|
- /* Pointers to various data structures */
|
146
|
|
- pnp_bios_t *pnp_bios;
|
147
|
|
- rom_t *rom;
|
148
|
|
- undi_rom_id_t *undi_rom_id;
|
149
|
|
- pxe_t *pxe;
|
150
|
|
- pxenv_structure_t *pxs;
|
151
|
|
- undi_base_mem_xmit_data_t *xmit_data;
|
152
|
|
- /* Pointers and sizes to keep track of allocated base memory */
|
153
|
|
- undi_base_mem_data_t *base_mem_data;
|
154
|
|
- void *driver_code;
|
155
|
|
- size_t driver_code_size;
|
156
|
|
- void *driver_data;
|
157
|
|
- size_t driver_data_size;
|
158
|
|
- char *xmit_buffer;
|
159
|
|
- /* Flags. We keep our own instead of trusting the UNDI driver
|
160
|
|
- * to have implemented PXENV_UNDI_GET_STATE correctly. Plus
|
161
|
|
- * there's the small issue of PXENV_UNDI_GET_STATE being the
|
162
|
|
- * same API call as PXENV_STOP_UNDI...
|
163
|
|
- */
|
164
|
|
- uint8_t prestarted; /* pxenv_start_undi() has been called */
|
165
|
|
- uint8_t started; /* pxenv_undi_startup() has been called */
|
166
|
|
- uint8_t initialized; /* pxenv_undi_initialize() has been called */
|
167
|
|
- uint8_t opened; /* pxenv_undi_open() has been called */
|
168
|
|
- /* Parameters that we need to store for future reference
|
169
|
|
- */
|
170
|
|
- struct pci_device *pci;
|
171
|
|
- irq_t irq;
|
172
|
|
-} undi_t;
|
173
|
|
-
|
174
|
|
-/* Constants
|
175
|
|
- */
|
176
|
|
-
|
177
|
|
-#define HUNT_FOR_PIXIES 0
|
178
|
|
-#define HUNT_FOR_UNDI_ROMS 1
|