[CACHED_INFO_BINL] = { create_fakepxebsack },
};
+/**
+ * Name PXENV_GET_CACHED_INFO packet type
+ *
+ * @v packet_type Packet type
+ * @ret name Name of packet type
+ */
+static inline __attribute__ (( always_inline )) const char *
+pxenv_get_cached_info_name ( int packet_type ) {
+ switch ( packet_type ) {
+ case PXENV_PACKET_TYPE_DHCP_DISCOVER:
+ return "DHCPDISCOVER";
+ case PXENV_PACKET_TYPE_DHCP_ACK:
+ return "DHCPACK";
+ case PXENV_PACKET_TYPE_CACHED_REPLY:
+ return "BINL";
+ default:
+ return "<INVALID>";
+ }
+}
+
/* The case in which the caller doesn't supply a buffer is really
* awkward to support given that we have multiple sources of options,
* and that we don't actually store the DHCP packets. (We may not
*
*/
PXENV_EXIT_t pxenv_unload_stack ( struct s_PXENV_UNLOAD_STACK *unload_stack ) {
- DBG ( "PXENV_UNLOAD_STACK" );
+ DBGC ( &pxe_netdev, "PXENV_UNLOAD_STACK\n" );
unload_stack->Status = PXENV_STATUS_SUCCESS;
return PXENV_EXIT_SUCCESS;
userptr_t buffer;
int rc;
- DBG ( "PXENV_GET_CACHED_INFO %d", get_cached_info->PacketType );
-
- DBG ( " to %04x:%04x+%x", get_cached_info->Buffer.segment,
- get_cached_info->Buffer.offset, get_cached_info->BufferSize );
+ DBGC ( &pxe_netdev, "PXENV_GET_CACHED_INFO %s to %04x:%04x+%x",
+ pxenv_get_cached_info_name ( get_cached_info->PacketType ),
+ get_cached_info->Buffer.segment,
+ get_cached_info->Buffer.offset, get_cached_info->BufferSize );
/* Sanity check */
idx = ( get_cached_info->PacketType - 1 );
if ( idx >= NUM_CACHED_INFOS ) {
- DBG ( " bad PacketType" );
+ DBGC ( &pxe_netdev, " bad PacketType %d\n",
+ get_cached_info->PacketType );
goto err;
}
info = &cached_info[idx];
creator = &pxe_dhcp_packet_creators[idx];
if ( ( rc = creator->create ( pxe_netdev, info,
sizeof ( *info ) ) ) != 0 ) {
- DBG ( " failed to build packet" );
+ DBGC ( &pxe_netdev, " failed to build packet: %s\n",
+ strerror ( rc ) );
goto err;
}
}
get_cached_info->Buffer.segment = rm_ds;
get_cached_info->Buffer.offset = __from_data16 ( info );
get_cached_info->BufferSize = sizeof ( *info );
- DBG ( " returning %04x:%04x+%04x['%x']",
- get_cached_info->Buffer.segment,
- get_cached_info->Buffer.offset,
- get_cached_info->BufferSize,
- get_cached_info->BufferLimit );
+ DBGC ( &pxe_netdev, " using %04x:%04x+%04x['%x']",
+ get_cached_info->Buffer.segment,
+ get_cached_info->Buffer.offset,
+ get_cached_info->BufferSize,
+ get_cached_info->BufferLimit );
} else {
/* Copy packet to client buffer */
if ( len > sizeof ( *info ) )
len = sizeof ( *info );
if ( len < sizeof ( *info ) )
- DBG ( " buffer may be too short" );
+ DBGC ( &pxe_netdev, " buffer may be too short" );
buffer = real_to_user ( get_cached_info->Buffer.segment,
get_cached_info->Buffer.offset );
copy_to_user ( buffer, 0, info, len );
get_cached_info->BufferSize = len;
}
+ DBGC ( &pxe_netdev, "\n" );
get_cached_info->Status = PXENV_STATUS_SUCCESS;
return PXENV_EXIT_SUCCESS;
*restart_tftp ) {
PXENV_EXIT_t tftp_exit;
- DBG ( "PXENV_RESTART_TFTP " );
+ DBGC ( &pxe_netdev, "PXENV_RESTART_TFTP\n" );
/* Words cannot describe the complete mismatch between the PXE
* specification and any possible version of reality...
unsigned int location;
struct net_device *netdev;
- DBG ( "PXENV_START_UNDI %04x:%04x:%04x",
- start_undi->AX, start_undi->BX, start_undi->DX );
+ DBGC ( &pxe_netdev, "PXENV_START_UNDI %04x:%04x:%04x\n",
+ start_undi->AX, start_undi->BX, start_undi->DX );
/* Determine bus type and location. Use a heuristic to decide
* whether we are PCI or ISAPnP
/* Look for a matching net device */
netdev = find_netdev_by_location ( bus_type, location );
if ( ! netdev ) {
- DBG ( " no net device found" );
+ DBGC ( &pxe_netdev, "PXENV_START_UNDI could not find matching "
+ "net device\n" );
start_undi->Status = PXENV_STATUS_UNDI_CANNOT_INITIALIZE_NIC;
return PXENV_EXIT_FAILURE;
}
- DBG ( " using netdev %s", netdev->name );
+ DBGC ( &pxe_netdev, "PXENV_START_UNDI found net device %s\n",
+ netdev->name );
/* Activate PXE */
pxe_activate ( netdev );
* Status: working
*/
PXENV_EXIT_t pxenv_stop_undi ( struct s_PXENV_STOP_UNDI *stop_undi ) {
- DBG ( "PXENV_STOP_UNDI" );
+ DBGC ( &pxe_netdev, "PXENV_STOP_UNDI\n" );
/* Deactivate PXE */
pxe_deactivate();
/* Check to see if we still have any hooked interrupts */
if ( hooked_bios_interrupts != 0 ) {
- DBG ( "PXENV_STOP_UNDI failed: %d interrupts still hooked\n",
- hooked_bios_interrupts );
+ DBGC ( &pxe_netdev, "PXENV_STOP_UNDI failed: %d interrupts "
+ "still hooked\n", hooked_bios_interrupts );
stop_undi->Status = PXENV_STATUS_KEEP_UNDI;
return PXENV_EXIT_FAILURE;
}
* Status: won't implement (requires major structural changes)
*/
PXENV_EXIT_t pxenv_start_base ( struct s_PXENV_START_BASE *start_base ) {
- DBG ( "PXENV_START_BASE" );
+ DBGC ( &pxe_netdev, "PXENV_START_BASE\n" );
start_base->Status = PXENV_STATUS_UNSUPPORTED;
return PXENV_EXIT_FAILURE;
* Status: working
*/
PXENV_EXIT_t pxenv_stop_base ( struct s_PXENV_STOP_BASE *stop_base ) {
- DBG ( "PXENV_STOP_BASE" );
+ DBGC ( &pxe_netdev, "PXENV_STOP_BASE\n" );
/* The only time we will be called is when the NBP is trying
* to shut down the PXE stack. There's nothing we need to do