1- /* $NetBSD: autoconf.c,v 1.272 2023/12/20 05:33:19 thorpej Exp $ */
1+ /* $NetBSD: autoconf.c,v 1.273 2025/10/13 04:04:52 thorpej Exp $ */
22
33/*
44 * Copyright (c) 1996
4848 */
4949
5050#include <sys/cdefs.h>
51- __KERNEL_RCSID (0 , "$NetBSD: autoconf.c,v 1.272 2023/12/20 05:33:19 thorpej Exp $" );
51+ __KERNEL_RCSID (0 , "$NetBSD: autoconf.c,v 1.273 2025/10/13 04:04:52 thorpej Exp $" );
5252
5353#include "opt_ddb.h"
5454#include "opt_kgdb.h"
@@ -79,6 +79,7 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.272 2023/12/20 05:33:19 thorpej Exp $
7979
8080#include <net/if.h>
8181#include <net/if_ether.h>
82+ #include <net/ether_calls.h>
8283
8384#include <dev/cons.h>
8485
@@ -103,9 +104,6 @@ __KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.272 2023/12/20 05:33:19 thorpej Exp $
103104#include <dev/pci/pcidevs.h>
104105#include <dev/pci/pcivar.h>
105106#include <sparc/sparc/msiiepreg.h>
106- #ifdef MSIIEP
107- #include <sparc/sparc/pci_fixup.h>
108- #endif
109107
110108#ifdef DDB
111109#include <machine/db_machdep.h>
@@ -1541,7 +1539,6 @@ static int bus_class(device_t);
15411539static const char * bus_compatible (const char * );
15421540static int instance_match (device_t , void * , struct bootpath * );
15431541static void nail_bootdev (device_t , struct bootpath * );
1544- static void set_network_props (device_t , void * );
15451542
15461543static struct {
15471544 const char * name ;
@@ -1623,44 +1620,28 @@ bus_class(device_t dev)
16231620 return (class );
16241621}
16251622
1626- static void
1627- set_network_props (device_t dev , void * aux )
1623+ static int
1624+ sparc_ether_get_mac_address (device_t dev , devhandle_t call_handle , void * v )
16281625{
1629- struct mainbus_attach_args * ma ;
1630- struct sbus_attach_args * sa ;
1631- struct iommu_attach_args * iom ;
1632- struct pci_attach_args * pa ;
1633- uint8_t eaddr [ETHER_ADDR_LEN ];
1634- prop_dictionary_t dict ;
1635- prop_data_t blob ;
1636- int ofnode ;
1626+ struct ether_get_mac_address_args * args = v ;
1627+ int node ;
16371628
1638- ofnode = 0 ;
1639- switch (bus_class (device_parent (dev ))) {
1640- case BUSCLASS_MAINBUS :
1641- ma = aux ;
1642- ofnode = ma -> ma_node ;
1643- break ;
1644- case BUSCLASS_SBUS :
1645- sa = aux ;
1646- ofnode = sa -> sa_node ;
1647- break ;
1648- case BUSCLASS_IOMMU :
1649- iom = aux ;
1650- ofnode = iom -> iom_node ;
1651- break ;
1652- case BUSCLASS_PCI :
1653- pa = aux ;
1654- ofnode = PCITAG_NODE (pa -> pa_tag );
1655- break ;
1629+ /*
1630+ * If we're called with a valid OpenBoot node, then use it.
1631+ * Otherwise, assume we're using a handle-less old-world PROM
1632+ * and use the global MAC address in the ID PROM.
1633+ */
1634+ if (devhandle_type (call_handle ) == DEVHANDLE_TYPE_OPENBOOT ) {
1635+ node = prom_devhandle_to_node (call_handle );
1636+ } else {
1637+ node = 0 ;
16561638 }
16571639
1658- prom_getether (ofnode , eaddr );
1659- dict = device_properties (dev );
1660- blob = prop_data_create_copy (eaddr , ETHER_ADDR_LEN );
1661- prop_dictionary_set (dict , "mac-address" , blob );
1662- prop_object_release (blob );
1640+ prom_getether (node , args -> enaddr );
1641+ return 0 ;
16631642}
1643+ SYSDFLT_DEVICE_CALL_REGISTER (ETHER_GET_MAC_ADDRESS_STR ,
1644+ sparc_ether_get_mac_address )
16641645
16651646int
16661647instance_match (device_t dev , void * aux , struct bootpath * bp )
@@ -1793,12 +1774,6 @@ device_register(device_t dev, void *aux)
17931774 struct bootpath * bp = bootpath_store (0 , NULL );
17941775 const char * bpname ;
17951776
1796- #ifdef MSIIEP
1797- /* Check for PCI devices */
1798- if (bus_class (device_parent (dev )) == BUSCLASS_PCI )
1799- set_pci_props (dev );
1800- #endif
1801-
18021777 /*
18031778 * If device name does not match current bootpath component
18041779 * then there's nothing interesting to consider.
@@ -1845,13 +1820,7 @@ device_register(device_t dev, void *aux)
18451820 device_xname (dev )));
18461821 return ;
18471822 }
1848- } else if (device_is_a (dev , "le" ) ||
1849- device_is_a (dev , "hme" ) ||
1850- device_is_a (dev , "be" ) ||
1851- device_is_a (dev , "ie" )) {
1852-
1853- set_network_props (dev , aux );
1854-
1823+ } else if (device_class (dev ) == DV_IFNET ) {
18551824 /*
18561825 * LANCE, Happy Meal, or BigMac ethernet device
18571826 */
0 commit comments