1 /* ----------------------------------------------------------------------- *
3 * Copyright 2009 Erwan Velu - All Rights Reserved
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without
8 * restriction, including without limitation the rights to use,
9 * copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following
14 * The above copyright notice and this permission notice shall
15 * be included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
26 * -----------------------------------------------------------------------
31 /* Main Kernel menu */
32 void compute_PXE(struct s_my_menu *menu, struct s_hardware *hardware)
34 char buffer[SUBMENULEN + 1];
35 char infobar[STATLEN + 1];
37 if (hardware->is_pxe_valid == false)
40 menu->menu = add_menu(" PXE ", -1);
41 menu->items_count = 0;
42 set_menu_pos(SUBMENU_Y, SUBMENU_X);
44 struct s_pxe *p = &hardware->pxe;
46 if ((hardware->pci_ids_return_code == -ENOPCIIDS) || (p->pci_device==NULL)) {
47 snprintf(buffer, sizeof buffer, "PCI Vendor : %d",
49 snprintf(infobar, sizeof infobar, "PCI Vendor : %d",
51 add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
54 snprintf(buffer, sizeof buffer, "PCI Product : %d",
56 snprintf(infobar, sizeof infobar, "PCI Product : %d",
58 add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
61 snprintf(buffer, sizeof buffer, "PCI SubVendor : %d",
63 snprintf(infobar, sizeof infobar, "PCI SubVendor : %d",
65 add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
68 snprintf(buffer, sizeof buffer, "PCI SubProduct : %d",
70 snprintf(infobar, sizeof infobar, "PCI SubProduct : %d",
72 add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
75 snprintf(buffer, sizeof buffer, "PCI Revision : %d", p->rev);
76 snprintf(infobar, sizeof infobar, "PCI Revision : %d",
78 add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
81 snprintf(buffer, sizeof buffer,
82 "PCI Bus Pos. : %02x:%02x.%02x", p->pci_bus,
83 p->pci_dev, p->pci_func);
84 snprintf(infobar, sizeof infobar,
85 "PCI Bus Pos. : %02x:%02x.%02x", p->pci_bus,
86 p->pci_dev, p->pci_func);
87 add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
92 snprintf(buffer, sizeof buffer, "Manufacturer : %s",
93 p->pci_device->dev_info->vendor_name);
94 snprintf(infobar, sizeof infobar, "Manufacturer : %s",
95 p->pci_device->dev_info->vendor_name);
96 add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
99 snprintf(buffer, sizeof buffer, "Product : %s",
100 p->pci_device->dev_info->product_name);
101 snprintf(infobar, sizeof infobar, "Product : %s",
102 p->pci_device->dev_info->product_name);
103 add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
107 snprintf(buffer, sizeof buffer, "MAC Address : %s", p->mac_addr);
108 snprintf(infobar, sizeof infobar, "MAC Address : %s", p->mac_addr);
109 add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
112 snprintf(buffer, sizeof buffer, "IP Address : %d.%d.%d.%d",
113 p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]);
114 snprintf(infobar, sizeof infobar, "IP Address : %d.%d.%d.%d",
115 p->ip_addr[0], p->ip_addr[1], p->ip_addr[2], p->ip_addr[3]);
116 add_item(buffer, infobar, OPT_INACTIVE, NULL, 0);
119 printf("MENU: PXE menu done (%d items)\n", menu->items_count);