Bladeren bron

[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 15 jaren geleden
bovenliggende
commit
aa95744915
2 gewijzigde bestanden met toevoegingen van 32 en 0 verwijderingen
  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 Bestand weergeven

@@ -1937,6 +1937,32 @@ static void phantom_get_macaddr ( struct phantom_nic *phantom,
1937 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 1967
  * Initialise Phantom receive PEG
1942 1968
  *
@@ -2034,6 +2060,10 @@ static int phantom_probe ( struct pci_device *pci,
2034 2060
 	/* Read MAC addresses */
2035 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 2067
 	/* Register network devices */
2038 2068
 	if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
2039 2069
 		DBGC ( phantom, "Phantom %p could not register net device: "
@@ -2056,6 +2086,7 @@ static int phantom_probe ( struct pci_device *pci,
2056 2086
  err_register_settings:
2057 2087
 	unregister_netdev ( netdev );
2058 2088
  err_register_netdev:
2089
+ err_check_boot_enable:
2059 2090
  err_init_rcvpeg:
2060 2091
  err_init_cmdpeg:
2061 2092
 	phantom_halt_pegs ( phantom );

+ 1
- 0
src/drivers/net/phantom/phantom.h Bestand weergeven

@@ -109,6 +109,7 @@ enum unm_reg_blocks {
109 109
 #define UNM_CAM_RAM_CLP_STATUS_DONE		0x00000002UL
110 110
 #define UNM_CAM_RAM_CLP_STATUS_ERROR		0x0000ff00UL
111 111
 #define UNM_CAM_RAM_CLP_STATUS_UNINITIALISED	0xffffffffUL
112
+#define UNM_CAM_RAM_BOOT_ENABLE		( UNM_CAM_RAM + 0x000fc )
112 113
 #define UNM_CAM_RAM_WOL_PORT_MODE	( UNM_CAM_RAM + 0x00198 )
113 114
 #define UNM_CAM_RAM_MAC_ADDRS		( UNM_CAM_RAM + 0x001c0 )
114 115
 #define UNM_CAM_RAM_COLD_BOOT		( UNM_CAM_RAM + 0x001fc )

Laden…
Annuleren
Opslaan