Imported Debian patch 0.4.9-1 debian/0.4.9-1
authorBdale Garbee <bdale@gag.com>
Wed, 18 Aug 2004 14:59:03 +0000 (08:59 -0600)
committerBdale Garbee <bdale@gag.com>
Tue, 20 May 2008 05:06:19 +0000 (23:06 -0600)
AUTHORS
Makefile
debian/changelog
debian/control
doc/ChangeLog
src/efibootmgr/module.mk
src/lib/efi.c

diff --git a/AUTHORS b/AUTHORS
index 3059aa5139316f6e9bf0cb8c059548d37cd1d48d..bd8127de5416fe3f412433856f4ab68764627f5a 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -13,3 +13,6 @@ dann frazier <dannf@debian.org>
 - Patches to efibootmgr.c
 - network boot entry creation in efi.c
 
+Joshua Giles <Joshua_Giles@dell.com>
+- walk the PCI path inserting parent bridge device path components for
+  network boot and EDD30 entries.
index 3ae14633c0960f1df3c579b723fa6a1301023fdc..b7162d83b59122538d9abd93c2c29b362531cf6d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,10 @@
   default: all
 
-  RELEASE_DATE := "24-Feb-2004"
+  RELEASE_DATE := "09-Jun-2004"
   RELEASE_MAJOR := 0
   RELEASE_MINOR := 5
   RELEASE_SUBLEVEL := 0
-  RELEASE_EXTRALEVEL := -test3
+  RELEASE_EXTRALEVEL := -test4
   RELEASE_NAME := efibootmgr
   RELEASE_STRING := $(RELEASE_NAME)-$(RELEASE_MAJOR).$(RELEASE_MINOR).$(RELEASE_SUBLEVEL)$(RELEASE_EXTRALEVEL)
 
index 1aa93767178c15bb4f282ab4b6370d4da42003c3..5e57ff8f4b0506af298ff135f79e609edc04b7b0 100644 (file)
@@ -1,23 +1,3 @@
-efibootmgr (0.4.9-0.sarge.2) testing; urgency=high
-
-  * Base dependencies are frozen; this release reverts the portion of the
-    test4 changes that added a dependency on pciutils.  Thanks to Dann Frazier
-    for figuring this out and providing a suitable patch.  Closes: #268490
-
- -- Bdale Garbee <bdale@gag.com>  Fri, 27 Aug 2004 23:12:38 -0600
-
-efibootmgr (0.4.9-0.sarge.1) testing; urgency=high
-
-  * build 0.4.9-1 in testing chroot for sarge
-  * new upstream version.  This is actually 0.5.0-test4, renumbered to avoid
-    nastiness when 0.5.0 is released.  Upstream says 0.5.0 will be this code
-    with a documentation change.  Closes: #258838, #235227
-  * add pciutils-dev to build dependencies since we need libpci now
-  * hack in a typedef to get a u64 definition for ethtool.h
-  * urgency high because previous version fails with current 2.6 kernels
-
- -- Bdale Garbee <bdale@gag.com>  Wed, 18 Aug 2004 09:47:21 -0600
-
 efibootmgr (0.4.9-1) unstable; urgency=high
 
   * new upstream version.  This is actually 0.5.0-test4, renumbered to avoid
index b21f1379c7f7f70dcc71e032dc425f665ea83938..baaa98b0e5c7e4bbed659f0479d510376d9b27f3 100644 (file)
@@ -2,7 +2,7 @@ Source: efibootmgr
 Section: admin
 Priority: optional
 Maintainer: Bdale Garbee <bdale@gag.com>
-Build-Depends: debhelper (>> 3.0.0), docbook-to-man
+Build-Depends: debhelper (>> 3.0.0), docbook-to-man, pciutils-dev
 Standards-Version: 3.6.1.0
 
 Package: efibootmgr
