167207b96SArnd Bergmann /*
267207b96SArnd Bergmann  * SPU file system
367207b96SArnd Bergmann  *
467207b96SArnd Bergmann  * (C) Copyright IBM Deutschland Entwicklung GmbH 2005
567207b96SArnd Bergmann  *
667207b96SArnd Bergmann  * Author: Arnd Bergmann <arndb@de.ibm.com>
767207b96SArnd Bergmann  *
867207b96SArnd Bergmann  * This program is free software; you can redistribute it and/or modify
967207b96SArnd Bergmann  * it under the terms of the GNU General Public License as published by
1067207b96SArnd Bergmann  * the Free Software Foundation; either version 2, or (at your option)
1167207b96SArnd Bergmann  * any later version.
1267207b96SArnd Bergmann  *
1367207b96SArnd Bergmann  * This program is distributed in the hope that it will be useful,
1467207b96SArnd Bergmann  * but WITHOUT ANY WARRANTY; without even the implied warranty of
1567207b96SArnd Bergmann  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1667207b96SArnd Bergmann  * GNU General Public License for more details.
1767207b96SArnd Bergmann  *
1867207b96SArnd Bergmann  * You should have received a copy of the GNU General Public License
1967207b96SArnd Bergmann  * along with this program; if not, write to the Free Software
2067207b96SArnd Bergmann  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2167207b96SArnd Bergmann  */
2267207b96SArnd Bergmann #ifndef SPUFS_H
2367207b96SArnd Bergmann #define SPUFS_H
2467207b96SArnd Bergmann 
2567207b96SArnd Bergmann #include <linux/kref.h>
26650f8b02SChristoph Hellwig #include <linux/mutex.h>
2767207b96SArnd Bergmann #include <linux/spinlock.h>
2867207b96SArnd Bergmann #include <linux/fs.h>
29ea1ae594SChristoph Hellwig #include <linux/cpumask.h>
3067207b96SArnd Bergmann 
3167207b96SArnd Bergmann #include <asm/spu.h>
325473af04SMark Nutter #include <asm/spu_csa.h>
33b9e3bd77SDwayne Grant McConnell #include <asm/spu_info.h>
3467207b96SArnd Bergmann 
3567207b96SArnd Bergmann /* The magic number for our file system */
3667207b96SArnd Bergmann enum {
3767207b96SArnd Bergmann 	SPUFS_MAGIC = 0x23c9b64e,
3867207b96SArnd Bergmann };
3967207b96SArnd Bergmann 
408b3d6663SArnd Bergmann struct spu_context_ops;
416263203eSArnd Bergmann struct spu_gang;
426263203eSArnd Bergmann 
4336aaccc1SBob Nelson /* ctx->sched_flags */
4436aaccc1SBob Nelson enum {
4536aaccc1SBob Nelson 	SPU_SCHED_NOTIFY_ACTIVE,
46b2c863bdSChristoph Hellwig 	SPU_SCHED_WAS_ACTIVE,	/* was active upon spu_acquire_saved()  */
4736aaccc1SBob Nelson };
4836aaccc1SBob Nelson 
4967207b96SArnd Bergmann struct spu_context {
5067207b96SArnd Bergmann 	struct spu *spu;		  /* pointer to a physical SPU */
515473af04SMark Nutter 	struct spu_state csa;		  /* SPU context save area. */
5267207b96SArnd Bergmann 	spinlock_t mmio_lock;		  /* protects mmio access */
536df10a82SMark Nutter 	struct address_space *local_store; /* local store mapping.  */
546df10a82SMark Nutter 	struct address_space *mfc;	   /* 'mfc' area mappings. */
556df10a82SMark Nutter 	struct address_space *cntl;	   /* 'control' area mappings. */
566df10a82SMark Nutter 	struct address_space *signal1;	   /* 'signal1' area mappings. */
576df10a82SMark Nutter 	struct address_space *signal2;	   /* 'signal2' area mappings. */
5817e0e270SBenjamin Herrenschmidt 	struct address_space *mss;	   /* 'mss' area mappings. */
5917e0e270SBenjamin Herrenschmidt 	struct address_space *psmap;	   /* 'psmap' area mappings. */
6047d3a5faSChristoph Hellwig 	struct mutex mapping_lock;
6186767277SArnd Bergmann 	u64 object_id;		   /* user space pointer for oprofile */
628b3d6663SArnd Bergmann 
638b3d6663SArnd Bergmann 	enum { SPU_STATE_RUNNABLE, SPU_STATE_SAVED } state;
64650f8b02SChristoph Hellwig 	struct mutex state_mutex;
65e45d48a3SChristoph Hellwig 	struct mutex run_mutex;
668b3d6663SArnd Bergmann 
678b3d6663SArnd Bergmann 	struct mm_struct *owner;
6867207b96SArnd Bergmann 
6967207b96SArnd Bergmann 	struct kref kref;
708b3d6663SArnd Bergmann 	wait_queue_head_t ibox_wq;
718b3d6663SArnd Bergmann 	wait_queue_head_t wbox_wq;
725110459fSArnd Bergmann 	wait_queue_head_t stop_wq;
73a33a7d73SArnd Bergmann 	wait_queue_head_t mfc_wq;
7433bfd7a7SArnd Bergmann 	wait_queue_head_t run_wq;
758b3d6663SArnd Bergmann 	struct fasync_struct *ibox_fasync;
768b3d6663SArnd Bergmann 	struct fasync_struct *wbox_fasync;
77a33a7d73SArnd Bergmann 	struct fasync_struct *mfc_fasync;
78a33a7d73SArnd Bergmann 	u32 tagwait;
798b3d6663SArnd Bergmann 	struct spu_context_ops *ops;
802a911f0bSArnd Bergmann 	struct work_struct reap_work;
819add11daSArnd Bergmann 	unsigned long flags;
829add11daSArnd Bergmann 	unsigned long event_return;
836263203eSArnd Bergmann 
846263203eSArnd Bergmann 	struct list_head gang_list;
856263203eSArnd Bergmann 	struct spu_gang *gang;
861474855dSBob Nelson 	struct kref *prof_priv_kref;
871474855dSBob Nelson 	void ( * prof_priv_release) (struct kref *kref);
888389998aSChristoph Hellwig 
89476273adSChristoph Hellwig 	/* owner thread */
90476273adSChristoph Hellwig 	pid_t tid;
91476273adSChristoph Hellwig 
928389998aSChristoph Hellwig 	/* scheduler fields */
93079cdb61SChristoph Hellwig 	struct list_head rq;
9437901802SChristoph Hellwig 	unsigned int time_slice;
9526bec673SChristoph Hellwig 	unsigned long sched_flags;
96ea1ae594SChristoph Hellwig 	cpumask_t cpus_allowed;
972eb1b120SChristoph Hellwig 	int policy;
988389998aSChristoph Hellwig 	int prio;
99e9f8a0b6SChristoph Hellwig 
100e9f8a0b6SChristoph Hellwig 	/* statistics */
101e9f8a0b6SChristoph Hellwig 	struct {
102e9f8a0b6SChristoph Hellwig 		/* updates protected by ctx->state_mutex */
10327ec41d3SAndre Detsch 		enum spu_utilization_state util_state;
10427ec41d3SAndre Detsch 		unsigned long long tstamp;	/* time of last state switch */
10527ec41d3SAndre Detsch 		unsigned long long times[SPU_UTIL_MAX];
106e9f8a0b6SChristoph Hellwig 		unsigned long long vol_ctx_switch;
107e9f8a0b6SChristoph Hellwig 		unsigned long long invol_ctx_switch;
108e9f8a0b6SChristoph Hellwig 		unsigned long long min_flt;
109e9f8a0b6SChristoph Hellwig 		unsigned long long maj_flt;
110e9f8a0b6SChristoph Hellwig 		unsigned long long hash_flt;
111e9f8a0b6SChristoph Hellwig 		unsigned long long slb_flt;
112e9f8a0b6SChristoph Hellwig 		unsigned long long slb_flt_base; /* # at last ctx switch */
113e9f8a0b6SChristoph Hellwig 		unsigned long long class2_intr;
114e9f8a0b6SChristoph Hellwig 		unsigned long long class2_intr_base; /* # at last ctx switch */
115e9f8a0b6SChristoph Hellwig 		unsigned long long libassist;
116e9f8a0b6SChristoph Hellwig 	} stats;
1178e68e2f2SArnd Bergmann 
1188e68e2f2SArnd Bergmann 	struct list_head aff_list;
1198e68e2f2SArnd Bergmann 	int aff_head;
120c5fc8d2aSArnd Bergmann 	int aff_offset;
1216263203eSArnd Bergmann };
1226263203eSArnd Bergmann 
1236263203eSArnd Bergmann struct spu_gang {
1246263203eSArnd Bergmann 	struct list_head list;
1256263203eSArnd Bergmann 	struct mutex mutex;
1266263203eSArnd Bergmann 	struct kref kref;
1276263203eSArnd Bergmann 	int contexts;
1288e68e2f2SArnd Bergmann 
1298e68e2f2SArnd Bergmann 	struct spu_context *aff_ref_ctx;
1308e68e2f2SArnd Bergmann 	struct list_head aff_list_head;
1318e68e2f2SArnd Bergmann 	struct mutex aff_mutex;
1328e68e2f2SArnd Bergmann 	int aff_flags;
133c5fc8d2aSArnd Bergmann 	struct spu *aff_ref_spu;
134c5fc8d2aSArnd Bergmann 	atomic_t aff_sched_count;
13567207b96SArnd Bergmann };
13667207b96SArnd Bergmann 
1378e68e2f2SArnd Bergmann /* Flag bits for spu_gang aff_flags */
1388e68e2f2SArnd Bergmann #define AFF_OFFSETS_SET		1
1398e68e2f2SArnd Bergmann #define AFF_MERGED		2
1408e68e2f2SArnd Bergmann 
141a33a7d73SArnd Bergmann struct mfc_dma_command {
142a33a7d73SArnd Bergmann 	int32_t pad;	/* reserved */
143a33a7d73SArnd Bergmann 	uint32_t lsa;	/* local storage address */
144a33a7d73SArnd Bergmann 	uint64_t ea;	/* effective address */
145a33a7d73SArnd Bergmann 	uint16_t size;	/* transfer size */
146a33a7d73SArnd Bergmann 	uint16_t tag;	/* command tag */
147a33a7d73SArnd Bergmann 	uint16_t class;	/* class ID */
148a33a7d73SArnd Bergmann 	uint16_t cmd;	/* command opcode */
149a33a7d73SArnd Bergmann };
150a33a7d73SArnd Bergmann 
151a33a7d73SArnd Bergmann 
1528b3d6663SArnd Bergmann /* SPU context query/set operations. */
1538b3d6663SArnd Bergmann struct spu_context_ops {
1548b3d6663SArnd Bergmann 	int (*mbox_read) (struct spu_context * ctx, u32 * data);
1558b3d6663SArnd Bergmann 	 u32(*mbox_stat_read) (struct spu_context * ctx);
1563a843d7cSArnd Bergmann 	unsigned int (*mbox_stat_poll)(struct spu_context *ctx,
1573a843d7cSArnd Bergmann 					unsigned int events);
1588b3d6663SArnd Bergmann 	int (*ibox_read) (struct spu_context * ctx, u32 * data);
1598b3d6663SArnd Bergmann 	int (*wbox_write) (struct spu_context * ctx, u32 data);
1608b3d6663SArnd Bergmann 	 u32(*signal1_read) (struct spu_context * ctx);
1618b3d6663SArnd Bergmann 	void (*signal1_write) (struct spu_context * ctx, u32 data);
1628b3d6663SArnd Bergmann 	 u32(*signal2_read) (struct spu_context * ctx);
1638b3d6663SArnd Bergmann 	void (*signal2_write) (struct spu_context * ctx, u32 data);
1648b3d6663SArnd Bergmann 	void (*signal1_type_set) (struct spu_context * ctx, u64 val);
1658b3d6663SArnd Bergmann 	 u64(*signal1_type_get) (struct spu_context * ctx);
1668b3d6663SArnd Bergmann 	void (*signal2_type_set) (struct spu_context * ctx, u64 val);
1678b3d6663SArnd Bergmann 	 u64(*signal2_type_get) (struct spu_context * ctx);
1688b3d6663SArnd Bergmann 	 u32(*npc_read) (struct spu_context * ctx);
1698b3d6663SArnd Bergmann 	void (*npc_write) (struct spu_context * ctx, u32 data);
1708b3d6663SArnd Bergmann 	 u32(*status_read) (struct spu_context * ctx);
1718b3d6663SArnd Bergmann 	char*(*get_ls) (struct spu_context * ctx);
172cc210b3eSLuke Browning 	void (*privcntl_write) (struct spu_context *ctx, u64 data);
1733960c260SJeremy Kerr 	 u32 (*runcntl_read) (struct spu_context * ctx);
1745110459fSArnd Bergmann 	void (*runcntl_write) (struct spu_context * ctx, u32 data);
175c25620d7SMasato Noguchi 	void (*runcntl_stop) (struct spu_context * ctx);
176ee2d7340SArnd Bergmann 	void (*master_start) (struct spu_context * ctx);
177ee2d7340SArnd Bergmann 	void (*master_stop) (struct spu_context * ctx);
178a33a7d73SArnd Bergmann 	int (*set_mfc_query)(struct spu_context * ctx, u32 mask, u32 mode);
179a33a7d73SArnd Bergmann 	u32 (*read_mfc_tagstatus)(struct spu_context * ctx);
180a33a7d73SArnd Bergmann 	u32 (*get_mfc_free_elements)(struct spu_context *ctx);
181a33a7d73SArnd Bergmann 	int (*send_mfc_command)(struct spu_context * ctx,
182a33a7d73SArnd Bergmann 				struct mfc_dma_command * cmd);
183b9e3bd77SDwayne Grant McConnell 	void (*dma_info_read) (struct spu_context * ctx,
184b9e3bd77SDwayne Grant McConnell 			       struct spu_dma_info * info);
185b9e3bd77SDwayne Grant McConnell 	void (*proxydma_info_read) (struct spu_context * ctx,
186b9e3bd77SDwayne Grant McConnell 				    struct spu_proxydma_info * info);
18757dace23SArnd Bergmann 	void (*restart_dma)(struct spu_context *ctx);
1888b3d6663SArnd Bergmann };
1898b3d6663SArnd Bergmann 
1908b3d6663SArnd Bergmann extern struct spu_context_ops spu_hw_ops;
1918b3d6663SArnd Bergmann extern struct spu_context_ops spu_backing_ops;
1928b3d6663SArnd Bergmann 
19367207b96SArnd Bergmann struct spufs_inode_info {
19467207b96SArnd Bergmann 	struct spu_context *i_ctx;
1956263203eSArnd Bergmann 	struct spu_gang *i_gang;
19667207b96SArnd Bergmann 	struct inode vfs_inode;
19743c2bbd9SChristoph Hellwig 	int i_openers;
19867207b96SArnd Bergmann };
19967207b96SArnd Bergmann #define SPUFS_I(inode) \
20067207b96SArnd Bergmann 	container_of(inode, struct spufs_inode_info, vfs_inode)
20167207b96SArnd Bergmann 
20267207b96SArnd Bergmann extern struct tree_descr spufs_dir_contents[];
2035737edd1SMark Nutter extern struct tree_descr spufs_dir_nosched_contents[];
20467207b96SArnd Bergmann 
20567207b96SArnd Bergmann /* system call implementation */
20698f06978SJeremy Kerr extern struct spufs_calls spufs_calls;
20750af32a9SJeremy Kerr long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *status);
2088e68e2f2SArnd Bergmann long spufs_create(struct nameidata *nd, unsigned int flags,
2098e68e2f2SArnd Bergmann 			mode_t mode, struct file *filp);
21048cad41fSMichael Ellerman /* ELF coredump callbacks for writing SPU ELF notes */
21148cad41fSMichael Ellerman extern int spufs_coredump_extra_notes_size(void);
2127af1443aSMichael Ellerman extern int spufs_coredump_extra_notes_write(struct file *file, loff_t *foffset);
21348cad41fSMichael Ellerman 
2149c2e08c5SArjan van de Ven extern const struct file_operations spufs_context_fops;
21567207b96SArnd Bergmann 
2166263203eSArnd Bergmann /* gang management */
2176263203eSArnd Bergmann struct spu_gang *alloc_spu_gang(void);
2186263203eSArnd Bergmann struct spu_gang *get_spu_gang(struct spu_gang *gang);
2196263203eSArnd Bergmann int put_spu_gang(struct spu_gang *gang);
2206263203eSArnd Bergmann void spu_gang_remove_ctx(struct spu_gang *gang, struct spu_context *ctx);
2216263203eSArnd Bergmann void spu_gang_add_ctx(struct spu_gang *gang, struct spu_context *ctx);
2226263203eSArnd Bergmann 
22357dace23SArnd Bergmann /* fault handling */
22457dace23SArnd Bergmann int spufs_handle_class1(struct spu_context *ctx);
225d6ad39bcSJeremy Kerr int spufs_handle_class0(struct spu_context *ctx);
22657dace23SArnd Bergmann 
227c5fc8d2aSArnd Bergmann /* affinity */
228c5fc8d2aSArnd Bergmann struct spu *affinity_check(struct spu_context *ctx);
229c5fc8d2aSArnd Bergmann 
23067207b96SArnd Bergmann /* context management */
23165de66f0SChristoph Hellwig extern atomic_t nr_spu_contexts;
2326a0641e5SChristoph Hellwig static inline void spu_acquire(struct spu_context *ctx)
2336a0641e5SChristoph Hellwig {
2346a0641e5SChristoph Hellwig 	mutex_lock(&ctx->state_mutex);
2356a0641e5SChristoph Hellwig }
2366a0641e5SChristoph Hellwig 
2376a0641e5SChristoph Hellwig static inline void spu_release(struct spu_context *ctx)
2386a0641e5SChristoph Hellwig {
2396a0641e5SChristoph Hellwig 	mutex_unlock(&ctx->state_mutex);
2406a0641e5SChristoph Hellwig }
2416a0641e5SChristoph Hellwig 
2426263203eSArnd Bergmann struct spu_context * alloc_spu_context(struct spu_gang *gang);
24367207b96SArnd Bergmann void destroy_spu_context(struct kref *kref);
24467207b96SArnd Bergmann struct spu_context * get_spu_context(struct spu_context *ctx);
24567207b96SArnd Bergmann int put_spu_context(struct spu_context *ctx);
2465110459fSArnd Bergmann void spu_unmap_mappings(struct spu_context *ctx);
24767207b96SArnd Bergmann 
2488b3d6663SArnd Bergmann void spu_forget(struct spu_context *ctx);
24967207b96SArnd Bergmann void spu_acquire_saved(struct spu_context *ctx);
25027b1ea09SChristoph Hellwig void spu_release_saved(struct spu_context *ctx);
25150b520d4SChristoph Hellwig 
252e65c2f6fSLuke Browning int spu_stopped(struct spu_context *ctx, u32 * stat);
253e65c2f6fSLuke Browning void spu_del_from_rq(struct spu_context *ctx);
25426bec673SChristoph Hellwig int spu_activate(struct spu_context *ctx, unsigned long flags);
2558b3d6663SArnd Bergmann void spu_deactivate(struct spu_context *ctx);
2568b3d6663SArnd Bergmann void spu_yield(struct spu_context *ctx);
25736aaccc1SBob Nelson void spu_switch_notify(struct spu *spu, struct spu_context *ctx);
258fe443ef2SChristoph Hellwig void spu_set_timeslice(struct spu_context *ctx);
2592cf2b3b4SChristoph Hellwig void spu_update_sched_info(struct spu_context *ctx);
2602cf2b3b4SChristoph Hellwig void __spu_update_sched_info(struct spu_context *ctx);
2618b3d6663SArnd Bergmann int __init spu_sched_init(void);
262d1450317SSebastian Siewior void spu_sched_exit(void);
2638b3d6663SArnd Bergmann 
264c6730ed4SJeremy Kerr extern char *isolated_loader;
265c6730ed4SJeremy Kerr 
266ce8ab854SArnd Bergmann /*
267ce8ab854SArnd Bergmann  * spufs_wait
268ce8ab854SArnd Bergmann  *	Same as wait_event_interruptible(), except that here
269ce8ab854SArnd Bergmann  *	we need to call spu_release(ctx) before sleeping, and
270ce8ab854SArnd Bergmann  *	then spu_acquire(ctx) when awoken.
271ce8ab854SArnd Bergmann  */
272ce8ab854SArnd Bergmann 
273ce8ab854SArnd Bergmann #define spufs_wait(wq, condition)					\
274ce8ab854SArnd Bergmann ({									\
275ce8ab854SArnd Bergmann 	int __ret = 0;							\
276ce8ab854SArnd Bergmann 	DEFINE_WAIT(__wait);						\
277ce8ab854SArnd Bergmann 	for (;;) {							\
278ce8ab854SArnd Bergmann 		prepare_to_wait(&(wq), &__wait, TASK_INTERRUPTIBLE);	\
279ce8ab854SArnd Bergmann 		if (condition)						\
280ce8ab854SArnd Bergmann 			break;						\
281d3764397SJeremy Kerr 		if (signal_pending(current)) {				\
282d3764397SJeremy Kerr 			__ret = -ERESTARTSYS;				\
283d3764397SJeremy Kerr 			break;						\
284d3764397SJeremy Kerr 		}							\
285ce8ab854SArnd Bergmann 		spu_release(ctx);					\
286ce8ab854SArnd Bergmann 		schedule();						\
287ce8ab854SArnd Bergmann 		spu_acquire(ctx);					\
288ce8ab854SArnd Bergmann 	}								\
289ce8ab854SArnd Bergmann 	finish_wait(&(wq), &__wait);					\
290ce8ab854SArnd Bergmann 	__ret;								\
291ce8ab854SArnd Bergmann })
292ce8ab854SArnd Bergmann 
2938b3d6663SArnd Bergmann size_t spu_wbox_write(struct spu_context *ctx, u32 data);
2948b3d6663SArnd Bergmann size_t spu_ibox_read(struct spu_context *ctx, u32 *data);
2958b3d6663SArnd Bergmann 
2968b3d6663SArnd Bergmann /* irq callback funcs. */
2978b3d6663SArnd Bergmann void spufs_ibox_callback(struct spu *spu);
2988b3d6663SArnd Bergmann void spufs_wbox_callback(struct spu *spu);
2995110459fSArnd Bergmann void spufs_stop_callback(struct spu *spu);
300a33a7d73SArnd Bergmann void spufs_mfc_callback(struct spu *spu);
3019add11daSArnd Bergmann void spufs_dma_callback(struct spu *spu, int type);
3028b3d6663SArnd Bergmann 
303bf1ab978SDwayne Grant McConnell extern struct spu_coredump_calls spufs_coredump_calls;
304bf1ab978SDwayne Grant McConnell struct spufs_coredump_reader {
305bf1ab978SDwayne Grant McConnell 	char *name;
306bf1ab978SDwayne Grant McConnell 	ssize_t (*read)(struct spu_context *ctx,
307bf1ab978SDwayne Grant McConnell 			char __user *buffer, size_t size, loff_t *pos);
30874de08bcSMichael Ellerman 	u64 (*get)(struct spu_context *ctx);
309bf1ab978SDwayne Grant McConnell 	size_t size;
310bf1ab978SDwayne Grant McConnell };
311bf1ab978SDwayne Grant McConnell extern struct spufs_coredump_reader spufs_coredump_read[];
312bf1ab978SDwayne Grant McConnell extern int spufs_coredump_num_notes;
313bf1ab978SDwayne Grant McConnell 
3147cd58e43SJeremy Kerr extern int spu_init_csa(struct spu_state *csa);
3157cd58e43SJeremy Kerr extern void spu_fini_csa(struct spu_state *csa);
3167cd58e43SJeremy Kerr extern int spu_save(struct spu_state *prev, struct spu *spu);
3177cd58e43SJeremy Kerr extern int spu_restore(struct spu_state *new, struct spu *spu);
3187cd58e43SJeremy Kerr extern int spu_switch(struct spu_state *prev, struct spu_state *new,
3197cd58e43SJeremy Kerr 		      struct spu *spu);
3207cd58e43SJeremy Kerr extern int spu_alloc_lscsa(struct spu_state *csa);
3217cd58e43SJeremy Kerr extern void spu_free_lscsa(struct spu_state *csa);
32227ec41d3SAndre Detsch 
3237cd58e43SJeremy Kerr extern void spuctx_switch_state(struct spu_context *ctx,
3247cd58e43SJeremy Kerr 		enum spu_utilization_state new_state);
325fe2f896dSChristoph Hellwig 
32667207b96SArnd Bergmann #endif
327