platform: Fix checking `eventIDToAcknowledge`

As DSP0248 V1.3.0, `Figure 22 - Switching from asynchronous eventing to
poll for an event with large data` when the `tranferFlag` of
`PollForPlatformEventMessage` is `AcknowledgementOnly` the
`eventIDToAcknowledge` will be 0xffff.

But the contents in lines #1678 to #1681 of the same specs details
```
1678 0x0000 shall be returned to indicate the terminus event queue is empty. The PLDM Event Receiver shall
1679 acknowledge reception of the event by issuing the command again with the eventIDToAcknowledge set
1680 to the previously retrieved eventID (from the PLDM terminus). The PLDM terminus shall remove the
1681 acknowledged event message from its internal FIFO upon reception of the acknowledgment
```

When the `tranferFlag` is `AcknowledgementOnly` the
`eventIDToAcknowledge` should be `the previously retrieved eventID (from
the PLDM terminus)` which is not 0x0000 and 0xffff. Because `The PLDM
terminus shall remove the acknowledged event message` so the contents in
lines #1678 to #1681 are correct.

Update the failure condition in
`pldm_platform_poll_for_platform_event_message_validate` helper function
to follow the contents in lines #1678 to #1681. The helper will return
error when `tranferFlag` is `AcknowledgementOnly` and
`eventIDToAcknowledge` is 0xffff or 0x0000 (which can't be a real
previous event ID from terminus).

gitlint-ignore: B1, UC1
Fixes: 387b10f6cd37 ("platform: fix encode/decode_poll_for_platform_event_message_req")
Change-Id: Icf84494dbe2c43fba8ae2ec72e7197e8dd4abf3e
Signed-off-by: Thu Nguyen <thu@os.amperecomputing.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d904d46..55c6928 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -104,6 +104,12 @@
    Update checking of `TransferOperationFlag` and `eventIDToAcknowledge` to
    follow spec.
 
+3. platform: Fix checking `eventIDToAcknowledge`
+
+   As the event receiver sends `PollForPlatformEventMessage` with the
+   `tranferFlag` is `AcknowledgementOnly`, the value `eventIDToAcknowledge`
+   should be the previously retrieved eventID (from the PLDM terminus).
+
 ## [0.9.1] - 2024-09-07
 
 ### Changed
diff --git a/src/dsp/platform.c b/src/dsp/platform.c
index 755707a..4b6898e 100644
--- a/src/dsp/platform.c
+++ b/src/dsp/platform.c
@@ -1054,7 +1054,9 @@
 	    ((transfer_operation_flag == PLDM_GET_NEXTPART) &&
 	     (event_id_to_acknowledge != PLDM_PLATFORM_EVENT_ID_FRAGMENT)) ||
 	    ((transfer_operation_flag == PLDM_ACKNOWLEDGEMENT_ONLY) &&
-	     (event_id_to_acknowledge != PLDM_PLATFORM_EVENT_ID_FRAGMENT)) ||
+	     (event_id_to_acknowledge == PLDM_PLATFORM_EVENT_ID_FRAGMENT)) ||
+	    ((transfer_operation_flag == PLDM_ACKNOWLEDGEMENT_ONLY) &&
+	     (event_id_to_acknowledge == PLDM_PLATFORM_EVENT_ID_NULL)) ||
 	    (transfer_operation_flag > PLDM_ACKNOWLEDGEMENT_ONLY)) {
 		return -EPROTO;
 	}
diff --git a/tests/dsp/platform.cpp b/tests/dsp/platform.cpp
index 56e9fb3..e937dec 100644
--- a/tests/dsp/platform.cpp
+++ b/tests/dsp/platform.cpp
@@ -1480,7 +1480,7 @@
     uint8_t formatVersion = 0x01;
     uint8_t transferOperationFlag = PLDM_ACKNOWLEDGEMENT_ONLY;
     uint32_t dataTransferHandle = 0xaabbccdd;
-    uint16_t eventIdToAcknowledge = PLDM_PLATFORM_EVENT_ID_FRAGMENT;
+    uint16_t eventIdToAcknowledge = 0x1234;
 
     PLDM_MSG_DEFINE_P(request, PLDM_POLL_FOR_PLATFORM_EVENT_MESSAGE_REQ_BYTES);
 
@@ -1554,7 +1554,7 @@
     EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
 
     transferOperationFlag = PLDM_ACKNOWLEDGEMENT_ONLY;
-    eventIdToAcknowledge = 0x1234;
+    eventIdToAcknowledge = PLDM_PLATFORM_EVENT_ID_NULL;
     rc = encode_poll_for_platform_event_message_req(
         0, formatVersion, transferOperationFlag, dataTransferHandle,
         eventIdToAcknowledge, request,
@@ -1562,7 +1562,7 @@
     EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
 
     transferOperationFlag = PLDM_ACKNOWLEDGEMENT_ONLY;
-    eventIdToAcknowledge = PLDM_PLATFORM_EVENT_ID_NULL;
+    eventIdToAcknowledge = PLDM_PLATFORM_EVENT_ID_FRAGMENT;
     rc = encode_poll_for_platform_event_message_req(
         0, formatVersion, transferOperationFlag, dataTransferHandle,
         eventIdToAcknowledge, request,
@@ -1830,10 +1830,10 @@
     uint8_t formatVersion = 0x1;
     uint8_t transferOperationFlag = PLDM_ACKNOWLEDGEMENT_ONLY;
     uint32_t dataTransferHandle = 0x11223344;
-    uint16_t eventIdToAcknowledge = PLDM_PLATFORM_EVENT_ID_FRAGMENT;
+    uint16_t eventIdToAcknowledge = 0x1234;
     std::vector<uint8_t> requestMsg{
         0x1,  0x0,  0x0,  0x1, PLDM_ACKNOWLEDGEMENT_ONLY, 0x44, 0x33,
-        0x22, 0x11, 0xff, 0xff};
+        0x22, 0x11, 0x34, 0x12};
     // NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
     auto request = reinterpret_cast<pldm_msg*>(requestMsg.data());
 
@@ -1908,11 +1908,26 @@
 
     /*
      * transfer_operation_flag is PLDM_ACKNOWLEDGEMENT_ONLY and
-     * event_id_to_acknowledge is not PLDM_PLATFORM_EVENT_ID_FRAGMENT
+     * event_id_to_acknowledge is PLDM_PLATFORM_EVENT_ID_FRAGMENT
      */
     requestMsg[4] = PLDM_ACKNOWLEDGEMENT_ONLY;
-    requestMsg[9] = 0x11;
-    requestMsg[10] = 0x22;
+    requestMsg[9] = 0xff;
+    requestMsg[10] = 0xff;
+
+    rc = decode_poll_for_platform_event_message_req(
+        request, requestMsg.size() - hdrSize, &retFormatVersion,
+        &retTransferOperationFlag, &retDataTransferHandle,
+        &retEventIdToAcknowledge);
+
+    EXPECT_EQ(rc, PLDM_ERROR_INVALID_DATA);
+
+    /*
+     * transfer_operation_flag is PLDM_ACKNOWLEDGEMENT_ONLY and
+     * event_id_to_acknowledge is PLDM_PLATFORM_EVENT_ID_NULL
+     */
+    requestMsg[4] = PLDM_ACKNOWLEDGEMENT_ONLY;
+    requestMsg[9] = 0x00;
+    requestMsg[10] = 0x00;
 
     rc = decode_poll_for_platform_event_message_req(
         request, requestMsg.size() - hdrSize, &retFormatVersion,