scsi_cd.c (107193) | scsi_cd.c (109623) |
---|---|
1/* 2 * Copyright (c) 1997 Justin T. Gibbs. 3 * Copyright (c) 1997, 1998, 1999, 2000, 2001 Kenneth D. Merry. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * | 1/* 2 * Copyright (c) 1997 Justin T. Gibbs. 3 * Copyright (c) 1997, 1998, 1999, 2000, 2001 Kenneth D. Merry. 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 10 unchanged lines hidden (view full) --- 19 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * |
27 * $FreeBSD: head/sys/cam/scsi/scsi_cd.c 107193 2002-11-23 22:51:50Z njl $ | 27 * $FreeBSD: head/sys/cam/scsi/scsi_cd.c 109623 2003-01-21 08:56:16Z alfred $ |
28 */ 29/* 30 * Portions of this driver taken from the original FreeBSD cd driver. 31 * Written by Julian Elischer (julian@tfs.com) 32 * for TRW Financial Systems for use under the MACH(2.5) operating system. 33 * 34 * TRW Financial Systems, in accordance with their agreement with Carnegie 35 * Mellon University, makes this software available to CMU to distribute --- 1747 unchanged lines hidden (view full) --- 1783 1784 case CDIOCPLAYTRACKS: 1785 { 1786 struct ioc_play_track *args 1787 = (struct ioc_play_track *) addr; 1788 struct cd_mode_data *data; 1789 1790 data = malloc(sizeof(struct cd_mode_data), M_TEMP, | 28 */ 29/* 30 * Portions of this driver taken from the original FreeBSD cd driver. 31 * Written by Julian Elischer (julian@tfs.com) 32 * for TRW Financial Systems for use under the MACH(2.5) operating system. 33 * 34 * TRW Financial Systems, in accordance with their agreement with Carnegie 35 * Mellon University, makes this software available to CMU to distribute --- 1747 unchanged lines hidden (view full) --- 1783 1784 case CDIOCPLAYTRACKS: 1785 { 1786 struct ioc_play_track *args 1787 = (struct ioc_play_track *) addr; 1788 struct cd_mode_data *data; 1789 1790 data = malloc(sizeof(struct cd_mode_data), M_TEMP, |
1791 M_WAITOK); | 1791 0); |
1792 1793 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 1794 ("trying to do CDIOCPLAYTRACKS\n")); 1795 1796 error = cdgetmode(periph, data, AUDIO_PAGE); 1797 if (error) { 1798 free(data, M_TEMP); 1799 break; --- 17 unchanged lines hidden (view full) --- 1817 break; 1818 case CDIOCPLAYMSF: 1819 { 1820 struct ioc_play_msf *args 1821 = (struct ioc_play_msf *) addr; 1822 struct cd_mode_data *data; 1823 1824 data = malloc(sizeof(struct cd_mode_data), M_TEMP, | 1792 1793 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 1794 ("trying to do CDIOCPLAYTRACKS\n")); 1795 1796 error = cdgetmode(periph, data, AUDIO_PAGE); 1797 if (error) { 1798 free(data, M_TEMP); 1799 break; --- 17 unchanged lines hidden (view full) --- 1817 break; 1818 case CDIOCPLAYMSF: 1819 { 1820 struct ioc_play_msf *args 1821 = (struct ioc_play_msf *) addr; 1822 struct cd_mode_data *data; 1823 1824 data = malloc(sizeof(struct cd_mode_data), M_TEMP, |
1825 M_WAITOK); | 1825 0); |
1826 1827 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 1828 ("trying to do CDIOCPLAYMSF\n")); 1829 1830 error = cdgetmode(periph, data, AUDIO_PAGE); 1831 if (error) { 1832 free(data, M_TEMP); 1833 break; --- 18 unchanged lines hidden (view full) --- 1852 struct ioc_play_blocks *args 1853 = (struct ioc_play_blocks *) addr; 1854 struct cd_mode_data *data; 1855 1856 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 1857 ("trying to do CDIOCPLAYBLOCKS\n")); 1858 1859 data = malloc(sizeof(struct cd_mode_data), M_TEMP, | 1826 1827 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 1828 ("trying to do CDIOCPLAYMSF\n")); 1829 1830 error = cdgetmode(periph, data, AUDIO_PAGE); 1831 if (error) { 1832 free(data, M_TEMP); 1833 break; --- 18 unchanged lines hidden (view full) --- 1852 struct ioc_play_blocks *args 1853 = (struct ioc_play_blocks *) addr; 1854 struct cd_mode_data *data; 1855 1856 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 1857 ("trying to do CDIOCPLAYBLOCKS\n")); 1858 1859 data = malloc(sizeof(struct cd_mode_data), M_TEMP, |
1860 M_WAITOK); | 1860 0); |
1861 1862 error = cdgetmode(periph, data, AUDIO_PAGE); 1863 if (error) { 1864 free(data, M_TEMP); 1865 break; 1866 } 1867 data->page.audio.flags &= ~CD_PA_SOTC; 1868 data->page.audio.flags |= CD_PA_IMMED; --- 10 unchanged lines hidden (view full) --- 1879 = (struct ioc_read_subchannel *) addr; 1880 struct cd_sub_channel_info *data; 1881 u_int32_t len = args->data_len; 1882 1883 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 1884 ("trying to do CDIOCREADSUBCHANNEL\n")); 1885 1886 data = malloc(sizeof(struct cd_sub_channel_info), | 1861 1862 error = cdgetmode(periph, data, AUDIO_PAGE); 1863 if (error) { 1864 free(data, M_TEMP); 1865 break; 1866 } 1867 data->page.audio.flags &= ~CD_PA_SOTC; 1868 data->page.audio.flags |= CD_PA_IMMED; --- 10 unchanged lines hidden (view full) --- 1879 = (struct ioc_read_subchannel *) addr; 1880 struct cd_sub_channel_info *data; 1881 u_int32_t len = args->data_len; 1882 1883 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 1884 ("trying to do CDIOCREADSUBCHANNEL\n")); 1885 1886 data = malloc(sizeof(struct cd_sub_channel_info), |
1887 M_TEMP, M_WAITOK); | 1887 M_TEMP, 0); |
1888 1889 if ((len > sizeof(struct cd_sub_channel_info)) || 1890 (len < sizeof(struct cd_sub_channel_header))) { 1891 printf( 1892 "scsi_cd: cdioctl: " 1893 "cdioreadsubchannel: error, len=%d\n", 1894 len); 1895 error = EINVAL; --- 27 unchanged lines hidden (view full) --- 1923 case CDIOREADTOCHEADER: 1924 { 1925 struct ioc_toc_header *th; 1926 1927 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 1928 ("trying to do CDIOREADTOCHEADER\n")); 1929 1930 th = malloc(sizeof(struct ioc_toc_header), M_TEMP, | 1888 1889 if ((len > sizeof(struct cd_sub_channel_info)) || 1890 (len < sizeof(struct cd_sub_channel_header))) { 1891 printf( 1892 "scsi_cd: cdioctl: " 1893 "cdioreadsubchannel: error, len=%d\n", 1894 len); 1895 error = EINVAL; --- 27 unchanged lines hidden (view full) --- 1923 case CDIOREADTOCHEADER: 1924 { 1925 struct ioc_toc_header *th; 1926 1927 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 1928 ("trying to do CDIOREADTOCHEADER\n")); 1929 1930 th = malloc(sizeof(struct ioc_toc_header), M_TEMP, |
1931 M_WAITOK); | 1931 0); |
1932 error = cdreadtoc(periph, 0, 0, 1933 (struct cd_toc_entry *)th, 1934 sizeof (*th)); 1935 if (error) { 1936 free(th, M_TEMP); 1937 break; 1938 } 1939 if (softc->quirks & CD_Q_BCD_TRACKS) { --- 26 unchanged lines hidden (view full) --- 1966 (struct ioc_read_toc_entry *) addr; 1967 struct ioc_toc_header *th; 1968 u_int32_t len, readlen, idx, num; 1969 u_int32_t starting_track = te->starting_track; 1970 1971 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 1972 ("trying to do CDIOREADTOCENTRYS\n")); 1973 | 1932 error = cdreadtoc(periph, 0, 0, 1933 (struct cd_toc_entry *)th, 1934 sizeof (*th)); 1935 if (error) { 1936 free(th, M_TEMP); 1937 break; 1938 } 1939 if (softc->quirks & CD_Q_BCD_TRACKS) { --- 26 unchanged lines hidden (view full) --- 1966 (struct ioc_read_toc_entry *) addr; 1967 struct ioc_toc_header *th; 1968 u_int32_t len, readlen, idx, num; 1969 u_int32_t starting_track = te->starting_track; 1970 1971 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 1972 ("trying to do CDIOREADTOCENTRYS\n")); 1973 |
1974 data = malloc(sizeof(data_t), M_TEMP, M_WAITOK); 1975 lead = malloc(sizeof(lead_t), M_TEMP, M_WAITOK); | 1974 data = malloc(sizeof(data_t), M_TEMP, 0); 1975 lead = malloc(sizeof(lead_t), M_TEMP, 0); |
1976 1977 if (te->data_len < sizeof(struct cd_toc_entry) 1978 || (te->data_len % sizeof(struct cd_toc_entry)) != 0 1979 || (te->address_format != CD_MSF_FORMAT 1980 && te->address_format != CD_LBA_FORMAT)) { 1981 error = EINVAL; 1982 printf("scsi_cd: error in readtocentries, " 1983 "returning EINVAL\n"); --- 109 unchanged lines hidden (view full) --- 2093 struct ioc_read_toc_single_entry *te = 2094 (struct ioc_read_toc_single_entry *) addr; 2095 struct ioc_toc_header *th; 2096 u_int32_t track; 2097 2098 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2099 ("trying to do CDIOREADTOCENTRY\n")); 2100 | 1976 1977 if (te->data_len < sizeof(struct cd_toc_entry) 1978 || (te->data_len % sizeof(struct cd_toc_entry)) != 0 1979 || (te->address_format != CD_MSF_FORMAT 1980 && te->address_format != CD_LBA_FORMAT)) { 1981 error = EINVAL; 1982 printf("scsi_cd: error in readtocentries, " 1983 "returning EINVAL\n"); --- 109 unchanged lines hidden (view full) --- 2093 struct ioc_read_toc_single_entry *te = 2094 (struct ioc_read_toc_single_entry *) addr; 2095 struct ioc_toc_header *th; 2096 u_int32_t track; 2097 2098 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2099 ("trying to do CDIOREADTOCENTRY\n")); 2100 |
2101 data = malloc(sizeof(data_t), M_TEMP, M_WAITOK); | 2101 data = malloc(sizeof(data_t), M_TEMP, 0); |
2102 2103 if (te->address_format != CD_MSF_FORMAT 2104 && te->address_format != CD_LBA_FORMAT) { 2105 printf("error in readtocentry, " 2106 " returning EINVAL\n"); 2107 free(data, M_TEMP); 2108 error = EINVAL; 2109 break; --- 49 unchanged lines hidden (view full) --- 2159 { 2160 struct ioc_patch *arg = (struct ioc_patch *) addr; 2161 struct cd_mode_data *data; 2162 2163 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2164 ("trying to do CDIOCSETPATCH\n")); 2165 2166 data = malloc(sizeof(struct cd_mode_data), M_TEMP, | 2102 2103 if (te->address_format != CD_MSF_FORMAT 2104 && te->address_format != CD_LBA_FORMAT) { 2105 printf("error in readtocentry, " 2106 " returning EINVAL\n"); 2107 free(data, M_TEMP); 2108 error = EINVAL; 2109 break; --- 49 unchanged lines hidden (view full) --- 2159 { 2160 struct ioc_patch *arg = (struct ioc_patch *) addr; 2161 struct cd_mode_data *data; 2162 2163 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2164 ("trying to do CDIOCSETPATCH\n")); 2165 2166 data = malloc(sizeof(struct cd_mode_data), M_TEMP, |
2167 M_WAITOK); | 2167 0); |
2168 error = cdgetmode(periph, data, AUDIO_PAGE); 2169 if (error) { 2170 free(data, M_TEMP); 2171 break; 2172 } 2173 data->page.audio.port[LEFT_PORT].channels = 2174 arg->patch[0]; 2175 data->page.audio.port[RIGHT_PORT].channels = --- 8 unchanged lines hidden (view full) --- 2184 { 2185 struct ioc_vol *arg = (struct ioc_vol *) addr; 2186 struct cd_mode_data *data; 2187 2188 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2189 ("trying to do CDIOCGETVOL\n")); 2190 2191 data = malloc(sizeof(struct cd_mode_data), M_TEMP, | 2168 error = cdgetmode(periph, data, AUDIO_PAGE); 2169 if (error) { 2170 free(data, M_TEMP); 2171 break; 2172 } 2173 data->page.audio.port[LEFT_PORT].channels = 2174 arg->patch[0]; 2175 data->page.audio.port[RIGHT_PORT].channels = --- 8 unchanged lines hidden (view full) --- 2184 { 2185 struct ioc_vol *arg = (struct ioc_vol *) addr; 2186 struct cd_mode_data *data; 2187 2188 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2189 ("trying to do CDIOCGETVOL\n")); 2190 2191 data = malloc(sizeof(struct cd_mode_data), M_TEMP, |
2192 M_WAITOK); | 2192 0); |
2193 error = cdgetmode(periph, data, AUDIO_PAGE); 2194 if (error) { 2195 free(data, M_TEMP); 2196 break; 2197 } 2198 arg->vol[LEFT_PORT] = 2199 data->page.audio.port[LEFT_PORT].volume; 2200 arg->vol[RIGHT_PORT] = --- 7 unchanged lines hidden (view full) --- 2208 { 2209 struct ioc_vol *arg = (struct ioc_vol *) addr; 2210 struct cd_mode_data *data; 2211 2212 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2213 ("trying to do CDIOCSETVOL\n")); 2214 2215 data = malloc(sizeof(struct cd_mode_data), M_TEMP, | 2193 error = cdgetmode(periph, data, AUDIO_PAGE); 2194 if (error) { 2195 free(data, M_TEMP); 2196 break; 2197 } 2198 arg->vol[LEFT_PORT] = 2199 data->page.audio.port[LEFT_PORT].volume; 2200 arg->vol[RIGHT_PORT] = --- 7 unchanged lines hidden (view full) --- 2208 { 2209 struct ioc_vol *arg = (struct ioc_vol *) addr; 2210 struct cd_mode_data *data; 2211 2212 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2213 ("trying to do CDIOCSETVOL\n")); 2214 2215 data = malloc(sizeof(struct cd_mode_data), M_TEMP, |
2216 M_WAITOK); | 2216 0); |
2217 error = cdgetmode(periph, data, AUDIO_PAGE); 2218 if (error) { 2219 free(data, M_TEMP); 2220 break; 2221 } 2222 data->page.audio.port[LEFT_PORT].channels = CHANNEL_0; 2223 data->page.audio.port[LEFT_PORT].volume = 2224 arg->vol[LEFT_PORT]; --- 9 unchanged lines hidden (view full) --- 2234 case CDIOCSETMONO: 2235 { 2236 struct cd_mode_data *data; 2237 2238 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2239 ("trying to do CDIOCSETMONO\n")); 2240 2241 data = malloc(sizeof(struct cd_mode_data), | 2217 error = cdgetmode(periph, data, AUDIO_PAGE); 2218 if (error) { 2219 free(data, M_TEMP); 2220 break; 2221 } 2222 data->page.audio.port[LEFT_PORT].channels = CHANNEL_0; 2223 data->page.audio.port[LEFT_PORT].volume = 2224 arg->vol[LEFT_PORT]; --- 9 unchanged lines hidden (view full) --- 2234 case CDIOCSETMONO: 2235 { 2236 struct cd_mode_data *data; 2237 2238 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2239 ("trying to do CDIOCSETMONO\n")); 2240 2241 data = malloc(sizeof(struct cd_mode_data), |
2242 M_TEMP, M_WAITOK); | 2242 M_TEMP, 0); |
2243 error = cdgetmode(periph, data, AUDIO_PAGE); 2244 if (error) { 2245 free(data, M_TEMP); 2246 break; 2247 } 2248 data->page.audio.port[LEFT_PORT].channels = 2249 LEFT_CHANNEL | RIGHT_CHANNEL; 2250 data->page.audio.port[RIGHT_PORT].channels = --- 7 unchanged lines hidden (view full) --- 2258 case CDIOCSETSTEREO: 2259 { 2260 struct cd_mode_data *data; 2261 2262 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2263 ("trying to do CDIOCSETSTEREO\n")); 2264 2265 data = malloc(sizeof(struct cd_mode_data), M_TEMP, | 2243 error = cdgetmode(periph, data, AUDIO_PAGE); 2244 if (error) { 2245 free(data, M_TEMP); 2246 break; 2247 } 2248 data->page.audio.port[LEFT_PORT].channels = 2249 LEFT_CHANNEL | RIGHT_CHANNEL; 2250 data->page.audio.port[RIGHT_PORT].channels = --- 7 unchanged lines hidden (view full) --- 2258 case CDIOCSETSTEREO: 2259 { 2260 struct cd_mode_data *data; 2261 2262 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2263 ("trying to do CDIOCSETSTEREO\n")); 2264 2265 data = malloc(sizeof(struct cd_mode_data), M_TEMP, |
2266 M_WAITOK); | 2266 0); |
2267 error = cdgetmode(periph, data, AUDIO_PAGE); 2268 if (error) { 2269 free(data, M_TEMP); 2270 break; 2271 } 2272 data->page.audio.port[LEFT_PORT].channels = 2273 LEFT_CHANNEL; 2274 data->page.audio.port[RIGHT_PORT].channels = --- 7 unchanged lines hidden (view full) --- 2282 case CDIOCSETMUTE: 2283 { 2284 struct cd_mode_data *data; 2285 2286 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2287 ("trying to do CDIOCSETMUTE\n")); 2288 2289 data = malloc(sizeof(struct cd_mode_data), M_TEMP, | 2267 error = cdgetmode(periph, data, AUDIO_PAGE); 2268 if (error) { 2269 free(data, M_TEMP); 2270 break; 2271 } 2272 data->page.audio.port[LEFT_PORT].channels = 2273 LEFT_CHANNEL; 2274 data->page.audio.port[RIGHT_PORT].channels = --- 7 unchanged lines hidden (view full) --- 2282 case CDIOCSETMUTE: 2283 { 2284 struct cd_mode_data *data; 2285 2286 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2287 ("trying to do CDIOCSETMUTE\n")); 2288 2289 data = malloc(sizeof(struct cd_mode_data), M_TEMP, |
2290 M_WAITOK); | 2290 0); |
2291 error = cdgetmode(periph, data, AUDIO_PAGE); 2292 if (error) { 2293 free(data, M_TEMP); 2294 break; 2295 } 2296 data->page.audio.port[LEFT_PORT].channels = 0; 2297 data->page.audio.port[RIGHT_PORT].channels = 0; 2298 data->page.audio.port[2].channels = 0; --- 5 unchanged lines hidden (view full) --- 2304 case CDIOCSETLEFT: 2305 { 2306 struct cd_mode_data *data; 2307 2308 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2309 ("trying to do CDIOCSETLEFT\n")); 2310 2311 data = malloc(sizeof(struct cd_mode_data), M_TEMP, | 2291 error = cdgetmode(periph, data, AUDIO_PAGE); 2292 if (error) { 2293 free(data, M_TEMP); 2294 break; 2295 } 2296 data->page.audio.port[LEFT_PORT].channels = 0; 2297 data->page.audio.port[RIGHT_PORT].channels = 0; 2298 data->page.audio.port[2].channels = 0; --- 5 unchanged lines hidden (view full) --- 2304 case CDIOCSETLEFT: 2305 { 2306 struct cd_mode_data *data; 2307 2308 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2309 ("trying to do CDIOCSETLEFT\n")); 2310 2311 data = malloc(sizeof(struct cd_mode_data), M_TEMP, |
2312 M_WAITOK); | 2312 0); |
2313 error = cdgetmode(periph, data, AUDIO_PAGE); 2314 if (error) { 2315 free(data, M_TEMP); 2316 break; 2317 } 2318 data->page.audio.port[LEFT_PORT].channels = 2319 LEFT_CHANNEL; 2320 data->page.audio.port[RIGHT_PORT].channels = --- 7 unchanged lines hidden (view full) --- 2328 case CDIOCSETRIGHT: 2329 { 2330 struct cd_mode_data *data; 2331 2332 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2333 ("trying to do CDIOCSETRIGHT\n")); 2334 2335 data = malloc(sizeof(struct cd_mode_data), M_TEMP, | 2313 error = cdgetmode(periph, data, AUDIO_PAGE); 2314 if (error) { 2315 free(data, M_TEMP); 2316 break; 2317 } 2318 data->page.audio.port[LEFT_PORT].channels = 2319 LEFT_CHANNEL; 2320 data->page.audio.port[RIGHT_PORT].channels = --- 7 unchanged lines hidden (view full) --- 2328 case CDIOCSETRIGHT: 2329 { 2330 struct cd_mode_data *data; 2331 2332 CAM_DEBUG(periph->path, CAM_DEBUG_SUBTRACE, 2333 ("trying to do CDIOCSETRIGHT\n")); 2334 2335 data = malloc(sizeof(struct cd_mode_data), M_TEMP, |
2336 M_WAITOK); | 2336 0); |
2337 error = cdgetmode(periph, data, AUDIO_PAGE); 2338 if (error) { 2339 free(data, M_TEMP); 2340 break; 2341 } 2342 data->page.audio.port[LEFT_PORT].channels = 2343 RIGHT_CHANNEL; 2344 data->page.audio.port[RIGHT_PORT].channels = --- 135 unchanged lines hidden (view full) --- 2480 2481 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdsize\n")); 2482 2483 softc = (struct cd_softc *)periph->softc; 2484 2485 ccb = cdgetccb(periph, /* priority */ 1); 2486 2487 rcap_buf = malloc(sizeof(struct scsi_read_capacity_data), | 2337 error = cdgetmode(periph, data, AUDIO_PAGE); 2338 if (error) { 2339 free(data, M_TEMP); 2340 break; 2341 } 2342 data->page.audio.port[LEFT_PORT].channels = 2343 RIGHT_CHANNEL; 2344 data->page.audio.port[RIGHT_PORT].channels = --- 135 unchanged lines hidden (view full) --- 2480 2481 CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("entering cdsize\n")); 2482 2483 softc = (struct cd_softc *)periph->softc; 2484 2485 ccb = cdgetccb(periph, /* priority */ 1); 2486 2487 rcap_buf = malloc(sizeof(struct scsi_read_capacity_data), |
2488 M_TEMP, M_WAITOK); | 2488 M_TEMP, 0); |
2489 2490 scsi_read_capacity(&ccb->csio, 2491 /*retries*/ 1, 2492 cddone, 2493 MSG_SIMPLE_Q_TAG, 2494 rcap_buf, 2495 SSD_FULL_SIZE, 2496 /* timeout */20000); --- 552 unchanged lines hidden (view full) --- 3049 break; 3050 default: 3051 error = EINVAL; 3052 goto bailout; 3053 break; /* NOTREACHED */ 3054 } 3055 3056 if (length != 0) { | 2489 2490 scsi_read_capacity(&ccb->csio, 2491 /*retries*/ 1, 2492 cddone, 2493 MSG_SIMPLE_Q_TAG, 2494 rcap_buf, 2495 SSD_FULL_SIZE, 2496 /* timeout */20000); --- 552 unchanged lines hidden (view full) --- 3049 break; 3050 default: 3051 error = EINVAL; 3052 goto bailout; 3053 break; /* NOTREACHED */ 3054 } 3055 3056 if (length != 0) { |
3057 databuf = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); | 3057 databuf = malloc(length, M_DEVBUF, M_ZERO); |
3058 } else 3059 databuf = NULL; 3060 3061 3062 scsi_report_key(&ccb->csio, 3063 /* retries */ 1, 3064 /* cbfcnp */ cddone, 3065 /* tag_action */ MSG_SIMPLE_Q_TAG, --- 116 unchanged lines hidden (view full) --- 3182 ccb = cdgetccb(periph, /* priority */ 1); 3183 3184 switch(authinfo->format) { 3185 case DVD_SEND_CHALLENGE: { 3186 struct scsi_report_key_data_challenge *challenge_data; 3187 3188 length = sizeof(*challenge_data); 3189 | 3058 } else 3059 databuf = NULL; 3060 3061 3062 scsi_report_key(&ccb->csio, 3063 /* retries */ 1, 3064 /* cbfcnp */ cddone, 3065 /* tag_action */ MSG_SIMPLE_Q_TAG, --- 116 unchanged lines hidden (view full) --- 3182 ccb = cdgetccb(periph, /* priority */ 1); 3183 3184 switch(authinfo->format) { 3185 case DVD_SEND_CHALLENGE: { 3186 struct scsi_report_key_data_challenge *challenge_data; 3187 3188 length = sizeof(*challenge_data); 3189 |
3190 challenge_data = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); | 3190 challenge_data = malloc(length, M_DEVBUF, M_ZERO); |
3191 3192 databuf = (u_int8_t *)challenge_data; 3193 3194 scsi_ulto2b(length - sizeof(challenge_data->data_len), 3195 challenge_data->data_len); 3196 3197 bcopy(authinfo->keychal, challenge_data->challenge_key, 3198 min(sizeof(authinfo->keychal), 3199 sizeof(challenge_data->challenge_key))); 3200 break; 3201 } 3202 case DVD_SEND_KEY2: { 3203 struct scsi_report_key_data_key1_key2 *key2_data; 3204 3205 length = sizeof(*key2_data); 3206 | 3191 3192 databuf = (u_int8_t *)challenge_data; 3193 3194 scsi_ulto2b(length - sizeof(challenge_data->data_len), 3195 challenge_data->data_len); 3196 3197 bcopy(authinfo->keychal, challenge_data->challenge_key, 3198 min(sizeof(authinfo->keychal), 3199 sizeof(challenge_data->challenge_key))); 3200 break; 3201 } 3202 case DVD_SEND_KEY2: { 3203 struct scsi_report_key_data_key1_key2 *key2_data; 3204 3205 length = sizeof(*key2_data); 3206 |
3207 key2_data = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); | 3207 key2_data = malloc(length, M_DEVBUF, M_ZERO); |
3208 3209 databuf = (u_int8_t *)key2_data; 3210 3211 scsi_ulto2b(length - sizeof(key2_data->data_len), 3212 key2_data->data_len); 3213 3214 bcopy(authinfo->keychal, key2_data->key1, 3215 min(sizeof(authinfo->keychal), sizeof(key2_data->key1))); 3216 3217 break; 3218 } 3219 case DVD_SEND_RPC: { 3220 struct scsi_send_key_data_rpc *rpc_data; 3221 3222 length = sizeof(*rpc_data); 3223 | 3208 3209 databuf = (u_int8_t *)key2_data; 3210 3211 scsi_ulto2b(length - sizeof(key2_data->data_len), 3212 key2_data->data_len); 3213 3214 bcopy(authinfo->keychal, key2_data->key1, 3215 min(sizeof(authinfo->keychal), sizeof(key2_data->key1))); 3216 3217 break; 3218 } 3219 case DVD_SEND_RPC: { 3220 struct scsi_send_key_data_rpc *rpc_data; 3221 3222 length = sizeof(*rpc_data); 3223 |
3224 rpc_data = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); | 3224 rpc_data = malloc(length, M_DEVBUF, M_ZERO); |
3225 3226 databuf = (u_int8_t *)rpc_data; 3227 3228 scsi_ulto2b(length - sizeof(rpc_data->data_len), 3229 rpc_data->data_len); 3230 3231 rpc_data->region_code = authinfo->region; 3232 break; --- 125 unchanged lines hidden (view full) --- 3358 break; 3359 default: 3360 error = EINVAL; 3361 goto bailout; 3362 break; /* NOTREACHED */ 3363 } 3364 3365 if (length != 0) { | 3225 3226 databuf = (u_int8_t *)rpc_data; 3227 3228 scsi_ulto2b(length - sizeof(rpc_data->data_len), 3229 rpc_data->data_len); 3230 3231 rpc_data->region_code = authinfo->region; 3232 break; --- 125 unchanged lines hidden (view full) --- 3358 break; 3359 default: 3360 error = EINVAL; 3361 goto bailout; 3362 break; /* NOTREACHED */ 3363 } 3364 3365 if (length != 0) { |
3366 databuf = malloc(length, M_DEVBUF, M_WAITOK | M_ZERO); | 3366 databuf = malloc(length, M_DEVBUF, M_ZERO); |
3367 } else 3368 databuf = NULL; 3369 3370 scsi_read_dvd_structure(&ccb->csio, 3371 /* retries */ 1, 3372 /* cbfcnp */ cddone, 3373 /* tag_action */ MSG_SIMPLE_Q_TAG, 3374 /* lba */ address, --- 183 unchanged lines hidden --- | 3367 } else 3368 databuf = NULL; 3369 3370 scsi_read_dvd_structure(&ccb->csio, 3371 /* retries */ 1, 3372 /* cbfcnp */ cddone, 3373 /* tag_action */ MSG_SIMPLE_Q_TAG, 3374 /* lba */ address, --- 183 unchanged lines hidden --- |