\hypertarget{ahc__pci_8c_source}{}\doxysection{ahc\+\_\+pci.\+c}
\label{ahc__pci_8c_source}\index{dev/aic7xxx/ahc\_pci.c@{dev/aic7xxx/ahc\_pci.c}}
\mbox{\hyperlink{ahc__pci_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00002}00002 \textcolor{comment}{ * FreeBSD, PCI product support functions}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 1995-\/2001 Justin T. Gibbs}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00005}00005 \textcolor{comment}{ * All rights reserved.}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00006}00006 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00007}00007 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00008}00008 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00009}00009 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00010}00010 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00011}00011 \textcolor{comment}{ *    notice, this list of conditions, and the following disclaimer,}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00012}00012 \textcolor{comment}{ *    without modification, immediately at the beginning of the file.}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00013}00013 \textcolor{comment}{ * 2. The name of the author may not be used to endorse or promote products}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00014}00014 \textcolor{comment}{ *    derived from this software without specific prior written permission.}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00015}00015 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00016}00016 \textcolor{comment}{ * Alternatively, this software may be distributed under the terms of the}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00017}00017 \textcolor{comment}{ * GNU Public License ("{}GPL"{}).}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00018}00018 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00019}00019 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00020}00020 \textcolor{comment}{ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00021}00021 \textcolor{comment}{ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00022}00022 \textcolor{comment}{ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00023}00023 \textcolor{comment}{ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00024}00024 \textcolor{comment}{ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00025}00025 \textcolor{comment}{ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00026}00026 \textcolor{comment}{ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00027}00027 \textcolor{comment}{ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00028}00028 \textcolor{comment}{ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00029}00029 \textcolor{comment}{ * SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00030}00030 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00031}00031 \textcolor{comment}{ * \$Id: //depot/aic7xxx/freebsd/dev/aic7xxx/ahc\_pci.c\#19 \$}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00032}00032 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00033}00033 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00034}00034 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00035}\mbox{\hyperlink{ahc__pci_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00035}} \mbox{\hyperlink{ahc__pci_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00036}00036 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00037}00037 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{aic7xxx__osm_8h}{dev/aic7xxx/aic7xxx\_osm.h}}>}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00038}00038 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00039}00039 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ahc__pci_8c_adf8503d03555076671bdd39d587eeb19}{ahc\_pci\_probe}}(device\_t dev);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00040}00040 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{ahc__pci_8c_ac42a2088ad97a1938c43374440364016}{ahc\_pci\_attach}}(device\_t dev);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00041}00041 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00042}\mbox{\hyperlink{ahc__pci_8c_a5c6bfc36255776930407511a6983f084}{00042}} \textcolor{keyword}{static} device\_method\_t \mbox{\hyperlink{ahc__pci_8c_a5c6bfc36255776930407511a6983f084}{ahc\_pci\_device\_methods}}[] = \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00043}00043         \textcolor{comment}{/* Device interface */}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00044}00044         DEVMETHOD(device\_probe,         \mbox{\hyperlink{ahc__pci_8c_adf8503d03555076671bdd39d587eeb19}{ahc\_pci\_probe}}),}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00045}00045         DEVMETHOD(device\_attach,        \mbox{\hyperlink{ahc__pci_8c_ac42a2088ad97a1938c43374440364016}{ahc\_pci\_attach}}),}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00046}00046         DEVMETHOD(device\_detach,        \mbox{\hyperlink{aic7xxx__osm_8c_a643588257272d097780423190a24fe65}{ahc\_detach}}),}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00047}00047         \{ 0, 0 \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00048}00048 \};}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00049}00049 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00050}\mbox{\hyperlink{ahc__pci_8c_acfab522ce3f66002571219425ea75752}{00050}} \textcolor{keyword}{static} driver\_t \mbox{\hyperlink{ahc__pci_8c_acfab522ce3f66002571219425ea75752}{ahc\_pci\_driver}} = \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00051}00051         \textcolor{stringliteral}{"{}ahc"{}},}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00052}00052         \mbox{\hyperlink{ahc__pci_8c_a5c6bfc36255776930407511a6983f084}{ahc\_pci\_device\_methods}},}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00053}00053         \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct }\mbox{\hyperlink{structahc__softc}{ahc\_softc}})}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00054}00054 \};}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00055}00055 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00056}\mbox{\hyperlink{ahc__pci_8c_ab5c233e8082fa24e928e7345edd07b97}{00056}} \mbox{\hyperlink{ahc__pci_8c_ab5c233e8082fa24e928e7345edd07b97}{DRIVER\_MODULE}}(ahc\_pci, pci, \mbox{\hyperlink{ahc__pci_8c_acfab522ce3f66002571219425ea75752}{ahc\_pci\_driver}}, \mbox{\hyperlink{aic7xxx__osm_8c_a05fe04e1e6061d2d729f743e3be86d51}{ahc\_devclass}}, 0, 0);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00057}\mbox{\hyperlink{ahc__pci_8c_a07aa32a85e3323dc0227403526f91ceb}{00057}} \mbox{\hyperlink{ahc__pci_8c_a07aa32a85e3323dc0227403526f91ceb}{MODULE\_DEPEND}}(ahc\_pci, ahc, 1, 1, 1);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00058}\mbox{\hyperlink{ahc__pci_8c_abaa50ed3bf678eb7d5166ba546e6a81c}{00058}} \mbox{\hyperlink{ahc__pci_8c_abaa50ed3bf678eb7d5166ba546e6a81c}{MODULE\_VERSION}}(ahc\_pci, 1);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00059}00059 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00060}00060 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00061}\mbox{\hyperlink{ahc__pci_8c_adf8503d03555076671bdd39d587eeb19}{00061}} \mbox{\hyperlink{ahc__pci_8c_adf8503d03555076671bdd39d587eeb19}{ahc\_pci\_probe}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00062}00062 \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00063}00063         \textcolor{keyword}{struct  }\mbox{\hyperlink{structahc__pci__identity}{ahc\_pci\_identity}} *entry;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00064}00064 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00065}00065         entry = \mbox{\hyperlink{aic7xxx_8h_a09d688be1d488e42d042cc199b81b719}{ahc\_find\_pci\_device}}(dev);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00066}00066         \textcolor{keywordflow}{if} (entry != NULL) \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00067}00067                 device\_set\_desc(dev, entry-\/>\mbox{\hyperlink{structahc__pci__identity_aa23552fd199e618586b26a576b7ad61a}{name}});}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00068}00068                 \textcolor{keywordflow}{return} (BUS\_PROBE\_DEFAULT);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00069}00069         \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00070}00070         \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00071}00071 \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00072}00072 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00073}00073 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00074}\mbox{\hyperlink{ahc__pci_8c_ac42a2088ad97a1938c43374440364016}{00074}} \mbox{\hyperlink{ahc__pci_8c_ac42a2088ad97a1938c43374440364016}{ahc\_pci\_attach}}(device\_t dev)}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00075}00075 \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00076}00076         \textcolor{keyword}{struct   }\mbox{\hyperlink{structahc__pci__identity}{ahc\_pci\_identity}} *entry;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00077}00077         \textcolor{keyword}{struct   }\mbox{\hyperlink{structahc__softc}{ahc\_softc}} *ahc;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00078}00078         \textcolor{keywordtype}{char}    *\mbox{\hyperlink{structahc__softc_acdbbdc30c7fe3e5c3eb5e3985cde302f}{name}};}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00079}00079         \textcolor{keywordtype}{int}      error;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00080}00080 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00081}00081         entry = \mbox{\hyperlink{aic7xxx_8h_a09d688be1d488e42d042cc199b81b719}{ahc\_find\_pci\_device}}(dev);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00082}00082         \textcolor{keywordflow}{if} (entry == NULL)}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00083}00083                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00084}00084 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00085}00085         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00086}00086 \textcolor{comment}{         * Allocate a softc for this card and}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00087}00087 \textcolor{comment}{         * set it up for attachment by our}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00088}00088 \textcolor{comment}{         * common detect routine.}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00089}00089 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00090}00090         \mbox{\hyperlink{structahc__softc_acdbbdc30c7fe3e5c3eb5e3985cde302f}{name}} = malloc(strlen(device\_get\_nameunit(dev)) + 1, M\_DEVBUF, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00091}00091         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structahc__softc_acdbbdc30c7fe3e5c3eb5e3985cde302f}{name}} == NULL)}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00092}00092                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00093}00093         strcpy(\mbox{\hyperlink{structahc__softc_acdbbdc30c7fe3e5c3eb5e3985cde302f}{name}}, device\_get\_nameunit(dev));}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00094}00094         ahc = \mbox{\hyperlink{aic7xxx_8c_adb3765ad967c506510ad65417028ce86}{ahc\_alloc}}(dev, \mbox{\hyperlink{structahc__softc_acdbbdc30c7fe3e5c3eb5e3985cde302f}{name}});}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00095}00095         \textcolor{keywordflow}{if} (ahc == NULL)}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00096}00096                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00097}00097 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00098}00098         \mbox{\hyperlink{aic7xxx_8c_aea2958e5d4596c2568085f308cbb5b9c}{ahc\_set\_unit}}(ahc, device\_get\_unit(dev));}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00099}00099 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00100}00100         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00101}00101 \textcolor{comment}{         * Should we bother disabling 39Bit addressing}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00102}00102 \textcolor{comment}{         * based on installed memory?}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00103}00103 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00104}00104         \textcolor{keywordflow}{if} (\textcolor{keyword}{sizeof}(bus\_addr\_t) > 4)}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00105}00105                 ahc-\/>\mbox{\hyperlink{structahc__softc_a93c6c2a1032f6fc0f41d1aa1d2078ea3}{flags}} |= \mbox{\hyperlink{aic7xxx_8h_ab80df6f3fdeef56c8af9e33284a4fd81aceb69a3ab3fe20bfae4ff595ff7aaa69}{AHC\_39BIT\_ADDRESSING}};}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00106}00106 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00107}00107         \textcolor{comment}{/* Allocate a dmatag for our SCB DMA maps */}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00108}00108         error = \mbox{\hyperlink{aic__osm__lib_8h_a2c25902bc7997440be9afda6b4b947b7}{aic\_dma\_tag\_create}}(ahc, \textcolor{comment}{/*parent*/}bus\_get\_dma\_tag(dev),}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00109}00109                                    \textcolor{comment}{/*alignment*/}1, \textcolor{comment}{/*boundary*/}0,}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00110}00110                                    (ahc-\/>\mbox{\hyperlink{structahc__softc_a93c6c2a1032f6fc0f41d1aa1d2078ea3}{flags}} \& \mbox{\hyperlink{aic7xxx_8h_ab80df6f3fdeef56c8af9e33284a4fd81aceb69a3ab3fe20bfae4ff595ff7aaa69}{AHC\_39BIT\_ADDRESSING}})}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00111}00111                                    ? 0x7FFFFFFFFFLL}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00112}00112                                    : BUS\_SPACE\_MAXADDR\_32BIT,}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00113}00113                                    \textcolor{comment}{/*highaddr*/}BUS\_SPACE\_MAXADDR,}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00114}00114                                    \textcolor{comment}{/*filter*/}NULL, \textcolor{comment}{/*filterarg*/}NULL,}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00115}00115                                    \textcolor{comment}{/*maxsize*/}BUS\_SPACE\_MAXSIZE\_32BIT,}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00116}00116                                    \textcolor{comment}{/*nsegments*/}\mbox{\hyperlink{aic7xxx__osm_8h_a7f68f60c3974a190f22006baf79b214e}{AHC\_NSEG}},}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00117}00117                                    \textcolor{comment}{/*maxsegsz*/}\mbox{\hyperlink{aic7xxx_8h_a225bb9a2b7a88e88bdedb402cd8cf231}{AHC\_MAXTRANSFER\_SIZE}},}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00118}00118                                    \textcolor{comment}{/*flags*/}0,}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00119}00119                                    \&ahc-\/>\mbox{\hyperlink{structahc__softc_a58a2e1f94c8641616286b06f9d0053ce}{parent\_dmat}});}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00120}00120 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00121}00121         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00122}00122                 printf(\textcolor{stringliteral}{"{}ahc\_pci\_attach: Could not allocate DMA tag "{}}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00123}00123                        \textcolor{stringliteral}{"{}-\/ error \%d\(\backslash\)n"{}}, error);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00124}00124                 \mbox{\hyperlink{aic7xxx_8c_a9e0849e4b431c5241cc1ab5a043d5249}{ahc\_free}}(ahc);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00125}00125                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00126}00126         \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00127}00127         ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}} = dev;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00128}00128         error = \mbox{\hyperlink{aic7xxx_8h_add618b0dae995f5829d2d887cef4cc5c}{ahc\_pci\_config}}(ahc, entry);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00129}00129         \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00130}00130                 \mbox{\hyperlink{aic7xxx_8c_a9e0849e4b431c5241cc1ab5a043d5249}{ahc\_free}}(ahc);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00131}00131                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00132}00132         \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00133}00133 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00134}00134         \mbox{\hyperlink{aic7xxx__osm_8c_ae00a4bc910d91771859625478cde7fb8}{ahc\_attach}}(ahc);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00135}00135         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00136}00136 \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00137}00137 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00138}00138 \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00139}\mbox{\hyperlink{ahc__pci_8c_adabc04ec0809c171a887c32169f3b979}{00139}} \mbox{\hyperlink{ahc__pci_8c_adabc04ec0809c171a887c32169f3b979}{ahc\_pci\_map\_registers}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structahc__softc}{ahc\_softc}} *ahc)}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00140}00140 \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00141}00141         \textcolor{keyword}{struct  }resource *regs;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00142}00142         \textcolor{keywordtype}{int}     regs\_type;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00143}00143         \textcolor{keywordtype}{int}     regs\_id;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00144}00144         \textcolor{keywordtype}{int}     allow\_memio;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00145}00145 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00146}00146         regs = NULL;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00147}00147         regs\_type = 0;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00148}00148         regs\_id = 0;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00149}00149 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00150}00150         \textcolor{comment}{/* Retrieve the per-\/device 'allow\_memio' hint */}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00151}00151         \textcolor{keywordflow}{if} (resource\_int\_value(device\_get\_name(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}),}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00152}00152                                device\_get\_unit(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}),}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00153}00153                                \textcolor{stringliteral}{"{}allow\_memio"{}}, \&allow\_memio) != 0) \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00154}00154                 \textcolor{keywordflow}{if} (bootverbose)}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00155}00155                         device\_printf(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}, \textcolor{stringliteral}{"{}Defaulting to MEMIO "{}});}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00156}00156 \textcolor{preprocessor}{\#ifdef AHC\_ALLOW\_MEMIO}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00157}00157                 \textcolor{keywordflow}{if} (bootverbose)}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00158}00158                         printf(\textcolor{stringliteral}{"{}on\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00159}00159                 allow\_memio = 1;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00160}00160 \textcolor{preprocessor}{\#else}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00161}00161                 \textcolor{keywordflow}{if} (bootverbose)}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00162}00162                         printf(\textcolor{stringliteral}{"{}off\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00163}00163                 allow\_memio = 0;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00164}00164 \textcolor{preprocessor}{\#endif}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00165}00165         \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00166}00166 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00167}00167         \textcolor{keywordflow}{if} (allow\_memio != 0) \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00168}00168                 regs\_type = SYS\_RES\_MEMORY;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00169}00169                 regs\_id = \mbox{\hyperlink{aic7xxx_8h_ad728583f8ce04f935c2df0f5d3324d76}{AHC\_PCI\_MEMADDR}};}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00170}00170                 regs = bus\_alloc\_resource\_any(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}, regs\_type,}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00171}00171                                               \&regs\_id, RF\_ACTIVE);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00172}00172                 \textcolor{keywordflow}{if} (regs != NULL) \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00173}00173                         ahc-\/>\mbox{\hyperlink{structahc__softc_a3d0b889d134eca2d13f9333547e57bbc}{tag}} = rman\_get\_bustag(regs);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00174}00174                         ahc-\/>\mbox{\hyperlink{structahc__softc_a0446f4cd8b7d5c41b62e2db14409fe5e}{bsh}} = rman\_get\_bushandle(regs);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00175}00175 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00176}00176                         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00177}00177 \textcolor{comment}{                         * Do a quick test to see if memory mapped}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00178}00178 \textcolor{comment}{                         * I/O is functioning correctly.}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00179}00179 \textcolor{comment}{                         */}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00180}00180                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{aic7xxx_8h_a2e718abe316bc9b91c5f0de7263d12b8}{ahc\_pci\_test\_register\_access}}(ahc) != 0) \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00181}00181                                 device\_printf(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}},}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00182}00182                                        \textcolor{stringliteral}{"{}PCI Device \%d:\%d:\%d failed memory "{}}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00183}00183                                        \textcolor{stringliteral}{"{}mapped test.  Using PIO.\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00184}00184                                        aic\_get\_pci\_bus(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}),}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00185}00185                                        aic\_get\_pci\_slot(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}),}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00186}00186                                        aic\_get\_pci\_function(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}));}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00187}00187                                 bus\_release\_resource(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}, regs\_type,}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00188}00188                                                      regs\_id, regs);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00189}00189                                 regs = NULL;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00190}00190                         \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00191}00191                 \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00192}00192         \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00193}00193 }
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00194}00194         \textcolor{keywordflow}{if} (regs == NULL) \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00195}00195                 regs\_type = SYS\_RES\_IOPORT;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00196}00196                 regs\_id = \mbox{\hyperlink{aic7xxx_8h_a474b63d97bc8a3454a53922cb68cd221}{AHC\_PCI\_IOADDR}};}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00197}00197                 regs = bus\_alloc\_resource\_any(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}, regs\_type,}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00198}00198                                               \&regs\_id, RF\_ACTIVE);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00199}00199                 \textcolor{keywordflow}{if} (regs != NULL) \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00200}00200                         ahc-\/>\mbox{\hyperlink{structahc__softc_a3d0b889d134eca2d13f9333547e57bbc}{tag}} = rman\_get\_bustag(regs);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00201}00201                         ahc-\/>\mbox{\hyperlink{structahc__softc_a0446f4cd8b7d5c41b62e2db14409fe5e}{bsh}} = rman\_get\_bushandle(regs);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00202}00202                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{aic7xxx_8h_a2e718abe316bc9b91c5f0de7263d12b8}{ahc\_pci\_test\_register\_access}}(ahc) != 0) \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00203}00203                                 device\_printf(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}},}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00204}00204                                        \textcolor{stringliteral}{"{}PCI Device \%d:\%d:\%d failed I/O "{}}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00205}00205                                        \textcolor{stringliteral}{"{}mapped test.\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00206}00206                                        aic\_get\_pci\_bus(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}),}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00207}00207                                        aic\_get\_pci\_slot(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}),}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00208}00208                                        aic\_get\_pci\_function(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}));}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00209}00209                                 bus\_release\_resource(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}}, regs\_type,}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00210}00210                                                      regs\_id, regs);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00211}00211                                 regs = NULL;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00212}00212                         \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00213}00213                 \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00214}00214         \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00215}00215         \textcolor{keywordflow}{if} (regs == NULL) \{}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00216}00216                 device\_printf(ahc-\/>\mbox{\hyperlink{structahc__softc_ab79251036827fdd955ae522a1e209afe}{dev\_softc}},}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00217}00217                               \textcolor{stringliteral}{"{}can't allocate register resources\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00218}00218                 \textcolor{keywordflow}{return} (ENOMEM);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00219}00219         \}}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00220}00220         ahc-\/>\mbox{\hyperlink{structahc__softc_a8f2ffedf7b6be7d55c6f7a3e543ccc81}{platform\_data}}-\/>\mbox{\hyperlink{structahc__platform__data_adf20277356568231fa8c6b459fe43575}{regs\_res\_type}} = regs\_type;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00221}00221         ahc-\/>\mbox{\hyperlink{structahc__softc_a8f2ffedf7b6be7d55c6f7a3e543ccc81}{platform\_data}}-\/>\mbox{\hyperlink{structahc__platform__data_a31064106bacc7604b14f2b7cbd33aa5a}{regs\_res\_id}} = regs\_id;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00222}00222         ahc-\/>\mbox{\hyperlink{structahc__softc_a8f2ffedf7b6be7d55c6f7a3e543ccc81}{platform\_data}}-\/>\mbox{\hyperlink{structahc__platform__data_a12b615bc1edf94a24b18333020a7c4b1}{regs}} = regs;}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00223}00223         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{ahc__pci_8c_source_l00224}00224 \}}

\end{DoxyCode}
