1/*-
2 * Copyright (C) 2010 Nathan Whitehorn
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
22 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
23 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * $FreeBSD$
26 */
27
28#ifndef _PS3_LV1CALL_H
29#define _PS3_LV1CALL_H
30
31#include <machine/pte.h>
32
33int lv1_get_physmem(uint64_t *maxmem);
34int lv1_setup_address_space(uint64_t *as_id, uint64_t *ptsize);
35int lv1_insert_pte(u_int ptegidx, struct lpte *pte, int lockflags);
36int lv1_panic(int reboot);
37
38#define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_MODE_SET	0x0100
39#define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_SYNC		0x0101
40#define  L1GPU_DISPLAY_SYNC_HSYNC			1
41#define  L1GPU_DISPLAY_SYNC_VSYNC			2
42#define L1GPU_CONTEXT_ATTRIBUTE_DISPLAY_FLIP		0x0102
43
44int lv1_gpu_open(int);
45int lv1_gpu_context_attribute(int context, int op, int, int, int, int);
46int lv1_gpu_memory_allocate(int size, int, int, int, int, uint64_t *handle,
47	uint64_t *paddr);
48int lv1_gpu_context_allocate(uint64_t handle, int, uint64_t *context);
49
50int lv1_open_device(int, int, int /* 0 */);
51int lv1_close_device(int, int);
52int lv1_setup_dma(int, int, uint64_t *dmabase);
53
54#define GELIC_GET_MAC_ADDRESS	0x0001
55#define GELIC_GET_LINK_STATUS	0x0002
56#define  GELIC_LINK_UP		0x0001
57#define  GELIC_FULL_DUPLEX	0x0002
58#define  GELIC_AUTO_NEG		0x0004
59#define  GELIC_SPEED_10		0x0010
60#define  GELIC_SPEED_100	0x0020
61#define  GELIC_SPEED_1000	0x0040
62#define GELIC_GET_VLAN_ID	0x0004
63
64int lv1_net_init(int bus, int dev);
65int lv1_net_control(int bus, int dev, int, int, int, int, uint64_t *);
66int lv1_net_start_tx_dma(int bus, int dev, uint32_t addr, int);
67int lv1_net_start_rx_dma(int bus, int dev, uint32_t addr, int);
68int lv1_net_stop_tx_dma(int bus, int dev, int);
69int lv1_net_stop_rx_dma(int bus, int dev, int);
70
71int lv1_get_repository_node_value(uint64_t lpar_id, uint64_t n1, uint64_t n2,
72    uint64_t n3, uint64_t n4, uint64_t *v1, uint64_t *v2);
73
74int lv1_storage_read(uint64_t dev_id, uint64_t region_id, uint64_t start_sector,
75    uint64_t sector_count, uint64_t flags, uint64_t buf, uint64_t *tag);
76int lv1_storage_check_async_status(uint64_t dev_id, uint64_t tag,
77    uint64_t *status);
78
79#endif
80
81