xref: /freebsd/sys/dev/isci/isci.c (revision 4f52dfbb8d6c4d446500c5b097e3806ec219fbd4)
1 /*-
2  * SPDX-License-Identifier: BSD-2-Clause
3  *
4  * BSD LICENSE
5  *
6  * Copyright(c) 2008 - 2011 Intel Corporation. All rights reserved.
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  *   * Redistributions of source code must retain the above copyright
14  *     notice, this list of conditions and the following disclaimer.
15  *   * Redistributions in binary form must reproduce the above copyright
16  *     notice, this list of conditions and the following disclaimer in
17  *     the documentation and/or other materials provided with the
18  *     distribution.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #include <sys/cdefs.h>
34 __FBSDID("$FreeBSD$");
35 
36 #include <dev/isci/isci.h>
37 
38 #include <sys/sysctl.h>
39 #include <sys/malloc.h>
40 
41 #include <cam/cam_periph.h>
42 
43 #include <dev/led/led.h>
44 
45 #include <dev/pci/pcireg.h>
46 #include <dev/pci/pcivar.h>
47 
48 #include <dev/isci/scil/scic_logger.h>
49 #include <dev/isci/scil/scic_library.h>
50 #include <dev/isci/scil/scic_sgpio.h>
51 #include <dev/isci/scil/scic_user_callback.h>
52 
53 #include <dev/isci/scil/scif_controller.h>
54 #include <dev/isci/scil/scif_library.h>
55 #include <dev/isci/scil/scif_logger.h>
56 #include <dev/isci/scil/scif_user_callback.h>
57 
58 MALLOC_DEFINE(M_ISCI, "isci", "isci driver memory allocations");
59 
60 struct isci_softc *g_isci;
61 uint32_t g_isci_debug_level = 0;
62 
63 static int isci_probe(device_t);
64 static int isci_attach(device_t);
65 static int isci_detach(device_t);
66 
67 int isci_initialize(struct isci_softc *isci);
68 
69 void isci_allocate_dma_buffer_callback(void *arg, bus_dma_segment_t *seg,
70     int nseg, int error);
71 
72 static devclass_t isci_devclass;
73 
74 static device_method_t isci_pci_methods[] = {
75 	 /* Device interface */
76 	 DEVMETHOD(device_probe,  isci_probe),
77 	 DEVMETHOD(device_attach, isci_attach),
78 	 DEVMETHOD(device_detach, isci_detach),
79 	 { 0, 0 }
80 };
81 
82 static driver_t isci_pci_driver = {
83 	 "isci",
84 	 isci_pci_methods,
85 	 sizeof(struct isci_softc),
86 };
87 
88 DRIVER_MODULE(isci, pci, isci_pci_driver, isci_devclass, 0, 0);
89 MODULE_DEPEND(isci, cam, 1, 1, 1);
90 
91 static struct _pcsid
92 {
93 	 u_int32_t	type;
94 	 const char	*desc;
95 } pci_ids[] = {
96 	 { 0x1d608086,	"Intel(R) C600 Series Chipset SAS Controller"  },
97 	 { 0x1d618086,	"Intel(R) C600 Series Chipset SAS Controller (SATA mode)"  },
98 	 { 0x1d628086,	"Intel(R) C600 Series Chipset SAS Controller"  },
99 	 { 0x1d638086,	"Intel(R) C600 Series Chipset SAS Controller"  },
100 	 { 0x1d648086,	"Intel(R) C600 Series Chipset SAS Controller"  },
101 	 { 0x1d658086,	"Intel(R) C600 Series Chipset SAS Controller"  },
102 	 { 0x1d668086,	"Intel(R) C600 Series Chipset SAS Controller"  },
103 	 { 0x1d678086,	"Intel(R) C600 Series Chipset SAS Controller"  },
104 	 { 0x1d688086,	"Intel(R) C600 Series Chipset SAS Controller"  },
105 	 { 0x1d698086,	"Intel(R) C600 Series Chipset SAS Controller"  },
106 	 { 0x1d6a8086,	"Intel(R) C600 Series Chipset SAS Controller (SATA mode)"  },
107 	 { 0x1d6b8086,  "Intel(R) C600 Series Chipset SAS Controller (SATA mode)"  },
108 	 { 0x1d6c8086,	"Intel(R) C600 Series Chipset SAS Controller"  },
109 	 { 0x1d6d8086,	"Intel(R) C600 Series Chipset SAS Controller"  },
110 	 { 0x1d6e8086,	"Intel(R) C600 Series Chipset SAS Controller"  },
111 	 { 0x1d6f8086,	"Intel(R) C600 Series Chipset SAS Controller (SATA mode)"  },
112 	 { 0x00000000,	NULL				}
113 };
114 
115 static int
116 isci_probe (device_t device)
117 {
118 	u_int32_t	type = pci_get_devid(device);
119 	struct _pcsid	*ep = pci_ids;
120 
121 	while (ep->type && ep->type != type)
122 		++ep;
123 
124 	if (ep->desc)
125 	{
126 		device_set_desc(device, ep->desc);
127 		return (BUS_PROBE_DEFAULT);
128 	}
129 	else
130 		return (ENXIO);
131 }
132 
133 static int
134 isci_allocate_pci_memory(struct isci_softc *isci)
135 {
136 	int i;
137 
138 	for (i = 0; i < ISCI_NUM_PCI_BARS; i++)
139 	{
140 		struct ISCI_PCI_BAR *pci_bar = &isci->pci_bar[i];
141 
142 		pci_bar->resource_id = PCIR_BAR(i*2);
143 		pci_bar->resource = bus_alloc_resource_any(isci->device,
144 		    SYS_RES_MEMORY, &pci_bar->resource_id,
145 		    RF_ACTIVE);
146 
147 		if(pci_bar->resource == NULL)
148 			isci_log_message(0, "ISCI",
149 			    "unable to allocate pci resource\n");
150 		else {
151 			pci_bar->bus_tag = rman_get_bustag(pci_bar->resource);
152 			pci_bar->bus_handle =
153 			    rman_get_bushandle(pci_bar->resource);
154 		}
155 	}
156 
157 	return (0);
158 }
159 
160 static int
161 isci_attach(device_t device)
162 {
163 	int error;
164 	struct isci_softc *isci = DEVICE2SOFTC(device);
165 
166 	g_isci = isci;
167 	isci->device = device;
168 	pci_enable_busmaster(device);
169 
170 	isci_allocate_pci_memory(isci);
171 
172 	error = isci_initialize(isci);
173 
174 	if (error)
175 	{
176 		isci_detach(device);
177 		return (error);
178 	}
179 
180 	isci_interrupt_setup(isci);
181 	isci_sysctl_initialize(isci);
182 
183 	return (0);
184 }
185 
186 static int
187 isci_detach(device_t device)
188 {
189 	struct isci_softc *isci = DEVICE2SOFTC(device);
190 	int i, phy;
191 
192 	for (i = 0; i < isci->controller_count; i++) {
193 		struct ISCI_CONTROLLER *controller = &isci->controllers[i];
194 		SCI_STATUS status;
195 		void *unmap_buffer;
196 
197 		if (controller->scif_controller_handle != NULL) {
198 			scic_controller_disable_interrupts(
199 			    scif_controller_get_scic_handle(controller->scif_controller_handle));
200 
201 			mtx_lock(&controller->lock);
202 			status = scif_controller_stop(controller->scif_controller_handle, 0);
203 			mtx_unlock(&controller->lock);
204 
205 			while (controller->is_started == TRUE) {
206 				/* Now poll for interrupts until the controller stop complete
207 				 *  callback is received.
208 				 */
209 				mtx_lock(&controller->lock);
210 				isci_interrupt_poll_handler(controller);
211 				mtx_unlock(&controller->lock);
212 				pause("isci", 1);
213 			}
214 
215 			if(controller->sim != NULL) {
216 				mtx_lock(&controller->lock);
217 				xpt_free_path(controller->path);
218 				xpt_bus_deregister(cam_sim_path(controller->sim));
219 				cam_sim_free(controller->sim, TRUE);
220 				mtx_unlock(&controller->lock);
221 			}
222 		}
223 
224 		if (controller->timer_memory != NULL)
225 			free(controller->timer_memory, M_ISCI);
226 
227 		if (controller->remote_device_memory != NULL)
228 			free(controller->remote_device_memory, M_ISCI);
229 
230 		for (phy = 0; phy < SCI_MAX_PHYS; phy++) {
231 			if (controller->phys[phy].cdev_fault)
232 				led_destroy(controller->phys[phy].cdev_fault);
233 
234 			if (controller->phys[phy].cdev_locate)
235 				led_destroy(controller->phys[phy].cdev_locate);
236 		}
237 
238 		while (1) {
239 			sci_pool_get(controller->unmap_buffer_pool, unmap_buffer);
240 			if (unmap_buffer == NULL)
241 				break;
242 			contigfree(unmap_buffer, PAGE_SIZE, M_ISCI);
243 		}
244 	}
245 
246 	/* The SCIF controllers have been stopped, so we can now
247 	 *  free the SCI library memory.
248 	 */
249 	if (isci->sci_library_memory != NULL)
250 		free(isci->sci_library_memory, M_ISCI);
251 
252 	for (i = 0; i < ISCI_NUM_PCI_BARS; i++)
253 	{
254 		struct ISCI_PCI_BAR *pci_bar = &isci->pci_bar[i];
255 
256 		if (pci_bar->resource != NULL)
257 			bus_release_resource(device, SYS_RES_MEMORY,
258 			    pci_bar->resource_id, pci_bar->resource);
259 	}
260 
261 	for (i = 0; i < isci->num_interrupts; i++)
262 	{
263 		struct ISCI_INTERRUPT_INFO *interrupt_info;
264 
265 		interrupt_info = &isci->interrupt_info[i];
266 
267 		if(interrupt_info->tag != NULL)
268 			bus_teardown_intr(device, interrupt_info->res,
269 			    interrupt_info->tag);
270 
271 		if(interrupt_info->res != NULL)
272 			bus_release_resource(device, SYS_RES_IRQ,
273 			    rman_get_rid(interrupt_info->res),
274 			    interrupt_info->res);
275 
276 		pci_release_msi(device);
277 	}
278 	pci_disable_busmaster(device);
279 
280 	return (0);
281 }
282 
283 int
284 isci_initialize(struct isci_softc *isci)
285 {
286 	int error;
287 	uint32_t status = 0;
288 	uint32_t library_object_size;
289 	uint32_t verbosity_mask;
290 	uint32_t scic_log_object_mask;
291 	uint32_t scif_log_object_mask;
292 	uint8_t *header_buffer;
293 
294 	library_object_size = scif_library_get_object_size(SCI_MAX_CONTROLLERS);
295 
296 	isci->sci_library_memory =
297 	    malloc(library_object_size, M_ISCI, M_NOWAIT | M_ZERO );
298 
299 	isci->sci_library_handle = scif_library_construct(
300 	    isci->sci_library_memory, SCI_MAX_CONTROLLERS);
301 
302 	sci_object_set_association( isci->sci_library_handle, (void *)isci);
303 
304 	verbosity_mask = (1<<SCI_LOG_VERBOSITY_ERROR) |
305 	    (1<<SCI_LOG_VERBOSITY_WARNING) | (1<<SCI_LOG_VERBOSITY_INFO) |
306 	    (1<<SCI_LOG_VERBOSITY_TRACE);
307 
308 	scic_log_object_mask = 0xFFFFFFFF;
309 	scic_log_object_mask &= ~SCIC_LOG_OBJECT_COMPLETION_QUEUE;
310 	scic_log_object_mask &= ~SCIC_LOG_OBJECT_SSP_IO_REQUEST;
311 	scic_log_object_mask &= ~SCIC_LOG_OBJECT_STP_IO_REQUEST;
312 	scic_log_object_mask &= ~SCIC_LOG_OBJECT_SMP_IO_REQUEST;
313 	scic_log_object_mask &= ~SCIC_LOG_OBJECT_CONTROLLER;
314 
315 	scif_log_object_mask = 0xFFFFFFFF;
316 	scif_log_object_mask &= ~SCIF_LOG_OBJECT_CONTROLLER;
317 	scif_log_object_mask &= ~SCIF_LOG_OBJECT_IO_REQUEST;
318 
319 	TUNABLE_INT_FETCH("hw.isci.debug_level", &g_isci_debug_level);
320 
321 	sci_logger_enable(sci_object_get_logger(isci->sci_library_handle),
322 	    scif_log_object_mask, verbosity_mask);
323 
324 	sci_logger_enable(sci_object_get_logger(
325 	    scif_library_get_scic_handle(isci->sci_library_handle)),
326 	    scic_log_object_mask, verbosity_mask);
327 
328 	header_buffer = (uint8_t *)&isci->pci_common_header;
329 	for (uint8_t i = 0; i < sizeof(isci->pci_common_header); i++)
330 		header_buffer[i] = pci_read_config(isci->device, i, 1);
331 
332 	scic_library_set_pci_info(
333 	    scif_library_get_scic_handle(isci->sci_library_handle),
334 	    &isci->pci_common_header);
335 
336 	isci->oem_parameters_found = FALSE;
337 
338 	isci_get_oem_parameters(isci);
339 
340 	/* trigger interrupt if 32 completions occur before timeout expires */
341 	isci->coalesce_number = 32;
342 
343 	/* trigger interrupt if 2 microseconds elapse after a completion occurs,
344 	 *  regardless if "coalesce_number" completions have occurred
345 	 */
346 	isci->coalesce_timeout = 2;
347 
348 	isci->controller_count = scic_library_get_pci_device_controller_count(
349 	    scif_library_get_scic_handle(isci->sci_library_handle));
350 
351 	for (int index = 0; index < isci->controller_count; index++) {
352 		struct ISCI_CONTROLLER *controller = &isci->controllers[index];
353 		SCI_CONTROLLER_HANDLE_T scif_controller_handle;
354 
355 		controller->index = index;
356 		isci_controller_construct(controller, isci);
357 
358 		scif_controller_handle = controller->scif_controller_handle;
359 
360 		status = isci_controller_initialize(controller);
361 
362 		if(status != SCI_SUCCESS) {
363 			isci_log_message(0, "ISCI",
364 			    "isci_controller_initialize FAILED: %x\n",
365 			    status);
366 			return (status);
367 		}
368 
369 		error = isci_controller_allocate_memory(controller);
370 
371 		if (error != 0)
372 			return (error);
373 
374 		scif_controller_set_interrupt_coalescence(
375 		    scif_controller_handle, isci->coalesce_number,
376 		    isci->coalesce_timeout);
377 	}
378 
379 	/* FreeBSD provides us a hook to ensure we get a chance to start
380 	 *  our controllers and complete initial domain discovery before
381 	 *  it searches for the boot device.  Once we're done, we'll
382 	 *  disestablish the hook, signaling the kernel that is can proceed
383 	 *  with the boot process.
384 	 */
385 	isci->config_hook.ich_func = &isci_controller_start;
386 	isci->config_hook.ich_arg = &isci->controllers[0];
387 
388 	if (config_intrhook_establish(&isci->config_hook) != 0)
389 		isci_log_message(0, "ISCI",
390 		    "config_intrhook_establish failed!\n");
391 
392 	return (status);
393 }
394 
395 void
396 isci_allocate_dma_buffer_callback(void *arg, bus_dma_segment_t *seg,
397     int nseg, int error)
398 {
399 	struct ISCI_MEMORY *memory = (struct ISCI_MEMORY *)arg;
400 
401 	memory->error = error;
402 
403 	if (nseg != 1 || error != 0)
404 		isci_log_message(0, "ISCI",
405 		    "Failed to allocate physically contiguous memory!\n");
406 	else
407 		memory->physical_address = seg->ds_addr;
408 }
409 
410 int
411 isci_allocate_dma_buffer(device_t device, struct ISCI_MEMORY *memory)
412 {
413 	uint32_t status;
414 
415 	status = bus_dma_tag_create(bus_get_dma_tag(device),
416 	    0x40 /* cacheline alignment */, 0x0, BUS_SPACE_MAXADDR,
417 	    BUS_SPACE_MAXADDR, NULL, NULL, memory->size,
418 	    0x1 /* we want physically contiguous */,
419 	    memory->size, 0, NULL, NULL, &memory->dma_tag);
420 
421 	if(status == ENOMEM) {
422 		isci_log_message(0, "ISCI", "bus_dma_tag_create failed\n");
423 		return (status);
424 	}
425 
426 	status = bus_dmamem_alloc(memory->dma_tag,
427 	    (void **)&memory->virtual_address, BUS_DMA_ZERO, &memory->dma_map);
428 
429 	if(status == ENOMEM)
430 	{
431 		isci_log_message(0, "ISCI", "bus_dmamem_alloc failed\n");
432 		return (status);
433 	}
434 
435 	status = bus_dmamap_load(memory->dma_tag, memory->dma_map,
436 	    (void *)memory->virtual_address, memory->size,
437 	    isci_allocate_dma_buffer_callback, memory, 0);
438 
439 	if(status == EINVAL)
440 	{
441 		isci_log_message(0, "ISCI", "bus_dmamap_load failed\n");
442 		return (status);
443 	}
444 
445 	return (0);
446 }
447 
448 /**
449  * @brief This callback method asks the user to associate the supplied
450  *        lock with an operating environment specific locking construct.
451  *
452  * @param[in]  controller This parameter specifies the controller with
453  *             which this lock is to be associated.
454  * @param[in]  lock This parameter specifies the lock for which the
455  *             user should associate an operating environment specific
456  *             locking object.
457  *
458  * @see The SCI_LOCK_LEVEL enumeration for more information.
459  *
460  * @return none.
461  */
462 void
463 scif_cb_lock_associate(SCI_CONTROLLER_HANDLE_T controller,
464     SCI_LOCK_HANDLE_T lock)
465 {
466 
467 }
468 
469 /**
470  * @brief This callback method asks the user to de-associate the supplied
471  *        lock with an operating environment specific locking construct.
472  *
473  * @param[in]  controller This parameter specifies the controller with
474  *             which this lock is to be de-associated.
475  * @param[in]  lock This parameter specifies the lock for which the
476  *             user should de-associate an operating environment specific
477  *             locking object.
478  *
479  * @see The SCI_LOCK_LEVEL enumeration for more information.
480  *
481  * @return none.
482  */
483 void
484 scif_cb_lock_disassociate(SCI_CONTROLLER_HANDLE_T controller,
485     SCI_LOCK_HANDLE_T lock)
486 {
487 
488 }
489 
490 
491 /**
492  * @brief This callback method asks the user to acquire/get the lock.
493  *        This method should pend until the lock has been acquired.
494  *
495  * @param[in]  controller This parameter specifies the controller with
496  *             which this lock is associated.
497  * @param[in]  lock This parameter specifies the lock to be acquired.
498  *
499  * @return none
500  */
501 void
502 scif_cb_lock_acquire(SCI_CONTROLLER_HANDLE_T controller,
503     SCI_LOCK_HANDLE_T lock)
504 {
505 
506 }
507 
508 /**
509  * @brief This callback method asks the user to release a lock.
510  *
511  * @param[in]  controller This parameter specifies the controller with
512  *             which this lock is associated.
513  * @param[in]  lock This parameter specifies the lock to be released.
514  *
515  * @return none
516  */
517 void
518 scif_cb_lock_release(SCI_CONTROLLER_HANDLE_T controller,
519     SCI_LOCK_HANDLE_T lock)
520 {
521 }
522 
523 /**
524  * @brief This callback method creates an OS specific deferred task
525  *        for internal usage. The handler to deferred task is stored by OS
526  *        driver.
527  *
528  * @param[in] controller This parameter specifies the controller object
529  *            with which this callback is associated.
530  *
531  * @return none
532  */
533 void
534 scif_cb_start_internal_io_task_create(SCI_CONTROLLER_HANDLE_T controller)
535 {
536 
537 }
538 
539 /**
540  * @brief This callback method schedules a OS specific deferred task.
541  *
542  * @param[in] controller This parameter specifies the controller
543  *            object with which this callback is associated.
544  * @param[in] start_internal_io_task_routine This parameter specifies the
545  *            sci start_internal_io routine.
546  * @param[in] context This parameter specifies a handle to a parameter
547  *            that will be passed into the "start_internal_io_task_routine"
548  *            when it is invoked.
549  *
550  * @return none
551  */
552 void
553 scif_cb_start_internal_io_task_schedule(SCI_CONTROLLER_HANDLE_T scif_controller,
554     FUNCPTR start_internal_io_task_routine, void *context)
555 {
556 	/** @todo Use FreeBSD tasklet to defer this routine to a later time,
557 	 *  rather than calling the routine inline.
558 	 */
559 	SCI_START_INTERNAL_IO_ROUTINE sci_start_internal_io_routine =
560 	    (SCI_START_INTERNAL_IO_ROUTINE)start_internal_io_task_routine;
561 
562 	sci_start_internal_io_routine(context);
563 }
564 
565 /**
566  * @brief In this method the user must write to PCI memory via access.
567  *        This method is used for access to memory space and IO space.
568  *
569  * @param[in]  controller The controller for which to read a DWORD.
570  * @param[in]  address This parameter depicts the address into
571  *             which to write.
572  * @param[out] write_value This parameter depicts the value being written
573  *             into the PCI memory location.
574  *
575  * @todo These PCI memory access calls likely needs to be optimized into macros?
576  */
577 void
578 scic_cb_pci_write_dword(SCI_CONTROLLER_HANDLE_T scic_controller,
579     void *address, uint32_t write_value)
580 {
581 	SCI_CONTROLLER_HANDLE_T scif_controller =
582 	    (SCI_CONTROLLER_HANDLE_T) sci_object_get_association(scic_controller);
583 	struct ISCI_CONTROLLER *isci_controller =
584 	    (struct ISCI_CONTROLLER *) sci_object_get_association(scif_controller);
585 	struct isci_softc *isci = isci_controller->isci;
586 	uint32_t bar = (uint32_t)(((POINTER_UINT)address & 0xF0000000) >> 28);
587 	bus_size_t offset = (bus_size_t)((POINTER_UINT)address & 0x0FFFFFFF);
588 
589 	bus_space_write_4(isci->pci_bar[bar].bus_tag,
590 	    isci->pci_bar[bar].bus_handle, offset, write_value);
591 }
592 
593 /**
594  * @brief In this method the user must read from PCI memory via access.
595  *        This method is used for access to memory space and IO space.
596  *
597  * @param[in]  controller The controller for which to read a DWORD.
598  * @param[in]  address This parameter depicts the address from
599  *             which to read.
600  *
601  * @return The value being returned from the PCI memory location.
602  *
603  * @todo This PCI memory access calls likely need to be optimized into macro?
604  */
605 uint32_t
606 scic_cb_pci_read_dword(SCI_CONTROLLER_HANDLE_T scic_controller, void *address)
607 {
608 	SCI_CONTROLLER_HANDLE_T scif_controller =
609 		(SCI_CONTROLLER_HANDLE_T)sci_object_get_association(scic_controller);
610 	struct ISCI_CONTROLLER *isci_controller =
611 		(struct ISCI_CONTROLLER *)sci_object_get_association(scif_controller);
612 	struct isci_softc *isci = isci_controller->isci;
613 	uint32_t bar = (uint32_t)(((POINTER_UINT)address & 0xF0000000) >> 28);
614 	bus_size_t offset = (bus_size_t)((POINTER_UINT)address & 0x0FFFFFFF);
615 
616 	return (bus_space_read_4(isci->pci_bar[bar].bus_tag,
617 	    isci->pci_bar[bar].bus_handle, offset));
618 }
619 
620 /**
621  * @brief This method is called when the core requires the OS driver
622  *        to stall execution.  This method is utilized during initialization
623  *        or non-performance paths only.
624  *
625  * @param[in]  microseconds This parameter specifies the number of
626  *             microseconds for which to stall.  The operating system driver
627  *             is allowed to round this value up where necessary.
628  *
629  * @return none.
630  */
631 void
632 scic_cb_stall_execution(uint32_t microseconds)
633 {
634 
635 	DELAY(microseconds);
636 }
637 
638 /**
639  * @brief In this method the user must return the base address register (BAR)
640  *        value for the supplied base address register number.
641  *
642  * @param[in] controller The controller for which to retrieve the bar number.
643  * @param[in] bar_number This parameter depicts the BAR index/number to be read.
644  *
645  * @return Return a pointer value indicating the contents of the BAR.
646  * @retval NULL indicates an invalid BAR index/number was specified.
647  * @retval All other values indicate a valid VIRTUAL address from the BAR.
648  */
649 void *
650 scic_cb_pci_get_bar(SCI_CONTROLLER_HANDLE_T controller,
651     uint16_t bar_number)
652 {
653 
654 	return ((void *)(POINTER_UINT)((uint32_t)bar_number << 28));
655 }
656 
657 /**
658  * @brief This method informs the SCI Core user that a phy/link became
659  *        ready, but the phy is not allowed in the port.  In some
660  *        situations the underlying hardware only allows for certain phy
661  *        to port mappings.  If these mappings are violated, then this
662  *        API is invoked.
663  *
664  * @param[in] controller This parameter represents the controller which
665  *            contains the port.
666  * @param[in] port This parameter specifies the SCI port object for which
667  *            the callback is being invoked.
668  * @param[in] phy This parameter specifies the phy that came ready, but the
669  *            phy can't be a valid member of the port.
670  *
671  * @return none
672  */
673 void
674 scic_cb_port_invalid_link_up(SCI_CONTROLLER_HANDLE_T controller,
675     SCI_PORT_HANDLE_T port, SCI_PHY_HANDLE_T phy)
676 {
677 
678 }
679