Skip to content

Commit

Permalink
Updated all files from commit
Browse files Browse the repository at this point in the history
a7a9eb3107edae81f1f0508c79e2839f21209e92

Signed-off-by: Wissam Shoukair <wissams@mellanox.com>
  • Loading branch information
Wissam Shoukair committed Mar 22, 2016
1 parent 0e63043 commit 8414f98
Show file tree
Hide file tree
Showing 59 changed files with 1,818 additions and 1,039 deletions.
31 changes: 9 additions & 22 deletions src/arch/i386/interface/syslinux/comboot_call.c
Expand Up @@ -42,8 +42,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <ipxe/image.h>
#include <ipxe/version.h>
#include <usr/imgmgmt.h>
#include "config/console.h"
#include "config/serial.h"

/** The "SYSLINUX" version string */
static char __bss16_array ( syslinux_version, [32] );
Expand Down Expand Up @@ -262,18 +260,10 @@ static __asmcall void int21 ( struct i386_all_regs *ix86 ) {
break;

case 0x04: /* Write Character to Serial Port */
#ifdef CONSOLE_SERIAL
serial_putc ( ix86->regs.dl );
ix86->flags &= ~CF;
#else
{
static int printed = 0;
if ( ! printed ) {
printed = 1;
DBG ( "Serial console is disabled\n" );
}
if ( serial_console.base ) {
uart_transmit ( &serial_console, ix86->regs.dl );
ix86->flags &= ~CF;
}
#endif
break;

case 0x09: /* Write DOS String to Console */
Expand Down Expand Up @@ -466,15 +456,12 @@ static __asmcall void int22 ( struct i386_all_regs *ix86 ) {
break;

case 0x000B: /* Get Serial Console Configuration */
#if defined(CONSOLE_SERIAL) && !defined(COMPRESERVE)
ix86->regs.dx = COMCONSOLE;
ix86->regs.cx = 115200 / COMSPEED;
ix86->regs.bx = 0;
#else
ix86->regs.dx = 0;
#endif

ix86->flags &= ~CF;
if ( serial_console.base ) {
ix86->regs.dx = ( ( intptr_t ) serial_console.base );
ix86->regs.cx = serial_console.divisor;
ix86->regs.bx = 0;
ix86->flags &= ~CF;
}
break;
case 0x000C: /* Perform final cleanup */
shutdown_boot();
Expand Down
11 changes: 2 additions & 9 deletions src/arch/i386/prefix/mromprefix.S
Expand Up @@ -200,7 +200,7 @@ find_mem_bar:
movl %eax, %esi
addr32 es movzbl 2(%esi), %ecx
shll $7, %ecx
addr32 es movzbl 2(%esi,%ecx,4), %edx
addr32 es movzwl mpciheader_image_length(%esi,%ecx,4), %edx
shll $7, %edx
addl %edx, %ecx
addr32 es rep movsl
Expand Down Expand Up @@ -467,20 +467,13 @@ pci_set_mem_access:
.org 0x00
mromheader:
.word 0xaa55 /* BIOS extension signature */
mromheader_size: .byte 0 /* Size in 512-byte blocks */
.byte 0x01 /* Dummy size (BIOS bug workaround) */
.org 0x18
.word mpciheader
.org 0x1a
.word 0
.size mromheader, . - mromheader

.section ".zinfo.fixup", "a", @progbits /* Compressor fixups */
.ascii "APPB"
.long mromheader_size
.long 512
.long 0
.previous

mpciheader:
.ascii "PCIR" /* Signature */
.word pci_vendor_id /* Vendor identification */
Expand Down
130 changes: 49 additions & 81 deletions src/arch/i386/prefix/romprefix.S
Expand Up @@ -24,7 +24,6 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )
( PMM_HANDLE_BASE | 0x00001000 )
#define PMM_HANDLE_BASE_DECOMPRESS_TO \
( PMM_HANDLE_BASE | 0x00002000 )
#define PCI_FUNC_MASK 0x07

/* ROM banner timeout, converted to a number of (18Hz) timer ticks. */
#define ROM_BANNER_TIMEOUT_TICKS ( ( 18 * ROM_BANNER_TIMEOUT ) / 10 )
Expand Down Expand Up @@ -442,23 +441,27 @@ no_pmm:
popw %bx
#if ( ! defined ( MLX_QEMU ) && ! defined ( DEVICE_CIB ) )
#ifdef DEVICE_CX3
/*
* reading ppf to check if there is driver up
* having one indicates that this prefix is running while UEFI driver is up
* therefore we should not do any HCA commands, and gently continue (and posting BEV)
*/
call test_device_ownership
testl %eax, %eax
jnz 93f
call check_nv_cfg_en
call get_flexboot_menu_to
pushw %cs
call check_op_rom_en
#elif defined(DEVICE_CX4)
#elif defined(DEVICE_CX4)
call gw_get_cap_ofst
cmpb $0 ,mlx_cap_ofst
/* on error skip other functions */
je 93f
call check_nv_cfg_en
call get_flexboot_menu_to
/*push cs to make a 32 bit jump
#endif
/* push cs to make a 32 bit jump */
pushw %cs
call check_op_rom_en
*/

#endif
93:
#endif
popw %bx
Expand All @@ -478,11 +481,6 @@ no_pmm:
xorw %si, %si
xorw %di, %di
cs rep movsb
.endif
/* Skip prompt if this is not the first PCI function, if applicable */
.ifeqs BUSTYPE, "PCIR"
testb $PCI_FUNC_MASK, init_pci_busdevfn
jnz no_shell
.endif
/* check reasult and act according to it */
cmpw $0x0, (flexboot_menu_to)
Expand Down Expand Up @@ -908,11 +906,13 @@ exec_message_post_install:
*/
check_op_rom_en:
pushl %esi
#ifdef DEVICE_CX3
movl $1, %eax
/* get number of ports , store in %esi */
movl $1, %eax
call get_num_ports
cmpl $0xffffffff, %eax
je delete_bev

/* get port conf - start from port 1 */
movl %eax, %esi;
movl $1, %eax
Expand All @@ -925,6 +925,11 @@ port_loop:
incl %eax
decl %esi
jnz port_loop
#elif defined(DEVICE_CX4)
call check_host_op_rom_en
testl %eax, %eax
jnz 99f
#endif
delete_bev:
#ifndef MLX_QEMU
movl $0x0, %eax
Expand Down Expand Up @@ -1054,14 +1059,15 @@ my_pci_write_config_dword:
ret
.size my_pci_write_config_dword, . - my_pci_write_config_dword

#define TLV_ROM_BNR_TYPE 0x2010

#define TLV_ROM_BNR_ENTRY_OFST 0x2
#define INI_PARAM_ROM_BNR_MB_OFST 0x0
#define INI_PARAM_ROM_BNR_TO_BIT_OFST 16
#define DEFAULT_BANNER_TIMEOUT 14
#define ROM_BANNER_TO_TLV_MASK 0xf

#ifdef DEVICE_CX3
#define TLV_ROM_BNR_TYPE 0x2010
#define GW_ADDR_ADDR 0x58
#define GW_DATA_ADDR 0x5c
#define HCR_INPUT_H_OFFSET 0x80680
Expand All @@ -1072,7 +1078,7 @@ my_pci_write_config_dword:
#define HCR_OUTPUT_H_OFFSET 0x8068C
#define HCR_TOKEN_MOD_OFFSET 0x80694
#define HCR_OFFSET 0x80698

#define HCR_PPF_OFFSET 0x8069C
#define HCR_TOKEN 0xffff0000
#define HCR_OPMOD_SHIFT 12
#define HCR_T_BIT 21
Expand Down Expand Up @@ -1133,7 +1139,13 @@ cmd_pend:
ret
.size cmd_pend, . - cmd_pend

test_device_ownership:
movl $HCR_PPF_OFFSET, %eax
call gw_read_dword
ret
.size test_device_ownership, . - test_device_ownership


/*
* Description - check device NVMEM configuration enabled
* IN - NON
Expand Down Expand Up @@ -1632,7 +1644,8 @@ get_num_ports:
addl $24, %esp
cmpl $0xffffffff, %eax
je 99f
shrl $16, %eax
shrl $16, %eax
andl $0xff, %eax
99:
ret
.size get_num_ports, . -get_num_ports
Expand Down Expand Up @@ -1663,8 +1676,7 @@ get_tlv_value:
orl %ss:6(%ebp), %eax
pushl %eax
/* in_param_l */
shll $16, %eax
orl %ss:10(%ebp), %eax
movl %ss:10(%ebp), %eax
pushl %eax /* dword offset */
/* in_param_h */
pushl $0
Expand Down Expand Up @@ -1838,6 +1850,8 @@ gw_write_dword: //offset at eax (HCR)!
.size gw_write_dword, . - gw_write_dword

#elif defined(DEVICE_CX4) || defined(DEVICE_CIB)
#define TLV_ROM_BNR_TYPE 0x210

/*
* Description - check device NVMEM configuration enabled
* IN - NON
Expand Down Expand Up @@ -1872,16 +1886,15 @@ get_flexboot_menu_to:
pushl $TLV_ROM_BNR_ENTRY_OFST
/* push TLV type to the stack */
pushl $TLV_ROM_BNR_TYPE
/* port number is passed in %eax*/
movl $0x1, %eax
/* port zero cause per host class */
movl $0x0, %eax
call get_tlv_value
/* pop passed parameter */
addl $8 , %esp
/* wanted result should be in lower dword */
popl %eax
/* %eax holds the wanted parameter */
andl $ROM_BANNER_TO_TLV_MASK, %eax

#ifdef MLX_QEMU
/* due to a bug in QEMU running enviourment make sure time out is not zero */
movl $12, %eax
Expand All @@ -1903,35 +1916,36 @@ get_flexboot_menu_to:
* read TLV , no TLV read INI.
* if NO TLV & INI return dis (0)
*
* IN - eax : port number
* IN - NONE
* OUT - eax : en(1) / dis (0)
*
*/
#define BOOT_SETTINGS_TYPE 0x2021
#define BOOT_SETTINGS_TYPE 0x221
#define OP_ROM_EN_INI_MASK 0x20000000
#define OP_ROM_EN_TLV_MASK 0x80ff0000
#define OP_ROM_EN_TLV_OFST 0x2
check_port_en:
check_host_op_rom_en:
/* save edx/eax/ecx register to stack */
pushl %edx
pushl %ecx
/* place holder low dword of 64 bit value */
pushl $0xffffffff
/* push TLV type to the stack */
pushl $BOOT_SETTINGS_TYPE
/* push TLV entry offset */
pushl $OP_ROM_EN_TLV_OFST
/* push port number */
pushl %eax
/* push TLV type to the stack */
pushl $BOOT_SETTINGS_TYPE
/* port zero cause per host class */
movl $0x0, %eax
call get_tlv_value
/* pop passed parameter */
addl $8 , %esp
addl $8, %esp
/* pop resault */
popl %ecx
/* check failure */
cmpl $0xffffffff, %eax
je 98f
/* value was read from TLV */
/* align wanted word to first word */
shrl $16, %ecx
/* save option rom enable bit value */
movl %ecx, %edx
/* legacy boot protocol check */
Expand All @@ -1947,41 +1961,7 @@ check_port_en:
popl %ecx
popl %edx
ret
.size check_port_en, . -check_port_en


/*
* Description - Read numer of ports using mod_stat
* IN - eax : port number
* OUT - eax : number of ports
*/
get_num_ports:
/* place holder for the lower part of the 64 bit value returned. */
pushl $0x0
/* opcode */
//pushl $MLX4_CMD_MOD_STAT_CFG
/* opcode modifier */
//pushl $MOD_STAT_CFG_GET_INLINE_MOD
/* input_mod */
shll $8, %eax
//orl $MOD_STAT_CFG_MAC_NUM_PORTS_OFFSET, %eax
pushl %eax
/* in_param_l */
pushl $0
/* in_param_h */
pushl $0
/* invoke command */
//call hca_cmd
addl $24, %esp
movl $0x10000, %eax
cmpl $0xffffffff, %eax
je 99f
shrl $16, %eax
99:
ret
.size get_num_ports, . -get_num_ports


.size check_host_op_rom_en, . -check_host_op_rom_en

#define MLX_ICMD_SEMAPHORE_ADDR 0x0
#define COMMON_SEMAPHORES_FLASH_PROGRAMMING_OFST 0x10
Expand Down Expand Up @@ -2189,7 +2169,6 @@ gw_write_to_space:
/* write data */
call my_pci_write_config_dword


/* set flag bit to monitor later for successful space write access */
movzbw mlx_cap_ofst, %di
addw $MLX_CAP_ADDR_OFST, %di
Expand Down Expand Up @@ -2532,8 +2511,6 @@ write_nv_access:
/* first dword all zero except over_en bit */
movl $0x02000000, %esi
orl %ss:14(%ebp), %esi
//orl $0x4, %esi
//movl $0x02000004, %esi
movw $PCI_GW_SPACE_ALL_ICMD, %ax
movl $NV_ACCESS_BASE_OFFSET, %edx
call gw_write_to_space
Expand All @@ -2544,8 +2521,8 @@ write_nv_access:
shll $NV_ACCESS_PORT_ALIGN, %esi
/* TLV type in first byte */
orl %ss:6(%ebp), %esi
/* set class byte*/
orl $0x01000000, %esi
/* set param class byte ( set to per host) */
orl $0x03000000, %esi
addl $0x4, %edx
call gw_write_to_space

Expand All @@ -2563,7 +2540,7 @@ write_nv_access:
.size write_nv_access, . - write_nv_access

/*
* IN - eax : port number or 0 for globals
* IN - eax : port number or 0 for NON per port settings
%esp :
* [esp] + 2 = TLV_TYPE
* [esp] + 6 = TLV_ENTRY_OFFST
Expand Down Expand Up @@ -2624,15 +2601,6 @@ get_tlv_value:
pushl %esi
call write_nv_access
addl $12, %esp

/* push data value */
/*
movl $0x0, %esi
movw $PCI_GW_SPACE_ALL_ICMD, %ax
movl $TLV_ENTRIES_BASE_OFFSET, %edx
addl %ss:10(%ebp), %edx
call gw_write_to_space
*/
/* run icmd give a go bit %eax will hold the return code*/
/* busy is set to 1 */
pushl $0x1
Expand Down

0 comments on commit 8414f98

Please sign in to comment.