1makecom(9F) Kernel Functions for Drivers makecom(9F)
2
3
4
6 makecom, makecom_g0, makecom_g0_s, makecom_g1, makecom_g5 - make a
7 packet for SCSI commands
8
10 #include <sys/scsi/scsi.h>
11
12 void makecom_g0(struct scsi_pkt *pkt, struct scsi_device *devp,
13 int flag, int cmd, int addr, int cnt);
14
15
16 void makecom_g0_s(struct scsi_pkt *pkt, struct scsi_device *devp,
17 int flag, int cmd, int cnt, int fixbit);
18
19
20 void makecom_g1(struct scsi_pkt *pkt, struct scsi_device *devp,
21 int flag, int cmd, int addr, int cnt);
22
23
24 void makecom_g5(struct scsi_pkt *pkt, struct scsi_device *devp,
25 int flag, int cmd, int addr, int cnt);
26
27
29 These interfaces are obsolete. scsi_setup_cdb(9F) should be used
30 instead.
31
33 pkt Pointer to an allocated scsi_pkt(9S) structure.
34
35
36 devp Pointer to the target's scsi_device(9S) structure.
37
38
39 flag Flags for the pkt_flags member.
40
41
42 cmd First byte of a group 0 or 1 or 5 SCSI CDB.
43
44
45 addr Pointer to the location of the data.
46
47
48 cnt Data transfer length in units defined by the SCSI device
49 type. For sequential devices cnt is the number of bytes. For
50 block devices, cnt is the number of blocks.
51
52
53 fixbit Fixed bit in sequential access device commands.
54
55
57 The makecom functions initialize a packet with the specified command
58 descriptor block, devp and transport flags. The pkt_address, pkt_flags,
59 and the command descriptor block pointed to by pkt_cdbp are initialized
60 using the remaining arguments. Target drivers may use makecom_g0() for
61 Group 0 commands (except for sequential access devices), or make‐
62 com_g0_s() for Group 0 commands for sequential access devices, or make‐
63 com_g1() for Group 1 commands, or makecom_g5() for Group 5 commands.
64 fixbit is used by sequential access devices for accessing fixed block
65 sizes and sets the tag portion of the SCSI CDB.
66
68 These functions can be called from user, interrupt, or kernel context.
69
71 Example 1 Using makecom Functions
72
73 if (blkno >= (1<<20)) {
74 makecom_g1(pkt, SD_SCSI_DEVP, pflag, SCMD_WRITE_G1,
75 (int) blkno, nblk);
76 } else {
77 makecom_g0(pkt, SD_SCSI_DEVP, pflag, SCMD_WRITE,
78 (int) blkno, nblk);
79 }
80
81
83 See attributes(5) for a description of the following attributes:
84
85
86
87
88 ┌─────────────────────────────┬─────────────────────────────┐
89 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
90 ├─────────────────────────────┼─────────────────────────────┤
91 │Stability Level │Obsolete │
92 └─────────────────────────────┴─────────────────────────────┘
93
95 attributes(5), scsi_setup_cdb(9F), scsi_device(9S), scsi_pkt(9S)
96
97
98 ANSI Small Computer System Interface-2 (SCSI-2)
99
100
101 Writing Device Drivers
102
104 The makecom_g0(), makecom_g0_s(), makecom_g1(), and makecom_g5() func‐
105 tions are obsolete and will be discontinued in a future release. These
106 functions have been replaced by the scsi_setup_cdb() function. See
107 scsi_setup_cdb(9F).
108
109
110
111SunOS 5.11 16 Jan 2006 makecom(9F)