Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[phantom] Allow for PXE boot to be enabled/disabled on a per-port basis
This is something of an ugly hack to accommodate an OEM requirement.
The NIC has only one expansion ROM BAR, rather than one per port.  To
allow individual ports to be selectively enabled/disabled for PXE boot
(as required), we must therefore leave the expansion ROM always
enabled, and place the per-port enable/disable logic within the gPXE
driver.
  • Loading branch information
Michael Brown committed Nov 1, 2008
1 parent 5e6b821 commit aa95744
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/drivers/net/phantom/phantom.c
Expand Up @@ -1937,6 +1937,32 @@ static void phantom_get_macaddr ( struct phantom_nic *phantom,
phantom, eth_ntoa ( ll_addr ) );
}

/**
* Check Phantom is enabled for boot
*
* @v phanton_port Phantom NIC
* @ret rc Return status code
*
* This is something of an ugly hack to accommodate an OEM
* requirement. The NIC has only one expansion ROM BAR, rather than
* one per port. To allow individual ports to be selectively
* enabled/disabled for PXE boot (as required), we must therefore
* leave the expansion ROM always enabled, and place the per-port
* enable/disable logic within the gPXE driver.
*/
static int phantom_check_boot_enable ( struct phantom_nic *phantom ) {
unsigned long boot_enable;

boot_enable = phantom_readl ( phantom, UNM_CAM_RAM_BOOT_ENABLE );
if ( ! ( boot_enable & ( 1 << phantom->port ) ) ) {
DBGC ( phantom, "Phantom %p PXE boot is disabled\n",
phantom );
return -ENOTSUP;
}

return 0;
}

/**
* Initialise Phantom receive PEG
*
Expand Down Expand Up @@ -2034,6 +2060,10 @@ static int phantom_probe ( struct pci_device *pci,
/* Read MAC addresses */
phantom_get_macaddr ( phantom, netdev->ll_addr );

/* Skip if boot disabled on NIC */
if ( ( rc = phantom_check_boot_enable ( phantom ) ) != 0 )
goto err_check_boot_enable;

/* Register network devices */
if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
DBGC ( phantom, "Phantom %p could not register net device: "
Expand All @@ -2056,6 +2086,7 @@ static int phantom_probe ( struct pci_device *pci,
err_register_settings:
unregister_netdev ( netdev );
err_register_netdev:
err_check_boot_enable:
err_init_rcvpeg:
err_init_cmdpeg:
phantom_halt_pegs ( phantom );
Expand Down
1 change: 1 addition & 0 deletions src/drivers/net/phantom/phantom.h
Expand Up @@ -109,6 +109,7 @@ enum unm_reg_blocks {
#define UNM_CAM_RAM_CLP_STATUS_DONE 0x00000002UL
#define UNM_CAM_RAM_CLP_STATUS_ERROR 0x0000ff00UL
#define UNM_CAM_RAM_CLP_STATUS_UNINITIALISED 0xffffffffUL
#define UNM_CAM_RAM_BOOT_ENABLE ( UNM_CAM_RAM + 0x000fc )
#define UNM_CAM_RAM_WOL_PORT_MODE ( UNM_CAM_RAM + 0x00198 )
#define UNM_CAM_RAM_MAC_ADDRS ( UNM_CAM_RAM + 0x001c0 )
#define UNM_CAM_RAM_COLD_BOOT ( UNM_CAM_RAM + 0x001fc )
Expand Down

0 comments on commit aa95744

Please sign in to comment.