File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -352,6 +352,42 @@ int pciehp_check_link_status(struct controller *ctrl)
352
352
return retval ;
353
353
}
354
354
355
+ static int __pciehp_link_set (struct controller * ctrl , bool enable )
356
+ {
357
+ u16 lnk_ctrl ;
358
+ int retval = 0 ;
359
+
360
+ retval = pciehp_readw (ctrl , PCI_EXP_LNKCTL , & lnk_ctrl );
361
+ if (retval ) {
362
+ ctrl_err (ctrl , "Cannot read LNKCTRL register\n" );
363
+ return retval ;
364
+ }
365
+
366
+ if (enable )
367
+ lnk_ctrl &= ~PCI_EXP_LNKCTL_LD ;
368
+ else
369
+ lnk_ctrl |= PCI_EXP_LNKCTL_LD ;
370
+
371
+ retval = pciehp_writew (ctrl , PCI_EXP_LNKCTL , lnk_ctrl );
372
+ if (retval ) {
373
+ ctrl_err (ctrl , "Cannot write LNKCTRL register\n" );
374
+ return retval ;
375
+ }
376
+ ctrl_dbg (ctrl , "%s: lnk_ctrl = %x\n" , __func__ , lnk_ctrl );
377
+
378
+ return retval ;
379
+ }
380
+
381
+ static int pciehp_link_enable (struct controller * ctrl )
382
+ {
383
+ return __pciehp_link_set (ctrl , true);
384
+ }
385
+
386
+ static int pciehp_link_disable (struct controller * ctrl )
387
+ {
388
+ return __pciehp_link_set (ctrl , false);
389
+ }
390
+
355
391
int pciehp_get_attention_status (struct slot * slot , u8 * status )
356
392
{
357
393
struct controller * ctrl = slot -> ctrl ;
You can’t perform that action at this time.
0 commit comments