/*+++\r
\r
-Copyright (c) 2006, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
+Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>\r
+This program and the accompanying materials \r
are licensed and made available under the terms and conditions of the BSD License \r
which accompanies this distribution. The full text of the license may be found at \r
http://opensource.org/licenses/bsd-license.php \r
\r
Abstract:\r
\r
-This following section documents the envirnoment variables for the Win UNIX \r
+This following section documents the environment variables for the UNIX \r
build. These variables are used to define the (virtual) hardware \r
configuration of the UNIX environment\r
\r
// device path.\r
//\r
UNIX_PCD_ENTRY mPcdEnvironment[] = {\r
- {PcdToken(PcdUnixConsole), &gEfiUnixConsoleGuid},\r
- {PcdToken(PcdUnixUga), &gEfiUnixUgaGuid},\r
- {PcdToken(PcdUnixFileSystem), &gEfiUnixFileSystemGuid},\r
- {PcdToken(PcdUnixSerialPort), &gEfiUnixSerialPortGuid},\r
- {PcdToken(PcdUnixVirtualDisk), &gEfiUnixVirtualDisksGuid},\r
- {PcdToken(PcdUnixPhysicalDisk), &gEfiUnixPhysicalDisksGuid},\r
- {PcdToken(PcdUnixCpuModel), &gEfiUnixCPUModelGuid},\r
- {PcdToken(PcdUnixCpuSpeed), &gEfiUnixCPUSpeedGuid},\r
- {PcdToken(PcdUnixMemorySize), &gEfiUnixMemoryGuid}\r
+ {PcdToken(PcdUnixConsole), &gEfiUnixConsoleGuid},\r
+ {PcdToken(PcdUnixUga), &gEfiUnixUgaGuid},\r
+ {PcdToken(PcdUnixGop), &gEfiUnixGopGuid},\r
+ {PcdToken(PcdUnixFileSystem), &gEfiUnixFileSystemGuid},\r
+ {PcdToken(PcdUnixSerialPort), &gEfiUnixSerialPortGuid},\r
+ {PcdToken(PcdUnixVirtualDisk), &gEfiUnixVirtualDisksGuid},\r
+ {PcdToken(PcdUnixPhysicalDisk), &gEfiUnixPhysicalDisksGuid},\r
+ {PcdToken(PcdUnixCpuModel), &gEfiUnixCPUModelGuid},\r
+ {PcdToken(PcdUnixCpuSpeed), &gEfiUnixCPUSpeedGuid},\r
+ {PcdToken(PcdUnixMemorySize), &gEfiUnixMemoryGuid},\r
+ {PcdToken(PcdUnixNetworkInterface), &gEfiUnixNetworkGuid}\r
};\r
\r
VOID *\r
None\r
\r
--*/\r
-// TODO: This - add argument and description to function comment\r
-// TODO: ControllerHandle - add argument and description to function comment\r
-// TODO: RemainingDevicePath - add argument and description to function comment\r
-// TODO: EFI_UNSUPPORTED - add return value to function comment\r
-// TODO: EFI_UNSUPPORTED - add return value to function comment\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
{\r
EFI_STATUS Status;\r
EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r
// it is a legal Device Path Node for this bus driver's children.\r
//\r
if (RemainingDevicePath != NULL) {\r
- if (RemainingDevicePath->Type != HARDWARE_DEVICE_PATH ||\r
- RemainingDevicePath->SubType != HW_VENDOR_DP ||\r
- DevicePathNodeLength(RemainingDevicePath) != sizeof(UNIX_VENDOR_DEVICE_PATH_NODE)) {\r
- return EFI_UNSUPPORTED;\r
- }\r
-\r
- for (Index = 0; Index < UNIX_PCD_ARRAY_SIZE; Index++) {\r
- if (CompareGuid (&((VENDOR_DEVICE_PATH *) RemainingDevicePath)->Guid, mPcdEnvironment[Index].DevicePathGuid)) {\r
- break;\r
+ //\r
+ // Check if RemainingDevicePath is the End of Device Path Node, \r
+ // if yes, go on checking other conditions\r
+ //\r
+ if (!IsDevicePathEnd (RemainingDevicePath)) {\r
+ //\r
+ // If RemainingDevicePath isn't the End of Device Path Node,\r
+ // check its validation\r
+ //\r
+ if (RemainingDevicePath->Type != HARDWARE_DEVICE_PATH ||\r
+ RemainingDevicePath->SubType != HW_VENDOR_DP ||\r
+ DevicePathNodeLength(RemainingDevicePath) != sizeof(UNIX_VENDOR_DEVICE_PATH_NODE)) {\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ \r
+ for (Index = 0; Index < UNIX_PCD_ARRAY_SIZE; Index++) {\r
+ if (CompareGuid (&((VENDOR_DEVICE_PATH *) RemainingDevicePath)->Guid, mPcdEnvironment[Index].DevicePathGuid)) {\r
+ break;\r
+ }\r
+ }\r
+ \r
+ if (Index >= UNIX_PCD_ARRAY_SIZE) {\r
+ return EFI_UNSUPPORTED;\r
}\r
- }\r
-\r
- if (Index >= UNIX_PCD_ARRAY_SIZE) {\r
- return EFI_UNSUPPORTED;\r
}\r
}\r
\r
//\r
Status = gBS->OpenProtocol (\r
ControllerHandle,\r
- &gEfiDevicePathProtocolGuid,\r
- (VOID **)&ParentDevicePath,\r
+ &gEfiUnixThunkProtocolGuid,\r
+ (VOID **)&UnixThunk,\r
This->DriverBindingHandle,\r
ControllerHandle,\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
return Status;\r
}\r
\r
+ //\r
+ // Close the I/O Abstraction(s) used to perform the supported test\r
+ //\r
gBS->CloseProtocol (\r
ControllerHandle,\r
- &gEfiDevicePathProtocolGuid,\r
+ &gEfiUnixThunkProtocolGuid,\r
This->DriverBindingHandle,\r
ControllerHandle\r
);\r
\r
+ //\r
+ // Open the EFI Device Path protocol needed to perform the supported test\r
+ //\r
Status = gBS->OpenProtocol (\r
ControllerHandle,\r
- &gEfiUnixThunkProtocolGuid,\r
- (VOID **)&UnixThunk,\r
+ &gEfiDevicePathProtocolGuid,\r
+ (VOID **)&ParentDevicePath,\r
This->DriverBindingHandle,\r
ControllerHandle,\r
EFI_OPEN_PROTOCOL_BY_DRIVER\r
}\r
\r
//\r
- // Close the I/O Abstraction(s) used to perform the supported test\r
+ // Close protocol, don't use device path protocol in the Support() function\r
//\r
gBS->CloseProtocol (\r
ControllerHandle,\r
- &gEfiUnixThunkProtocolGuid,\r
+ &gEfiDevicePathProtocolGuid,\r
This->DriverBindingHandle,\r
ControllerHandle\r
);\r
None\r
\r
--*/\r
-// TODO: This - add argument and description to function comment\r
-// TODO: ControllerHandle - add argument and description to function comment\r
-// TODO: RemainingDevicePath - add argument and description to function comment\r
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// TODO: EFI_OUT_OF_RESOURCES - add return value to function comment\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
{\r
EFI_STATUS Status;\r
EFI_STATUS InstallStatus;\r
StartString = TempStr;\r
\r
//\r
- // Parse the envirnment variable into sub strings using '!' as a delimator.\r
+ // Parse the environment variable into sub strings using '!' as a delimator.\r
// Each substring needs it's own handle to be added to the system. This code\r
// does not understand the sub string. Thats the device drivers job.\r
//\r
CreateDevice = TRUE;\r
if (RemainingDevicePath != NULL) {\r
CreateDevice = FALSE;\r
- Node = (UNIX_VENDOR_DEVICE_PATH_NODE *) RemainingDevicePath;\r
- if (Node->VendorDevicePath.Header.Type == HARDWARE_DEVICE_PATH &&\r
- Node->VendorDevicePath.Header.SubType == HW_VENDOR_DP &&\r
- DevicePathNodeLength (&Node->VendorDevicePath.Header) == sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)\r
- ) {\r
- if (CompareGuid (&Node->VendorDevicePath.Guid, mPcdEnvironment[Index].DevicePathGuid) &&\r
- Node->Instance == Count\r
+ //\r
+ // Check if RemainingDevicePath is the End of Device Path Node, \r
+ // if yes, don't create any child device \r
+ //\r
+ if (!IsDevicePathEnd (RemainingDevicePath)) {\r
+ //\r
+ // If RemainingDevicePath isn't the End of Device Path Node,\r
+ // check its validation\r
+ //\r
+ Node = (UNIX_VENDOR_DEVICE_PATH_NODE *) RemainingDevicePath;\r
+ if (Node->VendorDevicePath.Header.Type == HARDWARE_DEVICE_PATH &&\r
+ Node->VendorDevicePath.Header.SubType == HW_VENDOR_DP &&\r
+ DevicePathNodeLength (&Node->VendorDevicePath.Header) == sizeof (UNIX_VENDOR_DEVICE_PATH_NODE)\r
) {\r
- CreateDevice = TRUE;\r
+ if (CompareGuid (&Node->VendorDevicePath.Guid, mPcdEnvironment[Index].DevicePathGuid) &&\r
+ Node->Instance == Count\r
+ ) {\r
+ CreateDevice = TRUE;\r
+ }\r
}\r
}\r
}\r
\r
UnixDevice->ControllerNameTable = NULL;\r
\r
- // FIXME: check size\r
+ // FIXME: check size\r
StrCpy(ComponentName, UnixDevice->UnixIo.EnvString);\r
\r
UnixDevice->DevicePath = UnixBusCreateDevicePath (\r
None\r
\r
--*/\r
-// TODO: This - add argument and description to function comment\r
-// TODO: ControllerHandle - add argument and description to function comment\r
-// TODO: NumberOfChildren - add argument and description to function comment\r
-// TODO: ChildHandleBuffer - add argument and description to function comment\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
-// TODO: EFI_DEVICE_ERROR - add return value to function comment\r
-// TODO: EFI_SUCCESS - add return value to function comment\r
{\r
EFI_STATUS Status;\r
UINTN Index;\r