[ipxe-devel] [PATCH v2 2/3] [i386/core] Add support for setting autoboot_device from BSS
Alex Williamson
alex.williamson at redhat.com
Tue Feb 25 23:00:39 UTC 2014
Add an i386 specifical initialization hook and BSS data to allow
prefix code to store autoboot device information.
Signed-off-by: Alex Williamson <alex.williamson at redhat.com>
---
src/arch/i386/core/pci_autoboot_device.c | 52 ++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)
create mode 100644 src/arch/i386/core/pci_autoboot_device.c
diff --git a/src/arch/i386/core/pci_autoboot_device.c b/src/arch/i386/core/pci_autoboot_device.c
new file mode 100644
index 0000000..41769e6
--- /dev/null
+++ b/src/arch/i386/core/pci_autoboot_device.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2014 Red Hat Inc.
+ * Alex Williamson <alex.williamson at redhat.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301, USA.
+ */
+
+FILE_LICENCE ( GPL2_OR_LATER );
+
+#include <stdint.h>
+#include <stdlib.h>
+#include <ipxe/device.h>
+#include <ipxe/init.h>
+#include <realmode.h>
+#include <usr/autoboot.h>
+
+uint16_t __bss16 ( i386_pci_autoboot_bdf );
+#define i386_pci_autoboot_bdf __use_data16 ( i386_pci_autoboot_bdf )
+
+uint16_t __bss16 ( i386_pci_autoboot_bdf_set );
+#define i386_pci_autoboot_bdf_set __use_data16 ( i386_pci_autoboot_bdf_set )
+
+/**
+ *
+ * PCI autoboot_device initialisation - Relay settings from BSS to autoboot
+ *
+ */
+static void pci_autoboot_device_init ( void ) {
+
+ if ( i386_pci_autoboot_bdf_set ) {
+ autoboot_device.bus_type = BUS_TYPE_PCI;
+ autoboot_device.location = i386_pci_autoboot_bdf;
+ }
+}
+
+/** PCI autoboot_device initialisation function */
+struct init_fn pci_autoboot_device_init_fn __init_fn ( INIT_NORMAL ) = {
+ .initialise = pci_autoboot_device_init,
+};
More information about the ipxe-devel
mailing list