1 #ifndef __HVMLOADER_OPTION_ROM_H__
2 #define __HVMLOADER_OPTION_ROM_H__
3 
4 #include <stdint.h>
5 
6 struct option_rom_header {
7     uint8_t signature[2]; /* "\x55\xaa" */
8     uint8_t rom_size; /* 512-byte increments */
9     uint32_t entry_point;
10     uint8_t reserved[17];
11     uint16_t pci_header_offset;
12     uint16_t expansion_header_offset;
13 } __attribute__ ((packed));
14 
15 struct option_rom_pnp_header {
16     uint8_t signature[4]; /* "$PnP" */
17     uint8_t structure_revision;
18     uint8_t structure_length; /* 16-byte increments */
19     uint16_t next_header_offset;
20     uint8_t reserved;
21     uint8_t checksum;
22     uint32_t device_id;
23     uint16_t manufacturer_name_offset;
24     uint16_t product_name_offset;
25     uint8_t device_type_code[3];
26     uint8_t device_indicators;
27     uint16_t boot_connection_vector;
28     uint16_t disconnect_vector;
29     uint16_t bootstap_entry_vector;
30     uint16_t reserved2;
31     uint16_t static_resource_information_vector;
32 } __attribute__ ((packed));
33 
34 
35 struct option_rom_pci_header {
36     uint8_t signature[4]; /* "PCIR" */
37     uint16_t vendor_id;
38     uint16_t device_id;
39     uint16_t vital_product_data_offset;
40     uint16_t structure_length;
41     uint8_t structure_revision;
42     uint8_t class_code[3];
43     uint16_t image_length;
44     uint16_t image_revision;
45     uint8_t code_type;
46     uint8_t indicator;
47     uint16_t reserved;
48 } __attribute__ ((packed));
49 
50 #define round_option_rom(x) (((x) + 2047) & ~2047)
51 int scan_etherboot_nic(unsigned int option_rom_end,
52                        uint32_t copy_rom_dest,
53                        void *etherboot_rom);
54 int pci_load_option_roms(unsigned int option_rom_end,
55                          uint32_t rom_base_addr);
56 
57 #endif /* __HVMLOADER_OPTION_ROM_H__ */
58 
59 /*
60  * Local variables:
61  * mode: C
62  * c-file-style: "BSD"
63  * c-basic-offset: 4
64  * tab-width: 4
65  * indent-tabs-mode: nil
66  * End:
67  */
68