iPXE
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.

Referenced by mlx_icmd_read_buffer(), and mlx_icmd_write_buffer().

◆ MLX_ICMD_MB_SIZE_ADDR

#define MLX_ICMD_MB_SIZE_ADDR   0x1000

Definition at line 28 of file mlx_icmd.h.

Referenced by mlx_icmd_init().

◆ MLX_ICMD_CTRL_ADDR

#define MLX_ICMD_CTRL_ADDR   0x0

Definition at line 29 of file mlx_icmd.h.

Referenced by mlx_icmd_get_status(), mlx_icmd_go(), and mlx_icmd_set_opcode().

◆ MLX_ICMD_SEMAPHORE_ADDR

#define MLX_ICMD_SEMAPHORE_ADDR   0x0

Definition at line 31 of file mlx_icmd.h.

Referenced by mlx_icmd_clear_semaphore(), and mlx_icmd_get_semaphore().

◆ 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,
45 OCBB_QUERY_SET_EVENT = 0x900A,
46 OCSD_INIT = 0xf004,
47};
@ OCBB_INIT
Definition mlx_icmd.h:42
@ GET_FW_INFO
Definition mlx_icmd.h:37
@ QUERY_WOL_ROL
Definition mlx_icmd.h:40
@ SET_WOL_ROL
Definition mlx_icmd.h:41
@ OCBB_QUERY_SET_EVENT
Definition mlx_icmd.h:45
@ OCSD_INIT
Definition mlx_icmd.h:46
@ OCBB_QUERY_HEADER_STATUS
Definition mlx_icmd.h:43
@ OCBB_QUERY_ETOC_STATUS
Definition mlx_icmd.h:44
@ QUERY_VIRTUAL_MAC
Definition mlx_icmd.h:38
@ FLASH_REG_ACCESS
Definition mlx_icmd.h:36
@ SET_VIRTUAL_MAC
Definition mlx_icmd.h:39

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);
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 }
360read_err:
361icmd_failed:
362get_status_err:
363go_err:
364opcode_err:
366semaphore_err:
367size_err:
368open_err:
369invalid_param:
370 return status;
371}
#define NULL
NULL pointer (VOID *)
Definition Base.h:322
uint8_t data[48]
Additional event data.
Definition ena.h:11
uint8_t status
Status.
Definition ena.h:5
uint8_t opcode
Opcode.
Definition ena.h:5
#define MLX_CHECK_STATUS(id, status, label, message)
Definition mlx_bail.h:37
static mlx_status mlx_icmd_go(IN mlx_utils *utils)
Definition mlx_icmd.c:168
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
static mlx_status mlx_icmd_clear_semaphore(IN mlx_utils *utils)
Definition mlx_icmd.c:78
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
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_init(IN mlx_utils *utils)
Definition mlx_icmd.c:105
static mlx_status mlx_icmd_get_semaphore(IN mlx_utils *utils)
Definition mlx_icmd.c:30
#define MLX_DEBUG_ERROR(...)
Definition mlx_logging.h:29
uint32_t mlx_uint32
#define MLX_FAILED
#define MLX_INVALID_PARAMETER
#define MLX_SUCCESS
int mlx_status

References data, IN, 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, OUT, and status.

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