Re: git: b076d8d54c2f - main - mptable_hostb: Use legacy_get_pcibus() to fetch PCI bus number.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 23 Jun 2022 22:04:32 UTC
On 6/23/22 2:56 PM, FreeBSD User wrote:
> Am Thu, 23 Jun 2022 17:52:36 GMT
> John Baldwin <jhb@FreeBSD.org> schrieb:
> 
>> The branch main has been updated by jhb:
>>
>> URL: https://cgit.FreeBSD.org/src/commit/?id=b076d8d54c2fd91a35aad6931d0bfa2aa0122036
>>
>> commit b076d8d54c2fd91a35aad6931d0bfa2aa0122036
>> Author:     John Baldwin <jhb@FreeBSD.org>
>> AuthorDate: 2022-06-23 17:49:09 +0000
>> Commit:     John Baldwin <jhb@FreeBSD.org>
>> CommitDate: 2022-06-23 17:49:09 +0000
>>
>>      mptable_hostb: Use legacy_get_pcibus() to fetch PCI bus number.
>>      
>>      The mptable_hostb driver is a child of legacy0 and has legacy bus
>>      ivars, not PCI or PCI bridge ivars.
>>      
>>      PR:             264819
>>      Reported by:    Dennis Clarke <dclarke@blastwave.org>
>>      Diagnosed by:   avg
>>      Reviewed by:    avg
>>      MFC after:      1 week
>>      Differential Revision:  https://reviews.freebsd.org/D35548
>> ---
>>   sys/x86/x86/mptable.c     | 2 +-
>>   sys/x86/x86/mptable_pci.c | 2 +-
>>   2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/sys/x86/x86/mptable.c b/sys/x86/x86/mptable.c
>> index 5cc42863cf38..c5f113c55a2b 100644
>> --- a/sys/x86/x86/mptable.c
>> +++ b/sys/x86/x86/mptable.c
>> @@ -1250,7 +1250,7 @@ mptable_pci_host_res_init(device_t pcib)
>>   	struct host_res_args args;
>>   
>>   	KASSERT(pci0 != -1, ("do not know how to map PCI bus IDs"));
>> -	args.bus = pci_get_bus(pcib) + pci0;
>> +	args.bus = legacy_get_pcibus(pcib) + pci0;
>>   	args.dev = pcib;
>>   	args.sc = device_get_softc(pcib);
>>   	if (pcib_host_res_init(pcib, &args.sc->sc_host_res) != 0)
>> diff --git a/sys/x86/x86/mptable_pci.c b/sys/x86/x86/mptable_pci.c
>> index 1a1d98eafc39..8a1d2abe46fe 100644
>> --- a/sys/x86/x86/mptable_pci.c
>> +++ b/sys/x86/x86/mptable_pci.c
>> @@ -57,7 +57,7 @@ mptable_hostb_probe(device_t dev)
>>   
>>   	if (pci_cfgregopen() == 0)
>>   		return (ENXIO);
>> -	if (mptable_pci_probe_table(pcib_get_bus(dev)) != 0)
>> +	if (mptable_pci_probe_table(legacy_get_pcibus(dev)) != 0)
>>   		return (ENXIO);
>>   	device_set_desc(dev, "MPTable Host-PCI bridge");
>>   	return (0);
>>
> 
> I think this commit broke buildkernel on our hosts (custom kernel):
> 
> 
> [...]
> 
> /usr/src/sys/x86/x86/mptable.c:1253:13: error: implicit declaration of function
> 'legacy_get_pcibus' is invalid in C99 [-Werror,-Wimplicit-function-declaration] args.bus =
> legacy_get_pcibus(pcib) + pci0; ^ 1 error generated. *** [mptable.o] Error code 1
> 
> 
> Kind regards,

Should be fixed by 15a6642da6b0b97de580e06349706cf7e660986c.

-- 
John Baldwin