index 2841c362bcfa42e85f1d42f7ad0a69f3d7e74aa2..8ba7756904b7f3a1bb6a56bc08491442f402bacd 100644 (file)
@@ -1,3 +1,14 @@
+* Wed Jun 07 2004 Matt Domsch <Matt_Domsch@dell.com>
+- Fixed bug where read_boot_order() would wrongly return EFI_NOT_FOUND
+  when it needed to create a new BootOrder variable.  Reported by Micah Parrish.
+- Added code to recursively walk the PCI bus putting parent PCI bridges
+  in.  This is necessary for Dell PowerEdge 3250 and 7250 servers and
+  Intel Tiger2 and Tiger4 platforms when creating PXE boot entries for
+  the onboard NICs, and if creating EDD30 boot path entries.  Work by Matt
+  and Joshua Giles.
+  - Note, efibootmgr now requires libpci for building.
+- Released v0.5.0-test4
+
 * Sat Apr 24 2004 Matt Domsch <Matt_Domsch@dell.com>
 - Fixed reversed logic of create_or_edit_variable which prevented object
   creation or editing on sysfs.
index 069a6485f8e1520f629cd6c4c22657a16670614d..dac4907e8b486a718e2da313abcceb048f8ddb72 100644 (file)
@@ -11,6 +11,7 @@ efibootmgr_LIBS    := crc32.o disk.o efi.o efichar.o gpt.o scsi_ioctls.o \
 efibootmgr_LIBDIR  := src/lib
 efibootmgr_FULLLIB := \
        $(patsubst %,$(efibootmgr_LIBDIR)/%,$(efibootmgr_LIBS))
+LIBS = -lpci
 
 ALLDEPS += $(efibootmgr_FULLTARGET)
 CLEANLIST += $(efibootmgr_FULLTARGET)
@@ -19,4 +20,5 @@ bindir_TARGETS += $(efibootmgr_FULLTARGET)
 
 $(efibootmgr_FULLTARGET): \
        $(efibootmgr_FULLOBJECT) \
-       $(efibootmgr_FULLLIB)
+       $(efibootmgr_FULLLIB) \
+       $(LIBS)
index ebfcdbc41318a935603119e5c47efbd39c3dcbbd..dcc5e9195c6f91729e6ebb24fd9fd12cf938342e 100644 (file)
 #include <sys/ioctl.h>
 #include <linux/sockios.h>
 #include <net/if.h>
-
-typedef unsigned long long u64; /* hack, so we may include kernel's ethtool.h */
-typedef __uint32_t u32;         /* ditto */
-typedef __uint16_t u16;         /* ditto */
-typedef __uint8_t u8;           /* ditto */
-
+#include <pci/pci.h>
+typedef __u64 u64;
 #include <linux/ethtool.h>
 #include "efi.h"
 #include "efichar.h"
@@ -49,6 +45,7 @@ typedef __uint8_t u8;           /* ditto */
 #include "efibootmgr.h"
 #include "efivars_procfs.h"
 #include "efivars_sysfs.h"
+#include "list.h"
 
 static struct efivar_kernel_calls *fs_kernel_calls;
 
@@ -298,8 +295,55 @@ make_mac_addr_device_path(void *dest, char *mac, uint8_t iftype)
        return p.length;
 }
 
+struct device
+{
+       struct pci_dev *pci_dev;
+       struct list_head node;
+};
+
+static struct device *
+is_parent_bridge(struct pci_dev *p, unsigned int target_bus)
+{
+       struct device *d;
+       unsigned int primary, secondary;
+
+       if ( (pci_read_word(p, PCI_HEADER_TYPE) & 0x7f) != PCI_HEADER_TYPE_BRIDGE)
+               return NULL;
+
+       primary=pci_read_byte(p, PCI_PRIMARY_BUS);
+       secondary=pci_read_byte(p, PCI_SECONDARY_BUS);
+
+
+       if (secondary != target_bus)
+               return NULL;
+
+       d = malloc(sizeof(struct device));
+       if (!d)
+               return NULL;
+       memset(d, 0, sizeof(*d));
+       INIT_LIST_HEAD(&d->node);
+
+       d->pci_dev = p;
+
+       return d;
+}
+
+static struct device *
+find_parent(struct pci_access *pacc, unsigned int target_bus)
+{
+       struct device *dev;
+       struct pci_dev *p;
+
+       for (p=pacc->devices; p; p=p->next) {
+               dev = is_parent_bridge(p, target_bus);
+               if (dev)
+                       return dev;
+       }
+       return NULL;
+}
+
 static uint16_t
