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