Changeset View
Changeset View
Standalone View
Standalone View
stable/10/sys/dev/ixl/i40e_osdep.c
/****************************************************************************** | /****************************************************************************** | ||||
Copyright (c) 2013-2014, Intel Corporation | Copyright (c) 2013-2015, Intel Corporation | ||||
All rights reserved. | All rights reserved. | ||||
Redistribution and use in source and binary forms, with or without | Redistribution and use in source and binary forms, with or without | ||||
modification, are permitted provided that the following conditions are met: | modification, are permitted provided that the following conditions are met: | ||||
1. Redistributions of source code must retain the above copyright notice, | 1. Redistributions of source code must retain the above copyright notice, | ||||
this list of conditions and the following disclaimer. | this list of conditions and the following disclaimer. | ||||
▲ Show 20 Lines • Show All 138 Lines • ▼ Show 20 Lines | |||||
i40e_release_spinlock(struct i40e_spinlock *lock) | i40e_release_spinlock(struct i40e_spinlock *lock) | ||||
{ | { | ||||
mtx_unlock(&lock->mutex); | mtx_unlock(&lock->mutex); | ||||
} | } | ||||
void | void | ||||
i40e_destroy_spinlock(struct i40e_spinlock *lock) | i40e_destroy_spinlock(struct i40e_spinlock *lock) | ||||
{ | { | ||||
if (mtx_initialized(&lock->mutex)) | |||||
mtx_destroy(&lock->mutex); | mtx_destroy(&lock->mutex); | ||||
} | } | ||||
/* | /* | ||||
** i40e_debug_d - OS dependent version of shared code debug printing | * Helper function for debug statement printing | ||||
*/ | */ | ||||
void i40e_debug_d(void *hw, u32 mask, char *fmt, ...) | void | ||||
i40e_debug_d(struct i40e_hw *hw, enum i40e_debug_mask mask, char *fmt, ...) | |||||
{ | { | ||||
char buf[512]; | |||||
va_list args; | va_list args; | ||||
if (!(mask & ((struct i40e_hw *)hw)->debug_mask)) | if (!(mask & ((struct i40e_hw *)hw)->debug_mask)) | ||||
return; | return; | ||||
va_start(args, fmt); | va_start(args, fmt); | ||||
vsnprintf(buf, sizeof(buf), fmt, args); | device_printf(((struct i40e_osdep *)hw->back)->dev, fmt, args); | ||||
va_end(args); | va_end(args); | ||||
/* the debug string is already formatted with a newline */ | |||||
printf("%s", buf); | |||||
} | } | ||||
u16 | u16 | ||||
i40e_read_pci_cfg(struct i40e_hw *hw, u32 reg) | i40e_read_pci_cfg(struct i40e_hw *hw, u32 reg) | ||||
{ | { | ||||
u16 value; | u16 value; | ||||
value = pci_read_config(((struct i40e_osdep *)hw->back)->dev, | value = pci_read_config(((struct i40e_osdep *)hw->back)->dev, | ||||
Show All 14 Lines |