smp_all.c (216088) | smp_all.c (298431) |
---|---|
1/*- 2 * Copyright (c) 2010 Spectra Logic Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 30 * $Id: //depot/users/kenm/FreeBSD-test/sys/cam/scsi/smp_all.c#4 $ 31 */ 32 33/* 34 * Serial Management Protocol helper functions. 35 */ 36 37#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2010 Spectra Logic Corporation 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 21 unchanged lines hidden (view full) --- 30 * $Id: //depot/users/kenm/FreeBSD-test/sys/cam/scsi/smp_all.c#4 $ 31 */ 32 33/* 34 * Serial Management Protocol helper functions. 35 */ 36 37#include <sys/cdefs.h> |
38__FBSDID("$FreeBSD: head/sys/cam/scsi/smp_all.c 216088 2010-11-30 22:39:46Z ken $"); | 38__FBSDID("$FreeBSD: head/sys/cam/scsi/smp_all.c 298431 2016-04-21 19:40:10Z pfg $"); |
39 40#include <sys/param.h> 41#include <sys/types.h> 42#ifdef _KERNEL 43#include <sys/systm.h> 44#include <sys/libkern.h> 45#include <sys/kernel.h> 46#else /* _KERNEL */ --- 66 unchanged lines hidden (view full) --- 113 {SMP_FR_DISABLED_PWD_NOT_SUP, "Disabled Password Not Supported"} 114}; 115 116const char * 117smp_error_desc(int function_result) 118{ 119 int i; 120 | 39 40#include <sys/param.h> 41#include <sys/types.h> 42#ifdef _KERNEL 43#include <sys/systm.h> 44#include <sys/libkern.h> 45#include <sys/kernel.h> 46#else /* _KERNEL */ --- 66 unchanged lines hidden (view full) --- 113 {SMP_FR_DISABLED_PWD_NOT_SUP, "Disabled Password Not Supported"} 114}; 115 116const char * 117smp_error_desc(int function_result) 118{ 119 int i; 120 |
121 for (i = 0; i < (sizeof(smp_error_table)/sizeof(smp_error_table[0])); 122 i++){ | 121 for (i = 0; i < nitems(smp_error_table); i++){ |
123 if (function_result == smp_error_table[i].function_result) 124 return (smp_error_table[i].desc); 125 } 126 return ("Reserved Function Result"); 127} 128 129/* List current as of SPL Revision 7 */ 130struct smp_cmd_table_entry { --- 28 unchanged lines hidden (view full) --- 159 {SMP_FUNC_CONFIG_PHY_EVENT, "CONFIGURE PHY EVENT"} 160}; 161 162const char * 163smp_command_desc(uint8_t cmd_num) 164{ 165 int i; 166 | 122 if (function_result == smp_error_table[i].function_result) 123 return (smp_error_table[i].desc); 124 } 125 return ("Reserved Function Result"); 126} 127 128/* List current as of SPL Revision 7 */ 129struct smp_cmd_table_entry { --- 28 unchanged lines hidden (view full) --- 158 {SMP_FUNC_CONFIG_PHY_EVENT, "CONFIGURE PHY EVENT"} 159}; 160 161const char * 162smp_command_desc(uint8_t cmd_num) 163{ 164 int i; 165 |
167 for (i = 0; i < (sizeof(smp_cmd_table)/sizeof(smp_cmd_table[0])) && | 166 for (i = 0; i < nitems(smp_cmd_table) && |
168 smp_cmd_table[i].cmd_num <= cmd_num; i++) { 169 if (cmd_num == smp_cmd_table[i].cmd_num) 170 return (smp_cmd_table[i].desc); 171 } 172 173 /* 174 * 0x40 to 0x7f and 0xc0 to 0xff are the vendor specific SMP 175 * command ranges. --- 445 unchanged lines hidden --- | 167 smp_cmd_table[i].cmd_num <= cmd_num; i++) { 168 if (cmd_num == smp_cmd_table[i].cmd_num) 169 return (smp_cmd_table[i].desc); 170 } 171 172 /* 173 * 0x40 to 0x7f and 0xc0 to 0xff are the vendor specific SMP 174 * command ranges. --- 445 unchanged lines hidden --- |