xref: /freebsd/sys/dev/ixgbe/ixgbe_bypass.h (revision 71625ec9ad2a9bc8c09784fbd23b759830e0ee5f)
18eb6488eSEric Joyner /******************************************************************************
28eb6488eSEric Joyner 
38455e365SKevin Bowling   Copyright (c) 2001-2020, Intel Corporation
48eb6488eSEric Joyner   All rights reserved.
58eb6488eSEric Joyner 
68eb6488eSEric Joyner   Redistribution and use in source and binary forms, with or without
78eb6488eSEric Joyner   modification, are permitted provided that the following conditions are met:
88eb6488eSEric Joyner 
98eb6488eSEric Joyner    1. Redistributions of source code must retain the above copyright notice,
108eb6488eSEric Joyner       this list of conditions and the following disclaimer.
118eb6488eSEric Joyner 
128eb6488eSEric Joyner    2. Redistributions in binary form must reproduce the above copyright
138eb6488eSEric Joyner       notice, this list of conditions and the following disclaimer in the
148eb6488eSEric Joyner       documentation and/or other materials provided with the distribution.
158eb6488eSEric Joyner 
168eb6488eSEric Joyner    3. Neither the name of the Intel Corporation nor the names of its
178eb6488eSEric Joyner       contributors may be used to endorse or promote products derived from
188eb6488eSEric Joyner       this software without specific prior written permission.
198eb6488eSEric Joyner 
208eb6488eSEric Joyner   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
218eb6488eSEric Joyner   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
228eb6488eSEric Joyner   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
238eb6488eSEric Joyner   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
248eb6488eSEric Joyner   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
258eb6488eSEric Joyner   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
268eb6488eSEric Joyner   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
278eb6488eSEric Joyner   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
288eb6488eSEric Joyner   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
298eb6488eSEric Joyner   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
308eb6488eSEric Joyner   POSSIBILITY OF SUCH DAMAGE.
318eb6488eSEric Joyner 
328eb6488eSEric Joyner ******************************************************************************/
338eb6488eSEric Joyner 
348eb6488eSEric Joyner #ifndef _IXGBE_BYPASS_H_
358eb6488eSEric Joyner #define _IXGBE_BYPASS_H_
368eb6488eSEric Joyner 
378eb6488eSEric Joyner 
388eb6488eSEric Joyner /*
398eb6488eSEric Joyner  * The bypass driver needs to set FW to a epoc of the number of
408eb6488eSEric Joyner  * seconds we are into this year.  This macro's help support that.
418eb6488eSEric Joyner  */
428eb6488eSEric Joyner #define SEC_PER_DAY     (60 * 60 * 24)
438eb6488eSEric Joyner #define SEC_PER_YEAR    (SEC_PER_DAY * 365)
448eb6488eSEric Joyner #define SEC_PER_LYEAR   (SEC_PER_DAY * 366)
458eb6488eSEric Joyner #define LEAP_YR(y)      ((y % 400 == 0) || ((y % 4 == 0) && (y % 100 != 0)))
468eb6488eSEric Joyner #define SEC_THIS_YEAR(y)        (LEAP_YR(y) ? SEC_PER_LYEAR : SEC_PER_YEAR)
478eb6488eSEric Joyner 
48*b1d5caf3SKevin Bowling void ixgbe_bypass_init(struct ixgbe_softc *);
498eb6488eSEric Joyner 
508eb6488eSEric Joyner #endif /* _IXGBE_BYPASS_H_ */
51