+/**\r
+ Allocates an aligned buffer for SCSI device.\r
+\r
+ This function allocates an aligned buffer for the SCSI device to perform\r
+ SCSI pass through operations. The alignment requirement is from SCSI pass\r
+ through interface.\r
+\r
+ @param ScsiIoDevice The SCSI child device involved for the operation.\r
+ @param BufferSize The request buffer size.\r
+\r
+ @return A pointer to the aligned buffer or NULL if the allocation fails.\r
+\r
+**/\r
+VOID *\r
+AllocateAlignedBuffer (\r
+ IN SCSI_IO_DEV *ScsiIoDevice,\r
+ IN UINTN BufferSize\r
+ )\r
+{\r
+ return AllocateAlignedPages (EFI_SIZE_TO_PAGES (BufferSize), ScsiIoDevice->ScsiIo.IoAlign);\r
+}\r
+\r
+/**\r
+ Frees an aligned buffer for SCSI device.\r
+\r
+ This function frees an aligned buffer for the SCSI device to perform\r
+ SCSI pass through operations.\r
+\r
+ @param Buffer The aligned buffer to be freed.\r
+ @param BufferSize The request buffer size.\r
+\r
+**/\r
+VOID\r
+FreeAlignedBuffer (\r
+ IN VOID *Buffer,\r
+ IN UINTN BufferSize\r
+ )\r
+{\r
+ if (Buffer != NULL) {\r
+ FreeAlignedPages (Buffer, EFI_SIZE_TO_PAGES (BufferSize));\r
+ }\r
+}\r
+\r