@@ -109,13 +109,16 @@ static ssize_t ahci_read_em_buffer(struct device *dev,
109
109
static ssize_t ahci_store_em_buffer (struct device * dev ,
110
110
struct device_attribute * attr ,
111
111
const char * buf , size_t size );
112
+ static ssize_t ahci_show_em_supported (struct device * dev ,
113
+ struct device_attribute * attr , char * buf );
112
114
113
115
static DEVICE_ATTR (ahci_host_caps , S_IRUGO , ahci_show_host_caps , NULL) ;
114
116
static DEVICE_ATTR (ahci_host_cap2 , S_IRUGO , ahci_show_host_cap2 , NULL) ;
115
117
static DEVICE_ATTR (ahci_host_version , S_IRUGO , ahci_show_host_version , NULL) ;
116
118
static DEVICE_ATTR (ahci_port_cmd , S_IRUGO , ahci_show_port_cmd , NULL) ;
117
119
static DEVICE_ATTR (em_buffer , S_IWUSR | S_IRUGO ,
118
120
ahci_read_em_buffer , ahci_store_em_buffer ) ;
121
+ static DEVICE_ATTR (em_message_supported , S_IRUGO , ahci_show_em_supported , NULL) ;
119
122
120
123
struct device_attribute * ahci_shost_attrs [] = {
121
124
& dev_attr_link_power_management_policy ,
@@ -126,6 +129,7 @@ struct device_attribute *ahci_shost_attrs[] = {
126
129
& dev_attr_ahci_host_version ,
127
130
& dev_attr_ahci_port_cmd ,
128
131
& dev_attr_em_buffer ,
132
+ & dev_attr_em_message_supported ,
129
133
NULL
130
134
};
131
135
EXPORT_SYMBOL_GPL (ahci_shost_attrs );
@@ -343,6 +347,24 @@ static ssize_t ahci_store_em_buffer(struct device *dev,
343
347
return size ;
344
348
}
345
349
350
+ static ssize_t ahci_show_em_supported (struct device * dev ,
351
+ struct device_attribute * attr , char * buf )
352
+ {
353
+ struct Scsi_Host * shost = class_to_shost (dev );
354
+ struct ata_port * ap = ata_shost_to_port (shost );
355
+ struct ahci_host_priv * hpriv = ap -> host -> private_data ;
356
+ void __iomem * mmio = hpriv -> mmio ;
357
+ u32 em_ctl ;
358
+
359
+ em_ctl = readl (mmio + HOST_EM_CTL );
360
+
361
+ return sprintf (buf , "%s%s%s%s\n" ,
362
+ em_ctl & EM_CTL_LED ? "led " : "" ,
363
+ em_ctl & EM_CTL_SAFTE ? "saf-te " : "" ,
364
+ em_ctl & EM_CTL_SES ? "ses-2 " : "" ,
365
+ em_ctl & EM_CTL_SGPIO ? "sgpio " : "" );
366
+ }
367
+
346
368
/**
347
369
* ahci_save_initial_config - Save and fixup initial config values
348
370
* @dev: target AHCI device
0 commit comments