1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * PS3 Storage Devices
4  *
5  * Copyright (C) 2007 Sony Computer Entertainment Inc.
6  * Copyright 2007 Sony Corp.
7  */
8 
9 #ifndef _ASM_POWERPC_PS3STOR_H_
10 #define _ASM_POWERPC_PS3STOR_H_
11 
12 #include <linux/interrupt.h>
13 
14 #include <asm/ps3.h>
15 
16 
17 struct ps3_storage_region {
18 	unsigned int id;
19 	u64 start;
20 	u64 size;
21 };
22 
23 struct ps3_storage_device {
24 	struct ps3_system_bus_device sbd;
25 
26 	struct ps3_dma_region dma_region;
27 	unsigned int irq;
28 	u64 blk_size;
29 
30 	u64 tag;
31 	u64 lv1_status;
32 	struct completion done;
33 
34 	unsigned long bounce_size;
35 	void *bounce_buf;
36 	u64 bounce_lpar;
37 	dma_addr_t bounce_dma;
38 
39 	unsigned int num_regions;
40 	unsigned long accessible_regions;
41 	unsigned int region_idx;		/* first accessible region */
42 	struct ps3_storage_region regions[];	/* Must be last */
43 };
44 
to_ps3_storage_device(struct device * dev)45 static inline struct ps3_storage_device *to_ps3_storage_device(struct device *dev)
46 {
47 	return container_of(dev, struct ps3_storage_device, sbd.core);
48 }
49 
50 extern int ps3stor_setup(struct ps3_storage_device *dev,
51 			 irq_handler_t handler);
52 extern void ps3stor_teardown(struct ps3_storage_device *dev);
53 extern u64 ps3stor_read_write_sectors(struct ps3_storage_device *dev, u64 lpar,
54 				      u64 start_sector, u64 sectors,
55 				      int write);
56 extern u64 ps3stor_send_command(struct ps3_storage_device *dev, u64 cmd,
57 				u64 arg1, u64 arg2, u64 arg3, u64 arg4);
58 
59 #endif /* _ASM_POWERPC_PS3STOR_H_ */
60