:: limine / common / pxe / pxe.h 2.4 KB raw

1
#ifndef PXE_H
2
#define PXE_H
3
4
#include <stdint.h>
5
#include <lib/part.h>
6
7
#define DHCP_ACK_PACKET_LEN 296
8
9
extern uint8_t cached_dhcp_packet[DHCP_ACK_PACKET_LEN];
10
extern bool cached_dhcp_ack_valid;
11
12
#if defined (BIOS)
13
14
struct volume *pxe_bind_volume(void);
15
void pxe_init(void);
16
int pxe_call(uint16_t opcode, uint16_t buf_seg, uint16_t buf_off);
17
18
#define MAC_ADDR_LEN 16
19
typedef uint8_t MAC_ADDR_t[MAC_ADDR_LEN];
20
21
struct bootph {
22
    uint8_t opcode;
23
    uint8_t Hardware;
24
    uint8_t Hardlen;
25
    uint8_t Gatehops;
26
    uint32_t ident;
27
    uint16_t seconds;
28
    uint16_t Flags;
29
    uint32_t cip;
30
    uint32_t yip;
31
    uint32_t sip;
32
    uint32_t gip;
33
    MAC_ADDR_t CAddr;
34
    uint8_t Sname[64];
35
    uint8_t bootfile[128];
36
    union bootph_vendor {
37
        uint8_t d[1024];
38
        struct bootph_vendor_v {
39
            uint8_t magic[4];
40
            uint32_t flags;
41
            uint8_t pad[52];
42
        } v;
43
    } vendor;
44
};
45
46
 struct PXENV_UNDI_GET_INFORMATION {
47
    uint16_t Status;
48
    uint16_t BaseIo;
49
    uint16_t IntNumber;
50
    uint16_t MaxTranUnit;
51
    uint16_t HwType;
52
    uint16_t HwAddrLen;
53
    uint8_t CurrentNodeAddress[16];
54
    uint8_t PermNodeAddress[16];
55
    uint16_t ROMAddress;
56
    uint16_t RxBufCt;
57
    uint16_t TxBufCt;
58
 };
59
60
#define PXE_SIGNATURE "PXENV+"
61
struct pxenv {
62
    uint8_t signature[6];
63
    uint16_t version;
64
    uint8_t length;
65
    uint8_t checksum;
66
    uint32_t rm_entry;
67
    uint32_t pm_offset;
68
    uint16_t pm_selector;
69
    uint16_t stack_seg;
70
    uint16_t stack_size;
71
    uint16_t bc_code_seg;
72
    uint16_t bc_code_size;
73
    uint16_t bc_data_seg;
74
    uint16_t bc_data_size;
75
    uint16_t undi_data_seg;
76
    uint16_t undi_data_size;
77
    uint16_t undi_code_seg;
78
    uint16_t undi_code_size;
79
    uint32_t pxe_ptr;
80
} __attribute__((packed));
81
82
#define PXE_BANGPXE_SIGNATURE "!PXE"
83
struct bangpxe {
84
    uint8_t signature[4];
85
    uint8_t length;
86
    uint8_t chksum;
87
    uint8_t rev;
88
    uint8_t reserved;
89
    uint32_t undiromid;
90
    uint32_t baseromid;
91
    uint32_t rm_entry;
92
    uint32_t pm_entry;
93
} __attribute__((packed));
94
95
#define PXENV_GET_CACHED_INFO 0x0071
96
#define PXENV_PACKET_TYPE_CACHED_REPLY 3
97
struct pxenv_get_cached_info {
98
    uint16_t status;
99
    uint16_t packet_type;
100
    uint16_t buffer_size;
101
    uint32_t buffer;
102
    uint16_t buffer_limit;
103
} __attribute__((packed));
104
105
#elif defined (UEFI)
106
107
struct volume *pxe_bind_volume(EFI_HANDLE efi_handle, EFI_PXE_BASE_CODE *pxe_base_code);
108
109
#endif
110
111
#endif
tab: 248 wrap: offon