3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; version 2 of the License.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #include <sys/types.h>
21 #include <sys/ioctl.h>
23 #include <asm/ps3dmproxy.h>
25 #include "ps3dm_proxy.h"
27 int ps3dm_proxy_open(const char *path
)
29 return open(path
, O_RDWR
);
32 int ps3dm_proxy_close(int fd
)
37 int ps3dm_proxy_user_to_lpar_addr(int fd
, uint64_t user_addr
, uint64_t *lpar_addr
)
39 struct ps3dmproxy_ioctl_user_to_lpar_addr arg
;
42 memset(&arg
, 0, sizeof(arg
));
43 arg
.user_addr
= user_addr
;
45 error
= ioctl(fd
, PS3DMPROXY_IOCTL_USER_TO_LPAR_ADDR
, &arg
);
48 *lpar_addr
= arg
.lpar_addr
;
53 int ps3dm_proxy_get_repo_node_val(int fd
, uint64_t lpar_id
, const uint64_t key
[4], uint64_t val
[2])
55 struct ps3dmproxy_ioctl_get_repo_node_val arg
;
58 memset(&arg
, 0, sizeof(arg
));
59 arg
.lpar_id
= lpar_id
;
65 error
= ioctl(fd
, PS3DMPROXY_IOCTL_GET_REPO_NODE_VAL
, &arg
);
75 int ps3dm_proxy_do_request(int fd
, struct ps3dm_hdr
*sendbuf
, unsigned int sendbuf_size
,
76 struct ps3dm_hdr
*recvbuf
, unsigned int recvbuf_size
)
78 struct ps3dmproxy_ioctl_do_request arg
;
80 memset(&arg
, 0, sizeof(arg
));
81 arg
.sendbuf
= (uint64_t) sendbuf
;
82 arg
.sendbuf_size
= sendbuf_size
;
83 arg
.recvbuf
= (uint64_t) recvbuf
;
84 arg
.recvbuf_size
= recvbuf_size
;
86 return ioctl(fd
, PS3DMPROXY_IOCTL_DO_REQUEST
, &arg
);