Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
2.0 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. config.c
  5. Abstract:
  6. This module contains code for interpreting and manipulating the ARC
  7. firmware configuration tree in various ways.
  8. Author:
  9. John Vert (jvert) 7-Oct-1993
  10. Environment:
  11. Runs in the ARC environment.
  12. Revision History:
  13. --*/
  14. #include "setupldr.h"
  15. #include "stdio.h"
  16. #define MAX_FLOPPIES 4
  17. PCONFIGURATION_COMPONENT_DATA FloppyData[MAX_FLOPPIES];
  18. ULONG NumFloppies=0;
  19. //
  20. // definition for function callbacks
  21. //
  22. //
  23. // Local prototypes
  24. //
  25. BOOLEAN
  26. EnumerateFloppies(
  27. IN PCONFIGURATION_COMPONENT_DATA ConfigData
  28. );
  29. BOOLEAN
  30. SlFindFloppy(
  31. IN ULONG FloppyNumber,
  32. OUT PCHAR ArcName
  33. )
  34. /*++
  35. Routine Description:
  36. Given a floppy number (0, 1, etc.) this routine computes the appropriate
  37. ARC name.
  38. Arguments:
  39. FloppyNumber - Supplies the floppy number.
  40. ArcName - Returns the ARC name of the specified floppy device
  41. Return Value:
  42. TRUE - Floppy exists in the ARC firmware tree.
  43. FALSE - Floppy was not found.
  44. --*/
  45. {
  46. if (NumFloppies==0) {
  47. BlSearchConfigTree(BlLoaderBlock->ConfigurationRoot,
  48. PeripheralClass,
  49. FloppyDiskPeripheral,
  50. (ULONG)-1,
  51. EnumerateFloppies);
  52. }
  53. if (FloppyNumber >= NumFloppies) {
  54. SlFatalError(SL_FLOPPY_NOT_FOUND,NumFloppies,FloppyNumber);
  55. }
  56. BlGetPathnameFromComponent(FloppyData[FloppyNumber],
  57. ArcName);
  58. return(TRUE);
  59. }
  60. BOOLEAN
  61. EnumerateFloppies(
  62. IN PCONFIGURATION_COMPONENT_DATA ConfigData
  63. )
  64. /*++
  65. Routine Description:
  66. Callback routine for enumerating all the floppies in the ARC config tree.
  67. Arguments:
  68. ConfigData - Supplies a pointer to the floppies ARC component data.
  69. Return Value:
  70. TRUE - continue searching
  71. FALSE - stop searching tree.
  72. --*/
  73. {
  74. if (NumFloppies == MAX_FLOPPIES) {
  75. return(FALSE);
  76. }
  77. FloppyData[NumFloppies++] = ConfigData;
  78. return(TRUE);
  79. }
  80.