Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

efi_fdt.c 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. * Copyright (C) 2019 Michael Brown <mbrown@fensystems.co.uk>.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License as
  6. * published by the Free Software Foundation; either version 2 of the
  7. * License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but
  10. * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software
  16. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  17. * 02110-1301, USA.
  18. *
  19. * You can also choose to distribute this program under the terms of
  20. * the Unmodified Binary Distribution Licence (as given in the file
  21. * COPYING.UBDL), provided that you have satisfied its requirements.
  22. */
  23. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  24. #include <string.h>
  25. #include <ipxe/fdt.h>
  26. #include <ipxe/efi/efi.h>
  27. #include <ipxe/init.h>
  28. /** @file
  29. *
  30. * EFI Flattened Device Tree
  31. *
  32. */
  33. #define DEVICE_TREE_TABLE_GUID \
  34. { 0xb1b621d5, 0xf19c, 0x41a5, \
  35. { 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } }
  36. /** EFI Flattened Device Tree configuration table */
  37. static struct fdt_header *efi_fdt;
  38. EFI_USE_TABLE ( DEVICE_TREE_TABLE, &efi_fdt, 0 );
  39. /**
  40. * Initialise EFI Flattened Device Tree
  41. *
  42. */
  43. static void efi_fdt_init ( void ) {
  44. int rc;
  45. /* Do nothing if no configuration table is present */
  46. if ( ! efi_fdt ) {
  47. DBGC ( &efi_fdt, "EFIFDT has no configuration table\n" );
  48. return;
  49. }
  50. DBGC ( &efi_fdt, "EFIFDT configuration table at %p\n", efi_fdt );
  51. /* Register device tree */
  52. if ( ( rc = register_fdt ( efi_fdt ) ) != 0 ) {
  53. DBGC ( &efi_fdt, "EFIFDT could not register: %s\n",
  54. strerror ( rc ) );
  55. return;
  56. }
  57. }
  58. /** EFI Flattened Device Tree initialisation function */
  59. struct init_fn efi_fdt_init_fn __init_fn ( INIT_EARLY ) = {
  60. .initialise = efi_fdt_init,
  61. };