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