]>
git.saurik.com Git - apple/xnu.git/blob - bsd/dev/ppc/nvram.c
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
23 * BSD driver for Non-volatile RAM.
24 * Stub functions call the real thing in the Platform Expert.
26 * Suurballe 11 Feb 1999
29 #include <sys/types.h>
30 #include <sys/param.h>
32 extern int PEnvopen ( dev_t
, int, int, struct proc
* );
33 extern int PEnvclose ( dev_t
, int, int, struct proc
* );
34 extern int PEnvread ( long, int, unsigned char *);
35 extern int PEnvwrite ( long, int, unsigned char * );
38 nvopen(dev
, flag
, devtype
, pp
)
43 return PEnvopen(dev
,flag
,devtype
,pp
);
48 nvclose(dev
, flag
, mode
, pp
)
53 return PEnvclose(dev
,flag
,mode
,pp
);
58 nvread(dev
, uio
, ioflag
)
70 offset
= uio
->uio_offset
;
71 size
= uio
->uio_resid
;
73 for (read
= 0; read
< size
; read
++, offset
++) {
74 error
= PEnvread(offset
, 1, &cc
);
79 error
= ureadc(c
, uio
);
89 nvwrite(dev_t dev
, struct uio
*uio
, int ioflag
)
91 register struct iovec
*iov
;
99 offset
= uio
->uio_offset
;
100 size
= uio
->uio_resid
;
102 for (wrote
= 0; wrote
< size
; wrote
++, offset
++) {
107 cc
= (unsigned char)c
;
108 error
= PEnvwrite(offset
, 1, &cc
);