3 Copyright (c) 1998 Intel Corporation
11 Debug library functions for Hardware IO access
23 InitializeGlobalIoDevice (
24 IN EFI_DEVICE_PATH *DevicePath,
25 IN EFI_GUID *Protocol,
27 OUT EFI_DEVICE_IO_INTERFACE **GlobalIoFncs
33 Check to see if DevicePath exists for a given Protocol. Return Error if it
34 exists. Return GlobalIoFuncs set match the DevicePath
38 DevicePath - to operate on
39 Protocol - to check the DevicePath against
40 ErrorStr - ASCII string to display on error
41 GlobalIoFncs - Returned with DeviceIoProtocol for the DevicePath
45 Pass or Fail based on wether GlobalIoFncs where found
53 // Check to see if this device path already has Protocol on it.
54 // if so we are loading recursivly and should exit with an error
56 Status = uefi_call_wrapper(BS->LocateDevicePath, 3, Protocol, &DevicePath, &Handle);
57 if (!EFI_ERROR(Status)) {
58 DEBUG ((D_INIT, "Device Already Loaded for %a device\n", ErrorStr));
59 return EFI_LOAD_ERROR;
62 Status = uefi_call_wrapper(BS->LocateDevicePath, 3, &DeviceIoProtocol, &DevicePath, &Handle);
63 if (!EFI_ERROR(Status)) {
64 Status = uefi_call_wrapper(BS->HandleProtocol, 3, Handle, &DeviceIoProtocol, (VOID*)GlobalIoFncs);
67 ASSERT (!EFI_ERROR(Status));
73 IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
74 IN EFI_IO_WIDTH Width,
81 Status = uefi_call_wrapper(GlobalIoFncs->Io.Read, 5, GlobalIoFncs, Width, (UINT64)Port, 1, &Data);
82 ASSERT(!EFI_ERROR(Status));
88 IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
89 IN EFI_IO_WIDTH Width,
96 Status = uefi_call_wrapper(GlobalIoFncs->Io.Write, 5, GlobalIoFncs, Width, (UINT64)Port, 1, &Data);
97 ASSERT(!EFI_ERROR(Status));
103 IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
104 IN EFI_IO_WIDTH Width,
111 Status = uefi_call_wrapper(GlobalIoFncs->Pci.Read, 5, GlobalIoFncs, Width, (UINT64)Address, 1, &Data);
112 ASSERT(!EFI_ERROR(Status));
118 IN EFI_DEVICE_IO_INTERFACE *GlobalIoFncs,
119 IN EFI_IO_WIDTH Width,
126 Status = uefi_call_wrapper(GlobalIoFncs->Pci.Write, 5, GlobalIoFncs, Width, (UINT64)Address, 1, &Data);
127 ASSERT(!EFI_ERROR(Status));