diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-06-29 08:57:39 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2006-06-29 08:57:39 -0400 |
commit | 132fab13635a56a8151641671a2f896be00fd215 (patch) | |
tree | 678424bd1698fd9fd90225c85fee01a68d997284 /drivers | |
parent | 06fa46a2fcb7e13386707a3eac74f11140a9f818 (diff) |
[S390] modular 3270 driver.
The initial i/o to a 3270 device is done using the static module variables
raw3270_init_data and raw3270_init_request. If the 3270 device driver is
built as a module and gets loaded above 2GB, the initial i/o will fail
because these variables will get addresses > 2GB. To make it work the
two variables are moved to struct raw3270 and the data structure is
allocated with GFP_DMA.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/s390/char/raw3270.c | 67 |
1 files changed, 34 insertions, 33 deletions
diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index eecb2afad5c2..3c1314b7391b 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c | |||
@@ -50,6 +50,9 @@ struct raw3270 { | |||
50 | unsigned char *ascebc; /* ascii -> ebcdic table */ | 50 | unsigned char *ascebc; /* ascii -> ebcdic table */ |
51 | struct class_device *clttydev; /* 3270-class tty device ptr */ | 51 | struct class_device *clttydev; /* 3270-class tty device ptr */ |
52 | struct class_device *cltubdev; /* 3270-class tub device ptr */ | 52 | struct class_device *cltubdev; /* 3270-class tub device ptr */ |
53 | |||
54 | struct raw3270_request init_request; | ||
55 | unsigned char init_data[256]; | ||
53 | }; | 56 | }; |
54 | 57 | ||
55 | /* raw3270->flags */ | 58 | /* raw3270->flags */ |
@@ -484,8 +487,6 @@ struct raw3270_ua { /* Query Reply structure for Usable Area */ | |||
484 | } __attribute__ ((packed)) aua; | 487 | } __attribute__ ((packed)) aua; |
485 | } __attribute__ ((packed)); | 488 | } __attribute__ ((packed)); |
486 | 489 | ||
487 | static unsigned char raw3270_init_data[256]; | ||
488 | static struct raw3270_request raw3270_init_request; | ||
489 | static struct diag210 raw3270_init_diag210; | 490 | static struct diag210 raw3270_init_diag210; |
490 | static DECLARE_MUTEX(raw3270_init_sem); | 491 | static DECLARE_MUTEX(raw3270_init_sem); |
491 | 492 | ||
@@ -644,17 +645,17 @@ __raw3270_size_device(struct raw3270 *rp) | |||
644 | * required (3270 device switched to 'stand-by') and command | 645 | * required (3270 device switched to 'stand-by') and command |
645 | * rejects (old devices that can't do 'read partition'). | 646 | * rejects (old devices that can't do 'read partition'). |
646 | */ | 647 | */ |
647 | memset(&raw3270_init_request, 0, sizeof(raw3270_init_request)); | 648 | memset(&rp->init_request, 0, sizeof(rp->init_request)); |
648 | memset(raw3270_init_data, 0, sizeof(raw3270_init_data)); | 649 | memset(&rp->init_data, 0, 256); |
649 | /* Store 'read partition' data stream to raw3270_init_data */ | 650 | /* Store 'read partition' data stream to init_data */ |
650 | memcpy(raw3270_init_data, wbuf, sizeof(wbuf)); | 651 | memcpy(&rp->init_data, wbuf, sizeof(wbuf)); |
651 | INIT_LIST_HEAD(&raw3270_init_request.list); | 652 | INIT_LIST_HEAD(&rp->init_request.list); |
652 | raw3270_init_request.ccw.cmd_code = TC_WRITESF; | 653 | rp->init_request.ccw.cmd_code = TC_WRITESF; |
653 | raw3270_init_request.ccw.flags = CCW_FLAG_SLI; | 654 | rp->init_request.ccw.flags = CCW_FLAG_SLI; |
654 | raw3270_init_request.ccw.count = sizeof(wbuf); | 655 | rp->init_request.ccw.count = sizeof(wbuf); |
655 | raw3270_init_request.ccw.cda = (__u32) __pa(raw3270_init_data); | 656 | rp->init_request.ccw.cda = (__u32) __pa(&rp->init_data); |
656 | 657 | ||
657 | rc = raw3270_start_init(rp, &raw3270_init_view, &raw3270_init_request); | 658 | rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); |
658 | if (rc) | 659 | if (rc) |
659 | /* Check error cases: -ERESTARTSYS, -EIO and -EOPNOTSUPP */ | 660 | /* Check error cases: -ERESTARTSYS, -EIO and -EOPNOTSUPP */ |
660 | return rc; | 661 | return rc; |
@@ -679,18 +680,18 @@ __raw3270_size_device(struct raw3270 *rp) | |||
679 | * The device accepted the 'read partition' command. Now | 680 | * The device accepted the 'read partition' command. Now |
680 | * set up a read ccw and issue it. | 681 | * set up a read ccw and issue it. |
681 | */ | 682 | */ |
682 | raw3270_init_request.ccw.cmd_code = TC_READMOD; | 683 | rp->init_request.ccw.cmd_code = TC_READMOD; |
683 | raw3270_init_request.ccw.flags = CCW_FLAG_SLI; | 684 | rp->init_request.ccw.flags = CCW_FLAG_SLI; |
684 | raw3270_init_request.ccw.count = sizeof(raw3270_init_data); | 685 | rp->init_request.ccw.count = sizeof(rp->init_data); |
685 | raw3270_init_request.ccw.cda = (__u32) __pa(raw3270_init_data); | 686 | rp->init_request.ccw.cda = (__u32) __pa(rp->init_data); |
686 | rc = raw3270_start_init(rp, &raw3270_init_view, &raw3270_init_request); | 687 | rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); |
687 | if (rc) | 688 | if (rc) |
688 | return rc; | 689 | return rc; |
689 | /* Got a Query Reply */ | 690 | /* Got a Query Reply */ |
690 | count = sizeof(raw3270_init_data) - raw3270_init_request.rescnt; | 691 | count = sizeof(rp->init_data) - rp->init_request.rescnt; |
691 | uap = (struct raw3270_ua *) (raw3270_init_data + 1); | 692 | uap = (struct raw3270_ua *) (rp->init_data + 1); |
692 | /* Paranoia check. */ | 693 | /* Paranoia check. */ |
693 | if (raw3270_init_data[0] != 0x88 || uap->uab.qcode != 0x81) | 694 | if (rp->init_data[0] != 0x88 || uap->uab.qcode != 0x81) |
694 | return -EOPNOTSUPP; | 695 | return -EOPNOTSUPP; |
695 | /* Copy rows/columns of default Usable Area */ | 696 | /* Copy rows/columns of default Usable Area */ |
696 | rp->rows = uap->uab.h; | 697 | rp->rows = uap->uab.h; |
@@ -749,18 +750,18 @@ raw3270_reset_device(struct raw3270 *rp) | |||
749 | int rc; | 750 | int rc; |
750 | 751 | ||
751 | down(&raw3270_init_sem); | 752 | down(&raw3270_init_sem); |
752 | memset(&raw3270_init_request, 0, sizeof(raw3270_init_request)); | 753 | memset(&rp->init_request, 0, sizeof(rp->init_request)); |
753 | memset(raw3270_init_data, 0, sizeof(raw3270_init_data)); | 754 | memset(&rp->init_data, 0, sizeof(rp->init_data)); |
754 | /* Store reset data stream to raw3270_init_data/raw3270_init_request */ | 755 | /* Store reset data stream to init_data/init_request */ |
755 | raw3270_init_data[0] = TW_KR; | 756 | rp->init_data[0] = TW_KR; |
756 | INIT_LIST_HEAD(&raw3270_init_request.list); | 757 | INIT_LIST_HEAD(&rp->init_request.list); |
757 | raw3270_init_request.ccw.cmd_code = TC_EWRITEA; | 758 | rp->init_request.ccw.cmd_code = TC_EWRITEA; |
758 | raw3270_init_request.ccw.flags = CCW_FLAG_SLI; | 759 | rp->init_request.ccw.flags = CCW_FLAG_SLI; |
759 | raw3270_init_request.ccw.count = 1; | 760 | rp->init_request.ccw.count = 1; |
760 | raw3270_init_request.ccw.cda = (__u32) __pa(raw3270_init_data); | 761 | rp->init_request.ccw.cda = (__u32) __pa(rp->init_data); |
761 | rp->view = &raw3270_init_view; | 762 | rp->view = &raw3270_init_view; |
762 | raw3270_init_view.dev = rp; | 763 | raw3270_init_view.dev = rp; |
763 | rc = raw3270_start_init(rp, &raw3270_init_view, &raw3270_init_request); | 764 | rc = raw3270_start_init(rp, &raw3270_init_view, &rp->init_request); |
764 | raw3270_init_view.dev = 0; | 765 | raw3270_init_view.dev = 0; |
765 | rp->view = 0; | 766 | rp->view = 0; |
766 | up(&raw3270_init_sem); | 767 | up(&raw3270_init_sem); |
@@ -854,7 +855,7 @@ raw3270_setup_console(struct ccw_device *cdev) | |||
854 | char *ascebc; | 855 | char *ascebc; |
855 | int rc; | 856 | int rc; |
856 | 857 | ||
857 | rp = (struct raw3270 *) alloc_bootmem(sizeof(struct raw3270)); | 858 | rp = (struct raw3270 *) alloc_bootmem_low(sizeof(struct raw3270)); |
858 | ascebc = (char *) alloc_bootmem(256); | 859 | ascebc = (char *) alloc_bootmem(256); |
859 | rc = raw3270_setup_device(cdev, rp, ascebc); | 860 | rc = raw3270_setup_device(cdev, rp, ascebc); |
860 | if (rc) | 861 | if (rc) |
@@ -895,7 +896,7 @@ raw3270_create_device(struct ccw_device *cdev) | |||
895 | char *ascebc; | 896 | char *ascebc; |
896 | int rc; | 897 | int rc; |
897 | 898 | ||
898 | rp = kmalloc(sizeof(struct raw3270), GFP_KERNEL); | 899 | rp = kmalloc(sizeof(struct raw3270), GFP_KERNEL | GFP_DMA); |
899 | if (!rp) | 900 | if (!rp) |
900 | return ERR_PTR(-ENOMEM); | 901 | return ERR_PTR(-ENOMEM); |
901 | ascebc = kmalloc(256, GFP_KERNEL); | 902 | ascebc = kmalloc(256, GFP_KERNEL); |