2 * PCI Express PCI Hot Plug Driver
4 * Copyright (C) 1995,2001 Compaq Computer Corporation
5 * Copyright (C) 2001 Greg Kroah-Hartman (greg@kroah.com)
6 * Copyright (C) 2001 IBM Corp.
7 * Copyright (C) 2003-2004 Intel Corporation
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or (at
14 * your option) any later version.
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
19 * NON INFRINGEMENT. See the GNU General Public License for more
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 * Send feedback to <greg@kroah.com>,<kristen.c.accardi@intel.com>
30 #include <linux/kernel.h>
31 #include <linux/module.h>
32 #include <linux/types.h>
33 #include <linux/pci.h>
34 #include <linux/interrupt.h>
40 #define DBG_K_TRACE_ENTRY ((unsigned int)0x00000001) /* On function entry */
41 #define DBG_K_TRACE_EXIT ((unsigned int)0x00000002) /* On function exit */
42 #define DBG_K_INFO ((unsigned int)0x00000004) /* Info messages */
43 #define DBG_K_ERROR ((unsigned int)0x00000008) /* Error messages */
44 #define DBG_K_TRACE (DBG_K_TRACE_ENTRY|DBG_K_TRACE_EXIT)
45 #define DBG_K_STANDARD (DBG_K_INFO|DBG_K_ERROR|DBG_K_TRACE)
46 /* Redefine this flagword to set debug level */
47 #define DEBUG_LEVEL DBG_K_STANDARD
49 #define DEFINE_DBG_BUFFER char __dbg_str_buf[256];
51 #define DBG_PRINT( dbg_flags, args... ) \
53 if ( DEBUG_LEVEL & ( dbg_flags ) ) \
56 len = sprintf( __dbg_str_buf, "%s:%d: %s: ", \
57 __FILE__, __LINE__, __FUNCTION__ ); \
58 sprintf( __dbg_str_buf + len, args ); \
59 printk( KERN_NOTICE "%s\n", __dbg_str_buf ); \
63 #define DBG_ENTER_ROUTINE DBG_PRINT (DBG_K_TRACE_ENTRY, "%s", "[Entry]");
64 #define DBG_LEAVE_ROUTINE DBG_PRINT (DBG_K_TRACE_EXIT, "%s", "[Exit]");
66 #define DEFINE_DBG_BUFFER
67 #define DBG_ENTER_ROUTINE
68 #define DBG_LEAVE_ROUTINE
87 } __attribute__ ((packed
));
89 /* offsets to the controller registers based on the above structure layout */
91 PCIECAPID
= offsetof(struct ctrl_reg
, cap_id
),
92 NXTCAPPTR
= offsetof(struct ctrl_reg
, nxt_ptr
),
93 CAPREG
= offsetof(struct ctrl_reg
, cap_reg
),
94 DEVCAP
= offsetof(struct ctrl_reg
, dev_cap
),
95 DEVCTRL
= offsetof(struct ctrl_reg
, dev_ctrl
),
96 DEVSTATUS
= offsetof(struct ctrl_reg
, dev_status
),
97 LNKCAP
= offsetof(struct ctrl_reg
, lnk_cap
),
98 LNKCTRL
= offsetof(struct ctrl_reg
, lnk_ctrl
),
99 LNKSTATUS
= offsetof(struct ctrl_reg
, lnk_status
),
100 SLOTCAP
= offsetof(struct ctrl_reg
, slot_cap
),
101 SLOTCTRL
= offsetof(struct ctrl_reg
, slot_ctrl
),
102 SLOTSTATUS
= offsetof(struct ctrl_reg
, slot_status
),
103 ROOTCTRL
= offsetof(struct ctrl_reg
, root_ctrl
),
104 ROOTSTATUS
= offsetof(struct ctrl_reg
, root_status
),
106 static int pcie_cap_base
= 0; /* Base of the PCI Express capability item structure */
108 #define PCIE_CAP_ID(cb) ( cb + PCIECAPID )
109 #define NXT_CAP_PTR(cb) ( cb + NXTCAPPTR )
110 #define CAP_REG(cb) ( cb + CAPREG )
111 #define DEV_CAP(cb) ( cb + DEVCAP )
112 #define DEV_CTRL(cb) ( cb + DEVCTRL )
113 #define DEV_STATUS(cb) ( cb + DEVSTATUS )
114 #define LNK_CAP(cb) ( cb + LNKCAP )
115 #define LNK_CTRL(cb) ( cb + LNKCTRL )
116 #define LNK_STATUS(cb) ( cb + LNKSTATUS )
117 #define SLOT_CAP(cb) ( cb + SLOTCAP )
118 #define SLOT_CTRL(cb) ( cb + SLOTCTRL )
119 #define SLOT_STATUS(cb) ( cb + SLOTSTATUS )
120 #define ROOT_CTRL(cb) ( cb + ROOTCTRL )
121 #define ROOT_STATUS(cb) ( cb + ROOTSTATUS )
123 #define hp_register_read_word(pdev, reg , value) \
124 pci_read_config_word(pdev, reg, &value)
126 #define hp_register_read_dword(pdev, reg , value) \
127 pci_read_config_dword(pdev, reg, &value)
129 #define hp_register_write_word(pdev, reg , value) \
130 pci_write_config_word(pdev, reg, value)
132 #define hp_register_dwrite_word(pdev, reg , value) \
133 pci_write_config_dword(pdev, reg, value)
135 /* Field definitions in PCI Express Capabilities Register */
136 #define CAP_VER 0x000F
137 #define DEV_PORT_TYPE 0x00F0
138 #define SLOT_IMPL 0x0100
139 #define MSG_NUM 0x3E00
141 /* Device or Port Type */
142 #define NAT_ENDPT 0x00
143 #define LEG_ENDPT 0x01
144 #define ROOT_PORT 0x04
145 #define UP_STREAM 0x05
146 #define DN_STREAM 0x06
147 #define PCIE_PCI_BRDG 0x07
148 #define PCI_PCIE_BRDG 0x10
150 /* Field definitions in Device Capabilities Register */
151 #define DATTN_BUTTN_PRSN 0x1000
152 #define DATTN_LED_PRSN 0x2000
153 #define DPWR_LED_PRSN 0x4000
155 /* Field definitions in Link Capabilities Register */
156 #define MAX_LNK_SPEED 0x000F
157 #define MAX_LNK_WIDTH 0x03F0
159 /* Link Width Encoding */
168 /*Field definitions of Link Status Register */
169 #define LNK_SPEED 0x000F
170 #define NEG_LINK_WD 0x03F0
171 #define LNK_TRN_ERR 0x0400
172 #define LNK_TRN 0x0800
173 #define SLOT_CLK_CONF 0x1000
175 /* Field definitions in Slot Capabilities Register */
176 #define ATTN_BUTTN_PRSN 0x00000001
177 #define PWR_CTRL_PRSN 0x00000002
178 #define MRL_SENS_PRSN 0x00000004
179 #define ATTN_LED_PRSN 0x00000008
180 #define PWR_LED_PRSN 0x00000010
181 #define HP_SUPR_RM_SUP 0x00000020
182 #define HP_CAP 0x00000040
183 #define SLOT_PWR_VALUE 0x000003F8
184 #define SLOT_PWR_LIMIT 0x00000C00
185 #define PSN 0xFFF80000 /* PSN: Physical Slot Number */
187 /* Field definitions in Slot Control Register */
188 #define ATTN_BUTTN_ENABLE 0x0001
189 #define PWR_FAULT_DETECT_ENABLE 0x0002
190 #define MRL_DETECT_ENABLE 0x0004
191 #define PRSN_DETECT_ENABLE 0x0008
192 #define CMD_CMPL_INTR_ENABLE 0x0010
193 #define HP_INTR_ENABLE 0x0020
194 #define ATTN_LED_CTRL 0x00C0
195 #define PWR_LED_CTRL 0x0300
196 #define PWR_CTRL 0x0400
198 /* Attention indicator and Power indicator states */
200 #define LED_BLINK 0x10
203 /* Power Control Command */
205 #define POWER_OFF 0x0400
207 /* Field definitions in Slot Status Register */
208 #define ATTN_BUTTN_PRESSED 0x0001
209 #define PWR_FAULT_DETECTED 0x0002
210 #define MRL_SENS_CHANGED 0x0004
211 #define PRSN_DETECT_CHANGED 0x0008
212 #define CMD_COMPLETED 0x0010
213 #define MRL_STATE 0x0020
214 #define PRSN_STATE 0x0040
216 static spinlock_t hpc_event_lock
;
218 DEFINE_DBG_BUFFER
/* Debug string buffer for entire HPC defined here */
219 static struct php_ctlr_state_s
*php_ctlr_list_head
; /* HPC state linked list */
220 static int ctlr_seq_num
= 0; /* Controller sequence # */
221 static spinlock_t list_lock
;
223 static irqreturn_t
pcie_isr(int IRQ
, void *dev_id
, struct pt_regs
*regs
);
225 static void start_int_poll_timer(struct php_ctlr_state_s
*php_ctlr
, int seconds
);
227 /* This is the interrupt polling timeout function. */
228 static void int_poll_timeout(unsigned long lphp_ctlr
)
230 struct php_ctlr_state_s
*php_ctlr
= (struct php_ctlr_state_s
*)lphp_ctlr
;
235 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
239 /* Poll for interrupt events. regs == NULL => polling */
240 pcie_isr( 0, (void *)php_ctlr
, NULL
);
242 init_timer(&php_ctlr
->int_poll_timer
);
244 if (!pciehp_poll_time
)
245 pciehp_poll_time
= 2; /* reset timer to poll in 2 secs if user doesn't specify at module installation*/
247 start_int_poll_timer(php_ctlr
, pciehp_poll_time
);
252 /* This function starts the interrupt polling timer. */
253 static void start_int_poll_timer(struct php_ctlr_state_s
*php_ctlr
, int seconds
)
256 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
260 if ( ( seconds
<= 0 ) || ( seconds
> 60 ) )
261 seconds
= 2; /* Clamp to sane value */
263 php_ctlr
->int_poll_timer
.function
= &int_poll_timeout
;
264 php_ctlr
->int_poll_timer
.data
= (unsigned long)php_ctlr
; /* Instance data */
265 php_ctlr
->int_poll_timer
.expires
= jiffies
+ seconds
* HZ
;
266 add_timer(&php_ctlr
->int_poll_timer
);
271 static int pcie_write_cmd(struct slot
*slot
, u16 cmd
)
273 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
280 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
284 retval
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_STATUS(slot
->ctrl
->cap_base
), slot_status
);
286 err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__
);
290 if ((slot_status
& CMD_COMPLETED
) == CMD_COMPLETED
) {
291 /* After 1 sec and CMD_COMPLETED still not set, just proceed forward to issue
292 the next command according to spec. Just print out the error message */
293 dbg("%s : CMD_COMPLETED not clear after 1 sec.\n", __FUNCTION__
);
296 retval
= hp_register_write_word(php_ctlr
->pci_dev
, SLOT_CTRL(slot
->ctrl
->cap_base
), cmd
| CMD_CMPL_INTR_ENABLE
);
298 err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__
);
306 static int hpc_check_lnk_status(struct controller
*ctrl
)
308 struct php_ctlr_state_s
*php_ctlr
= ctrl
->hpc_ctlr_handle
;
315 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
319 retval
= hp_register_read_word(php_ctlr
->pci_dev
, LNK_STATUS(ctrl
->cap_base
), lnk_status
);
322 err("%s : hp_register_read_word LNK_STATUS failed\n", __FUNCTION__
);
326 dbg("%s: lnk_status = %x\n", __FUNCTION__
, lnk_status
);
327 if ( (lnk_status
& LNK_TRN
) || (lnk_status
& LNK_TRN_ERR
) ||
328 !(lnk_status
& NEG_LINK_WD
)) {
329 err("%s : Link Training Error occurs \n", __FUNCTION__
);
339 static int hpc_get_attention_status(struct slot
*slot
, u8
*status
)
341 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
349 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
353 retval
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_ctrl
);
356 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
360 dbg("%s: SLOT_CTRL %x, value read %x\n", __FUNCTION__
,SLOT_CTRL(slot
->ctrl
->cap_base
), slot_ctrl
);
362 atten_led_state
= (slot_ctrl
& ATTN_LED_CTRL
) >> 6;
364 switch (atten_led_state
) {
366 *status
= 0xFF; /* Reserved */
369 *status
= 1; /* On */
372 *status
= 2; /* Blink */
375 *status
= 0; /* Off */
386 static int hpc_get_power_status(struct slot
* slot
, u8
*status
)
388 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
396 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
400 retval
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_ctrl
);
403 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
406 dbg("%s: SLOT_CTRL %x value read %x\n", __FUNCTION__
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_ctrl
);
408 pwr_state
= (slot_ctrl
& PWR_CTRL
) >> 10;
427 static int hpc_get_latch_status(struct slot
*slot
, u8
*status
)
429 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
436 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
440 retval
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_STATUS(slot
->ctrl
->cap_base
), slot_status
);
443 err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__
);
447 *status
= (((slot_status
& MRL_STATE
) >> 5) == 0) ? 0 : 1;
453 static int hpc_get_adapter_status(struct slot
*slot
, u8
*status
)
455 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
463 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
467 retval
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_STATUS(slot
->ctrl
->cap_base
), slot_status
);
470 err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__
);
473 card_state
= (u8
)((slot_status
& PRSN_STATE
) >> 6);
474 *status
= (card_state
== 1) ? 1 : 0;
480 static int hpc_query_power_fault(struct slot
* slot
)
482 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
490 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
494 retval
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_STATUS(slot
->ctrl
->cap_base
), slot_status
);
497 err("%s : Cannot check for power fault\n", __FUNCTION__
);
500 pwr_fault
= (u8
)((slot_status
& PWR_FAULT_DETECTED
) >> 1);
506 static int hpc_set_attention_status(struct slot
*slot
, u8 value
)
508 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
516 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
520 if (slot
->hp_slot
>= php_ctlr
->num_slots
) {
521 err("%s: Invalid HPC slot number!\n", __FUNCTION__
);
524 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_ctrl
);
527 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
532 case 0 : /* turn off */
533 slot_cmd
= (slot_ctrl
& ~ATTN_LED_CTRL
) | 0x00C0;
535 case 1: /* turn on */
536 slot_cmd
= (slot_ctrl
& ~ATTN_LED_CTRL
) | 0x0040;
538 case 2: /* turn blink */
539 slot_cmd
= (slot_ctrl
& ~ATTN_LED_CTRL
) | 0x0080;
544 if (!pciehp_poll_mode
)
545 slot_cmd
= slot_cmd
| HP_INTR_ENABLE
;
547 pcie_write_cmd(slot
, slot_cmd
);
548 dbg("%s: SLOT_CTRL %x write cmd %x\n", __FUNCTION__
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_cmd
);
555 static void hpc_set_green_led_on(struct slot
*slot
)
557 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
565 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
569 if (slot
->hp_slot
>= php_ctlr
->num_slots
) {
570 err("%s: Invalid HPC slot number!\n", __FUNCTION__
);
574 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_ctrl
);
577 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
580 slot_cmd
= (slot_ctrl
& ~PWR_LED_CTRL
) | 0x0100;
581 if (!pciehp_poll_mode
)
582 slot_cmd
= slot_cmd
| HP_INTR_ENABLE
;
584 pcie_write_cmd(slot
, slot_cmd
);
586 dbg("%s: SLOT_CTRL %x write cmd %x\n",__FUNCTION__
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_cmd
);
591 static void hpc_set_green_led_off(struct slot
*slot
)
593 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
601 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
605 if (slot
->hp_slot
>= php_ctlr
->num_slots
) {
606 err("%s: Invalid HPC slot number!\n", __FUNCTION__
);
610 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_ctrl
);
613 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
617 slot_cmd
= (slot_ctrl
& ~PWR_LED_CTRL
) | 0x0300;
619 if (!pciehp_poll_mode
)
620 slot_cmd
= slot_cmd
| HP_INTR_ENABLE
;
621 pcie_write_cmd(slot
, slot_cmd
);
622 dbg("%s: SLOT_CTRL %x write cmd %x\n", __FUNCTION__
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_cmd
);
628 static void hpc_set_green_led_blink(struct slot
*slot
)
630 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
638 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
642 if (slot
->hp_slot
>= php_ctlr
->num_slots
) {
643 err("%s: Invalid HPC slot number!\n", __FUNCTION__
);
647 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_ctrl
);
650 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
654 slot_cmd
= (slot_ctrl
& ~PWR_LED_CTRL
) | 0x0200;
656 if (!pciehp_poll_mode
)
657 slot_cmd
= slot_cmd
| HP_INTR_ENABLE
;
658 pcie_write_cmd(slot
, slot_cmd
);
660 dbg("%s: SLOT_CTRL %x write cmd %x\n",__FUNCTION__
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_cmd
);
665 int pcie_get_ctlr_slot_config(struct controller
*ctrl
,
666 int *num_ctlr_slots
, /* number of slots in this HPC; only 1 in PCIE */
667 int *first_device_num
, /* PCI dev num of the first slot in this PCIE */
668 int *physical_slot_num
, /* phy slot num of the first slot in this PCIE */
671 struct php_ctlr_state_s
*php_ctlr
= ctrl
->hpc_ctlr_handle
;
678 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
682 *first_device_num
= 0;
685 rc
= hp_register_read_dword(php_ctlr
->pci_dev
, SLOT_CAP(ctrl
->cap_base
), slot_cap
);
688 err("%s : hp_register_read_dword SLOT_CAP failed\n", __FUNCTION__
);
692 *physical_slot_num
= slot_cap
>> 19;
693 dbg("%s: PSN %d \n", __FUNCTION__
, *physical_slot_num
);
695 *ctrlcap
= slot_cap
& 0x0000007f;
701 static void hpc_release_ctlr(struct controller
*ctrl
)
703 struct php_ctlr_state_s
*php_ctlr
= ctrl
->hpc_ctlr_handle
;
704 struct php_ctlr_state_s
*p
, *p_prev
;
709 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
713 if (pciehp_poll_mode
) {
714 del_timer(&php_ctlr
->int_poll_timer
);
717 free_irq(php_ctlr
->irq
, ctrl
);
720 pci_disable_msi(php_ctlr
->pci_dev
);
723 if (php_ctlr
->pci_dev
)
724 php_ctlr
->pci_dev
= NULL
;
726 spin_lock(&list_lock
);
727 p
= php_ctlr_list_head
;
732 p_prev
->pnext
= p
->pnext
;
734 php_ctlr_list_head
= p
->pnext
;
741 spin_unlock(&list_lock
);
749 static int hpc_power_on_slot(struct slot
* slot
)
751 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
753 u16 slot_ctrl
, slot_status
;
760 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
764 dbg("%s: slot->hp_slot %x\n", __FUNCTION__
, slot
->hp_slot
);
765 if (slot
->hp_slot
>= php_ctlr
->num_slots
) {
766 err("%s: Invalid HPC slot number!\n", __FUNCTION__
);
770 /* Clear sticky power-fault bit from previous power failures */
771 hp_register_read_word(php_ctlr
->pci_dev
,
772 SLOT_STATUS(slot
->ctrl
->cap_base
), slot_status
);
773 slot_status
&= PWR_FAULT_DETECTED
;
775 hp_register_write_word(php_ctlr
->pci_dev
,
776 SLOT_STATUS(slot
->ctrl
->cap_base
), slot_status
);
778 retval
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_ctrl
);
781 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
785 slot_cmd
= (slot_ctrl
& ~PWR_CTRL
) | POWER_ON
;
787 if (!pciehp_poll_mode
)
788 slot_cmd
= slot_cmd
| HP_INTR_ENABLE
;
790 retval
= pcie_write_cmd(slot
, slot_cmd
);
793 err("%s: Write %x command failed!\n", __FUNCTION__
, slot_cmd
);
796 dbg("%s: SLOT_CTRL %x write cmd %x\n",__FUNCTION__
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_cmd
);
803 static int hpc_power_off_slot(struct slot
* slot
)
805 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
814 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
818 dbg("%s: slot->hp_slot %x\n", __FUNCTION__
, slot
->hp_slot
);
820 if (slot
->hp_slot
>= php_ctlr
->num_slots
) {
821 err("%s: Invalid HPC slot number!\n", __FUNCTION__
);
824 retval
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_ctrl
);
827 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
831 slot_cmd
= (slot_ctrl
& ~PWR_CTRL
) | POWER_OFF
;
833 if (!pciehp_poll_mode
)
834 slot_cmd
= slot_cmd
| HP_INTR_ENABLE
;
836 retval
= pcie_write_cmd(slot
, slot_cmd
);
839 err("%s: Write command failed!\n", __FUNCTION__
);
842 dbg("%s: SLOT_CTRL %x write cmd %x\n",__FUNCTION__
, SLOT_CTRL(slot
->ctrl
->cap_base
), slot_cmd
);
849 static irqreturn_t
pcie_isr(int IRQ
, void *dev_id
, struct pt_regs
*regs
)
851 struct controller
*ctrl
= NULL
;
852 struct php_ctlr_state_s
*php_ctlr
;
853 u8 schedule_flag
= 0;
854 u16 slot_status
, intr_detect
, intr_loc
;
856 int hp_slot
= 0; /* only 1 slot per PCI Express port */
862 if (!pciehp_poll_mode
) {
864 php_ctlr
= ctrl
->hpc_ctlr_handle
;
867 ctrl
= (struct controller
*)php_ctlr
->callback_instance_id
;
871 dbg("%s: dev_id %p ctlr == NULL\n", __FUNCTION__
, (void*) dev_id
);
876 dbg("%s: php_ctlr == NULL\n", __FUNCTION__
);
880 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_STATUS(ctrl
->cap_base
), slot_status
);
882 err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__
);
886 intr_detect
= ( ATTN_BUTTN_PRESSED
| PWR_FAULT_DETECTED
| MRL_SENS_CHANGED
|
887 PRSN_DETECT_CHANGED
| CMD_COMPLETED
);
889 intr_loc
= slot_status
& intr_detect
;
891 /* Check to see if it was our interrupt */
895 dbg("%s: intr_loc %x\n", __FUNCTION__
, intr_loc
);
896 /* Mask Hot-plug Interrupt Enable */
897 if (!pciehp_poll_mode
) {
898 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_CTRL(ctrl
->cap_base
), temp_word
);
900 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
904 dbg("%s: hp_register_read_word SLOT_CTRL with value %x\n", __FUNCTION__
, temp_word
);
905 temp_word
= (temp_word
& ~HP_INTR_ENABLE
& ~CMD_CMPL_INTR_ENABLE
) | 0x00;
907 rc
= hp_register_write_word(php_ctlr
->pci_dev
, SLOT_CTRL(ctrl
->cap_base
), temp_word
);
909 err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__
);
913 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_STATUS(ctrl
->cap_base
), slot_status
);
915 err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__
);
918 dbg("%s: hp_register_read_word SLOT_STATUS with value %x\n", __FUNCTION__
, slot_status
);
920 /* Clear command complete interrupt caused by this write */
922 rc
= hp_register_write_word(php_ctlr
->pci_dev
, SLOT_STATUS(ctrl
->cap_base
), temp_word
);
924 err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__
);
929 if (intr_loc
& CMD_COMPLETED
) {
931 * Command Complete Interrupt Pending
933 wake_up_interruptible(&ctrl
->queue
);
936 if ((php_ctlr
->switch_change_callback
) && (intr_loc
& MRL_SENS_CHANGED
))
937 schedule_flag
+= php_ctlr
->switch_change_callback(
938 hp_slot
, php_ctlr
->callback_instance_id
);
939 if ((php_ctlr
->attention_button_callback
) && (intr_loc
& ATTN_BUTTN_PRESSED
))
940 schedule_flag
+= php_ctlr
->attention_button_callback(
941 hp_slot
, php_ctlr
->callback_instance_id
);
942 if ((php_ctlr
->presence_change_callback
) && (intr_loc
& PRSN_DETECT_CHANGED
))
943 schedule_flag
+= php_ctlr
->presence_change_callback(
944 hp_slot
, php_ctlr
->callback_instance_id
);
945 if ((php_ctlr
->power_fault_callback
) && (intr_loc
& PWR_FAULT_DETECTED
))
946 schedule_flag
+= php_ctlr
->power_fault_callback(
947 hp_slot
, php_ctlr
->callback_instance_id
);
949 /* Clear all events after serving them */
951 rc
= hp_register_write_word(php_ctlr
->pci_dev
, SLOT_STATUS(ctrl
->cap_base
), temp_word
);
953 err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__
);
956 /* Unmask Hot-plug Interrupt Enable */
957 if (!pciehp_poll_mode
) {
958 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_CTRL(ctrl
->cap_base
), temp_word
);
960 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
964 dbg("%s: Unmask Hot-plug Interrupt Enable\n", __FUNCTION__
);
965 temp_word
= (temp_word
& ~HP_INTR_ENABLE
) | HP_INTR_ENABLE
;
967 rc
= hp_register_write_word(php_ctlr
->pci_dev
, SLOT_CTRL(ctrl
->cap_base
), temp_word
);
969 err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__
);
973 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_STATUS(ctrl
->cap_base
), slot_status
);
975 err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__
);
979 /* Clear command complete interrupt caused by this write */
981 rc
= hp_register_write_word(php_ctlr
->pci_dev
, SLOT_STATUS(ctrl
->cap_base
), temp_word
);
983 err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__
);
986 dbg("%s: hp_register_write_word SLOT_STATUS with value %x\n", __FUNCTION__
, temp_word
);
992 static int hpc_get_max_lnk_speed (struct slot
*slot
, enum pci_bus_speed
*value
)
994 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
995 enum pcie_link_speed lnk_speed
;
1002 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
1006 if (slot
->hp_slot
>= php_ctlr
->num_slots
) {
1007 err("%s: Invalid HPC slot number!\n", __FUNCTION__
);
1011 retval
= hp_register_read_dword(php_ctlr
->pci_dev
, LNK_CAP(slot
->ctrl
->cap_base
), lnk_cap
);
1014 err("%s : hp_register_read_dword LNK_CAP failed\n", __FUNCTION__
);
1018 switch (lnk_cap
& 0x000F) {
1020 lnk_speed
= PCIE_2PT5GB
;
1023 lnk_speed
= PCIE_LNK_SPEED_UNKNOWN
;
1028 dbg("Max link speed = %d\n", lnk_speed
);
1033 static int hpc_get_max_lnk_width (struct slot
*slot
, enum pcie_link_width
*value
)
1035 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
1036 enum pcie_link_width lnk_wdth
;
1043 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
1047 if (slot
->hp_slot
>= php_ctlr
->num_slots
) {
1048 err("%s: Invalid HPC slot number!\n", __FUNCTION__
);
1052 retval
= hp_register_read_dword(php_ctlr
->pci_dev
, LNK_CAP(slot
->ctrl
->cap_base
), lnk_cap
);
1055 err("%s : hp_register_read_dword LNK_CAP failed\n", __FUNCTION__
);
1059 switch ((lnk_cap
& 0x03F0) >> 4){
1061 lnk_wdth
= PCIE_LNK_WIDTH_RESRV
;
1064 lnk_wdth
= PCIE_LNK_X1
;
1067 lnk_wdth
= PCIE_LNK_X2
;
1070 lnk_wdth
= PCIE_LNK_X4
;
1073 lnk_wdth
= PCIE_LNK_X8
;
1076 lnk_wdth
= PCIE_LNK_X12
;
1079 lnk_wdth
= PCIE_LNK_X16
;
1082 lnk_wdth
= PCIE_LNK_X32
;
1085 lnk_wdth
= PCIE_LNK_WIDTH_UNKNOWN
;
1090 dbg("Max link width = %d\n", lnk_wdth
);
1095 static int hpc_get_cur_lnk_speed (struct slot
*slot
, enum pci_bus_speed
*value
)
1097 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
1098 enum pcie_link_speed lnk_speed
= PCI_SPEED_UNKNOWN
;
1105 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
1109 if (slot
->hp_slot
>= php_ctlr
->num_slots
) {
1110 err("%s: Invalid HPC slot number!\n", __FUNCTION__
);
1114 retval
= hp_register_read_word(php_ctlr
->pci_dev
, LNK_STATUS(slot
->ctrl
->cap_base
), lnk_status
);
1117 err("%s : hp_register_read_word LNK_STATUS failed\n", __FUNCTION__
);
1121 switch (lnk_status
& 0x0F) {
1123 lnk_speed
= PCIE_2PT5GB
;
1126 lnk_speed
= PCIE_LNK_SPEED_UNKNOWN
;
1131 dbg("Current link speed = %d\n", lnk_speed
);
1136 static int hpc_get_cur_lnk_width (struct slot
*slot
, enum pcie_link_width
*value
)
1138 struct php_ctlr_state_s
*php_ctlr
= slot
->ctrl
->hpc_ctlr_handle
;
1139 enum pcie_link_width lnk_wdth
= PCIE_LNK_WIDTH_UNKNOWN
;
1146 err("%s: Invalid HPC controller handle!\n", __FUNCTION__
);
1150 if (slot
->hp_slot
>= php_ctlr
->num_slots
) {
1151 err("%s: Invalid HPC slot number!\n", __FUNCTION__
);
1155 retval
= hp_register_read_word(php_ctlr
->pci_dev
, LNK_STATUS(slot
->ctrl
->cap_base
), lnk_status
);
1158 err("%s : hp_register_read_word LNK_STATUS failed\n", __FUNCTION__
);
1162 switch ((lnk_status
& 0x03F0) >> 4){
1164 lnk_wdth
= PCIE_LNK_WIDTH_RESRV
;
1167 lnk_wdth
= PCIE_LNK_X1
;
1170 lnk_wdth
= PCIE_LNK_X2
;
1173 lnk_wdth
= PCIE_LNK_X4
;
1176 lnk_wdth
= PCIE_LNK_X8
;
1179 lnk_wdth
= PCIE_LNK_X12
;
1182 lnk_wdth
= PCIE_LNK_X16
;
1185 lnk_wdth
= PCIE_LNK_X32
;
1188 lnk_wdth
= PCIE_LNK_WIDTH_UNKNOWN
;
1193 dbg("Current link width = %d\n", lnk_wdth
);
1198 static struct hpc_ops pciehp_hpc_ops
= {
1199 .power_on_slot
= hpc_power_on_slot
,
1200 .power_off_slot
= hpc_power_off_slot
,
1201 .set_attention_status
= hpc_set_attention_status
,
1202 .get_power_status
= hpc_get_power_status
,
1203 .get_attention_status
= hpc_get_attention_status
,
1204 .get_latch_status
= hpc_get_latch_status
,
1205 .get_adapter_status
= hpc_get_adapter_status
,
1207 .get_max_bus_speed
= hpc_get_max_lnk_speed
,
1208 .get_cur_bus_speed
= hpc_get_cur_lnk_speed
,
1209 .get_max_lnk_width
= hpc_get_max_lnk_width
,
1210 .get_cur_lnk_width
= hpc_get_cur_lnk_width
,
1212 .query_power_fault
= hpc_query_power_fault
,
1213 .green_led_on
= hpc_set_green_led_on
,
1214 .green_led_off
= hpc_set_green_led_off
,
1215 .green_led_blink
= hpc_set_green_led_blink
,
1217 .release_ctlr
= hpc_release_ctlr
,
1218 .check_lnk_status
= hpc_check_lnk_status
,
1221 int pcie_init(struct controller
* ctrl
, struct pcie_device
*dev
)
1223 struct php_ctlr_state_s
*php_ctlr
, *p
;
1224 void *instance_id
= ctrl
;
1226 static int first
= 1;
1229 u16 intr_enable
= 0;
1231 int cap_base
, saved_cap_base
;
1232 u16 slot_status
, slot_ctrl
;
1233 struct pci_dev
*pdev
;
1237 spin_lock_init(&list_lock
);
1238 php_ctlr
= (struct php_ctlr_state_s
*) kmalloc(sizeof(struct php_ctlr_state_s
), GFP_KERNEL
);
1240 if (!php_ctlr
) { /* allocate controller state data */
1241 err("%s: HPC controller memory allocation error!\n", __FUNCTION__
);
1245 memset(php_ctlr
, 0, sizeof(struct php_ctlr_state_s
));
1248 php_ctlr
->pci_dev
= pdev
; /* save pci_dev in context */
1250 dbg("%s: hotplug controller vendor id 0x%x device id 0x%x\n",
1251 __FUNCTION__
, pdev
->vendor
, pdev
->device
);
1253 saved_cap_base
= pcie_cap_base
;
1255 if ((cap_base
= pci_find_capability(pdev
, PCI_CAP_ID_EXP
)) == 0) {
1256 dbg("%s: Can't find PCI_CAP_ID_EXP (0x10)\n", __FUNCTION__
);
1257 goto abort_free_ctlr
;
1260 ctrl
->cap_base
= cap_base
;
1262 dbg("%s: pcie_cap_base %x\n", __FUNCTION__
, pcie_cap_base
);
1264 rc
= hp_register_read_word(pdev
, CAP_REG(ctrl
->cap_base
), cap_reg
);
1266 err("%s : hp_register_read_word CAP_REG failed\n", __FUNCTION__
);
1267 goto abort_free_ctlr
;
1269 dbg("%s: CAP_REG offset %x cap_reg %x\n", __FUNCTION__
, CAP_REG(ctrl
->cap_base
), cap_reg
);
1271 if (((cap_reg
& SLOT_IMPL
) == 0) || (((cap_reg
& DEV_PORT_TYPE
) != 0x0040)
1272 && ((cap_reg
& DEV_PORT_TYPE
) != 0x0060))) {
1273 dbg("%s : This is not a root port or the port is not connected to a slot\n", __FUNCTION__
);
1274 goto abort_free_ctlr
;
1277 rc
= hp_register_read_dword(php_ctlr
->pci_dev
, SLOT_CAP(ctrl
->cap_base
), slot_cap
);
1279 err("%s : hp_register_read_word CAP_REG failed\n", __FUNCTION__
);
1280 goto abort_free_ctlr
;
1282 dbg("%s: SLOT_CAP offset %x slot_cap %x\n", __FUNCTION__
, SLOT_CAP(ctrl
->cap_base
), slot_cap
);
1284 if (!(slot_cap
& HP_CAP
)) {
1285 dbg("%s : This slot is not hot-plug capable\n", __FUNCTION__
);
1286 goto abort_free_ctlr
;
1288 /* For debugging purpose */
1289 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_STATUS(ctrl
->cap_base
), slot_status
);
1291 err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__
);
1292 goto abort_free_ctlr
;
1294 dbg("%s: SLOT_STATUS offset %x slot_status %x\n", __FUNCTION__
, SLOT_STATUS(ctrl
->cap_base
), slot_status
);
1296 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_CTRL(ctrl
->cap_base
), slot_ctrl
);
1298 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
1299 goto abort_free_ctlr
;
1301 dbg("%s: SLOT_CTRL offset %x slot_ctrl %x\n", __FUNCTION__
, SLOT_CTRL(ctrl
->cap_base
), slot_ctrl
);
1304 spin_lock_init(&hpc_event_lock
);
1308 for ( rc
= 0; rc
< DEVICE_COUNT_RESOURCE
; rc
++)
1309 if (pci_resource_len(pdev
, rc
) > 0)
1310 dbg("pci resource[%d] start=0x%lx(len=0x%lx)\n", rc
,
1311 pci_resource_start(pdev
, rc
), pci_resource_len(pdev
, rc
));
1313 info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev
->vendor
, pdev
->device
,
1314 pdev
->subsystem_vendor
, pdev
->subsystem_device
);
1316 if (pci_enable_device(pdev
))
1317 goto abort_free_ctlr
;
1319 init_MUTEX(&ctrl
->crit_sect
);
1320 /* setup wait queue */
1321 init_waitqueue_head(&ctrl
->queue
);
1324 php_ctlr
->irq
= dev
->irq
;
1326 /* Save interrupt callback info */
1327 php_ctlr
->attention_button_callback
= pciehp_handle_attention_button
;
1328 php_ctlr
->switch_change_callback
= pciehp_handle_switch_change
;
1329 php_ctlr
->presence_change_callback
= pciehp_handle_presence_change
;
1330 php_ctlr
->power_fault_callback
= pciehp_handle_power_fault
;
1331 php_ctlr
->callback_instance_id
= instance_id
;
1333 /* return PCI Controller Info */
1334 php_ctlr
->slot_device_offset
= 0;
1335 php_ctlr
->num_slots
= 1;
1337 /* Mask Hot-plug Interrupt Enable */
1338 rc
= hp_register_read_word(pdev
, SLOT_CTRL(ctrl
->cap_base
), temp_word
);
1340 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
1341 goto abort_free_ctlr
;
1344 dbg("%s: SLOT_CTRL %x value read %x\n", __FUNCTION__
, SLOT_CTRL(ctrl
->cap_base
), temp_word
);
1345 temp_word
= (temp_word
& ~HP_INTR_ENABLE
& ~CMD_CMPL_INTR_ENABLE
) | 0x00;
1347 rc
= hp_register_write_word(pdev
, SLOT_CTRL(ctrl
->cap_base
), temp_word
);
1349 err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__
);
1350 goto abort_free_ctlr
;
1353 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_STATUS(ctrl
->cap_base
), slot_status
);
1355 err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__
);
1356 goto abort_free_ctlr
;
1359 temp_word
= 0x1F; /* Clear all events */
1360 rc
= hp_register_write_word(php_ctlr
->pci_dev
, SLOT_STATUS(ctrl
->cap_base
), temp_word
);
1362 err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__
);
1363 goto abort_free_ctlr
;
1366 if (pciehp_poll_mode
) {/* Install interrupt polling code */
1367 /* Install and start the interrupt polling timer */
1368 init_timer(&php_ctlr
->int_poll_timer
);
1369 start_int_poll_timer( php_ctlr
, 10 ); /* start with 10 second delay */
1371 /* Installs the interrupt handler */
1372 rc
= request_irq(php_ctlr
->irq
, pcie_isr
, SA_SHIRQ
, MY_NAME
, (void *) ctrl
);
1373 dbg("%s: request_irq %d for hpc%d (returns %d)\n", __FUNCTION__
, php_ctlr
->irq
, ctlr_seq_num
, rc
);
1375 err("Can't get irq %d for the hotplug controller\n", php_ctlr
->irq
);
1376 goto abort_free_ctlr
;
1380 dbg("pciehp ctrl b:d:f:irq=0x%x:%x:%x:%x\n", pdev
->bus
->number
,
1381 PCI_SLOT(pdev
->devfn
), PCI_FUNC(pdev
->devfn
), dev
->irq
);
1383 rc
= hp_register_read_word(pdev
, SLOT_CTRL(ctrl
->cap_base
), temp_word
);
1385 err("%s : hp_register_read_word SLOT_CTRL failed\n", __FUNCTION__
);
1386 goto abort_free_ctlr
;
1389 intr_enable
= intr_enable
| PRSN_DETECT_ENABLE
;
1391 if (ATTN_BUTTN(slot_cap
))
1392 intr_enable
= intr_enable
| ATTN_BUTTN_ENABLE
;
1394 if (POWER_CTRL(slot_cap
))
1395 intr_enable
= intr_enable
| PWR_FAULT_DETECT_ENABLE
;
1397 if (MRL_SENS(slot_cap
))
1398 intr_enable
= intr_enable
| MRL_DETECT_ENABLE
;
1400 temp_word
= (temp_word
& ~intr_enable
) | intr_enable
;
1402 if (pciehp_poll_mode
) {
1403 temp_word
= (temp_word
& ~HP_INTR_ENABLE
) | 0x0;
1405 temp_word
= (temp_word
& ~HP_INTR_ENABLE
) | HP_INTR_ENABLE
;
1408 /* Unmask Hot-plug Interrupt Enable for the interrupt notification mechanism case */
1409 rc
= hp_register_write_word(pdev
, SLOT_CTRL(ctrl
->cap_base
), temp_word
);
1411 err("%s : hp_register_write_word SLOT_CTRL failed\n", __FUNCTION__
);
1412 goto abort_free_ctlr
;
1414 rc
= hp_register_read_word(php_ctlr
->pci_dev
, SLOT_STATUS(ctrl
->cap_base
), slot_status
);
1416 err("%s : hp_register_read_word SLOT_STATUS failed\n", __FUNCTION__
);
1417 goto abort_free_ctlr
;
1420 temp_word
= 0x1F; /* Clear all events */
1421 rc
= hp_register_write_word(php_ctlr
->pci_dev
, SLOT_STATUS(ctrl
->cap_base
), temp_word
);
1423 err("%s : hp_register_write_word SLOT_STATUS failed\n", __FUNCTION__
);
1424 goto abort_free_ctlr
;
1428 dbg("Bypassing BIOS check for pciehp use on %s\n",
1429 pci_name(ctrl
->pci_dev
));
1431 rc
= pciehp_get_hp_hw_control_from_firmware(ctrl
->pci_dev
);
1433 goto abort_free_ctlr
;
1436 /* Add this HPC instance into the HPC list */
1437 spin_lock(&list_lock
);
1438 if (php_ctlr_list_head
== 0) {
1439 php_ctlr_list_head
= php_ctlr
;
1440 p
= php_ctlr_list_head
;
1443 p
= php_ctlr_list_head
;
1448 p
->pnext
= php_ctlr
;
1450 spin_unlock(&list_lock
);
1453 ctrl
->hpc_ctlr_handle
= php_ctlr
;
1454 ctrl
->hpc_ops
= &pciehp_hpc_ops
;
1459 /* We end up here for the many possible ways to fail this API. */
1461 pcie_cap_base
= saved_cap_base
;