xref: /haiku/src/add-ons/kernel/busses/scsi/ahci/sata_request.h (revision ed6250c95736c0b55da79d6e9dd01369532260c0)
1 /*
2  * Copyright 2008, Marcus Overhagen. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef _SATA_REQUEST_H
6 #define _SATA_REQUEST_H
7 
8 #include "ahci_defs.h"
9 
10 class sata_request
11 {
12 public:
13 					sata_request();
14 					sata_request(scsi_ccb *ccb);
15 					~sata_request();
16 
17 	void			set_data(void *data, size_t dataSize);
18 
19 	void			set_ata_cmd(uint8 command);
20 	void			set_ata28_cmd(uint8 command, uint32 lba, uint8 sectorCount);
21 	void			set_ata48_cmd(uint8 command, uint64 lba, uint16 sectorCount);
22 
23 	scsi_ccb *		ccb();
24 	const void *	fis();
25 	void *			data();
26 	int				size();
27 	void			finish(int tfd, size_t bytesTransfered);
28 	void			abort();
29 
30 	void			wait_for_completition();
31 	int				completition_status();
32 
33 private:
34 	scsi_ccb *		fCcb;
35 	uint8			fFis[20];
36 	sem_id			fCompletionSem;
37 	int				fCompletionStatus;
38 	void *			fData;
39 	size_t			fDataSize;
40 };
41 
42 
43 inline scsi_ccb *
44 sata_request::ccb()
45 {
46 	return fCcb;
47 }
48 
49 
50 inline const void *
51 sata_request::fis()
52 {
53 	return fFis;
54 }
55 
56 
57 inline void *
58 sata_request::data()
59 {
60 	return fData;
61 }
62 
63 
64 inline int
65 sata_request::size()
66 {
67 	return fDataSize;
68 }
69 
70 
71 #endif
72