diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/block/pktcdvd.c | 82 | ||||
-rw-r--r-- | drivers/char/sysrq.c | 2 | ||||
-rw-r--r-- | drivers/fc4/fc.c | 2 | ||||
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 14 | ||||
-rw-r--r-- | drivers/net/wireless/ipw2200.c | 6 | ||||
-rw-r--r-- | drivers/s390/block/Kconfig | 14 | ||||
-rw-r--r-- | drivers/s390/block/Makefile | 2 | ||||
-rw-r--r-- | drivers/s390/block/dasd.c | 97 | ||||
-rw-r--r-- | drivers/s390/block/dasd_3990_erp.c | 3 | ||||
-rw-r--r-- | drivers/s390/block/dasd_eckd.h | 1 | ||||
-rw-r--r-- | drivers/s390/block/dasd_eer.c | 1090 | ||||
-rw-r--r-- | drivers/s390/block/dasd_int.h | 38 | ||||
-rw-r--r-- | drivers/s390/cio/qdio.c | 13 | ||||
-rw-r--r-- | drivers/spi/spi.c | 5 | ||||
-rw-r--r-- | drivers/video/aty/radeon_pm.c | 19 |
15 files changed, 101 insertions, 1287 deletions
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 93e44d0292ab..bc9b2bcd7dba 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -58,6 +58,7 @@ | |||
58 | #include <linux/suspend.h> | 58 | #include <linux/suspend.h> |
59 | #include <scsi/scsi_cmnd.h> | 59 | #include <scsi/scsi_cmnd.h> |
60 | #include <scsi/scsi_ioctl.h> | 60 | #include <scsi/scsi_ioctl.h> |
61 | #include <scsi/scsi.h> | ||
61 | 62 | ||
62 | #include <asm/uaccess.h> | 63 | #include <asm/uaccess.h> |
63 | 64 | ||
@@ -380,6 +381,7 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command * | |||
380 | memcpy(rq->cmd, cgc->cmd, CDROM_PACKET_SIZE); | 381 | memcpy(rq->cmd, cgc->cmd, CDROM_PACKET_SIZE); |
381 | if (sizeof(rq->cmd) > CDROM_PACKET_SIZE) | 382 | if (sizeof(rq->cmd) > CDROM_PACKET_SIZE) |
382 | memset(rq->cmd + CDROM_PACKET_SIZE, 0, sizeof(rq->cmd) - CDROM_PACKET_SIZE); | 383 | memset(rq->cmd + CDROM_PACKET_SIZE, 0, sizeof(rq->cmd) - CDROM_PACKET_SIZE); |
384 | rq->cmd_len = COMMAND_SIZE(rq->cmd[0]); | ||
383 | 385 | ||
384 | rq->ref_count++; | 386 | rq->ref_count++; |
385 | rq->flags |= REQ_NOMERGE; | 387 | rq->flags |= REQ_NOMERGE; |
@@ -1495,40 +1497,42 @@ static int pkt_set_write_settings(struct pktcdvd_device *pd) | |||
1495 | } | 1497 | } |
1496 | 1498 | ||
1497 | /* | 1499 | /* |
1498 | * 0 -- we can write to this track, 1 -- we can't | 1500 | * 1 -- we can write to this track, 0 -- we can't |
1499 | */ | 1501 | */ |
1500 | static int pkt_good_track(track_information *ti) | 1502 | static int pkt_writable_track(struct pktcdvd_device *pd, track_information *ti) |
1501 | { | 1503 | { |
1502 | /* | 1504 | switch (pd->mmc3_profile) { |
1503 | * only good for CD-RW at the moment, not DVD-RW | 1505 | case 0x1a: /* DVD+RW */ |
1504 | */ | 1506 | case 0x12: /* DVD-RAM */ |
1507 | /* The track is always writable on DVD+RW/DVD-RAM */ | ||
1508 | return 1; | ||
1509 | default: | ||
1510 | break; | ||
1511 | } | ||
1505 | 1512 | ||
1506 | /* | 1513 | if (!ti->packet || !ti->fp) |
1507 | * FIXME: only for FP | ||
1508 | */ | ||
1509 | if (ti->fp == 0) | ||
1510 | return 0; | 1514 | return 0; |
1511 | 1515 | ||
1512 | /* | 1516 | /* |
1513 | * "good" settings as per Mt Fuji. | 1517 | * "good" settings as per Mt Fuji. |
1514 | */ | 1518 | */ |
1515 | if (ti->rt == 0 && ti->blank == 0 && ti->packet == 1) | 1519 | if (ti->rt == 0 && ti->blank == 0) |
1516 | return 0; | 1520 | return 1; |
1517 | 1521 | ||
1518 | if (ti->rt == 0 && ti->blank == 1 && ti->packet == 1) | 1522 | if (ti->rt == 0 && ti->blank == 1) |
1519 | return 0; | 1523 | return 1; |
1520 | 1524 | ||
1521 | if (ti->rt == 1 && ti->blank == 0 && ti->packet == 1) | 1525 | if (ti->rt == 1 && ti->blank == 0) |
1522 | return 0; | 1526 | return 1; |
1523 | 1527 | ||
1524 | printk("pktcdvd: bad state %d-%d-%d\n", ti->rt, ti->blank, ti->packet); | 1528 | printk("pktcdvd: bad state %d-%d-%d\n", ti->rt, ti->blank, ti->packet); |
1525 | return 1; | 1529 | return 0; |
1526 | } | 1530 | } |
1527 | 1531 | ||
1528 | /* | 1532 | /* |
1529 | * 0 -- we can write to this disc, 1 -- we can't | 1533 | * 1 -- we can write to this disc, 0 -- we can't |
1530 | */ | 1534 | */ |
1531 | static int pkt_good_disc(struct pktcdvd_device *pd, disc_information *di) | 1535 | static int pkt_writable_disc(struct pktcdvd_device *pd, disc_information *di) |
1532 | { | 1536 | { |
1533 | switch (pd->mmc3_profile) { | 1537 | switch (pd->mmc3_profile) { |
1534 | case 0x0a: /* CD-RW */ | 1538 | case 0x0a: /* CD-RW */ |
@@ -1537,10 +1541,10 @@ static int pkt_good_disc(struct pktcdvd_device *pd, disc_information *di) | |||
1537 | case 0x1a: /* DVD+RW */ | 1541 | case 0x1a: /* DVD+RW */ |
1538 | case 0x13: /* DVD-RW */ | 1542 | case 0x13: /* DVD-RW */ |
1539 | case 0x12: /* DVD-RAM */ | 1543 | case 0x12: /* DVD-RAM */ |
1540 | return 0; | 1544 | return 1; |
1541 | default: | 1545 | default: |
1542 | VPRINTK("pktcdvd: Wrong disc profile (%x)\n", pd->mmc3_profile); | 1546 | VPRINTK("pktcdvd: Wrong disc profile (%x)\n", pd->mmc3_profile); |
1543 | return 1; | 1547 | return 0; |
1544 | } | 1548 | } |
1545 | 1549 | ||
1546 | /* | 1550 | /* |
@@ -1549,25 +1553,25 @@ static int pkt_good_disc(struct pktcdvd_device *pd, disc_information *di) | |||
1549 | */ | 1553 | */ |
1550 | if (di->disc_type == 0xff) { | 1554 | if (di->disc_type == 0xff) { |
1551 | printk("pktcdvd: Unknown disc. No track?\n"); | 1555 | printk("pktcdvd: Unknown disc. No track?\n"); |
1552 | return 1; | 1556 | return 0; |
1553 | } | 1557 | } |
1554 | 1558 | ||
1555 | if (di->disc_type != 0x20 && di->disc_type != 0) { | 1559 | if (di->disc_type != 0x20 && di->disc_type != 0) { |
1556 | printk("pktcdvd: Wrong disc type (%x)\n", di->disc_type); | 1560 | printk("pktcdvd: Wrong disc type (%x)\n", di->disc_type); |
1557 | return 1; | 1561 | return 0; |
1558 | } | 1562 | } |
1559 | 1563 | ||
1560 | if (di->erasable == 0) { | 1564 | if (di->erasable == 0) { |
1561 | printk("pktcdvd: Disc not erasable\n"); | 1565 | printk("pktcdvd: Disc not erasable\n"); |
1562 | return 1; | 1566 | return 0; |
1563 | } | 1567 | } |
1564 | 1568 | ||
1565 | if (di->border_status == PACKET_SESSION_RESERVED) { | 1569 | if (di->border_status == PACKET_SESSION_RESERVED) { |
1566 | printk("pktcdvd: Can't write to last track (reserved)\n"); | 1570 | printk("pktcdvd: Can't write to last track (reserved)\n"); |
1567 | return 1; | 1571 | return 0; |
1568 | } | 1572 | } |
1569 | 1573 | ||
1570 | return 0; | 1574 | return 1; |
1571 | } | 1575 | } |
1572 | 1576 | ||
1573 | static int pkt_probe_settings(struct pktcdvd_device *pd) | 1577 | static int pkt_probe_settings(struct pktcdvd_device *pd) |
@@ -1592,23 +1596,9 @@ static int pkt_probe_settings(struct pktcdvd_device *pd) | |||
1592 | return ret; | 1596 | return ret; |
1593 | } | 1597 | } |
1594 | 1598 | ||
1595 | if (pkt_good_disc(pd, &di)) | 1599 | if (!pkt_writable_disc(pd, &di)) |
1596 | return -ENXIO; | 1600 | return -EROFS; |
1597 | 1601 | ||
1598 | switch (pd->mmc3_profile) { | ||
1599 | case 0x1a: /* DVD+RW */ | ||
1600 | printk("pktcdvd: inserted media is DVD+RW\n"); | ||
1601 | break; | ||
1602 | case 0x13: /* DVD-RW */ | ||
1603 | printk("pktcdvd: inserted media is DVD-RW\n"); | ||
1604 | break; | ||
1605 | case 0x12: /* DVD-RAM */ | ||
1606 | printk("pktcdvd: inserted media is DVD-RAM\n"); | ||
1607 | break; | ||
1608 | default: | ||
1609 | printk("pktcdvd: inserted media is CD-R%s\n", di.erasable ? "W" : ""); | ||
1610 | break; | ||
1611 | } | ||
1612 | pd->type = di.erasable ? PACKET_CDRW : PACKET_CDR; | 1602 | pd->type = di.erasable ? PACKET_CDRW : PACKET_CDR; |
1613 | 1603 | ||
1614 | track = 1; /* (di.last_track_msb << 8) | di.last_track_lsb; */ | 1604 | track = 1; /* (di.last_track_msb << 8) | di.last_track_lsb; */ |
@@ -1617,9 +1607,9 @@ static int pkt_probe_settings(struct pktcdvd_device *pd) | |||
1617 | return ret; | 1607 | return ret; |
1618 | } | 1608 | } |
1619 | 1609 | ||
1620 | if (pkt_good_track(&ti)) { | 1610 | if (!pkt_writable_track(pd, &ti)) { |
1621 | printk("pktcdvd: can't write to this track\n"); | 1611 | printk("pktcdvd: can't write to this track\n"); |
1622 | return -ENXIO; | 1612 | return -EROFS; |
1623 | } | 1613 | } |
1624 | 1614 | ||
1625 | /* | 1615 | /* |
@@ -1633,7 +1623,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd) | |||
1633 | } | 1623 | } |
1634 | if (pd->settings.size > PACKET_MAX_SECTORS) { | 1624 | if (pd->settings.size > PACKET_MAX_SECTORS) { |
1635 | printk("pktcdvd: packet size is too big\n"); | 1625 | printk("pktcdvd: packet size is too big\n"); |
1636 | return -ENXIO; | 1626 | return -EROFS; |
1637 | } | 1627 | } |
1638 | pd->settings.fp = ti.fp; | 1628 | pd->settings.fp = ti.fp; |
1639 | pd->offset = (be32_to_cpu(ti.track_start) << 2) & (pd->settings.size - 1); | 1629 | pd->offset = (be32_to_cpu(ti.track_start) << 2) & (pd->settings.size - 1); |
@@ -1675,7 +1665,7 @@ static int pkt_probe_settings(struct pktcdvd_device *pd) | |||
1675 | break; | 1665 | break; |
1676 | default: | 1666 | default: |
1677 | printk("pktcdvd: unknown data mode\n"); | 1667 | printk("pktcdvd: unknown data mode\n"); |
1678 | return 1; | 1668 | return -EROFS; |
1679 | } | 1669 | } |
1680 | return 0; | 1670 | return 0; |
1681 | } | 1671 | } |
@@ -1886,7 +1876,7 @@ static int pkt_open_write(struct pktcdvd_device *pd) | |||
1886 | 1876 | ||
1887 | if ((ret = pkt_probe_settings(pd))) { | 1877 | if ((ret = pkt_probe_settings(pd))) { |
1888 | VPRINTK("pktcdvd: %s failed probe\n", pd->name); | 1878 | VPRINTK("pktcdvd: %s failed probe\n", pd->name); |
1889 | return -EROFS; | 1879 | return ret; |
1890 | } | 1880 | } |
1891 | 1881 | ||
1892 | if ((ret = pkt_set_write_settings(pd))) { | 1882 | if ((ret = pkt_set_write_settings(pd))) { |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 5765f672e853..d58f82318853 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -243,7 +243,7 @@ static struct sysrq_key_op sysrq_term_op = { | |||
243 | 243 | ||
244 | static void moom_callback(void *ignored) | 244 | static void moom_callback(void *ignored) |
245 | { | 245 | { |
246 | out_of_memory(GFP_KERNEL, 0); | 246 | out_of_memory(&NODE_DATA(0)->node_zonelists[ZONE_NORMAL], GFP_KERNEL, 0); |
247 | } | 247 | } |
248 | 248 | ||
249 | static DECLARE_WORK(moom_work, moom_callback, NULL); | 249 | static DECLARE_WORK(moom_work, moom_callback, NULL); |
diff --git a/drivers/fc4/fc.c b/drivers/fc4/fc.c index 5c8943509cc1..66d03f242d3c 100644 --- a/drivers/fc4/fc.c +++ b/drivers/fc4/fc.c | |||
@@ -1053,7 +1053,7 @@ static int fc_do_els(fc_channel *fc, unsigned int alpa, void *data, int len) | |||
1053 | int i; | 1053 | int i; |
1054 | 1054 | ||
1055 | fcmd = &_fcmd; | 1055 | fcmd = &_fcmd; |
1056 | memset(fcmd, 0, sizeof(fcmd)); | 1056 | memset(fcmd, 0, sizeof(fcp_cmnd)); |
1057 | FCD(("PLOGI SID %d DID %d\n", fc->sid, alpa)) | 1057 | FCD(("PLOGI SID %d DID %d\n", fc->sid, alpa)) |
1058 | fch = &fcmd->fch; | 1058 | fch = &fcmd->fch; |
1059 | FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, alpa); | 1059 | FILL_FCHDR_RCTL_DID(fch, R_CTL_ELS_REQ, alpa); |
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index 69c04945591f..ded2c33f5b85 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -1019,8 +1019,8 @@ static void __xipram xip_udelay(struct map_info *map, struct flchip *chip, | |||
1019 | #define XIP_INVAL_CACHED_RANGE(map, from, size) \ | 1019 | #define XIP_INVAL_CACHED_RANGE(map, from, size) \ |
1020 | INVALIDATE_CACHED_RANGE(map, from, size) | 1020 | INVALIDATE_CACHED_RANGE(map, from, size) |
1021 | 1021 | ||
1022 | #define INVALIDATE_CACHE_UDELAY(map, chip, adr, len, usec) \ | 1022 | #define INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr, adr, len, usec) \ |
1023 | UDELAY(map, chip, adr, usec) | 1023 | UDELAY(map, chip, cmd_adr, usec) |
1024 | 1024 | ||
1025 | /* | 1025 | /* |
1026 | * Extra notes: | 1026 | * Extra notes: |
@@ -1052,7 +1052,7 @@ do { \ | |||
1052 | spin_lock(chip->mutex); \ | 1052 | spin_lock(chip->mutex); \ |
1053 | } while (0) | 1053 | } while (0) |
1054 | 1054 | ||
1055 | #define INVALIDATE_CACHE_UDELAY(map, chip, adr, len, usec) \ | 1055 | #define INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr, adr, len, usec) \ |
1056 | do { \ | 1056 | do { \ |
1057 | spin_unlock(chip->mutex); \ | 1057 | spin_unlock(chip->mutex); \ |
1058 | INVALIDATE_CACHED_RANGE(map, adr, len); \ | 1058 | INVALIDATE_CACHED_RANGE(map, adr, len); \ |
@@ -1284,7 +1284,7 @@ static int __xipram do_write_oneword(struct map_info *map, struct flchip *chip, | |||
1284 | map_write(map, datum, adr); | 1284 | map_write(map, datum, adr); |
1285 | chip->state = mode; | 1285 | chip->state = mode; |
1286 | 1286 | ||
1287 | INVALIDATE_CACHE_UDELAY(map, chip, | 1287 | INVALIDATE_CACHE_UDELAY(map, chip, adr, |
1288 | adr, map_bankwidth(map), | 1288 | adr, map_bankwidth(map), |
1289 | chip->word_write_time); | 1289 | chip->word_write_time); |
1290 | 1290 | ||
@@ -1572,8 +1572,8 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip, | |||
1572 | map_write(map, CMD(0xd0), cmd_adr); | 1572 | map_write(map, CMD(0xd0), cmd_adr); |
1573 | chip->state = FL_WRITING; | 1573 | chip->state = FL_WRITING; |
1574 | 1574 | ||
1575 | INVALIDATE_CACHE_UDELAY(map, chip, | 1575 | INVALIDATE_CACHE_UDELAY(map, chip, cmd_adr, |
1576 | cmd_adr, len, | 1576 | adr, len, |
1577 | chip->buffer_write_time); | 1577 | chip->buffer_write_time); |
1578 | 1578 | ||
1579 | timeo = jiffies + (HZ/2); | 1579 | timeo = jiffies + (HZ/2); |
@@ -1744,7 +1744,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, | |||
1744 | chip->state = FL_ERASING; | 1744 | chip->state = FL_ERASING; |
1745 | chip->erase_suspended = 0; | 1745 | chip->erase_suspended = 0; |
1746 | 1746 | ||
1747 | INVALIDATE_CACHE_UDELAY(map, chip, | 1747 | INVALIDATE_CACHE_UDELAY(map, chip, adr, |
1748 | adr, len, | 1748 | adr, len, |
1749 | chip->erase_time*1000/2); | 1749 | chip->erase_time*1000/2); |
1750 | 1750 | ||
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c index 14beab4bc91c..287676ad80df 100644 --- a/drivers/net/wireless/ipw2200.c +++ b/drivers/net/wireless/ipw2200.c | |||
@@ -4616,9 +4616,9 @@ static void ipw_rx_notification(struct ipw_priv *priv, | |||
4616 | } | 4616 | } |
4617 | 4617 | ||
4618 | default: | 4618 | default: |
4619 | IPW_ERROR("Unknown notification: " | 4619 | IPW_DEBUG_NOTIF("Unknown notification: " |
4620 | "subtype=%d,flags=0x%2x,size=%d\n", | 4620 | "subtype=%d,flags=0x%2x,size=%d\n", |
4621 | notif->subtype, notif->flags, notif->size); | 4621 | notif->subtype, notif->flags, notif->size); |
4622 | } | 4622 | } |
4623 | } | 4623 | } |
4624 | 4624 | ||
diff --git a/drivers/s390/block/Kconfig b/drivers/s390/block/Kconfig index 6912399d0937..6f50cc9323d9 100644 --- a/drivers/s390/block/Kconfig +++ b/drivers/s390/block/Kconfig | |||
@@ -55,21 +55,13 @@ config DASD_DIAG | |||
55 | Disks under VM. If you are not running under VM or unsure what it is, | 55 | Disks under VM. If you are not running under VM or unsure what it is, |
56 | say "N". | 56 | say "N". |
57 | 57 | ||
58 | config DASD_EER | ||
59 | tristate "Extended error reporting (EER)" | ||
60 | depends on DASD | ||
61 | help | ||
62 | This driver provides a character device interface to the | ||
63 | DASD extended error reporting. This is only needed if you want to | ||
64 | use applications written for the EER facility. | ||
65 | |||
66 | config DASD_CMB | 58 | config DASD_CMB |
67 | tristate "Compatibility interface for DASD channel measurement blocks" | 59 | tristate "Compatibility interface for DASD channel measurement blocks" |
68 | depends on DASD | 60 | depends on DASD |
69 | help | 61 | help |
70 | This driver provides an additional interface to the channel | 62 | This driver provides an additional interface to the channel measurement |
71 | measurement facility, which is normally accessed though sysfs, with | 63 | facility, which is normally accessed though sysfs, with a set of |
72 | a set of ioctl functions specific to the dasd driver. | 64 | ioctl functions specific to the dasd driver. |
73 | This is only needed if you want to use applications written for | 65 | This is only needed if you want to use applications written for |
74 | linux-2.4 dasd channel measurement facility interface. | 66 | linux-2.4 dasd channel measurement facility interface. |
75 | 67 | ||
diff --git a/drivers/s390/block/Makefile b/drivers/s390/block/Makefile index 0c0d871e8f51..58c6780134f7 100644 --- a/drivers/s390/block/Makefile +++ b/drivers/s390/block/Makefile | |||
@@ -5,7 +5,6 @@ | |||
5 | dasd_eckd_mod-objs := dasd_eckd.o dasd_3990_erp.o dasd_9343_erp.o | 5 | dasd_eckd_mod-objs := dasd_eckd.o dasd_3990_erp.o dasd_9343_erp.o |
6 | dasd_fba_mod-objs := dasd_fba.o dasd_3370_erp.o dasd_9336_erp.o | 6 | dasd_fba_mod-objs := dasd_fba.o dasd_3370_erp.o dasd_9336_erp.o |
7 | dasd_diag_mod-objs := dasd_diag.o | 7 | dasd_diag_mod-objs := dasd_diag.o |
8 | dasd_eer_mod-objs := dasd_eer.o | ||
9 | dasd_mod-objs := dasd.o dasd_ioctl.o dasd_proc.o dasd_devmap.o \ | 8 | dasd_mod-objs := dasd.o dasd_ioctl.o dasd_proc.o dasd_devmap.o \ |
10 | dasd_genhd.o dasd_erp.o | 9 | dasd_genhd.o dasd_erp.o |
11 | 10 | ||
@@ -14,6 +13,5 @@ obj-$(CONFIG_DASD_DIAG) += dasd_diag_mod.o | |||
14 | obj-$(CONFIG_DASD_ECKD) += dasd_eckd_mod.o | 13 | obj-$(CONFIG_DASD_ECKD) += dasd_eckd_mod.o |
15 | obj-$(CONFIG_DASD_FBA) += dasd_fba_mod.o | 14 | obj-$(CONFIG_DASD_FBA) += dasd_fba_mod.o |
16 | obj-$(CONFIG_DASD_CMB) += dasd_cmb.o | 15 | obj-$(CONFIG_DASD_CMB) += dasd_cmb.o |
17 | obj-$(CONFIG_DASD_EER) += dasd_eer.o | ||
18 | obj-$(CONFIG_BLK_DEV_XPRAM) += xpram.o | 16 | obj-$(CONFIG_BLK_DEV_XPRAM) += xpram.o |
19 | obj-$(CONFIG_DCSSBLK) += dcssblk.o | 17 | obj-$(CONFIG_DCSSBLK) += dcssblk.o |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 08c88fcd8963..af1d5b404cee 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/buffer_head.h> | 19 | #include <linux/buffer_head.h> |
20 | #include <linux/hdreg.h> | 20 | #include <linux/hdreg.h> |
21 | #include <linux/notifier.h> | ||
22 | 21 | ||
23 | #include <asm/ccwdev.h> | 22 | #include <asm/ccwdev.h> |
24 | #include <asm/ebcdic.h> | 23 | #include <asm/ebcdic.h> |
@@ -58,7 +57,6 @@ static void dasd_int_handler(struct ccw_device *, unsigned long, struct irb *); | |||
58 | static void dasd_flush_ccw_queue(struct dasd_device *, int); | 57 | static void dasd_flush_ccw_queue(struct dasd_device *, int); |
59 | static void dasd_tasklet(struct dasd_device *); | 58 | static void dasd_tasklet(struct dasd_device *); |
60 | static void do_kick_device(void *data); | 59 | static void do_kick_device(void *data); |
61 | static void dasd_disable_eer(struct dasd_device *device); | ||
62 | 60 | ||
63 | /* | 61 | /* |
64 | * SECTION: Operations on the device structure. | 62 | * SECTION: Operations on the device structure. |
@@ -153,10 +151,13 @@ dasd_state_new_to_known(struct dasd_device *device) | |||
153 | static inline void | 151 | static inline void |
154 | dasd_state_known_to_new(struct dasd_device * device) | 152 | dasd_state_known_to_new(struct dasd_device * device) |
155 | { | 153 | { |
156 | /* disable extended error reporting for this device */ | ||
157 | dasd_disable_eer(device); | ||
158 | /* Forget the discipline information. */ | 154 | /* Forget the discipline information. */ |
155 | if (device->discipline) | ||
156 | module_put(device->discipline->owner); | ||
159 | device->discipline = NULL; | 157 | device->discipline = NULL; |
158 | if (device->base_discipline) | ||
159 | module_put(device->base_discipline->owner); | ||
160 | device->base_discipline = NULL; | ||
160 | device->state = DASD_STATE_NEW; | 161 | device->state = DASD_STATE_NEW; |
161 | 162 | ||
162 | dasd_free_queue(device); | 163 | dasd_free_queue(device); |
@@ -871,9 +872,6 @@ dasd_handle_state_change_pending(struct dasd_device *device) | |||
871 | struct dasd_ccw_req *cqr; | 872 | struct dasd_ccw_req *cqr; |
872 | struct list_head *l, *n; | 873 | struct list_head *l, *n; |
873 | 874 | ||
874 | /* first of all call extended error reporting */ | ||
875 | dasd_write_eer_trigger(DASD_EER_STATECHANGE, device, NULL); | ||
876 | |||
877 | device->stopped &= ~DASD_STOPPED_PENDING; | 875 | device->stopped &= ~DASD_STOPPED_PENDING; |
878 | 876 | ||
879 | /* restart all 'running' IO on queue */ | 877 | /* restart all 'running' IO on queue */ |
@@ -1093,19 +1091,6 @@ restart: | |||
1093 | } | 1091 | } |
1094 | goto restart; | 1092 | goto restart; |
1095 | } | 1093 | } |
1096 | |||
1097 | /* first of all call extended error reporting */ | ||
1098 | if (device->eer && cqr->status == DASD_CQR_FAILED) { | ||
1099 | dasd_write_eer_trigger(DASD_EER_FATALERROR, | ||
1100 | device, cqr); | ||
1101 | |||
1102 | /* restart request */ | ||
1103 | cqr->status = DASD_CQR_QUEUED; | ||
1104 | cqr->retries = 255; | ||
1105 | device->stopped |= DASD_STOPPED_QUIESCE; | ||
1106 | goto restart; | ||
1107 | } | ||
1108 | |||
1109 | /* Process finished ERP request. */ | 1094 | /* Process finished ERP request. */ |
1110 | if (cqr->refers) { | 1095 | if (cqr->refers) { |
1111 | __dasd_process_erp(device, cqr); | 1096 | __dasd_process_erp(device, cqr); |
@@ -1243,8 +1228,7 @@ __dasd_start_head(struct dasd_device * device) | |||
1243 | cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list); | 1228 | cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, list); |
1244 | /* check FAILFAST */ | 1229 | /* check FAILFAST */ |
1245 | if (device->stopped & ~DASD_STOPPED_PENDING && | 1230 | if (device->stopped & ~DASD_STOPPED_PENDING && |
1246 | test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags) && | 1231 | test_bit(DASD_CQR_FLAGS_FAILFAST, &cqr->flags)) { |
1247 | (!device->eer)) { | ||
1248 | cqr->status = DASD_CQR_FAILED; | 1232 | cqr->status = DASD_CQR_FAILED; |
1249 | dasd_schedule_bh(device); | 1233 | dasd_schedule_bh(device); |
1250 | } | 1234 | } |
@@ -1880,9 +1864,10 @@ dasd_generic_remove (struct ccw_device *cdev) | |||
1880 | */ | 1864 | */ |
1881 | int | 1865 | int |
1882 | dasd_generic_set_online (struct ccw_device *cdev, | 1866 | dasd_generic_set_online (struct ccw_device *cdev, |
1883 | struct dasd_discipline *discipline) | 1867 | struct dasd_discipline *base_discipline) |
1884 | 1868 | ||
1885 | { | 1869 | { |
1870 | struct dasd_discipline *discipline; | ||
1886 | struct dasd_device *device; | 1871 | struct dasd_device *device; |
1887 | int rc; | 1872 | int rc; |
1888 | 1873 | ||
@@ -1890,6 +1875,7 @@ dasd_generic_set_online (struct ccw_device *cdev, | |||
1890 | if (IS_ERR(device)) | 1875 | if (IS_ERR(device)) |
1891 | return PTR_ERR(device); | 1876 | return PTR_ERR(device); |
1892 | 1877 | ||
1878 | discipline = base_discipline; | ||
1893 | if (device->features & DASD_FEATURE_USEDIAG) { | 1879 | if (device->features & DASD_FEATURE_USEDIAG) { |
1894 | if (!dasd_diag_discipline_pointer) { | 1880 | if (!dasd_diag_discipline_pointer) { |
1895 | printk (KERN_WARNING | 1881 | printk (KERN_WARNING |
@@ -1901,6 +1887,16 @@ dasd_generic_set_online (struct ccw_device *cdev, | |||
1901 | } | 1887 | } |
1902 | discipline = dasd_diag_discipline_pointer; | 1888 | discipline = dasd_diag_discipline_pointer; |
1903 | } | 1889 | } |
1890 | if (!try_module_get(base_discipline->owner)) { | ||
1891 | dasd_delete_device(device); | ||
1892 | return -EINVAL; | ||
1893 | } | ||
1894 | if (!try_module_get(discipline->owner)) { | ||
1895 | module_put(base_discipline->owner); | ||
1896 | dasd_delete_device(device); | ||
1897 | return -EINVAL; | ||
1898 | } | ||
1899 | device->base_discipline = base_discipline; | ||
1904 | device->discipline = discipline; | 1900 | device->discipline = discipline; |
1905 | 1901 | ||
1906 | rc = discipline->check_device(device); | 1902 | rc = discipline->check_device(device); |
@@ -1909,6 +1905,8 @@ dasd_generic_set_online (struct ccw_device *cdev, | |||
1909 | "dasd_generic couldn't online device %s " | 1905 | "dasd_generic couldn't online device %s " |
1910 | "with discipline %s rc=%i\n", | 1906 | "with discipline %s rc=%i\n", |
1911 | cdev->dev.bus_id, discipline->name, rc); | 1907 | cdev->dev.bus_id, discipline->name, rc); |
1908 | module_put(discipline->owner); | ||
1909 | module_put(base_discipline->owner); | ||
1912 | dasd_delete_device(device); | 1910 | dasd_delete_device(device); |
1913 | return rc; | 1911 | return rc; |
1914 | } | 1912 | } |
@@ -1986,9 +1984,6 @@ dasd_generic_notify(struct ccw_device *cdev, int event) | |||
1986 | switch (event) { | 1984 | switch (event) { |
1987 | case CIO_GONE: | 1985 | case CIO_GONE: |
1988 | case CIO_NO_PATH: | 1986 | case CIO_NO_PATH: |
1989 | /* first of all call extended error reporting */ | ||
1990 | dasd_write_eer_trigger(DASD_EER_NOPATH, device, NULL); | ||
1991 | |||
1992 | if (device->state < DASD_STATE_BASIC) | 1987 | if (device->state < DASD_STATE_BASIC) |
1993 | break; | 1988 | break; |
1994 | /* Device is active. We want to keep it. */ | 1989 | /* Device is active. We want to keep it. */ |
@@ -2046,51 +2041,6 @@ dasd_generic_auto_online (struct ccw_driver *dasd_discipline_driver) | |||
2046 | put_driver(drv); | 2041 | put_driver(drv); |
2047 | } | 2042 | } |
2048 | 2043 | ||
2049 | /* | ||
2050 | * notifications for extended error reports | ||
2051 | */ | ||
2052 | static struct notifier_block *dasd_eer_chain; | ||
2053 | |||
2054 | int | ||
2055 | dasd_register_eer_notifier(struct notifier_block *nb) | ||
2056 | { | ||
2057 | return notifier_chain_register(&dasd_eer_chain, nb); | ||
2058 | } | ||
2059 | |||
2060 | int | ||
2061 | dasd_unregister_eer_notifier(struct notifier_block *nb) | ||
2062 | { | ||
2063 | return notifier_chain_unregister(&dasd_eer_chain, nb); | ||
2064 | } | ||
2065 | |||
2066 | /* | ||
2067 | * Notify the registered error reporting module of a problem | ||
2068 | */ | ||
2069 | void | ||
2070 | dasd_write_eer_trigger(unsigned int id, struct dasd_device *device, | ||
2071 | struct dasd_ccw_req *cqr) | ||
2072 | { | ||
2073 | if (device->eer) { | ||
2074 | struct dasd_eer_trigger temp; | ||
2075 | temp.id = id; | ||
2076 | temp.device = device; | ||
2077 | temp.cqr = cqr; | ||
2078 | notifier_call_chain(&dasd_eer_chain, DASD_EER_TRIGGER, | ||
2079 | (void *)&temp); | ||
2080 | } | ||
2081 | } | ||
2082 | |||
2083 | /* | ||
2084 | * Tell the registered error reporting module to disable error reporting for | ||
2085 | * a given device and to cleanup any private data structures on that device. | ||
2086 | */ | ||
2087 | static void | ||
2088 | dasd_disable_eer(struct dasd_device *device) | ||
2089 | { | ||
2090 | notifier_call_chain(&dasd_eer_chain, DASD_EER_DISABLE, (void *)device); | ||
2091 | } | ||
2092 | |||
2093 | |||
2094 | static int __init | 2044 | static int __init |
2095 | dasd_init(void) | 2045 | dasd_init(void) |
2096 | { | 2046 | { |
@@ -2172,11 +2122,6 @@ EXPORT_SYMBOL_GPL(dasd_generic_set_online); | |||
2172 | EXPORT_SYMBOL_GPL(dasd_generic_set_offline); | 2122 | EXPORT_SYMBOL_GPL(dasd_generic_set_offline); |
2173 | EXPORT_SYMBOL_GPL(dasd_generic_auto_online); | 2123 | EXPORT_SYMBOL_GPL(dasd_generic_auto_online); |
2174 | 2124 | ||
2175 | EXPORT_SYMBOL(dasd_register_eer_notifier); | ||
2176 | EXPORT_SYMBOL(dasd_unregister_eer_notifier); | ||
2177 | EXPORT_SYMBOL(dasd_write_eer_trigger); | ||
2178 | |||
2179 | |||
2180 | /* | 2125 | /* |
2181 | * Overrides for Emacs so that we follow Linus's tabbing style. | 2126 | * Overrides for Emacs so that we follow Linus's tabbing style. |
2182 | * Emacs will notice this stuff at the end of the file and automatically | 2127 | * Emacs will notice this stuff at the end of the file and automatically |
diff --git a/drivers/s390/block/dasd_3990_erp.c b/drivers/s390/block/dasd_3990_erp.c index c811380b9079..4ee0f934e325 100644 --- a/drivers/s390/block/dasd_3990_erp.c +++ b/drivers/s390/block/dasd_3990_erp.c | |||
@@ -1108,9 +1108,6 @@ dasd_3990_handle_env_data(struct dasd_ccw_req * erp, char *sense) | |||
1108 | case 0x0B: | 1108 | case 0x0B: |
1109 | DEV_MESSAGE(KERN_WARNING, device, "%s", | 1109 | DEV_MESSAGE(KERN_WARNING, device, "%s", |
1110 | "FORMAT F - Volume is suspended duplex"); | 1110 | "FORMAT F - Volume is suspended duplex"); |
1111 | /* call extended error reporting (EER) */ | ||
1112 | dasd_write_eer_trigger(DASD_EER_PPRCSUSPEND, device, | ||
1113 | erp->refers); | ||
1114 | break; | 1111 | break; |
1115 | case 0x0C: | 1112 | case 0x0C: |
1116 | DEV_MESSAGE(KERN_WARNING, device, "%s", | 1113 | DEV_MESSAGE(KERN_WARNING, device, "%s", |
diff --git a/drivers/s390/block/dasd_eckd.h b/drivers/s390/block/dasd_eckd.h index e15dd7978050..bc3823d35223 100644 --- a/drivers/s390/block/dasd_eckd.h +++ b/drivers/s390/block/dasd_eckd.h | |||
@@ -29,7 +29,6 @@ | |||
29 | #define DASD_ECKD_CCW_PSF 0x27 | 29 | #define DASD_ECKD_CCW_PSF 0x27 |
30 | #define DASD_ECKD_CCW_RSSD 0x3e | 30 | #define DASD_ECKD_CCW_RSSD 0x3e |
31 | #define DASD_ECKD_CCW_LOCATE_RECORD 0x47 | 31 | #define DASD_ECKD_CCW_LOCATE_RECORD 0x47 |
32 | #define DASD_ECKD_CCW_SNSS 0x54 | ||
33 | #define DASD_ECKD_CCW_DEFINE_EXTENT 0x63 | 32 | #define DASD_ECKD_CCW_DEFINE_EXTENT 0x63 |
34 | #define DASD_ECKD_CCW_WRITE_MT 0x85 | 33 | #define DASD_ECKD_CCW_WRITE_MT 0x85 |
35 | #define DASD_ECKD_CCW_READ_MT 0x86 | 34 | #define DASD_ECKD_CCW_READ_MT 0x86 |
diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c deleted file mode 100644 index f70cd7716b24..000000000000 --- a/drivers/s390/block/dasd_eer.c +++ /dev/null | |||
@@ -1,1090 +0,0 @@ | |||
1 | /* | ||
2 | * character device driver for extended error reporting | ||
3 | * | ||
4 | * | ||
5 | * Copyright (C) 2005 IBM Corporation | ||
6 | * extended error reporting for DASD ECKD devices | ||
7 | * Author(s): Stefan Weinhuber <wein@de.ibm.com> | ||
8 | * | ||
9 | */ | ||
10 | |||
11 | #include <linux/init.h> | ||
12 | #include <linux/fs.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/miscdevice.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/moduleparam.h> | ||
17 | #include <linux/device.h> | ||
18 | #include <linux/workqueue.h> | ||
19 | #include <linux/poll.h> | ||
20 | #include <linux/notifier.h> | ||
21 | |||
22 | #include <asm/uaccess.h> | ||
23 | #include <asm/semaphore.h> | ||
24 | #include <asm/atomic.h> | ||
25 | #include <asm/ebcdic.h> | ||
26 | |||
27 | #include "dasd_int.h" | ||
28 | #include "dasd_eckd.h" | ||
29 | |||
30 | |||
31 | MODULE_LICENSE("GPL"); | ||
32 | |||
33 | MODULE_AUTHOR("Stefan Weinhuber <wein@de.ibm.com>"); | ||
34 | MODULE_DESCRIPTION("DASD extended error reporting module"); | ||
35 | |||
36 | |||
37 | #ifdef PRINTK_HEADER | ||
38 | #undef PRINTK_HEADER | ||
39 | #endif /* PRINTK_HEADER */ | ||
40 | #define PRINTK_HEADER "dasd(eer):" | ||
41 | |||
42 | |||
43 | |||
44 | |||
45 | |||
46 | /*****************************************************************************/ | ||
47 | /* the internal buffer */ | ||
48 | /*****************************************************************************/ | ||
49 | |||
50 | /* | ||
51 | * The internal buffer is meant to store obaque blobs of data, so it doesn't | ||
52 | * know of higher level concepts like triggers. | ||
53 | * It consists of a number of pages that are used as a ringbuffer. Each data | ||
54 | * blob is stored in a simple record that consists of an integer, which | ||
55 | * contains the size of the following data, and the data bytes themselfes. | ||
56 | * | ||
57 | * To allow for multiple independent readers we create one internal buffer | ||
58 | * each time the device is opened and destroy the buffer when the file is | ||
59 | * closed again. | ||
60 | * | ||
61 | * One record can be written to a buffer by using the functions | ||
62 | * - dasd_eer_start_record (one time per record to write the size to the buffer | ||
63 | * and reserve the space for the data) | ||
64 | * - dasd_eer_write_buffer (one or more times per record to write the data) | ||
65 | * The data can be written in several steps but you will have to compute | ||
66 | * the total size up front for the invocation of dasd_eer_start_record. | ||
67 | * If the ringbuffer is full, dasd_eer_start_record will remove the required | ||
68 | * number of old records. | ||
69 | * | ||
70 | * A record is typically read in two steps, first read the integer that | ||
71 | * specifies the size of the following data, then read the data. | ||
72 | * Both can be done by | ||
73 | * - dasd_eer_read_buffer | ||
74 | * | ||
75 | * For all mentioned functions you need to get the bufferlock first and keep it | ||
76 | * until a complete record is written or read. | ||
77 | */ | ||
78 | |||
79 | |||
80 | /* | ||
81 | * Alle information necessary to keep track of an internal buffer is kept in | ||
82 | * a struct eerbuffer. The buffer specific to a file pointer is strored in | ||
83 | * the private_data field of that file. To be able to write data to all | ||
84 | * existing buffers, each buffer is also added to the bufferlist. | ||
85 | * If the user doesn't want to read a complete record in one go, we have to | ||
86 | * keep track of the rest of the record. residual stores the number of bytes | ||
87 | * that are still to deliver. If the rest of the record is invalidated between | ||
88 | * two reads then residual will be set to -1 so that the next read will fail. | ||
89 | * All entries in the eerbuffer structure are protected with the bufferlock. | ||
90 | * To avoid races between writing to a buffer on the one side and creating | ||
91 | * and destroying buffers on the other side, the bufferlock must also be used | ||
92 | * to protect the bufferlist. | ||
93 | */ | ||
94 | |||
95 | struct eerbuffer { | ||
96 | struct list_head list; | ||
97 | char **buffer; | ||
98 | int buffersize; | ||
99 | int buffer_page_count; | ||
100 | int head; | ||
101 | int tail; | ||
102 | int residual; | ||
103 | }; | ||
104 | |||
105 | LIST_HEAD(bufferlist); | ||
106 | |||
107 | static spinlock_t bufferlock = SPIN_LOCK_UNLOCKED; | ||
108 | |||
109 | DECLARE_WAIT_QUEUE_HEAD(dasd_eer_read_wait_queue); | ||
110 | |||
111 | /* | ||
112 | * How many free bytes are available on the buffer. | ||
113 | * needs to be called with bufferlock held | ||
114 | */ | ||
115 | static int | ||
116 | dasd_eer_get_free_bytes(struct eerbuffer *eerb) | ||
117 | { | ||
118 | if (eerb->head < eerb->tail) { | ||
119 | return eerb->tail - eerb->head - 1; | ||
120 | } else | ||
121 | return eerb->buffersize - eerb->head + eerb->tail -1; | ||
122 | } | ||
123 | |||
124 | /* | ||
125 | * How many bytes of buffer space are used. | ||
126 | * needs to be called with bufferlock held | ||
127 | */ | ||
128 | static int | ||
129 | dasd_eer_get_filled_bytes(struct eerbuffer *eerb) | ||
130 | { | ||
131 | |||
132 | if (eerb->head >= eerb->tail) { | ||
133 | return eerb->head - eerb->tail; | ||
134 | } else | ||
135 | return eerb->buffersize - eerb->tail + eerb->head; | ||
136 | } | ||
137 | |||
138 | /* | ||
139 | * The dasd_eer_write_buffer function just copies count bytes of data | ||
140 | * to the buffer. Make sure to call dasd_eer_start_record first, to | ||
141 | * make sure that enough free space is available. | ||
142 | * needs to be called with bufferlock held | ||
143 | */ | ||
144 | static void | ||
145 | dasd_eer_write_buffer(struct eerbuffer *eerb, int count, char *data) | ||
146 | { | ||
147 | |||
148 | unsigned long headindex,localhead; | ||
149 | unsigned long rest, len; | ||
150 | char *nextdata; | ||
151 | |||
152 | nextdata = data; | ||
153 | rest = count; | ||
154 | while (rest > 0) { | ||
155 | headindex = eerb->head / PAGE_SIZE; | ||
156 | localhead = eerb->head % PAGE_SIZE; | ||
157 | len = min(rest, (PAGE_SIZE - localhead)); | ||
158 | memcpy(eerb->buffer[headindex]+localhead, nextdata, len); | ||
159 | nextdata += len; | ||
160 | rest -= len; | ||
161 | eerb->head += len; | ||
162 | if ( eerb->head == eerb->buffersize ) | ||
163 | eerb->head = 0; /* wrap around */ | ||
164 | if (eerb->head > eerb->buffersize) { | ||
165 | MESSAGE(KERN_ERR, "%s", "runaway buffer head."); | ||
166 | BUG(); | ||
167 | } | ||
168 | } | ||
169 | } | ||
170 | |||
171 | /* | ||
172 | * needs to be called with bufferlock held | ||
173 | */ | ||
174 | static int | ||
175 | dasd_eer_read_buffer(struct eerbuffer *eerb, int count, char *data) | ||
176 | { | ||
177 | |||
178 | unsigned long tailindex,localtail; | ||
179 | unsigned long rest, len, finalcount; | ||
180 | char *nextdata; | ||
181 | |||
182 | finalcount = min(count, dasd_eer_get_filled_bytes(eerb)); | ||
183 | nextdata = data; | ||
184 | rest = finalcount; | ||
185 | while (rest > 0) { | ||
186 | tailindex = eerb->tail / PAGE_SIZE; | ||
187 | localtail = eerb->tail % PAGE_SIZE; | ||
188 | len = min(rest, (PAGE_SIZE - localtail)); | ||
189 | memcpy(nextdata, eerb->buffer[tailindex]+localtail, len); | ||
190 | nextdata += len; | ||
191 | rest -= len; | ||
192 | eerb->tail += len; | ||
193 | if ( eerb->tail == eerb->buffersize ) | ||
194 | eerb->tail = 0; /* wrap around */ | ||
195 | if (eerb->tail > eerb->buffersize) { | ||
196 | MESSAGE(KERN_ERR, "%s", "runaway buffer tail."); | ||
197 | BUG(); | ||
198 | } | ||
199 | } | ||
200 | return finalcount; | ||
201 | } | ||
202 | |||
203 | /* | ||
204 | * Whenever you want to write a blob of data to the internal buffer you | ||
205 | * have to start by using this function first. It will write the number | ||
206 | * of bytes that will be written to the buffer. If necessary it will remove | ||
207 | * old records to make room for the new one. | ||
208 | * needs to be called with bufferlock held | ||
209 | */ | ||
210 | static int | ||
211 | dasd_eer_start_record(struct eerbuffer *eerb, int count) | ||
212 | { | ||
213 | int tailcount; | ||
214 | if (count + sizeof(count) > eerb->buffersize) | ||
215 | return -ENOMEM; | ||
216 | while (dasd_eer_get_free_bytes(eerb) < count + sizeof(count)) { | ||
217 | if (eerb->residual > 0) { | ||
218 | eerb->tail += eerb->residual; | ||
219 | if (eerb->tail >= eerb->buffersize) | ||
220 | eerb->tail -= eerb->buffersize; | ||
221 | eerb->residual = -1; | ||
222 | } | ||
223 | dasd_eer_read_buffer(eerb, sizeof(tailcount), | ||
224 | (char*)(&tailcount)); | ||
225 | eerb->tail += tailcount; | ||
226 | if (eerb->tail >= eerb->buffersize) | ||
227 | eerb->tail -= eerb->buffersize; | ||
228 | } | ||
229 | dasd_eer_write_buffer(eerb, sizeof(count), (char*)(&count)); | ||
230 | |||
231 | return 0; | ||
232 | }; | ||
233 | |||
234 | /* | ||
235 | * release pages that are not used anymore | ||
236 | */ | ||
237 | static void | ||
238 | dasd_eer_free_buffer_pages(char **buf, int no_pages) | ||
239 | { | ||
240 | int i; | ||
241 | |||
242 | for (i = 0; i < no_pages; ++i) { | ||
243 | free_page((unsigned long)buf[i]); | ||
244 | } | ||
245 | } | ||
246 | |||
247 | /* | ||
248 | * allocate a new set of memory pages | ||
249 | */ | ||
250 | static int | ||
251 | dasd_eer_allocate_buffer_pages(char **buf, int no_pages) | ||
252 | { | ||
253 | int i; | ||
254 | |||
255 | for (i = 0; i < no_pages; ++i) { | ||
256 | buf[i] = (char *) get_zeroed_page(GFP_KERNEL); | ||
257 | if (!buf[i]) { | ||
258 | dasd_eer_free_buffer_pages(buf, i); | ||
259 | return -ENOMEM; | ||
260 | } | ||
261 | } | ||
262 | return 0; | ||
263 | } | ||
264 | |||
265 | /* | ||
266 | * empty the buffer by resetting head and tail | ||
267 | * In case there is a half read data blob in the buffer, we set residual | ||
268 | * to -1 to indicate that the remainder of the blob is lost. | ||
269 | */ | ||
270 | static void | ||
271 | dasd_eer_purge_buffer(struct eerbuffer *eerb) | ||
272 | { | ||
273 | unsigned long flags; | ||
274 | |||
275 | spin_lock_irqsave(&bufferlock, flags); | ||
276 | if (eerb->residual > 0) | ||
277 | eerb->residual = -1; | ||
278 | eerb->tail=0; | ||
279 | eerb->head=0; | ||
280 | spin_unlock_irqrestore(&bufferlock, flags); | ||
281 | } | ||
282 | |||
283 | /* | ||
284 | * set the size of the buffer, newsize is the new number of pages to be used | ||
285 | * we don't try to copy any data back an forth, so any resize will also purge | ||
286 | * the buffer | ||
287 | */ | ||
288 | static int | ||
289 | dasd_eer_resize_buffer(struct eerbuffer *eerb, int newsize) | ||
290 | { | ||
291 | int i, oldcount, reuse; | ||
292 | char **new; | ||
293 | char **old; | ||
294 | unsigned long flags; | ||
295 | |||
296 | if (newsize < 1) | ||
297 | return -EINVAL; | ||
298 | if (eerb->buffer_page_count == newsize) { | ||
299 | /* documented behaviour is that any successfull invocation | ||
300 | * will purge all records */ | ||
301 | dasd_eer_purge_buffer(eerb); | ||
302 | return 0; | ||
303 | } | ||
304 | new = kmalloc(newsize*sizeof(char*), GFP_KERNEL); | ||
305 | if (!new) | ||
306 | return -ENOMEM; | ||
307 | |||
308 | reuse=min(eerb->buffer_page_count, newsize); | ||
309 | for (i = 0; i < reuse; ++i) { | ||
310 | new[i] = eerb->buffer[i]; | ||
311 | } | ||
312 | if (eerb->buffer_page_count < newsize) { | ||
313 | if (dasd_eer_allocate_buffer_pages( | ||
314 | &new[eerb->buffer_page_count], | ||
315 | newsize - eerb->buffer_page_count)) { | ||
316 | kfree(new); | ||
317 | return -ENOMEM; | ||
318 | } | ||
319 | } | ||
320 | |||
321 | spin_lock_irqsave(&bufferlock, flags); | ||
322 | old = eerb->buffer; | ||
323 | eerb->buffer = new; | ||
324 | if (eerb->residual > 0) | ||
325 | eerb->residual = -1; | ||
326 | eerb->tail = 0; | ||
327 | eerb->head = 0; | ||
328 | oldcount = eerb->buffer_page_count; | ||
329 | eerb->buffer_page_count = newsize; | ||
330 | spin_unlock_irqrestore(&bufferlock, flags); | ||
331 | |||
332 | if (oldcount > newsize) { | ||
333 | for (i = newsize; i < oldcount; ++i) { | ||
334 | free_page((unsigned long)old[i]); | ||
335 | } | ||
336 | } | ||
337 | kfree(old); | ||
338 | |||
339 | return 0; | ||
340 | } | ||
341 | |||
342 | |||
343 | /*****************************************************************************/ | ||
344 | /* The extended error reporting functionality */ | ||
345 | /*****************************************************************************/ | ||
346 | |||
347 | /* | ||
348 | * When a DASD device driver wants to report an error, it calls the | ||
349 | * function dasd_eer_write_trigger (via a notifier mechanism) and gives the | ||
350 | * respective trigger ID as parameter. | ||
351 | * Currently there are four kinds of triggers: | ||
352 | * | ||
353 | * DASD_EER_FATALERROR: all kinds of unrecoverable I/O problems | ||
354 | * DASD_EER_PPRCSUSPEND: PPRC was suspended | ||
355 | * DASD_EER_NOPATH: There is no path to the device left. | ||
356 | * DASD_EER_STATECHANGE: The state of the device has changed. | ||
357 | * | ||
358 | * For the first three triggers all required information can be supplied by | ||
359 | * the caller. For these triggers a record is written by the function | ||
360 | * dasd_eer_write_standard_trigger. | ||
361 | * | ||
362 | * When dasd_eer_write_trigger is called to write a DASD_EER_STATECHANGE | ||
363 | * trigger, we have to gather the necessary sense data first. We cannot queue | ||
364 | * the necessary SNSS (sense subsystem status) request immediatly, since we | ||
365 | * are likely to run in a deadlock situation. Instead, we schedule a | ||
366 | * work_struct that calls the function dasd_eer_sense_subsystem_status to | ||
367 | * create and start an SNSS request asynchronously. | ||
368 | * | ||
369 | * To avoid memory allocations at runtime, the necessary memory is allocated | ||
370 | * when the extended error reporting is enabled for a device (by | ||
371 | * dasd_eer_probe). There is one private eer data structure for each eer | ||
372 | * enabled DASD device. It contains memory for the work_struct, one SNSS cqr | ||
373 | * and a flags field that is used to coordinate the use of the cqr. The call | ||
374 | * to write a state change trigger can come in at any time, so we have one flag | ||
375 | * CQR_IN_USE that protects the cqr itself. When this flag indicates that the | ||
376 | * cqr is currently in use, dasd_eer_sense_subsystem_status cannot start a | ||
377 | * second request but sets the SNSS_REQUESTED flag instead. | ||
378 | * | ||
379 | * When the request is finished, the callback function dasd_eer_SNSS_cb | ||
380 | * is called. This function will invoke the function | ||
381 | * dasd_eer_write_SNSS_trigger to finally write the trigger. It will also | ||
382 | * check the SNSS_REQUESTED flag and if it is set it will call | ||
383 | * dasd_eer_sense_subsystem_status again. | ||
384 | * | ||
385 | * To avoid race conditions during the handling of the lock, the flags must | ||
386 | * be protected by the snsslock. | ||
387 | */ | ||
388 | |||
389 | struct dasd_eer_private { | ||
390 | struct dasd_ccw_req *cqr; | ||
391 | unsigned long flags; | ||
392 | struct work_struct worker; | ||
393 | }; | ||
394 | |||
395 | static void dasd_eer_destroy(struct dasd_device *device, | ||
396 | struct dasd_eer_private *eer); | ||
397 | static int | ||
398 | dasd_eer_write_trigger(struct dasd_eer_trigger *trigger); | ||
399 | static void dasd_eer_sense_subsystem_status(void *data); | ||
400 | static int dasd_eer_notify(struct notifier_block *self, | ||
401 | unsigned long action, void *data); | ||
402 | |||
403 | struct workqueue_struct *dasd_eer_workqueue; | ||
404 | |||
405 | #define SNSS_DATA_SIZE 44 | ||
406 | static spinlock_t snsslock = SPIN_LOCK_UNLOCKED; | ||
407 | |||
408 | #define DASD_EER_BUSID_SIZE 10 | ||
409 | struct dasd_eer_header { | ||
410 | __u32 total_size; | ||
411 | __u32 trigger; | ||
412 | __u64 tv_sec; | ||
413 | __u64 tv_usec; | ||
414 | char busid[DASD_EER_BUSID_SIZE]; | ||
415 | } __attribute__ ((packed)); | ||
416 | |||
417 | static struct notifier_block dasd_eer_nb = { | ||
418 | .notifier_call = dasd_eer_notify, | ||
419 | }; | ||
420 | |||
421 | /* | ||
422 | * flags for use with dasd_eer_private | ||
423 | */ | ||
424 | #define CQR_IN_USE 0 | ||
425 | #define SNSS_REQUESTED 1 | ||
426 | |||
427 | /* | ||
428 | * This function checks if extended error reporting is available for a given | ||
429 | * dasd_device. If yes, then it creates and returns a struct dasd_eer, | ||
430 | * otherwise it returns an -EPERM error pointer. | ||
431 | */ | ||
432 | struct dasd_eer_private * | ||
433 | dasd_eer_probe(struct dasd_device *device) | ||
434 | { | ||
435 | struct dasd_eer_private *private; | ||
436 | |||
437 | if (!(device && device->discipline | ||
438 | && !strcmp(device->discipline->name, "ECKD"))) { | ||
439 | return ERR_PTR(-EPERM); | ||
440 | } | ||
441 | /* allocate the private data structure */ | ||
442 | private = (struct dasd_eer_private *)kmalloc( | ||
443 | sizeof(struct dasd_eer_private), GFP_KERNEL); | ||
444 | if (!private) { | ||
445 | return ERR_PTR(-ENOMEM); | ||
446 | } | ||
447 | INIT_WORK(&private->worker, dasd_eer_sense_subsystem_status, | ||
448 | (void *)device); | ||
449 | private->cqr = dasd_kmalloc_request("ECKD", | ||
450 | 1 /* SNSS */ , | ||
451 | SNSS_DATA_SIZE , | ||
452 | device); | ||
453 | if (!private->cqr) { | ||
454 | kfree(private); | ||
455 | return ERR_PTR(-ENOMEM); | ||
456 | } | ||
457 | private->flags = 0; | ||
458 | return private; | ||
459 | }; | ||
460 | |||
461 | /* | ||
462 | * If our private SNSS request is queued, remove it from the | ||
463 | * dasd ccw queue so we can free the requests memory. | ||
464 | */ | ||
465 | static void | ||
466 | dasd_eer_dequeue_SNSS_request(struct dasd_device *device, | ||
467 | struct dasd_eer_private *eer) | ||
468 | { | ||
469 | struct list_head *lst, *nxt; | ||
470 | struct dasd_ccw_req *cqr, *erpcqr; | ||
471 | dasd_erp_fn_t erp_fn; | ||
472 | |||
473 | spin_lock_irq(get_ccwdev_lock(device->cdev)); | ||
474 | list_for_each_safe(lst, nxt, &device->ccw_queue) { | ||
475 | cqr = list_entry(lst, struct dasd_ccw_req, list); | ||
476 | /* we are looking for two kinds or requests */ | ||
477 | /* first kind: our SNSS request: */ | ||
478 | if (cqr == eer->cqr) { | ||
479 | if (cqr->status == DASD_CQR_IN_IO) | ||
480 | device->discipline->term_IO(cqr); | ||
481 | list_del(&cqr->list); | ||
482 | break; | ||
483 | } | ||
484 | /* second kind: ERP requests for our SNSS request */ | ||
485 | if (cqr->refers) { | ||
486 | /* If this erp request chain ends in our cqr, then */ | ||
487 | /* cal the erp_postaction to clean it up */ | ||
488 | erpcqr = cqr; | ||
489 | while (erpcqr->refers) { | ||
490 | erpcqr = erpcqr->refers; | ||
491 | } | ||
492 | if (erpcqr == eer->cqr) { | ||
493 | erp_fn = device->discipline->erp_postaction( | ||
494 | cqr); | ||
495 | erp_fn(cqr); | ||
496 | } | ||
497 | continue; | ||
498 | } | ||
499 | } | ||
500 | spin_unlock_irq(get_ccwdev_lock(device->cdev)); | ||
501 | } | ||
502 | |||
503 | /* | ||
504 | * This function dismantles a struct dasd_eer that was created by | ||
505 | * dasd_eer_probe. Since we want to free our private data structure, | ||
506 | * we must make sure that the memory is not in use anymore. | ||
507 | * We have to flush the work queue and remove a possible SNSS request | ||
508 | * from the dasd queue. | ||
509 | */ | ||
510 | static void | ||
511 | dasd_eer_destroy(struct dasd_device *device, struct dasd_eer_private *eer) | ||
512 | { | ||
513 | flush_workqueue(dasd_eer_workqueue); | ||
514 | dasd_eer_dequeue_SNSS_request(device, eer); | ||
515 | dasd_kfree_request(eer->cqr, device); | ||
516 | kfree(eer); | ||
517 | }; | ||
518 | |||
519 | /* | ||
520 | * enable the extended error reporting for a particular device | ||
521 | */ | ||
522 | static int | ||
523 | dasd_eer_enable_on_device(struct dasd_device *device) | ||
524 | { | ||
525 | void *eer; | ||
526 | if (!device) | ||
527 | return -ENODEV; | ||
528 | if (device->eer) | ||
529 | return 0; | ||
530 | if (!try_module_get(THIS_MODULE)) { | ||
531 | return -EINVAL; | ||
532 | } | ||
533 | eer = (void *)dasd_eer_probe(device); | ||
534 | if (IS_ERR(eer)) { | ||
535 | module_put(THIS_MODULE); | ||
536 | return PTR_ERR(eer); | ||
537 | } | ||
538 | device->eer = eer; | ||
539 | return 0; | ||
540 | } | ||
541 | |||
542 | /* | ||
543 | * enable the extended error reporting for a particular device | ||
544 | */ | ||
545 | static int | ||
546 | dasd_eer_disable_on_device(struct dasd_device *device) | ||
547 | { | ||
548 | struct dasd_eer_private *eer = device->eer; | ||
549 | |||
550 | if (!device) | ||
551 | return -ENODEV; | ||
552 | if (!device->eer) | ||
553 | return 0; | ||
554 | device->eer = NULL; | ||
555 | dasd_eer_destroy(device,eer); | ||
556 | module_put(THIS_MODULE); | ||
557 | |||
558 | return 0; | ||
559 | } | ||
560 | |||
561 | /* | ||
562 | * Set extended error reporting (eer) | ||
563 | * Note: This will be registered as a DASD ioctl, to be called on DASD devices. | ||
564 | */ | ||
565 | static int | ||
566 | dasd_ioctl_set_eer(struct block_device *bdev, int no, long args) | ||
567 | { | ||
568 | struct dasd_device *device; | ||
569 | int intval; | ||
570 | |||
571 | if (!capable(CAP_SYS_ADMIN)) | ||
572 | return -EACCES; | ||
573 | if (bdev != bdev->bd_contains) | ||
574 | /* Error-reporting is not allowed for partitions */ | ||
575 | return -EINVAL; | ||
576 | if (get_user(intval, (int __user *) args)) | ||
577 | return -EFAULT; | ||
578 | device = bdev->bd_disk->private_data; | ||
579 | if (device == NULL) | ||
580 | return -ENODEV; | ||
581 | |||
582 | intval = (intval != 0); | ||
583 | DEV_MESSAGE (KERN_DEBUG, device, | ||
584 | "set eer on device to %d", intval); | ||
585 | if (intval) | ||
586 | return dasd_eer_enable_on_device(device); | ||
587 | else | ||
588 | return dasd_eer_disable_on_device(device); | ||
589 | } | ||
590 | |||
591 | /* | ||
592 | * Get value of extended error reporting. | ||
593 | * Note: This will be registered as a DASD ioctl, to be called on DASD devices. | ||
594 | */ | ||
595 | static int | ||
596 | dasd_ioctl_get_eer(struct block_device *bdev, int no, long args) | ||
597 | { | ||
598 | struct dasd_device *device; | ||
599 | |||
600 | device = bdev->bd_disk->private_data; | ||
601 | if (device == NULL) | ||
602 | return -ENODEV; | ||
603 | return put_user((device->eer != NULL), (int __user *) args); | ||
604 | } | ||
605 | |||
606 | /* | ||
607 | * The following function can be used for those triggers that have | ||
608 | * all necessary data available when the function is called. | ||
609 | * If the parameter cqr is not NULL, the chain of requests will be searched | ||
610 | * for valid sense data, and all valid sense data sets will be added to | ||
611 | * the triggers data. | ||
612 | */ | ||
613 | static int | ||
614 | dasd_eer_write_standard_trigger(int trigger, struct dasd_device *device, | ||
615 | struct dasd_ccw_req *cqr) | ||
616 | { | ||
617 | struct dasd_ccw_req *temp_cqr; | ||
618 | int data_size; | ||
619 | struct timeval tv; | ||
620 | struct dasd_eer_header header; | ||
621 | unsigned long flags; | ||
622 | struct eerbuffer *eerb; | ||
623 | |||
624 | /* go through cqr chain and count the valid sense data sets */ | ||
625 | temp_cqr = cqr; | ||
626 | data_size = 0; | ||
627 | while (temp_cqr) { | ||
628 | if (temp_cqr->irb.esw.esw0.erw.cons) | ||
629 | data_size += 32; | ||
630 | temp_cqr = temp_cqr->refers; | ||
631 | } | ||
632 | |||
633 | header.total_size = sizeof(header) + data_size + 4; /* "EOR" */ | ||
634 | header.trigger = trigger; | ||
635 | do_gettimeofday(&tv); | ||
636 | header.tv_sec = tv.tv_sec; | ||
637 | header.tv_usec = tv.tv_usec; | ||
638 | strncpy(header.busid, device->cdev->dev.bus_id, DASD_EER_BUSID_SIZE); | ||
639 | |||
640 | spin_lock_irqsave(&bufferlock, flags); | ||
641 | list_for_each_entry(eerb, &bufferlist, list) { | ||
642 | dasd_eer_start_record(eerb, header.total_size); | ||
643 | dasd_eer_write_buffer(eerb, sizeof(header), (char*)(&header)); | ||
644 | temp_cqr = cqr; | ||
645 | while (temp_cqr) { | ||
646 | if (temp_cqr->irb.esw.esw0.erw.cons) | ||
647 | dasd_eer_write_buffer(eerb, 32, cqr->irb.ecw); | ||
648 | temp_cqr = temp_cqr->refers; | ||
649 | } | ||
650 | dasd_eer_write_buffer(eerb, 4,"EOR"); | ||
651 | } | ||
652 | spin_unlock_irqrestore(&bufferlock, flags); | ||
653 | |||
654 | wake_up_interruptible(&dasd_eer_read_wait_queue); | ||
655 | |||
656 | return 0; | ||
657 | } | ||
658 | |||
659 | /* | ||
660 | * This function writes a DASD_EER_STATECHANGE trigger. | ||
661 | */ | ||
662 | static void | ||
663 | dasd_eer_write_SNSS_trigger(struct dasd_device *device, | ||
664 | struct dasd_ccw_req *cqr) | ||
665 | { | ||
666 | int data_size; | ||
667 | int snss_rc; | ||
668 | struct timeval tv; | ||
669 | struct dasd_eer_header header; | ||
670 | unsigned long flags; | ||
671 | struct eerbuffer *eerb; | ||
672 | |||
673 | snss_rc = (cqr->status == DASD_CQR_FAILED) ? -EIO : 0; | ||
674 | if (snss_rc) | ||
675 | data_size = 0; | ||
676 | else | ||
677 | data_size = SNSS_DATA_SIZE; | ||
678 | |||
679 | header.total_size = sizeof(header) + data_size + 4; /* "EOR" */ | ||
680 | header.trigger = DASD_EER_STATECHANGE; | ||
681 | do_gettimeofday(&tv); | ||
682 | header.tv_sec = tv.tv_sec; | ||
683 | header.tv_usec = tv.tv_usec; | ||
684 | strncpy(header.busid, device->cdev->dev.bus_id, DASD_EER_BUSID_SIZE); | ||
685 | |||
686 | spin_lock_irqsave(&bufferlock, flags); | ||
687 | list_for_each_entry(eerb, &bufferlist, list) { | ||
688 | dasd_eer_start_record(eerb, header.total_size); | ||
689 | dasd_eer_write_buffer(eerb, sizeof(header),(char*)(&header)); | ||
690 | if (!snss_rc) | ||
691 | dasd_eer_write_buffer(eerb, SNSS_DATA_SIZE, cqr->data); | ||
692 | dasd_eer_write_buffer(eerb, 4,"EOR"); | ||
693 | } | ||
694 | spin_unlock_irqrestore(&bufferlock, flags); | ||
695 | |||
696 | wake_up_interruptible(&dasd_eer_read_wait_queue); | ||
697 | } | ||
698 | |||
699 | /* | ||
700 | * callback function for use with SNSS request | ||
701 | */ | ||
702 | static void | ||
703 | dasd_eer_SNSS_cb(struct dasd_ccw_req *cqr, void *data) | ||
704 | { | ||
705 | struct dasd_device *device; | ||
706 | struct dasd_eer_private *private; | ||
707 | unsigned long irqflags; | ||
708 | |||
709 | device = (struct dasd_device *)data; | ||
710 | private = (struct dasd_eer_private *)device->eer; | ||
711 | dasd_eer_write_SNSS_trigger(device, cqr); | ||
712 | spin_lock_irqsave(&snsslock, irqflags); | ||
713 | if(!test_and_clear_bit(SNSS_REQUESTED, &private->flags)) { | ||
714 | clear_bit(CQR_IN_USE, &private->flags); | ||
715 | spin_unlock_irqrestore(&snsslock, irqflags); | ||
716 | return; | ||
717 | }; | ||
718 | clear_bit(CQR_IN_USE, &private->flags); | ||
719 | spin_unlock_irqrestore(&snsslock, irqflags); | ||
720 | dasd_eer_sense_subsystem_status(device); | ||
721 | return; | ||
722 | } | ||
723 | |||
724 | /* | ||
725 | * clean a used cqr before using it again | ||
726 | */ | ||
727 | static void | ||
728 | dasd_eer_clean_SNSS_request(struct dasd_ccw_req *cqr) | ||
729 | { | ||
730 | struct ccw1 *cpaddr = cqr->cpaddr; | ||
731 | void *data = cqr->data; | ||
732 | |||
733 | memset(cqr, 0, sizeof(struct dasd_ccw_req)); | ||
734 | memset(cpaddr, 0, sizeof(struct ccw1)); | ||
735 | memset(data, 0, SNSS_DATA_SIZE); | ||
736 | cqr->cpaddr = cpaddr; | ||
737 | cqr->data = data; | ||
738 | strncpy((char *) &cqr->magic, "ECKD", 4); | ||
739 | ASCEBC((char *) &cqr->magic, 4); | ||
740 | set_bit(DASD_CQR_FLAGS_USE_ERP, &cqr->flags); | ||
741 | } | ||
742 | |||
743 | /* | ||
744 | * build and start an SNSS request | ||
745 | * This function is called from a work queue so we have to | ||
746 | * pass the dasd_device pointer as a void pointer. | ||
747 | */ | ||
748 | static void | ||
749 | dasd_eer_sense_subsystem_status(void *data) | ||
750 | { | ||
751 | struct dasd_device *device; | ||
752 | struct dasd_eer_private *private; | ||
753 | struct dasd_ccw_req *cqr; | ||
754 | struct ccw1 *ccw; | ||
755 | unsigned long irqflags; | ||
756 | |||
757 | device = (struct dasd_device *)data; | ||
758 | private = (struct dasd_eer_private *)device->eer; | ||
759 | if (!private) /* device not eer enabled any more */ | ||
760 | return; | ||
761 | cqr = private->cqr; | ||
762 | spin_lock_irqsave(&snsslock, irqflags); | ||
763 | if(test_and_set_bit(CQR_IN_USE, &private->flags)) { | ||
764 | set_bit(SNSS_REQUESTED, &private->flags); | ||
765 | spin_unlock_irqrestore(&snsslock, irqflags); | ||
766 | return; | ||
767 | }; | ||
768 | spin_unlock_irqrestore(&snsslock, irqflags); | ||
769 | dasd_eer_clean_SNSS_request(cqr); | ||
770 | cqr->device = device; | ||
771 | cqr->retries = 255; | ||
772 | cqr->expires = 10 * HZ; | ||
773 | |||
774 | ccw = cqr->cpaddr; | ||
775 | ccw->cmd_code = DASD_ECKD_CCW_SNSS; | ||
776 | ccw->count = SNSS_DATA_SIZE; | ||
777 | ccw->flags = 0; | ||
778 | ccw->cda = (__u32)(addr_t)cqr->data; | ||
779 | |||
780 | cqr->buildclk = get_clock(); | ||
781 | cqr->status = DASD_CQR_FILLED; | ||
782 | cqr->callback = dasd_eer_SNSS_cb; | ||
783 | cqr->callback_data = (void *)device; | ||
784 | dasd_add_request_head(cqr); | ||
785 | |||
786 | return; | ||
787 | } | ||
788 | |||
789 | /* | ||
790 | * This function is called for all triggers. It calls the appropriate | ||
791 | * function that writes the actual trigger records. | ||
792 | */ | ||
793 | static int | ||
794 | dasd_eer_write_trigger(struct dasd_eer_trigger *trigger) | ||
795 | { | ||
796 | int rc; | ||
797 | struct dasd_eer_private *private = trigger->device->eer; | ||
798 | |||
799 | switch (trigger->id) { | ||
800 | case DASD_EER_FATALERROR: | ||
801 | case DASD_EER_PPRCSUSPEND: | ||
802 | rc = dasd_eer_write_standard_trigger( | ||
803 | trigger->id, trigger->device, trigger->cqr); | ||
804 | break; | ||
805 | case DASD_EER_NOPATH: | ||
806 | rc = dasd_eer_write_standard_trigger( | ||
807 | trigger->id, trigger->device, NULL); | ||
808 | break; | ||
809 | case DASD_EER_STATECHANGE: | ||
810 | if (queue_work(dasd_eer_workqueue, &private->worker)) { | ||
811 | rc=0; | ||
812 | } else { | ||
813 | /* If the work_struct was already queued, it can't | ||
814 | * be queued again. But this is OK since we don't | ||
815 | * need to have it queued twice. | ||
816 | */ | ||
817 | rc = -EBUSY; | ||
818 | } | ||
819 | break; | ||
820 | default: /* unknown trigger, so we write it without any sense data */ | ||
821 | rc = dasd_eer_write_standard_trigger( | ||
822 | trigger->id, trigger->device, NULL); | ||
823 | break; | ||
824 | } | ||
825 | return rc; | ||
826 | } | ||
827 | |||
828 | /* | ||
829 | * This function is registered with the dasd device driver and gets called | ||
830 | * for all dasd eer notifications. | ||
831 | */ | ||
832 | static int dasd_eer_notify(struct notifier_block *self, | ||
833 | unsigned long action, void *data) | ||
834 | { | ||
835 | switch (action) { | ||
836 | case DASD_EER_DISABLE: | ||
837 | dasd_eer_disable_on_device((struct dasd_device *)data); | ||
838 | break; | ||
839 | case DASD_EER_TRIGGER: | ||
840 | dasd_eer_write_trigger((struct dasd_eer_trigger *)data); | ||
841 | break; | ||
842 | } | ||
843 | return NOTIFY_OK; | ||
844 | } | ||
845 | |||
846 | |||
847 | /*****************************************************************************/ | ||
848 | /* the device operations */ | ||
849 | /*****************************************************************************/ | ||
850 | |||
851 | /* | ||
852 | * On the one side we need a lock to access our internal buffer, on the | ||
853 | * other side a copy_to_user can sleep. So we need to copy the data we have | ||
854 | * to transfer in a readbuffer, which is protected by the readbuffer_mutex. | ||
855 | */ | ||
856 | static char readbuffer[PAGE_SIZE]; | ||
857 | DECLARE_MUTEX(readbuffer_mutex); | ||
858 | |||
859 | |||
860 | static int | ||
861 | dasd_eer_open(struct inode *inp, struct file *filp) | ||
862 | { | ||
863 | struct eerbuffer *eerb; | ||
864 | unsigned long flags; | ||
865 | |||
866 | eerb = kmalloc(sizeof(struct eerbuffer), GFP_KERNEL); | ||
867 | eerb->head = 0; | ||
868 | eerb->tail = 0; | ||
869 | eerb->residual = 0; | ||
870 | eerb->buffer_page_count = 1; | ||
871 | eerb->buffersize = eerb->buffer_page_count * PAGE_SIZE; | ||
872 | eerb->buffer = kmalloc(eerb->buffer_page_count*sizeof(char*), | ||
873 | GFP_KERNEL); | ||
874 | if (!eerb->buffer) | ||
875 | return -ENOMEM; | ||
876 | if (dasd_eer_allocate_buffer_pages(eerb->buffer, | ||
877 | eerb->buffer_page_count)) { | ||
878 | kfree(eerb->buffer); | ||
879 | return -ENOMEM; | ||
880 | } | ||
881 | filp->private_data = eerb; | ||
882 | spin_lock_irqsave(&bufferlock, flags); | ||
883 | list_add(&eerb->list, &bufferlist); | ||
884 | spin_unlock_irqrestore(&bufferlock, flags); | ||
885 | |||
886 | return nonseekable_open(inp,filp); | ||
887 | } | ||
888 | |||
889 | static int | ||
890 | dasd_eer_close(struct inode *inp, struct file *filp) | ||
891 | { | ||
892 | struct eerbuffer *eerb; | ||
893 | unsigned long flags; | ||
894 | |||
895 | eerb = (struct eerbuffer *)filp->private_data; | ||
896 | spin_lock_irqsave(&bufferlock, flags); | ||
897 | list_del(&eerb->list); | ||
898 | spin_unlock_irqrestore(&bufferlock, flags); | ||
899 | dasd_eer_free_buffer_pages(eerb->buffer, eerb->buffer_page_count); | ||
900 | kfree(eerb->buffer); | ||
901 | kfree(eerb); | ||
902 | |||
903 | return 0; | ||
904 | } | ||
905 | |||
906 | static long | ||
907 | dasd_eer_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | ||
908 | { | ||
909 | int intval; | ||
910 | struct eerbuffer *eerb; | ||
911 | |||
912 | eerb = (struct eerbuffer *)filp->private_data; | ||
913 | switch (cmd) { | ||
914 | case DASD_EER_PURGE: | ||
915 | dasd_eer_purge_buffer(eerb); | ||
916 | return 0; | ||
917 | case DASD_EER_SETBUFSIZE: | ||
918 | if (get_user(intval, (int __user *)arg)) | ||
919 | return -EFAULT; | ||
920 | return dasd_eer_resize_buffer(eerb, intval); | ||
921 | default: | ||
922 | return -ENOIOCTLCMD; | ||
923 | } | ||
924 | } | ||
925 | |||
926 | static ssize_t | ||
927 | dasd_eer_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos) | ||
928 | { | ||
929 | int tc,rc; | ||
930 | int tailcount,effective_count; | ||
931 | unsigned long flags; | ||
932 | struct eerbuffer *eerb; | ||
933 | |||
934 | eerb = (struct eerbuffer *)filp->private_data; | ||
935 | if(down_interruptible(&readbuffer_mutex)) | ||
936 | return -ERESTARTSYS; | ||
937 | |||
938 | spin_lock_irqsave(&bufferlock, flags); | ||
939 | |||
940 | if (eerb->residual < 0) { /* the remainder of this record */ | ||
941 | /* has been deleted */ | ||
942 | eerb->residual = 0; | ||
943 | spin_unlock_irqrestore(&bufferlock, flags); | ||
944 | up(&readbuffer_mutex); | ||
945 | return -EIO; | ||
946 | } else if (eerb->residual > 0) { | ||
947 | /* OK we still have a second half of a record to deliver */ | ||
948 | effective_count = min(eerb->residual, (int)count); | ||
949 | eerb->residual -= effective_count; | ||
950 | } else { | ||
951 | tc = 0; | ||
952 | while (!tc) { | ||
953 | tc = dasd_eer_read_buffer(eerb, | ||
954 | sizeof(tailcount), (char*)(&tailcount)); | ||
955 | if (!tc) { | ||
956 | /* no data available */ | ||
957 | spin_unlock_irqrestore(&bufferlock, flags); | ||
958 | up(&readbuffer_mutex); | ||
959 | if (filp->f_flags & O_NONBLOCK) | ||
960 | return -EAGAIN; | ||
961 | rc = wait_event_interruptible( | ||
962 | dasd_eer_read_wait_queue, | ||
963 | eerb->head != eerb->tail); | ||
964 | if (rc) { | ||
965 | return rc; | ||
966 | } | ||
967 | if(down_interruptible(&readbuffer_mutex)) | ||
968 | return -ERESTARTSYS; | ||
969 | spin_lock_irqsave(&bufferlock, flags); | ||
970 | } | ||
971 | } | ||
972 | WARN_ON(tc != sizeof(tailcount)); | ||
973 | effective_count = min(tailcount,(int)count); | ||
974 | eerb->residual = tailcount - effective_count; | ||
975 | } | ||
976 | |||
977 | tc = dasd_eer_read_buffer(eerb, effective_count, readbuffer); | ||
978 | WARN_ON(tc != effective_count); | ||
979 | |||
980 | spin_unlock_irqrestore(&bufferlock, flags); | ||
981 | |||
982 | if (copy_to_user(buf, readbuffer, effective_count)) { | ||
983 | up(&readbuffer_mutex); | ||
984 | return -EFAULT; | ||
985 | } | ||
986 | |||
987 | up(&readbuffer_mutex); | ||
988 | return effective_count; | ||
989 | } | ||
990 | |||
991 | static unsigned int | ||
992 | dasd_eer_poll (struct file *filp, poll_table *ptable) | ||
993 | { | ||
994 | unsigned int mask; | ||
995 | unsigned long flags; | ||
996 | struct eerbuffer *eerb; | ||
997 | |||
998 | eerb = (struct eerbuffer *)filp->private_data; | ||
999 | poll_wait(filp, &dasd_eer_read_wait_queue, ptable); | ||
1000 | spin_lock_irqsave(&bufferlock, flags); | ||
1001 | if (eerb->head != eerb->tail) | ||
1002 | mask = POLLIN | POLLRDNORM ; | ||
1003 | else | ||
1004 | mask = 0; | ||
1005 | spin_unlock_irqrestore(&bufferlock, flags); | ||
1006 | return mask; | ||
1007 | } | ||
1008 | |||
1009 | static struct file_operations dasd_eer_fops = { | ||
1010 | .open = &dasd_eer_open, | ||
1011 | .release = &dasd_eer_close, | ||
1012 | .unlocked_ioctl = &dasd_eer_ioctl, | ||
1013 | .compat_ioctl = &dasd_eer_ioctl, | ||
1014 | .read = &dasd_eer_read, | ||
1015 | .poll = &dasd_eer_poll, | ||
1016 | .owner = THIS_MODULE, | ||
1017 | }; | ||
1018 | |||
1019 | static struct miscdevice dasd_eer_dev = { | ||
1020 | .minor = MISC_DYNAMIC_MINOR, | ||
1021 | .name = "dasd_eer", | ||
1022 | .fops = &dasd_eer_fops, | ||
1023 | }; | ||
1024 | |||
1025 | |||
1026 | /*****************************************************************************/ | ||
1027 | /* Init and exit */ | ||
1028 | /*****************************************************************************/ | ||
1029 | |||
1030 | static int | ||
1031 | __init dasd_eer_init(void) | ||
1032 | { | ||
1033 | int rc; | ||
1034 | |||
1035 | dasd_eer_workqueue = create_singlethread_workqueue("dasd_eer"); | ||
1036 | if (!dasd_eer_workqueue) { | ||
1037 | MESSAGE(KERN_ERR , "%s", "dasd_eer_init could not " | ||
1038 | "create workqueue \n"); | ||
1039 | rc = -ENOMEM; | ||
1040 | goto out; | ||
1041 | } | ||
1042 | |||
1043 | rc = dasd_register_eer_notifier(&dasd_eer_nb); | ||
1044 | if (rc) { | ||
1045 | MESSAGE(KERN_ERR, "%s", "dasd_eer_init could not " | ||
1046 | "register error reporting"); | ||
1047 | goto queue; | ||
1048 | } | ||
1049 | |||
1050 | dasd_ioctl_no_register(THIS_MODULE, BIODASDEERSET, dasd_ioctl_set_eer); | ||
1051 | dasd_ioctl_no_register(THIS_MODULE, BIODASDEERGET, dasd_ioctl_get_eer); | ||
1052 | |||
1053 | /* we don't need our own character device, | ||
1054 | * so we just register as misc device */ | ||
1055 | rc = misc_register(&dasd_eer_dev); | ||
1056 | if (rc) { | ||
1057 | MESSAGE(KERN_ERR, "%s", "dasd_eer_init could not " | ||
1058 | "register misc device"); | ||
1059 | goto unregister; | ||
1060 | } | ||
1061 | |||
1062 | return 0; | ||
1063 | |||
1064 | unregister: | ||
1065 | dasd_unregister_eer_notifier(&dasd_eer_nb); | ||
1066 | dasd_ioctl_no_unregister(THIS_MODULE, BIODASDEERSET, | ||
1067 | dasd_ioctl_set_eer); | ||
1068 | dasd_ioctl_no_unregister(THIS_MODULE, BIODASDEERGET, | ||
1069 | dasd_ioctl_get_eer); | ||
1070 | queue: | ||
1071 | destroy_workqueue(dasd_eer_workqueue); | ||
1072 | out: | ||
1073 | return rc; | ||
1074 | |||
1075 | } | ||
1076 | module_init(dasd_eer_init); | ||
1077 | |||
1078 | static void | ||
1079 | __exit dasd_eer_exit(void) | ||
1080 | { | ||
1081 | dasd_unregister_eer_notifier(&dasd_eer_nb); | ||
1082 | dasd_ioctl_no_unregister(THIS_MODULE, BIODASDEERSET, | ||
1083 | dasd_ioctl_set_eer); | ||
1084 | dasd_ioctl_no_unregister(THIS_MODULE, BIODASDEERGET, | ||
1085 | dasd_ioctl_get_eer); | ||
1086 | destroy_workqueue(dasd_eer_workqueue); | ||
1087 | |||
1088 | WARN_ON(misc_deregister(&dasd_eer_dev) != 0); | ||
1089 | } | ||
1090 | module_exit(dasd_eer_exit); | ||
diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index d1b08fa13fd2..0592354cc604 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h | |||
@@ -275,34 +275,6 @@ struct dasd_discipline { | |||
275 | 275 | ||
276 | extern struct dasd_discipline *dasd_diag_discipline_pointer; | 276 | extern struct dasd_discipline *dasd_diag_discipline_pointer; |
277 | 277 | ||
278 | |||
279 | /* | ||
280 | * Notification numbers for extended error reporting notifications: | ||
281 | * The DASD_EER_DISABLE notification is sent before a dasd_device (and it's | ||
282 | * eer pointer) is freed. The error reporting module needs to do all necessary | ||
283 | * cleanup steps. | ||
284 | * The DASD_EER_TRIGGER notification sends the actual error reports (triggers). | ||
285 | */ | ||
286 | #define DASD_EER_DISABLE 0 | ||
287 | #define DASD_EER_TRIGGER 1 | ||
288 | |||
289 | /* Trigger IDs for extended error reporting DASD_EER_TRIGGER notification */ | ||
290 | #define DASD_EER_FATALERROR 1 | ||
291 | #define DASD_EER_NOPATH 2 | ||
292 | #define DASD_EER_STATECHANGE 3 | ||
293 | #define DASD_EER_PPRCSUSPEND 4 | ||
294 | |||
295 | /* | ||
296 | * The dasd_eer_trigger structure contains all data that we need to send | ||
297 | * along with an DASD_EER_TRIGGER notification. | ||
298 | */ | ||
299 | struct dasd_eer_trigger { | ||
300 | unsigned int id; | ||
301 | struct dasd_device *device; | ||
302 | struct dasd_ccw_req *cqr; | ||
303 | }; | ||
304 | |||
305 | |||
306 | struct dasd_device { | 278 | struct dasd_device { |
307 | /* Block device stuff. */ | 279 | /* Block device stuff. */ |
308 | struct gendisk *gdp; | 280 | struct gendisk *gdp; |
@@ -316,11 +288,9 @@ struct dasd_device { | |||
316 | unsigned long flags; /* per device flags */ | 288 | unsigned long flags; /* per device flags */ |
317 | unsigned short features; /* copy of devmap-features (read-only!) */ | 289 | unsigned short features; /* copy of devmap-features (read-only!) */ |
318 | 290 | ||
319 | /* extended error reporting stuff (eer) */ | ||
320 | void *eer; | ||
321 | |||
322 | /* Device discipline stuff. */ | 291 | /* Device discipline stuff. */ |
323 | struct dasd_discipline *discipline; | 292 | struct dasd_discipline *discipline; |
293 | struct dasd_discipline *base_discipline; | ||
324 | char *private; | 294 | char *private; |
325 | 295 | ||
326 | /* Device state and target state. */ | 296 | /* Device state and target state. */ |
@@ -519,12 +489,6 @@ int dasd_generic_set_online(struct ccw_device *, struct dasd_discipline *); | |||
519 | int dasd_generic_set_offline (struct ccw_device *cdev); | 489 | int dasd_generic_set_offline (struct ccw_device *cdev); |
520 | int dasd_generic_notify(struct ccw_device *, int); | 490 | int dasd_generic_notify(struct ccw_device *, int); |
521 | void dasd_generic_auto_online (struct ccw_driver *); | 491 | void dasd_generic_auto_online (struct ccw_driver *); |
522 | int dasd_register_eer_notifier(struct notifier_block *); | ||
523 | int dasd_unregister_eer_notifier(struct notifier_block *); | ||
524 | void dasd_write_eer_trigger(unsigned int , struct dasd_device *, | ||
525 | struct dasd_ccw_req *); | ||
526 | |||
527 | |||
528 | 492 | ||
529 | /* externals in dasd_devmap.c */ | 493 | /* externals in dasd_devmap.c */ |
530 | extern int dasd_max_devindex; | 494 | extern int dasd_max_devindex; |
diff --git a/drivers/s390/cio/qdio.c b/drivers/s390/cio/qdio.c index 45ce032772f4..9ed37dc9a1b0 100644 --- a/drivers/s390/cio/qdio.c +++ b/drivers/s390/cio/qdio.c | |||
@@ -165,8 +165,13 @@ qdio_do_eqbs(struct qdio_q *q, unsigned char *state, | |||
165 | q_no = q->q_no; | 165 | q_no = q->q_no; |
166 | if(!q->is_input_q) | 166 | if(!q->is_input_q) |
167 | q_no += irq->no_input_qs; | 167 | q_no += irq->no_input_qs; |
168 | again: | ||
168 | ccq = do_eqbs(irq->sch_token, state, q_no, start, cnt); | 169 | ccq = do_eqbs(irq->sch_token, state, q_no, start, cnt); |
169 | rc = qdio_check_ccq(q, ccq); | 170 | rc = qdio_check_ccq(q, ccq); |
171 | if (rc == 1) { | ||
172 | QDIO_DBF_TEXT5(1,trace,"eqAGAIN"); | ||
173 | goto again; | ||
174 | } | ||
170 | if (rc < 0) { | 175 | if (rc < 0) { |
171 | QDIO_DBF_TEXT2(1,trace,"eqberr"); | 176 | QDIO_DBF_TEXT2(1,trace,"eqberr"); |
172 | sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt, *cnt, ccq, q_no); | 177 | sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt, *cnt, ccq, q_no); |
@@ -195,8 +200,13 @@ qdio_do_sqbs(struct qdio_q *q, unsigned char state, | |||
195 | q_no = q->q_no; | 200 | q_no = q->q_no; |
196 | if(!q->is_input_q) | 201 | if(!q->is_input_q) |
197 | q_no += irq->no_input_qs; | 202 | q_no += irq->no_input_qs; |
203 | again: | ||
198 | ccq = do_sqbs(irq->sch_token, state, q_no, start, cnt); | 204 | ccq = do_sqbs(irq->sch_token, state, q_no, start, cnt); |
199 | rc = qdio_check_ccq(q, ccq); | 205 | rc = qdio_check_ccq(q, ccq); |
206 | if (rc == 1) { | ||
207 | QDIO_DBF_TEXT5(1,trace,"sqAGAIN"); | ||
208 | goto again; | ||
209 | } | ||
200 | if (rc < 0) { | 210 | if (rc < 0) { |
201 | QDIO_DBF_TEXT3(1,trace,"sqberr"); | 211 | QDIO_DBF_TEXT3(1,trace,"sqberr"); |
202 | sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt,*cnt,ccq,q_no); | 212 | sprintf(dbf_text,"%2x,%2x,%d,%d",tmp_cnt,*cnt,ccq,q_no); |
@@ -1187,8 +1197,7 @@ tiqdio_is_inbound_q_done(struct qdio_q *q) | |||
1187 | 1197 | ||
1188 | if (!no_used) | 1198 | if (!no_used) |
1189 | return 1; | 1199 | return 1; |
1190 | 1200 | if (!q->siga_sync && !irq->is_qebsm) | |
1191 | if (!q->siga_sync) | ||
1192 | /* we'll check for more primed buffers in qeth_stop_polling */ | 1201 | /* we'll check for more primed buffers in qeth_stop_polling */ |
1193 | return 0; | 1202 | return 0; |
1194 | if (irq->is_qebsm) { | 1203 | if (irq->is_qebsm) { |
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 791c4dc550ae..94f5e8ed83a7 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c | |||
@@ -90,7 +90,7 @@ static int spi_suspend(struct device *dev, pm_message_t message) | |||
90 | int value; | 90 | int value; |
91 | struct spi_driver *drv = to_spi_driver(dev->driver); | 91 | struct spi_driver *drv = to_spi_driver(dev->driver); |
92 | 92 | ||
93 | if (!drv->suspend) | 93 | if (!drv || !drv->suspend) |
94 | return 0; | 94 | return 0; |
95 | 95 | ||
96 | /* suspend will stop irqs and dma; no more i/o */ | 96 | /* suspend will stop irqs and dma; no more i/o */ |
@@ -105,7 +105,7 @@ static int spi_resume(struct device *dev) | |||
105 | int value; | 105 | int value; |
106 | struct spi_driver *drv = to_spi_driver(dev->driver); | 106 | struct spi_driver *drv = to_spi_driver(dev->driver); |
107 | 107 | ||
108 | if (!drv->resume) | 108 | if (!drv || !drv->resume) |
109 | return 0; | 109 | return 0; |
110 | 110 | ||
111 | /* resume may restart the i/o queue */ | 111 | /* resume may restart the i/o queue */ |
@@ -449,7 +449,6 @@ void spi_unregister_master(struct spi_master *master) | |||
449 | { | 449 | { |
450 | (void) device_for_each_child(master->cdev.dev, NULL, __unregister); | 450 | (void) device_for_each_child(master->cdev.dev, NULL, __unregister); |
451 | class_device_unregister(&master->cdev); | 451 | class_device_unregister(&master->cdev); |
452 | master->cdev.dev = NULL; | ||
453 | } | 452 | } |
454 | EXPORT_SYMBOL_GPL(spi_unregister_master); | 453 | EXPORT_SYMBOL_GPL(spi_unregister_master); |
455 | 454 | ||
diff --git a/drivers/video/aty/radeon_pm.c b/drivers/video/aty/radeon_pm.c index 556895e99645..1f8d805c61e5 100644 --- a/drivers/video/aty/radeon_pm.c +++ b/drivers/video/aty/radeon_pm.c | |||
@@ -1321,8 +1321,6 @@ static void radeon_pm_full_reset_sdram(struct radeonfb_info *rinfo) | |||
1321 | mdelay( 15); | 1321 | mdelay( 15); |
1322 | } | 1322 | } |
1323 | 1323 | ||
1324 | #ifdef CONFIG_PPC_OF | ||
1325 | |||
1326 | static void radeon_pm_reset_pad_ctlr_strength(struct radeonfb_info *rinfo) | 1324 | static void radeon_pm_reset_pad_ctlr_strength(struct radeonfb_info *rinfo) |
1327 | { | 1325 | { |
1328 | u32 tmp, tmp2; | 1326 | u32 tmp, tmp2; |
@@ -1836,6 +1834,8 @@ static void radeon_reinitialize_M10(struct radeonfb_info *rinfo) | |||
1836 | radeon_pm_m10_enable_lvds_spread_spectrum(rinfo); | 1834 | radeon_pm_m10_enable_lvds_spread_spectrum(rinfo); |
1837 | } | 1835 | } |
1838 | 1836 | ||
1837 | #ifdef CONFIG_PPC_OF | ||
1838 | |||
1839 | static void radeon_pm_m9p_reconfigure_mc(struct radeonfb_info *rinfo) | 1839 | static void radeon_pm_m9p_reconfigure_mc(struct radeonfb_info *rinfo) |
1840 | { | 1840 | { |
1841 | OUTREG(MC_CNTL, rinfo->save_regs[46]); | 1841 | OUTREG(MC_CNTL, rinfo->save_regs[46]); |
@@ -2728,13 +2728,23 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) | |||
2728 | printk("radeonfb: Dynamic Clock Power Management disabled\n"); | 2728 | printk("radeonfb: Dynamic Clock Power Management disabled\n"); |
2729 | } | 2729 | } |
2730 | 2730 | ||
2731 | #if defined(CONFIG_PM) | ||
2731 | /* Check if we can power manage on suspend/resume. We can do | 2732 | /* Check if we can power manage on suspend/resume. We can do |
2732 | * D2 on M6, M7 and M9, and we can resume from D3 cold a few other | 2733 | * D2 on M6, M7 and M9, and we can resume from D3 cold a few other |
2733 | * "Mac" cards, but that's all. We need more infos about what the | 2734 | * "Mac" cards, but that's all. We need more infos about what the |
2734 | * BIOS does tho. Right now, all this PM stuff is pmac-only for that | 2735 | * BIOS does tho. Right now, all this PM stuff is pmac-only for that |
2735 | * reason. --BenH | 2736 | * reason. --BenH |
2736 | */ | 2737 | */ |
2737 | #if defined(CONFIG_PM) && defined(CONFIG_PPC_PMAC) | 2738 | /* Special case for Samsung P35 laptops |
2739 | */ | ||
2740 | if ((rinfo->pdev->vendor == PCI_VENDOR_ID_ATI) && | ||
2741 | (rinfo->pdev->device == PCI_CHIP_RV350_NP) && | ||
2742 | (rinfo->pdev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG) && | ||
2743 | (rinfo->pdev->subsystem_device == 0xc00c)) { | ||
2744 | rinfo->reinit_func = radeon_reinitialize_M10; | ||
2745 | rinfo->pm_mode |= radeon_pm_off; | ||
2746 | } | ||
2747 | #if defined(CONFIG_PPC_PMAC) | ||
2738 | if (_machine == _MACH_Pmac && rinfo->of_node) { | 2748 | if (_machine == _MACH_Pmac && rinfo->of_node) { |
2739 | if (rinfo->is_mobility && rinfo->pm_reg && | 2749 | if (rinfo->is_mobility && rinfo->pm_reg && |
2740 | rinfo->family <= CHIP_FAMILY_RV250) | 2750 | rinfo->family <= CHIP_FAMILY_RV250) |
@@ -2778,7 +2788,8 @@ void radeonfb_pm_init(struct radeonfb_info *rinfo, int dynclk) | |||
2778 | OUTREG(TV_DAC_CNTL, INREG(TV_DAC_CNTL) | 0x07000000); | 2788 | OUTREG(TV_DAC_CNTL, INREG(TV_DAC_CNTL) | 0x07000000); |
2779 | #endif | 2789 | #endif |
2780 | } | 2790 | } |
2781 | #endif /* defined(CONFIG_PM) && defined(CONFIG_PPC_PMAC) */ | 2791 | #endif /* defined(CONFIG_PPC_PMAC) */ |
2792 | #endif /* defined(CONFIG_PM) */ | ||
2782 | } | 2793 | } |
2783 | 2794 | ||
2784 | void radeonfb_pm_exit(struct radeonfb_info *rinfo) | 2795 | void radeonfb_pm_exit(struct radeonfb_info *rinfo) |