/*
* Copyright (c) 2008-2016 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 <sys/sysmacros.h>
#include "sfxge.h"
#include "efx.h"
/*
* All efx_phy_*() must be after efx_port_init()
*
* LOCKING STRATEGY: Aquire sm_lock and test sm_state==SFXGE_MAC_STARTED
* to serialise against sfxge_restart()
*
* Note that there is no seperate PHY lock
* Everything is driven from MAC code and the MAC lock is used
*/
/* PHY DMA attributes */
DDI_DEVICE_ATTR_V0, /* devacc_attr_version */
DDI_NEVERSWAP_ACC, /* devacc_attr_endian_flags */
DDI_STRICTORDER_ACC /* devacc_attr_dataorder */
};
DMA_ATTR_V0, /* dma_attr_version */
0, /* dma_attr_addr_lo */
0xffffffffffffffffull, /* dma_attr_addr_hi */
0xffffffffffffffffull, /* dma_attr_count_max */
0x1000, /* dma_attr_align */
0xffffffff, /* dma_attr_burstsizes */
1, /* dma_attr_minxfer */
0xffffffffffffffffull, /* dma_attr_maxxfer */
0xffffffffffffffffull, /* dma_attr_seg */
1, /* dma_attr_sgllen */
1, /* dma_attr_granular */
0 /* dma_attr_flags */
};
static int
{
if (rw != KSTAT_READ) {
goto fail1;
}
goto done;
/* Synchronize the DMA memory for reading */
!= 0)
goto fail2;
knp++;
}
done:
return (0);
return (rc);
}
int
{
unsigned int id;
int rc;
KM_NOSLEEP)) == NULL) {
goto fail1;
}
encp->enc_phy_name);
/* Create the set */
goto fail2;
}
/* Initialise the named stats */
knp++;
}
return (0);
return (rc);
}
void
{
/* Destroy the set */
}
int
{
int rc;
goto fail1;
return (0);
return (rc);
}
{
goto done;
done:
}
/*
* Set up the advertised capabilities that may have been asked for
* when the mac was not in the state SFXGE_MAC_STARTED.
* Must be called after efx_port_init().
*/
int
{
int rc;
int err;
if (use_default)
else
smp->sm_phy_cap_to_set = 0;
smp->sm_phy_cap_to_unset = 0;
/*
* The configuation wasn't accepted, so set to
* defaults.
*/
goto fail1;
"Setting of advertised link capabilities failed. "
"Using default settings. "
"(Requested 0x%x Given 0x%x Supported 0x%x)",
} else {
goto fail2;
}
}
return (0);
return (rc);
}
{
goto done;
done:
if (mutablep)
}
int
{
int rc = 0;
/* Store the request for when the mac is started */
if (set)
else
goto done;
}
if (set)
else
done:
return (rc);
}
void
{
}