upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / scsi / bfa / bfa_fcs_port.c
1 /*
2  * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
3  * All rights reserved
4  * www.brocade.com
5  *
6  * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License (GPL) Version 2 as
10  * published by the Free Software Foundation
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  */
17
18 /**
19  *  bfa_fcs_pport.c BFA FCS PPORT ( physical port)
20  */
21
22 #include <fcs/bfa_fcs.h>
23 #include <bfa_svc.h>
24 #include <fcs/bfa_fcs_fabric.h>
25 #include "fcs_trcmod.h"
26 #include "fcs.h"
27 #include "fcs_fabric.h"
28 #include "fcs_port.h"
29
30 BFA_TRC_FILE(FCS, PPORT);
31
32 static void
33 bfa_fcs_pport_event_handler(void *cbarg, bfa_pport_event_t event)
34 {
35         struct bfa_fcs_s      *fcs = cbarg;
36
37         bfa_trc(fcs, event);
38
39         switch (event) {
40         case BFA_PPORT_LINKUP:
41                 bfa_fcs_fabric_link_up(&fcs->fabric);
42                 break;
43
44         case BFA_PPORT_LINKDOWN:
45                 bfa_fcs_fabric_link_down(&fcs->fabric);
46                 break;
47
48         case BFA_PPORT_TRUNK_LINKDOWN:
49                 bfa_assert(0);
50                 break;
51
52         default:
53                 bfa_assert(0);
54         }
55 }
56
57 void
58 bfa_fcs_pport_attach(struct bfa_fcs_s *fcs)
59 {
60         bfa_fcport_event_register(fcs->bfa, bfa_fcs_pport_event_handler, fcs);
61 }