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
23bcbf1b
Commit
23bcbf1b
authored
Dec 10, 2010
by
David S. Miller
Browse files
Options
Browse Files
Download
Plain Diff
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/sparc-2.6
parents
6313e3c2
595a251c
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
64 additions
and
409 deletions
+64
-409
arch/sparc/include/asm/openprom.h
arch/sparc/include/asm/openprom.h
+1
-1
arch/sparc/include/asm/oplib_32.h
arch/sparc/include/asm/oplib_32.h
+2
-33
arch/sparc/include/asm/oplib_64.h
arch/sparc/include/asm/oplib_64.h
+2
-44
arch/sparc/kernel/leon_kernel.c
arch/sparc/kernel/leon_kernel.c
+2
-2
arch/sparc/prom/Makefile
arch/sparc/prom/Makefile
+0
-1
arch/sparc/prom/console_32.c
arch/sparc/prom/console_32.c
+12
-53
arch/sparc/prom/console_64.c
arch/sparc/prom/console_64.c
+15
-66
arch/sparc/prom/devops_32.c
arch/sparc/prom/devops_32.c
+0
-87
arch/sparc/prom/devops_64.c
arch/sparc/prom/devops_64.c
+0
-67
arch/sparc/prom/misc_64.c
arch/sparc/prom/misc_64.c
+1
-15
arch/sparc/prom/printf.c
arch/sparc/prom/printf.c
+29
-6
arch/sparc/prom/tree_32.c
arch/sparc/prom/tree_32.c
+0
-16
arch/sparc/prom/tree_64.c
arch/sparc/prom/tree_64.c
+0
-18
No files found.
arch/sparc/include/asm/openprom.h
View file @
23bcbf1b
...
@@ -39,7 +39,7 @@ struct linux_dev_v2_funcs {
...
@@ -39,7 +39,7 @@ struct linux_dev_v2_funcs {
int
(
*
v2_dev_open
)(
char
*
devpath
);
int
(
*
v2_dev_open
)(
char
*
devpath
);
void
(
*
v2_dev_close
)(
int
d
);
void
(
*
v2_dev_close
)(
int
d
);
int
(
*
v2_dev_read
)(
int
d
,
char
*
buf
,
int
nbytes
);
int
(
*
v2_dev_read
)(
int
d
,
char
*
buf
,
int
nbytes
);
int
(
*
v2_dev_write
)(
int
d
,
char
*
buf
,
int
nbytes
);
int
(
*
v2_dev_write
)(
int
d
,
c
onst
c
har
*
buf
,
int
nbytes
);
int
(
*
v2_dev_seek
)(
int
d
,
int
hi
,
int
lo
);
int
(
*
v2_dev_seek
)(
int
d
,
int
hi
,
int
lo
);
/* Never issued (multistage load support) */
/* Never issued (multistage load support) */
...
...
arch/sparc/include/asm/oplib_32.h
View file @
23bcbf1b
...
@@ -60,25 +60,6 @@ extern char *prom_getbootargs(void);
...
@@ -60,25 +60,6 @@ extern char *prom_getbootargs(void);
extern
char
*
prom_mapio
(
char
*
virt_hint
,
int
io_space
,
unsigned
int
phys_addr
,
unsigned
int
num_bytes
);
extern
char
*
prom_mapio
(
char
*
virt_hint
,
int
io_space
,
unsigned
int
phys_addr
,
unsigned
int
num_bytes
);
extern
void
prom_unmapio
(
char
*
virt_addr
,
unsigned
int
num_bytes
);
extern
void
prom_unmapio
(
char
*
virt_addr
,
unsigned
int
num_bytes
);
/* Device operations. */
/* Open the device described by the passed string. Note, that the format
* of the string is different on V0 vs. V2->higher proms. The caller must
* know what he/she is doing! Returns the device descriptor, an int.
*/
extern
int
prom_devopen
(
char
*
device_string
);
/* Close a previously opened device described by the passed integer
* descriptor.
*/
extern
int
prom_devclose
(
int
device_handle
);
/* Do a seek operation on the device described by the passed integer
* descriptor.
*/
extern
void
prom_seek
(
int
device_handle
,
unsigned
int
seek_hival
,
unsigned
int
seek_lowval
);
/* Miscellaneous routines, don't really fit in any category per se. */
/* Miscellaneous routines, don't really fit in any category per se. */
/* Reboot the machine with the command line passed. */
/* Reboot the machine with the command line passed. */
...
@@ -121,19 +102,8 @@ extern int prom_getrev(void);
...
@@ -121,19 +102,8 @@ extern int prom_getrev(void);
/* Get the prom firmware revision. */
/* Get the prom firmware revision. */
extern
int
prom_getprev
(
void
);
extern
int
prom_getprev
(
void
);
/* Character operations to/from the console.... */
/* Write a buffer of characters to the console. */
extern
void
prom_console_write_buf
(
const
char
*
buf
,
int
len
);
/* Non-blocking get character from console. */
extern
int
prom_nbgetchar
(
void
);
/* Non-blocking put character to console. */
extern
int
prom_nbputchar
(
char
character
);
/* Blocking get character from console. */
extern
char
prom_getchar
(
void
);
/* Blocking put character to console. */
extern
void
prom_putchar
(
char
character
);
/* Prom's internal routines, don't use in kernel/boot code. */
/* Prom's internal routines, don't use in kernel/boot code. */
extern
void
prom_printf
(
const
char
*
fmt
,
...);
extern
void
prom_printf
(
const
char
*
fmt
,
...);
...
@@ -238,7 +208,6 @@ extern int prom_node_has_property(phandle node, char *property);
...
@@ -238,7 +208,6 @@ extern int prom_node_has_property(phandle node, char *property);
extern
int
prom_setprop
(
phandle
node
,
const
char
*
prop_name
,
char
*
prop_value
,
extern
int
prom_setprop
(
phandle
node
,
const
char
*
prop_name
,
char
*
prop_value
,
int
value_size
);
int
value_size
);
extern
phandle
prom_pathtoinode
(
char
*
path
);
extern
phandle
prom_inst2pkg
(
int
);
extern
phandle
prom_inst2pkg
(
int
);
/* Dorking with Bus ranges... */
/* Dorking with Bus ranges... */
...
...
arch/sparc/include/asm/oplib_64.h
View file @
23bcbf1b
...
@@ -67,27 +67,6 @@ extern void prom_init(void *cif_handler, void *cif_stack);
...
@@ -67,27 +67,6 @@ extern void prom_init(void *cif_handler, void *cif_stack);
/* Boot argument acquisition, returns the boot command line string. */
/* Boot argument acquisition, returns the boot command line string. */
extern
char
*
prom_getbootargs
(
void
);
extern
char
*
prom_getbootargs
(
void
);
/* Device utilities. */
/* Device operations. */
/* Open the device described by the passed string. Note, that the format
* of the string is different on V0 vs. V2->higher proms. The caller must
* know what he/she is doing! Returns the device descriptor, an int.
*/
extern
int
prom_devopen
(
const
char
*
device_string
);
/* Close a previously opened device described by the passed integer
* descriptor.
*/
extern
int
prom_devclose
(
int
device_handle
);
/* Do a seek operation on the device described by the passed integer
* descriptor.
*/
extern
void
prom_seek
(
int
device_handle
,
unsigned
int
seek_hival
,
unsigned
int
seek_lowval
);
/* Miscellaneous routines, don't really fit in any category per se. */
/* Miscellaneous routines, don't really fit in any category per se. */
/* Reboot the machine with the command line passed. */
/* Reboot the machine with the command line passed. */
...
@@ -109,33 +88,14 @@ extern void prom_halt(void) __attribute__ ((noreturn));
...
@@ -109,33 +88,14 @@ extern void prom_halt(void) __attribute__ ((noreturn));
/* Halt and power-off the machine. */
/* Halt and power-off the machine. */
extern
void
prom_halt_power_off
(
void
)
__attribute__
((
noreturn
));
extern
void
prom_halt_power_off
(
void
)
__attribute__
((
noreturn
));
/* Set the PROM 'sync' callback function to the passed function pointer.
* When the user gives the 'sync' command at the prom prompt while the
* kernel is still active, the prom will call this routine.
*
*/
typedef
int
(
*
callback_func_t
)(
long
*
cmd
);
extern
void
prom_setcallback
(
callback_func_t
func_ptr
);
/* Acquire the IDPROM of the root node in the prom device tree. This
/* Acquire the IDPROM of the root node in the prom device tree. This
* gets passed a buffer where you would like it stuffed. The return value
* gets passed a buffer where you would like it stuffed. The return value
* is the format type of this idprom or 0xff on error.
* is the format type of this idprom or 0xff on error.
*/
*/
extern
unsigned
char
prom_get_idprom
(
char
*
idp_buffer
,
int
idpbuf_size
);
extern
unsigned
char
prom_get_idprom
(
char
*
idp_buffer
,
int
idpbuf_size
);
/* Character operations to/from the console.... */
/* Write a buffer of characters to the console. */
extern
void
prom_console_write_buf
(
const
char
*
buf
,
int
len
);
/* Non-blocking get character from console. */
extern
int
prom_nbgetchar
(
void
);
/* Non-blocking put character to console. */
extern
int
prom_nbputchar
(
char
character
);
/* Blocking get character from console. */
extern
char
prom_getchar
(
void
);
/* Blocking put character to console. */
extern
void
prom_putchar
(
char
character
);
/* Prom's internal routines, don't use in kernel/boot code. */
/* Prom's internal routines, don't use in kernel/boot code. */
extern
void
prom_printf
(
const
char
*
fmt
,
...);
extern
void
prom_printf
(
const
char
*
fmt
,
...);
...
@@ -279,9 +239,7 @@ extern phandle prom_finddevice(const char *name);
...
@@ -279,9 +239,7 @@ extern phandle prom_finddevice(const char *name);
extern
int
prom_setprop
(
phandle
node
,
const
char
*
prop_name
,
char
*
prop_value
,
extern
int
prom_setprop
(
phandle
node
,
const
char
*
prop_name
,
char
*
prop_value
,
int
value_size
);
int
value_size
);
extern
phandle
prom_pathtoinode
(
const
char
*
path
);
extern
phandle
prom_inst2pkg
(
int
);
extern
phandle
prom_inst2pkg
(
int
);
extern
int
prom_service_exists
(
const
char
*
service_name
);
extern
void
prom_sun4v_guest_soft_state
(
void
);
extern
void
prom_sun4v_guest_soft_state
(
void
);
extern
int
prom_ihandle2path
(
int
handle
,
char
*
buffer
,
int
bufsize
);
extern
int
prom_ihandle2path
(
int
handle
,
char
*
buffer
,
int
bufsize
);
...
...
arch/sparc/kernel/leon_kernel.c
View file @
23bcbf1b
...
@@ -114,7 +114,7 @@ void __init leon_init_timers(irq_handler_t counter_fn)
...
@@ -114,7 +114,7 @@ void __init leon_init_timers(irq_handler_t counter_fn)
if
(
leon3_gptimer_regs
&&
leon3_irqctrl_regs
)
{
if
(
leon3_gptimer_regs
&&
leon3_irqctrl_regs
)
{
LEON3_BYPASS_STORE_PA
(
&
leon3_gptimer_regs
->
e
[
0
].
val
,
0
);
LEON3_BYPASS_STORE_PA
(
&
leon3_gptimer_regs
->
e
[
0
].
val
,
0
);
LEON3_BYPASS_STORE_PA
(
&
leon3_gptimer_regs
->
e
[
0
].
rld
,
LEON3_BYPASS_STORE_PA
(
&
leon3_gptimer_regs
->
e
[
0
].
rld
,
(((
1000000
/
100
)
-
1
)));
(((
1000000
/
HZ
)
-
1
)));
LEON3_BYPASS_STORE_PA
(
&
leon3_gptimer_regs
->
e
[
0
].
ctrl
,
0
);
LEON3_BYPASS_STORE_PA
(
&
leon3_gptimer_regs
->
e
[
0
].
ctrl
,
0
);
#ifdef CONFIG_SMP
#ifdef CONFIG_SMP
...
@@ -128,7 +128,7 @@ void __init leon_init_timers(irq_handler_t counter_fn)
...
@@ -128,7 +128,7 @@ void __init leon_init_timers(irq_handler_t counter_fn)
}
}
LEON3_BYPASS_STORE_PA
(
&
leon3_gptimer_regs
->
e
[
1
].
val
,
0
);
LEON3_BYPASS_STORE_PA
(
&
leon3_gptimer_regs
->
e
[
1
].
val
,
0
);
LEON3_BYPASS_STORE_PA
(
&
leon3_gptimer_regs
->
e
[
1
].
rld
,
(((
1000000
/
100
)
-
1
)));
LEON3_BYPASS_STORE_PA
(
&
leon3_gptimer_regs
->
e
[
1
].
rld
,
(((
1000000
/
HZ
)
-
1
)));
LEON3_BYPASS_STORE_PA
(
&
leon3_gptimer_regs
->
e
[
1
].
ctrl
,
0
);
LEON3_BYPASS_STORE_PA
(
&
leon3_gptimer_regs
->
e
[
1
].
ctrl
,
0
);
# endif
# endif
...
...
arch/sparc/prom/Makefile
View file @
23bcbf1b
...
@@ -6,7 +6,6 @@ ccflags := -Werror
...
@@ -6,7 +6,6 @@ ccflags := -Werror
lib-y
:=
bootstr_
$(BITS)
.o
lib-y
:=
bootstr_
$(BITS)
.o
lib-$(CONFIG_SPARC32)
+=
devmap.o
lib-$(CONFIG_SPARC32)
+=
devmap.o
lib-y
+=
devops_
$(BITS)
.o
lib-y
+=
init_
$(BITS)
.o
lib-y
+=
init_
$(BITS)
.o
lib-$(CONFIG_SPARC32)
+=
memory.o
lib-$(CONFIG_SPARC32)
+=
memory.o
lib-y
+=
misc_
$(BITS)
.o
lib-y
+=
misc_
$(BITS)
.o
...
...
arch/sparc/prom/console_32.c
View file @
23bcbf1b
...
@@ -16,63 +16,26 @@
...
@@ -16,63 +16,26 @@
extern
void
restore_current
(
void
);
extern
void
restore_current
(
void
);
/* Non blocking get character from console input device, returns -1
* if no input was taken. This can be used for polling.
*/
int
prom_nbgetchar
(
void
)
{
static
char
inc
;
int
i
=
-
1
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
prom_lock
,
flags
);
switch
(
prom_vers
)
{
case
PROM_V0
:
i
=
(
*
(
romvec
->
pv_nbgetchar
))();
break
;
case
PROM_V2
:
case
PROM_V3
:
if
(
(
*
(
romvec
->
pv_v2devops
).
v2_dev_read
)(
*
romvec
->
pv_v2bootargs
.
fd_stdin
,
&
inc
,
0x1
)
==
1
)
{
i
=
inc
;
}
else
{
i
=
-
1
;
}
break
;
default:
i
=
-
1
;
break
;
};
restore_current
();
spin_unlock_irqrestore
(
&
prom_lock
,
flags
);
return
i
;
/* Ugh, we could spin forever on unsupported proms ;( */
}
/* Non blocking put character to console device, returns -1 if
/* Non blocking put character to console device, returns -1 if
* unsuccessful.
* unsuccessful.
*/
*/
int
static
int
prom_nbputchar
(
const
char
*
buf
)
prom_nbputchar
(
char
c
)
{
{
static
char
outc
;
unsigned
long
flags
;
unsigned
long
flags
;
int
i
=
-
1
;
int
i
=
-
1
;
spin_lock_irqsave
(
&
prom_lock
,
flags
);
spin_lock_irqsave
(
&
prom_lock
,
flags
);
switch
(
prom_vers
)
{
switch
(
prom_vers
)
{
case
PROM_V0
:
case
PROM_V0
:
i
=
(
*
(
romvec
->
pv_nbputchar
))(
c
);
i
=
(
*
(
romvec
->
pv_nbputchar
))(
*
buf
);
break
;
break
;
case
PROM_V2
:
case
PROM_V2
:
case
PROM_V3
:
case
PROM_V3
:
outc
=
c
;
if
((
*
(
romvec
->
pv_v2devops
).
v2_dev_write
)(
*
romvec
->
pv_v2bootargs
.
fd_stdout
,
if
(
(
*
(
romvec
->
pv_v2devops
).
v2_dev_write
)(
*
romvec
->
pv_v2bootargs
.
fd_stdout
,
&
outc
,
0x1
)
==
1
)
buf
,
0x1
)
==
1
)
i
=
0
;
i
=
0
;
else
i
=
-
1
;
break
;
break
;
default:
default:
i
=
-
1
;
break
;
break
;
};
};
restore_current
();
restore_current
();
...
@@ -80,18 +43,14 @@ prom_nbputchar(char c)
...
@@ -80,18 +43,14 @@ prom_nbputchar(char c)
return
i
;
/* Ugh, we could spin forever on unsupported proms ;( */
return
i
;
/* Ugh, we could spin forever on unsupported proms ;( */
}
}
/* Blocking version of get character routine above. */
void
prom_console_write_buf
(
const
char
*
buf
,
int
len
)
char
prom_getchar
(
void
)
{
{
int
character
;
while
(
len
)
{
while
((
character
=
prom_nbgetchar
())
==
-
1
)
;
int
n
=
prom_nbputchar
(
buf
);
return
(
char
)
character
;
if
(
n
)
continue
;
len
--
;
buf
++
;
}
}
}
/* Blocking version of put character routine above. */
void
prom_putchar
(
char
c
)
{
while
(
prom_nbputchar
(
c
)
==
-
1
)
;
}
arch/sparc/prom/console_64.c
View file @
23bcbf1b
...
@@ -15,85 +15,34 @@
...
@@ -15,85 +15,34 @@
extern
int
prom_stdin
,
prom_stdout
;
extern
int
prom_stdin
,
prom_stdout
;
/* Non blocking get character from console input device, returns -1
static
int
__prom_console_write_buf
(
const
char
*
buf
,
int
len
)
* if no input was taken. This can be used for polling.
*/
inline
int
prom_nbgetchar
(
void
)
{
unsigned
long
args
[
7
];
char
inc
;
args
[
0
]
=
(
unsigned
long
)
"read"
;
args
[
1
]
=
3
;
args
[
2
]
=
1
;
args
[
3
]
=
(
unsigned
int
)
prom_stdin
;
args
[
4
]
=
(
unsigned
long
)
&
inc
;
args
[
5
]
=
1
;
args
[
6
]
=
(
unsigned
long
)
-
1
;
p1275_cmd_direct
(
args
);
if
(
args
[
6
]
==
1
)
return
inc
;
return
-
1
;
}
/* Non blocking put character to console device, returns -1 if
* unsuccessful.
*/
inline
int
prom_nbputchar
(
char
c
)
{
{
unsigned
long
args
[
7
];
unsigned
long
args
[
7
];
char
outc
;
int
ret
;
outc
=
c
;
args
[
0
]
=
(
unsigned
long
)
"write"
;
args
[
0
]
=
(
unsigned
long
)
"write"
;
args
[
1
]
=
3
;
args
[
1
]
=
3
;
args
[
2
]
=
1
;
args
[
2
]
=
1
;
args
[
3
]
=
(
unsigned
int
)
prom_stdout
;
args
[
3
]
=
(
unsigned
int
)
prom_stdout
;
args
[
4
]
=
(
unsigned
long
)
&
outc
;
args
[
4
]
=
(
unsigned
long
)
buf
;
args
[
5
]
=
1
;
args
[
5
]
=
(
unsigned
int
)
len
;
args
[
6
]
=
(
unsigned
long
)
-
1
;
args
[
6
]
=
(
unsigned
long
)
-
1
;
p1275_cmd_direct
(
args
);
p1275_cmd_direct
(
args
);
if
(
args
[
6
]
==
1
)
ret
=
(
int
)
args
[
6
];
return
0
;
if
(
ret
<
0
)
else
return
-
1
;
return
-
1
;
return
ret
;
}
}
/* Blocking version of get character routine above. */
void
prom_console_write_buf
(
const
char
*
buf
,
int
len
)
char
prom_getchar
(
void
)
{
int
character
;
while
((
character
=
prom_nbgetchar
())
==
-
1
)
;
return
(
char
)
character
;
}
/* Blocking version of put character routine above. */
void
prom_putchar
(
char
c
)
{
{
prom_nbputchar
(
c
);
while
(
len
)
{
}
int
n
=
__prom_console_write_buf
(
buf
,
len
);
if
(
n
<
0
)
void
continue
;
prom_puts
(
const
char
*
s
,
int
len
)
len
-=
n
;
{
buf
+=
len
;
unsigned
long
args
[
7
];
}
args
[
0
]
=
(
unsigned
long
)
"write"
;
args
[
1
]
=
3
;
args
[
2
]
=
1
;
args
[
3
]
=
(
unsigned
int
)
prom_stdout
;
args
[
4
]
=
(
unsigned
long
)
s
;
args
[
5
]
=
len
;
args
[
6
]
=
(
unsigned
long
)
-
1
;
p1275_cmd_direct
(
args
);
}
}
arch/sparc/prom/devops_32.c
deleted
100644 → 0
View file @
6313e3c2
/*
* devops.c: Device operations using the PROM.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <asm/openprom.h>
#include <asm/oplib.h>
extern
void
restore_current
(
void
);
/* Open the device described by the string 'dstr'. Returns the handle
* to that device used for subsequent operations on that device.
* Returns -1 on failure.
*/
int
prom_devopen
(
char
*
dstr
)
{
int
handle
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
prom_lock
,
flags
);
switch
(
prom_vers
)
{
case
PROM_V0
:
handle
=
(
*
(
romvec
->
pv_v0devops
.
v0_devopen
))(
dstr
);
if
(
handle
==
0
)
handle
=
-
1
;
break
;
case
PROM_V2
:
case
PROM_V3
:
handle
=
(
*
(
romvec
->
pv_v2devops
.
v2_dev_open
))(
dstr
);
break
;
default:
handle
=
-
1
;
break
;
};
restore_current
();
spin_unlock_irqrestore
(
&
prom_lock
,
flags
);
return
handle
;
}
/* Close the device described by device handle 'dhandle'. */
int
prom_devclose
(
int
dhandle
)
{
unsigned
long
flags
;
spin_lock_irqsave
(
&
prom_lock
,
flags
);
switch
(
prom_vers
)
{
case
PROM_V0
:
(
*
(
romvec
->
pv_v0devops
.
v0_devclose
))(
dhandle
);
break
;
case
PROM_V2
:
case
PROM_V3
:
(
*
(
romvec
->
pv_v2devops
.
v2_dev_close
))(
dhandle
);
break
;
default:
break
;
};
restore_current
();
spin_unlock_irqrestore
(
&
prom_lock
,
flags
);
return
0
;
}
/* Seek to specified location described by 'seekhi' and 'seeklo'
* for device 'dhandle'.
*/
void
prom_seek
(
int
dhandle
,
unsigned
int
seekhi
,
unsigned
int
seeklo
)
{
unsigned
long
flags
;
spin_lock_irqsave
(
&
prom_lock
,
flags
);
switch
(
prom_vers
)
{
case
PROM_V0
:
(
*
(
romvec
->
pv_v0devops
.
v0_seekdev
))(
dhandle
,
seekhi
,
seeklo
);
break
;
case
PROM_V2
:
case
PROM_V3
:
(
*
(
romvec
->
pv_v2devops
.
v2_dev_seek
))(
dhandle
,
seekhi
,
seeklo
);
break
;
default:
break
;
};
restore_current
();
spin_unlock_irqrestore
(
&
prom_lock
,
flags
);
}
arch/sparc/prom/devops_64.c
deleted
100644 → 0
View file @
6313e3c2
/*
* devops.c: Device operations using the PROM.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
* Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
*/
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <asm/openprom.h>
#include <asm/oplib.h>
/* Open the device described by the string 'dstr'. Returns the handle
* to that device used for subsequent operations on that device.
* Returns 0 on failure.
*/
int
prom_devopen
(
const
char
*
dstr
)
{
unsigned
long
args
[
5
];
args
[
0
]
=
(
unsigned
long
)
"open"
;
args
[
1
]
=
1
;
args
[
2
]
=
1
;
args
[
3
]
=
(
unsigned
long
)
dstr
;
args
[
4
]
=
(
unsigned
long
)
-
1
;
p1275_cmd_direct
(
args
);
return
(
int
)
args
[
4
];
}
/* Close the device described by device handle 'dhandle'. */
int
prom_devclose
(
int
dhandle
)
{
unsigned
long
args
[
4
];
args
[
0
]
=
(
unsigned
long
)
"close"
;
args
[
1
]
=
1
;
args
[
2
]
=
0
;
args
[
3
]
=
(
unsigned
int
)
dhandle
;
p1275_cmd_direct
(
args
);
return
0
;
}
/* Seek to specified location described by 'seekhi' and 'seeklo'
* for device 'dhandle'.
*/
void
prom_seek
(
int
dhandle
,
unsigned
int
seekhi
,
unsigned
int
seeklo
)
{
unsigned
long
args
[
7
];
args
[
0
]
=
(
unsigned
long
)
"seek"
;
args
[
1
]
=
3
;
args
[
2
]
=
1
;
args
[
3
]
=
(
unsigned
int
)
dhandle
;
args
[
4
]
=
seekhi
;
args
[
5
]
=
seeklo
;
args
[
6
]
=
(
unsigned
long
)
-
1
;
p1275_cmd_direct
(
args
);
}
arch/sparc/prom/misc_64.c
View file @
23bcbf1b
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
#include <asm/system.h>
#include <asm/system.h>
#include <asm/ldc.h>
#include <asm/ldc.h>
int
prom_service_exists
(
const
char
*
service_name
)
static
int
prom_service_exists
(
const
char
*
service_name
)
{
{
unsigned
long
args
[
5
];
unsigned
long
args
[
5
];
...
@@ -150,20 +150,6 @@ void prom_halt_power_off(void)
...
@@ -150,20 +150,6 @@ void prom_halt_power_off(void)
prom_halt
();
prom_halt
();
}
}
/* Set prom sync handler to call function 'funcp'. */
void
prom_setcallback
(
callback_func_t
funcp
)
{
unsigned
long
args
[
5
];
if
(
!
funcp
)
return
;
args
[
0
]
=
(
unsigned
long
)
"set-callback"
;
args
[
1
]
=
1
;
args
[
2
]
=
1
;
args
[
3
]
=
(
unsigned
long
)
funcp
;
args
[
4
]
=
(
unsigned
long
)
-
1
;
p1275_cmd_direct
(
args
);
}
/* Get the idprom and stuff it into buffer 'idbuf'. Returns the
/* Get the idprom and stuff it into buffer 'idbuf'. Returns the
* format type. 'num_bytes' is the number of bytes that your idbuf
* format type. 'num_bytes' is the number of bytes that your idbuf
* has space for. Returns 0xff on error.
* has space for. Returns 0xff on error.
...
...
arch/sparc/prom/printf.c
View file @
23bcbf1b
...
@@ -15,22 +15,45 @@
...
@@ -15,22 +15,45 @@
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/compiler.h>
#include <linux/compiler.h>
#include <linux/spinlock.h>
#include <asm/openprom.h>
#include <asm/openprom.h>
#include <asm/oplib.h>
#include <asm/oplib.h>
#define CONSOLE_WRITE_BUF_SIZE 1024
static
char
ppbuf
[
1024
];
static
char
ppbuf
[
1024
];
static
char
console_write_buf
[
CONSOLE_WRITE_BUF_SIZE
];
static
DEFINE_RAW_SPINLOCK
(
console_write_lock
);
void
notrace
prom_write
(
const
char
*
buf
,
unsigned
int
n
)
void
notrace
prom_write
(
const
char
*
buf
,
unsigned
int
n
)
{
{
char
ch
;
unsigned
int
dest_len
;
unsigned
long
flags
;
char
*
dest
;
dest
=
console_write_buf
;
raw_spin_lock_irqsave
(
&
console_write_lock
,
flags
);
while
(
n
!=
0
)
{
dest_len
=
0
;
--
n
;
while
(
n
--
!=
0
)
{
if
((
ch
=
*
buf
++
)
==
'\n'
)
char
ch
=
*
buf
++
;
prom_putchar
(
'\r'
);
if
(
ch
==
'\n'
)
{
prom_putchar
(
ch
);
*
dest
++
=
'\r'
;
dest_len
++
;
}
*
dest
++
=
ch
;
dest_len
++
;
if
(
dest_len
>=
CONSOLE_WRITE_BUF_SIZE
-
1
)
{
prom_console_write_buf
(
console_write_buf
,
dest_len
);
dest
=
console_write_buf
;
dest_len
=
0
;
}
}
}
if
(
dest_len
)
prom_console_write_buf
(
console_write_buf
,
dest_len
);
raw_spin_unlock_irqrestore
(
&
console_write_lock
,
flags
);
}
}
void
notrace
prom_printf
(
const
char
*
fmt
,
...)
void
notrace
prom_printf
(
const
char
*
fmt
,
...)
...
...
arch/sparc/prom/tree_32.c
View file @
23bcbf1b
...
@@ -342,19 +342,3 @@ phandle prom_inst2pkg(int inst)
...
@@ -342,19 +342,3 @@ phandle prom_inst2pkg(int inst)
if
(
node
==
-
1
)
return
0
;
if
(
node
==
-
1
)
return
0
;
return
node
;
return
node
;
}
}
/* Return 'node' assigned to a particular prom 'path'
* FIXME: Should work for v0 as well
*/
phandle
prom_pathtoinode
(
char
*
path
)
{
phandle
node
;
int
inst
;
inst
=
prom_devopen
(
path
);
if
(
inst
==
-
1
)
return
0
;
node
=
prom_inst2pkg
(
inst
);
prom_devclose
(
inst
);
if
(
node
==
-
1
)
return
0
;
return
node
;
}
arch/sparc/prom/tree_64.c
View file @
23bcbf1b
...
@@ -374,24 +374,6 @@ inline phandle prom_inst2pkg(int inst)
...
@@ -374,24 +374,6 @@ inline phandle prom_inst2pkg(int inst)
return
node
;
return
node
;
}
}
/* Return 'node' assigned to a particular prom 'path'
* FIXME: Should work for v0 as well
*/
phandle
prom_pathtoinode
(
const
char
*
path
)
{
phandle
node
;
int
inst
;
inst
=
prom_devopen
(
path
);
if
(
inst
==
0
)
return
0
;
node
=
prom_inst2pkg
(
inst
);
prom_devclose
(
inst
);
if
(
node
==
-
1
)
return
0
;
return
node
;
}
int
prom_ihandle2path
(
int
handle
,
char
*
buffer
,
int
bufsize
)
int
prom_ihandle2path
(
int
handle
,
char
*
buffer
,
int
bufsize
)
{
{
unsigned
long
args
[
7
];
unsigned
long
args
[
7
];
...
...
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