PR 892: TFES PxCI check + unique test temp files

- src/x86/ata.c: verify PxCI is clear in the TFES path before scrubbing
  the DMA buffer (symmetric with the success path; prevents scrubbing
  while the HBA may still reference the buffer)
- unit-update-ram-nofixed-noramboot.c: append PID to /tmp filenames to
  avoid collisions under parallel make -j or shared runners
pull/892/head
Daniele Lacamera 2026-09-16 14:40:50 +02:00
parent 66be5eb520
commit d316af6567
2 changed files with 17 additions and 4 deletions

View File

@ -298,13 +298,19 @@ int ata_cmd_complete_async()
if (!ata_async_info.in_progress)
return ATA_ERR_OP_NOT_IN_PROGRESS;
ata = &ATA_Drv[ata_async_info.drv];
slot = ata_async_info.slot;
if (mmio_read32(AHCI_PxIS(ata->ahci_base, ata->ahci_port)) & AHCI_PORT_IS_TFES) {
/* Task-file error: verify the HBA has retired the command (PxCI
* clear) before scrubbing the DMA buffer it may still reference. */
if ((mmio_read32(AHCI_PxCI(ata->ahci_base, ata->ahci_port)) &
(1 << slot)) != 0)
return ATA_ERR_BUSY;
ret = -1;
goto done;
}
slot = ata_async_info.slot;
if ((mmio_read32(AHCI_PxCI(ata->ahci_base, ata->ahci_port)) & (1 << slot)) != 0)
if ((mmio_read32(AHCI_PxCI(ata->ahci_base, ata->ahci_port)) &
(1 << slot)) != 0)
return ATA_ERR_BUSY;
ret = 0;

View File

@ -107,12 +107,19 @@ static void reset_mock_stats(void)
static void prepare_flash(void)
{
int ret;
char ext_path[64];
char int_path[64];
ret = mmap_file("/tmp/wolfboot-unit-ext-file-nofixed-noramboot.bin",
snprintf(ext_path, sizeof(ext_path),
"/tmp/wolfboot-unit-ext-file-nofixed-noramboot-%d.bin", (int)getpid());
snprintf(int_path, sizeof(int_path),
"/tmp/wolfboot-unit-int-file-nofixed-noramboot-%d.bin", (int)getpid());
ret = mmap_file(ext_path,
(void *)(uintptr_t)MOCK_ADDRESS_UPDATE,
WOLFBOOT_PARTITION_SIZE + IMAGE_HEADER_SIZE, NULL);
ck_assert_int_ge(ret, 0);
ret = mmap_file("/tmp/wolfboot-unit-int-file-nofixed-noramboot.bin",
ret = mmap_file(int_path,
(void *)(uintptr_t)MOCK_ADDRESS_BOOT,
WOLFBOOT_PARTITION_SIZE + IMAGE_HEADER_SIZE, NULL);
ck_assert_int_ge(ret, 0);