diff options
author | RajithaY <rajithax.yerrumsetty@intel.com> | 2017-04-25 03:31:15 -0700 |
---|---|---|
committer | Rajitha Yerrumchetty <rajithax.yerrumsetty@intel.com> | 2017-05-22 06:48:08 +0000 |
commit | bb756eebdac6fd24e8919e2c43f7d2c8c4091f59 (patch) | |
tree | ca11e03542edf2d8f631efeca5e1626d211107e3 /qemu/roms/ipxe/src/core/device.c | |
parent | a14b48d18a9ed03ec191cf16b162206998a895ce (diff) |
Adding qemu as a submodule of KVMFORNFV
This Patch includes the changes to add qemu as a submodule to
kvmfornfv repo and make use of the updated latest qemu for the
execution of all testcase
Change-Id: I1280af507a857675c7f81d30c95255635667bdd7
Signed-off-by:RajithaY<rajithax.yerrumsetty@intel.com>
Diffstat (limited to 'qemu/roms/ipxe/src/core/device.c')
-rw-r--r-- | qemu/roms/ipxe/src/core/device.c | 140 |
1 files changed, 0 insertions, 140 deletions
diff --git a/qemu/roms/ipxe/src/core/device.c b/qemu/roms/ipxe/src/core/device.c deleted file mode 100644 index 77d7b719b..000000000 --- a/qemu/roms/ipxe/src/core/device.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright (C) 2006 Michael Brown <mbrown@fensystems.co.uk>. - * - * 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. - * - * You can also choose to distribute this program under the terms of - * the Unmodified Binary Distribution Licence (as given in the file - * COPYING.UBDL), provided that you have satisfied its requirements. - */ - -FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); - -#include <string.h> -#include <ipxe/list.h> -#include <ipxe/tables.h> -#include <ipxe/init.h> -#include <ipxe/interface.h> -#include <ipxe/device.h> - -/** - * @file - * - * Device model - * - */ - -/** Registered root devices */ -static LIST_HEAD ( devices ); - -/** Device removal inhibition counter */ -int device_keep_count = 0; - -/** - * Probe a root device - * - * @v rootdev Root device - * @ret rc Return status code - */ -static int rootdev_probe ( struct root_device *rootdev ) { - int rc; - - DBG ( "Adding %s root bus\n", rootdev->dev.name ); - if ( ( rc = rootdev->driver->probe ( rootdev ) ) != 0 ) { - DBG ( "Failed to add %s root bus: %s\n", - rootdev->dev.name, strerror ( rc ) ); - return rc; - } - - return 0; -} - -/** - * Remove a root device - * - * @v rootdev Root device - */ -static void rootdev_remove ( struct root_device *rootdev ) { - rootdev->driver->remove ( rootdev ); - DBG ( "Removed %s root bus\n", rootdev->dev.name ); -} - -/** - * Probe all devices - * - * This initiates probing for all devices in the system. After this - * call, the device hierarchy will be populated, and all hardware - * should be ready to use. - */ -static void probe_devices ( void ) { - struct root_device *rootdev; - int rc; - - for_each_table_entry ( rootdev, ROOT_DEVICES ) { - list_add ( &rootdev->dev.siblings, &devices ); - INIT_LIST_HEAD ( &rootdev->dev.children ); - if ( ( rc = rootdev_probe ( rootdev ) ) != 0 ) - list_del ( &rootdev->dev.siblings ); - } -} - -/** - * Remove all devices - * - */ -static void remove_devices ( int booting __unused ) { - struct root_device *rootdev; - struct root_device *tmp; - - if ( device_keep_count != 0 ) { - DBG ( "Refusing to remove devices on shutdown\n" ); - return; - } - - list_for_each_entry_safe ( rootdev, tmp, &devices, dev.siblings ) { - rootdev_remove ( rootdev ); - list_del ( &rootdev->dev.siblings ); - } -} - -struct startup_fn startup_devices __startup_fn ( STARTUP_NORMAL ) = { - .startup = probe_devices, - .shutdown = remove_devices, -}; - -/** - * Identify a device behind an interface - * - * @v intf Interface - * @ret device Device, or NULL - */ -struct device * identify_device ( struct interface *intf ) { - struct interface *dest; - identify_device_TYPE ( void * ) *op = - intf_get_dest_op ( intf, identify_device, &dest ); - void *object = intf_object ( dest ); - void *device; - - if ( op ) { - device = op ( object ); - } else { - /* Default is to return NULL */ - device = NULL; - } - - intf_put ( dest ); - return device; -} |