/*
* Copyright (c) 2012-2015 Solarflare Communications Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are
* those of the authors and should not be interpreted as representing official
* policies, either expressed or implied, of the FreeBSD Project.
*/
#include "efx.h"
#include "efx_impl.h"
#if EFSYS_OPT_MCDI
#ifndef WITH_MCDI_V2
#error "WITH_MCDI_V2 required for EF10 MCDIv2 commands."
#endif
{
/*
* All EF10 firmware supports MCDIv2 and MCDIv1.
* Medford BootROM supports MCDIv2 and MCDIv1.
* Huntington BootROM supports MCDIv1 only.
*/
/* A host DMA buffer is required for EF10 MCDI */
goto fail1;
}
/*
* Ensure that the MC doorbell is in a known state before issuing MCDI
* commands. The recovery algorithm requires that the MC command buffer
* must be 256 byte aligned. See bug24769.
*/
goto fail2;
}
/* Save initial MC reboot status */
(void) ef10_mcdi_poll_reboot(enp);
/* Start a new epoch (allow fresh MCDI requests to succeed) */
return (0);
return (rc);
}
void
{
}
void
{
unsigned int pos;
/* Write the header */
}
/* Write the payload */
}
/* Guarantee ordering of memory (MCDI request) and PIO (MC doorbell) */
/* Ring the doorbell to post the command DMA address to the MC */
}
{
}
void
{
unsigned int pos;
}
}
{
/* Update MC reboot status word */
/* MC has rebooted if the value has changed */
if (new_status != old_status) {
/*
* FIXME: Ignore detected MC REBOOT for now.
*
* The Siena support for checking for MC reboot from status
* flags is broken - see comments in siena_mcdi_poll_reboot().
* As the generic MCDI code is shared the EF10 reboot
* detection suffers similar problems.
*
* Do not report an error when the boot status changes until
* this can be handled by common code drivers (and reworked to
* support Siena too).
*/
if (B_FALSE) {
goto fail1;
}
}
return (0);
return (rc);
}
{
/*
* Use privilege mask state at MCDI attach.
*/
switch (id) {
/*
* Admin privilege must be used prior to introduction of
* specific flag.
*/
*supportedp =
break;
/*
* Admin privilege used prior to introduction of
* specific flag.
*/
*supportedp =
break;
/*
* Admin privilege must be used prior to introduction of
* mac spoofing privilege (at v4.6), which is used up to
* introduction of change mac spoofing privilege (at v4.7)
*/
*supportedp =
break;
/*
* Admin privilege must be used prior to introduction of
* mac spoofing privilege (at v4.6), which is used up to
* introduction of mac spoofing TX privilege (at v4.7)
*/
*supportedp =
break;
default:
goto fail1;
}
return (0);
return (rc);
}
#endif /* EFSYS_OPT_MCDI */
#endif /* EFSYS_OPT_HUNTINGTON || EFSYS_OPT_MEDFORD */