iPXE
Data Structures | Macros | Enumerations | Functions
mlx_icmd.h File Reference
#include "mlx_utils.h"

Go to the source code of this file.

Data Structures

struct  mlx_icmd_ocsd
 

Macros

#define MLX_ICMD_MB_ADDR   0x100000
 
#define MLX_ICMD_MB_SIZE_ADDR   0x1000
 
#define MLX_ICMD_CTRL_ADDR   0x0
 
#define MLX_ICMD_SEMAPHORE_ADDR   0x0
 
#define MLX_ICMD_SEMAPHORE_ID   1234
 

Enumerations

enum  {
  FLASH_REG_ACCESS = 0x9001, GET_FW_INFO = 0x8007, QUERY_VIRTUAL_MAC = 0x9003, SET_VIRTUAL_MAC = 0x9004,
  QUERY_WOL_ROL = 0x9005, SET_WOL_ROL = 0x9006, OCBB_INIT = 0x9007, OCBB_QUERY_HEADER_STATUS = 0x9008,
  OCBB_QUERY_ETOC_STATUS = 0x9009, OCBB_QUERY_SET_EVENT = 0x900A, OCSD_INIT = 0xf004
}
 

Functions

 FILE_LICENCE (GPL2_OR_LATER)
 
mlx_status mlx_icmd_send_command (IN mlx_utils *utils, IN mlx_uint16 opcode, IN OUT mlx_void *data, IN mlx_uint32 write_data_size, IN mlx_uint32 read_data_size)
 

Macro Definition Documentation

◆ MLX_ICMD_MB_ADDR

#define MLX_ICMD_MB_ADDR   0x100000

Definition at line 27 of file mlx_icmd.h.

◆ MLX_ICMD_MB_SIZE_ADDR

#define MLX_ICMD_MB_SIZE_ADDR   0x1000

Definition at line 28 of file mlx_icmd.h.

◆ MLX_ICMD_CTRL_ADDR

#define MLX_ICMD_CTRL_ADDR   0x0

Definition at line 29 of file mlx_icmd.h.

◆ MLX_ICMD_SEMAPHORE_ADDR

#define MLX_ICMD_SEMAPHORE_ADDR   0x0

Definition at line 31 of file mlx_icmd.h.

◆ MLX_ICMD_SEMAPHORE_ID

#define MLX_ICMD_SEMAPHORE_ID   1234

Definition at line 33 of file mlx_icmd.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
FLASH_REG_ACCESS 
GET_FW_INFO 
QUERY_VIRTUAL_MAC 
SET_VIRTUAL_MAC 
QUERY_WOL_ROL 
SET_WOL_ROL 
OCBB_INIT 
OCBB_QUERY_HEADER_STATUS 
OCBB_QUERY_ETOC_STATUS 
OCBB_QUERY_SET_EVENT 
OCSD_INIT 

Definition at line 35 of file mlx_icmd.h.

35  {
36  FLASH_REG_ACCESS = 0x9001,
37  GET_FW_INFO = 0x8007,
38  QUERY_VIRTUAL_MAC = 0x9003,
39  SET_VIRTUAL_MAC = 0x9004,
40  QUERY_WOL_ROL = 0x9005,
41  SET_WOL_ROL = 0x9006,
42  OCBB_INIT = 0x9007,
43  OCBB_QUERY_HEADER_STATUS = 0x9008,
44  OCBB_QUERY_ETOC_STATUS = 0x9009,
45  OCBB_QUERY_SET_EVENT = 0x900A,
46  OCSD_INIT = 0xf004,
47 };

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER  )

◆ mlx_icmd_send_command()

mlx_status mlx_icmd_send_command ( IN mlx_utils utils,
IN mlx_uint16  opcode,
IN OUT mlx_void data,
IN mlx_uint32  write_data_size,
IN mlx_uint32  read_data_size 
)

Definition at line 310 of file mlx_icmd.c.

317 {
319  mlx_uint32 icmd_status = 0;
320 
321  if (utils == NULL || data == NULL) {
323  goto invalid_param;
324  }
325  status = mlx_icmd_init(utils);
326  MLX_CHECK_STATUS(utils, status, open_err, "failed to open icmd");
327 
328  if (write_data_size > utils->icmd.max_cmd_size ||
329  read_data_size > utils->icmd.max_cmd_size) {
331  goto size_err;
332  }
333 
335  MLX_CHECK_STATUS(utils, status, semaphore_err, "failed to get icmd semaphore");
336 
338  MLX_CHECK_STATUS(utils, status, opcode_err, "failed to set icmd opcode");
339 
340  if (write_data_size != 0) {
341  status = mlx_icmd_write_buffer(utils, data, write_data_size);
342  MLX_CHECK_STATUS(utils, status, opcode_err, "failed to write icmd MB");
343  }
344 
345  status = mlx_icmd_go(utils);
346  MLX_CHECK_STATUS(utils, status, go_err, "failed to activate icmd");
347 
348  status = mlx_icmd_get_status(utils, &icmd_status);
349  MLX_CHECK_STATUS(utils, status, get_status_err, "failed to set icmd opcode");
350 
351  if (icmd_status != 0) {
352  MLX_DEBUG_ERROR(utils, "icmd failed with status = %d\n", icmd_status);
353  status = MLX_FAILED;
354  goto icmd_failed;
355  }
356  if (read_data_size != 0) {
357  status = mlx_icmd_read_buffer(utils, data, read_data_size);
358  MLX_CHECK_STATUS(utils, status, read_err, "failed to read icmd MB");
359  }
360 read_err:
361 icmd_failed:
362 get_status_err:
363 go_err:
364 opcode_err:
366 semaphore_err:
367 size_err:
368 open_err:
369 invalid_param:
370  return status;
371 }
uint8_t opcode
Opcode.
Definition: ena.h:16
#define MLX_INVALID_PARAMETER
static mlx_status mlx_icmd_init(IN mlx_utils *utils)
Definition: mlx_icmd.c:105
uint8_t status
Status.
Definition: ena.h:16
uint32_t mlx_uint32
#define MLX_SUCCESS
static mlx_status mlx_icmd_get_status(IN mlx_utils *utils, OUT mlx_uint32 *out_status)
Definition: mlx_icmd.c:226
static mlx_status mlx_icmd_set_opcode(IN mlx_utils *utils, IN mlx_uint16 opcode)
Definition: mlx_icmd.c:134
#define MLX_FAILED
static mlx_status mlx_icmd_go(IN mlx_utils *utils)
Definition: mlx_icmd.c:168
static mlx_status mlx_icmd_read_buffer(IN mlx_utils *utils, OUT mlx_void *data, IN mlx_uint32 data_size)
Definition: mlx_icmd.c:284
static mlx_status mlx_icmd_get_semaphore(IN mlx_utils *utils)
Definition: mlx_icmd.c:30
static mlx_status mlx_icmd_write_buffer(IN mlx_utils *utils, IN mlx_void *data, IN mlx_uint32 data_size)
Definition: mlx_icmd.c:255
#define MLX_DEBUG_ERROR(...)
Definition: mlx_logging.h:29
int mlx_status
struct arbelprm_port_state_change_st data
Message.
Definition: arbel.h:12
static mlx_status mlx_icmd_clear_semaphore(IN mlx_utils *utils)
Definition: mlx_icmd.c:78
#define MLX_CHECK_STATUS(id, status, label, message)
Definition: mlx_bail.h:37
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362

References data, MLX_CHECK_STATUS, MLX_DEBUG_ERROR, MLX_FAILED, mlx_icmd_clear_semaphore(), mlx_icmd_get_semaphore(), mlx_icmd_get_status(), mlx_icmd_go(), mlx_icmd_init(), mlx_icmd_read_buffer(), mlx_icmd_set_opcode(), mlx_icmd_write_buffer(), MLX_INVALID_PARAMETER, MLX_SUCCESS, NULL, opcode, and status.

Referenced by mlx_reg_access(), mlx_vmac_query_virt_mac(), and mlx_vmac_set_virt_mac().