Print this page
9724 qede needs updates for newer GCC
*** 31,40 ****
--- 31,43 ----
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+ /*
+ * Copyright 2018 Joyent, Inc.
+ */
#include "qede.h"
#define FP_LOCK(ptr) \
mutex_enter(&ptr->fp_lock);
*** 1261,1271 ****
*/
static enum ioc_reply
qede_set_loopback_mode(qede_t *qede, uint32_t mode)
{
! int ret, i = 0;
struct ecore_dev *edev = &qede->edev;
struct ecore_hwfn *hwfn;
struct ecore_ptt *ptt = NULL;
struct ecore_mcp_link_params *link_params;
--- 1264,1274 ----
*/
static enum ioc_reply
qede_set_loopback_mode(qede_t *qede, uint32_t mode)
{
! int i = 0;
struct ecore_dev *edev = &qede->edev;
struct ecore_hwfn *hwfn;
struct ecore_ptt *ptt = NULL;
struct ecore_mcp_link_params *link_params;
*** 1288,1298 ****
}
i = 0;
link_params->loopback_mode = ETH_LOOPBACK_NONE;
qede->loop_back_mode = QEDE_LOOP_NONE;
! ret = ecore_mcp_set_link(hwfn, ptt, 1);
ecore_ptt_release(hwfn, ptt);
while (!qede->params.link_state && i < 5000) {
OSAL_MSLEEP(1);
i++;
--- 1291,1301 ----
}
i = 0;
link_params->loopback_mode = ETH_LOOPBACK_NONE;
qede->loop_back_mode = QEDE_LOOP_NONE;
! (void) ecore_mcp_set_link(hwfn, ptt, 1);
ecore_ptt_release(hwfn, ptt);
while (!qede->params.link_state && i < 5000) {
OSAL_MSLEEP(1);
i++;
*** 1309,1319 ****
i++;
}
i = 0;
link_params->loopback_mode = ETH_LOOPBACK_INT_PHY;
qede->loop_back_mode = QEDE_LOOP_INTERNAL;
! ret = ecore_mcp_set_link(hwfn, ptt, 1);
ecore_ptt_release(hwfn, ptt);
while(!qede->params.link_state && i < 5000) {
OSAL_MSLEEP(1);
i++;
--- 1312,1322 ----
i++;
}
i = 0;
link_params->loopback_mode = ETH_LOOPBACK_INT_PHY;
qede->loop_back_mode = QEDE_LOOP_INTERNAL;
! (void) ecore_mcp_set_link(hwfn, ptt, 1);
ecore_ptt_release(hwfn, ptt);
while(!qede->params.link_state && i < 5000) {
OSAL_MSLEEP(1);
i++;
*** 1462,1472 ****
qede_ioctl_rd_wr_nvram(qede_t *qede, mblk_t *mp)
{
qede_nvram_data_t *data1 = (qede_nvram_data_t *)(mp->b_cont->b_rptr);
qede_nvram_data_t *data2, *next_data;
struct ecore_dev *edev = &qede->edev;
! uint32_t ret = 0, hdr_size = 24, bytes_to_copy, copy_len = 0;
uint32_t copy_len1 = 0;
uint32_t addr = data1->off;
uint32_t size = data1->size, i, buf_size;
uint8_t cmd, cmd2;
uint8_t *buf, *tmp_buf;
--- 1465,1475 ----
qede_ioctl_rd_wr_nvram(qede_t *qede, mblk_t *mp)
{
qede_nvram_data_t *data1 = (qede_nvram_data_t *)(mp->b_cont->b_rptr);
qede_nvram_data_t *data2, *next_data;
struct ecore_dev *edev = &qede->edev;
! uint32_t hdr_size = 24, bytes_to_copy, copy_len = 0;
uint32_t copy_len1 = 0;
uint32_t addr = data1->off;
uint32_t size = data1->size, i, buf_size;
uint8_t cmd, cmd2;
uint8_t *buf, *tmp_buf;
*** 1480,1497 ****
if(buf == NULL) {
cmn_err(CE_WARN, "memory allocation failed"
" in nvram read ioctl\n");
return (DDI_FAILURE);
}
! ret = ecore_mcp_nvm_read(edev, addr, buf, data1->size);
copy_len = (MBLKL(mp->b_cont)) - hdr_size;
if(copy_len > size) {
(void) memcpy(data1->uabc, buf, size);
kmem_free(buf, size);
//OSAL_FREE(edev, buf);
- ret = 0;
break;
}
(void) memcpy(data1->uabc, buf, copy_len);
bytes_to_copy = size - copy_len;
tmp_buf = ((uint8_t *)buf) + copy_len;
--- 1483,1499 ----
if(buf == NULL) {
cmn_err(CE_WARN, "memory allocation failed"
" in nvram read ioctl\n");
return (DDI_FAILURE);
}
! (void) ecore_mcp_nvm_read(edev, addr, buf, data1->size);
copy_len = (MBLKL(mp->b_cont)) - hdr_size;
if(copy_len > size) {
(void) memcpy(data1->uabc, buf, size);
kmem_free(buf, size);
//OSAL_FREE(edev, buf);
break;
}
(void) memcpy(data1->uabc, buf, copy_len);
bytes_to_copy = size - copy_len;
tmp_buf = ((uint8_t *)buf) + copy_len;
*** 1527,1537 ****
cmd2 = (uint8_t )data1->cmd2;
size = data1->size;
addr = data1->off;
buf_size = size; //data1->buf_size;
//buf_size = data1->buf_size;
- ret = 0;
switch(cmd2){
case START_NVM_WRITE:
buf = kmem_zalloc(size, GFP_KERNEL);
//buf = qede->reserved_buf;
--- 1529,1538 ----
*** 1545,1555 ****
cmn_err(CE_NOTE,
"buf = %p, size = %x\n", qede->nvm_buf_start, size);
qede->nvm_buf = buf;
qede->copy_len = 0;
//tmp_buf = buf + addr;
- ret = 0;
break;
case ACCUMULATE_NVM_BUF:
tmp_buf = qede->nvm_buf;
copy_len = MBLKL(mp->b_cont) - hdr_size;
--- 1546,1555 ----
*** 1567,1577 ****
tmp_buf = tmp_buf + buf_size;
qede->nvm_buf = tmp_buf;
//qede->copy_len = qede->copy_len + buf_size;
cmn_err(CE_NOTE,
"buf_size from app = %x\n", copy_len);
- ret = 0;
break;
}
(void) memcpy(tmp_buf, data1->uabc, copy_len);
tmp_buf = tmp_buf + copy_len;
bytes_to_copy = buf_size - copy_len;
--- 1567,1576 ----
*** 1588,1598 ****
if (copy_len > bytes_to_copy){
(void) memcpy(tmp_buf, next_data->uabc,
bytes_to_copy);
qede->copy_len = qede->copy_len +
bytes_to_copy;
- ret = 0;
break;
}
(void) memcpy(tmp_buf, next_data->uabc,
copy_len);
qede->copy_len = qede->copy_len + copy_len;
--- 1587,1596 ----
*** 1600,1656 ****
copy_len = copy_len1 + copy_len;
bytes_to_copy = bytes_to_copy - copy_len;
mp1 = mp1->b_cont;
}
qede->nvm_buf = tmp_buf;
- ret = 0;
break;
case STOP_NVM_WRITE:
//qede->nvm_buf = tmp_buf;
- ret = 0;
break;
case READ_BUF:
tmp_buf = (uint8_t *)qede->nvm_buf_start;
for(i = 0; i < size ; i++){
cmn_err(CE_NOTE,
"buff (%d) : %d\n", i, *tmp_buf);
tmp_buf ++;
}
- ret = 0;
break;
}
break;
case QEDE_NVRAM_CMD_PUT_FILE_DATA:
tmp_buf = qede->nvm_buf_start;
! ret = ecore_mcp_nvm_write(edev, ECORE_PUT_FILE_DATA,
addr, tmp_buf, size);
kmem_free(qede->nvm_buf_start, size);
//OSAL_FREE(edev, tmp_buf);
cmn_err(CE_NOTE, "total size = %x, copied size = %x\n",
qede->nvm_buf_size, qede->copy_len);
tmp_buf = NULL;
qede->nvm_buf = NULL;
qede->nvm_buf_start = NULL;
- ret = 0;
break;
case QEDE_NVRAM_CMD_SET_SECURE_MODE:
! ret = ecore_mcp_nvm_set_secure_mode(edev, addr);
break;
case QEDE_NVRAM_CMD_DEL_FILE:
! ret = ecore_mcp_nvm_del_file(edev, addr);
break;
case QEDE_NVRAM_CMD_PUT_FILE_BEGIN:
! ret = ecore_mcp_nvm_put_file_begin(edev, addr);
break;
case QEDE_NVRAM_CMD_GET_NVRAM_RESP:
buf = kmem_zalloc(size, KM_SLEEP);
! ret = ecore_mcp_nvm_resp(edev, buf);
(void)memcpy(data1->uabc, buf, size);
kmem_free(buf, size);
break;
default:
--- 1598,1650 ----
copy_len = copy_len1 + copy_len;
bytes_to_copy = bytes_to_copy - copy_len;
mp1 = mp1->b_cont;
}
qede->nvm_buf = tmp_buf;
break;
case STOP_NVM_WRITE:
//qede->nvm_buf = tmp_buf;
break;
case READ_BUF:
tmp_buf = (uint8_t *)qede->nvm_buf_start;
for(i = 0; i < size ; i++){
cmn_err(CE_NOTE,
"buff (%d) : %d\n", i, *tmp_buf);
tmp_buf ++;
}
break;
}
break;
case QEDE_NVRAM_CMD_PUT_FILE_DATA:
tmp_buf = qede->nvm_buf_start;
! (void) ecore_mcp_nvm_write(edev, ECORE_PUT_FILE_DATA,
addr, tmp_buf, size);
kmem_free(qede->nvm_buf_start, size);
//OSAL_FREE(edev, tmp_buf);
cmn_err(CE_NOTE, "total size = %x, copied size = %x\n",
qede->nvm_buf_size, qede->copy_len);
tmp_buf = NULL;
qede->nvm_buf = NULL;
qede->nvm_buf_start = NULL;
break;
case QEDE_NVRAM_CMD_SET_SECURE_MODE:
! (void) ecore_mcp_nvm_set_secure_mode(edev, addr);
break;
case QEDE_NVRAM_CMD_DEL_FILE:
! (void) ecore_mcp_nvm_del_file(edev, addr);
break;
case QEDE_NVRAM_CMD_PUT_FILE_BEGIN:
! (void) ecore_mcp_nvm_put_file_begin(edev, addr);
break;
case QEDE_NVRAM_CMD_GET_NVRAM_RESP:
buf = kmem_zalloc(size, KM_SLEEP);
! (void) ecore_mcp_nvm_resp(edev, buf);
(void)memcpy(data1->uabc, buf, size);
kmem_free(buf, size);
break;
default: