本文整理汇总了C++中DBGC函数的典型用法代码示例。如果您正苦于以下问题:C++ DBGC函数的具体用法?C++ DBGC怎么用?C++ DBGC使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DBGC函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: efi_snp_reset
/**
* Reset the network device
*
* @v snp SNP interface
* @v ext_verify Extended verification required
* @ret efirc EFI status code
*/
static EFI_STATUS EFIAPI
efi_snp_reset ( EFI_SIMPLE_NETWORK_PROTOCOL *snp, BOOLEAN ext_verify ) {
struct efi_snp_device *snpdev =
container_of ( snp, struct efi_snp_device, snp );
int rc;
DBGC2 ( snpdev, "SNPDEV %p RESET (%s extended verification)\n",
snpdev, ( ext_verify ? "with" : "without" ) );
netdev_close ( snpdev->netdev );
snpdev->mode.State = EfiSimpleNetworkStarted;
if ( ( rc = netdev_open ( snpdev->netdev ) ) != 0 ) {
DBGC ( snpdev, "SNPDEV %p could not reopen %s: %s\n",
snpdev, snpdev->netdev->name, strerror ( rc ) );
return RC_TO_EFIRC ( rc );
}
snpdev->mode.State = EfiSimpleNetworkInitialized;
return 0;
}
示例2: nvo_init_dhcpopts
/**
* Parse stored options
*
* @v nvo Non-volatile options block
*
* Verifies that the options data is valid, and configures the DHCP
* options block. If the data is not valid, it is replaced with an
* empty options block.
*/
static void nvo_init_dhcpopts ( struct nvo_block *nvo ) {
uint8_t *options_data;
size_t options_len;
/* Steal one byte for the checksum */
options_data = ( nvo->data + 1 );
options_len = ( nvo->total_len - 1 );
/* If checksum fails, or options data starts with a zero,
* assume the whole block is invalid. This should capture the
* case of random initial contents.
*/
if ( ( nvo_checksum ( nvo ) != 0 ) || ( options_data[0] == 0 ) ) {
DBGC ( nvo, "NVO %p has checksum %02x and initial byte %02x; "
"assuming empty\n", nvo, nvo_checksum ( nvo ),
options_data[0] );
memset ( nvo->data, 0, nvo->total_len );
}
dhcpopt_init ( &nvo->dhcpopts, options_data, options_len );
}
示例3: intelxlvf_reset_wait_teardown
/**
* Wait for admin event queue to be torn down
*
* @v intelxl Intel device
* @ret rc Return status code
*/
static int intelxlvf_reset_wait_teardown ( struct intelxl_nic *intelxl ) {
uint32_t admin_evt_len;
unsigned int i;
/* Wait for admin event queue to be torn down */
for ( i = 0 ; i < INTELXLVF_RESET_MAX_WAIT_MS ; i++ ) {
/* Check admin event queue length register */
admin_evt_len = readl ( intelxl->regs + INTELXLVF_ADMIN +
INTELXLVF_ADMIN_EVT_LEN );
if ( ! ( admin_evt_len & INTELXL_ADMIN_LEN_ENABLE ) )
return 0;
/* Delay */
mdelay ( 1 );
}
DBGC ( intelxl, "INTELXL %p timed out waiting for teardown (%#08x)\n",
intelxl, admin_evt_len );
return -ETIMEDOUT;
}
示例4: nii_set_rx_filters
/**
* Set receive filters
*
* @v nii NII NIC
* @ret rc Return status code
*/
static int nii_set_rx_filters ( struct nii_nic *nii ) {
unsigned int op;
int stat;
int rc;
/* Issue command */
op = NII_OP ( PXE_OPCODE_RECEIVE_FILTERS,
( PXE_OPFLAGS_RECEIVE_FILTER_ENABLE |
PXE_OPFLAGS_RECEIVE_FILTER_UNICAST |
PXE_OPFLAGS_RECEIVE_FILTER_BROADCAST |
PXE_OPFLAGS_RECEIVE_FILTER_PROMISCUOUS |
PXE_OPFLAGS_RECEIVE_FILTER_ALL_MULTICAST ) );
if ( ( stat = nii_issue ( nii, op ) ) < 0 ) {
rc = -EIO_STAT ( stat );
DBGC ( nii, "NII %s could not set receive filters: %s\n",
nii->dev.name, strerror ( rc ) );
return rc;
}
return 0;
}
示例5: myson_wait_idle
/**
* Wait for transmit and receive to become idle
*
* @v myson Myson device
* @ret rc Return status code
*/
static int myson_wait_idle ( struct myson_nic *myson ) {
uint32_t tcr_rcr;
unsigned int i;
/* Wait for both transmit and receive to be idle */
for ( i = 0 ; i < MYSON_IDLE_MAX_WAIT_MS ; i++ ) {
/* If either process is running, delay 1ms and retry */
tcr_rcr = readl ( myson->regs + MYSON_TCR_RCR );
if ( tcr_rcr & ( MYSON_TCR_TXS | MYSON_RCR_RXS ) ) {
mdelay ( 1 );
continue;
}
return 0;
}
DBGC ( myson, "MYSON %p timed out waiting for idle state (status "
"%08x)\n", myson, tcr_rcr );
return -ETIMEDOUT;
}
示例6: nii_initialise
/**
* Initialise UNDI
*
* @v nii NII NIC
* @ret rc Return status code
*/
static int nii_initialise ( struct nii_nic *nii ) {
PXE_CPB_INITIALIZE cpb;
PXE_DB_INITIALIZE db;
unsigned int op;
int stat;
int rc;
/* Allocate memory buffer */
nii->buffer = umalloc ( nii->buffer_len );
if ( ! nii->buffer ) {
rc = -ENOMEM;
goto err_alloc;
}
/* Construct parameter block */
memset ( &cpb, 0, sizeof ( cpb ) );
cpb.MemoryAddr = ( ( intptr_t ) nii->buffer );
cpb.MemoryLength = nii->buffer_len;
/* Construct data block */
memset ( &db, 0, sizeof ( db ) );
/* Issue command */
op = NII_OP ( PXE_OPCODE_INITIALIZE,
PXE_OPFLAGS_INITIALIZE_DO_NOT_DETECT_CABLE );
if ( ( stat = nii_issue_cpb_db ( nii, op, &cpb, sizeof ( cpb ),
&db, sizeof ( db ) ) ) < 0 ) {
rc = -EIO_STAT ( stat );
DBGC ( nii, "NII %s could not initialise: %s\n",
nii->dev.name, strerror ( rc ) );
goto err_initialize;
}
return 0;
err_initialize:
ufree ( nii->buffer );
err_alloc:
return rc;
}
示例7: peerdisc_socket_open
/**
* Open all PeerDist discovery sockets
*
* @ret rc Return status code
*/
static int peerdisc_socket_open ( void ) {
struct peerdisc_socket *socket;
int rc;
/* Open each socket */
for_each_table_entry ( socket, PEERDISC_SOCKETS ) {
if ( ( rc = xfer_open_socket ( &socket->xfer, SOCK_DGRAM,
&socket->address.sa,
NULL ) ) != 0 ) {
DBGC ( socket, "PEERDISC %s could not open socket: "
"%s\n", socket->name, strerror ( rc ) );
goto err;
}
}
return 0;
err:
for_each_table_entry_continue_reverse ( socket, PEERDISC_SOCKETS )
intf_restart ( &socket->xfer, rc );
return rc;
}
示例8: efi_image_probe
/**
* Probe EFI image
*
* @v image EFI file
* @ret rc Return status code
*/
static int efi_image_probe ( struct image *image ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
EFI_HANDLE handle;
EFI_STATUS efirc;
/* Attempt loading image */
if ( ( efirc = bs->LoadImage ( FALSE, efi_image_handle, NULL,
user_to_virt ( image->data, 0 ),
image->len, &handle ) ) != 0 ) {
/* Not an EFI image */
DBGC ( image, "EFIIMAGE %p could not load: %s\n",
image, efi_strerror ( efirc ) );
return -ENOEXEC;
}
/* Unload the image. We can't leave it loaded, because we
* have no "unload" operation.
*/
bs->UnloadImage ( handle );
return 0;
}
示例9: rhine_mii_autopoll
/**
* Enable auto-polling
*
* @v rhn Rhine device
* @ret rc Return status code
*
* This is voodoo. There seems to be no documentation on exactly what
* we are waiting for, or why we have to do anything other than simply
* turn the feature on.
*/
static int rhine_mii_autopoll ( struct rhine_nic *rhn ) {
unsigned int timeout = RHINE_TIMEOUT_US;
uint8_t addr;
/* Initiate auto-polling */
writeb ( MII_BMSR, rhn->regs + RHINE_MII_ADDR );
writeb ( RHINE_MII_CR_AUTOPOLL, rhn->regs + RHINE_MII_CR );
/* Wait for auto-polling to complete */
while ( timeout-- ) {
udelay ( 1 );
addr = readb ( rhn->regs + RHINE_MII_ADDR );
if ( ! ( addr & RHINE_MII_ADDR_MDONE ) ) {
writeb ( ( MII_BMSR | RHINE_MII_ADDR_MSRCEN ),
rhn->regs + RHINE_MII_ADDR );
return 0;
}
}
DBGC ( rhn, "RHINE %p MII auto-poll timeout\n", rhn );
return -ETIMEDOUT;
}
示例10: pxe_probe_no_mz
/**
* Probe PXE image (with rejection of potential EFI images)
*
* @v image PXE file
* @ret rc Return status code
*/
int pxe_probe_no_mz ( struct image *image ) {
uint16_t magic;
int rc;
/* Probe PXE image */
if ( ( rc = pxe_probe ( image ) ) != 0 )
return rc;
/* Reject image with an "MZ" signature which may indicate an
* EFI image incorrectly handed out to a BIOS system.
*/
if ( image->len >= sizeof ( magic ) ) {
copy_from_user ( &magic, image->data, 0, sizeof ( magic ) );
if ( magic == cpu_to_le16 ( EFI_IMAGE_DOS_SIGNATURE ) ) {
DBGC ( image, "IMAGE %p may be an EFI image\n",
image );
return -ENOTTY;
}
}
return 0;
}
示例11: rhine_poll_rx
/**
* Poll for received packets
*
* @v netdev Network device
*/
static void rhine_poll_rx ( struct net_device *netdev ) {
struct rhine_nic *rhn = netdev->priv;
struct rhine_descriptor *desc;
struct io_buffer *iobuf;
unsigned int rx_idx;
uint32_t des0;
size_t len;
/* Check for received packets */
while ( rhn->rx.cons != rhn->rx.prod ) {
/* Get next receive descriptor */
rx_idx = ( rhn->rx.cons % RHINE_RXDESC_NUM );
desc = &rhn->rx.desc[rx_idx];
/* Stop if descriptor is still in use */
if ( desc->des0 & cpu_to_le32 ( RHINE_DES0_OWN ) )
return;
/* Populate I/O buffer */
iobuf = rhn->rx_iobuf[rx_idx];
rhn->rx_iobuf[rx_idx] = NULL;
des0 = le32_to_cpu ( desc->des0 );
len = ( RHINE_DES0_GETSIZE ( des0 ) - 4 /* strip CRC */ );
iob_put ( iobuf, len );
/* Hand off to network stack */
if ( des0 & RHINE_RDES0_RXOK ) {
DBGC2 ( rhn, "RHINE %p RX %d complete (length %zd)\n",
rhn, rx_idx, len );
netdev_rx ( netdev, iobuf );
} else {
DBGC ( rhn, "RHINE %p RX %d error (length %zd, DES0 "
"%08x)\n", rhn, rx_idx, len, des0 );
netdev_rx_err ( netdev, iobuf, -EIO );
}
rhn->rx.cons++;
}
}
示例12: intelxlvf_admin_get_resources
/**
* Get resources
*
* @v netdev Network device
* @ret rc Return status code
*/
static int intelxlvf_admin_get_resources ( struct net_device *netdev ) {
struct intelxl_nic *intelxl = netdev->priv;
struct intelxl_admin_descriptor *cmd;
struct intelxl_admin_vf_get_resources_buffer *res;
int rc;
/* Populate descriptor */
cmd = intelxl_admin_command_descriptor ( intelxl );
cmd->vopcode = cpu_to_le32 ( INTELXL_ADMIN_VF_GET_RESOURCES );
/* Issue command */
if ( ( rc = intelxlvf_admin_command ( netdev ) ) != 0 )
return rc;
/* Parse response */
res = &intelxl->vbuf.res;
intelxl->vsi = le16_to_cpu ( res->vsi );
memcpy ( netdev->hw_addr, res->mac, ETH_ALEN );
DBGC ( intelxl, "INTELXL %p VSI %#04x\n", intelxl, intelxl->vsi );
return 0;
}
示例13: intelxlvf_reset_wait_active
/**
* Wait for virtual function to be marked as active
*
* @v intelxl Intel device
* @ret rc Return status code
*/
static int intelxlvf_reset_wait_active ( struct intelxl_nic *intelxl ) {
uint32_t vfgen_rstat;
unsigned int vfr_state;
unsigned int i;
/* Wait for virtual function to be marked as active */
for ( i = 0 ; i < INTELXLVF_RESET_MAX_WAIT_MS ; i++ ) {
/* Check status as written by physical function driver */
vfgen_rstat = readl ( intelxl->regs + INTELXLVF_VFGEN_RSTAT );
vfr_state = INTELXLVF_VFGEN_RSTAT_VFR_STATE ( vfgen_rstat );
if ( vfr_state == INTELXLVF_VFGEN_RSTAT_VFR_STATE_ACTIVE )
return 0;
/* Delay */
mdelay ( 1 );
}
DBGC ( intelxl, "INTELXL %p timed out waiting for activation "
"(%#08x)\n", intelxl, vfgen_rstat );
return -ETIMEDOUT;
}
示例14: efi_watchdog_expired
/**
* Hold off watchdog timer
*
* @v retry Retry timer
* @v over Failure indicator
*/
static void efi_watchdog_expired ( struct retry_timer *timer,
int over __unused ) {
EFI_BOOT_SERVICES *bs = efi_systab->BootServices;
static CHAR16 data[] = WATCHDOG_DATA;
EFI_STATUS efirc;
int rc;
DBGC2 ( timer, "EFI holding off watchdog timer\n" );
/* Restart this holdoff timer */
start_timer_fixed ( timer, ( WATCHDOG_HOLDOFF_SECS * TICKS_PER_SEC ) );
/* Reset watchdog timer */
if ( ( efirc = bs->SetWatchdogTimer ( WATCHDOG_TIMEOUT_SECS,
WATCHDOG_CODE, sizeof ( data ),
data ) ) != 0 ) {
rc = -EEFI ( efirc );
DBGC ( timer, "EFI could not set watchdog timer: %s\n",
strerror ( rc ) );
return;
}
}
示例15: nii_set_station_address
/**
* Set station address
*
* @v nii NII NIC
* @v netdev Network device
* @ret rc Return status code
*/
static int nii_set_station_address ( struct nii_nic *nii,
struct net_device *netdev ) {
PXE_CPB_STATION_ADDRESS cpb;
int stat;
int rc;
/* Construct parameter block */
memset ( &cpb, 0, sizeof ( cpb ) );
memcpy ( cpb.StationAddr, netdev->ll_addr,
netdev->ll_protocol->ll_addr_len );
/* Issue command */
if ( ( stat = nii_issue_cpb ( nii, PXE_OPCODE_STATION_ADDRESS,
&cpb, sizeof ( cpb ) ) ) < 0 ) {
rc = -EIO_STAT ( stat );
DBGC ( nii, "NII %s could not set station address: %s\n",
nii->dev.name, strerror ( rc ) );
return rc;
}
return 0;
}