Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
0214410a
Commit
0214410a
authored
Sep 25, 2003
by
Martin Schwidefsky
Committed by
Linus Torvalds
Sep 25, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] s390: xpram driver.
- Make xpram work on 64 bit machines. - Use new-style module_param.
parent
c530119e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
19 deletions
+26
-19
drivers/s390/block/xpram.c
drivers/s390/block/xpram.c
+26
-19
No files found.
drivers/s390/block/xpram.c
View file @
0214410a
...
...
@@ -26,11 +26,12 @@
*/
#include <linux/module.h>
#include <linux/
version
.h>
#include <linux/
moduleparam
.h>
#include <linux/ctype.h>
/* isdigit, isxdigit */
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/blkdev.h>
#include <linux/blkpg.h>
#include <linux/hdreg.h>
/* HDIO_GETGEO */
#include <linux/sysdev.h>
...
...
@@ -58,23 +59,23 @@ static struct sys_device xpram_sys_device = {
};
typedef
struct
{
unsigned
long
size
;
/* size of xpram segment in pages */
unsigned
long
offset
;
/* start page of xpram segment */
unsigned
int
size
;
/* size of xpram segment in pages */
unsigned
int
offset
;
/* start page of xpram segment */
}
xpram_device_t
;
static
xpram_device_t
xpram_devices
[
XPRAM_MAX_DEVS
];
static
int
xpram_sizes
[
XPRAM_MAX_DEVS
];
static
unsigned
int
xpram_sizes
[
XPRAM_MAX_DEVS
];
static
struct
gendisk
*
xpram_disks
[
XPRAM_MAX_DEVS
];
static
unsigned
long
xpram_pages
;
static
unsigned
int
xpram_pages
;
static
int
xpram_devs
;
/*
* Parameter parsing functions.
*/
static
int
devs
=
XPRAM_DEVS
;
static
unsigned
long
sizes
[
XPRAM_MAX_DEVS
];
static
unsigned
int
sizes
[
XPRAM_MAX_DEVS
];
MODULE_PARM
(
devs
,
"i"
);
module_param
(
devs
,
int
,
0
);
MODULE_PARM
(
sizes
,
"1-"
__MODULE_STRING
(
XPRAM_MAX_DEVS
)
"i"
);
MODULE_PARM_DESC
(
devs
,
"number of devices (
\"
partitions
\"
), "
\
...
...
@@ -149,7 +150,7 @@ __setup("xpram_parts=", xpram_setup);
* -EIO: if pgin failed
* -ENXIO: if xpram has vanished
*/
static
int
xpram_page_in
(
unsigned
long
page_addr
,
unsigned
long
xpage_index
)
static
int
xpram_page_in
(
unsigned
long
page_addr
,
unsigned
int
xpage_index
)
{
int
cc
;
...
...
@@ -180,7 +181,7 @@ static int xpram_page_in (unsigned long page_addr, unsigned long xpage_index)
return
-
ENXIO
;
}
if
(
cc
==
1
)
{
PRINT_ERR
(
"page in failed for page index %
ld
.
\n
"
,
PRINT_ERR
(
"page in failed for page index %
u
.
\n
"
,
xpage_index
);
return
-
EIO
;
}
...
...
@@ -197,7 +198,7 @@ static int xpram_page_in (unsigned long page_addr, unsigned long xpage_index)
* -EIO: if pgout failed
* -ENXIO: if xpram has vanished
*/
static
long
xpram_page_out
(
unsigned
long
page_addr
,
unsigned
long
xpage_index
)
static
long
xpram_page_out
(
unsigned
long
page_addr
,
unsigned
int
xpage_index
)
{
int
cc
;
...
...
@@ -228,7 +229,7 @@ static long xpram_page_out (unsigned long page_addr, unsigned long xpage_index)
return
-
ENXIO
;
}
if
(
cc
==
1
)
{
PRINT_ERR
(
"page out failed for page index %
ld
.
\n
"
,
PRINT_ERR
(
"page out failed for page index %
u
.
\n
"
,
xpage_index
);
return
-
EIO
;
}
...
...
@@ -244,6 +245,8 @@ static int __init xpram_present(void)
int
rc
;
mem_page
=
(
unsigned
long
)
__get_free_page
(
GFP_KERNEL
);
if
(
!
mem_page
)
return
-
ENOMEM
;
rc
=
xpram_page_in
(
mem_page
,
0
);
free_page
(
mem_page
);
return
rc
?
-
ENXIO
:
0
;
...
...
@@ -254,13 +257,15 @@ static int __init xpram_present(void)
*/
static
unsigned
long
__init
xpram_highest_page_index
(
void
)
{
unsigned
long
page_index
,
add_bit
;
unsigned
int
page_index
,
add_bit
;
unsigned
long
mem_page
;
mem_page
=
(
unsigned
long
)
__get_free_page
(
GFP_KERNEL
);
if
(
!
mem_page
)
return
0
;
page_index
=
0
;
add_bit
=
1ULL
<<
(
sizeof
(
unsigned
long
)
*
8
-
1
);
add_bit
=
1ULL
<<
(
sizeof
(
unsigned
int
)
*
8
-
1
);
while
(
add_bit
>
0
)
{
if
(
xpram_page_in
(
mem_page
,
page_index
|
add_bit
)
==
0
)
page_index
|=
add_bit
;
...
...
@@ -279,7 +284,7 @@ static int xpram_make_request(request_queue_t *q, struct bio *bio)
{
xpram_device_t
*
xdev
=
bio
->
bi_bdev
->
bd_disk
->
private_data
;
struct
bio_vec
*
bvec
;
unsigned
long
index
;
unsigned
int
index
;
unsigned
long
page_addr
;
unsigned
long
bytes
;
int
i
;
...
...
@@ -290,6 +295,8 @@ static int xpram_make_request(request_queue_t *q, struct bio *bio)
if
((
bio
->
bi_size
>>
12
)
>
xdev
->
size
)
/* Request size is no page-aligned. */
goto
fail
;
if
((
bio
->
bi_sector
>>
3
)
>
0xffffffffU
-
xdev
->
offset
)
goto
fail
;
index
=
(
bio
->
bi_sector
>>
3
)
+
xdev
->
offset
;
bio_for_each_segment
(
bvec
,
bio
,
i
)
{
page_addr
=
(
unsigned
long
)
...
...
@@ -382,13 +389,13 @@ static int __init xpram_setup_sizes(unsigned long pages)
PRINT_INFO
(
" number of devices (partitions): %d
\n
"
,
xpram_devs
);
for
(
i
=
0
;
i
<
xpram_devs
;
i
++
)
{
if
(
xpram_sizes
[
i
])
PRINT_INFO
(
" size of partition %d: %
d
kB
\n
"
,
PRINT_INFO
(
" size of partition %d: %
u
kB
\n
"
,
i
,
xpram_sizes
[
i
]);
else
PRINT_INFO
(
" size of partition %d to be set "
"automatically
\n
"
,
i
);
}
PRINT_DEBUG
(
" memory needed (for sized partitions): %l
d
kB
\n
"
,
PRINT_DEBUG
(
" memory needed (for sized partitions): %l
u
kB
\n
"
,
mem_needed
);
PRINT_DEBUG
(
" partitions to be sized automatically: %d
\n
"
,
mem_auto_no
);
...
...
@@ -407,7 +414,7 @@ static int __init xpram_setup_sizes(unsigned long pages)
if
(
mem_auto_no
)
{
mem_auto
=
((
pages
-
mem_needed
/
4
)
/
mem_auto_no
)
*
4
;
PRINT_INFO
(
" automatically determined "
"partition size: %l
d
kB
\n
"
,
mem_auto
);
"partition size: %l
u
kB
\n
"
,
mem_auto
);
for
(
i
=
0
;
i
<
xpram_devs
;
i
++
)
if
(
xpram_sizes
[
i
]
==
0
)
xpram_sizes
[
i
]
=
mem_auto
;
...
...
@@ -499,8 +506,8 @@ static int __init xpram_init(void)
return
-
ENODEV
;
}
xpram_pages
=
xpram_highest_page_index
();
PRINT_INFO
(
" %
li pages expanded memory found (%li
KB).
\n
"
,
xpram_pages
,
xpram_pages
*
4
);
PRINT_INFO
(
" %
u pages expanded memory found (%lu
KB).
\n
"
,
xpram_pages
,
(
unsigned
long
)
xpram_pages
*
4
);
rc
=
xpram_setup_sizes
(
xpram_pages
);
if
(
rc
)
return
rc
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment