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
nexedi
linux
Commits
e004aaa1
Commit
e004aaa1
authored
Mar 14, 2004
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://bk.arm.linux.org.uk/linux-2.6-pcmcia
into ppc970.osdl.org:/home/torvalds/v2.5/linux
parents
92c06c66
b528e0d6
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
502 additions
and
449 deletions
+502
-449
drivers/pcmcia/Kconfig
drivers/pcmcia/Kconfig
+19
-0
drivers/pcmcia/Makefile
drivers/pcmcia/Makefile
+4
-0
drivers/pcmcia/au1000_generic.c
drivers/pcmcia/au1000_generic.c
+20
-10
drivers/pcmcia/au1000_pb1x00.c
drivers/pcmcia/au1000_pb1x00.c
+4
-2
drivers/pcmcia/bulkmem.c
drivers/pcmcia/bulkmem.c
+28
-28
drivers/pcmcia/cardbus.c
drivers/pcmcia/cardbus.c
+2
-6
drivers/pcmcia/cistpl.c
drivers/pcmcia/cistpl.c
+4
-5
drivers/pcmcia/cs.c
drivers/pcmcia/cs.c
+55
-265
drivers/pcmcia/cs_internal.h
drivers/pcmcia/cs_internal.h
+15
-5
drivers/pcmcia/ds.c
drivers/pcmcia/ds.c
+256
-40
drivers/pcmcia/i82365.c
drivers/pcmcia/i82365.c
+24
-17
drivers/pcmcia/sa11xx_core.c
drivers/pcmcia/sa11xx_core.c
+32
-37
drivers/pcmcia/tcic.c
drivers/pcmcia/tcic.c
+21
-14
drivers/pcmcia/yenta_socket.c
drivers/pcmcia/yenta_socket.c
+14
-14
include/pcmcia/cs.h
include/pcmcia/cs.h
+4
-6
No files found.
drivers/pcmcia/Kconfig
View file @
e004aaa1
...
@@ -26,6 +26,25 @@ config PCMCIA
...
@@ -26,6 +26,25 @@ config PCMCIA
To compile this driver as modules, choose M here: the
To compile this driver as modules, choose M here: the
modules will be called pcmcia_core and ds.
modules will be called pcmcia_core and ds.
config PCMCIA_DEBUG
bool "Enable PCMCIA debugging"
depends on PCMCIA != n
help
Say Y here to enable PCMCIA subsystem debugging. You
will need to choose the debugging level either via the
kernel command line, or module options depending whether
you build the PCMCIA as modules.
The kernel command line options are:
pcmcia_core.pc_debug=N
ds.pc_debug=N
sa11xx_core.pc_debug=N
The module option is called pc_debug=N
In all the above examples, N is the debugging verbosity
level.
config YENTA
config YENTA
tristate "CardBus yenta-compatible bridge support"
tristate "CardBus yenta-compatible bridge support"
depends on PCMCIA && PCI
depends on PCMCIA && PCI
...
...
drivers/pcmcia/Makefile
View file @
e004aaa1
...
@@ -2,6 +2,10 @@
...
@@ -2,6 +2,10 @@
# Makefile for the kernel pcmcia subsystem (c/o David Hinds)
# Makefile for the kernel pcmcia subsystem (c/o David Hinds)
#
#
ifeq
($(CONFIG_PCMCIA_DEBUG),y)
EXTRA_CFLAGS
+=
-DDEBUG
endif
obj-$(CONFIG_PCMCIA)
+=
pcmcia_core.o ds.o
obj-$(CONFIG_PCMCIA)
+=
pcmcia_core.o ds.o
obj-$(CONFIG_YENTA)
+=
yenta_socket.o
obj-$(CONFIG_YENTA)
+=
yenta_socket.o
...
...
drivers/pcmcia/au1000_generic.c
View file @
e004aaa1
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
*
*
*/
*/
#include <linux/module.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/config.h>
#include <linux/config.h>
#include <linux/delay.h>
#include <linux/delay.h>
...
@@ -54,8 +55,17 @@
...
@@ -54,8 +55,17 @@
#include <asm/au1000.h>
#include <asm/au1000.h>
#include <asm/au1000_pcmcia.h>
#include <asm/au1000_pcmcia.h>
#ifdef
PCMCIA_
DEBUG
#ifdef DEBUG
static
int
pc_debug
;
static
int
pc_debug
;
module_param
(
pc_debug
,
int
,
0644
);
#define debug(lvl,fmt) do { \
if (pc_debug > (lvl)) \
printk(KERN_DEBUG fmt); \
} while (0)
#else
#define debug(lvl,fmt) do { } while (0)
#endif
#endif
MODULE_LICENSE
(
"GPL"
);
MODULE_LICENSE
(
"GPL"
);
...
@@ -209,7 +219,7 @@ static int __init au1000_pcmcia_driver_init(void)
...
@@ -209,7 +219,7 @@ static int __init au1000_pcmcia_driver_init(void)
*/
*/
au1000_pcmcia_poll_event
(
0
);
au1000_pcmcia_poll_event
(
0
);
DEBUG
(
1
,
"au1000: initialization complete
\n
"
);
debug
(
1
,
"au1000: initialization complete
\n
"
);
return
0
;
return
0
;
}
/* au1000_pcmcia_driver_init() */
}
/* au1000_pcmcia_driver_init() */
...
@@ -228,7 +238,7 @@ static void __exit au1000_pcmcia_driver_shutdown(void)
...
@@ -228,7 +238,7 @@ static void __exit au1000_pcmcia_driver_shutdown(void)
if
(
pcmcia_socket
[
i
].
virt_io
)
if
(
pcmcia_socket
[
i
].
virt_io
)
iounmap
((
void
*
)
pcmcia_socket
[
i
].
virt_io
);
iounmap
((
void
*
)
pcmcia_socket
[
i
].
virt_io
);
}
}
DEBUG
(
1
,
"au1000: shutdown complete
\n
"
);
debug
(
1
,
"au1000: shutdown complete
\n
"
);
}
}
module_exit
(
au1000_pcmcia_driver_shutdown
);
module_exit
(
au1000_pcmcia_driver_shutdown
);
...
@@ -249,14 +259,14 @@ au1000_pcmcia_events(struct pcmcia_state *state,
...
@@ -249,14 +259,14 @@ au1000_pcmcia_events(struct pcmcia_state *state,
unsigned
int
events
=
0
;
unsigned
int
events
=
0
;
if
(
state
->
detect
!=
prev_state
->
detect
){
if
(
state
->
detect
!=
prev_state
->
detect
){
DEBUG
(
2
,
"%s(): card detect value %u
\n
"
,
debug
(
2
,
"%s(): card detect value %u
\n
"
,
__FUNCTION__
,
state
->
detect
);
__FUNCTION__
,
state
->
detect
);
events
|=
mask
&
SS_DETECT
;
events
|=
mask
&
SS_DETECT
;
}
}
if
(
state
->
ready
!=
prev_state
->
ready
){
if
(
state
->
ready
!=
prev_state
->
ready
){
DEBUG
(
2
,
"%s(): card ready value %u
\n
"
,
debug
(
2
,
"%s(): card ready value %u
\n
"
,
__FUNCTION__
,
state
->
ready
);
__FUNCTION__
,
state
->
ready
);
events
|=
mask
&
((
flags
&
SS_IOCARD
)
?
0
:
SS_READY
);
events
|=
mask
&
((
flags
&
SS_IOCARD
)
?
0
:
SS_READY
);
}
}
...
@@ -429,7 +439,7 @@ au1000_pcmcia_get_status(unsigned int sock, unsigned int *status)
...
@@ -429,7 +439,7 @@ au1000_pcmcia_get_status(unsigned int sock, unsigned int *status)
*
status
|=
state
.
vs_Xv
?
SS_XVCARD
:
0
;
*
status
|=
state
.
vs_Xv
?
SS_XVCARD
:
0
;
DEBUG
(
2
,
"
\t
status: %s%s%s%s%s%s%s%s
\n
"
,
debug
(
2
,
"
\t
status: %s%s%s%s%s%s%s%s
\n
"
,
(
*
status
&
SS_DETECT
)
?
"DETECT "
:
""
,
(
*
status
&
SS_DETECT
)
?
"DETECT "
:
""
,
(
*
status
&
SS_READY
)
?
"READY "
:
""
,
(
*
status
&
SS_READY
)
?
"READY "
:
""
,
(
*
status
&
SS_BATDEAD
)
?
"BATDEAD "
:
""
,
(
*
status
&
SS_BATDEAD
)
?
"BATDEAD "
:
""
,
...
@@ -457,7 +467,7 @@ au1000_pcmcia_set_socket(unsigned int sock, socket_state_t *state)
...
@@ -457,7 +467,7 @@ au1000_pcmcia_set_socket(unsigned int sock, socket_state_t *state)
{
{
struct
pcmcia_configure
configure
;
struct
pcmcia_configure
configure
;
DEBUG
(
2
,
"
\t
mask: %s%s%s%s%s%s
\n\t
flags: %s%s%s%s%s%s
\n
"
debug
(
2
,
"
\t
mask: %s%s%s%s%s%s
\n\t
flags: %s%s%s%s%s%s
\n
"
"
\t
Vcc %d Vpp %d irq %d
\n
"
,
"
\t
Vcc %d Vpp %d irq %d
\n
"
,
(
state
->
csc_mask
==
0
)
?
"<NONE>"
:
""
,
(
state
->
csc_mask
==
0
)
?
"<NONE>"
:
""
,
(
state
->
csc_mask
&
SS_DETECT
)
?
"DETECT "
:
""
,
(
state
->
csc_mask
&
SS_DETECT
)
?
"DETECT "
:
""
,
...
@@ -494,7 +504,7 @@ au1000_pcmcia_set_socket(unsigned int sock, socket_state_t *state)
...
@@ -494,7 +504,7 @@ au1000_pcmcia_set_socket(unsigned int sock, socket_state_t *state)
static
int
static
int
au1000_pcmcia_get_io_map
(
unsigned
int
sock
,
struct
pccard_io_map
*
map
)
au1000_pcmcia_get_io_map
(
unsigned
int
sock
,
struct
pccard_io_map
*
map
)
{
{
DEBUG
(
1
,
"au1000_pcmcia_get_io_map: sock %d
\n
"
,
sock
);
debug
(
1
,
"au1000_pcmcia_get_io_map: sock %d
\n
"
,
sock
);
if
(
map
->
map
>=
MAX_IO_WIN
){
if
(
map
->
map
>=
MAX_IO_WIN
){
printk
(
KERN_ERR
"%s(): map (%d) out of range
\n
"
,
printk
(
KERN_ERR
"%s(): map (%d) out of range
\n
"
,
__FUNCTION__
,
map
->
map
);
__FUNCTION__
,
map
->
map
);
...
@@ -531,7 +541,7 @@ au1000_pcmcia_set_io_map(unsigned int sock, struct pccard_io_map *map)
...
@@ -531,7 +541,7 @@ au1000_pcmcia_set_io_map(unsigned int sock, struct pccard_io_map *map)
map
->
start
=
pcmcia_socket
[
sock
].
virt_io
;
map
->
start
=
pcmcia_socket
[
sock
].
virt_io
;
map
->
stop
=
map
->
start
+
(
map
->
stop
-
start
);
map
->
stop
=
map
->
start
+
(
map
->
stop
-
start
);
pcmcia_socket
[
sock
].
io_map
[
map
->
map
]
=*
map
;
pcmcia_socket
[
sock
].
io_map
[
map
->
map
]
=*
map
;
DEBUG
(
3
,
"set_io_map %d start %x stop %x
\n
"
,
debug
(
3
,
"set_io_map %d start %x stop %x
\n
"
,
map
->
map
,
map
->
start
,
map
->
stop
);
map
->
map
,
map
->
start
,
map
->
stop
);
return
0
;
return
0
;
...
@@ -595,7 +605,7 @@ au1000_pcmcia_set_mem_map(unsigned int sock, struct pccard_mem_map *map)
...
@@ -595,7 +605,7 @@ au1000_pcmcia_set_mem_map(unsigned int sock, struct pccard_mem_map *map)
map
->
sys_stop
=
map
->
sys_start
+
(
map
->
sys_stop
-
start
);
map
->
sys_stop
=
map
->
sys_start
+
(
map
->
sys_stop
-
start
);
pcmcia_socket
[
sock
].
mem_map
[
map
->
map
]
=*
map
;
pcmcia_socket
[
sock
].
mem_map
[
map
->
map
]
=*
map
;
spin_unlock_irqrestore
(
&
pcmcia_lock
,
flags
);
spin_unlock_irqrestore
(
&
pcmcia_lock
,
flags
);
DEBUG
(
3
,
"set_mem_map %d start %x stop %x card_start %x
\n
"
,
debug
(
3
,
"set_mem_map %d start %x stop %x card_start %x
\n
"
,
map
->
map
,
map
->
sys_start
,
map
->
sys_stop
,
map
->
map
,
map
->
sys_start
,
map
->
sys_stop
,
map
->
card_start
);
map
->
card_start
);
return
0
;
return
0
;
...
...
drivers/pcmcia/au1000_pb1x00.c
View file @
e004aaa1
...
@@ -48,6 +48,8 @@
...
@@ -48,6 +48,8 @@
#include <asm/au1000.h>
#include <asm/au1000.h>
#include <asm/au1000_pcmcia.h>
#include <asm/au1000_pcmcia.h>
#define debug(fmt, arg...) do { } while (0)
#ifdef CONFIG_MIPS_PB1000
#ifdef CONFIG_MIPS_PB1000
#include <asm/pb1000.h>
#include <asm/pb1000.h>
#define PCMCIA_IRQ AU1000_GPIO_15
#define PCMCIA_IRQ AU1000_GPIO_15
...
@@ -213,7 +215,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure)
...
@@ -213,7 +215,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure)
}
}
pcr
&=
~
PCR_SLOT_0_RST
;
pcr
&=
~
PCR_SLOT_0_RST
;
DEBUG
(
KERN_INFO
"Vcc %dV Vpp %dV, pcr %x
\n
"
,
debug
(
"Vcc %dV Vpp %dV, pcr %x
\n
"
,
configure
->
vcc
,
configure
->
vpp
,
pcr
);
configure
->
vcc
,
configure
->
vpp
,
pcr
);
switch
(
configure
->
vcc
){
switch
(
configure
->
vcc
){
case
0
:
/* Vcc 0 */
case
0
:
/* Vcc 0 */
...
@@ -324,7 +326,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure)
...
@@ -324,7 +326,7 @@ pb1x00_pcmcia_configure_socket(const struct pcmcia_configure *configure)
pcr
=
au_readw
(
PB1100_MEM_PCMCIA
)
&
~
0xf
;
pcr
=
au_readw
(
PB1100_MEM_PCMCIA
)
&
~
0xf
;
DEBUG
(
KERN_INFO
"Vcc %dV Vpp %dV, pcr %x, reset %d
\n
"
,
debug
(
"Vcc %dV Vpp %dV, pcr %x, reset %d
\n
"
,
configure
->
vcc
,
configure
->
vpp
,
pcr
,
configure
->
reset
);
configure
->
vcc
,
configure
->
vpp
,
pcr
,
configure
->
reset
);
...
...
drivers/pcmcia/bulkmem.c
View file @
e004aaa1
...
@@ -48,6 +48,8 @@
...
@@ -48,6 +48,8 @@
#include <pcmcia/cistpl.h>
#include <pcmcia/cistpl.h>
#include "cs_internal.h"
#include "cs_internal.h"
static
void
retry_erase_list
(
erase_busy_t
*
list
,
u_int
cause
);
/*======================================================================
/*======================================================================
This function handles submitting an MTD request, and retrying
This function handles submitting an MTD request, and retrying
...
@@ -108,18 +110,18 @@ static int do_mtd_request(memory_handle_t handle, mtd_request_t *req,
...
@@ -108,18 +110,18 @@ static int do_mtd_request(memory_handle_t handle, mtd_request_t *req,
======================================================================*/
======================================================================*/
static
void
insert_queue
(
erase_busy_t
*
head
,
erase_busy_t
*
entry
)
static
void
insert_queue
(
struct
pcmcia_socket
*
s
,
erase_busy_t
*
head
,
erase_busy_t
*
entry
)
{
{
DEBUG
(
2
,
"cs:
adding 0x%p to queue 0x%p
\n
"
,
entry
,
head
);
cs_dbg
(
s
,
2
,
"
adding 0x%p to queue 0x%p
\n
"
,
entry
,
head
);
entry
->
next
=
head
;
entry
->
next
=
head
;
entry
->
prev
=
head
->
prev
;
entry
->
prev
=
head
->
prev
;
head
->
prev
->
next
=
entry
;
head
->
prev
->
next
=
entry
;
head
->
prev
=
entry
;
head
->
prev
=
entry
;
}
}
static
void
remove_queue
(
erase_busy_t
*
entry
)
static
void
remove_queue
(
struct
pcmcia_socket
*
s
,
erase_busy_t
*
entry
)
{
{
DEBUG
(
2
,
"cs:
unqueueing 0x%p
\n
"
,
entry
);
cs_dbg
(
s
,
2
,
"
unqueueing 0x%p
\n
"
,
entry
);
entry
->
next
->
prev
=
entry
->
prev
;
entry
->
next
->
prev
=
entry
->
prev
;
entry
->
prev
->
next
=
entry
->
next
;
entry
->
prev
->
next
=
entry
->
next
;
}
}
...
@@ -132,34 +134,35 @@ static void retry_erase(erase_busy_t *busy, u_int cause)
...
@@ -132,34 +134,35 @@ static void retry_erase(erase_busy_t *busy, u_int cause)
struct
pcmcia_socket
*
s
;
struct
pcmcia_socket
*
s
;
int
ret
;
int
ret
;
DEBUG
(
2
,
"cs: trying erase request 0x%p...
\n
"
,
busy
);
mtd
=
erase
->
Handle
->
mtd
;
s
=
SOCKET
(
mtd
);
cs_dbg
(
s
,
2
,
"trying erase request 0x%p...
\n
"
,
busy
);
if
(
busy
->
next
)
if
(
busy
->
next
)
remove_queue
(
busy
);
remove_queue
(
s
,
busy
);
req
.
Function
=
MTD_REQ_ERASE
|
cause
;
req
.
Function
=
MTD_REQ_ERASE
|
cause
;
req
.
TransferLength
=
erase
->
Size
;
req
.
TransferLength
=
erase
->
Size
;
req
.
DestCardOffset
=
erase
->
Offset
+
erase
->
Handle
->
info
.
CardOffset
;
req
.
DestCardOffset
=
erase
->
Offset
+
erase
->
Handle
->
info
.
CardOffset
;
req
.
MediaID
=
erase
->
Handle
->
MediaID
;
req
.
MediaID
=
erase
->
Handle
->
MediaID
;
mtd
=
erase
->
Handle
->
mtd
;
s
=
SOCKET
(
mtd
);
mtd
->
event_callback_args
.
mtdrequest
=
&
req
;
mtd
->
event_callback_args
.
mtdrequest
=
&
req
;
ret
=
EVENT
(
mtd
,
CS_EVENT_MTD_REQUEST
,
CS_EVENT_PRI_LOW
);
ret
=
EVENT
(
mtd
,
CS_EVENT_MTD_REQUEST
,
CS_EVENT_PRI_LOW
);
if
(
ret
==
CS_BUSY
)
{
if
(
ret
==
CS_BUSY
)
{
DEBUG
(
2
,
" Status = %d, requeueing.
\n
"
,
req
.
Status
);
cs_dbg
(
s
,
2
,
" Status = %d, requeueing.
\n
"
,
req
.
Status
);
switch
(
req
.
Status
)
{
switch
(
req
.
Status
)
{
case
MTD_WAITREQ
:
case
MTD_WAITREQ
:
case
MTD_WAITPOWER
:
case
MTD_WAITPOWER
:
insert_queue
(
&
mtd
->
erase_busy
,
busy
);
insert_queue
(
s
,
&
mtd
->
erase_busy
,
busy
);
break
;
break
;
case
MTD_WAITTIMER
:
case
MTD_WAITTIMER
:
case
MTD_WAITRDY
:
case
MTD_WAITRDY
:
if
(
req
.
Status
==
MTD_WAITRDY
)
if
(
req
.
Status
==
MTD_WAITRDY
)
insert_queue
(
&
s
->
erase_busy
,
busy
);
insert_queue
(
s
,
&
s
->
erase_busy
,
busy
);
mod_timer
(
&
busy
->
timeout
,
jiffies
+
req
.
Timeout
*
HZ
/
1000
);
mod_timer
(
&
busy
->
timeout
,
jiffies
+
req
.
Timeout
*
HZ
/
1000
);
break
;
break
;
}
}
}
else
{
}
else
{
/* update erase queue status */
/* update erase queue status */
DEBUG
(
2
,
" Ret = %d
\n
"
,
ret
);
cs_dbg
(
s
,
2
,
" Ret = %d
\n
"
,
ret
);
switch
(
ret
)
{
switch
(
ret
)
{
case
CS_SUCCESS
:
case
CS_SUCCESS
:
erase
->
State
=
ERASE_PASSED
;
break
;
erase
->
State
=
ERASE_PASSED
;
break
;
...
@@ -183,11 +186,11 @@ static void retry_erase(erase_busy_t *busy, u_int cause)
...
@@ -183,11 +186,11 @@ static void retry_erase(erase_busy_t *busy, u_int cause)
}
}
}
/* retry_erase */
}
/* retry_erase */
void
retry_erase_list
(
erase_busy_t
*
list
,
u_int
cause
)
static
void
retry_erase_list
(
erase_busy_t
*
list
,
u_int
cause
)
{
{
erase_busy_t
tmp
=
*
list
;
erase_busy_t
tmp
=
*
list
;
DEBUG
(
2
,
"cs:
rescanning erase queue list 0x%p
\n
"
,
list
);
cs_dbg
(
SOCKET
(
list
->
client
),
2
,
"
rescanning erase queue list 0x%p
\n
"
,
list
);
if
(
list
->
next
==
list
)
if
(
list
->
next
==
list
)
return
;
return
;
/* First, truncate the original list */
/* First, truncate the original list */
...
@@ -204,8 +207,9 @@ void retry_erase_list(erase_busy_t *list, u_int cause)
...
@@ -204,8 +207,9 @@ void retry_erase_list(erase_busy_t *list, u_int cause)
static
void
handle_erase_timeout
(
u_long
arg
)
static
void
handle_erase_timeout
(
u_long
arg
)
{
{
DEBUG
(
0
,
"cs: erase timeout for entry 0x%lx
\n
"
,
arg
);
erase_busy_t
*
busy
=
(
erase_busy_t
*
)
arg
;
retry_erase
((
erase_busy_t
*
)
arg
,
MTD_REQ_TIMEOUT
);
cs_dbg
(
SOCKET
(
busy
->
client
),
0
,
"erase timeout for entry 0x%lx
\n
"
,
arg
);
retry_erase
(
busy
,
MTD_REQ_TIMEOUT
);
}
}
static
void
setup_erase_request
(
client_handle_t
handle
,
eraseq_entry_t
*
erase
)
static
void
setup_erase_request
(
client_handle_t
handle
,
eraseq_entry_t
*
erase
)
...
@@ -333,7 +337,7 @@ static void setup_regions(client_handle_t handle, int attr,
...
@@ -333,7 +337,7 @@ static void setup_regions(client_handle_t handle, int attr,
cistpl_device_geo_t
geo
;
cistpl_device_geo_t
geo
;
memory_handle_t
r
;
memory_handle_t
r
;
DEBUG
(
1
,
"cs:
setup_regions(0x%p, %d, 0x%p)
\n
"
,
cs_dbg
(
SOCKET
(
handle
),
1
,
"
setup_regions(0x%p, %d, 0x%p)
\n
"
,
handle
,
attr
,
list
);
handle
,
attr
,
list
);
code
=
(
attr
)
?
CISTPL_DEVICE_A
:
CISTPL_DEVICE
;
code
=
(
attr
)
?
CISTPL_DEVICE_A
:
CISTPL_DEVICE
;
...
@@ -342,17 +346,13 @@ static void setup_regions(client_handle_t handle, int attr,
...
@@ -342,17 +346,13 @@ static void setup_regions(client_handle_t handle, int attr,
code
=
(
attr
)
?
CISTPL_JEDEC_A
:
CISTPL_JEDEC_C
;
code
=
(
attr
)
?
CISTPL_JEDEC_A
:
CISTPL_JEDEC_C
;
has_jedec
=
(
read_tuple
(
handle
,
code
,
&
jedec
)
==
CS_SUCCESS
);
has_jedec
=
(
read_tuple
(
handle
,
code
,
&
jedec
)
==
CS_SUCCESS
);
if
(
has_jedec
&&
(
device
.
ndev
!=
jedec
.
nid
))
{
if
(
has_jedec
&&
(
device
.
ndev
!=
jedec
.
nid
))
{
#ifdef PCMCIA_DEBUG
cs_dbg
(
SOCKET
(
handle
),
0
,
"Device info does not match JEDEC info.
\n
"
);
printk
(
KERN_DEBUG
"cs: Device info does not match JEDEC info.
\n
"
);
#endif
has_jedec
=
0
;
has_jedec
=
0
;
}
}
code
=
(
attr
)
?
CISTPL_DEVICE_GEO_A
:
CISTPL_DEVICE_GEO
;
code
=
(
attr
)
?
CISTPL_DEVICE_GEO_A
:
CISTPL_DEVICE_GEO
;
has_geo
=
(
read_tuple
(
handle
,
code
,
&
geo
)
==
CS_SUCCESS
);
has_geo
=
(
read_tuple
(
handle
,
code
,
&
geo
)
==
CS_SUCCESS
);
if
(
has_geo
&&
(
device
.
ndev
!=
geo
.
ngeo
))
{
if
(
has_geo
&&
(
device
.
ndev
!=
geo
.
ngeo
))
{
#ifdef PCMCIA_DEBUG
cs_dbg
(
SOCKET
(
handle
),
0
,
"Device info does not match geometry tuple.
\n
"
);
printk
(
KERN_DEBUG
"cs: Device info does not match geometry tuple.
\n
"
);
#endif
has_geo
=
0
;
has_geo
=
0
;
}
}
...
@@ -458,7 +458,7 @@ int pcmcia_register_mtd(client_handle_t handle, mtd_reg_t *reg)
...
@@ -458,7 +458,7 @@ int pcmcia_register_mtd(client_handle_t handle, mtd_reg_t *reg)
list
=
s
->
a_region
;
list
=
s
->
a_region
;
else
else
list
=
s
->
c_region
;
list
=
s
->
c_region
;
DEBUG
(
1
,
"cs:
register_mtd(0x%p, '%s', 0x%x)
\n
"
,
cs_dbg
(
s
,
1
,
"
register_mtd(0x%p, '%s', 0x%x)
\n
"
,
handle
,
handle
->
dev_info
,
reg
->
Offset
);
handle
,
handle
->
dev_info
,
reg
->
Offset
);
while
(
list
)
{
while
(
list
)
{
if
(
list
->
info
.
CardOffset
==
reg
->
Offset
)
break
;
if
(
list
->
info
.
CardOffset
==
reg
->
Offset
)
break
;
...
@@ -548,7 +548,7 @@ int pcmcia_open_memory(client_handle_t *handle, open_mem_t *open, memory_handle_
...
@@ -548,7 +548,7 @@ int pcmcia_open_memory(client_handle_t *handle, open_mem_t *open, memory_handle_
}
}
if
(
region
&&
region
->
mtd
)
{
if
(
region
&&
region
->
mtd
)
{
*
mh
=
region
;
*
mh
=
region
;
DEBUG
(
1
,
"cs:
open_memory(0x%p, 0x%x) = 0x%p
\n
"
,
cs_dbg
(
s
,
1
,
"
open_memory(0x%p, 0x%x) = 0x%p
\n
"
,
handle
,
open
->
Offset
,
region
);
handle
,
open
->
Offset
,
region
);
return
CS_SUCCESS
;
return
CS_SUCCESS
;
}
else
}
else
...
@@ -565,7 +565,7 @@ int pcmcia_open_memory(client_handle_t *handle, open_mem_t *open, memory_handle_
...
@@ -565,7 +565,7 @@ int pcmcia_open_memory(client_handle_t *handle, open_mem_t *open, memory_handle_
int
pcmcia_close_memory
(
memory_handle_t
handle
)
int
pcmcia_close_memory
(
memory_handle_t
handle
)
{
{
DEBUG
(
1
,
"cs: close_memory(0x%p)
\n
"
,
handle
);
cs_dbg
(
SOCKET
(
handle
->
mtd
),
1
,
"cs: close_memory(0x%p)
\n
"
,
handle
);
if
(
CHECK_REGION
(
handle
))
if
(
CHECK_REGION
(
handle
))
return
CS_BAD_HANDLE
;
return
CS_BAD_HANDLE
;
return
CS_SUCCESS
;
return
CS_SUCCESS
;
...
...
drivers/pcmcia/cardbus.c
View file @
e004aaa1
...
@@ -58,10 +58,6 @@
...
@@ -58,10 +58,6 @@
#include <pcmcia/cistpl.h>
#include <pcmcia/cistpl.h>
#include "cs_internal.h"
#include "cs_internal.h"
#ifdef PCMCIA_DEBUG
static
int
pc_debug
=
PCMCIA_DEBUG
;
#endif
/*====================================================================*/
/*====================================================================*/
#define FIND_FIRST_BIT(n) ((n) - ((n) & ((n)-1)))
#define FIND_FIRST_BIT(n) ((n) - ((n) & ((n)-1)))
...
@@ -119,7 +115,7 @@ static u_int xlate_rom_addr(u_char * b, u_int addr)
...
@@ -119,7 +115,7 @@ static u_int xlate_rom_addr(u_char * b, u_int addr)
static
void
cb_release_cis_mem
(
struct
pcmcia_socket
*
s
)
static
void
cb_release_cis_mem
(
struct
pcmcia_socket
*
s
)
{
{
if
(
s
->
cb_cis_virt
)
{
if
(
s
->
cb_cis_virt
)
{
DEBUG
(
1
,
"cs:
cb_release_cis_mem()
\n
"
);
cs_dbg
(
s
,
1
,
"
cb_release_cis_mem()
\n
"
);
iounmap
(
s
->
cb_cis_virt
);
iounmap
(
s
->
cb_cis_virt
);
s
->
cb_cis_virt
=
NULL
;
s
->
cb_cis_virt
=
NULL
;
s
->
cb_cis_res
=
0
;
s
->
cb_cis_res
=
0
;
...
@@ -160,7 +156,7 @@ int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void
...
@@ -160,7 +156,7 @@ int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void
struct
pci_dev
*
dev
;
struct
pci_dev
*
dev
;
struct
resource
*
res
;
struct
resource
*
res
;
DEBUG
(
3
,
"cs:
read_cb_mem(%d, %#x, %u)
\n
"
,
space
,
addr
,
len
);
cs_dbg
(
s
,
3
,
"
read_cb_mem(%d, %#x, %u)
\n
"
,
space
,
addr
,
len
);
dev
=
pci_find_slot
(
s
->
cb_dev
->
subordinate
->
number
,
0
);
dev
=
pci_find_slot
(
s
->
cb_dev
->
subordinate
->
number
,
0
);
if
(
!
dev
)
if
(
!
dev
)
...
...
drivers/pcmcia/cistpl.c
View file @
e004aaa1
...
@@ -143,7 +143,7 @@ int read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
...
@@ -143,7 +143,7 @@ int read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
{
{
u_char
*
sys
,
*
end
,
*
buf
=
ptr
;
u_char
*
sys
,
*
end
,
*
buf
=
ptr
;
DEBUG
(
3
,
"cs:
read_cis_mem(%d, %#x, %u)
\n
"
,
attr
,
addr
,
len
);
cs_dbg
(
s
,
3
,
"
read_cis_mem(%d, %#x, %u)
\n
"
,
attr
,
addr
,
len
);
if
(
attr
&
IS_INDIRECT
)
{
if
(
attr
&
IS_INDIRECT
)
{
/* Indirect accesses use a bunch of special registers at fixed
/* Indirect accesses use a bunch of special registers at fixed
...
@@ -195,7 +195,7 @@ int read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
...
@@ -195,7 +195,7 @@ int read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
addr
=
0
;
addr
=
0
;
}
}
}
}
DEBUG
(
3
,
"cs:
%#2.2x %#2.2x %#2.2x %#2.2x ...
\n
"
,
cs_dbg
(
s
,
3
,
"
%#2.2x %#2.2x %#2.2x %#2.2x ...
\n
"
,
*
(
u_char
*
)(
ptr
+
0
),
*
(
u_char
*
)(
ptr
+
1
),
*
(
u_char
*
)(
ptr
+
0
),
*
(
u_char
*
)(
ptr
+
1
),
*
(
u_char
*
)(
ptr
+
2
),
*
(
u_char
*
)(
ptr
+
3
));
*
(
u_char
*
)(
ptr
+
2
),
*
(
u_char
*
)(
ptr
+
3
));
return
0
;
return
0
;
...
@@ -206,7 +206,7 @@ void write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
...
@@ -206,7 +206,7 @@ void write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
{
{
u_char
*
sys
,
*
end
,
*
buf
=
ptr
;
u_char
*
sys
,
*
end
,
*
buf
=
ptr
;
DEBUG
(
3
,
"cs:
write_cis_mem(%d, %#x, %u)
\n
"
,
attr
,
addr
,
len
);
cs_dbg
(
s
,
3
,
"
write_cis_mem(%d, %#x, %u)
\n
"
,
attr
,
addr
,
len
);
if
(
attr
&
IS_INDIRECT
)
{
if
(
attr
&
IS_INDIRECT
)
{
/* Indirect accesses use a bunch of special registers at fixed
/* Indirect accesses use a bunch of special registers at fixed
...
@@ -578,8 +578,7 @@ int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple)
...
@@ -578,8 +578,7 @@ int pcmcia_get_next_tuple(client_handle_t handle, tuple_t *tuple)
ofs
+=
link
[
1
]
+
2
;
ofs
+=
link
[
1
]
+
2
;
}
}
if
(
i
==
MAX_TUPLES
)
{
if
(
i
==
MAX_TUPLES
)
{
DEBUG
(
1
,
"cs: overrun in pcmcia_get_next_tuple for socket %d
\n
"
,
cs_dbg
(
s
,
1
,
"cs: overrun in pcmcia_get_next_tuple
\n
"
);
handle
->
Socket
);
return
CS_NO_MORE_ITEMS
;
return
CS_NO_MORE_ITEMS
;
}
}
...
...
drivers/pcmcia/cs.c
View file @
e004aaa1
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
======================================================================*/
======================================================================*/
#include <linux/module.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/config.h>
#include <linux/config.h>
...
@@ -110,10 +111,15 @@ INT_MODULE_PARM(cis_speed, 300); /* ns */
...
@@ -110,10 +111,15 @@ INT_MODULE_PARM(cis_speed, 300); /* ns */
/* Access speed for IO windows */
/* Access speed for IO windows */
INT_MODULE_PARM
(
io_speed
,
0
);
/* ns */
INT_MODULE_PARM
(
io_speed
,
0
);
/* ns */
#ifdef PCMCIA_DEBUG
#ifdef DEBUG
INT_MODULE_PARM
(
pc_debug
,
PCMCIA_DEBUG
);
static
int
pc_debug
;
static
const
char
*
version
=
"cs.c 1.279 2001/10/13 00:08:28 (David Hinds)"
;
module_param
(
pc_debug
,
int
,
0644
);
int
cs_debug_level
(
int
level
)
{
return
pc_debug
>
level
;
}
#endif
#endif
/*====================================================================*/
/*====================================================================*/
...
@@ -127,103 +133,6 @@ socket_state_t dead_socket = {
...
@@ -127,103 +133,6 @@ socket_state_t dead_socket = {
LIST_HEAD
(
pcmcia_socket_list
);
LIST_HEAD
(
pcmcia_socket_list
);
DECLARE_RWSEM
(
pcmcia_socket_list_rwsem
);
DECLARE_RWSEM
(
pcmcia_socket_list_rwsem
);
/*====================================================================*/
/* String tables for error messages */
typedef
struct
lookup_t
{
int
key
;
char
*
msg
;
}
lookup_t
;
static
const
lookup_t
error_table
[]
=
{
{
CS_SUCCESS
,
"Operation succeeded"
},
{
CS_BAD_ADAPTER
,
"Bad adapter"
},
{
CS_BAD_ATTRIBUTE
,
"Bad attribute"
,
},
{
CS_BAD_BASE
,
"Bad base address"
},
{
CS_BAD_EDC
,
"Bad EDC"
},
{
CS_BAD_IRQ
,
"Bad IRQ"
},
{
CS_BAD_OFFSET
,
"Bad offset"
},
{
CS_BAD_PAGE
,
"Bad page number"
},
{
CS_READ_FAILURE
,
"Read failure"
},
{
CS_BAD_SIZE
,
"Bad size"
},
{
CS_BAD_SOCKET
,
"Bad socket"
},
{
CS_BAD_TYPE
,
"Bad type"
},
{
CS_BAD_VCC
,
"Bad Vcc"
},
{
CS_BAD_VPP
,
"Bad Vpp"
},
{
CS_BAD_WINDOW
,
"Bad window"
},
{
CS_WRITE_FAILURE
,
"Write failure"
},
{
CS_NO_CARD
,
"No card present"
},
{
CS_UNSUPPORTED_FUNCTION
,
"Usupported function"
},
{
CS_UNSUPPORTED_MODE
,
"Unsupported mode"
},
{
CS_BAD_SPEED
,
"Bad speed"
},
{
CS_BUSY
,
"Resource busy"
},
{
CS_GENERAL_FAILURE
,
"General failure"
},
{
CS_WRITE_PROTECTED
,
"Write protected"
},
{
CS_BAD_ARG_LENGTH
,
"Bad argument length"
},
{
CS_BAD_ARGS
,
"Bad arguments"
},
{
CS_CONFIGURATION_LOCKED
,
"Configuration locked"
},
{
CS_IN_USE
,
"Resource in use"
},
{
CS_NO_MORE_ITEMS
,
"No more items"
},
{
CS_OUT_OF_RESOURCE
,
"Out of resource"
},
{
CS_BAD_HANDLE
,
"Bad handle"
},
{
CS_BAD_TUPLE
,
"Bad CIS tuple"
}
};
#define ERROR_COUNT (sizeof(error_table)/sizeof(lookup_t))
static
const
lookup_t
service_table
[]
=
{
{
AccessConfigurationRegister
,
"AccessConfigurationRegister"
},
{
AddSocketServices
,
"AddSocketServices"
},
{
AdjustResourceInfo
,
"AdjustResourceInfo"
},
{
CheckEraseQueue
,
"CheckEraseQueue"
},
{
CloseMemory
,
"CloseMemory"
},
{
DeregisterClient
,
"DeregisterClient"
},
{
DeregisterEraseQueue
,
"DeregisterEraseQueue"
},
{
GetCardServicesInfo
,
"GetCardServicesInfo"
},
{
GetClientInfo
,
"GetClientInfo"
},
{
GetConfigurationInfo
,
"GetConfigurationInfo"
},
{
GetEventMask
,
"GetEventMask"
},
{
GetFirstClient
,
"GetFirstClient"
},
{
GetFirstRegion
,
"GetFirstRegion"
},
{
GetFirstTuple
,
"GetFirstTuple"
},
{
GetNextClient
,
"GetNextClient"
},
{
GetNextRegion
,
"GetNextRegion"
},
{
GetNextTuple
,
"GetNextTuple"
},
{
GetStatus
,
"GetStatus"
},
{
GetTupleData
,
"GetTupleData"
},
{
MapMemPage
,
"MapMemPage"
},
{
ModifyConfiguration
,
"ModifyConfiguration"
},
{
ModifyWindow
,
"ModifyWindow"
},
{
OpenMemory
,
"OpenMemory"
},
{
ParseTuple
,
"ParseTuple"
},
{
ReadMemory
,
"ReadMemory"
},
{
RegisterClient
,
"RegisterClient"
},
{
RegisterEraseQueue
,
"RegisterEraseQueue"
},
{
RegisterMTD
,
"RegisterMTD"
},
{
ReleaseConfiguration
,
"ReleaseConfiguration"
},
{
ReleaseIO
,
"ReleaseIO"
},
{
ReleaseIRQ
,
"ReleaseIRQ"
},
{
ReleaseWindow
,
"ReleaseWindow"
},
{
RequestConfiguration
,
"RequestConfiguration"
},
{
RequestIO
,
"RequestIO"
},
{
RequestIRQ
,
"RequestIRQ"
},
{
RequestSocketMask
,
"RequestSocketMask"
},
{
RequestWindow
,
"RequestWindow"
},
{
ResetCard
,
"ResetCard"
},
{
SetEventMask
,
"SetEventMask"
},
{
ValidateCIS
,
"ValidateCIS"
},
{
WriteMemory
,
"WriteMemory"
},
{
BindDevice
,
"BindDevice"
},
{
BindMTD
,
"BindMTD"
},
{
ReportError
,
"ReportError"
},
{
SuspendCard
,
"SuspendCard"
},
{
ResumeCard
,
"ResumeCard"
},
{
EjectCard
,
"EjectCard"
},
{
InsertCard
,
"InsertCard"
},
{
ReplaceCIS
,
"ReplaceCIS"
}
};
#define SERVICE_COUNT (sizeof(service_table)/sizeof(lookup_t))
/*====================================================================
/*====================================================================
...
@@ -306,7 +215,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
...
@@ -306,7 +215,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket)
if
(
!
socket
||
!
socket
->
ops
||
!
socket
->
dev
.
dev
)
if
(
!
socket
||
!
socket
->
ops
||
!
socket
->
dev
.
dev
)
return
-
EINVAL
;
return
-
EINVAL
;
DEBUG
(
0
,
"cs:
pcmcia_register_socket(0x%p)
\n
"
,
socket
->
ops
);
cs_dbg
(
socket
,
0
,
"
pcmcia_register_socket(0x%p)
\n
"
,
socket
->
ops
);
/* try to obtain a socket number [yes, it gets ugly if we
/* try to obtain a socket number [yes, it gets ugly if we
* register more than 2^sizeof(unsigned int) pcmcia
* register more than 2^sizeof(unsigned int) pcmcia
...
@@ -377,7 +286,7 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket)
...
@@ -377,7 +286,7 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket)
if
(
!
socket
)
if
(
!
socket
)
return
;
return
;
DEBUG
(
0
,
"cs:
pcmcia_unregister_socket(0x%p)
\n
"
,
socket
->
ops
);
cs_dbg
(
socket
,
0
,
"
pcmcia_unregister_socket(0x%p)
\n
"
,
socket
->
ops
);
if
(
socket
->
thread
)
{
if
(
socket
->
thread
)
{
init_completion
(
&
socket
->
thread_done
);
init_completion
(
&
socket
->
thread_done
);
...
@@ -443,10 +352,9 @@ static void shutdown_socket(struct pcmcia_socket *s)
...
@@ -443,10 +352,9 @@ static void shutdown_socket(struct pcmcia_socket *s)
{
{
client_t
**
c
;
client_t
**
c
;
DEBUG
(
1
,
"cs: shutdown_socket(%p)
\n
"
,
s
);
cs_dbg
(
s
,
1
,
"shutdown_socket
\n
"
);
/* Blank out the socket state */
/* Blank out the socket state */
s
->
state
&=
SOCKET_PRESENT
|
SOCKET_INUSE
;
s
->
socket
=
dead_socket
;
s
->
socket
=
dead_socket
;
s
->
ops
->
init
(
s
);
s
->
ops
->
init
(
s
);
s
->
ops
->
set_socket
(
s
,
&
s
->
socket
);
s
->
ops
->
set_socket
(
s
,
&
s
->
socket
);
...
@@ -499,8 +407,8 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority)
...
@@ -499,8 +407,8 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority)
{
{
client_t
*
client
=
s
->
clients
;
client_t
*
client
=
s
->
clients
;
int
ret
;
int
ret
;
DEBUG
(
1
,
"cs: send_event(sock %d,
event %d, pri %d)
\n
"
,
cs_dbg
(
s
,
1
,
"send_event(
event %d, pri %d)
\n
"
,
s
->
sock
,
event
,
priority
);
event
,
priority
);
ret
=
0
;
ret
=
0
;
if
(
s
->
state
&
SOCKET_CARDBUS
)
if
(
s
->
state
&
SOCKET_CARDBUS
)
return
0
;
return
0
;
...
@@ -516,26 +424,14 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority)
...
@@ -516,26 +424,14 @@ static int send_event(struct pcmcia_socket *s, event_t event, int priority)
return
ret
;
return
ret
;
}
/* send_event */
}
/* send_event */
static
void
pcmcia_error
(
struct
pcmcia_socket
*
skt
,
const
char
*
fmt
,
...)
{
static
char
buf
[
128
];
va_list
ap
;
int
len
;
va_start
(
ap
,
fmt
);
len
=
vsnprintf
(
buf
,
sizeof
(
buf
),
fmt
,
ap
);
va_end
(
ap
);
buf
[
len
]
=
'\0'
;
printk
(
KERN_ERR
"PCMCIA: socket %p: %s"
,
skt
,
buf
);
}
#define cs_to_timeout(cs) (((cs) * HZ + 99) / 100)
#define cs_to_timeout(cs) (((cs) * HZ + 99) / 100)
static
void
socket_remove_drivers
(
struct
pcmcia_socket
*
skt
)
static
void
socket_remove_drivers
(
struct
pcmcia_socket
*
skt
)
{
{
client_t
*
client
;
client_t
*
client
;
cs_dbg
(
skt
,
4
,
"remove_drivers
\n
"
);
send_event
(
skt
,
CS_EVENT_CARD_REMOVAL
,
CS_EVENT_PRI_HIGH
);
send_event
(
skt
,
CS_EVENT_CARD_REMOVAL
,
CS_EVENT_PRI_HIGH
);
for
(
client
=
skt
->
clients
;
client
;
client
=
client
->
next
)
for
(
client
=
skt
->
clients
;
client
;
client
=
client
->
next
)
...
@@ -545,10 +441,13 @@ static void socket_remove_drivers(struct pcmcia_socket *skt)
...
@@ -545,10 +441,13 @@ static void socket_remove_drivers(struct pcmcia_socket *skt)
static
void
socket_shutdown
(
struct
pcmcia_socket
*
skt
)
static
void
socket_shutdown
(
struct
pcmcia_socket
*
skt
)
{
{
cs_dbg
(
skt
,
4
,
"shutdown
\n
"
);
socket_remove_drivers
(
skt
);
socket_remove_drivers
(
skt
);
skt
->
state
&=
SOCKET_INUSE
|
SOCKET_PRESENT
;
set_current_state
(
TASK_UNINTERRUPTIBLE
);
set_current_state
(
TASK_UNINTERRUPTIBLE
);
schedule_timeout
(
cs_to_timeout
(
shutdown_delay
));
schedule_timeout
(
cs_to_timeout
(
shutdown_delay
));
skt
->
state
&=
~
SOCKET_PRESENT
;
skt
->
state
&=
SOCKET_INUSE
;
shutdown_socket
(
skt
);
shutdown_socket
(
skt
);
}
}
...
@@ -556,6 +455,8 @@ static int socket_reset(struct pcmcia_socket *skt)
...
@@ -556,6 +455,8 @@ static int socket_reset(struct pcmcia_socket *skt)
{
{
int
status
,
i
;
int
status
,
i
;
cs_dbg
(
skt
,
4
,
"reset
\n
"
);
skt
->
socket
.
flags
|=
SS_OUTPUT_ENA
|
SS_RESET
;
skt
->
socket
.
flags
|=
SS_OUTPUT_ENA
|
SS_RESET
;
skt
->
ops
->
set_socket
(
skt
,
&
skt
->
socket
);
skt
->
ops
->
set_socket
(
skt
,
&
skt
->
socket
);
udelay
((
long
)
reset_time
);
udelay
((
long
)
reset_time
);
...
@@ -578,7 +479,7 @@ static int socket_reset(struct pcmcia_socket *skt)
...
@@ -578,7 +479,7 @@ static int socket_reset(struct pcmcia_socket *skt)
schedule_timeout
(
cs_to_timeout
(
unreset_check
));
schedule_timeout
(
cs_to_timeout
(
unreset_check
));
}
}
pcmcia_erro
r
(
skt
,
"time out after reset.
\n
"
);
cs_er
r
(
skt
,
"time out after reset.
\n
"
);
return
CS_GENERAL_FAILURE
;
return
CS_GENERAL_FAILURE
;
}
}
...
@@ -586,6 +487,8 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
...
@@ -586,6 +487,8 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
{
{
int
status
,
i
;
int
status
,
i
;
cs_dbg
(
skt
,
4
,
"setup
\n
"
);
skt
->
ops
->
get_status
(
skt
,
&
status
);
skt
->
ops
->
get_status
(
skt
,
&
status
);
if
(
!
(
status
&
SS_DETECT
))
if
(
!
(
status
&
SS_DETECT
))
return
CS_NO_CARD
;
return
CS_NO_CARD
;
...
@@ -606,14 +509,14 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
...
@@ -606,14 +509,14 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
}
}
if
(
status
&
SS_PENDING
)
{
if
(
status
&
SS_PENDING
)
{
pcmcia_erro
r
(
skt
,
"voltage interrogation timed out.
\n
"
);
cs_er
r
(
skt
,
"voltage interrogation timed out.
\n
"
);
return
CS_GENERAL_FAILURE
;
return
CS_GENERAL_FAILURE
;
}
}
if
(
status
&
SS_CARDBUS
)
{
if
(
status
&
SS_CARDBUS
)
{
skt
->
state
|=
SOCKET_CARDBUS
;
skt
->
state
|=
SOCKET_CARDBUS
;
#ifndef CONFIG_CARDBUS
#ifndef CONFIG_CARDBUS
pcmcia_erro
r
(
skt
,
"cardbus cards are not supported.
\n
"
);
cs_er
r
(
skt
,
"cardbus cards are not supported.
\n
"
);
return
CS_BAD_TYPE
;
return
CS_BAD_TYPE
;
#endif
#endif
}
}
...
@@ -626,7 +529,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
...
@@ -626,7 +529,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
else
if
(
!
(
status
&
SS_XVCARD
))
else
if
(
!
(
status
&
SS_XVCARD
))
skt
->
socket
.
Vcc
=
skt
->
socket
.
Vpp
=
50
;
skt
->
socket
.
Vcc
=
skt
->
socket
.
Vpp
=
50
;
else
{
else
{
pcmcia_erro
r
(
skt
,
"unsupported voltage key.
\n
"
);
cs_er
r
(
skt
,
"unsupported voltage key.
\n
"
);
return
CS_BAD_TYPE
;
return
CS_BAD_TYPE
;
}
}
skt
->
socket
.
flags
=
0
;
skt
->
socket
.
flags
=
0
;
...
@@ -640,7 +543,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
...
@@ -640,7 +543,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay)
skt
->
ops
->
get_status
(
skt
,
&
status
);
skt
->
ops
->
get_status
(
skt
,
&
status
);
if
(
!
(
status
&
SS_POWERON
))
{
if
(
!
(
status
&
SS_POWERON
))
{
pcmcia_erro
r
(
skt
,
"unable to apply power.
\n
"
);
cs_er
r
(
skt
,
"unable to apply power.
\n
"
);
return
CS_BAD_TYPE
;
return
CS_BAD_TYPE
;
}
}
...
@@ -655,6 +558,8 @@ static int socket_insert(struct pcmcia_socket *skt)
...
@@ -655,6 +558,8 @@ static int socket_insert(struct pcmcia_socket *skt)
{
{
int
ret
;
int
ret
;
cs_dbg
(
skt
,
4
,
"insert
\n
"
);
if
(
!
cs_socket_get
(
skt
))
if
(
!
cs_socket_get
(
skt
))
return
CS_NO_CARD
;
return
CS_NO_CARD
;
...
@@ -667,6 +572,8 @@ static int socket_insert(struct pcmcia_socket *skt)
...
@@ -667,6 +572,8 @@ static int socket_insert(struct pcmcia_socket *skt)
skt
->
state
|=
SOCKET_CARDBUS_CONFIG
;
skt
->
state
|=
SOCKET_CARDBUS_CONFIG
;
}
}
#endif
#endif
cs_dbg
(
skt
,
4
,
"insert done
\n
"
);
send_event
(
skt
,
CS_EVENT_CARD_INSERTION
,
CS_EVENT_PRI_LOW
);
send_event
(
skt
,
CS_EVENT_CARD_INSERTION
,
CS_EVENT_PRI_LOW
);
}
else
{
}
else
{
socket_shutdown
(
skt
);
socket_shutdown
(
skt
);
...
@@ -832,6 +739,7 @@ static int pccardd(void *__skt)
...
@@ -832,6 +739,7 @@ static int pccardd(void *__skt)
*/
*/
void
pcmcia_parse_events
(
struct
pcmcia_socket
*
s
,
u_int
events
)
void
pcmcia_parse_events
(
struct
pcmcia_socket
*
s
,
u_int
events
)
{
{
cs_dbg
(
s
,
4
,
"parse_events: events %08x
\n
"
,
events
);
if
(
s
->
thread
)
{
if
(
s
->
thread
)
{
spin_lock
(
&
s
->
thread_lock
);
spin_lock
(
&
s
->
thread_lock
);
s
->
thread_events
|=
events
;
s
->
thread_events
|=
events
;
...
@@ -857,14 +765,14 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base,
...
@@ -857,14 +765,14 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base,
align
=
(
*
base
)
?
(
lines
?
1
<<
lines
:
0
)
:
1
;
align
=
(
*
base
)
?
(
lines
?
1
<<
lines
:
0
)
:
1
;
if
(
align
&&
(
align
<
num
))
{
if
(
align
&&
(
align
<
num
))
{
if
(
*
base
)
{
if
(
*
base
)
{
DEBUG
(
0
,
"odd IO request: num %04x align %04x
\n
"
,
cs_dbg
(
s
,
0
,
"odd IO request: num %04x align %04x
\n
"
,
num
,
align
);
num
,
align
);
align
=
0
;
align
=
0
;
}
else
}
else
while
(
align
&&
(
align
<
num
))
align
<<=
1
;
while
(
align
&&
(
align
<
num
))
align
<<=
1
;
}
}
if
(
*
base
&
~
(
align
-
1
))
{
if
(
*
base
&
~
(
align
-
1
))
{
DEBUG
(
0
,
"odd IO request: base %04x align %04x
\n
"
,
cs_dbg
(
s
,
0
,
"odd IO request: base %04x align %04x
\n
"
,
*
base
,
align
);
*
base
,
align
);
align
=
0
;
align
=
0
;
}
}
...
@@ -979,77 +887,6 @@ int pcmcia_access_configuration_register(client_handle_t handle,
...
@@ -979,77 +887,6 @@ int pcmcia_access_configuration_register(client_handle_t handle,
return
CS_SUCCESS
;
return
CS_SUCCESS
;
}
/* access_configuration_register */
}
/* access_configuration_register */
/*======================================================================
Bind_device() associates a device driver with a particular socket.
It is normally called by Driver Services after it has identified
a newly inserted card. An instance of that driver will then be
eligible to register as a client of this socket.
======================================================================*/
int
pcmcia_bind_device
(
bind_req_t
*
req
)
{
client_t
*
client
;
struct
pcmcia_socket
*
s
;
s
=
req
->
Socket
;
if
(
!
s
)
return
CS_BAD_SOCKET
;
client
=
(
client_t
*
)
kmalloc
(
sizeof
(
client_t
),
GFP_KERNEL
);
if
(
!
client
)
return
CS_OUT_OF_RESOURCE
;
memset
(
client
,
'\0'
,
sizeof
(
client_t
));
client
->
client_magic
=
CLIENT_MAGIC
;
strlcpy
(
client
->
dev_info
,
(
char
*
)
req
->
dev_info
,
DEV_NAME_LEN
);
client
->
Socket
=
s
;
client
->
Function
=
req
->
Function
;
client
->
state
=
CLIENT_UNBOUND
;
client
->
erase_busy
.
next
=
&
client
->
erase_busy
;
client
->
erase_busy
.
prev
=
&
client
->
erase_busy
;
init_waitqueue_head
(
&
client
->
mtd_req
);
client
->
next
=
s
->
clients
;
s
->
clients
=
client
;
DEBUG
(
1
,
"cs: bind_device(): client 0x%p, sock %p, dev %s
\n
"
,
client
,
client
->
Socket
,
client
->
dev_info
);
return
CS_SUCCESS
;
}
/* bind_device */
/*======================================================================
Bind_mtd() associates a device driver with a particular memory
region. It is normally called by Driver Services after it has
identified a memory device type. An instance of the corresponding
driver will then be able to register to control this region.
======================================================================*/
int
pcmcia_bind_mtd
(
mtd_bind_t
*
req
)
{
struct
pcmcia_socket
*
s
;
memory_handle_t
region
;
s
=
req
->
Socket
;
if
(
!
s
)
return
CS_BAD_SOCKET
;
if
(
req
->
Attributes
&
REGION_TYPE_AM
)
region
=
s
->
a_region
;
else
region
=
s
->
c_region
;
while
(
region
)
{
if
(
region
->
info
.
CardOffset
==
req
->
CardOffset
)
break
;
region
=
region
->
info
.
next
;
}
if
(
!
region
||
(
region
->
mtd
!=
NULL
))
return
CS_BAD_OFFSET
;
strlcpy
(
region
->
dev_info
,
(
char
*
)
req
->
dev_info
,
DEV_NAME_LEN
);
DEBUG
(
1
,
"cs: bind_mtd(): attr 0x%x, offset 0x%x, dev %s
\n
"
,
req
->
Attributes
,
req
->
CardOffset
,
(
char
*
)
req
->
dev_info
);
return
CS_SUCCESS
;
}
/* bind_mtd */
/*====================================================================*/
/*====================================================================*/
...
@@ -1061,9 +898,12 @@ int pcmcia_deregister_client(client_handle_t handle)
...
@@ -1061,9 +898,12 @@ int pcmcia_deregister_client(client_handle_t handle)
u_long
flags
;
u_long
flags
;
int
i
;
int
i
;
DEBUG
(
1
,
"cs: deregister_client(%p)
\n
"
,
handle
);
if
(
CHECK_HANDLE
(
handle
))
if
(
CHECK_HANDLE
(
handle
))
return
CS_BAD_HANDLE
;
return
CS_BAD_HANDLE
;
s
=
SOCKET
(
handle
);
cs_dbg
(
s
,
1
,
"deregister_client(%p)
\n
"
,
handle
);
if
(
handle
->
state
&
if
(
handle
->
state
&
(
CLIENT_IRQ_REQ
|
CLIENT_IO_REQ
|
CLIENT_CONFIG_LOCKED
))
(
CLIENT_IRQ_REQ
|
CLIENT_IO_REQ
|
CLIENT_CONFIG_LOCKED
))
return
CS_IN_USE
;
return
CS_IN_USE
;
...
@@ -1072,7 +912,6 @@ int pcmcia_deregister_client(client_handle_t handle)
...
@@ -1072,7 +912,6 @@ int pcmcia_deregister_client(client_handle_t handle)
return
CS_IN_USE
;
return
CS_IN_USE
;
/* Disconnect all MTD links */
/* Disconnect all MTD links */
s
=
SOCKET
(
handle
);
if
(
handle
->
mtd_count
)
{
if
(
handle
->
mtd_count
)
{
for
(
region
=
s
->
a_region
;
region
;
region
=
region
->
info
.
next
)
for
(
region
=
s
->
a_region
;
region
;
region
=
region
->
info
.
next
)
if
(
region
->
mtd
==
handle
)
region
->
mtd
=
NULL
;
if
(
region
->
mtd
==
handle
)
region
->
mtd
=
NULL
;
...
@@ -1543,8 +1382,8 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req)
...
@@ -1543,8 +1382,8 @@ int pcmcia_register_client(client_handle_t *handle, client_reg_t *req)
memset
(
s
->
config
,
0
,
sizeof
(
config_t
)
*
s
->
functions
);
memset
(
s
->
config
,
0
,
sizeof
(
config_t
)
*
s
->
functions
);
}
}
DEBUG
(
1
,
"cs: register_client(): client 0x%p, sock
%p, dev %s
\n
"
,
cs_dbg
(
s
,
1
,
"register_client(): client 0x
%p, dev %s
\n
"
,
client
,
client
->
Socke
t
,
client
->
dev_info
);
clien
t
,
client
->
dev_info
);
if
(
client
->
EventMask
&
CS_EVENT_REGISTRATION_COMPLETE
)
if
(
client
->
EventMask
&
CS_EVENT_REGISTRATION_COMPLETE
)
EVENT
(
client
,
CS_EVENT_REGISTRATION_COMPLETE
,
CS_EVENT_PRI_LOW
);
EVENT
(
client
,
CS_EVENT_REGISTRATION_COMPLETE
,
CS_EVENT_PRI_LOW
);
...
@@ -2077,8 +1916,8 @@ int pcmcia_reset_card(client_handle_t handle, client_req_t *req)
...
@@ -2077,8 +1916,8 @@ int pcmcia_reset_card(client_handle_t handle, client_req_t *req)
if
(
CHECK_HANDLE
(
handle
))
if
(
CHECK_HANDLE
(
handle
))
return
CS_BAD_HANDLE
;
return
CS_BAD_HANDLE
;
DEBUG
(
1
,
"cs: resetting socket %p
\n
"
,
handle
->
Socket
);
skt
=
SOCKET
(
handle
);
skt
=
SOCKET
(
handle
);
cs_dbg
(
skt
,
1
,
"resetting socket
\n
"
);
down
(
&
skt
->
skt_sem
);
down
(
&
skt
->
skt_sem
);
do
{
do
{
...
@@ -2119,15 +1958,11 @@ int pcmcia_reset_card(client_handle_t handle, client_req_t *req)
...
@@ -2119,15 +1958,11 @@ int pcmcia_reset_card(client_handle_t handle, client_req_t *req)
======================================================================*/
======================================================================*/
int
pcmcia_suspend_card
(
client_handle_t
handle
,
client_req_t
*
req
)
int
pcmcia_suspend_card
(
struct
pcmcia_socket
*
skt
)
{
{
struct
pcmcia_socket
*
skt
;
int
ret
;
int
ret
;
if
(
CHECK_HANDLE
(
handle
))
cs_dbg
(
skt
,
1
,
"suspending socket
\n
"
);
return
CS_BAD_HANDLE
;
DEBUG
(
1
,
"cs: suspending socket %p
\n
"
,
handle
->
Socket
);
skt
=
SOCKET
(
handle
);
down
(
&
skt
->
skt_sem
);
down
(
&
skt
->
skt_sem
);
do
{
do
{
...
@@ -2146,15 +1981,11 @@ int pcmcia_suspend_card(client_handle_t handle, client_req_t *req)
...
@@ -2146,15 +1981,11 @@ int pcmcia_suspend_card(client_handle_t handle, client_req_t *req)
return
ret
;
return
ret
;
}
/* suspend_card */
}
/* suspend_card */
int
pcmcia_resume_card
(
client_handle_t
handle
,
client_req_t
*
req
)
int
pcmcia_resume_card
(
struct
pcmcia_socket
*
skt
)
{
{
struct
pcmcia_socket
*
skt
;
int
ret
;
int
ret
;
if
(
CHECK_HANDLE
(
handle
))
cs_dbg
(
skt
,
1
,
"waking up socket
\n
"
);
return
CS_BAD_HANDLE
;
DEBUG
(
1
,
"cs: waking up socket %p
\n
"
,
handle
->
Socket
);
skt
=
SOCKET
(
handle
);
down
(
&
skt
->
skt_sem
);
down
(
&
skt
->
skt_sem
);
do
{
do
{
...
@@ -2179,15 +2010,11 @@ int pcmcia_resume_card(client_handle_t handle, client_req_t *req)
...
@@ -2179,15 +2010,11 @@ int pcmcia_resume_card(client_handle_t handle, client_req_t *req)
======================================================================*/
======================================================================*/
int
pcmcia_eject_card
(
client_handle_t
handle
,
client_req_t
*
req
)
int
pcmcia_eject_card
(
struct
pcmcia_socket
*
skt
)
{
{
struct
pcmcia_socket
*
skt
;
int
ret
;
int
ret
;
if
(
CHECK_HANDLE
(
handle
))
cs_dbg
(
skt
,
1
,
"user eject request
\n
"
);
return
CS_BAD_HANDLE
;
DEBUG
(
1
,
"cs: user eject request on socket %p
\n
"
,
handle
->
Socket
);
skt
=
SOCKET
(
handle
);
down
(
&
skt
->
skt_sem
);
down
(
&
skt
->
skt_sem
);
do
{
do
{
...
@@ -2208,15 +2035,11 @@ int pcmcia_eject_card(client_handle_t handle, client_req_t *req)
...
@@ -2208,15 +2035,11 @@ int pcmcia_eject_card(client_handle_t handle, client_req_t *req)
return
ret
;
return
ret
;
}
/* eject_card */
}
/* eject_card */
int
pcmcia_insert_card
(
client_handle_t
handle
,
client_req_t
*
req
)
int
pcmcia_insert_card
(
struct
pcmcia_socket
*
skt
)
{
{
struct
pcmcia_socket
*
skt
;
int
ret
;
int
ret
;
if
(
CHECK_HANDLE
(
handle
))
cs_dbg
(
skt
,
1
,
"user insert request
\n
"
);
return
CS_BAD_HANDLE
;
DEBUG
(
1
,
"cs: user insert request on socket %p
\n
"
,
handle
->
Socket
);
skt
=
SOCKET
(
handle
);
down
(
&
skt
->
skt_sem
);
down
(
&
skt
->
skt_sem
);
do
{
do
{
...
@@ -2260,35 +2083,6 @@ int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask)
...
@@ -2260,35 +2083,6 @@ int pcmcia_set_event_mask(client_handle_t handle, eventmask_t *mask)
return
CS_SUCCESS
;
return
CS_SUCCESS
;
}
/* set_event_mask */
}
/* set_event_mask */
/*====================================================================*/
int
pcmcia_report_error
(
client_handle_t
handle
,
error_info_t
*
err
)
{
int
i
;
char
*
serv
;
if
(
CHECK_HANDLE
(
handle
))
printk
(
KERN_NOTICE
);
else
printk
(
KERN_NOTICE
"%s: "
,
handle
->
dev_info
);
for
(
i
=
0
;
i
<
SERVICE_COUNT
;
i
++
)
if
(
service_table
[
i
].
key
==
err
->
func
)
break
;
if
(
i
<
SERVICE_COUNT
)
serv
=
service_table
[
i
].
msg
;
else
serv
=
"Unknown service number"
;
for
(
i
=
0
;
i
<
ERROR_COUNT
;
i
++
)
if
(
error_table
[
i
].
key
==
err
->
retcode
)
break
;
if
(
i
<
ERROR_COUNT
)
printk
(
"%s: %s
\n
"
,
serv
,
error_table
[
i
].
msg
);
else
printk
(
"%s: Unknown error code %#x
\n
"
,
serv
,
err
->
retcode
);
return
CS_SUCCESS
;
}
/* report_error */
/*======================================================================
/*======================================================================
OS-specific module glue goes here
OS-specific module glue goes here
...
@@ -2297,8 +2091,6 @@ int pcmcia_report_error(client_handle_t handle, error_info_t *err)
...
@@ -2297,8 +2091,6 @@ int pcmcia_report_error(client_handle_t handle, error_info_t *err)
/* in alpha order */
/* in alpha order */
EXPORT_SYMBOL
(
pcmcia_access_configuration_register
);
EXPORT_SYMBOL
(
pcmcia_access_configuration_register
);
EXPORT_SYMBOL
(
pcmcia_adjust_resource_info
);
EXPORT_SYMBOL
(
pcmcia_adjust_resource_info
);
EXPORT_SYMBOL
(
pcmcia_bind_device
);
EXPORT_SYMBOL
(
pcmcia_bind_mtd
);
EXPORT_SYMBOL
(
pcmcia_check_erase_queue
);
EXPORT_SYMBOL
(
pcmcia_check_erase_queue
);
EXPORT_SYMBOL
(
pcmcia_close_memory
);
EXPORT_SYMBOL
(
pcmcia_close_memory
);
EXPORT_SYMBOL
(
pcmcia_copy_memory
);
EXPORT_SYMBOL
(
pcmcia_copy_memory
);
...
@@ -2333,7 +2125,6 @@ EXPORT_SYMBOL(pcmcia_release_io);
...
@@ -2333,7 +2125,6 @@ EXPORT_SYMBOL(pcmcia_release_io);
EXPORT_SYMBOL
(
pcmcia_release_irq
);
EXPORT_SYMBOL
(
pcmcia_release_irq
);
EXPORT_SYMBOL
(
pcmcia_release_window
);
EXPORT_SYMBOL
(
pcmcia_release_window
);
EXPORT_SYMBOL
(
pcmcia_replace_cis
);
EXPORT_SYMBOL
(
pcmcia_replace_cis
);
EXPORT_SYMBOL
(
pcmcia_report_error
);
EXPORT_SYMBOL
(
pcmcia_request_configuration
);
EXPORT_SYMBOL
(
pcmcia_request_configuration
);
EXPORT_SYMBOL
(
pcmcia_request_io
);
EXPORT_SYMBOL
(
pcmcia_request_io
);
EXPORT_SYMBOL
(
pcmcia_request_irq
);
EXPORT_SYMBOL
(
pcmcia_request_irq
);
...
@@ -2360,7 +2151,6 @@ static int __init init_pcmcia_cs(void)
...
@@ -2360,7 +2151,6 @@ static int __init init_pcmcia_cs(void)
{
{
printk
(
KERN_INFO
"%s
\n
"
,
release
);
printk
(
KERN_INFO
"%s
\n
"
,
release
);
printk
(
KERN_INFO
" %s
\n
"
,
options
);
printk
(
KERN_INFO
" %s
\n
"
,
options
);
DEBUG
(
0
,
"%s
\n
"
,
version
);
class_register
(
&
pcmcia_socket_class
);
class_register
(
&
pcmcia_socket_class
);
return
0
;
return
0
;
...
...
drivers/pcmcia/cs_internal.h
View file @
e004aaa1
...
@@ -167,7 +167,6 @@ int replace_cis(client_handle_t handle, cisdump_t *cis);
...
@@ -167,7 +167,6 @@ int replace_cis(client_handle_t handle, cisdump_t *cis);
int
read_tuple
(
client_handle_t
handle
,
cisdata_t
code
,
void
*
parse
);
int
read_tuple
(
client_handle_t
handle
,
cisdata_t
code
,
void
*
parse
);
/* In bulkmem.c */
/* In bulkmem.c */
void
retry_erase_list
(
struct
erase_busy_t
*
list
,
u_int
cause
);
int
get_first_region
(
client_handle_t
handle
,
region_info_t
*
rgn
);
int
get_first_region
(
client_handle_t
handle
,
region_info_t
*
rgn
);
int
get_next_region
(
client_handle_t
handle
,
region_info_t
*
rgn
);
int
get_next_region
(
client_handle_t
handle
,
region_info_t
*
rgn
);
int
register_mtd
(
client_handle_t
handle
,
mtd_reg_t
*
reg
);
int
register_mtd
(
client_handle_t
handle
,
mtd_reg_t
*
reg
);
...
@@ -194,11 +193,22 @@ void release_resource_db(void);
...
@@ -194,11 +193,22 @@ void release_resource_db(void);
extern
struct
rw_semaphore
pcmcia_socket_list_rwsem
;
extern
struct
rw_semaphore
pcmcia_socket_list_rwsem
;
extern
struct
list_head
pcmcia_socket_list
;
extern
struct
list_head
pcmcia_socket_list
;
#ifdef PCMCIA_DEBUG
#define cs_socket_name(skt) ((skt)->dev.class_id)
extern
int
pc_debug
;
#define DEBUG(n, args...) do { if (pc_debug>(n)) printk(KERN_DEBUG args); } while (0)
#ifdef DEBUG
extern
int
cs_debug_level
(
int
);
#define cs_dbg(skt, lvl, fmt, arg...) do { \
if (cs_debug_level(lvl)) \
printk(KERN_DEBUG "cs: %s: " fmt, \
cs_socket_name(skt) , ## arg); \
} while (0)
#else
#else
#define
DEBUG(n, args
...) do { } while (0)
#define
cs_dbg(skt, lvl, fmt, arg
...) do { } while (0)
#endif
#endif
#define cs_err(skt, fmt, arg...) \
printk(KERN_ERR "cs: %s: " fmt, (skt)->dev.class_id , ## arg)
#endif
/* _LINUX_CS_INTERNAL_H */
#endif
/* _LINUX_CS_INTERNAL_H */
drivers/pcmcia/ds.c
View file @
e004aaa1
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include <linux/config.h>
#include <linux/config.h>
#include <linux/module.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/major.h>
#include <linux/major.h>
...
@@ -53,6 +54,7 @@
...
@@ -53,6 +54,7 @@
#include <asm/atomic.h>
#include <asm/atomic.h>
#define IN_CARD_SERVICES
#include <pcmcia/version.h>
#include <pcmcia/version.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
#include <pcmcia/cs.h>
...
@@ -61,6 +63,8 @@
...
@@ -61,6 +63,8 @@
#include <pcmcia/ds.h>
#include <pcmcia/ds.h>
#include <pcmcia/ss.h>
#include <pcmcia/ss.h>
#include "cs_internal.h"
/*====================================================================*/
/*====================================================================*/
/* Module parameters */
/* Module parameters */
...
@@ -69,13 +73,17 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
...
@@ -69,13 +73,17 @@ MODULE_AUTHOR("David Hinds <dahinds@users.sourceforge.net>");
MODULE_DESCRIPTION
(
"PCMCIA Driver Services"
);
MODULE_DESCRIPTION
(
"PCMCIA Driver Services"
);
MODULE_LICENSE
(
"Dual MPL/GPL"
);
MODULE_LICENSE
(
"Dual MPL/GPL"
);
#define INT_MODULE_PARM(n, v) static int n = v; MODULE_PARM(n, "i")
#ifdef DEBUG
static
int
pc_debug
;
module_param
(
pc_debug
,
int
,
0644
);
#ifdef PCMCIA_DEBUG
#define ds_dbg(lvl, fmt, arg...) do { \
INT_MODULE_PARM
(
pc_debug
,
PCMCIA_DEBUG
);
if (pc_debug > (lvl)) \
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
printk(KERN_DEBUG "ds: " fmt , ## arg); \
} while (0)
#else
#else
#define
DEBUG(n, args...
)
#define
ds_dbg(lvl, fmt, arg...) do { } while (0
)
#endif
#endif
/*====================================================================*/
/*====================================================================*/
...
@@ -113,10 +121,10 @@ struct pcmcia_bus_socket {
...
@@ -113,10 +121,10 @@ struct pcmcia_bus_socket {
struct
pcmcia_socket
*
parent
;
struct
pcmcia_socket
*
parent
;
};
};
#define SOCKET_PRESENT 0x01
#define
DS_
SOCKET_PRESENT 0x01
#define
SOCKET_BUSY
0x02
#define
DS_SOCKET_BUSY
0x02
#define SOCKET_REMOVAL_PENDING 0x10
#define
DS_
SOCKET_REMOVAL_PENDING 0x10
#define
SOCKET_DEAD
0x80
#define
DS_SOCKET_DEAD
0x80
/*====================================================================*/
/*====================================================================*/
...
@@ -129,6 +137,214 @@ extern struct proc_dir_entry *proc_pccard;
...
@@ -129,6 +137,214 @@ extern struct proc_dir_entry *proc_pccard;
/*====================================================================*/
/*====================================================================*/
/* code which was in cs.c before */
/*======================================================================
Bind_device() associates a device driver with a particular socket.
It is normally called by Driver Services after it has identified
a newly inserted card. An instance of that driver will then be
eligible to register as a client of this socket.
======================================================================*/
static
int
pcmcia_bind_device
(
bind_req_t
*
req
)
{
client_t
*
client
;
struct
pcmcia_socket
*
s
;
s
=
req
->
Socket
;
if
(
!
s
)
return
CS_BAD_SOCKET
;
client
=
(
client_t
*
)
kmalloc
(
sizeof
(
client_t
),
GFP_KERNEL
);
if
(
!
client
)
return
CS_OUT_OF_RESOURCE
;
memset
(
client
,
'\0'
,
sizeof
(
client_t
));
client
->
client_magic
=
CLIENT_MAGIC
;
strlcpy
(
client
->
dev_info
,
(
char
*
)
req
->
dev_info
,
DEV_NAME_LEN
);
client
->
Socket
=
s
;
client
->
Function
=
req
->
Function
;
client
->
state
=
CLIENT_UNBOUND
;
client
->
erase_busy
.
next
=
&
client
->
erase_busy
;
client
->
erase_busy
.
prev
=
&
client
->
erase_busy
;
init_waitqueue_head
(
&
client
->
mtd_req
);
client
->
next
=
s
->
clients
;
s
->
clients
=
client
;
ds_dbg
(
1
,
"%s: bind_device(): client 0x%p, dev %s
\n
"
,
cs_socket_name
(
client
->
Socket
),
client
,
client
->
dev_info
);
return
CS_SUCCESS
;
}
/* bind_device */
/*======================================================================
Bind_mtd() associates a device driver with a particular memory
region. It is normally called by Driver Services after it has
identified a memory device type. An instance of the corresponding
driver will then be able to register to control this region.
======================================================================*/
static
int
pcmcia_bind_mtd
(
mtd_bind_t
*
req
)
{
struct
pcmcia_socket
*
s
;
memory_handle_t
region
;
s
=
req
->
Socket
;
if
(
!
s
)
return
CS_BAD_SOCKET
;
if
(
req
->
Attributes
&
REGION_TYPE_AM
)
region
=
s
->
a_region
;
else
region
=
s
->
c_region
;
while
(
region
)
{
if
(
region
->
info
.
CardOffset
==
req
->
CardOffset
)
break
;
region
=
region
->
info
.
next
;
}
if
(
!
region
||
(
region
->
mtd
!=
NULL
))
return
CS_BAD_OFFSET
;
strlcpy
(
region
->
dev_info
,
(
char
*
)
req
->
dev_info
,
DEV_NAME_LEN
);
ds_dbg
(
1
,
"%s: bind_mtd: attr 0x%x, offset 0x%x, dev %s
\n
"
,
cs_socket_name
(
s
),
req
->
Attributes
,
req
->
CardOffset
,
(
char
*
)
req
->
dev_info
);
return
CS_SUCCESS
;
}
/* bind_mtd */
/* String tables for error messages */
typedef
struct
lookup_t
{
int
key
;
char
*
msg
;
}
lookup_t
;
static
const
lookup_t
error_table
[]
=
{
{
CS_SUCCESS
,
"Operation succeeded"
},
{
CS_BAD_ADAPTER
,
"Bad adapter"
},
{
CS_BAD_ATTRIBUTE
,
"Bad attribute"
,
},
{
CS_BAD_BASE
,
"Bad base address"
},
{
CS_BAD_EDC
,
"Bad EDC"
},
{
CS_BAD_IRQ
,
"Bad IRQ"
},
{
CS_BAD_OFFSET
,
"Bad offset"
},
{
CS_BAD_PAGE
,
"Bad page number"
},
{
CS_READ_FAILURE
,
"Read failure"
},
{
CS_BAD_SIZE
,
"Bad size"
},
{
CS_BAD_SOCKET
,
"Bad socket"
},
{
CS_BAD_TYPE
,
"Bad type"
},
{
CS_BAD_VCC
,
"Bad Vcc"
},
{
CS_BAD_VPP
,
"Bad Vpp"
},
{
CS_BAD_WINDOW
,
"Bad window"
},
{
CS_WRITE_FAILURE
,
"Write failure"
},
{
CS_NO_CARD
,
"No card present"
},
{
CS_UNSUPPORTED_FUNCTION
,
"Usupported function"
},
{
CS_UNSUPPORTED_MODE
,
"Unsupported mode"
},
{
CS_BAD_SPEED
,
"Bad speed"
},
{
CS_BUSY
,
"Resource busy"
},
{
CS_GENERAL_FAILURE
,
"General failure"
},
{
CS_WRITE_PROTECTED
,
"Write protected"
},
{
CS_BAD_ARG_LENGTH
,
"Bad argument length"
},
{
CS_BAD_ARGS
,
"Bad arguments"
},
{
CS_CONFIGURATION_LOCKED
,
"Configuration locked"
},
{
CS_IN_USE
,
"Resource in use"
},
{
CS_NO_MORE_ITEMS
,
"No more items"
},
{
CS_OUT_OF_RESOURCE
,
"Out of resource"
},
{
CS_BAD_HANDLE
,
"Bad handle"
},
{
CS_BAD_TUPLE
,
"Bad CIS tuple"
}
};
static
const
lookup_t
service_table
[]
=
{
{
AccessConfigurationRegister
,
"AccessConfigurationRegister"
},
{
AddSocketServices
,
"AddSocketServices"
},
{
AdjustResourceInfo
,
"AdjustResourceInfo"
},
{
CheckEraseQueue
,
"CheckEraseQueue"
},
{
CloseMemory
,
"CloseMemory"
},
{
DeregisterClient
,
"DeregisterClient"
},
{
DeregisterEraseQueue
,
"DeregisterEraseQueue"
},
{
GetCardServicesInfo
,
"GetCardServicesInfo"
},
{
GetClientInfo
,
"GetClientInfo"
},
{
GetConfigurationInfo
,
"GetConfigurationInfo"
},
{
GetEventMask
,
"GetEventMask"
},
{
GetFirstClient
,
"GetFirstClient"
},
{
GetFirstRegion
,
"GetFirstRegion"
},
{
GetFirstTuple
,
"GetFirstTuple"
},
{
GetNextClient
,
"GetNextClient"
},
{
GetNextRegion
,
"GetNextRegion"
},
{
GetNextTuple
,
"GetNextTuple"
},
{
GetStatus
,
"GetStatus"
},
{
GetTupleData
,
"GetTupleData"
},
{
MapMemPage
,
"MapMemPage"
},
{
ModifyConfiguration
,
"ModifyConfiguration"
},
{
ModifyWindow
,
"ModifyWindow"
},
{
OpenMemory
,
"OpenMemory"
},
{
ParseTuple
,
"ParseTuple"
},
{
ReadMemory
,
"ReadMemory"
},
{
RegisterClient
,
"RegisterClient"
},
{
RegisterEraseQueue
,
"RegisterEraseQueue"
},
{
RegisterMTD
,
"RegisterMTD"
},
{
ReleaseConfiguration
,
"ReleaseConfiguration"
},
{
ReleaseIO
,
"ReleaseIO"
},
{
ReleaseIRQ
,
"ReleaseIRQ"
},
{
ReleaseWindow
,
"ReleaseWindow"
},
{
RequestConfiguration
,
"RequestConfiguration"
},
{
RequestIO
,
"RequestIO"
},
{
RequestIRQ
,
"RequestIRQ"
},
{
RequestSocketMask
,
"RequestSocketMask"
},
{
RequestWindow
,
"RequestWindow"
},
{
ResetCard
,
"ResetCard"
},
{
SetEventMask
,
"SetEventMask"
},
{
ValidateCIS
,
"ValidateCIS"
},
{
WriteMemory
,
"WriteMemory"
},
{
BindDevice
,
"BindDevice"
},
{
BindMTD
,
"BindMTD"
},
{
ReportError
,
"ReportError"
},
{
SuspendCard
,
"SuspendCard"
},
{
ResumeCard
,
"ResumeCard"
},
{
EjectCard
,
"EjectCard"
},
{
InsertCard
,
"InsertCard"
},
{
ReplaceCIS
,
"ReplaceCIS"
}
};
int
pcmcia_report_error
(
client_handle_t
handle
,
error_info_t
*
err
)
{
int
i
;
char
*
serv
;
if
(
CHECK_HANDLE
(
handle
))
printk
(
KERN_NOTICE
);
else
printk
(
KERN_NOTICE
"%s: "
,
handle
->
dev_info
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
service_table
);
i
++
)
if
(
service_table
[
i
].
key
==
err
->
func
)
break
;
if
(
i
<
ARRAY_SIZE
(
service_table
))
serv
=
service_table
[
i
].
msg
;
else
serv
=
"Unknown service number"
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
error_table
);
i
++
)
if
(
error_table
[
i
].
key
==
err
->
retcode
)
break
;
if
(
i
<
ARRAY_SIZE
(
error_table
))
printk
(
"%s: %s
\n
"
,
serv
,
error_table
[
i
].
msg
);
else
printk
(
"%s: Unknown error code %#x
\n
"
,
serv
,
err
->
retcode
);
return
CS_SUCCESS
;
}
/* report_error */
EXPORT_SYMBOL
(
pcmcia_report_error
);
/* end of code which was in cs.c before */
/*======================================================================*/
void
cs_error
(
client_handle_t
handle
,
int
func
,
int
ret
)
void
cs_error
(
client_handle_t
handle
,
int
func
,
int
ret
)
{
{
error_info_t
err
=
{
func
,
ret
};
error_info_t
err
=
{
func
,
ret
};
...
@@ -249,12 +465,12 @@ static int handle_request(struct pcmcia_bus_socket *s, event_t event)
...
@@ -249,12 +465,12 @@ static int handle_request(struct pcmcia_bus_socket *s, event_t event)
{
{
if
(
s
->
req_pending
!=
0
)
if
(
s
->
req_pending
!=
0
)
return
CS_IN_USE
;
return
CS_IN_USE
;
if
(
s
->
state
&
SOCKET_BUSY
)
if
(
s
->
state
&
DS_
SOCKET_BUSY
)
s
->
req_pending
=
1
;
s
->
req_pending
=
1
;
handle_event
(
s
,
event
);
handle_event
(
s
,
event
);
if
(
wait_event_interruptible
(
s
->
request
,
s
->
req_pending
<=
0
))
if
(
wait_event_interruptible
(
s
->
request
,
s
->
req_pending
<=
0
))
return
CS_IN_USE
;
return
CS_IN_USE
;
if
(
s
->
state
&
SOCKET_BUSY
)
if
(
s
->
state
&
DS_
SOCKET_BUSY
)
return
s
->
req_result
;
return
s
->
req_result
;
return
CS_SUCCESS
;
return
CS_SUCCESS
;
}
}
...
@@ -263,7 +479,7 @@ static void handle_removal(void *data)
...
@@ -263,7 +479,7 @@ static void handle_removal(void *data)
{
{
struct
pcmcia_bus_socket
*
s
=
data
;
struct
pcmcia_bus_socket
*
s
=
data
;
handle_event
(
s
,
CS_EVENT_CARD_REMOVAL
);
handle_event
(
s
,
CS_EVENT_CARD_REMOVAL
);
s
->
state
&=
~
SOCKET_REMOVAL_PENDING
;
s
->
state
&=
~
DS_
SOCKET_REMOVAL_PENDING
;
}
}
/*======================================================================
/*======================================================================
...
@@ -277,22 +493,22 @@ static int ds_event(event_t event, int priority,
...
@@ -277,22 +493,22 @@ static int ds_event(event_t event, int priority,
{
{
struct
pcmcia_bus_socket
*
s
;
struct
pcmcia_bus_socket
*
s
;
DEBUG
(
1
,
"ds:
ds_event(0x%06x, %d, 0x%p)
\n
"
,
ds_dbg
(
1
,
"
ds_event(0x%06x, %d, 0x%p)
\n
"
,
event
,
priority
,
args
->
client_handle
);
event
,
priority
,
args
->
client_handle
);
s
=
args
->
client_data
;
s
=
args
->
client_data
;
switch
(
event
)
{
switch
(
event
)
{
case
CS_EVENT_CARD_REMOVAL
:
case
CS_EVENT_CARD_REMOVAL
:
s
->
state
&=
~
SOCKET_PRESENT
;
s
->
state
&=
~
DS_
SOCKET_PRESENT
;
if
(
!
(
s
->
state
&
SOCKET_REMOVAL_PENDING
))
{
if
(
!
(
s
->
state
&
DS_
SOCKET_REMOVAL_PENDING
))
{
s
->
state
|=
SOCKET_REMOVAL_PENDING
;
s
->
state
|=
DS_
SOCKET_REMOVAL_PENDING
;
schedule_delayed_work
(
&
s
->
removal
,
HZ
/
10
);
schedule_delayed_work
(
&
s
->
removal
,
HZ
/
10
);
}
}
break
;
break
;
case
CS_EVENT_CARD_INSERTION
:
case
CS_EVENT_CARD_INSERTION
:
s
->
state
|=
SOCKET_PRESENT
;
s
->
state
|=
DS_
SOCKET_PRESENT
;
handle_event
(
s
,
event
);
handle_event
(
s
,
event
);
break
;
break
;
...
@@ -353,7 +569,7 @@ static int bind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info)
...
@@ -353,7 +569,7 @@ static int bind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info)
if
(
!
s
)
if
(
!
s
)
return
-
EINVAL
;
return
-
EINVAL
;
DEBUG
(
2
,
"bind_request(%d, '%s')
\n
"
,
s
->
parent
->
sock
,
ds_dbg
(
2
,
"bind_request(%d, '%s')
\n
"
,
s
->
parent
->
sock
,
(
char
*
)
bind_info
->
dev_info
);
(
char
*
)
bind_info
->
dev_info
);
driver
=
get_pcmcia_driver
(
&
bind_info
->
dev_info
);
driver
=
get_pcmcia_driver
(
&
bind_info
->
dev_info
);
if
(
!
driver
)
if
(
!
driver
)
...
@@ -484,7 +700,7 @@ static int unbind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info)
...
@@ -484,7 +700,7 @@ static int unbind_request(struct pcmcia_bus_socket *s, bind_info_t *bind_info)
{
{
socket_bind_t
**
b
,
*
c
;
socket_bind_t
**
b
,
*
c
;
DEBUG
(
2
,
"unbind_request(%d, '%s')
\n
"
,
s
->
parent
->
sock
,
ds_dbg
(
2
,
"unbind_request(%d, '%s')
\n
"
,
s
->
parent
->
sock
,
(
char
*
)
bind_info
->
dev_info
);
(
char
*
)
bind_info
->
dev_info
);
for
(
b
=
&
s
->
bind
;
*
b
;
b
=
&
(
*
b
)
->
next
)
for
(
b
=
&
s
->
bind
;
*
b
;
b
=
&
(
*
b
)
->
next
)
if
((
strcmp
((
char
*
)(
*
b
)
->
driver
->
drv
.
name
,
if
((
strcmp
((
char
*
)(
*
b
)
->
driver
->
drv
.
name
,
...
@@ -518,17 +734,17 @@ static int ds_open(struct inode *inode, struct file *file)
...
@@ -518,17 +734,17 @@ static int ds_open(struct inode *inode, struct file *file)
struct
pcmcia_bus_socket
*
s
;
struct
pcmcia_bus_socket
*
s
;
user_info_t
*
user
;
user_info_t
*
user
;
DEBUG
(
0
,
"ds_open(socket %d)
\n
"
,
i
);
ds_dbg
(
0
,
"ds_open(socket %d)
\n
"
,
i
);
s
=
pcmcia_get_bus_socket
(
i
);
s
=
pcmcia_get_bus_socket
(
i
);
if
(
!
s
)
if
(
!
s
)
return
-
ENODEV
;
return
-
ENODEV
;
if
((
file
->
f_flags
&
O_ACCMODE
)
!=
O_RDONLY
)
{
if
((
file
->
f_flags
&
O_ACCMODE
)
!=
O_RDONLY
)
{
if
(
s
->
state
&
SOCKET_BUSY
)
if
(
s
->
state
&
DS_
SOCKET_BUSY
)
return
-
EBUSY
;
return
-
EBUSY
;
else
else
s
->
state
|=
SOCKET_BUSY
;
s
->
state
|=
DS_
SOCKET_BUSY
;
}
}
user
=
kmalloc
(
sizeof
(
user_info_t
),
GFP_KERNEL
);
user
=
kmalloc
(
sizeof
(
user_info_t
),
GFP_KERNEL
);
...
@@ -540,7 +756,7 @@ static int ds_open(struct inode *inode, struct file *file)
...
@@ -540,7 +756,7 @@ static int ds_open(struct inode *inode, struct file *file)
s
->
user
=
user
;
s
->
user
=
user
;
file
->
private_data
=
user
;
file
->
private_data
=
user
;
if
(
s
->
state
&
SOCKET_PRESENT
)
if
(
s
->
state
&
DS_
SOCKET_PRESENT
)
queue_event
(
user
,
CS_EVENT_CARD_INSERTION
);
queue_event
(
user
,
CS_EVENT_CARD_INSERTION
);
return
0
;
return
0
;
}
/* ds_open */
}
/* ds_open */
...
@@ -552,7 +768,7 @@ static int ds_release(struct inode *inode, struct file *file)
...
@@ -552,7 +768,7 @@ static int ds_release(struct inode *inode, struct file *file)
struct
pcmcia_bus_socket
*
s
;
struct
pcmcia_bus_socket
*
s
;
user_info_t
*
user
,
**
link
;
user_info_t
*
user
,
**
link
;
DEBUG
(
0
,
"ds_release(socket %d)
\n
"
,
iminor
(
inode
));
ds_dbg
(
0
,
"ds_release(socket %d)
\n
"
,
iminor
(
inode
));
user
=
file
->
private_data
;
user
=
file
->
private_data
;
if
(
CHECK_USER
(
user
))
if
(
CHECK_USER
(
user
))
...
@@ -562,7 +778,7 @@ static int ds_release(struct inode *inode, struct file *file)
...
@@ -562,7 +778,7 @@ static int ds_release(struct inode *inode, struct file *file)
/* Unlink user data structure */
/* Unlink user data structure */
if
((
file
->
f_flags
&
O_ACCMODE
)
!=
O_RDONLY
)
{
if
((
file
->
f_flags
&
O_ACCMODE
)
!=
O_RDONLY
)
{
s
->
state
&=
~
SOCKET_BUSY
;
s
->
state
&=
~
DS_
SOCKET_BUSY
;
s
->
req_pending
=
0
;
s
->
req_pending
=
0
;
wake_up_interruptible
(
&
s
->
request
);
wake_up_interruptible
(
&
s
->
request
);
}
}
...
@@ -588,7 +804,7 @@ static ssize_t ds_read(struct file *file, char *buf,
...
@@ -588,7 +804,7 @@ static ssize_t ds_read(struct file *file, char *buf,
user_info_t
*
user
;
user_info_t
*
user
;
int
ret
;
int
ret
;
DEBUG
(
2
,
"ds_read(socket %d)
\n
"
,
iminor
(
inode
));
ds_dbg
(
2
,
"ds_read(socket %d)
\n
"
,
iminor
(
file
->
f_dentry
->
d_
inode
));
if
(
count
<
4
)
if
(
count
<
4
)
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -598,7 +814,7 @@ static ssize_t ds_read(struct file *file, char *buf,
...
@@ -598,7 +814,7 @@ static ssize_t ds_read(struct file *file, char *buf,
return
-
EIO
;
return
-
EIO
;
s
=
user
->
socket
;
s
=
user
->
socket
;
if
(
s
->
state
&
SOCKET_DEAD
)
if
(
s
->
state
&
DS_
SOCKET_DEAD
)
return
-
EIO
;
return
-
EIO
;
ret
=
wait_event_interruptible
(
s
->
queue
,
!
queue_empty
(
user
));
ret
=
wait_event_interruptible
(
s
->
queue
,
!
queue_empty
(
user
));
...
@@ -616,7 +832,7 @@ static ssize_t ds_write(struct file *file, const char *buf,
...
@@ -616,7 +832,7 @@ static ssize_t ds_write(struct file *file, const char *buf,
struct
pcmcia_bus_socket
*
s
;
struct
pcmcia_bus_socket
*
s
;
user_info_t
*
user
;
user_info_t
*
user
;
DEBUG
(
2
,
"ds_write(socket %d)
\n
"
,
iminor
(
inode
));
ds_dbg
(
2
,
"ds_write(socket %d)
\n
"
,
iminor
(
file
->
f_dentry
->
d_
inode
));
if
(
count
!=
4
)
if
(
count
!=
4
)
return
-
EINVAL
;
return
-
EINVAL
;
...
@@ -628,7 +844,7 @@ static ssize_t ds_write(struct file *file, const char *buf,
...
@@ -628,7 +844,7 @@ static ssize_t ds_write(struct file *file, const char *buf,
return
-
EIO
;
return
-
EIO
;
s
=
user
->
socket
;
s
=
user
->
socket
;
if
(
s
->
state
&
SOCKET_DEAD
)
if
(
s
->
state
&
DS_
SOCKET_DEAD
)
return
-
EIO
;
return
-
EIO
;
if
(
s
->
req_pending
)
{
if
(
s
->
req_pending
)
{
...
@@ -650,7 +866,7 @@ static u_int ds_poll(struct file *file, poll_table *wait)
...
@@ -650,7 +866,7 @@ static u_int ds_poll(struct file *file, poll_table *wait)
struct
pcmcia_bus_socket
*
s
;
struct
pcmcia_bus_socket
*
s
;
user_info_t
*
user
;
user_info_t
*
user
;
DEBUG
(
2
,
"ds_poll(socket %d)
\n
"
,
iminor
(
inode
));
ds_dbg
(
2
,
"ds_poll(socket %d)
\n
"
,
iminor
(
file
->
f_dentry
->
d_
inode
));
user
=
file
->
private_data
;
user
=
file
->
private_data
;
if
(
CHECK_USER
(
user
))
if
(
CHECK_USER
(
user
))
...
@@ -677,14 +893,14 @@ static int ds_ioctl(struct inode * inode, struct file * file,
...
@@ -677,14 +893,14 @@ static int ds_ioctl(struct inode * inode, struct file * file,
ds_ioctl_arg_t
buf
;
ds_ioctl_arg_t
buf
;
user_info_t
*
user
;
user_info_t
*
user
;
DEBUG
(
2
,
"ds_ioctl(socket %d, %#x, %#lx)
\n
"
,
iminor
(
inode
),
cmd
,
arg
);
ds_dbg
(
2
,
"ds_ioctl(socket %d, %#x, %#lx)
\n
"
,
iminor
(
inode
),
cmd
,
arg
);
user
=
file
->
private_data
;
user
=
file
->
private_data
;
if
(
CHECK_USER
(
user
))
if
(
CHECK_USER
(
user
))
return
-
EIO
;
return
-
EIO
;
s
=
user
->
socket
;
s
=
user
->
socket
;
if
(
s
->
state
&
SOCKET_DEAD
)
if
(
s
->
state
&
DS_
SOCKET_DEAD
)
return
-
EIO
;
return
-
EIO
;
size
=
(
cmd
&
IOCSIZE_MASK
)
>>
IOCSIZE_SHIFT
;
size
=
(
cmd
&
IOCSIZE_MASK
)
>>
IOCSIZE_SHIFT
;
...
@@ -697,14 +913,14 @@ static int ds_ioctl(struct inode * inode, struct file * file,
...
@@ -697,14 +913,14 @@ static int ds_ioctl(struct inode * inode, struct file * file,
if
(
cmd
&
IOC_IN
)
{
if
(
cmd
&
IOC_IN
)
{
err
=
verify_area
(
VERIFY_READ
,
(
char
*
)
arg
,
size
);
err
=
verify_area
(
VERIFY_READ
,
(
char
*
)
arg
,
size
);
if
(
err
)
{
if
(
err
)
{
DEBUG
(
3
,
"ds_ioctl(): verify_read = %d
\n
"
,
err
);
ds_dbg
(
3
,
"ds_ioctl(): verify_read = %d
\n
"
,
err
);
return
err
;
return
err
;
}
}
}
}
if
(
cmd
&
IOC_OUT
)
{
if
(
cmd
&
IOC_OUT
)
{
err
=
verify_area
(
VERIFY_WRITE
,
(
char
*
)
arg
,
size
);
err
=
verify_area
(
VERIFY_WRITE
,
(
char
*
)
arg
,
size
);
if
(
err
)
{
if
(
err
)
{
DEBUG
(
3
,
"ds_ioctl(): verify_write = %d
\n
"
,
err
);
ds_dbg
(
3
,
"ds_ioctl(): verify_write = %d
\n
"
,
err
);
return
err
;
return
err
;
}
}
}
}
...
@@ -748,16 +964,16 @@ static int ds_ioctl(struct inode * inode, struct file * file,
...
@@ -748,16 +964,16 @@ static int ds_ioctl(struct inode * inode, struct file * file,
ret
=
pcmcia_validate_cis
(
s
->
handle
,
&
buf
.
cisinfo
);
ret
=
pcmcia_validate_cis
(
s
->
handle
,
&
buf
.
cisinfo
);
break
;
break
;
case
DS_SUSPEND_CARD
:
case
DS_SUSPEND_CARD
:
ret
=
pcmcia_suspend_card
(
s
->
handle
,
NULL
);
ret
=
pcmcia_suspend_card
(
s
->
parent
);
break
;
break
;
case
DS_RESUME_CARD
:
case
DS_RESUME_CARD
:
ret
=
pcmcia_resume_card
(
s
->
handle
,
NULL
);
ret
=
pcmcia_resume_card
(
s
->
parent
);
break
;
break
;
case
DS_EJECT_CARD
:
case
DS_EJECT_CARD
:
ret
=
pcmcia_eject_card
(
s
->
handle
,
NULL
);
ret
=
pcmcia_eject_card
(
s
->
parent
);
break
;
break
;
case
DS_INSERT_CARD
:
case
DS_INSERT_CARD
:
ret
=
pcmcia_insert_card
(
s
->
handle
,
NULL
);
ret
=
pcmcia_insert_card
(
s
->
parent
);
break
;
break
;
case
DS_ACCESS_CONFIGURATION_REGISTER
:
case
DS_ACCESS_CONFIGURATION_REGISTER
:
if
((
buf
.
conf_reg
.
Action
==
CS_WRITE
)
&&
!
capable
(
CAP_SYS_ADMIN
))
if
((
buf
.
conf_reg
.
Action
==
CS_WRITE
)
&&
!
capable
(
CAP_SYS_ADMIN
))
...
@@ -806,7 +1022,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
...
@@ -806,7 +1022,7 @@ static int ds_ioctl(struct inode * inode, struct file * file,
}
}
if
((
err
==
0
)
&&
(
ret
!=
CS_SUCCESS
))
{
if
((
err
==
0
)
&&
(
ret
!=
CS_SUCCESS
))
{
DEBUG
(
2
,
"ds_ioctl: ret = %d
\n
"
,
ret
);
ds_dbg
(
2
,
"ds_ioctl: ret = %d
\n
"
,
ret
);
switch
(
ret
)
{
switch
(
ret
)
{
case
CS_BAD_SOCKET
:
case
CS_NO_CARD
:
case
CS_BAD_SOCKET
:
case
CS_NO_CARD
:
err
=
-
ENODEV
;
break
;
err
=
-
ENODEV
;
break
;
...
@@ -916,7 +1132,7 @@ static void pcmcia_bus_remove_socket(struct class_device *class_dev)
...
@@ -916,7 +1132,7 @@ static void pcmcia_bus_remove_socket(struct class_device *class_dev)
pcmcia_deregister_client
(
socket
->
pcmcia
->
handle
);
pcmcia_deregister_client
(
socket
->
pcmcia
->
handle
);
socket
->
pcmcia
->
state
|=
SOCKET_DEAD
;
socket
->
pcmcia
->
state
|=
DS_
SOCKET_DEAD
;
pcmcia_put_bus_socket
(
socket
->
pcmcia
);
pcmcia_put_bus_socket
(
socket
->
pcmcia
);
socket
->
pcmcia
=
NULL
;
socket
->
pcmcia
=
NULL
;
...
...
drivers/pcmcia/i82365.c
View file @
e004aaa1
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
======================================================================*/
======================================================================*/
#include <linux/module.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/config.h>
#include <linux/config.h>
#include <linux/types.h>
#include <linux/types.h>
...
@@ -66,14 +67,20 @@
...
@@ -66,14 +67,20 @@
#include "ricoh.h"
#include "ricoh.h"
#include "o2micro.h"
#include "o2micro.h"
#ifdef PCMCIA_DEBUG
#ifdef DEBUG
static
int
pc_debug
=
PCMCIA_DEBUG
;
MODULE_PARM
(
pc_debug
,
"i"
);
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
static
const
char
*
version
=
static
const
char
*
version
=
"i82365.c 1.265 1999/11/10 18:36:21 (David Hinds)"
;
"i82365.c 1.265 1999/11/10 18:36:21 (David Hinds)"
;
static
int
pc_debug
;
module_param
(
pc_debug
,
int
,
0644
);
#define debug(lvl, fmt, arg...) do { \
if (pc_debug > (lvl)) \
printk(KERN_DEBUG "i82365: " fmt , ## arg); \
} while (0)
#else
#else
#define
DEBUG(n, args
...) do { } while (0)
#define
debug(lvl, fmt, arg
...) do { } while (0)
#endif
#endif
static
irqreturn_t
i365_count_irq
(
int
,
void
*
,
struct
pt_regs
*
);
static
irqreturn_t
i365_count_irq
(
int
,
void
*
,
struct
pt_regs
*
);
...
@@ -496,13 +503,13 @@ static irqreturn_t i365_count_irq(int irq, void *dev, struct pt_regs *regs)
...
@@ -496,13 +503,13 @@ static irqreturn_t i365_count_irq(int irq, void *dev, struct pt_regs *regs)
{
{
i365_get
(
irq_sock
,
I365_CSC
);
i365_get
(
irq_sock
,
I365_CSC
);
irq_hits
++
;
irq_hits
++
;
DEBUG
(
2
,
"-> hit on irq %d
\n
"
,
irq
);
debug
(
2
,
"-> hit on irq %d
\n
"
,
irq
);
return
IRQ_HANDLED
;
return
IRQ_HANDLED
;
}
}
static
u_int
__init
test_irq
(
u_short
sock
,
int
irq
)
static
u_int
__init
test_irq
(
u_short
sock
,
int
irq
)
{
{
DEBUG
(
2
,
" testing ISA irq %d
\n
"
,
irq
);
debug
(
2
,
" testing ISA irq %d
\n
"
,
irq
);
if
(
request_irq
(
irq
,
i365_count_irq
,
0
,
"scan"
,
i365_count_irq
)
!=
0
)
if
(
request_irq
(
irq
,
i365_count_irq
,
0
,
"scan"
,
i365_count_irq
)
!=
0
)
return
1
;
return
1
;
irq_hits
=
0
;
irq_sock
=
sock
;
irq_hits
=
0
;
irq_sock
=
sock
;
...
@@ -510,7 +517,7 @@ static u_int __init test_irq(u_short sock, int irq)
...
@@ -510,7 +517,7 @@ static u_int __init test_irq(u_short sock, int irq)
schedule_timeout
(
HZ
/
100
);
schedule_timeout
(
HZ
/
100
);
if
(
irq_hits
)
{
if
(
irq_hits
)
{
free_irq
(
irq
,
i365_count_irq
);
free_irq
(
irq
,
i365_count_irq
);
DEBUG
(
2
,
" spurious hit!
\n
"
);
debug
(
2
,
" spurious hit!
\n
"
);
return
1
;
return
1
;
}
}
...
@@ -523,7 +530,7 @@ static u_int __init test_irq(u_short sock, int irq)
...
@@ -523,7 +530,7 @@ static u_int __init test_irq(u_short sock, int irq)
/* mask all interrupts */
/* mask all interrupts */
i365_set
(
sock
,
I365_CSCINT
,
0
);
i365_set
(
sock
,
I365_CSCINT
,
0
);
DEBUG
(
2
,
" hits = %d
\n
"
,
irq_hits
);
debug
(
2
,
" hits = %d
\n
"
,
irq_hits
);
return
(
irq_hits
!=
1
);
return
(
irq_hits
!=
1
);
}
}
...
@@ -850,7 +857,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev,
...
@@ -850,7 +857,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev,
u_long
flags
=
0
;
u_long
flags
=
0
;
int
handled
=
0
;
int
handled
=
0
;
DEBUG
(
4
,
"i82365:
pcic_interrupt(%d)
\n
"
,
irq
);
debug
(
4
,
"
pcic_interrupt(%d)
\n
"
,
irq
);
for
(
j
=
0
;
j
<
20
;
j
++
)
{
for
(
j
=
0
;
j
<
20
;
j
++
)
{
active
=
0
;
active
=
0
;
...
@@ -874,7 +881,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev,
...
@@ -874,7 +881,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev,
events
|=
(
csc
&
I365_CSC_READY
)
?
SS_READY
:
0
;
events
|=
(
csc
&
I365_CSC_READY
)
?
SS_READY
:
0
;
}
}
ISA_UNLOCK
(
i
,
flags
);
ISA_UNLOCK
(
i
,
flags
);
DEBUG
(
2
,
"i82365:
socket %d event 0x%02x
\n
"
,
i
,
events
);
debug
(
2
,
"
socket %d event 0x%02x
\n
"
,
i
,
events
);
if
(
events
)
if
(
events
)
pcmcia_parse_events
(
&
socket
[
i
].
socket
,
events
);
pcmcia_parse_events
(
&
socket
[
i
].
socket
,
events
);
...
@@ -886,7 +893,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev,
...
@@ -886,7 +893,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev,
if
(
j
==
20
)
if
(
j
==
20
)
printk
(
KERN_NOTICE
"i82365: infinite loop in interrupt handler
\n
"
);
printk
(
KERN_NOTICE
"i82365: infinite loop in interrupt handler
\n
"
);
DEBUG
(
4
,
"i82365:
interrupt done
\n
"
);
debug
(
4
,
"
interrupt done
\n
"
);
return
IRQ_RETVAL
(
handled
);
return
IRQ_RETVAL
(
handled
);
}
/* pcic_interrupt */
}
/* pcic_interrupt */
...
@@ -928,7 +935,7 @@ static int i365_get_status(u_short sock, u_int *value)
...
@@ -928,7 +935,7 @@ static int i365_get_status(u_short sock, u_int *value)
}
}
}
}
DEBUG
(
1
,
"i82365:
GetStatus(%d) = %#4.4x
\n
"
,
sock
,
*
value
);
debug
(
1
,
"
GetStatus(%d) = %#4.4x
\n
"
,
sock
,
*
value
);
return
0
;
return
0
;
}
/* i365_get_status */
}
/* i365_get_status */
...
@@ -998,7 +1005,7 @@ static int i365_get_socket(u_short sock, socket_state_t *state)
...
@@ -998,7 +1005,7 @@ static int i365_get_socket(u_short sock, socket_state_t *state)
state
->
csc_mask
|=
(
reg
&
I365_CSC_READY
)
?
SS_READY
:
0
;
state
->
csc_mask
|=
(
reg
&
I365_CSC_READY
)
?
SS_READY
:
0
;
}
}
DEBUG
(
1
,
"i82365:
GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
debug
(
1
,
"
GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
"io_irq %d, csc_mask %#2.2x
\n
"
,
sock
,
state
->
flags
,
"io_irq %d, csc_mask %#2.2x
\n
"
,
sock
,
state
->
flags
,
state
->
Vcc
,
state
->
Vpp
,
state
->
io_irq
,
state
->
csc_mask
);
state
->
Vcc
,
state
->
Vpp
,
state
->
io_irq
,
state
->
csc_mask
);
return
0
;
return
0
;
...
@@ -1011,7 +1018,7 @@ static int i365_set_socket(u_short sock, socket_state_t *state)
...
@@ -1011,7 +1018,7 @@ static int i365_set_socket(u_short sock, socket_state_t *state)
struct
i82365_socket
*
t
=
&
socket
[
sock
];
struct
i82365_socket
*
t
=
&
socket
[
sock
];
u_char
reg
;
u_char
reg
;
DEBUG
(
1
,
"i82365:
SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, "
debug
(
1
,
"
SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, "
"io_irq %d, csc_mask %#2.2x)
\n
"
,
sock
,
state
->
flags
,
"io_irq %d, csc_mask %#2.2x)
\n
"
,
sock
,
state
->
flags
,
state
->
Vcc
,
state
->
Vpp
,
state
->
io_irq
,
state
->
csc_mask
);
state
->
Vcc
,
state
->
Vpp
,
state
->
io_irq
,
state
->
csc_mask
);
...
@@ -1120,7 +1127,7 @@ static int i365_set_io_map(u_short sock, struct pccard_io_map *io)
...
@@ -1120,7 +1127,7 @@ static int i365_set_io_map(u_short sock, struct pccard_io_map *io)
{
{
u_char
map
,
ioctl
;
u_char
map
,
ioctl
;
DEBUG
(
1
,
"i82365:
SetIOMap(%d, %d, %#2.2x, %d ns, "
debug
(
1
,
"
SetIOMap(%d, %d, %#2.2x, %d ns, "
"%#4.4x-%#4.4x)
\n
"
,
sock
,
io
->
map
,
io
->
flags
,
"%#4.4x-%#4.4x)
\n
"
,
sock
,
io
->
map
,
io
->
flags
,
io
->
speed
,
io
->
start
,
io
->
stop
);
io
->
speed
,
io
->
start
,
io
->
stop
);
map
=
io
->
map
;
map
=
io
->
map
;
...
@@ -1150,7 +1157,7 @@ static int i365_set_mem_map(u_short sock, struct pccard_mem_map *mem)
...
@@ -1150,7 +1157,7 @@ static int i365_set_mem_map(u_short sock, struct pccard_mem_map *mem)
u_short
base
,
i
;
u_short
base
,
i
;
u_char
map
;
u_char
map
;
DEBUG
(
1
,
"i82365:
SetMemMap(%d, %d, %#2.2x, %d ns, %#5.5lx-%#5.5"
debug
(
1
,
"
SetMemMap(%d, %d, %#2.2x, %d ns, %#5.5lx-%#5.5"
"lx, %#5.5x)
\n
"
,
sock
,
mem
->
map
,
mem
->
flags
,
mem
->
speed
,
"lx, %#5.5x)
\n
"
,
sock
,
mem
->
map
,
mem
->
flags
,
mem
->
speed
,
mem
->
sys_start
,
mem
->
sys_stop
,
mem
->
card_start
);
mem
->
sys_start
,
mem
->
sys_stop
,
mem
->
card_start
);
...
...
drivers/pcmcia/sa11xx_core.c
View file @
e004aaa1
...
@@ -35,6 +35,7 @@
...
@@ -35,6 +35,7 @@
*/
*/
#include <linux/module.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/config.h>
#include <linux/config.h>
#include <linux/cpufreq.h>
#include <linux/cpufreq.h>
...
@@ -54,8 +55,19 @@
...
@@ -54,8 +55,19 @@
#include "sa11xx_core.h"
#include "sa11xx_core.h"
#include "sa1100.h"
#include "sa1100.h"
#ifdef
PCMCIA_
DEBUG
#ifdef DEBUG
static
int
pc_debug
;
static
int
pc_debug
;
module_param
(
pc_debug
,
int
,
0644
);
#define debug(skt, lvl, fmt, arg...) do { \
if (pc_debug > (lvl)) \
printk(KERN_DEBUG "skt%u: %s: " fmt, \
(skt)->nr, __func__ , ## arg); \
} while (0)
#else
#define debug(skt, lvl, fmt, arg...) do { } while (0)
#endif
#endif
#define to_sa1100_socket(x) container_of(x, struct sa1100_pcmcia_socket, socket)
#define to_sa1100_socket(x) container_of(x, struct sa1100_pcmcia_socket, socket)
...
@@ -133,8 +145,8 @@ sa1100_pcmcia_set_mecr(struct sa1100_pcmcia_socket *skt, unsigned int cpu_clock)
...
@@ -133,8 +145,8 @@ sa1100_pcmcia_set_mecr(struct sa1100_pcmcia_socket *skt, unsigned int cpu_clock)
local_irq_restore
(
flags
);
local_irq_restore
(
flags
);
DEBUG
(
4
,
"%s(): sock %u
FAST %X BSM %X BSA %X BSIO %X
\n
"
,
debug
(
skt
,
2
,
"
FAST %X BSM %X BSA %X BSIO %X
\n
"
,
__FUNCTION__
,
skt
->
nr
,
MECR_FAST_GET
(
mecr
,
skt
->
nr
),
MECR_FAST_GET
(
mecr
,
skt
->
nr
),
MECR_BSM_GET
(
mecr
,
skt
->
nr
),
MECR_BSA_GET
(
mecr
,
skt
->
nr
),
MECR_BSM_GET
(
mecr
,
skt
->
nr
),
MECR_BSA_GET
(
mecr
,
skt
->
nr
),
MECR_BSIO_GET
(
mecr
,
skt
->
nr
));
MECR_BSIO_GET
(
mecr
,
skt
->
nr
));
...
@@ -221,7 +233,7 @@ static int sa1100_pcmcia_sock_init(struct pcmcia_socket *sock)
...
@@ -221,7 +233,7 @@ static int sa1100_pcmcia_sock_init(struct pcmcia_socket *sock)
{
{
struct
sa1100_pcmcia_socket
*
skt
=
to_sa1100_socket
(
sock
);
struct
sa1100_pcmcia_socket
*
skt
=
to_sa1100_socket
(
sock
);
DEBUG
(
2
,
"%s(): initializing socket %u
\n
"
,
__FUNCTION__
,
skt
->
nr
);
debug
(
skt
,
2
,
"initializing socket
\n
"
);
skt
->
ops
->
socket_init
(
skt
);
skt
->
ops
->
socket_init
(
skt
);
return
0
;
return
0
;
...
@@ -242,7 +254,7 @@ static int sa1100_pcmcia_suspend(struct pcmcia_socket *sock)
...
@@ -242,7 +254,7 @@ static int sa1100_pcmcia_suspend(struct pcmcia_socket *sock)
struct
sa1100_pcmcia_socket
*
skt
=
to_sa1100_socket
(
sock
);
struct
sa1100_pcmcia_socket
*
skt
=
to_sa1100_socket
(
sock
);
int
ret
;
int
ret
;
DEBUG
(
2
,
"%s(): suspending socket %u
\n
"
,
__FUNCTION__
,
skt
->
nr
);
debug
(
skt
,
2
,
"suspending socket
\n
"
);
ret
=
sa1100_pcmcia_config_skt
(
skt
,
&
dead_socket
);
ret
=
sa1100_pcmcia_config_skt
(
skt
,
&
dead_socket
);
if
(
ret
==
0
)
if
(
ret
==
0
)
...
@@ -260,7 +272,7 @@ static void sa1100_check_status(struct sa1100_pcmcia_socket *skt)
...
@@ -260,7 +272,7 @@ static void sa1100_check_status(struct sa1100_pcmcia_socket *skt)
{
{
unsigned
int
events
;
unsigned
int
events
;
DEBUG
(
4
,
"%s(): entering PCMCIA monitoring thread
\n
"
,
__FUNCTION__
);
debug
(
skt
,
4
,
"entering PCMCIA monitoring thread
\n
"
);
do
{
do
{
unsigned
int
status
;
unsigned
int
status
;
...
@@ -273,7 +285,7 @@ static void sa1100_check_status(struct sa1100_pcmcia_socket *skt)
...
@@ -273,7 +285,7 @@ static void sa1100_check_status(struct sa1100_pcmcia_socket *skt)
skt
->
status
=
status
;
skt
->
status
=
status
;
spin_unlock_irqrestore
(
&
status_lock
,
flags
);
spin_unlock_irqrestore
(
&
status_lock
,
flags
);
DEBUG
(
2
,
"events: %s%s%s%s%s%s
\n
"
,
debug
(
skt
,
4
,
"events: %s%s%s%s%s%s
\n
"
,
events
==
0
?
"<NONE>"
:
""
,
events
==
0
?
"<NONE>"
:
""
,
events
&
SS_DETECT
?
"DETECT "
:
""
,
events
&
SS_DETECT
?
"DETECT "
:
""
,
events
&
SS_READY
?
"READY "
:
""
,
events
&
SS_READY
?
"READY "
:
""
,
...
@@ -293,7 +305,7 @@ static void sa1100_check_status(struct sa1100_pcmcia_socket *skt)
...
@@ -293,7 +305,7 @@ static void sa1100_check_status(struct sa1100_pcmcia_socket *skt)
static
void
sa1100_pcmcia_poll_event
(
unsigned
long
dummy
)
static
void
sa1100_pcmcia_poll_event
(
unsigned
long
dummy
)
{
{
struct
sa1100_pcmcia_socket
*
skt
=
(
struct
sa1100_pcmcia_socket
*
)
dummy
;
struct
sa1100_pcmcia_socket
*
skt
=
(
struct
sa1100_pcmcia_socket
*
)
dummy
;
DEBUG
(
4
,
"%s(): polling for events
\n
"
,
__FUNCTION__
);
debug
(
skt
,
4
,
"polling for events
\n
"
);
mod_timer
(
&
skt
->
poll_timer
,
jiffies
+
SA1100_PCMCIA_POLL_PERIOD
);
mod_timer
(
&
skt
->
poll_timer
,
jiffies
+
SA1100_PCMCIA_POLL_PERIOD
);
...
@@ -314,7 +326,7 @@ static irqreturn_t sa1100_pcmcia_interrupt(int irq, void *dev, struct pt_regs *r
...
@@ -314,7 +326,7 @@ static irqreturn_t sa1100_pcmcia_interrupt(int irq, void *dev, struct pt_regs *r
{
{
struct
sa1100_pcmcia_socket
*
skt
=
dev
;
struct
sa1100_pcmcia_socket
*
skt
=
dev
;
DEBUG
(
3
,
"%s(): servicing IRQ %d
\n
"
,
__FUNCTION__
,
irq
);
debug
(
skt
,
3
,
"servicing IRQ %d
\n
"
,
irq
);
sa1100_check_status
(
skt
);
sa1100_check_status
(
skt
);
...
@@ -363,7 +375,7 @@ sa1100_pcmcia_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
...
@@ -363,7 +375,7 @@ sa1100_pcmcia_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
{
struct
sa1100_pcmcia_socket
*
skt
=
to_sa1100_socket
(
sock
);
struct
sa1100_pcmcia_socket
*
skt
=
to_sa1100_socket
(
sock
);
DEBUG
(
2
,
"%s() for sock %u
\n
"
,
__FUNCTION__
,
skt
->
nr
);
debug
(
skt
,
2
,
"
\n
"
);
*
state
=
skt
->
cs_state
;
*
state
=
skt
->
cs_state
;
...
@@ -385,22 +397,19 @@ sa1100_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
...
@@ -385,22 +397,19 @@ sa1100_pcmcia_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
{
struct
sa1100_pcmcia_socket
*
skt
=
to_sa1100_socket
(
sock
);
struct
sa1100_pcmcia_socket
*
skt
=
to_sa1100_socket
(
sock
);
DEBUG
(
2
,
"%s() for sock %u
\n
"
,
__FUNCTION__
,
skt
->
nr
);
debug
(
skt
,
2
,
"mask: %s%s%s%s%s%sflags: %s%s%s%s%s%sVcc %d Vpp %d irq %d
\n
"
,
(
state
->
csc_mask
==
0
)
?
"<NONE> "
:
""
,
DEBUG
(
3
,
"
\t
mask: %s%s%s%s%s%s
\n\t
flags: %s%s%s%s%s%s
\n
"
,
(
state
->
csc_mask
==
0
)
?
"<NONE>"
:
""
,
(
state
->
csc_mask
&
SS_DETECT
)
?
"DETECT "
:
""
,
(
state
->
csc_mask
&
SS_DETECT
)
?
"DETECT "
:
""
,
(
state
->
csc_mask
&
SS_READY
)
?
"READY "
:
""
,
(
state
->
csc_mask
&
SS_READY
)
?
"READY "
:
""
,
(
state
->
csc_mask
&
SS_BATDEAD
)
?
"BATDEAD "
:
""
,
(
state
->
csc_mask
&
SS_BATDEAD
)
?
"BATDEAD "
:
""
,
(
state
->
csc_mask
&
SS_BATWARN
)
?
"BATWARN "
:
""
,
(
state
->
csc_mask
&
SS_BATWARN
)
?
"BATWARN "
:
""
,
(
state
->
csc_mask
&
SS_STSCHG
)
?
"STSCHG "
:
""
,
(
state
->
csc_mask
&
SS_STSCHG
)
?
"STSCHG "
:
""
,
(
state
->
flags
==
0
)
?
"<NONE>"
:
""
,
(
state
->
flags
==
0
)
?
"<NONE>
"
:
""
,
(
state
->
flags
&
SS_PWR_AUTO
)
?
"PWR_AUTO "
:
""
,
(
state
->
flags
&
SS_PWR_AUTO
)
?
"PWR_AUTO "
:
""
,
(
state
->
flags
&
SS_IOCARD
)
?
"IOCARD "
:
""
,
(
state
->
flags
&
SS_IOCARD
)
?
"IOCARD "
:
""
,
(
state
->
flags
&
SS_RESET
)
?
"RESET "
:
""
,
(
state
->
flags
&
SS_RESET
)
?
"RESET "
:
""
,
(
state
->
flags
&
SS_SPKR_ENA
)
?
"SPKR_ENA "
:
""
,
(
state
->
flags
&
SS_SPKR_ENA
)
?
"SPKR_ENA "
:
""
,
(
state
->
flags
&
SS_OUTPUT_ENA
)
?
"OUTPUT_ENA "
:
""
);
(
state
->
flags
&
SS_OUTPUT_ENA
)
?
"OUTPUT_ENA "
:
""
,
DEBUG
(
3
,
"
\t
Vcc %d Vpp %d irq %d
\n
"
,
state
->
Vcc
,
state
->
Vpp
,
state
->
io_irq
);
state
->
Vcc
,
state
->
Vpp
,
state
->
io_irq
);
return
sa1100_pcmcia_config_skt
(
skt
,
state
);
return
sa1100_pcmcia_config_skt
(
skt
,
state
);
...
@@ -422,11 +431,9 @@ sa1100_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *map)
...
@@ -422,11 +431,9 @@ sa1100_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *map)
struct
sa1100_pcmcia_socket
*
skt
=
to_sa1100_socket
(
sock
);
struct
sa1100_pcmcia_socket
*
skt
=
to_sa1100_socket
(
sock
);
unsigned
short
speed
=
map
->
speed
;
unsigned
short
speed
=
map
->
speed
;
DEBUG
(
2
,
"%s() for sock %u
\n
"
,
__FUNCTION__
,
skt
->
nr
);
debug
(
skt
,
2
,
"map %u speed %u start 0x%08x stop 0x%08x
\n
"
,
DEBUG
(
3
,
"
\t
map %u speed %u
\n\t
start 0x%08x stop 0x%08x
\n
"
,
map
->
map
,
map
->
speed
,
map
->
start
,
map
->
stop
);
map
->
map
,
map
->
speed
,
map
->
start
,
map
->
stop
);
DEBUG
(
3
,
"
\t
flags: %s%s%s%s%s%s%s%s
\n
"
,
debug
(
skt
,
2
,
"
flags: %s%s%s%s%s%s%s%s
\n
"
,
(
map
->
flags
==
0
)
?
"<NONE>"
:
""
,
(
map
->
flags
==
0
)
?
"<NONE>"
:
""
,
(
map
->
flags
&
MAP_ACTIVE
)
?
"ACTIVE "
:
""
,
(
map
->
flags
&
MAP_ACTIVE
)
?
"ACTIVE "
:
""
,
(
map
->
flags
&
MAP_16BIT
)
?
"16BIT "
:
""
,
(
map
->
flags
&
MAP_16BIT
)
?
"16BIT "
:
""
,
...
@@ -479,11 +486,9 @@ sa1100_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map
...
@@ -479,11 +486,9 @@ sa1100_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *map
struct
resource
*
res
;
struct
resource
*
res
;
unsigned
short
speed
=
map
->
speed
;
unsigned
short
speed
=
map
->
speed
;
DEBUG
(
2
,
"%s() for sock %u
\n
"
,
__FUNCTION__
,
skt
->
nr
);
debug
(
skt
,
2
,
"map %u speed %u card_start %08x
\n
"
,
DEBUG
(
3
,
"
\t
map %u speed %u card_start %08x
\n
"
,
map
->
map
,
map
->
speed
,
map
->
card_start
);
map
->
map
,
map
->
speed
,
map
->
card_start
);
DEBUG
(
3
,
"
\t
flags: %s%s%s%s%s%s%s%s
\n
"
,
debug
(
skt
,
2
,
"
flags: %s%s%s%s%s%s%s%s
\n
"
,
(
map
->
flags
==
0
)
?
"<NONE>"
:
""
,
(
map
->
flags
==
0
)
?
"<NONE>"
:
""
,
(
map
->
flags
&
MAP_ACTIVE
)
?
"ACTIVE "
:
""
,
(
map
->
flags
&
MAP_ACTIVE
)
?
"ACTIVE "
:
""
,
(
map
->
flags
&
MAP_16BIT
)
?
"16BIT "
:
""
,
(
map
->
flags
&
MAP_16BIT
)
?
"16BIT "
:
""
,
...
@@ -920,23 +925,13 @@ sa1100_pcmcia_notifier(struct notifier_block *nb, unsigned long val,
...
@@ -920,23 +925,13 @@ sa1100_pcmcia_notifier(struct notifier_block *nb, unsigned long val,
switch
(
val
)
{
switch
(
val
)
{
case
CPUFREQ_PRECHANGE
:
case
CPUFREQ_PRECHANGE
:
if
(
freqs
->
new
>
freqs
->
old
)
{
if
(
freqs
->
new
>
freqs
->
old
)
DEBUG
(
2
,
"%s(): new frequency %u.%uMHz > %u.%uMHz, "
"pre-updating
\n
"
,
__FUNCTION__
,
freqs
->
new
/
1000
,
(
freqs
->
new
/
100
)
%
10
,
freqs
->
old
/
1000
,
(
freqs
->
old
/
100
)
%
10
);
sa1100_pcmcia_update_mecr
(
freqs
->
new
);
sa1100_pcmcia_update_mecr
(
freqs
->
new
);
}
break
;
break
;
case
CPUFREQ_POSTCHANGE
:
case
CPUFREQ_POSTCHANGE
:
if
(
freqs
->
new
<
freqs
->
old
)
{
if
(
freqs
->
new
<
freqs
->
old
)
DEBUG
(
2
,
"%s(): new frequency %u.%uMHz < %u.%uMHz, "
"post-updating
\n
"
,
__FUNCTION__
,
freqs
->
new
/
1000
,
(
freqs
->
new
/
100
)
%
10
,
freqs
->
old
/
1000
,
(
freqs
->
old
/
100
)
%
10
);
sa1100_pcmcia_update_mecr
(
freqs
->
new
);
sa1100_pcmcia_update_mecr
(
freqs
->
new
);
}
break
;
break
;
}
}
...
...
drivers/pcmcia/tcic.c
View file @
e004aaa1
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
======================================================================*/
======================================================================*/
#include <linux/module.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/fcntl.h>
...
@@ -55,14 +56,20 @@
...
@@ -55,14 +56,20 @@
#include <pcmcia/ss.h>
#include <pcmcia/ss.h>
#include "tcic.h"
#include "tcic.h"
#ifdef PCMCIA_DEBUG
#ifdef DEBUG
static
int
pc_debug
=
PCMCIA_DEBUG
;
static
int
pc_debug
;
module_param
(
pc_debug
,
int
,
0644
);
MODULE_PARM
(
pc_debug
,
"i"
);
MODULE_PARM
(
pc_debug
,
"i"
);
static
const
char
*
version
=
static
const
char
*
version
=
"tcic.c 1.111 2000/02/15 04:13:12 (David Hinds)"
;
"tcic.c 1.111 2000/02/15 04:13:12 (David Hinds)"
;
#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
#define debug(lvl, fmt, arg...) do { \
if (pc_debug > (lvl)) \
printk(KERN_DEBUG "tcic: " fmt , ## arg); \
} while (0)
#else
#else
#define
DEBUG(n, args...
)
#define
debug(lvl, fmt, arg...) do { } while (0
)
#endif
#endif
MODULE_AUTHOR
(
"David Hinds <dahinds@users.sourceforge.net>"
);
MODULE_AUTHOR
(
"David Hinds <dahinds@users.sourceforge.net>"
);
...
@@ -133,7 +140,7 @@ static struct tcic_socket socket_table[2];
...
@@ -133,7 +140,7 @@ static struct tcic_socket socket_table[2];
to map to irq 11, but is coded as 0 or 1 in the irq registers. */
to map to irq 11, but is coded as 0 or 1 in the irq registers. */
#define TCIC_IRQ(x) ((x) ? (((x) == 11) ? 1 : (x)) : 15)
#define TCIC_IRQ(x) ((x) ? (((x) == 11) ? 1 : (x)) : 15)
#ifdef
PCMCIA_
DEBUG_X
#ifdef DEBUG_X
static
u_char
tcic_getb
(
u_char
reg
)
static
u_char
tcic_getb
(
u_char
reg
)
{
{
u_char
val
=
inb
(
tcic_base
+
reg
);
u_char
val
=
inb
(
tcic_base
+
reg
);
...
@@ -168,7 +175,7 @@ static void tcic_setw(u_char reg, u_short data)
...
@@ -168,7 +175,7 @@ static void tcic_setw(u_char reg, u_short data)
static
void
tcic_setl
(
u_char
reg
,
u_int
data
)
static
void
tcic_setl
(
u_char
reg
,
u_int
data
)
{
{
#ifdef
PCMCIA_
DEBUG_X
#ifdef DEBUG_X
printk
(
KERN_DEBUG
"tcic_setl(%#x, %#lx)
\n
"
,
tcic_base
+
reg
,
data
);
printk
(
KERN_DEBUG
"tcic_setl(%#x, %#lx)
\n
"
,
tcic_base
+
reg
,
data
);
#endif
#endif
outw
(
data
&
0xffff
,
tcic_base
+
reg
);
outw
(
data
&
0xffff
,
tcic_base
+
reg
);
...
@@ -573,7 +580,7 @@ static irqreturn_t tcic_interrupt(int irq, void *dev, struct pt_regs *regs)
...
@@ -573,7 +580,7 @@ static irqreturn_t tcic_interrupt(int irq, void *dev, struct pt_regs *regs)
}
else
}
else
active
=
1
;
active
=
1
;
DEBUG
(
2
,
"tcic:
tcic_interrupt()
\n
"
);
debug
(
2
,
"
tcic_interrupt()
\n
"
);
for
(
i
=
0
;
i
<
sockets
;
i
++
)
{
for
(
i
=
0
;
i
<
sockets
;
i
++
)
{
psock
=
socket_table
[
i
].
psock
;
psock
=
socket_table
[
i
].
psock
;
...
@@ -610,13 +617,13 @@ static irqreturn_t tcic_interrupt(int irq, void *dev, struct pt_regs *regs)
...
@@ -610,13 +617,13 @@ static irqreturn_t tcic_interrupt(int irq, void *dev, struct pt_regs *regs)
}
}
active
=
0
;
active
=
0
;
DEBUG
(
2
,
"tcic:
interrupt done
\n
"
);
debug
(
2
,
"
interrupt done
\n
"
);
return
IRQ_HANDLED
;
return
IRQ_HANDLED
;
}
/* tcic_interrupt */
}
/* tcic_interrupt */
static
void
tcic_timer
(
u_long
data
)
static
void
tcic_timer
(
u_long
data
)
{
{
DEBUG
(
2
,
"tcic:
tcic_timer()
\n
"
);
debug
(
2
,
"
tcic_timer()
\n
"
);
tcic_timer_pending
=
0
;
tcic_timer_pending
=
0
;
tcic_interrupt
(
0
,
NULL
,
NULL
);
tcic_interrupt
(
0
,
NULL
,
NULL
);
}
/* tcic_timer */
}
/* tcic_timer */
...
@@ -643,7 +650,7 @@ static int tcic_get_status(struct pcmcia_socket *sock, u_int *value)
...
@@ -643,7 +650,7 @@ static int tcic_get_status(struct pcmcia_socket *sock, u_int *value)
reg
=
tcic_getb
(
TCIC_PWR
);
reg
=
tcic_getb
(
TCIC_PWR
);
if
(
reg
&
(
TCIC_PWR_VCC
(
psock
)
|
TCIC_PWR_VPP
(
psock
)))
if
(
reg
&
(
TCIC_PWR_VCC
(
psock
)
|
TCIC_PWR_VPP
(
psock
)))
*
value
|=
SS_POWERON
;
*
value
|=
SS_POWERON
;
DEBUG
(
1
,
"tcic:
GetStatus(%d) = %#2.2x
\n
"
,
psock
,
*
value
);
debug
(
1
,
"
GetStatus(%d) = %#2.2x
\n
"
,
psock
,
*
value
);
return
0
;
return
0
;
}
/* tcic_get_status */
}
/* tcic_get_status */
...
@@ -694,7 +701,7 @@ static int tcic_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
...
@@ -694,7 +701,7 @@ static int tcic_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
state
->
csc_mask
|=
(
scf2
&
TCIC_SCF2_MRDY
)
?
0
:
SS_READY
;
state
->
csc_mask
|=
(
scf2
&
TCIC_SCF2_MRDY
)
?
0
:
SS_READY
;
}
}
DEBUG
(
1
,
"tcic:
GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
debug
(
1
,
"
GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
"io_irq %d, csc_mask %#2.2x
\n
"
,
psock
,
state
->
flags
,
"io_irq %d, csc_mask %#2.2x
\n
"
,
psock
,
state
->
flags
,
state
->
Vcc
,
state
->
Vpp
,
state
->
io_irq
,
state
->
csc_mask
);
state
->
Vcc
,
state
->
Vpp
,
state
->
io_irq
,
state
->
csc_mask
);
return
0
;
return
0
;
...
@@ -708,7 +715,7 @@ static int tcic_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
...
@@ -708,7 +715,7 @@ static int tcic_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
u_char
reg
;
u_char
reg
;
u_short
scf1
,
scf2
;
u_short
scf1
,
scf2
;
DEBUG
(
1
,
"tcic:
SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, "
debug
(
1
,
"
SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, "
"io_irq %d, csc_mask %#2.2x)
\n
"
,
psock
,
state
->
flags
,
"io_irq %d, csc_mask %#2.2x)
\n
"
,
psock
,
state
->
flags
,
state
->
Vcc
,
state
->
Vpp
,
state
->
io_irq
,
state
->
csc_mask
);
state
->
Vcc
,
state
->
Vpp
,
state
->
io_irq
,
state
->
csc_mask
);
tcic_setw
(
TCIC_ADDR
+
2
,
(
psock
<<
TCIC_SS_SHFT
)
|
TCIC_ADR2_INDREG
);
tcic_setw
(
TCIC_ADDR
+
2
,
(
psock
<<
TCIC_SS_SHFT
)
|
TCIC_ADR2_INDREG
);
...
@@ -783,7 +790,7 @@ static int tcic_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io)
...
@@ -783,7 +790,7 @@ static int tcic_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io)
u_int
addr
;
u_int
addr
;
u_short
base
,
len
,
ioctl
;
u_short
base
,
len
,
ioctl
;
DEBUG
(
1
,
"tcic:
SetIOMap(%d, %d, %#2.2x, %d ns, "
debug
(
1
,
"
SetIOMap(%d, %d, %#2.2x, %d ns, "
"%#4.4x-%#4.4x)
\n
"
,
psock
,
io
->
map
,
io
->
flags
,
"%#4.4x-%#4.4x)
\n
"
,
psock
,
io
->
map
,
io
->
flags
,
io
->
speed
,
io
->
start
,
io
->
stop
);
io
->
speed
,
io
->
start
,
io
->
stop
);
if
((
io
->
map
>
1
)
||
(
io
->
start
>
0xffff
)
||
(
io
->
stop
>
0xffff
)
||
if
((
io
->
map
>
1
)
||
(
io
->
start
>
0xffff
)
||
(
io
->
stop
>
0xffff
)
||
...
@@ -820,7 +827,7 @@ static int tcic_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *m
...
@@ -820,7 +827,7 @@ static int tcic_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *m
u_short
addr
,
ctl
;
u_short
addr
,
ctl
;
u_long
base
,
len
,
mmap
;
u_long
base
,
len
,
mmap
;
DEBUG
(
1
,
"tcic:
SetMemMap(%d, %d, %#2.2x, %d ns, "
debug
(
1
,
"
SetMemMap(%d, %d, %#2.2x, %d ns, "
"%#5.5lx-%#5.5lx, %#5.5x)
\n
"
,
psock
,
mem
->
map
,
mem
->
flags
,
"%#5.5lx-%#5.5lx, %#5.5x)
\n
"
,
psock
,
mem
->
map
,
mem
->
flags
,
mem
->
speed
,
mem
->
sys_start
,
mem
->
sys_stop
,
mem
->
card_start
);
mem
->
speed
,
mem
->
sys_start
,
mem
->
sys_stop
,
mem
->
card_start
);
if
((
mem
->
map
>
3
)
||
(
mem
->
card_start
>
0x3ffffff
)
||
if
((
mem
->
map
>
3
)
||
(
mem
->
card_start
>
0x3ffffff
)
||
...
...
drivers/pcmcia/yenta_socket.c
View file @
e004aaa1
...
@@ -30,9 +30,9 @@
...
@@ -30,9 +30,9 @@
#if 0
#if 0
#define
DEBUG(x,args...) printk(KERN_DEBUG "%s: " x, __FUNCTION__
, ##args)
#define
debug(x,args...) printk(KERN_DEBUG "%s: " x, __func__
, ##args)
#else
#else
#define
DEBUG
(x,args...)
#define
debug
(x,args...)
#endif
#endif
/* Don't ask.. */
/* Don't ask.. */
...
@@ -47,13 +47,13 @@
...
@@ -47,13 +47,13 @@
static
inline
u32
cb_readl
(
struct
yenta_socket
*
socket
,
unsigned
reg
)
static
inline
u32
cb_readl
(
struct
yenta_socket
*
socket
,
unsigned
reg
)
{
{
u32
val
=
readl
(
socket
->
base
+
reg
);
u32
val
=
readl
(
socket
->
base
+
reg
);
DEBUG
(
"%p %04x %08x
\n
"
,
socket
,
reg
,
val
);
debug
(
"%p %04x %08x
\n
"
,
socket
,
reg
,
val
);
return
val
;
return
val
;
}
}
static
inline
void
cb_writel
(
struct
yenta_socket
*
socket
,
unsigned
reg
,
u32
val
)
static
inline
void
cb_writel
(
struct
yenta_socket
*
socket
,
unsigned
reg
,
u32
val
)
{
{
DEBUG
(
"%p %04x %08x
\n
"
,
socket
,
reg
,
val
);
debug
(
"%p %04x %08x
\n
"
,
socket
,
reg
,
val
);
writel
(
val
,
socket
->
base
+
reg
);
writel
(
val
,
socket
->
base
+
reg
);
}
}
...
@@ -61,7 +61,7 @@ static inline u8 config_readb(struct yenta_socket *socket, unsigned offset)
...
@@ -61,7 +61,7 @@ static inline u8 config_readb(struct yenta_socket *socket, unsigned offset)
{
{
u8
val
;
u8
val
;
pci_read_config_byte
(
socket
->
dev
,
offset
,
&
val
);
pci_read_config_byte
(
socket
->
dev
,
offset
,
&
val
);
DEBUG
(
"%p %04x %02x
\n
"
,
socket
,
offset
,
val
);
debug
(
"%p %04x %02x
\n
"
,
socket
,
offset
,
val
);
return
val
;
return
val
;
}
}
...
@@ -69,7 +69,7 @@ static inline u16 config_readw(struct yenta_socket *socket, unsigned offset)
...
@@ -69,7 +69,7 @@ static inline u16 config_readw(struct yenta_socket *socket, unsigned offset)
{
{
u16
val
;
u16
val
;
pci_read_config_word
(
socket
->
dev
,
offset
,
&
val
);
pci_read_config_word
(
socket
->
dev
,
offset
,
&
val
);
DEBUG
(
"%p %04x %04x
\n
"
,
socket
,
offset
,
val
);
debug
(
"%p %04x %04x
\n
"
,
socket
,
offset
,
val
);
return
val
;
return
val
;
}
}
...
@@ -77,32 +77,32 @@ static inline u32 config_readl(struct yenta_socket *socket, unsigned offset)
...
@@ -77,32 +77,32 @@ static inline u32 config_readl(struct yenta_socket *socket, unsigned offset)
{
{
u32
val
;
u32
val
;
pci_read_config_dword
(
socket
->
dev
,
offset
,
&
val
);
pci_read_config_dword
(
socket
->
dev
,
offset
,
&
val
);
DEBUG
(
"%p %04x %08x
\n
"
,
socket
,
offset
,
val
);
debug
(
"%p %04x %08x
\n
"
,
socket
,
offset
,
val
);
return
val
;
return
val
;
}
}
static
inline
void
config_writeb
(
struct
yenta_socket
*
socket
,
unsigned
offset
,
u8
val
)
static
inline
void
config_writeb
(
struct
yenta_socket
*
socket
,
unsigned
offset
,
u8
val
)
{
{
DEBUG
(
"%p %04x %02x
\n
"
,
socket
,
offset
,
val
);
debug
(
"%p %04x %02x
\n
"
,
socket
,
offset
,
val
);
pci_write_config_byte
(
socket
->
dev
,
offset
,
val
);
pci_write_config_byte
(
socket
->
dev
,
offset
,
val
);
}
}
static
inline
void
config_writew
(
struct
yenta_socket
*
socket
,
unsigned
offset
,
u16
val
)
static
inline
void
config_writew
(
struct
yenta_socket
*
socket
,
unsigned
offset
,
u16
val
)
{
{
DEBUG
(
"%p %04x %04x
\n
"
,
socket
,
offset
,
val
);
debug
(
"%p %04x %04x
\n
"
,
socket
,
offset
,
val
);
pci_write_config_word
(
socket
->
dev
,
offset
,
val
);
pci_write_config_word
(
socket
->
dev
,
offset
,
val
);
}
}
static
inline
void
config_writel
(
struct
yenta_socket
*
socket
,
unsigned
offset
,
u32
val
)
static
inline
void
config_writel
(
struct
yenta_socket
*
socket
,
unsigned
offset
,
u32
val
)
{
{
DEBUG
(
"%p %04x %08x
\n
"
,
socket
,
offset
,
val
);
debug
(
"%p %04x %08x
\n
"
,
socket
,
offset
,
val
);
pci_write_config_dword
(
socket
->
dev
,
offset
,
val
);
pci_write_config_dword
(
socket
->
dev
,
offset
,
val
);
}
}
static
inline
u8
exca_readb
(
struct
yenta_socket
*
socket
,
unsigned
reg
)
static
inline
u8
exca_readb
(
struct
yenta_socket
*
socket
,
unsigned
reg
)
{
{
u8
val
=
readb
(
socket
->
base
+
0x800
+
reg
);
u8
val
=
readb
(
socket
->
base
+
0x800
+
reg
);
DEBUG
(
"%p %04x %02x
\n
"
,
socket
,
reg
,
val
);
debug
(
"%p %04x %02x
\n
"
,
socket
,
reg
,
val
);
return
val
;
return
val
;
}
}
...
@@ -111,19 +111,19 @@ static inline u8 exca_readw(struct yenta_socket *socket, unsigned reg)
...
@@ -111,19 +111,19 @@ static inline u8 exca_readw(struct yenta_socket *socket, unsigned reg)
u16
val
;
u16
val
;
val
=
readb
(
socket
->
base
+
0x800
+
reg
);
val
=
readb
(
socket
->
base
+
0x800
+
reg
);
val
|=
readb
(
socket
->
base
+
0x800
+
reg
+
1
)
<<
8
;
val
|=
readb
(
socket
->
base
+
0x800
+
reg
+
1
)
<<
8
;
DEBUG
(
"%p %04x %04x
\n
"
,
socket
,
reg
,
val
);
debug
(
"%p %04x %04x
\n
"
,
socket
,
reg
,
val
);
return
val
;
return
val
;
}
}
static
inline
void
exca_writeb
(
struct
yenta_socket
*
socket
,
unsigned
reg
,
u8
val
)
static
inline
void
exca_writeb
(
struct
yenta_socket
*
socket
,
unsigned
reg
,
u8
val
)
{
{
DEBUG
(
"%p %04x %02x
\n
"
,
socket
,
reg
,
val
);
debug
(
"%p %04x %02x
\n
"
,
socket
,
reg
,
val
);
writeb
(
val
,
socket
->
base
+
0x800
+
reg
);
writeb
(
val
,
socket
->
base
+
0x800
+
reg
);
}
}
static
void
exca_writew
(
struct
yenta_socket
*
socket
,
unsigned
reg
,
u16
val
)
static
void
exca_writew
(
struct
yenta_socket
*
socket
,
unsigned
reg
,
u16
val
)
{
{
DEBUG
(
"%p %04x %04x
\n
"
,
socket
,
reg
,
val
);
debug
(
"%p %04x %04x
\n
"
,
socket
,
reg
,
val
);
writeb
(
val
,
socket
->
base
+
0x800
+
reg
);
writeb
(
val
,
socket
->
base
+
0x800
+
reg
);
writeb
(
val
>>
8
,
socket
->
base
+
0x800
+
reg
+
1
);
writeb
(
val
>>
8
,
socket
->
base
+
0x800
+
reg
+
1
);
}
}
...
...
include/pcmcia/cs.h
View file @
e004aaa1
...
@@ -422,8 +422,6 @@ enum service {
...
@@ -422,8 +422,6 @@ enum service {
};
};
int
pcmcia_access_configuration_register
(
client_handle_t
handle
,
conf_reg_t
*
reg
);
int
pcmcia_access_configuration_register
(
client_handle_t
handle
,
conf_reg_t
*
reg
);
int
pcmcia_bind_device
(
bind_req_t
*
req
);
int
pcmcia_bind_mtd
(
mtd_bind_t
*
req
);
int
pcmcia_deregister_client
(
client_handle_t
handle
);
int
pcmcia_deregister_client
(
client_handle_t
handle
);
int
pcmcia_get_configuration_info
(
client_handle_t
handle
,
config_info_t
*
config
);
int
pcmcia_get_configuration_info
(
client_handle_t
handle
,
config_info_t
*
config
);
int
pcmcia_get_card_services_info
(
servinfo_t
*
info
);
int
pcmcia_get_card_services_info
(
servinfo_t
*
info
);
...
@@ -447,10 +445,10 @@ int pcmcia_request_io(client_handle_t handle, io_req_t *req);
...
@@ -447,10 +445,10 @@ int pcmcia_request_io(client_handle_t handle, io_req_t *req);
int
pcmcia_request_irq
(
client_handle_t
handle
,
irq_req_t
*
req
);
int
pcmcia_request_irq
(
client_handle_t
handle
,
irq_req_t
*
req
);
int
pcmcia_request_window
(
client_handle_t
*
handle
,
win_req_t
*
req
,
window_handle_t
*
wh
);
int
pcmcia_request_window
(
client_handle_t
*
handle
,
win_req_t
*
req
,
window_handle_t
*
wh
);
int
pcmcia_reset_card
(
client_handle_t
handle
,
client_req_t
*
req
);
int
pcmcia_reset_card
(
client_handle_t
handle
,
client_req_t
*
req
);
int
pcmcia_suspend_card
(
client_handle_t
handle
,
client_req_t
*
req
);
int
pcmcia_suspend_card
(
struct
pcmcia_socket
*
skt
);
int
pcmcia_resume_card
(
client_handle_t
handle
,
client_req_t
*
req
);
int
pcmcia_resume_card
(
struct
pcmcia_socket
*
skt
);
int
pcmcia_eject_card
(
client_handle_t
handle
,
client_req_t
*
req
);
int
pcmcia_eject_card
(
struct
pcmcia_socket
*
skt
);
int
pcmcia_insert_card
(
client_handle_t
handle
,
client_req_t
*
req
);
int
pcmcia_insert_card
(
struct
pcmcia_socket
*
skt
);
int
pcmcia_set_event_mask
(
client_handle_t
handle
,
eventmask_t
*
mask
);
int
pcmcia_set_event_mask
(
client_handle_t
handle
,
eventmask_t
*
mask
);
int
pcmcia_report_error
(
client_handle_t
handle
,
error_info_t
*
err
);
int
pcmcia_report_error
(
client_handle_t
handle
,
error_info_t
*
err
);
struct
pci_bus
*
pcmcia_lookup_bus
(
client_handle_t
handle
);
struct
pci_bus
*
pcmcia_lookup_bus
(
client_handle_t
handle
);
...
...
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