xref: /linux/arch/powerpc/include/asm/ps3stor.h (revision ca55b2fef3a9373fcfc30f82fd26bc7fccbda732)
1 /*
2  * PS3 Storage Devices
3  *
4  * Copyright (C) 2007 Sony Computer Entertainment Inc.
5  * Copyright 2007 Sony Corp.
6  *
7  * This program is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU General Public License as published
9  * by the Free Software Foundation; version 2 of the License.
10  *
11  * This program is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20 
21 #ifndef _ASM_POWERPC_PS3STOR_H_
22 #define _ASM_POWERPC_PS3STOR_H_
23 
24 #include <linux/interrupt.h>
25 
26 #include <asm/ps3.h>
27 
28 
29 struct ps3_storage_region {
30 	unsigned int id;
31 	u64 start;
32 	u64 size;
33 };
34 
35 struct ps3_storage_device {
36 	struct ps3_system_bus_device sbd;
37 
38 	struct ps3_dma_region dma_region;
39 	unsigned int irq;
40 	u64 blk_size;
41 
42 	u64 tag;
43 	u64 lv1_status;
44 	struct completion done;
45 
46 	unsigned long bounce_size;
47 	void *bounce_buf;
48 	u64 bounce_lpar;
49 	dma_addr_t bounce_dma;
50 
51 	unsigned int num_regions;
52 	unsigned long accessible_regions;
53 	unsigned int region_idx;		/* first accessible region */
54 	struct ps3_storage_region regions[0];	/* Must be last */
55 };
56 
57 static inline struct ps3_storage_device *to_ps3_storage_device(struct device *dev)
58 {
59 	return container_of(dev, struct ps3_storage_device, sbd.core);
60 }
61 
62 extern int ps3stor_setup(struct ps3_storage_device *dev,
63 			 irq_handler_t handler);
64 extern void ps3stor_teardown(struct ps3_storage_device *dev);
65 extern u64 ps3stor_read_write_sectors(struct ps3_storage_device *dev, u64 lpar,
66 				      u64 start_sector, u64 sectors,
67 				      int write);
68 extern u64 ps3stor_send_command(struct ps3_storage_device *dev, u64 cmd,
69 				u64 arg1, u64 arg2, u64 arg3, u64 arg4);
70 
71 #endif /* _ASM_POWERPC_PS3STOR_H_ */
72