Print this page
8368 remove warlock leftovers from usr/src/uts


1998  *      i_hca_regs_map_setup() can be called in user or kernel context only.
1999  */
2000 static int
2001 i_hca_regs_map_setup(struct i_hca_fm *hca_fm, dev_info_t *dip, uint_t rnumber,
2002     caddr_t *addrp, offset_t offset, offset_t len,
2003     ddi_device_acc_attr_t *accattrp, ddi_acc_handle_t *handle)
2004 {
2005         int status;
2006         struct i_hca_acc_handle *handlep, *hdlp, *last;
2007 
2008         /* Allocate an access handle */
2009         if ((status = ddi_regs_map_setup(dip, rnumber, addrp, offset,
2010             len, accattrp, handle)) != DDI_SUCCESS) {
2011                 return (status);
2012         }
2013 
2014         /* Allocate HCA FM acc handle structure */
2015         handlep = kmem_cache_alloc(hca_fm->fm_acc_cache, KM_SLEEP);
2016 
2017         /* Initialize fields */
2018         _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*handlep))
2019         handlep->next = NULL;
2020         handlep->save_hdl = (*handle);
2021         handlep->thread_cnt = 0;
2022         mutex_init(&handlep->lock, NULL, MUTEX_DRIVER, NULL);
2023 
2024         /* Register this handle */
2025         mutex_enter(&hca_fm->lock);
2026         for (last = hdlp = hca_fm->hdl; hdlp != NULL; hdlp = hdlp->next) {
2027                 last = hdlp;
2028         }
2029         if (last == NULL) {
2030                 hca_fm->hdl = handlep;
2031         } else {
2032                 last->next = handlep;
2033         }
2034         mutex_exit(&hca_fm->lock);
2035 
2036         return (status);
2037 }
2038 


2114  *
2115  *  Caller's context
2116  *      i_hca_pci_config_setup() can be called in user or kernel context only.
2117  */
2118 static int
2119 i_hca_pci_config_setup(struct i_hca_fm *hca_fm, dev_info_t *dip,
2120     ddi_acc_handle_t *handle)
2121 {
2122         int status;
2123         struct i_hca_acc_handle *handlep, *hdlp, *last;
2124 
2125         /* Allocate an access handle */
2126         if ((status = pci_config_setup(dip, handle)) != DDI_SUCCESS) {
2127                 return (status);
2128         }
2129 
2130         /* Allocate HCA FM acc handle structure */
2131         handlep = kmem_cache_alloc(hca_fm->fm_acc_cache, KM_SLEEP);
2132 
2133         /* Initialize fields */
2134         _NOTE(NOW_INVISIBLE_TO_OTHER_THREADS(*handlep))
2135         handlep->next = NULL;
2136         handlep->save_hdl = (*handle);
2137         handlep->thread_cnt = 0;
2138         mutex_init(&handlep->lock, NULL, MUTEX_DRIVER, NULL);
2139 
2140         /* Register this handle */
2141         mutex_enter(&hca_fm->lock);
2142         for (last = hdlp = hca_fm->hdl; hdlp != NULL; hdlp = hdlp->next) {
2143                 last = hdlp;
2144         }
2145         if (last == NULL) {
2146                 hca_fm->hdl = handlep;
2147         } else {
2148                 last->next = handlep;
2149         }
2150         mutex_exit(&hca_fm->lock);
2151 
2152         return (status);
2153 }
2154 




1998  *      i_hca_regs_map_setup() can be called in user or kernel context only.
1999  */
2000 static int
2001 i_hca_regs_map_setup(struct i_hca_fm *hca_fm, dev_info_t *dip, uint_t rnumber,
2002     caddr_t *addrp, offset_t offset, offset_t len,
2003     ddi_device_acc_attr_t *accattrp, ddi_acc_handle_t *handle)
2004 {
2005         int status;
2006         struct i_hca_acc_handle *handlep, *hdlp, *last;
2007 
2008         /* Allocate an access handle */
2009         if ((status = ddi_regs_map_setup(dip, rnumber, addrp, offset,
2010             len, accattrp, handle)) != DDI_SUCCESS) {
2011                 return (status);
2012         }
2013 
2014         /* Allocate HCA FM acc handle structure */
2015         handlep = kmem_cache_alloc(hca_fm->fm_acc_cache, KM_SLEEP);
2016 
2017         /* Initialize fields */

2018         handlep->next = NULL;
2019         handlep->save_hdl = (*handle);
2020         handlep->thread_cnt = 0;
2021         mutex_init(&handlep->lock, NULL, MUTEX_DRIVER, NULL);
2022 
2023         /* Register this handle */
2024         mutex_enter(&hca_fm->lock);
2025         for (last = hdlp = hca_fm->hdl; hdlp != NULL; hdlp = hdlp->next) {
2026                 last = hdlp;
2027         }
2028         if (last == NULL) {
2029                 hca_fm->hdl = handlep;
2030         } else {
2031                 last->next = handlep;
2032         }
2033         mutex_exit(&hca_fm->lock);
2034 
2035         return (status);
2036 }
2037 


2113  *
2114  *  Caller's context
2115  *      i_hca_pci_config_setup() can be called in user or kernel context only.
2116  */
2117 static int
2118 i_hca_pci_config_setup(struct i_hca_fm *hca_fm, dev_info_t *dip,
2119     ddi_acc_handle_t *handle)
2120 {
2121         int status;
2122         struct i_hca_acc_handle *handlep, *hdlp, *last;
2123 
2124         /* Allocate an access handle */
2125         if ((status = pci_config_setup(dip, handle)) != DDI_SUCCESS) {
2126                 return (status);
2127         }
2128 
2129         /* Allocate HCA FM acc handle structure */
2130         handlep = kmem_cache_alloc(hca_fm->fm_acc_cache, KM_SLEEP);
2131 
2132         /* Initialize fields */

2133         handlep->next = NULL;
2134         handlep->save_hdl = (*handle);
2135         handlep->thread_cnt = 0;
2136         mutex_init(&handlep->lock, NULL, MUTEX_DRIVER, NULL);
2137 
2138         /* Register this handle */
2139         mutex_enter(&hca_fm->lock);
2140         for (last = hdlp = hca_fm->hdl; hdlp != NULL; hdlp = hdlp->next) {
2141                 last = hdlp;
2142         }
2143         if (last == NULL) {
2144                 hca_fm->hdl = handlep;
2145         } else {
2146                 last->next = handlep;
2147         }
2148         mutex_exit(&hca_fm->lock);
2149 
2150         return (status);
2151 }
2152