diff options
author | David Milburn <dmilburn@redhat.com> | 2008-10-13 15:38:36 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-10-28 00:37:15 -0400 |
commit | 87943acf60898a3efb6b5ee85d4cc789898bf5e8 (patch) | |
tree | 4d2d57fd89b7aa2b37cf2798c816964664452c8a /drivers/ata | |
parent | eb40963c835c69681af516388a2a92b57e2f0fe7 (diff) |
libata: ahci enclosure management bit mask
Enclosure management bit mask definitions.
Signed-off-by: David Milburn <dmilburn@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/ata')
-rw-r--r-- | drivers/ata/ahci.c | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c index 3c71d3133431..a67b8e7c712d 100644 --- a/drivers/ata/ahci.c +++ b/drivers/ata/ahci.c | |||
@@ -49,6 +49,17 @@ | |||
49 | #define DRV_NAME "ahci" | 49 | #define DRV_NAME "ahci" |
50 | #define DRV_VERSION "3.0" | 50 | #define DRV_VERSION "3.0" |
51 | 51 | ||
52 | /* Enclosure Management Control */ | ||
53 | #define EM_CTRL_MSG_TYPE 0x000f0000 | ||
54 | |||
55 | /* Enclosure Management LED Message Type */ | ||
56 | #define EM_MSG_LED_HBA_PORT 0x0000000f | ||
57 | #define EM_MSG_LED_PMP_SLOT 0x0000ff00 | ||
58 | #define EM_MSG_LED_VALUE 0xffff0000 | ||
59 | #define EM_MSG_LED_VALUE_ACTIVITY 0x00070000 | ||
60 | #define EM_MSG_LED_VALUE_OFF 0xfff80000 | ||
61 | #define EM_MSG_LED_VALUE_ON 0x00010000 | ||
62 | |||
52 | static int ahci_skip_host_reset; | 63 | static int ahci_skip_host_reset; |
53 | module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); | 64 | module_param_named(skip_host_reset, ahci_skip_host_reset, int, 0444); |
54 | MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); | 65 | MODULE_PARM_DESC(skip_host_reset, "skip global host reset (0=don't skip, 1=skip)"); |
@@ -1225,7 +1236,7 @@ static void ahci_sw_activity_blink(unsigned long arg) | |||
1225 | u32 activity_led_state; | 1236 | u32 activity_led_state; |
1226 | unsigned long flags; | 1237 | unsigned long flags; |
1227 | 1238 | ||
1228 | led_message &= 0xffff0000; | 1239 | led_message &= EM_MSG_LED_VALUE; |
1229 | led_message |= ap->port_no | (link->pmp << 8); | 1240 | led_message |= ap->port_no | (link->pmp << 8); |
1230 | 1241 | ||
1231 | /* check to see if we've had activity. If so, | 1242 | /* check to see if we've had activity. If so, |
@@ -1236,7 +1247,7 @@ static void ahci_sw_activity_blink(unsigned long arg) | |||
1236 | if (emp->saved_activity != emp->activity) { | 1247 | if (emp->saved_activity != emp->activity) { |
1237 | emp->saved_activity = emp->activity; | 1248 | emp->saved_activity = emp->activity; |
1238 | /* get the current LED state */ | 1249 | /* get the current LED state */ |
1239 | activity_led_state = led_message & 0x00010000; | 1250 | activity_led_state = led_message & EM_MSG_LED_VALUE_ON; |
1240 | 1251 | ||
1241 | if (activity_led_state) | 1252 | if (activity_led_state) |
1242 | activity_led_state = 0; | 1253 | activity_led_state = 0; |
@@ -1244,14 +1255,14 @@ static void ahci_sw_activity_blink(unsigned long arg) | |||
1244 | activity_led_state = 1; | 1255 | activity_led_state = 1; |
1245 | 1256 | ||
1246 | /* clear old state */ | 1257 | /* clear old state */ |
1247 | led_message &= 0xfff8ffff; | 1258 | led_message &= ~EM_MSG_LED_VALUE_ACTIVITY; |
1248 | 1259 | ||
1249 | /* toggle state */ | 1260 | /* toggle state */ |
1250 | led_message |= (activity_led_state << 16); | 1261 | led_message |= (activity_led_state << 16); |
1251 | mod_timer(&emp->timer, jiffies + msecs_to_jiffies(100)); | 1262 | mod_timer(&emp->timer, jiffies + msecs_to_jiffies(100)); |
1252 | } else { | 1263 | } else { |
1253 | /* switch to idle */ | 1264 | /* switch to idle */ |
1254 | led_message &= 0xfff8ffff; | 1265 | led_message &= ~EM_MSG_LED_VALUE_ACTIVITY; |
1255 | if (emp->blink_policy == BLINK_OFF) | 1266 | if (emp->blink_policy == BLINK_OFF) |
1256 | led_message |= (1 << 16); | 1267 | led_message |= (1 << 16); |
1257 | } | 1268 | } |
@@ -1300,7 +1311,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, | |||
1300 | struct ahci_em_priv *emp; | 1311 | struct ahci_em_priv *emp; |
1301 | 1312 | ||
1302 | /* get the slot number from the message */ | 1313 | /* get the slot number from the message */ |
1303 | pmp = (state & 0x0000ff00) >> 8; | 1314 | pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8; |
1304 | if (pmp < MAX_SLOTS) | 1315 | if (pmp < MAX_SLOTS) |
1305 | emp = &pp->em_priv[pmp]; | 1316 | emp = &pp->em_priv[pmp]; |
1306 | else | 1317 | else |
@@ -1325,7 +1336,7 @@ static ssize_t ahci_transmit_led_message(struct ata_port *ap, u32 state, | |||
1325 | message[0] |= (4 << 8); | 1336 | message[0] |= (4 << 8); |
1326 | 1337 | ||
1327 | /* ignore 0:4 of byte zero, fill in port info yourself */ | 1338 | /* ignore 0:4 of byte zero, fill in port info yourself */ |
1328 | message[1] = ((state & 0xfffffff0) | ap->port_no); | 1339 | message[1] = ((state & ~EM_MSG_LED_HBA_PORT) | ap->port_no); |
1329 | 1340 | ||
1330 | /* write message to EM_LOC */ | 1341 | /* write message to EM_LOC */ |
1331 | writel(message[0], mmio + hpriv->em_loc); | 1342 | writel(message[0], mmio + hpriv->em_loc); |
@@ -1368,7 +1379,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, | |||
1368 | state = simple_strtoul(buf, NULL, 0); | 1379 | state = simple_strtoul(buf, NULL, 0); |
1369 | 1380 | ||
1370 | /* get the slot number from the message */ | 1381 | /* get the slot number from the message */ |
1371 | pmp = (state & 0x0000ff00) >> 8; | 1382 | pmp = (state & EM_MSG_LED_PMP_SLOT) >> 8; |
1372 | if (pmp < MAX_SLOTS) | 1383 | if (pmp < MAX_SLOTS) |
1373 | emp = &pp->em_priv[pmp]; | 1384 | emp = &pp->em_priv[pmp]; |
1374 | else | 1385 | else |
@@ -1379,7 +1390,7 @@ static ssize_t ahci_led_store(struct ata_port *ap, const char *buf, | |||
1379 | * activity led through em_message | 1390 | * activity led through em_message |
1380 | */ | 1391 | */ |
1381 | if (emp->blink_policy) | 1392 | if (emp->blink_policy) |
1382 | state &= 0xfff8ffff; | 1393 | state &= ~EM_MSG_LED_VALUE_ACTIVITY; |
1383 | 1394 | ||
1384 | return ahci_transmit_led_message(ap, state, size); | 1395 | return ahci_transmit_led_message(ap, state, size); |
1385 | } | 1396 | } |
@@ -1398,16 +1409,16 @@ static ssize_t ahci_activity_store(struct ata_device *dev, enum sw_activity val) | |||
1398 | link->flags &= ~(ATA_LFLAG_SW_ACTIVITY); | 1409 | link->flags &= ~(ATA_LFLAG_SW_ACTIVITY); |
1399 | 1410 | ||
1400 | /* set the LED to OFF */ | 1411 | /* set the LED to OFF */ |
1401 | port_led_state &= 0xfff80000; | 1412 | port_led_state &= EM_MSG_LED_VALUE_OFF; |
1402 | port_led_state |= (ap->port_no | (link->pmp << 8)); | 1413 | port_led_state |= (ap->port_no | (link->pmp << 8)); |
1403 | ahci_transmit_led_message(ap, port_led_state, 4); | 1414 | ahci_transmit_led_message(ap, port_led_state, 4); |
1404 | } else { | 1415 | } else { |
1405 | link->flags |= ATA_LFLAG_SW_ACTIVITY; | 1416 | link->flags |= ATA_LFLAG_SW_ACTIVITY; |
1406 | if (val == BLINK_OFF) { | 1417 | if (val == BLINK_OFF) { |
1407 | /* set LED to ON for idle */ | 1418 | /* set LED to ON for idle */ |
1408 | port_led_state &= 0xfff80000; | 1419 | port_led_state &= EM_MSG_LED_VALUE_OFF; |
1409 | port_led_state |= (ap->port_no | (link->pmp << 8)); | 1420 | port_led_state |= (ap->port_no | (link->pmp << 8)); |
1410 | port_led_state |= 0x00010000; /* check this */ | 1421 | port_led_state |= EM_MSG_LED_VALUE_ON; /* check this */ |
1411 | ahci_transmit_led_message(ap, port_led_state, 4); | 1422 | ahci_transmit_led_message(ap, port_led_state, 4); |
1412 | } | 1423 | } |
1413 | } | 1424 | } |
@@ -2618,7 +2629,7 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
2618 | u32 em_loc = readl(mmio + HOST_EM_LOC); | 2629 | u32 em_loc = readl(mmio + HOST_EM_LOC); |
2619 | u32 em_ctl = readl(mmio + HOST_EM_CTL); | 2630 | u32 em_ctl = readl(mmio + HOST_EM_CTL); |
2620 | 2631 | ||
2621 | messages = (em_ctl & 0x000f0000) >> 16; | 2632 | messages = (em_ctl & EM_CTRL_MSG_TYPE) >> 16; |
2622 | 2633 | ||
2623 | /* we only support LED message type right now */ | 2634 | /* we only support LED message type right now */ |
2624 | if ((messages & 0x01) && (ahci_em_messages == 1)) { | 2635 | if ((messages & 0x01) && (ahci_em_messages == 1)) { |