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
b5d92a49
Commit
b5d92a49
authored
Mar 17, 2002
by
Anton Blanchard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ppc64: Add RTAS NVRAM driver, from Todd Inglett
parent
09f37343
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
141 additions
and
48 deletions
+141
-48
arch/ppc64/defconfig
arch/ppc64/defconfig
+0
-1
arch/ppc64/kernel/Makefile
arch/ppc64/kernel/Makefile
+1
-6
arch/ppc64/kernel/nvram.c
arch/ppc64/kernel/nvram.c
+140
-0
include/asm-ppc64/machdep.h
include/asm-ppc64/machdep.h
+0
-12
include/asm-ppc64/nvram.h
include/asm-ppc64/nvram.h
+0
-29
No files found.
arch/ppc64/defconfig
View file @
b5d92a49
...
...
@@ -449,7 +449,6 @@ CONFIG_PSMOUSE=y
#
# CONFIG_WATCHDOG is not set
# CONFIG_INTEL_RNG is not set
CONFIG_NVRAM=y
# CONFIG_DTLK is not set
# CONFIG_R3964 is not set
# CONFIG_APPLICOM is not set
...
...
arch/ppc64/kernel/Makefile
View file @
b5d92a49
...
...
@@ -38,18 +38,13 @@ endif
ifeq
($(CONFIG_PPC_PSERIES),y)
obj-$(CONFIG_PCI)
+=
pSeries_pci.o pSeries_lpar.o pSeries_hvCall.o
obj-y
+=
rtasd.o
obj-y
+=
rtasd.o
nvram.o
endif
obj-$(CONFIG_KGDB)
+=
ppc-stub.o
obj-$(CONFIG_SMP)
+=
smp.o
# tibit: for matrox_init2()
ifeq
($(CONFIG_NVRAM),y)
obj-$(CONFIG_NVRAM)
+=
pmac_nvram.o
endif
obj-y
+=
prom.o lmb.o rtas.o rtas-proc.o chrp_setup.o i8259.o
include
$(TOPDIR)/Rules.make
...
...
arch/ppc64/kernel/nvram.c
0 → 100644
View file @
b5d92a49
/*
* c 2001 PPC 64 Team, IBM Corp
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*
* /dev/nvram driver for PPC64
*
* This perhaps should live in drivers/char
*/
#include <linux/module.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/miscdevice.h>
#include <linux/fcntl.h>
#include <linux/nvram.h>
#include <linux/init.h>
#include <asm/uaccess.h>
#include <asm/nvram.h>
#include <asm/rtas.h>
#include <asm/prom.h>
static
unsigned
int
rtas_nvram_size
;
static
unsigned
int
nvram_fetch
,
nvram_store
;
static
char
nvram_buf
[
4
];
/* assume this is in the first 4GB */
static
loff_t
nvram_llseek
(
struct
file
*
file
,
loff_t
offset
,
int
origin
)
{
switch
(
origin
)
{
case
1
:
offset
+=
file
->
f_pos
;
break
;
case
2
:
offset
+=
rtas_nvram_size
;
break
;
}
if
(
offset
<
0
)
return
-
EINVAL
;
file
->
f_pos
=
offset
;
return
file
->
f_pos
;
}
static
ssize_t
read_nvram
(
struct
file
*
file
,
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
unsigned
int
i
;
unsigned
long
len
;
char
*
p
=
buf
;
if
(
verify_area
(
VERIFY_WRITE
,
buf
,
count
))
return
-
EFAULT
;
if
(
*
ppos
>=
rtas_nvram_size
)
return
0
;
for
(
i
=
*
ppos
;
count
>
0
&&
i
<
rtas_nvram_size
;
++
i
,
++
p
,
--
count
)
{
if
((
rtas_call
(
nvram_fetch
,
3
,
2
,
&
len
,
i
,
__pa
(
nvram_buf
),
1
)
!=
0
)
||
len
!=
1
)
return
-
EIO
;
if
(
__put_user
(
nvram_buf
[
0
],
p
))
return
-
EFAULT
;
}
*
ppos
=
i
;
return
p
-
buf
;
}
static
ssize_t
write_nvram
(
struct
file
*
file
,
const
char
*
buf
,
size_t
count
,
loff_t
*
ppos
)
{
unsigned
int
i
;
unsigned
long
len
;
const
char
*
p
=
buf
;
char
c
;
if
(
verify_area
(
VERIFY_READ
,
buf
,
count
))
return
-
EFAULT
;
if
(
*
ppos
>=
rtas_nvram_size
)
return
0
;
for
(
i
=
*
ppos
;
count
>
0
&&
i
<
rtas_nvram_size
;
++
i
,
++
p
,
--
count
)
{
if
(
__get_user
(
c
,
p
))
return
-
EFAULT
;
nvram_buf
[
0
]
=
c
;
if
((
rtas_call
(
nvram_store
,
3
,
2
,
&
len
,
i
,
__pa
(
nvram_buf
),
1
)
!=
0
)
||
len
!=
1
)
return
-
EIO
;
}
*
ppos
=
i
;
return
p
-
buf
;
}
static
int
nvram_ioctl
(
struct
inode
*
inode
,
struct
file
*
file
,
unsigned
int
cmd
,
unsigned
long
arg
)
{
return
-
EINVAL
;
}
struct
file_operations
nvram_fops
=
{
owner:
THIS_MODULE
,
llseek:
nvram_llseek
,
read:
read_nvram
,
write:
write_nvram
,
ioctl:
nvram_ioctl
,
};
static
struct
miscdevice
nvram_dev
=
{
NVRAM_MINOR
,
"nvram"
,
&
nvram_fops
};
int
__init
nvram_init
(
void
)
{
struct
device_node
*
nvram
;
unsigned
int
*
nbytes_p
,
proplen
;
if
((
nvram
=
find_type_devices
(
"nvram"
))
!=
NULL
)
{
nbytes_p
=
(
unsigned
int
*
)
get_property
(
nvram
,
"#bytes"
,
&
proplen
);
if
(
nbytes_p
&&
proplen
==
sizeof
(
unsigned
int
))
{
rtas_nvram_size
=
*
nbytes_p
;
}
}
nvram_fetch
=
rtas_token
(
"nvram-fetch"
);
nvram_store
=
rtas_token
(
"nvram-store"
);
printk
(
KERN_INFO
"PPC64 nvram contains %d bytes
\n
"
,
rtas_nvram_size
);
misc_register
(
&
nvram_dev
);
return
0
;
}
void
__exit
nvram_cleanup
(
void
)
{
misc_deregister
(
&
nvram_dev
);
}
module_init
(
nvram_init
);
module_exit
(
nvram_cleanup
);
MODULE_LICENSE
(
"GPL"
);
include/asm-ppc64/machdep.h
View file @
b5d92a49
...
...
@@ -148,17 +148,5 @@ extern char cmd_line[512];
extern
void
setup_pci_ptrs
(
void
);
/*
* Power macintoshes have either a CUDA or a PMU controlling
* system reset, power, NVRAM, RTC.
*/
typedef
enum
sys_ctrler_kind
{
SYS_CTRLER_UNKNOWN
=
0
,
SYS_CTRLER_CUDA
=
1
,
SYS_CTRLER_PMU
=
2
,
}
sys_ctrler_t
;
extern
sys_ctrler_t
sys_ctrler
;
#endif
/* _PPC_MACHDEP_H */
#endif
/* __KERNEL__ */
include/asm-ppc64/nvram.h
View file @
b5d92a49
...
...
@@ -36,33 +36,4 @@
#define BIN_TO_BCD(val) ((val)=(((val)/10)<<4) + (val)%10)
#endif
/* PowerMac specific nvram stuffs */
enum
{
pmac_nvram_OF
,
/* Open Firmware partition */
pmac_nvram_XPRAM
,
/* MacOS XPRAM partition */
pmac_nvram_NR
/* MacOS Name Registry partition */
};
/* Return partition offset in nvram */
extern
int
pmac_get_partition
(
int
partition
);
/* Direct access to XPRAM */
extern
u8
pmac_xpram_read
(
int
xpaddr
);
extern
void
pmac_xpram_write
(
int
xpaddr
,
u8
data
);
/* Some offsets in XPRAM */
#define PMAC_XPRAM_MACHINE_LOC 0xe4
#define PMAC_XPRAM_SOUND_VOLUME 0x08
/* Machine location structure in XPRAM */
struct
pmac_machine_location
{
u32
latitude
;
/* 2+30 bit Fractional number */
u32
longitude
;
/* 2+30 bit Fractional number */
u32
delta
;
/* mix of GMT delta and DLS */
};
/* /dev/nvram ioctls */
#define PMAC_NVRAM_GET_OFFSET _IOWR('p', 0x40, int)
/* Get NVRAM partition offset */
#endif
/* _PPC64_NVRAM_H */
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