17 Commits

Author SHA1 Message Date
tsaikevin e609296abe fix: [ARLS] Fix coverity issues (#2279)
Address following coverity issues
1. Integer Overflow or Wraparound (CWE 190)
2. NULL Pointer Dereference (CWD 476)

Signed-off-by: Kevin Tsai <kevin.tsai@intel.com>
2024-08-29 09:31:09 +08:00
Stanley Chang 1f79bf92e5 ahci: fix AhciWriteBlocks and AhciGetMediaInfo
This commit fixes two AHCI operations:

1. AhciWriteBlocks: caused by wrong command
2. AhciGetMediaInfo: caused by wrong offset

The patches also updates the EFI_ATA_IDENTIFY_DATA to align with the ATA8-ACS.

In addition, this commit ports the following changes from EDK2, to enhance the
command completion and trace:

1. cc28ab7a1d7: MdeModulePkg/AtaAtapiPassThru: Check IS to check for command completion
2. b465a811006: MdeModulePkg/AtaAtapiPassThru: Add SATA error recovery flow
3. 64e25d4b062: MdeModulePkg/AtaAtapiPassThru: Restart failed packets
4. 91d95113d07: MdeModulePkg/AtaAtapiPassThru: Trace ATA packets
5. 4c7ce0d285b: MdeModulePkg AtaAtapiPassThru: Skip the potential NULL pointer access

Last, the commit adjusts OS_LOADER_FD_SIZE for several platforms for x64 build

Verified: Using BlockIoTest to test with SATA SSD disk on TGL-UP3

Signed-off-by: Stanley Chang <stanley.chang@intel.com>
2024-06-03 21:24:06 -07:00
tsaikevin 0d45c3e60a fix: [Common] Fix Coverity issues (#1958)
Fixed dead default in switch and logically dead code (CWE 561)

Signed-off-by: Kevin Tsai <kevin.tsai@intel.com>
2023-07-19 14:03:41 -07:00
Mike Crowe 990e3e81e6 Use LF line endings in the repository
Convert the line endings stored for all text files in the repository to
LF. The majority previously used DOS-style CRLF line endings. Add a
.gitattributes file to enforce this and treat certain extensions as
never being text files.

Update PatchCheck.py to insist on LF line endings rather than CRLF.
However, its other checks fail on this commit due to lots of
pre-existing complaints that it only notices because the line endings
have changed.

Silicon/QemuSocPkg/FspBin/Patches/0001-Build-QEMU-FSP-2.0-binaries.patch
needs to be treated as binary since it contains a mixture of line
endings.

This change has implications depending on the client platform you are
using the repository from:

* Windows

The usual configuration for Git on Windows means that text files will
be checked out to the work tree with DOS-style CRLF line endings. If
that's not the case then you can configure Git to do so for the entire
machine with:

 git config --global core.autocrlf true

or for just the repository with:

 git config core.autocrlf true

Line endings will be normalised to LF when they are committed to the
repository. If you commit a text file with only LF line endings then it
will be converted to CRLF line endings in your work tree.

* Linux, MacOS and other Unices

The usual configuration for Git on such platforms is to check files out
of the repository with LF line endings. This is probably the right thing
for you. In the unlikely even that you are using Git on Unix but editing
or compiling on Windows for some reason then you may need to tweak your
configuration to force the use of CRLF line endings as described above.

* General

For more information see
https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings .

Fixes: https://github.com/slimbootloader/slimbootloader/issues/1400
Signed-off-by: Mike Crowe <mac@mcrowe.com>
2021-11-10 12:46:42 -08:00
Sai Talamudupula ac66d62da1 Fix AHCI init failure when NumPort=0
When a SATA controller has no Ports Implemented
behind it, AHCI mode init returns error even before
allocating buffers for RFis, CommandTable, CommandList.
So, AHCI de-init expects them to be NULL, else any
garbage value for these fields forces the code to do
a FreePool on non-allocated memory.

Signed-off-by: Sai Talamudupula <sai.kiran.talamudupula@intel.com>
2020-08-05 06:39:09 -07:00
Aiden Park 2f076387a0 Check SATA controller at Ahci Init
This will fix an unexpected exception when AhciHcPciBase is invalid
or the PCI config space is not enabled.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-05-22 12:20:57 -07:00
Maurice Ma 58ef188a07 Fix AHCI library memory de-allocation issue (#666)
This patch fixed AHCI memory de-allocation issue by checking the
correct pointer before calling FreePool/FreePages.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-04-13 17:37:36 -07:00
Aiden Park 3ec0361920 Fix pointer type cast errors from Visual Studio (#617)
Visual Studio reports more pointer type cast errors with 64-bit build.
This will cover the issue on the existing targets.

Signed-off-by: Aiden Park <aiden.park@intel.com>
2020-03-27 11:03:28 -07:00
Maurice Ma bc241455c0 Add IoMmu support for AHCI library
This patch added support for IoMmu interfaces. It will allow the
library to use DMA buffer for I/O transactions.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-19 22:06:50 -07:00
Maurice Ma 2fab0b7dce Add IoMmuLib implementation
This patch added IoMmuLib support so that device can allocate/free
DMA memory and map/unmap host memory to DMA memory. This lib was
added into AHCI inf file so that it can be tested for build. Later
on more patches will be submitted to enable DMA protection for each
media library such as AHCI, XHCI, eMMC, UFS, NVMe, etc.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-03-16 17:06:16 -07:00
Maurice Ma faa172e67e Add missing header files in INF
In order to sync up with EDK201911 stable release, it is required
to add missing header files in the INF file. Otherwise, the build
will throw warnings. This patch added the missing headers in INF
files.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2020-02-03 15:49:48 -08:00
Aiden Park b24fd2759c Cosmetic: Convert LF to CRLF
This will fully support PatchCheck.py.
- Remove all trailing whitespace
- Convert LF to CRLF by default
- Update EFI_D_* to DEBUG_*
- Re-enable CRLF check in PatchCheck.py

Signed-off-by: Aiden Park <aiden.park@intel.com>
2019-12-02 16:21:19 -08:00
Maurice Ma b0d5ef094c Add device deinit support
This patch added basic deinit support in the media DevInit() interface.
It uses a special DevDeinit phase to inform the media driver to do
device de-initialization. This de-initialization flow will be called
before OsLoader restarting and OS booting.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-14 10:10:11 -07:00
Maurice Ma d23d7e07f8 Fix AHCI memory de-allocation issue
This patch fixed the pointer check before de-allocating memory
previously allocated for AHCI controller.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-10-12 19:57:40 -07:00
Guo Dong 5e10bd1e07 Update BSD license to BSD+Patent license
To align with EDK2, update file license
to use BSD+Patent license

Signed-off-by: Guo Dong <guo.dong@intel.com>
2019-06-13 10:46:49 -07:00
Maurice Ma 0d8fad8bbc Allow SATA boot option to boot from any AHCI port
For SATA boot option, the hardware partition is mapped into AHCI
port. Current implementation requires a specific AHCI port in order
to boot from that hard drive. This patch added support to boot
from the first detected AHCI port when the hardware partition is
set to 0xFF.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
2019-04-19 10:43:10 -07:00
Maurice Ma c6999f497a Initial check-in for Slim Bootloader source 2018-09-13 16:11:07 -07:00