\hypertarget{e1000__osdep_8c_source}{}\doxysection{e1000\+\_\+osdep.\+c}
\label{e1000__osdep_8c_source}\index{dev/e1000/e1000\_osdep.c@{dev/e1000/e1000\_osdep.c}}
\mbox{\hyperlink{e1000__osdep_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00001}00001 \textcolor{comment}{/******************************************************************************}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00002}00002 \textcolor{comment}{  SPDX-\/License-\/Identifier: BSD-\/3-\/Clause}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00003}00003 \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00004}00004 \textcolor{comment}{  Copyright (c) 2001-\/2020, Intel Corporation}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00005}00005 \textcolor{comment}{  All rights reserved.}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00006}00006 \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00007}00007 \textcolor{comment}{  Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00008}00008 \textcolor{comment}{  modification, are permitted provided that the following conditions are met:}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00009}00009 \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00010}00010 \textcolor{comment}{   1. Redistributions of source code must retain the above copyright notice,}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00011}00011 \textcolor{comment}{      this list of conditions and the following disclaimer.}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00012}00012 \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00013}00013 \textcolor{comment}{   2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00014}00014 \textcolor{comment}{      notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00015}00015 \textcolor{comment}{      documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00016}00016 \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00017}00017 \textcolor{comment}{   3. Neither the name of the Intel Corporation nor the names of its}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00018}00018 \textcolor{comment}{      contributors may be used to endorse or promote products derived from}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00019}00019 \textcolor{comment}{      this software without specific prior written permission.}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00020}00020 \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00021}00021 \textcolor{comment}{  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "{}AS IS"{}}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00022}00022 \textcolor{comment}{  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00023}00023 \textcolor{comment}{  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00024}00024 \textcolor{comment}{  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00025}00025 \textcolor{comment}{  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00026}00026 \textcolor{comment}{  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00027}00027 \textcolor{comment}{  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00028}00028 \textcolor{comment}{  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00029}00029 \textcolor{comment}{  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00030}00030 \textcolor{comment}{  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00031}00031 \textcolor{comment}{  POSSIBILITY OF SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00032}00032 \textcolor{comment}{}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00033}00033 \textcolor{comment}{******************************************************************************/}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00034}00034 \textcolor{comment}{/*\$FreeBSD\$*/}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00035}00035 }
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00036}00036 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{e1000__api_8h}{e1000\_api.h}}"{}}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00037}00037 }
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00038}00038 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00039}00039 \textcolor{comment}{ * NOTE: the following routines using the e1000 }}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00040}00040 \textcolor{comment}{ *      naming style are provided to the shared}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00041}00041 \textcolor{comment}{ *      code but are OS specific}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00042}00042 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00043}00043 }
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00044}00044 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00045}\mbox{\hyperlink{e1000__hw_8h_a76502146f6108fc5272618b87b4d1142}{00045}} \mbox{\hyperlink{e1000__osdep_8c_a76502146f6108fc5272618b87b4d1142}{e1000\_write\_pci\_cfg}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structe1000__hw}{e1000\_hw}} *hw, \mbox{\hyperlink{e1000__osdep_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}} reg, \mbox{\hyperlink{e1000__osdep_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} *value)}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00046}00046 \{}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00047}00047         pci\_write\_config(((\textcolor{keyword}{struct} \mbox{\hyperlink{structe1000__osdep}{e1000\_osdep}} *)hw-\/>\mbox{\hyperlink{structe1000__hw_ac683aa2e14c85e2b77ac6fca424dc7db}{back}})-\/>dev, reg, *value, 2);}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00048}00048 \}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00049}00049 }
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00050}00050 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00051}\mbox{\hyperlink{e1000__hw_8h_af05b63fded54f2adb80b1a0d3d796f25}{00051}} \mbox{\hyperlink{e1000__osdep_8c_af05b63fded54f2adb80b1a0d3d796f25}{e1000\_read\_pci\_cfg}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structe1000__hw}{e1000\_hw}} *hw, \mbox{\hyperlink{e1000__osdep_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}} reg, \mbox{\hyperlink{e1000__osdep_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} *value)}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00052}00052 \{}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00053}00053         *value = pci\_read\_config(((\textcolor{keyword}{struct} \mbox{\hyperlink{structe1000__osdep}{e1000\_osdep}} *)hw-\/>\mbox{\hyperlink{structe1000__hw_ac683aa2e14c85e2b77ac6fca424dc7db}{back}})-\/>dev, reg, 2);}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00054}00054 \}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00056}00056 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00057}\mbox{\hyperlink{e1000__hw_8h_a1057008999bf46edf07f66a6ad7d83f0}{00057}} \mbox{\hyperlink{e1000__osdep_8c_a1057008999bf46edf07f66a6ad7d83f0}{e1000\_pci\_set\_mwi}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structe1000__hw}{e1000\_hw}} *hw)}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00058}00058 \{}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00059}00059         pci\_write\_config(((\textcolor{keyword}{struct} \mbox{\hyperlink{structe1000__osdep}{e1000\_osdep}} *)hw-\/>\mbox{\hyperlink{structe1000__hw_ac683aa2e14c85e2b77ac6fca424dc7db}{back}})-\/>dev, PCIR\_COMMAND,}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00060}00060             (hw-\/>\mbox{\hyperlink{structe1000__hw_a54dfe65b05ea7457cd47b9c2a011d779}{bus}}.\mbox{\hyperlink{structe1000__bus__info_a34538da830f8f0d98b4c0b6ea3552162}{pci\_cmd\_word}} | \mbox{\hyperlink{e1000__osdep_8h_a283fe5d3f5e60bad44c002fa1ad53d30}{CMD\_MEM\_WRT\_INVALIDATE}}), 2);}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00061}00061 \}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00062}00062 }
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00063}00063 \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00064}\mbox{\hyperlink{e1000__hw_8h_ada5a02a77ecbdb9211edf0e767c06db7}{00064}} \mbox{\hyperlink{e1000__osdep_8c_ada5a02a77ecbdb9211edf0e767c06db7}{e1000\_pci\_clear\_mwi}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structe1000__hw}{e1000\_hw}} *hw)}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00065}00065 \{}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00066}00066         pci\_write\_config(((\textcolor{keyword}{struct} \mbox{\hyperlink{structe1000__osdep}{e1000\_osdep}} *)hw-\/>\mbox{\hyperlink{structe1000__hw_ac683aa2e14c85e2b77ac6fca424dc7db}{back}})-\/>dev, PCIR\_COMMAND,}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00067}00067             (hw-\/>\mbox{\hyperlink{structe1000__hw_a54dfe65b05ea7457cd47b9c2a011d779}{bus}}.\mbox{\hyperlink{structe1000__bus__info_a34538da830f8f0d98b4c0b6ea3552162}{pci\_cmd\_word}} \& \string~\mbox{\hyperlink{e1000__osdep_8h_a283fe5d3f5e60bad44c002fa1ad53d30}{CMD\_MEM\_WRT\_INVALIDATE}}), 2);}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00068}00068 \}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00069}00069 }
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00070}00070 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00071}00071 \textcolor{comment}{ * Read the PCI Express capabilities}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00072}00072 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00073}00073 int32\_t}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00074}\mbox{\hyperlink{e1000__hw_8h_a8b729caf83504e15bd66120a27ba4916}{00074}} \mbox{\hyperlink{e1000__osdep_8c_a5f3dbefcebd22b661e74bb13e14580c9}{e1000\_read\_pcie\_cap\_reg}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structe1000__hw}{e1000\_hw}} *hw, \mbox{\hyperlink{e1000__osdep_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}} reg, \mbox{\hyperlink{e1000__osdep_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} *value)}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00075}00075 \{}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00076}00076         device\_t dev = ((\textcolor{keyword}{struct }\mbox{\hyperlink{structe1000__osdep}{e1000\_osdep}} *)hw-\/>\mbox{\hyperlink{structe1000__hw_ac683aa2e14c85e2b77ac6fca424dc7db}{back}})-\/>dev;}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00077}00077         \mbox{\hyperlink{e1000__osdep_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}}  offset;}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00078}00078 }
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00079}00079         pci\_find\_cap(\mbox{\hyperlink{structe1000__osdep_ae409dd45d4d6f811a0c8c766c257adcb}{dev}}, PCIY\_EXPRESS, \&offset);}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00080}00080         *value = pci\_read\_config(\mbox{\hyperlink{structe1000__osdep_ae409dd45d4d6f811a0c8c766c257adcb}{dev}}, offset + reg, 2);}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00081}00081         \textcolor{keywordflow}{return} (\mbox{\hyperlink{e1000__defines_8h_ade686b442ce8b2b1dede6968fec28c10}{E1000\_SUCCESS}});}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00082}00082 \}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00083}00083 }
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00084}00084 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00085}00085 \textcolor{comment}{ * Write the PCI Express capabilities}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00086}00086 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00087}00087 int32\_t}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00088}\mbox{\hyperlink{e1000__hw_8h_aa64b71180f655e67ed7921e0c6baf696}{00088}} \mbox{\hyperlink{e1000__osdep_8c_a29057eb4ecc1cc9875912d24cc8c4297}{e1000\_write\_pcie\_cap\_reg}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structe1000__hw}{e1000\_hw}} *hw, \mbox{\hyperlink{e1000__osdep_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}} reg, \mbox{\hyperlink{e1000__osdep_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} *value)}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00089}00089 \{}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00090}00090         device\_t \mbox{\hyperlink{structe1000__osdep_ae409dd45d4d6f811a0c8c766c257adcb}{dev}} = ((\textcolor{keyword}{struct }\mbox{\hyperlink{structe1000__osdep}{e1000\_osdep}} *)hw-\/>\mbox{\hyperlink{structe1000__hw_ac683aa2e14c85e2b77ac6fca424dc7db}{back}})-\/>dev;}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00091}00091         \mbox{\hyperlink{e1000__osdep_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}}  offset;}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00092}00092 }
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00093}00093         pci\_find\_cap(\mbox{\hyperlink{structe1000__osdep_ae409dd45d4d6f811a0c8c766c257adcb}{dev}}, PCIY\_EXPRESS, \&offset);}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00094}00094         pci\_write\_config(\mbox{\hyperlink{structe1000__osdep_ae409dd45d4d6f811a0c8c766c257adcb}{dev}}, offset + reg, *value, 2);}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00095}00095         \textcolor{keywordflow}{return} (\mbox{\hyperlink{e1000__defines_8h_ade686b442ce8b2b1dede6968fec28c10}{E1000\_SUCCESS}});}
\DoxyCodeLine{\Hypertarget{e1000__osdep_8c_source_l00096}00096 \}}

\end{DoxyCode}
