summaryrefslogtreecommitdiff
path: root/lwis_device_slc.h
blob: ff82e107b50c27c43331e9eb424815de41a54aaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
 * Google LWIS SLC Device Driver
 *
 * Copyright (c) 2018 Google, LLC
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#ifndef LWIS_DEVICE_SLC_H_
#define LWIS_DEVICE_SLC_H_

#include "lwis_device.h"
#include <soc/google/pt.h>

#define MAX_NUM_PT 16

struct slc_partition {
	int id;
	size_t size_kb;
	int fd;
	ptid_t partition_id;
	struct pt_handle *partition_handle;
};

/*
 *  struct lwis_slc_device
 *  "Derived" lwis_device struct, with added slc related elements.
 */
struct lwis_slc_device {
	struct lwis_device base_dev;
	int num_pt;
	struct slc_partition pt[MAX_NUM_PT];
	struct pt_handle *partition_handle;
};

int lwis_slc_device_deinit(void);

int lwis_slc_buffer_alloc(struct lwis_device *lwis_dev, struct lwis_alloc_buffer_info *alloc_info);

int lwis_slc_buffer_free(struct lwis_device *lwis_dev, int fd);

#endif /* LWIS_DEVICE_SLC_H_ */