-make_pci_device_path(void *dest, uint8_t device, uint8_t function)
+make_one_pci_device_path(void *dest, uint8_t device, uint8_t function)
 {
        PCI_DEVICE_PATH p;
        memset(&p, 0, sizeof(p));
@@ -312,6 +356,47 @@ make_pci_device_path(void *dest, uint8_t device, uint8_t function)
        return p.length;
 }
 
+static uint16_t
+make_pci_device_path(void *dest, uint8_t bus, uint8_t device, uint8_t function)
+{
+       struct device *dev;
+       struct pci_access *pacc;
+       struct list_head *pos, *n;
+       LIST_HEAD(pci_parent_list);
+       char *p = dest;
+
+       pacc = pci_alloc();
+       if (!pacc)
+               return 0;
+
+       pci_init(pacc);
+       pci_scan_bus(pacc);
+
+       do {
+               dev = find_parent(pacc, bus);
+               if (dev) {
+                       list_add(&pci_parent_list, &dev->node);
+                       bus = dev->pci_dev->bus;
+               }
+       } while (dev && bus);
+
+
+       list_for_each_safe(pos, n, &pci_parent_list) {
+               dev = list_entry(pos, struct device, node);
+               p += make_one_pci_device_path(p,
+                                             dev->pci_dev->dev,
+                                             dev->pci_dev->func);
+               list_del(&dev->node);
+               free(dev);
+       }
+
+       p += make_one_pci_device_path(p, device, function);
+
+       pci_cleanup(pacc);
+
+       return ((void *)p - dest);
+}
+
 static uint16_t
 make_scsi_device_path(void *dest, uint16_t id, uint16_t lun)
 {
@@ -388,7 +473,7 @@ make_edd30_device_path(int fd, void *buffer)
        idlun_to_components(&idlun, &host, &channel, &id, &lun);
 
        p += make_acpi_device_path      (p, EISAID_PNP0A03, bus);
-       p += make_pci_device_path       (p, device, function);
+       p += make_pci_device_path       (p, bus, device, function);
        p += make_scsi_device_path      (p, id, lun);
        return ((void *)p - buffer);
 }
@@ -463,7 +548,7 @@ char *make_disk_load_option(char *p, char *disk)
 char *make_net_load_option(char *p, char *iface)
 {
     /* copied pretty much verbatim from the ethtool source */
-    int fd = 0, err;
+    int fd = 0, err; 
     int bus, slot, func;
     struct ifreq ifr;
     struct ethtool_drvinfo drvinfo;
@@ -482,13 +567,14 @@ char *make_net_load_option(char *p, char *iface)
         perror("Cannot get driver information");
     }
 
+
     err = sscanf(drvinfo.bus_info, "%2x:%2x.%x", &bus, &slot, &func);
     if (err == 0) {
         perror("Couldn't parse device location string.");
     }
 
     p += make_acpi_device_path(p, opts.acpi_hid, opts.acpi_uid);
-    p += make_pci_device_path(p, (uint8_t)slot, (uint8_t)func);
+    p += make_pci_device_path(p, bus, (uint8_t)slot, (uint8_t)func);
 
     err = ioctl(fd, SIOCGIFHWADDR, &ifr);
     if (err < 0) {
@@ -497,7 +583,6 @@ char *make_net_load_option(char *p, char *iface)
 
     p += make_mac_addr_device_path(p, ifr.ifr_ifru.ifru_hwaddr.sa_data, 0);
     p += make_end_device_path       (p);
-
     return(p);
 }