Browse Source

[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.
tags/v0.9.6
Michael Brown 16 years ago
parent
commit
aa95744915
2 changed files with 32 additions and 0 deletions
  1. 31
    0
      src/drivers/net/phantom/phantom.c
  2. 1
    0
      src/drivers/net/phantom/phantom.h

+ 31
- 0
src/drivers/net/phantom/phantom.c View File

1937
 	       phantom, eth_ntoa ( ll_addr ) );
1937
 	       phantom, eth_ntoa ( ll_addr ) );
1938
 }
1938
 }
1939
 
1939
 
1940
+/**
1941
+ * Check Phantom is enabled for boot
1942
+ *
1943
+ * @v phanton_port	Phantom NIC
1944
+ * @ret rc		Return status code
1945
+ *
1946
+ * This is something of an ugly hack to accommodate an OEM
1947
+ * requirement.  The NIC has only one expansion ROM BAR, rather than
1948
+ * one per port.  To allow individual ports to be selectively
1949
+ * enabled/disabled for PXE boot (as required), we must therefore
1950
+ * leave the expansion ROM always enabled, and place the per-port
1951
+ * enable/disable logic within the gPXE driver.
1952
+ */
1953
+static int phantom_check_boot_enable ( struct phantom_nic *phantom ) {
1954
+	unsigned long boot_enable;
1955
+
1956
+	boot_enable = phantom_readl ( phantom, UNM_CAM_RAM_BOOT_ENABLE );
1957
+	if ( ! ( boot_enable & ( 1 << phantom->port ) ) ) {
1958
+		DBGC ( phantom, "Phantom %p PXE boot is disabled\n",
1959
+		       phantom );
1960
+		return -ENOTSUP;
1961
+	}
1962
+
1963
+	return 0;
1964
+}
1965
+
1940
 /**
1966
 /**
1941
  * Initialise Phantom receive PEG
1967
  * Initialise Phantom receive PEG
1942
  *
1968
  *
2034
 	/* Read MAC addresses */
2060
 	/* Read MAC addresses */
2035
 	phantom_get_macaddr ( phantom, netdev->ll_addr );
2061
 	phantom_get_macaddr ( phantom, netdev->ll_addr );
2036
 
2062
 
2063
+	/* Skip if boot disabled on NIC */
2064
+	if ( ( rc = phantom_check_boot_enable ( phantom ) ) != 0 )
2065
+		goto err_check_boot_enable;
2066
+
2037
 	/* Register network devices */
2067
 	/* Register network devices */
2038
 	if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
2068
 	if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
2039
 		DBGC ( phantom, "Phantom %p could not register net device: "
2069
 		DBGC ( phantom, "Phantom %p could not register net device: "
2056
  err_register_settings:
2086
  err_register_settings:
2057
 	unregister_netdev ( netdev );
2087
 	unregister_netdev ( netdev );
2058
  err_register_netdev:
2088
  err_register_netdev:
2089
+ err_check_boot_enable:
2059
  err_init_rcvpeg:
2090
  err_init_rcvpeg:
2060
  err_init_cmdpeg:
2091
  err_init_cmdpeg:
2061
 	phantom_halt_pegs ( phantom );
2092
 	phantom_halt_pegs ( phantom );

+ 1
- 0
src/drivers/net/phantom/phantom.h View File

109
 #define UNM_CAM_RAM_CLP_STATUS_DONE		0x00000002UL
109
 #define UNM_CAM_RAM_CLP_STATUS_DONE		0x00000002UL
110
 #define UNM_CAM_RAM_CLP_STATUS_ERROR		0x0000ff00UL
110
 #define UNM_CAM_RAM_CLP_STATUS_ERROR		0x0000ff00UL
111
 #define UNM_CAM_RAM_CLP_STATUS_UNINITIALISED	0xffffffffUL
111
 #define UNM_CAM_RAM_CLP_STATUS_UNINITIALISED	0xffffffffUL
112
+#define UNM_CAM_RAM_BOOT_ENABLE		( UNM_CAM_RAM + 0x000fc )
112
 #define UNM_CAM_RAM_WOL_PORT_MODE	( UNM_CAM_RAM + 0x00198 )
113
 #define UNM_CAM_RAM_WOL_PORT_MODE	( UNM_CAM_RAM + 0x00198 )
113
 #define UNM_CAM_RAM_MAC_ADDRS		( UNM_CAM_RAM + 0x001c0 )
114
 #define UNM_CAM_RAM_MAC_ADDRS		( UNM_CAM_RAM + 0x001c0 )
114
 #define UNM_CAM_RAM_COLD_BOOT		( UNM_CAM_RAM + 0x001fc )
115
 #define UNM_CAM_RAM_COLD_BOOT		( UNM_CAM_RAM + 0x001fc )

Loading…
Cancel
Save