2008-05-16 18:46:30 +00:00
|
|
|
/******************************************************************************
|
2007-07-11 23:03:16 +00:00
|
|
|
|
2017-12-20 18:15:06 +00:00
|
|
|
Copyright (c) 2001-2017, Intel Corporation
|
2007-07-11 23:03:16 +00:00
|
|
|
All rights reserved.
|
2017-12-20 18:15:06 +00:00
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with or without
|
2007-07-11 23:03:16 +00:00
|
|
|
modification, are permitted provided that the following conditions are met:
|
2017-12-20 18:15:06 +00:00
|
|
|
|
|
|
|
1. Redistributions of source code must retain the above copyright notice,
|
2007-07-11 23:03:16 +00:00
|
|
|
this list of conditions and the following disclaimer.
|
2017-12-20 18:15:06 +00:00
|
|
|
|
|
|
|
2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
notice, this list of conditions and the following disclaimer in the
|
2007-07-11 23:03:16 +00:00
|
|
|
documentation and/or other materials provided with the distribution.
|
2017-12-20 18:15:06 +00:00
|
|
|
|
|
|
|
3. Neither the name of the Intel Corporation nor the names of its
|
|
|
|
contributors may be used to endorse or promote products derived from
|
2007-07-11 23:03:16 +00:00
|
|
|
this software without specific prior written permission.
|
2017-12-20 18:15:06 +00:00
|
|
|
|
2007-07-11 23:03:16 +00:00
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
2017-12-20 18:15:06 +00:00
|
|
|
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)
|
2007-07-11 23:03:16 +00:00
|
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
2008-05-16 18:46:30 +00:00
|
|
|
******************************************************************************/
|
|
|
|
/*$FreeBSD$*/
|
2015-12-23 22:45:17 +00:00
|
|
|
|
|
|
|
#include "ixgbe.h"
|
|
|
|
|
|
|
|
inline u16
|
|
|
|
ixgbe_read_pci_cfg(struct ixgbe_hw *hw, u32 reg)
|
|
|
|
{
|
2017-07-05 17:27:03 +00:00
|
|
|
return pci_read_config(((struct adapter *)hw->back)->dev, reg, 2);
|
2015-12-23 22:45:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
ixgbe_write_pci_cfg(struct ixgbe_hw *hw, u32 reg, u16 value)
|
|
|
|
{
|
2017-07-05 17:27:03 +00:00
|
|
|
pci_write_config(((struct adapter *)hw->back)->dev, reg, value, 2);
|
2015-12-23 22:45:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline u32
|
|
|
|
ixgbe_read_reg(struct ixgbe_hw *hw, u32 reg)
|
|
|
|
{
|
|
|
|
return bus_space_read_4(((struct adapter *)hw->back)->osdep.mem_bus_space_tag,
|
2017-07-05 17:27:03 +00:00
|
|
|
((struct adapter *)hw->back)->osdep.mem_bus_space_handle, reg);
|
2015-12-23 22:45:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
ixgbe_write_reg(struct ixgbe_hw *hw, u32 reg, u32 val)
|
|
|
|
{
|
|
|
|
bus_space_write_4(((struct adapter *)hw->back)->osdep.mem_bus_space_tag,
|
|
|
|
((struct adapter *)hw->back)->osdep.mem_bus_space_handle,
|
|
|
|
reg, val);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline u32
|
|
|
|
ixgbe_read_reg_array(struct ixgbe_hw *hw, u32 reg, u32 offset)
|
|
|
|
{
|
|
|
|
return bus_space_read_4(((struct adapter *)hw->back)->osdep.mem_bus_space_tag,
|
|
|
|
((struct adapter *)hw->back)->osdep.mem_bus_space_handle,
|
|
|
|
reg + (offset << 2));
|
|
|
|
}
|
|
|
|
|
|
|
|
inline void
|
|
|
|
ixgbe_write_reg_array(struct ixgbe_hw *hw, u32 reg, u32 offset, u32 val)
|
|
|
|
{
|
|
|
|
bus_space_write_4(((struct adapter *)hw->back)->osdep.mem_bus_space_tag,
|
|
|
|
((struct adapter *)hw->back)->osdep.mem_bus_space_handle,
|
|
|
|
reg + (offset << 2), val);
|
|
|
|
}
|