part.h (cef68bf9042dda6b77b5845a25f37b9ea882074b) part.h (7c4213f6a52f35ff6ba2d97aa4eb04cbfc963b86)
1/*
2 * (C) Copyright 2000-2004
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7#ifndef _PART_H
8#define _PART_H
9
10#include <ide.h>
11#include <common.h>
12
1/*
2 * (C) Copyright 2000-2004
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7#ifndef _PART_H
8#define _PART_H
9
10#include <ide.h>
11#include <common.h>
12
13typedef struct block_dev_desc {
13typedef struct block_dev_desc block_dev_desc_t;
14
15struct block_dev_desc {
14 int if_type; /* type of the interface */
15 int dev; /* device number */
16 unsigned char part_type; /* partition type */
17 unsigned char target; /* target SCSI ID */
18 unsigned char lun; /* target LUN */
19 unsigned char type; /* device type */
20 unsigned char removable; /* removable device */
21#ifdef CONFIG_LBA48
22 unsigned char lba48; /* device can use 48bit addr (ATA/ATAPI v7) */
23#endif
24 lbaint_t lba; /* number of blocks */
25 unsigned long blksz; /* block size */
26 int log2blksz; /* for convenience: log2(blksz) */
27 char vendor [40+1]; /* IDE model, SCSI Vendor */
28 char product[20+1]; /* IDE Serial no, SCSI product */
29 char revision[8+1]; /* firmware revision */
16 int if_type; /* type of the interface */
17 int dev; /* device number */
18 unsigned char part_type; /* partition type */
19 unsigned char target; /* target SCSI ID */
20 unsigned char lun; /* target LUN */
21 unsigned char type; /* device type */
22 unsigned char removable; /* removable device */
23#ifdef CONFIG_LBA48
24 unsigned char lba48; /* device can use 48bit addr (ATA/ATAPI v7) */
25#endif
26 lbaint_t lba; /* number of blocks */
27 unsigned long blksz; /* block size */
28 int log2blksz; /* for convenience: log2(blksz) */
29 char vendor [40+1]; /* IDE model, SCSI Vendor */
30 char product[20+1]; /* IDE Serial no, SCSI product */
31 char revision[8+1]; /* firmware revision */
30 unsigned long (*block_read)(int dev,
32 unsigned long (*block_read)(block_dev_desc_t *block_dev,
31 lbaint_t start,
32 lbaint_t blkcnt,
33 void *buffer);
33 lbaint_t start,
34 lbaint_t blkcnt,
35 void *buffer);
34 unsigned long (*block_write)(int dev,
36 unsigned long (*block_write)(block_dev_desc_t *block_dev,
35 lbaint_t start,
36 lbaint_t blkcnt,
37 const void *buffer);
37 lbaint_t start,
38 lbaint_t blkcnt,
39 const void *buffer);
38 unsigned long (*block_erase)(int dev,
40 unsigned long (*block_erase)(block_dev_desc_t *block_dev,
39 lbaint_t start,
40 lbaint_t blkcnt);
41 void *priv; /* driver private struct pointer */
41 lbaint_t start,
42 lbaint_t blkcnt);
43 void *priv; /* driver private struct pointer */
42}block_dev_desc_t;
44};
43
44#define BLOCK_CNT(size, block_dev_desc) (PAD_COUNT(size, block_dev_desc->blksz))
45#define PAD_TO_BLOCKSIZE(size, block_dev_desc) \
46 (PAD_SIZE(size, block_dev_desc->blksz))
47#define LOG2(x) (((x & 0xaaaaaaaa) ? 1 : 0) + ((x & 0xcccccccc) ? 2 : 0) + \
48 ((x & 0xf0f0f0f0) ? 4 : 0) + ((x & 0xff00ff00) ? 8 : 0) + \
49 ((x & 0xffff0000) ? 16 : 0))
50#define LOG2_INVALID(type) ((type)((sizeof(type)<<3)-1))

--- 257 unchanged lines hidden ---
45
46#define BLOCK_CNT(size, block_dev_desc) (PAD_COUNT(size, block_dev_desc->blksz))
47#define PAD_TO_BLOCKSIZE(size, block_dev_desc) \
48 (PAD_SIZE(size, block_dev_desc->blksz))
49#define LOG2(x) (((x & 0xaaaaaaaa) ? 1 : 0) + ((x & 0xcccccccc) ? 2 : 0) + \
50 ((x & 0xf0f0f0f0) ? 4 : 0) + ((x & 0xff00ff00) ? 8 : 0) + \
51 ((x & 0xffff0000) ? 16 : 0))
52#define LOG2_INVALID(type) ((type)((sizeof(type)<<3)-1))

--- 257 unchanged lines hidden ---