asr.c (108533) | asr.c (109623) |
---|---|
1/* 2 * Copyright (c) 1996-2000 Distributed Processing Technology Corporation 3 * Copyright (c) 2000-2001 Adaptec Corporation 4 * All rights reserved. 5 * 6 * TERMS AND CONDITIONS OF USE 7 * 8 * Redistribution and use in source form, with or without modification, are --- 89 unchanged lines hidden (view full) --- 98 * changed struct scsi_xfer to union ccb/struct ccb_hdr 99 * changed variable name xs to ccb 100 * changed struct scsi_link to struct cam_path 101 * changed struct scsibus_data to struct cam_sim 102 * stopped using fordriver for holding on to the TID 103 * use proprietary packet creation instead of scsi_inquire 104 * CAM layer sends synchronize commands. 105 * | 1/* 2 * Copyright (c) 1996-2000 Distributed Processing Technology Corporation 3 * Copyright (c) 2000-2001 Adaptec Corporation 4 * All rights reserved. 5 * 6 * TERMS AND CONDITIONS OF USE 7 * 8 * Redistribution and use in source form, with or without modification, are --- 89 unchanged lines hidden (view full) --- 98 * changed struct scsi_xfer to union ccb/struct ccb_hdr 99 * changed variable name xs to ccb 100 * changed struct scsi_link to struct cam_path 101 * changed struct scsibus_data to struct cam_sim 102 * stopped using fordriver for holding on to the TID 103 * use proprietary packet creation instead of scsi_inquire 104 * CAM layer sends synchronize commands. 105 * |
106 * $FreeBSD: head/sys/dev/asr/asr.c 108533 2003-01-01 18:49:04Z schweikh $ | 106 * $FreeBSD: head/sys/dev/asr/asr.c 109623 2003-01-21 08:56:16Z alfred $ |
107 */ 108 109#define ASR_VERSION 1 110#define ASR_REVISION '0' 111#define ASR_SUBREVISION '8' 112#define ASR_MONTH 8 113#define ASR_DAY 21 114#define ASR_YEAR 2001 - 1980 --- 791 unchanged lines hidden (view full) --- 906 907STATIC INLINE union asr_ccb * 908asr_alloc_ccb ( 909 IN Asr_softc_t * sc) 910{ 911 OUT union asr_ccb * new_ccb; 912 913 if ((new_ccb = (union asr_ccb *)malloc(sizeof(*new_ccb), | 107 */ 108 109#define ASR_VERSION 1 110#define ASR_REVISION '0' 111#define ASR_SUBREVISION '8' 112#define ASR_MONTH 8 113#define ASR_DAY 21 114#define ASR_YEAR 2001 - 1980 --- 791 unchanged lines hidden (view full) --- 906 907STATIC INLINE union asr_ccb * 908asr_alloc_ccb ( 909 IN Asr_softc_t * sc) 910{ 911 OUT union asr_ccb * new_ccb; 912 913 if ((new_ccb = (union asr_ccb *)malloc(sizeof(*new_ccb), |
914 M_DEVBUF, M_WAITOK | M_ZERO)) != (union asr_ccb *)NULL) { | 914 M_DEVBUF, M_ZERO)) != (union asr_ccb *)NULL) { |
915 new_ccb->ccb_h.pinfo.priority = 1; 916 new_ccb->ccb_h.pinfo.index = CAM_UNQUEUED_INDEX; 917 new_ccb->ccb_h.spriv_ptr0 = sc; 918 } 919 return (new_ccb); 920} /* asr_alloc_ccb */ 921 922STATIC INLINE void --- 277 unchanged lines hidden (view full) --- 1200 /* 1201 * Allocate a new structure? 1202 * Since one element in structure, the +1 1203 * needed for size has been abstracted. 1204 */ 1205 if ((new_entry == FALSE) 1206 || ((sc->ha_targets[bus] = bus_ptr = (target2lun_t *)malloc ( 1207 sizeof(*bus_ptr) + (sizeof(bus_ptr->LUN) * new_size), | 915 new_ccb->ccb_h.pinfo.priority = 1; 916 new_ccb->ccb_h.pinfo.index = CAM_UNQUEUED_INDEX; 917 new_ccb->ccb_h.spriv_ptr0 = sc; 918 } 919 return (new_ccb); 920} /* asr_alloc_ccb */ 921 922STATIC INLINE void --- 277 unchanged lines hidden (view full) --- 1200 /* 1201 * Allocate a new structure? 1202 * Since one element in structure, the +1 1203 * needed for size has been abstracted. 1204 */ 1205 if ((new_entry == FALSE) 1206 || ((sc->ha_targets[bus] = bus_ptr = (target2lun_t *)malloc ( 1207 sizeof(*bus_ptr) + (sizeof(bus_ptr->LUN) * new_size), |
1208 M_TEMP, M_WAITOK | M_ZERO)) | 1208 M_TEMP, M_ZERO)) |
1209 == (target2lun_t *)NULL)) { 1210 debug_asr_printf("failed to allocate bus list\n"); 1211 return ((tid_t *)NULL); 1212 } 1213 bus_ptr->size = new_size + 1; 1214 } else if (bus_ptr->size <= new_size) { 1215 target2lun_t * new_bus_ptr; 1216 1217 /* 1218 * Reallocate a new structure? 1219 * Since one element in structure, the +1 1220 * needed for size has been abstracted. 1221 */ 1222 if ((new_entry == FALSE) 1223 || ((new_bus_ptr = (target2lun_t *)malloc ( 1224 sizeof(*bus_ptr) + (sizeof(bus_ptr->LUN) * new_size), | 1209 == (target2lun_t *)NULL)) { 1210 debug_asr_printf("failed to allocate bus list\n"); 1211 return ((tid_t *)NULL); 1212 } 1213 bus_ptr->size = new_size + 1; 1214 } else if (bus_ptr->size <= new_size) { 1215 target2lun_t * new_bus_ptr; 1216 1217 /* 1218 * Reallocate a new structure? 1219 * Since one element in structure, the +1 1220 * needed for size has been abstracted. 1221 */ 1222 if ((new_entry == FALSE) 1223 || ((new_bus_ptr = (target2lun_t *)malloc ( 1224 sizeof(*bus_ptr) + (sizeof(bus_ptr->LUN) * new_size), |
1225 M_TEMP, M_WAITOK | M_ZERO)) | 1225 M_TEMP, M_ZERO)) |
1226 == (target2lun_t *)NULL)) { 1227 debug_asr_printf("failed to reallocate bus list\n"); 1228 return ((tid_t *)NULL); 1229 } 1230 /* 1231 * Copy the whole thing, safer, simpler coding 1232 * and not really performance critical at this point. 1233 */ --- 19 unchanged lines hidden (view full) --- 1253 /* 1254 * Allocate a new structure? 1255 * Since one element in structure, the +1 1256 * needed for size has been abstracted. 1257 */ 1258 if ((new_entry == FALSE) 1259 || ((bus_ptr->LUN[target] = target_ptr = (lun2tid_t *)malloc ( 1260 sizeof(*target_ptr) + (sizeof(target_ptr->TID) * new_size), | 1226 == (target2lun_t *)NULL)) { 1227 debug_asr_printf("failed to reallocate bus list\n"); 1228 return ((tid_t *)NULL); 1229 } 1230 /* 1231 * Copy the whole thing, safer, simpler coding 1232 * and not really performance critical at this point. 1233 */ --- 19 unchanged lines hidden (view full) --- 1253 /* 1254 * Allocate a new structure? 1255 * Since one element in structure, the +1 1256 * needed for size has been abstracted. 1257 */ 1258 if ((new_entry == FALSE) 1259 || ((bus_ptr->LUN[target] = target_ptr = (lun2tid_t *)malloc ( 1260 sizeof(*target_ptr) + (sizeof(target_ptr->TID) * new_size), |
1261 M_TEMP, M_WAITOK | M_ZERO)) | 1261 M_TEMP, M_ZERO)) |
1262 == (lun2tid_t *)NULL)) { 1263 debug_asr_printf("failed to allocate target list\n"); 1264 return ((tid_t *)NULL); 1265 } 1266 target_ptr->size = new_size + 1; 1267 } else if (target_ptr->size <= new_size) { 1268 lun2tid_t * new_target_ptr; 1269 1270 /* 1271 * Reallocate a new structure? 1272 * Since one element in structure, the +1 1273 * needed for size has been abstracted. 1274 */ 1275 if ((new_entry == FALSE) 1276 || ((new_target_ptr = (lun2tid_t *)malloc ( 1277 sizeof(*target_ptr) + (sizeof(target_ptr->TID) * new_size), | 1262 == (lun2tid_t *)NULL)) { 1263 debug_asr_printf("failed to allocate target list\n"); 1264 return ((tid_t *)NULL); 1265 } 1266 target_ptr->size = new_size + 1; 1267 } else if (target_ptr->size <= new_size) { 1268 lun2tid_t * new_target_ptr; 1269 1270 /* 1271 * Reallocate a new structure? 1272 * Since one element in structure, the +1 1273 * needed for size has been abstracted. 1274 */ 1275 if ((new_entry == FALSE) 1276 || ((new_target_ptr = (lun2tid_t *)malloc ( 1277 sizeof(*target_ptr) + (sizeof(target_ptr->TID) * new_size), |
1278 M_TEMP, M_WAITOK | M_ZERO)) | 1278 M_TEMP, M_ZERO)) |
1279 == (lun2tid_t *)NULL)) { 1280 debug_asr_printf("failed to reallocate target list\n"); 1281 return ((tid_t *)NULL); 1282 } 1283 /* 1284 * Copy the whole thing, safer, simpler coding 1285 * and not really performance critical at this point. 1286 */ --- 516 unchanged lines hidden (view full) --- 1803 PI2O_LCT_ENTRY Entry; 1804 1805 /* 1806 * sc value assumed valid 1807 */ 1808 MessageSizeInBytes = sizeof(I2O_EXEC_LCT_NOTIFY_MESSAGE) 1809 - sizeof(I2O_SG_ELEMENT) + sizeof(I2O_SGE_SIMPLE_ELEMENT); 1810 if ((Message_Ptr = (PI2O_EXEC_LCT_NOTIFY_MESSAGE)malloc ( | 1279 == (lun2tid_t *)NULL)) { 1280 debug_asr_printf("failed to reallocate target list\n"); 1281 return ((tid_t *)NULL); 1282 } 1283 /* 1284 * Copy the whole thing, safer, simpler coding 1285 * and not really performance critical at this point. 1286 */ --- 516 unchanged lines hidden (view full) --- 1803 PI2O_LCT_ENTRY Entry; 1804 1805 /* 1806 * sc value assumed valid 1807 */ 1808 MessageSizeInBytes = sizeof(I2O_EXEC_LCT_NOTIFY_MESSAGE) 1809 - sizeof(I2O_SG_ELEMENT) + sizeof(I2O_SGE_SIMPLE_ELEMENT); 1810 if ((Message_Ptr = (PI2O_EXEC_LCT_NOTIFY_MESSAGE)malloc ( |
1811 MessageSizeInBytes, M_TEMP, M_WAITOK)) | 1811 MessageSizeInBytes, M_TEMP, 0)) |
1812 == (PI2O_EXEC_LCT_NOTIFY_MESSAGE)NULL) { 1813 return (ENOMEM); 1814 } 1815 (void)ASR_fillMessage((char *)Message_Ptr, MessageSizeInBytes); 1816 I2O_MESSAGE_FRAME_setVersionOffset(&(Message_Ptr->StdMessageFrame), 1817 (I2O_VERSION_11 + 1818 (((sizeof(I2O_EXEC_LCT_NOTIFY_MESSAGE) - sizeof(I2O_SG_ELEMENT)) 1819 / sizeof(U32)) << 4))); --- 27 unchanged lines hidden (view full) --- 1847 * page is expected. We must break the request up into an SG list ... 1848 */ 1849 if (((len = (I2O_LCT_getTableSize(&Table) << 2)) <= 1850 (sizeof(I2O_LCT) - sizeof(I2O_LCT_ENTRY))) 1851 || (len > (128 * 1024))) { /* Arbitrary */ 1852 free (Message_Ptr, M_TEMP); 1853 return (EINVAL); 1854 } | 1812 == (PI2O_EXEC_LCT_NOTIFY_MESSAGE)NULL) { 1813 return (ENOMEM); 1814 } 1815 (void)ASR_fillMessage((char *)Message_Ptr, MessageSizeInBytes); 1816 I2O_MESSAGE_FRAME_setVersionOffset(&(Message_Ptr->StdMessageFrame), 1817 (I2O_VERSION_11 + 1818 (((sizeof(I2O_EXEC_LCT_NOTIFY_MESSAGE) - sizeof(I2O_SG_ELEMENT)) 1819 / sizeof(U32)) << 4))); --- 27 unchanged lines hidden (view full) --- 1847 * page is expected. We must break the request up into an SG list ... 1848 */ 1849 if (((len = (I2O_LCT_getTableSize(&Table) << 2)) <= 1850 (sizeof(I2O_LCT) - sizeof(I2O_LCT_ENTRY))) 1851 || (len > (128 * 1024))) { /* Arbitrary */ 1852 free (Message_Ptr, M_TEMP); 1853 return (EINVAL); 1854 } |
1855 if ((sc->ha_LCT = (PI2O_LCT)malloc (len, M_TEMP, M_WAITOK)) | 1855 if ((sc->ha_LCT = (PI2O_LCT)malloc (len, M_TEMP, 0)) |
1856 == (PI2O_LCT)NULL) { 1857 free (Message_Ptr, M_TEMP); 1858 return (ENOMEM); 1859 } 1860 /* 1861 * since this code is reused in several systems, code efficiency 1862 * is greater by using a shift operation rather than a divide by 1863 * sizeof(u_int32_t). --- 52 unchanged lines hidden (view full) --- 1916 &(Message_Ptr->StdMessageFrame), 1917 I2O_MESSAGE_FRAME_getMessageSize( 1918 &(Message_Ptr->StdMessageFrame)) 1919 + (sizeof(*sg) / sizeof(U32))); 1920 { 1921 PI2O_EXEC_LCT_NOTIFY_MESSAGE NewMessage_Ptr; 1922 1923 if ((NewMessage_Ptr = (PI2O_EXEC_LCT_NOTIFY_MESSAGE) | 1856 == (PI2O_LCT)NULL) { 1857 free (Message_Ptr, M_TEMP); 1858 return (ENOMEM); 1859 } 1860 /* 1861 * since this code is reused in several systems, code efficiency 1862 * is greater by using a shift operation rather than a divide by 1863 * sizeof(u_int32_t). --- 52 unchanged lines hidden (view full) --- 1916 &(Message_Ptr->StdMessageFrame), 1917 I2O_MESSAGE_FRAME_getMessageSize( 1918 &(Message_Ptr->StdMessageFrame)) 1919 + (sizeof(*sg) / sizeof(U32))); 1920 { 1921 PI2O_EXEC_LCT_NOTIFY_MESSAGE NewMessage_Ptr; 1922 1923 if ((NewMessage_Ptr = (PI2O_EXEC_LCT_NOTIFY_MESSAGE) |
1924 malloc (MessageSizeInBytes, M_TEMP, M_WAITOK)) | 1924 malloc (MessageSizeInBytes, M_TEMP, 0)) |
1925 == (PI2O_EXEC_LCT_NOTIFY_MESSAGE)NULL) { 1926 free (sc->ha_LCT, M_TEMP); 1927 sc->ha_LCT = (PI2O_LCT)NULL; 1928 free (Message_Ptr, M_TEMP); 1929 return (ENOMEM); 1930 } 1931 span = ((caddr_t)sg) - (caddr_t)Message_Ptr; 1932 bcopy ((caddr_t)Message_Ptr, --- 324 unchanged lines hidden (view full) --- 2257 size = sizeof(I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME) 2258 * sc->ha_Msgs_Count; 2259 2260 /* 2261 * contigmalloc only works reliably at 2262 * initialization time. 2263 */ 2264 if ((sc->ha_Msgs = (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME) | 1925 == (PI2O_EXEC_LCT_NOTIFY_MESSAGE)NULL) { 1926 free (sc->ha_LCT, M_TEMP); 1927 sc->ha_LCT = (PI2O_LCT)NULL; 1928 free (Message_Ptr, M_TEMP); 1929 return (ENOMEM); 1930 } 1931 span = ((caddr_t)sg) - (caddr_t)Message_Ptr; 1932 bcopy ((caddr_t)Message_Ptr, --- 324 unchanged lines hidden (view full) --- 2257 size = sizeof(I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME) 2258 * sc->ha_Msgs_Count; 2259 2260 /* 2261 * contigmalloc only works reliably at 2262 * initialization time. 2263 */ 2264 if ((sc->ha_Msgs = (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME) |
2265 contigmalloc (size, M_DEVBUF, M_WAITOK, 0ul, | 2265 contigmalloc (size, M_DEVBUF, 0, 0ul, |
2266 0xFFFFFFFFul, (u_long)sizeof(U32), 0ul)) 2267 != (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)NULL) { 2268 (void)bzero ((char *)sc->ha_Msgs, size); 2269 sc->ha_Msgs_Phys = KVTOPHYS(sc->ha_Msgs); 2270 } 2271 } 2272 2273 /* Initialize the outbound FIFO */ --- 17 unchanged lines hidden (view full) --- 2291{ 2292 PI2O_EXEC_SYS_TAB_SET_MESSAGE Message_Ptr; 2293 PI2O_SET_SYSTAB_HEADER SystemTable; 2294 Asr_softc_t * ha; 2295 PI2O_SGE_SIMPLE_ELEMENT sg; 2296 int retVal; 2297 2298 if ((SystemTable = (PI2O_SET_SYSTAB_HEADER)malloc ( | 2266 0xFFFFFFFFul, (u_long)sizeof(U32), 0ul)) 2267 != (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)NULL) { 2268 (void)bzero ((char *)sc->ha_Msgs, size); 2269 sc->ha_Msgs_Phys = KVTOPHYS(sc->ha_Msgs); 2270 } 2271 } 2272 2273 /* Initialize the outbound FIFO */ --- 17 unchanged lines hidden (view full) --- 2291{ 2292 PI2O_EXEC_SYS_TAB_SET_MESSAGE Message_Ptr; 2293 PI2O_SET_SYSTAB_HEADER SystemTable; 2294 Asr_softc_t * ha; 2295 PI2O_SGE_SIMPLE_ELEMENT sg; 2296 int retVal; 2297 2298 if ((SystemTable = (PI2O_SET_SYSTAB_HEADER)malloc ( |
2299 sizeof(I2O_SET_SYSTAB_HEADER), M_TEMP, M_WAITOK | M_ZERO)) | 2299 sizeof(I2O_SET_SYSTAB_HEADER), M_TEMP, M_ZERO)) |
2300 == (PI2O_SET_SYSTAB_HEADER)NULL) { 2301 return (ENOMEM); 2302 } 2303 for (ha = Asr_softc; ha; ha = ha->ha_next) { 2304 ++SystemTable->NumberEntries; 2305 } 2306 if ((Message_Ptr = (PI2O_EXEC_SYS_TAB_SET_MESSAGE)malloc ( 2307 sizeof(I2O_EXEC_SYS_TAB_SET_MESSAGE) - sizeof(I2O_SG_ELEMENT) 2308 + ((3+SystemTable->NumberEntries) * sizeof(I2O_SGE_SIMPLE_ELEMENT)), | 2300 == (PI2O_SET_SYSTAB_HEADER)NULL) { 2301 return (ENOMEM); 2302 } 2303 for (ha = Asr_softc; ha; ha = ha->ha_next) { 2304 ++SystemTable->NumberEntries; 2305 } 2306 if ((Message_Ptr = (PI2O_EXEC_SYS_TAB_SET_MESSAGE)malloc ( 2307 sizeof(I2O_EXEC_SYS_TAB_SET_MESSAGE) - sizeof(I2O_SG_ELEMENT) 2308 + ((3+SystemTable->NumberEntries) * sizeof(I2O_SGE_SIMPLE_ELEMENT)), |
2309 M_TEMP, M_WAITOK)) == (PI2O_EXEC_SYS_TAB_SET_MESSAGE)NULL) { | 2309 M_TEMP, 0)) == (PI2O_EXEC_SYS_TAB_SET_MESSAGE)NULL) { |
2310 free (SystemTable, M_TEMP); 2311 return (ENOMEM); 2312 } 2313 (void)ASR_fillMessage((char *)Message_Ptr, 2314 sizeof(I2O_EXEC_SYS_TAB_SET_MESSAGE) - sizeof(I2O_SG_ELEMENT) 2315 + ((3+SystemTable->NumberEntries) * sizeof(I2O_SGE_SIMPLE_ELEMENT))); 2316 I2O_MESSAGE_FRAME_setVersionOffset(&(Message_Ptr->StdMessageFrame), 2317 (I2O_VERSION_11 + --- 595 unchanged lines hidden (view full) --- 2913 sc->ha_pciBusNum = tag.cfg2.forward; 2914 sc->ha_pciDeviceNum = ((tag.cfg2.enable >> 1) & 7) 2915 | (tag.cfg2.port >> 5); 2916 } 2917#endif 2918 /* Check if the device is there? */ 2919 if ((ASR_resetIOP(sc->ha_Virt, sc->ha_Fvirt) == 0) 2920 || ((status = (PI2O_EXEC_STATUS_GET_REPLY)malloc ( | 2310 free (SystemTable, M_TEMP); 2311 return (ENOMEM); 2312 } 2313 (void)ASR_fillMessage((char *)Message_Ptr, 2314 sizeof(I2O_EXEC_SYS_TAB_SET_MESSAGE) - sizeof(I2O_SG_ELEMENT) 2315 + ((3+SystemTable->NumberEntries) * sizeof(I2O_SGE_SIMPLE_ELEMENT))); 2316 I2O_MESSAGE_FRAME_setVersionOffset(&(Message_Ptr->StdMessageFrame), 2317 (I2O_VERSION_11 + --- 595 unchanged lines hidden (view full) --- 2913 sc->ha_pciBusNum = tag.cfg2.forward; 2914 sc->ha_pciDeviceNum = ((tag.cfg2.enable >> 1) & 7) 2915 | (tag.cfg2.port >> 5); 2916 } 2917#endif 2918 /* Check if the device is there? */ 2919 if ((ASR_resetIOP(sc->ha_Virt, sc->ha_Fvirt) == 0) 2920 || ((status = (PI2O_EXEC_STATUS_GET_REPLY)malloc ( |
2921 sizeof(I2O_EXEC_STATUS_GET_REPLY), M_TEMP, M_WAITOK)) | 2921 sizeof(I2O_EXEC_STATUS_GET_REPLY), M_TEMP, 0)) |
2922 == (PI2O_EXEC_STATUS_GET_REPLY)NULL) 2923 || (ASR_getStatus(sc->ha_Virt, sc->ha_Fvirt, status) == NULL)) { 2924 printf ("asr%d: could not initialize hardware\n", unit); 2925 ATTACH_RETURN(ENODEV); /* Get next, maybe better luck */ 2926 } 2927 sc->ha_SystemTable.OrganizationID = status->OrganizationID; 2928 sc->ha_SystemTable.IOP_ID = status->IOP_ID; 2929 sc->ha_SystemTable.I2oVersion = status->I2oVersion; --- 102 unchanged lines hidden (view full) --- 3032 3033 /* 3034 * Print the HBA model number as inquired from the card. 3035 */ 3036 3037 printf ("asr%d:", unit); 3038 3039 if ((iq = (struct scsi_inquiry_data *)malloc ( | 2922 == (PI2O_EXEC_STATUS_GET_REPLY)NULL) 2923 || (ASR_getStatus(sc->ha_Virt, sc->ha_Fvirt, status) == NULL)) { 2924 printf ("asr%d: could not initialize hardware\n", unit); 2925 ATTACH_RETURN(ENODEV); /* Get next, maybe better luck */ 2926 } 2927 sc->ha_SystemTable.OrganizationID = status->OrganizationID; 2928 sc->ha_SystemTable.IOP_ID = status->IOP_ID; 2929 sc->ha_SystemTable.I2oVersion = status->I2oVersion; --- 102 unchanged lines hidden (view full) --- 3032 3033 /* 3034 * Print the HBA model number as inquired from the card. 3035 */ 3036 3037 printf ("asr%d:", unit); 3038 3039 if ((iq = (struct scsi_inquiry_data *)malloc ( |
3040 sizeof(struct scsi_inquiry_data), M_TEMP, M_WAITOK | M_ZERO)) | 3040 sizeof(struct scsi_inquiry_data), M_TEMP, M_ZERO)) |
3041 != (struct scsi_inquiry_data *)NULL) { 3042 defAlignLong(PRIVATE_SCSI_SCB_EXECUTE_MESSAGE,Message); 3043 PPRIVATE_SCSI_SCB_EXECUTE_MESSAGE Message_Ptr; 3044 int posted = 0; 3045 3046 bzero (Message_Ptr 3047 = getAlignLong(PRIVATE_SCSI_SCB_EXECUTE_MESSAGE, Message), 3048 sizeof(PRIVATE_SCSI_SCB_EXECUTE_MESSAGE) --- 893 unchanged lines hidden (view full) --- 3942 3943 if (ASR_getBlinkLedCode(sc)) { 3944 debug_usr_cmd_printf ("Adapter currently in BlinkLed %x\n", 3945 ASR_getBlinkLedCode(sc)); 3946 return (EIO); 3947 } 3948 /* Copy in the message into a local allocation */ 3949 if ((Message_Ptr = (PI2O_MESSAGE_FRAME)malloc ( | 3041 != (struct scsi_inquiry_data *)NULL) { 3042 defAlignLong(PRIVATE_SCSI_SCB_EXECUTE_MESSAGE,Message); 3043 PPRIVATE_SCSI_SCB_EXECUTE_MESSAGE Message_Ptr; 3044 int posted = 0; 3045 3046 bzero (Message_Ptr 3047 = getAlignLong(PRIVATE_SCSI_SCB_EXECUTE_MESSAGE, Message), 3048 sizeof(PRIVATE_SCSI_SCB_EXECUTE_MESSAGE) --- 893 unchanged lines hidden (view full) --- 3942 3943 if (ASR_getBlinkLedCode(sc)) { 3944 debug_usr_cmd_printf ("Adapter currently in BlinkLed %x\n", 3945 ASR_getBlinkLedCode(sc)); 3946 return (EIO); 3947 } 3948 /* Copy in the message into a local allocation */ 3949 if ((Message_Ptr = (PI2O_MESSAGE_FRAME)malloc ( |
3950 sizeof(I2O_MESSAGE_FRAME), M_TEMP, M_WAITOK)) | 3950 sizeof(I2O_MESSAGE_FRAME), M_TEMP, 0)) |
3951 == (PI2O_MESSAGE_FRAME)NULL) { 3952 debug_usr_cmd_printf ( 3953 "Failed to acquire I2O_MESSAGE_FRAME memory\n"); 3954 return (ENOMEM); 3955 } 3956 if ((error = copyin ((caddr_t)Packet, (caddr_t)Message_Ptr, 3957 sizeof(I2O_MESSAGE_FRAME))) != 0) { 3958 free (Message_Ptr, M_TEMP); --- 50 unchanged lines hidden (view full) --- 4009 if ((MessageSizeInBytes < sizeof(I2O_MESSAGE_FRAME)) 4010 || (MAX_INBOUND_SIZE < MessageSizeInBytes)) { 4011 debug_usr_cmd_printf ("Packet size %d incorrect\n", 4012 MessageSizeInBytes); 4013 return (EINVAL); 4014 } 4015 4016 if ((Message_Ptr = (PI2O_MESSAGE_FRAME)malloc (MessageSizeInBytes, | 3951 == (PI2O_MESSAGE_FRAME)NULL) { 3952 debug_usr_cmd_printf ( 3953 "Failed to acquire I2O_MESSAGE_FRAME memory\n"); 3954 return (ENOMEM); 3955 } 3956 if ((error = copyin ((caddr_t)Packet, (caddr_t)Message_Ptr, 3957 sizeof(I2O_MESSAGE_FRAME))) != 0) { 3958 free (Message_Ptr, M_TEMP); --- 50 unchanged lines hidden (view full) --- 4009 if ((MessageSizeInBytes < sizeof(I2O_MESSAGE_FRAME)) 4010 || (MAX_INBOUND_SIZE < MessageSizeInBytes)) { 4011 debug_usr_cmd_printf ("Packet size %d incorrect\n", 4012 MessageSizeInBytes); 4013 return (EINVAL); 4014 } 4015 4016 if ((Message_Ptr = (PI2O_MESSAGE_FRAME)malloc (MessageSizeInBytes, |
4017 M_TEMP, M_WAITOK)) == (PI2O_MESSAGE_FRAME)NULL) { | 4017 M_TEMP, 0)) == (PI2O_MESSAGE_FRAME)NULL) { |
4018 debug_usr_cmd_printf ("Failed to acquire frame[%d] memory\n", 4019 MessageSizeInBytes); 4020 return (ENOMEM); 4021 } 4022 if ((error = copyin ((caddr_t)Packet, (caddr_t)Message_Ptr, 4023 MessageSizeInBytes)) != 0) { 4024 free (Message_Ptr, M_TEMP); 4025 debug_usr_cmd_printf ("Can't copy in packet[%d] errno=%d\n", 4026 MessageSizeInBytes, error); 4027 return (error); 4028 } 4029 4030 /* Check the size of the reply frame, and start constructing */ 4031 4032 if ((Reply_Ptr = (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)malloc ( | 4018 debug_usr_cmd_printf ("Failed to acquire frame[%d] memory\n", 4019 MessageSizeInBytes); 4020 return (ENOMEM); 4021 } 4022 if ((error = copyin ((caddr_t)Packet, (caddr_t)Message_Ptr, 4023 MessageSizeInBytes)) != 0) { 4024 free (Message_Ptr, M_TEMP); 4025 debug_usr_cmd_printf ("Can't copy in packet[%d] errno=%d\n", 4026 MessageSizeInBytes, error); 4027 return (error); 4028 } 4029 4030 /* Check the size of the reply frame, and start constructing */ 4031 4032 if ((Reply_Ptr = (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)malloc ( |
4033 sizeof(I2O_MESSAGE_FRAME), M_TEMP, M_WAITOK)) | 4033 sizeof(I2O_MESSAGE_FRAME), M_TEMP, 0)) |
4034 == (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)NULL) { 4035 free (Message_Ptr, M_TEMP); 4036 debug_usr_cmd_printf ( 4037 "Failed to acquire I2O_MESSAGE_FRAME memory\n"); 4038 return (ENOMEM); 4039 } 4040 if ((error = copyin ((caddr_t)Reply, (caddr_t)Reply_Ptr, 4041 sizeof(I2O_MESSAGE_FRAME))) != 0) { --- 14 unchanged lines hidden (view full) --- 4056 ReplySizeInBytes, error); 4057 return (EINVAL); 4058 } 4059 4060 if ((Reply_Ptr = (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)malloc ( 4061 ((ReplySizeInBytes > sizeof(I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)) 4062 ? ReplySizeInBytes 4063 : sizeof(I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)), | 4034 == (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)NULL) { 4035 free (Message_Ptr, M_TEMP); 4036 debug_usr_cmd_printf ( 4037 "Failed to acquire I2O_MESSAGE_FRAME memory\n"); 4038 return (ENOMEM); 4039 } 4040 if ((error = copyin ((caddr_t)Reply, (caddr_t)Reply_Ptr, 4041 sizeof(I2O_MESSAGE_FRAME))) != 0) { --- 14 unchanged lines hidden (view full) --- 4056 ReplySizeInBytes, error); 4057 return (EINVAL); 4058 } 4059 4060 if ((Reply_Ptr = (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)malloc ( 4061 ((ReplySizeInBytes > sizeof(I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)) 4062 ? ReplySizeInBytes 4063 : sizeof(I2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)), |
4064 M_TEMP, M_WAITOK)) == (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)NULL) { | 4064 M_TEMP, 0)) == (PI2O_SCSI_ERROR_REPLY_MESSAGE_FRAME)NULL) { |
4065 free (Message_Ptr, M_TEMP); 4066 debug_usr_cmd_printf ("Failed to acquire frame[%d] memory\n", 4067 ReplySizeInBytes); 4068 return (ENOMEM); 4069 } 4070 (void)ASR_fillMessage ((char *)Reply_Ptr, ReplySizeInBytes); 4071 Reply_Ptr->StdReplyFrame.StdMessageFrame.InitiatorContext 4072 = Message_Ptr->InitiatorContext; --- 52 unchanged lines hidden (view full) --- 4125 debug_usr_cmd_printf ("SG[%d] = %x[%d]\n", 4126 sg - (PI2O_SGE_SIMPLE_ELEMENT)((char *)Message_Ptr 4127 + ((I2O_MESSAGE_FRAME_getVersionOffset( 4128 Message_Ptr) & 0xF0) >> 2)), 4129 I2O_SGE_SIMPLE_ELEMENT_getPhysicalAddress(sg), len); 4130 4131 if ((elm = (struct ioctlSgList_S *)malloc ( 4132 sizeof(*elm) - sizeof(elm->KernelSpace) + len, | 4065 free (Message_Ptr, M_TEMP); 4066 debug_usr_cmd_printf ("Failed to acquire frame[%d] memory\n", 4067 ReplySizeInBytes); 4068 return (ENOMEM); 4069 } 4070 (void)ASR_fillMessage ((char *)Reply_Ptr, ReplySizeInBytes); 4071 Reply_Ptr->StdReplyFrame.StdMessageFrame.InitiatorContext 4072 = Message_Ptr->InitiatorContext; --- 52 unchanged lines hidden (view full) --- 4125 debug_usr_cmd_printf ("SG[%d] = %x[%d]\n", 4126 sg - (PI2O_SGE_SIMPLE_ELEMENT)((char *)Message_Ptr 4127 + ((I2O_MESSAGE_FRAME_getVersionOffset( 4128 Message_Ptr) & 0xF0) >> 2)), 4129 I2O_SGE_SIMPLE_ELEMENT_getPhysicalAddress(sg), len); 4130 4131 if ((elm = (struct ioctlSgList_S *)malloc ( 4132 sizeof(*elm) - sizeof(elm->KernelSpace) + len, |
4133 M_TEMP, M_WAITOK)) | 4133 M_TEMP, 0)) |
4134 == (struct ioctlSgList_S *)NULL) { 4135 debug_usr_cmd_printf ( 4136 "Failed to allocate SG[%d]\n", len); 4137 error = ENOMEM; 4138 break; 4139 } 4140 SLIST_INSERT_HEAD(&sgList, elm, link); 4141 elm->FlagsCount = sg->FlagsCount; --- 72 unchanged lines hidden (view full) --- 4214 I2O_MESSAGE_FRAME_getMessageSize(Message_Ptr) 4215 + (sizeof(*sg) / sizeof(U32))); 4216 { 4217 PI2O_MESSAGE_FRAME NewMessage_Ptr; 4218 4219 if ((NewMessage_Ptr 4220 = (PI2O_MESSAGE_FRAME) 4221 malloc (MessageSizeInBytes, | 4134 == (struct ioctlSgList_S *)NULL) { 4135 debug_usr_cmd_printf ( 4136 "Failed to allocate SG[%d]\n", len); 4137 error = ENOMEM; 4138 break; 4139 } 4140 SLIST_INSERT_HEAD(&sgList, elm, link); 4141 elm->FlagsCount = sg->FlagsCount; --- 72 unchanged lines hidden (view full) --- 4214 I2O_MESSAGE_FRAME_getMessageSize(Message_Ptr) 4215 + (sizeof(*sg) / sizeof(U32))); 4216 { 4217 PI2O_MESSAGE_FRAME NewMessage_Ptr; 4218 4219 if ((NewMessage_Ptr 4220 = (PI2O_MESSAGE_FRAME) 4221 malloc (MessageSizeInBytes, |
4222 M_TEMP, M_WAITOK)) | 4222 M_TEMP, 0)) |
4223 == (PI2O_MESSAGE_FRAME)NULL) { 4224 debug_usr_cmd_printf ( 4225 "Failed to acquire frame[%d] memory\n", 4226 MessageSizeInBytes); 4227 error = ENOMEM; 4228 break; 4229 } 4230 span = ((caddr_t)sg) --- 465 unchanged lines hidden --- | 4223 == (PI2O_MESSAGE_FRAME)NULL) { 4224 debug_usr_cmd_printf ( 4225 "Failed to acquire frame[%d] memory\n", 4226 MessageSizeInBytes); 4227 error = ENOMEM; 4228 break; 4229 } 4230 span = ((caddr_t)sg) --- 465 unchanged lines hidden --- |