]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[intelxl] Allow expected admin queue command errors to be silenced
authorMichael Brown <mcb30@ipxe.org>
Thu, 17 Mar 2022 13:01:50 +0000 (13:01 +0000)
committerMichael Brown <mcb30@ipxe.org>
Thu, 11 Aug 2022 14:28:03 +0000 (15:28 +0100)
The "clear PXE mode" admin queue command will return an EEXIST error
if the device is already in non-PXE mode, but there is no other admin
queue command that can be used to determine whether the device has
already been switched into non-PXE mode.

Provide a mechanism to allow expected errors from a command to be
silenced, to allow the "clear PXE mode" command to be cleanly used
without needing to first check the GLLAN_RCTL_0 register value.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/drivers/net/intelxl.c

index 51e888a60457127f5a8e06fb570fc210e6793733..c73285a6110579bf6b24588c5acecf2fdf6e6a26 100644 (file)
@@ -348,6 +348,7 @@ int intelxl_admin_command ( struct intelxl_nic *intelxl ) {
        union intelxl_admin_buffer *buf;
        uint64_t address;
        uint32_t cookie;
+       uint16_t silence;
        unsigned int index;
        unsigned int tail;
        unsigned int i;
@@ -364,11 +365,14 @@ int intelxl_admin_command ( struct intelxl_nic *intelxl ) {
                DBGC2 ( intelxl, "/%#08x", le32_to_cpu ( cmd->cookie ) );
        DBGC2 ( intelxl, ":\n" );
 
+       /* Allow expected errors to be silenced */
+       silence = cmd->ret;
+       cmd->ret = 0;
+
        /* Sanity checks */
        assert ( ! ( cmd->flags & cpu_to_le16 ( INTELXL_ADMIN_FL_DD ) ) );
        assert ( ! ( cmd->flags & cpu_to_le16 ( INTELXL_ADMIN_FL_CMP ) ) );
        assert ( ! ( cmd->flags & cpu_to_le16 ( INTELXL_ADMIN_FL_ERR ) ) );
-       assert ( cmd->ret == 0 );
 
        /* Populate data buffer address if applicable */
        if ( cmd->flags & cpu_to_le16 ( INTELXL_ADMIN_FL_BUF ) ) {
@@ -419,8 +423,8 @@ int intelxl_admin_command ( struct intelxl_nic *intelxl ) {
                        goto err;
                }
 
-               /* Check for errors */
-               if ( cmd->ret != 0 ) {
+               /* Check for unexpected errors */
+               if ( ( cmd->ret != 0 ) && ( cmd->ret != silence ) ) {
                        DBGC ( intelxl, "INTELXL %p admin command %#x error "
                               "%d\n", intelxl, index,
                               le16_to_cpu ( cmd->ret ) );