Create a generic PCCARD_PNP_INFO from the MODULE_PNP_INFO building

block. Use it in all the PNP drivers to export either the current PNP
table. For uart, create a custom table and export it using
MODULE_PNP_INFO since it's the only one that matches on function
number.

Differential Review: https://reviews.freebsd.org/D3461
This commit is contained in:
Warner Losh 2015-12-11 05:27:56 +00:00
parent 493b2041d6
commit f6cea53f9d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=292079
20 changed files with 39 additions and 8 deletions

View File

@ -196,3 +196,4 @@ extern devclass_t aic_devclass;
MODULE_DEPEND(aic, cam, 1,1,1);
DRIVER_MODULE(aic, pccard, aic_pccard_driver, aic_devclass, 0, 0);
PCCARD_PNP_INFO(aic_pccard_products);

View File

@ -108,6 +108,7 @@ static const struct pccard_product an_pccard_products[] = {
PCMCIA_CARD(XIRCOM, CWE1130),
{ NULL }
};
PCCARD_PNP_INFO(an_pccard_products);
static int
an_pccard_probe(device_t dev)

View File

@ -183,3 +183,4 @@ static driver_t ata_pccard_driver = {
DRIVER_MODULE(ata, pccard, ata_pccard_driver, ata_devclass, NULL, NULL);
MODULE_DEPEND(ata, ata, 1, 1, 1);
PCCARD_PNP_INFO(ata_pccard_products);

View File

@ -112,4 +112,4 @@ static driver_t cmx_pccard_driver = {
};
DRIVER_MODULE(cmx, pccard, cmx_pccard_driver, cmx_devclass, 0, 0);
PCCARD_PNP_INFO(cmx_pccard_products);

View File

@ -56,6 +56,7 @@ static const struct pccard_product cs_pccard_products[] = {
PCMCIA_CARD(IBM, ETHERJET),
{ NULL }
};
static int
cs_pccard_probe(device_t dev)
{
@ -115,3 +116,4 @@ extern devclass_t cs_devclass;
DRIVER_MODULE(cs, pccard, cs_pccard_driver, cs_devclass, 0, 0);
MODULE_DEPEND(cs, ether, 1, 1, 1);
PCCARD_PNP_INFO(cs_pccard_products);

View File

@ -1248,3 +1248,4 @@ DRIVER_MODULE(ed, pccard, ed_pccard_driver, ed_devclass, 0, NULL);
DRIVER_MODULE(miibus, ed, miibus_driver, miibus_devclass, 0, NULL);
MODULE_DEPEND(ed, miibus, 1, 1, 1);
MODULE_DEPEND(ed, ether, 1, 1, 1);
PCCARD_PNP_INFO(ed_pccard_products);

View File

@ -235,3 +235,4 @@ static driver_t ep_pccard_driver = {
extern devclass_t ep_devclass;
DRIVER_MODULE(ep, pccard, ep_pccard_driver, ep_devclass, 0, 0);
PCCARD_PNP_INFO(ep_pccard_products);

View File

@ -228,3 +228,4 @@ static driver_t ex_pccard_driver = {
DRIVER_MODULE(ex, pccard, ex_pccard_driver, ex_devclass, 0, 0);
MODULE_DEPEND(ex, pccard, 1, 1, 1);
PCCARD_PNP_INFO(ex_pccard_products);

View File

@ -139,3 +139,4 @@ static driver_t fdc_pccard_driver = {
};
DRIVER_MODULE(fdc, pccard, fdc_pccard_driver, fdc_devclass, 0, 0);
PCCARD_PNP_INFO(fdc_pccard_products);

View File

@ -145,6 +145,7 @@ static driver_t fe_pccard_driver = {
DRIVER_MODULE(fe, pccard, fe_pccard_driver, fe_devclass, 0, 0);
MODULE_DEPEND(fe, pccard, 1, 1, 1);
PCCARD_PNP_INFO(fe_pccard_products);
static int fe_probe_mbh(device_t, const struct fe_pccard_product *);
static int fe_probe_tdk(device_t, const struct fe_pccard_product *);

View File

@ -293,6 +293,7 @@ static devclass_t ncv_devclass;
MODULE_DEPEND(ncv, scsi_low, 1, 1, 1);
DRIVER_MODULE(ncv, pccard, ncv_pccard_driver, ncv_devclass, 0, 0);
PCCARD_PNP_INFO(ncv_pccard_products);
static void
ncv_card_unload(device_t devi)

View File

@ -233,6 +233,7 @@ static devclass_t nsp_devclass;
MODULE_DEPEND(nsp, scsi_low, 1, 1, 1);
DRIVER_MODULE(nsp, pccard, nsp_pccard_driver, nsp_devclass, 0, 0);
PCCARD_PNP_INFO(nsp_pccard_products);
static void
nsp_card_unload(device_t devi)

View File

@ -85,6 +85,16 @@ struct pccard_product {
const char *pp_cis[4];
};
/**
* Note: There's no cis3 or cis4 reported for NOMATCH / pnpinfo events for pccard
* It's unclear if we actually need that for automatic loading or not. These stirngs
* are informative, according to the standard, but I have a dim memory of using these
* strings to match things, though I can't find the example right now.
*/
#define PCCARD_PNP_DESCR "D:human;V32:manufacturer;V32:product;Z:cisvendor;Z:cisproduct;"
#define PCCARD_PNP_INFO(t) \
MODULE_PNP_INFO(PCCARD_PNP_DESCR, pccard, t, t, sizeof(t[0]), sizeof(t) / sizeof(t[0])); \
typedef int (*pccard_product_match_fn) (device_t dev,
const struct pccard_product *ent, int vpfmatch);

View File

@ -327,3 +327,4 @@ extern devclass_t sn_devclass;
DRIVER_MODULE(sn, pccard, sn_pccard_driver, sn_devclass, 0, 0);
MODULE_DEPEND(sn, ether, 1, 1, 1);
PCCARD_PNP_INFO(sn_pccard_products);

View File

@ -92,6 +92,7 @@ static driver_t snc_pccard_driver = {
DRIVER_MODULE(snc, pccard, snc_pccard_driver, snc_devclass, 0, 0);
MODULE_DEPEND(snc, ether, 1, 1, 1);
PCCARD_PNP_INFO(snc_pccard_products);
/*
* snc_pccard_detach - detach this instance from the device.

View File

@ -136,3 +136,4 @@ static driver_t stg_pccard_driver = {
DRIVER_MODULE(stg, pccard, stg_pccard_driver, stg_devclass, 0, 0);
MODULE_DEPEND(stg, scsi_low, 1, 1, 1);
PCCARD_PNP_INFO(stg_pccard_products);

View File

@ -55,6 +55,8 @@ static device_method_t uart_pccard_methods[] = {
{ 0, 0 }
};
static uint32_t uart_pccard_function = PCCARD_FUNCTION_SERIAL;
static driver_t uart_pccard_driver = {
uart_driver_name,
uart_pccard_methods,
@ -76,7 +78,7 @@ uart_pccard_probe(device_t dev)
* some serial cards are better serviced by other drivers, so
* allow other drivers to claim it, if they want.
*/
if (fcn == PCCARD_FUNCTION_SERIAL)
if (fcn == uart_pccard_function)
return (BUS_PROBE_GENERIC);
return (ENXIO);
@ -98,3 +100,5 @@ uart_pccard_attach(device_t dev)
}
DRIVER_MODULE(uart, pccard, uart_pccard_driver, uart_devclass, 0, 0);
MODULE_PNP_INFO("U32:function_type;", pccard, uart, &uart_pccard_function,
sizeof(uart_pccard_function), 1);

View File

@ -153,6 +153,7 @@ static const struct pccard_product wi_pccard_products[] = {
PCMCIA_CARD(TDK, LAK_CD011WL),
{ NULL }
};
PCCARD_PNP_INFO(wi_pccard_products);
static int
wi_pccard_probe(device_t dev)

View File

@ -386,3 +386,4 @@ static driver_t xe_pccard_driver = {
devclass_t xe_devclass;
DRIVER_MODULE(xe, pccard, xe_pccard_driver, xe_devclass, 0, 0);
PCCARD_PNP_INFO(xe_pccard_products);

View File

@ -584,14 +584,14 @@ ng_bt3c_rcvdata(hook_p hook, item_p item)
* PC Card (PCMCIA) probe routine
*/
static struct pccard_product const bt3c_pccard_products[] = {
PCMCIA_CARD(3COM, 3CRWB609),
{ NULL, }
};
static int
bt3c_pccard_probe(device_t dev)
{
static struct pccard_product const bt3c_pccard_products[] = {
PCMCIA_CARD(3COM, 3CRWB609),
{ NULL, }
};
struct pccard_product const *pp = NULL;
pp = pccard_product_lookup(dev, bt3c_pccard_products,
@ -1222,4 +1222,4 @@ bt3c_modevent(module_t mod, int event, void *data)
DRIVER_MODULE(bt3c, pccard, bt3c_pccard_driver, bt3c_devclass, bt3c_modevent,0);
MODULE_VERSION(ng_bt3c, NG_BLUETOOTH_VERSION);
MODULE_DEPEND(ng_bt3c, netgraph, NG_ABI_VERSION, NG_ABI_VERSION,NG_ABI_VERSION);
PCCARD_PNP_INFO(bt3c_pccard_products);