|
@@ -1589,6 +1589,12 @@ static struct net_device_operations phantom_operations = {
|
1589
|
1589
|
*
|
1590
|
1590
|
*/
|
1591
|
1591
|
|
|
1592
|
+/** Phantom CLP settings tag magic */
|
|
1593
|
+#define PHN_CLP_TAG_MAGIC 0xc19c1900UL
|
|
1594
|
+
|
|
1595
|
+/** Phantom CLP settings tag magic mask */
|
|
1596
|
+#define PHN_CLP_TAG_MAGIC_MASK 0xffffff00UL
|
|
1597
|
+
|
1592
|
1598
|
/** Phantom CLP data
|
1593
|
1599
|
*
|
1594
|
1600
|
*/
|
|
@@ -1790,7 +1796,7 @@ struct phantom_clp_setting {
|
1790
|
1796
|
/** gPXE setting */
|
1791
|
1797
|
struct setting *setting;
|
1792
|
1798
|
/** Setting number */
|
1793
|
|
- unsigned int number;
|
|
1799
|
+ unsigned int clp_setting;
|
1794
|
1800
|
};
|
1795
|
1801
|
|
1796
|
1802
|
/** Phantom CLP settings */
|
|
@@ -1802,25 +1808,29 @@ static struct phantom_clp_setting clp_settings[] = {
|
1802
|
1808
|
* Find Phantom CLP setting
|
1803
|
1809
|
*
|
1804
|
1810
|
* @v setting gPXE setting
|
1805
|
|
- * @v clp_setting Equivalent Phantom CLP setting, or NULL
|
|
1811
|
+ * @v clp_setting Setting number, or 0 if not found
|
1806
|
1812
|
*/
|
1807
|
|
-static struct phantom_clp_setting *
|
1808
|
|
-phantom_find_clp_setting ( struct phantom_nic *phantom,
|
1809
|
|
- struct setting *setting ) {
|
|
1813
|
+static unsigned int
|
|
1814
|
+phantom_clp_setting ( struct phantom_nic *phantom, struct setting *setting ) {
|
1810
|
1815
|
struct phantom_clp_setting *clp_setting;
|
1811
|
1816
|
unsigned int i;
|
1812
|
1817
|
|
|
1818
|
+ /* Search the list of explicitly-defined settings */
|
1813
|
1819
|
for ( i = 0 ; i < ( sizeof ( clp_settings ) /
|
1814
|
1820
|
sizeof ( clp_settings[0] ) ) ; i++ ) {
|
1815
|
1821
|
clp_setting = &clp_settings[i];
|
1816
|
1822
|
if ( setting_cmp ( setting, clp_setting->setting ) == 0 )
|
1817
|
|
- return clp_setting;
|
|
1823
|
+ return clp_setting->clp_setting;
|
1818
|
1824
|
}
|
1819
|
1825
|
|
|
1826
|
+ /* Allow for use of numbered settings */
|
|
1827
|
+ if ( ( setting->tag & PHN_CLP_TAG_MAGIC_MASK ) == PHN_CLP_TAG_MAGIC )
|
|
1828
|
+ return ( setting->tag & ~PHN_CLP_TAG_MAGIC_MASK );
|
|
1829
|
+
|
1820
|
1830
|
DBGC2 ( phantom, "Phantom %p has no \"%s\" setting\n",
|
1821
|
1831
|
phantom, setting->name );
|
1822
|
1832
|
|
1823
|
|
- return NULL;
|
|
1833
|
+ return 0;
|
1824
|
1834
|
}
|
1825
|
1835
|
|
1826
|
1836
|
/**
|
|
@@ -1838,18 +1848,17 @@ static int phantom_store_setting ( struct settings *settings,
|
1838
|
1848
|
struct phantom_nic_port *phantom_port =
|
1839
|
1849
|
container_of ( settings, struct phantom_nic_port, settings );
|
1840
|
1850
|
struct phantom_nic *phantom = phantom_port->phantom;
|
1841
|
|
- struct phantom_clp_setting *clp_setting;
|
|
1851
|
+ unsigned int clp_setting;
|
1842
|
1852
|
int rc;
|
1843
|
1853
|
|
1844
|
1854
|
/* Find Phantom setting equivalent to gPXE setting */
|
1845
|
|
- clp_setting = phantom_find_clp_setting ( phantom, setting );
|
|
1855
|
+ clp_setting = phantom_clp_setting ( phantom, setting );
|
1846
|
1856
|
if ( ! clp_setting )
|
1847
|
1857
|
return -ENOTSUP;
|
1848
|
1858
|
|
1849
|
1859
|
/* Store setting */
|
1850
|
1860
|
if ( ( rc = phantom_clp_store ( phantom, phantom_port->port,
|
1851
|
|
- clp_setting->number,
|
1852
|
|
- data, len ) ) != 0 ) {
|
|
1861
|
+ clp_setting, data, len ) ) != 0 ) {
|
1853
|
1862
|
DBGC ( phantom, "Phantom %p could not store setting \"%s\": "
|
1854
|
1863
|
"%s\n", phantom, setting->name, strerror ( rc ) );
|
1855
|
1864
|
return rc;
|
|
@@ -1873,19 +1882,18 @@ static int phantom_fetch_setting ( struct settings *settings,
|
1873
|
1882
|
struct phantom_nic_port *phantom_port =
|
1874
|
1883
|
container_of ( settings, struct phantom_nic_port, settings );
|
1875
|
1884
|
struct phantom_nic *phantom = phantom_port->phantom;
|
1876
|
|
- struct phantom_clp_setting *clp_setting;
|
|
1885
|
+ unsigned int clp_setting;
|
1877
|
1886
|
int read_len;
|
1878
|
1887
|
int rc;
|
1879
|
1888
|
|
1880
|
1889
|
/* Find Phantom setting equivalent to gPXE setting */
|
1881
|
|
- clp_setting = phantom_find_clp_setting ( phantom, setting );
|
|
1890
|
+ clp_setting = phantom_clp_setting ( phantom, setting );
|
1882
|
1891
|
if ( ! clp_setting )
|
1883
|
1892
|
return -ENOTSUP;
|
1884
|
1893
|
|
1885
|
1894
|
/* Fetch setting */
|
1886
|
1895
|
if ( ( read_len = phantom_clp_fetch ( phantom, phantom_port->port,
|
1887
|
|
- clp_setting->number,
|
1888
|
|
- data, len ) ) < 0 ) {
|
|
1896
|
+ clp_setting, data, len ) ) < 0 ){
|
1889
|
1897
|
rc = read_len;
|
1890
|
1898
|
DBGC ( phantom, "Phantom %p could not fetch setting \"%s\": "
|
1891
|
1899
|
"%s\n", phantom, setting->name, strerror ( rc ) );
|
|
@@ -2269,7 +2277,7 @@ static int phantom_probe ( struct pci_device *pci,
|
2269
|
2277
|
phantom_port->port = i;
|
2270
|
2278
|
settings_init ( &phantom_port->settings,
|
2271
|
2279
|
&phantom_settings_operations,
|
2272
|
|
- &netdev->refcnt, "clp" );
|
|
2280
|
+ &netdev->refcnt, "clp", PHN_CLP_TAG_MAGIC );
|
2273
|
2281
|
}
|
2274
|
2282
|
|
2275
|
2283
|
/* BUG5945 - need to hack PCI config space on P3 B1 silicon.
|