Deleted Added
full compact
ofw_standard.c (208614) ofw_standard.c (209801)
1/* $NetBSD: Locore.c,v 1.7 2000/08/20 07:04:59 tsubai Exp $ */
2
3/*-
4 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5 * Copyright (C) 1995, 1996 TooLs GmbH.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 42 unchanged lines hidden (view full) ---

51 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
52 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
53 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
54 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
55 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 */
57
58#include <sys/cdefs.h>
1/* $NetBSD: Locore.c,v 1.7 2000/08/20 07:04:59 tsubai Exp $ */
2
3/*-
4 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5 * Copyright (C) 1995, 1996 TooLs GmbH.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 42 unchanged lines hidden (view full) ---

51 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
52 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
53 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
54 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
55 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
56 */
57
58#include <sys/cdefs.h>
59__FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_standard.c 208614 2010-05-28 10:43:56Z raj $");
59__FBSDID("$FreeBSD: head/sys/dev/ofw/ofw_standard.c 209801 2010-07-08 14:29:23Z nwhitehorn $");
60
61#include <sys/param.h>
62#include <sys/kernel.h>
63#include <sys/malloc.h>
64#include <sys/systm.h>
65
66#include <machine/stdarg.h>
67

--- 22 unchanged lines hidden (view full) ---

90 size_t len);
91static phandle_t ofw_std_finddevice(ofw_t ofw, const char *device);
92static ssize_t ofw_std_instance_to_path(ofw_t ofw, ihandle_t instance,
93 char *buf, size_t len);
94static ssize_t ofw_std_package_to_path(ofw_t ofw, phandle_t package, char *buf,
95 size_t len);
96static int ofw_std_call_method(ofw_t ofw, ihandle_t instance,
97 const char *method, int nargs, int nreturns,
60
61#include <sys/param.h>
62#include <sys/kernel.h>
63#include <sys/malloc.h>
64#include <sys/systm.h>
65
66#include <machine/stdarg.h>
67

--- 22 unchanged lines hidden (view full) ---

90 size_t len);
91static phandle_t ofw_std_finddevice(ofw_t ofw, const char *device);
92static ssize_t ofw_std_instance_to_path(ofw_t ofw, ihandle_t instance,
93 char *buf, size_t len);
94static ssize_t ofw_std_package_to_path(ofw_t ofw, phandle_t package, char *buf,
95 size_t len);
96static int ofw_std_call_method(ofw_t ofw, ihandle_t instance,
97 const char *method, int nargs, int nreturns,
98 unsigned long *args_and_returns);
98 cell_t *args_and_returns);
99static ihandle_t ofw_std_open(ofw_t ofw, const char *device);
100static void ofw_std_close(ofw_t ofw, ihandle_t instance);
101static ssize_t ofw_std_read(ofw_t ofw, ihandle_t instance, void *addr,
102 size_t len);
103static ssize_t ofw_std_write(ofw_t ofw, ihandle_t instance, const void *addr,
104 size_t len);
105static int ofw_std_seek(ofw_t ofw, ihandle_t instance, uint64_t pos);
106static caddr_t ofw_std_claim(ofw_t ofw, void *virt, size_t size, u_int align);

--- 403 unchanged lines hidden (view full) ---

510 if (openfirmware(&args) == -1)
511 return (-1);
512 return (args.size);
513}
514
515/* Call the method in the scope of a given instance. */
516static int
517ofw_std_call_method(ofw_t ofw, ihandle_t instance, const char *method,
99static ihandle_t ofw_std_open(ofw_t ofw, const char *device);
100static void ofw_std_close(ofw_t ofw, ihandle_t instance);
101static ssize_t ofw_std_read(ofw_t ofw, ihandle_t instance, void *addr,
102 size_t len);
103static ssize_t ofw_std_write(ofw_t ofw, ihandle_t instance, const void *addr,
104 size_t len);
105static int ofw_std_seek(ofw_t ofw, ihandle_t instance, uint64_t pos);
106static caddr_t ofw_std_claim(ofw_t ofw, void *virt, size_t size, u_int align);

--- 403 unchanged lines hidden (view full) ---

510 if (openfirmware(&args) == -1)
511 return (-1);
512 return (args.size);
513}
514
515/* Call the method in the scope of a given instance. */
516static int
517ofw_std_call_method(ofw_t ofw, ihandle_t instance, const char *method,
518 int nargs, int nreturns, unsigned long *args_and_returns)
518 int nargs, int nreturns, cell_t *args_and_returns)
519{
520 struct {
521 cell_t name;
522 cell_t nargs;
523 cell_t nreturns;
524 cell_t method;
525 cell_t instance;
526 cell_t args_n_results[12];
527 } args = {
528 (cell_t)"call-method",
529 2,
530 1,
531 };
519{
520 struct {
521 cell_t name;
522 cell_t nargs;
523 cell_t nreturns;
524 cell_t method;
525 cell_t instance;
526 cell_t args_n_results[12];
527 } args = {
528 (cell_t)"call-method",
529 2,
530 1,
531 };
532 cell_t *cp;
533 unsigned long *ap;
532 cell_t *cp, *ap;
534 int n;
535
536 if (nargs > 6)
537 return (-1);
538 args.nargs = nargs + 2;
539 args.nreturns = nreturns + 1;
540 args.method = (cell_t)method;
541 args.instance = instance;

--- 228 unchanged lines hidden ---
533 int n;
534
535 if (nargs > 6)
536 return (-1);
537 args.nargs = nargs + 2;
538 args.nreturns = nreturns + 1;
539 args.method = (cell_t)method;
540 args.instance = instance;

--- 228 unchanged lines hidden ---