xref: /netbsd-src/sys/dev/pci/ixgbe/ixgbe_bypass.h (revision 4ab64dd8558009744b547d27ef7493447654442b)
1*4ab64dd8Smsaitoh /* $NetBSD: ixgbe_bypass.h,v 1.5 2023/10/06 14:48:08 msaitoh Exp $ */
2dc7f84c8Smsaitoh /******************************************************************************
3dc7f84c8Smsaitoh 
48467fefbSmsaitoh   Copyright (c) 2001-2020, Intel Corporation
5dc7f84c8Smsaitoh   All rights reserved.
6dc7f84c8Smsaitoh 
7dc7f84c8Smsaitoh   Redistribution and use in source and binary forms, with or without
8dc7f84c8Smsaitoh   modification, are permitted provided that the following conditions are met:
9dc7f84c8Smsaitoh 
10dc7f84c8Smsaitoh    1. Redistributions of source code must retain the above copyright notice,
11dc7f84c8Smsaitoh       this list of conditions and the following disclaimer.
12dc7f84c8Smsaitoh 
13dc7f84c8Smsaitoh    2. Redistributions in binary form must reproduce the above copyright
14dc7f84c8Smsaitoh       notice, this list of conditions and the following disclaimer in the
15dc7f84c8Smsaitoh       documentation and/or other materials provided with the distribution.
16dc7f84c8Smsaitoh 
17dc7f84c8Smsaitoh    3. Neither the name of the Intel Corporation nor the names of its
18dc7f84c8Smsaitoh       contributors may be used to endorse or promote products derived from
19dc7f84c8Smsaitoh       this software without specific prior written permission.
20dc7f84c8Smsaitoh 
21dc7f84c8Smsaitoh   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22dc7f84c8Smsaitoh   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23dc7f84c8Smsaitoh   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24dc7f84c8Smsaitoh   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25dc7f84c8Smsaitoh   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26dc7f84c8Smsaitoh   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27dc7f84c8Smsaitoh   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28dc7f84c8Smsaitoh   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29dc7f84c8Smsaitoh   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30dc7f84c8Smsaitoh   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31dc7f84c8Smsaitoh   POSSIBILITY OF SUCH DAMAGE.
32dc7f84c8Smsaitoh 
33dc7f84c8Smsaitoh ******************************************************************************/
34dc7f84c8Smsaitoh /*$FreeBSD: head/sys/dev/ixgbe/ixgbe_bypass.h 320688 2017-07-05 17:27:03Z erj $*/
35dc7f84c8Smsaitoh 
36dc7f84c8Smsaitoh #ifndef _IXGBE_BYPASS_H_
37dc7f84c8Smsaitoh #define _IXGBE_BYPASS_H_
38dc7f84c8Smsaitoh 
39dc7f84c8Smsaitoh /*
40dc7f84c8Smsaitoh  * The bypass driver needs to set FW to a epoc of the number of
41dc7f84c8Smsaitoh  * seconds we are into this year.  This macro's help support that.
42dc7f84c8Smsaitoh  */
43dc7f84c8Smsaitoh #define SEC_PER_DAY     (60 * 60 * 24)
44dc7f84c8Smsaitoh #define SEC_PER_YEAR    (SEC_PER_DAY * 365)
45dc7f84c8Smsaitoh #define SEC_PER_LYEAR   (SEC_PER_DAY * 366)
46dc7f84c8Smsaitoh #define LEAP_YR(y)      ((y % 400 == 0) || ((y % 4 == 0) && (y % 100 != 0)))
47dc7f84c8Smsaitoh #define SEC_THIS_YEAR(y)        (LEAP_YR(y) ? SEC_PER_LYEAR : SEC_PER_YEAR)
48dc7f84c8Smsaitoh 
4955485da1Smsaitoh void ixgbe_bypass_init(struct ixgbe_softc *);
50dc7f84c8Smsaitoh 
51dc7f84c8Smsaitoh #endif /* _IXGBE_BYPASS_H_ */
52