Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
d23caa21
Commit
d23caa21
authored
Jul 03, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Plain Diff
Merge
bk://linux-pnp.bkbits.net/pnp-2.5
into home.osdl.org:/home/torvalds/v2.5/linux
parents
bf948e74
64ba4683
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
76 additions
and
16 deletions
+76
-16
drivers/pnp/interface.c
drivers/pnp/interface.c
+18
-4
drivers/pnp/manager.c
drivers/pnp/manager.c
+29
-8
drivers/pnp/resource.c
drivers/pnp/resource.c
+8
-0
drivers/pnp/support.c
drivers/pnp/support.c
+20
-4
include/linux/ioport.h
include/linux/ioport.h
+1
-0
No files found.
drivers/pnp/interface.c
View file @
d23caa21
...
...
@@ -259,7 +259,10 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
for
(
i
=
0
;
i
<
PNP_MAX_PORT
;
i
++
)
{
if
(
pnp_port_valid
(
dev
,
i
))
{
pnp_printf
(
buffer
,
"io"
);
pnp_printf
(
buffer
,
" 0x%lx-0x%lx
\n
"
,
if
(
pnp_port_flags
(
dev
,
i
)
&
IORESOURCE_DISABLED
)
pnp_printf
(
buffer
,
" disabled
\n
"
);
else
pnp_printf
(
buffer
,
" 0x%lx-0x%lx
\n
"
,
pnp_port_start
(
dev
,
i
),
pnp_port_end
(
dev
,
i
));
}
...
...
@@ -267,7 +270,10 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
for
(
i
=
0
;
i
<
PNP_MAX_MEM
;
i
++
)
{
if
(
pnp_mem_valid
(
dev
,
i
))
{
pnp_printf
(
buffer
,
"mem"
);
pnp_printf
(
buffer
,
" 0x%lx-0x%lx
\n
"
,
if
(
pnp_mem_flags
(
dev
,
i
)
&
IORESOURCE_DISABLED
)
pnp_printf
(
buffer
,
" disabled
\n
"
);
else
pnp_printf
(
buffer
,
" 0x%lx-0x%lx
\n
"
,
pnp_mem_start
(
dev
,
i
),
pnp_mem_end
(
dev
,
i
));
}
...
...
@@ -275,13 +281,21 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, char *buf)
for
(
i
=
0
;
i
<
PNP_MAX_IRQ
;
i
++
)
{
if
(
pnp_irq_valid
(
dev
,
i
))
{
pnp_printf
(
buffer
,
"irq"
);
pnp_printf
(
buffer
,
" %ld
\n
"
,
pnp_irq
(
dev
,
i
));
if
(
pnp_irq_flags
(
dev
,
i
)
&
IORESOURCE_DISABLED
)
pnp_printf
(
buffer
,
" disabled
\n
"
);
else
pnp_printf
(
buffer
,
" %ld
\n
"
,
pnp_irq
(
dev
,
i
));
}
}
for
(
i
=
0
;
i
<
PNP_MAX_DMA
;
i
++
)
{
if
(
pnp_dma_valid
(
dev
,
i
))
{
pnp_printf
(
buffer
,
"dma"
);
pnp_printf
(
buffer
,
" %ld
\n
"
,
pnp_dma
(
dev
,
i
));
if
(
pnp_dma_flags
(
dev
,
i
)
&
IORESOURCE_DISABLED
)
pnp_printf
(
buffer
,
" disabled
\n
"
);
else
pnp_printf
(
buffer
,
" %ld
\n
"
,
pnp_dma
(
dev
,
i
));
}
}
ret
=
(
buffer
->
curr
-
buf
);
...
...
drivers/pnp/manager.c
View file @
d23caa21
...
...
@@ -45,9 +45,15 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
flags
=
&
dev
->
res
.
port_resource
[
idx
].
flags
;
/* set the initial values */
*
flags
=
*
flags
|
rule
->
flags
|
IORESOURCE_IO
;
if
(
!
rule
->
size
)
{
*
flags
|=
IORESOURCE_DISABLED
;
return
1
;
/* skip disabled resource requests */
}
*
start
=
rule
->
min
;
*
end
=
*
start
+
rule
->
size
-
1
;
*
flags
=
*
flags
|
rule
->
flags
|
IORESOURCE_IO
;
/* run through until pnp_check_port is happy */
while
(
!
pnp_check_port
(
dev
,
idx
))
{
...
...
@@ -81,8 +87,6 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
flags
=
&
dev
->
res
.
mem_resource
[
idx
].
flags
;
/* set the initial values */
*
start
=
rule
->
min
;
*
end
=
*
start
+
rule
->
size
-
1
;
*
flags
=
*
flags
|
rule
->
flags
|
IORESOURCE_MEM
;
/* convert pnp flags to standard Linux flags */
...
...
@@ -95,6 +99,14 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
if
(
rule
->
flags
&
IORESOURCE_MEM_SHADOWABLE
)
*
flags
|=
IORESOURCE_SHADOWABLE
;
if
(
!
rule
->
size
)
{
*
flags
|=
IORESOURCE_DISABLED
;
return
1
;
/* skip disabled resource requests */
}
*
start
=
rule
->
min
;
*
end
=
*
start
+
rule
->
size
-
1
;
/* run through until pnp_check_mem is happy */
while
(
!
pnp_check_mem
(
dev
,
idx
))
{
*
start
+=
rule
->
align
;
...
...
@@ -135,6 +147,11 @@ static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx)
/* set the initial values */
*
flags
=
*
flags
|
rule
->
flags
|
IORESOURCE_IRQ
;
if
(
!
rule
->
map
)
{
*
flags
|=
IORESOURCE_DISABLED
;
return
1
;
/* skip disabled resource requests */
}
for
(
i
=
0
;
i
<
16
;
i
++
)
{
if
(
rule
->
map
&
(
1
<<
xtab
[
i
]))
{
*
start
=
*
end
=
xtab
[
i
];
...
...
@@ -175,6 +192,11 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
/* set the initial values */
*
flags
=
*
flags
|
rule
->
flags
|
IORESOURCE_DMA
;
if
(
!
rule
->
map
)
{
*
flags
|=
IORESOURCE_DISABLED
;
return
1
;
/* skip disabled resource requests */
}
for
(
i
=
0
;
i
<
8
;
i
++
)
{
if
(
rule
->
map
&
(
1
<<
xtab
[
i
]))
{
*
start
=
*
end
=
xtab
[
i
];
...
...
@@ -378,25 +400,24 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table * res,
dev
->
res
=
*
res
;
if
(
!
(
mode
&
PNP_CONFIG_FORCE
))
{
for
(
i
=
0
;
i
<
PNP_MAX_PORT
;
i
++
)
{
if
(
pnp_check_port
(
dev
,
i
))
if
(
!
pnp_check_port
(
dev
,
i
))
goto
fail
;
}
for
(
i
=
0
;
i
<
PNP_MAX_MEM
;
i
++
)
{
if
(
pnp_check_mem
(
dev
,
i
))
if
(
!
pnp_check_mem
(
dev
,
i
))
goto
fail
;
}
for
(
i
=
0
;
i
<
PNP_MAX_IRQ
;
i
++
)
{
if
(
pnp_check_irq
(
dev
,
i
))
if
(
!
pnp_check_irq
(
dev
,
i
))
goto
fail
;
}
for
(
i
=
0
;
i
<
PNP_MAX_DMA
;
i
++
)
{
if
(
pnp_check_dma
(
dev
,
i
))
if
(
!
pnp_check_dma
(
dev
,
i
))
goto
fail
;
}
}
up
(
&
pnp_res_mutex
);
pnp_auto_config_dev
(
dev
);
kfree
(
bak
);
return
0
;
...
...
drivers/pnp/resource.c
View file @
d23caa21
...
...
@@ -286,6 +286,8 @@ int pnp_check_port(struct pnp_dev * dev, int idx)
continue
;
for
(
tmp
=
0
;
tmp
<
PNP_MAX_PORT
;
tmp
++
)
{
if
(
tdev
->
res
.
port_resource
[
tmp
].
flags
&
IORESOURCE_IO
)
{
if
(
pnp_port_flags
(
dev
,
tmp
)
&
IORESOURCE_DISABLED
)
continue
;
tport
=
&
tdev
->
res
.
port_resource
[
tmp
].
start
;
tend
=
&
tdev
->
res
.
port_resource
[
tmp
].
end
;
if
(
ranged_conflict
(
port
,
end
,
tport
,
tend
))
...
...
@@ -340,6 +342,8 @@ int pnp_check_mem(struct pnp_dev * dev, int idx)
continue
;
for
(
tmp
=
0
;
tmp
<
PNP_MAX_MEM
;
tmp
++
)
{
if
(
tdev
->
res
.
mem_resource
[
tmp
].
flags
&
IORESOURCE_MEM
)
{
if
(
pnp_mem_flags
(
dev
,
tmp
)
&
IORESOURCE_DISABLED
)
continue
;
taddr
=
&
tdev
->
res
.
mem_resource
[
tmp
].
start
;
tend
=
&
tdev
->
res
.
mem_resource
[
tmp
].
end
;
if
(
ranged_conflict
(
addr
,
end
,
taddr
,
tend
))
...
...
@@ -409,6 +413,8 @@ int pnp_check_irq(struct pnp_dev * dev, int idx)
continue
;
for
(
tmp
=
0
;
tmp
<
PNP_MAX_IRQ
;
tmp
++
)
{
if
(
tdev
->
res
.
irq_resource
[
tmp
].
flags
&
IORESOURCE_IRQ
)
{
if
(
pnp_irq_flags
(
dev
,
tmp
)
&
IORESOURCE_DISABLED
)
continue
;
if
((
tdev
->
res
.
irq_resource
[
tmp
].
start
==
*
irq
))
return
0
;
}
...
...
@@ -462,6 +468,8 @@ int pnp_check_dma(struct pnp_dev * dev, int idx)
continue
;
for
(
tmp
=
0
;
tmp
<
PNP_MAX_DMA
;
tmp
++
)
{
if
(
tdev
->
res
.
dma_resource
[
tmp
].
flags
&
IORESOURCE_DMA
)
{
if
(
pnp_dma_flags
(
dev
,
tmp
)
&
IORESOURCE_DISABLED
)
continue
;
if
((
tdev
->
res
.
dma_resource
[
tmp
].
start
==
*
dma
))
return
0
;
}
...
...
drivers/pnp/support.c
View file @
d23caa21
...
...
@@ -68,9 +68,13 @@ static void current_irqresource(struct pnp_resource_table * res, int irq)
int
i
=
0
;
while
((
res
->
irq_resource
[
i
].
flags
&
IORESOURCE_IRQ
)
&&
i
<
PNP_MAX_IRQ
)
i
++
;
if
(
i
<
PNP_MAX_IRQ
)
{
res
->
irq_resource
[
i
].
flags
=
IORESOURCE_IRQ
;
// Also clears _UNSET flag
if
(
irq
==
-
1
)
{
res
->
irq_resource
[
i
].
flags
|=
IORESOURCE_DISABLED
;
return
;
}
res
->
irq_resource
[
i
].
start
=
res
->
irq_resource
[
i
].
end
=
(
unsigned
long
)
irq
;
res
->
irq_resource
[
i
].
flags
=
IORESOURCE_IRQ
;
// Also clears _UNSET flag
}
}
...
...
@@ -79,9 +83,13 @@ static void current_dmaresource(struct pnp_resource_table * res, int dma)
int
i
=
0
;
while
((
res
->
dma_resource
[
i
].
flags
&
IORESOURCE_DMA
)
&&
i
<
PNP_MAX_DMA
)
i
++
;
if
(
i
<
PNP_MAX_DMA
)
{
res
->
dma_resource
[
i
].
flags
=
IORESOURCE_DMA
;
// Also clears _UNSET flag
if
(
dma
==
-
1
)
{
res
->
dma_resource
[
i
].
flags
|=
IORESOURCE_DISABLED
;
return
;
}
res
->
dma_resource
[
i
].
start
=
res
->
dma_resource
[
i
].
end
=
(
unsigned
long
)
dma
;
res
->
dma_resource
[
i
].
flags
=
IORESOURCE_DMA
;
// Also clears _UNSET flag
}
}
...
...
@@ -90,9 +98,13 @@ static void current_ioresource(struct pnp_resource_table * res, int io, int len)
int
i
=
0
;
while
((
res
->
port_resource
[
i
].
flags
&
IORESOURCE_IO
)
&&
i
<
PNP_MAX_PORT
)
i
++
;
if
(
i
<
PNP_MAX_PORT
)
{
res
->
port_resource
[
i
].
flags
=
IORESOURCE_IO
;
// Also clears _UNSET flag
if
(
len
<=
0
||
(
io
+
len
-
1
)
>=
0x10003
)
{
res
->
port_resource
[
i
].
flags
|=
IORESOURCE_DISABLED
;
return
;
}
res
->
port_resource
[
i
].
start
=
(
unsigned
long
)
io
;
res
->
port_resource
[
i
].
end
=
(
unsigned
long
)(
io
+
len
-
1
);
res
->
port_resource
[
i
].
flags
=
IORESOURCE_IO
;
// Also clears _UNSET flag
}
}
...
...
@@ -101,9 +113,13 @@ static void current_memresource(struct pnp_resource_table * res, int mem, int le
int
i
=
0
;
while
((
res
->
mem_resource
[
i
].
flags
&
IORESOURCE_MEM
)
&&
i
<
PNP_MAX_MEM
)
i
++
;
if
(
i
<
PNP_MAX_MEM
)
{
res
->
mem_resource
[
i
].
flags
=
IORESOURCE_MEM
;
// Also clears _UNSET flag
if
(
len
<=
0
)
{
res
->
mem_resource
[
i
].
flags
|=
IORESOURCE_DISABLED
;
return
;
}
res
->
mem_resource
[
i
].
start
=
(
unsigned
long
)
mem
;
res
->
mem_resource
[
i
].
end
=
(
unsigned
long
)(
mem
+
len
-
1
);
res
->
mem_resource
[
i
].
flags
=
IORESOURCE_MEM
;
// Also clears _UNSET flag
}
}
...
...
include/linux/ioport.h
View file @
d23caa21
...
...
@@ -43,6 +43,7 @@ struct resource_list {
#define IORESOURCE_SHADOWABLE 0x00010000
#define IORESOURCE_BUS_HAS_VGA 0x00080000
#define IORESOURCE_DISABLED 0x10000000
#define IORESOURCE_UNSET 0x20000000
#define IORESOURCE_AUTO 0x40000000
#define IORESOURCE_BUSY 0x80000000
/* Driver has marked this resource busy */
...
...
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