From 0a28e00bd833bbebb9ce5056dd3e5bf67f16c6b5 Mon Sep 17 00:00:00 2001 From: marcel Date: Fri, 26 Sep 2003 04:44:55 +0000 Subject: [PATCH] Make the port number available to the sub-device with PUC_IVAR_PORT. --- sys/dev/puc/puc.c | 11 ++++++++--- sys/dev/puc/pucvar.h | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/dev/puc/puc.c b/sys/dev/puc/puc.c index 8ba17b10303b..3703ae34810c 100644 --- a/sys/dev/puc/puc.c +++ b/sys/dev/puc/puc.c @@ -105,9 +105,10 @@ __FBSDID("$FreeBSD$"); struct puc_device { struct resource_list resources; + int port; + int regshft; u_int serialfreq; u_int subtype; - int regshft; }; static void puc_intr(void *arg); @@ -331,6 +332,7 @@ puc_attach(device_t dev, const struct puc_device_description *desc) &rle->res->r_bushandle); } + pdev->port = i + 1; pdev->serialfreq = sc->sc_desc.ports[i].serialfreq; pdev->subtype = sc->sc_desc.ports[i].type & PUC_PORT_SUBTYPE_MASK; @@ -598,12 +600,15 @@ puc_read_ivar(device_t dev, device_t child, int index, uintptr_t *result) case PUC_IVAR_FREQ: *result = pdev->serialfreq; break; - case PUC_IVAR_SUBTYPE: - *result = pdev->subtype; + case PUC_IVAR_PORT: + *result = pdev->port; break; case PUC_IVAR_REGSHFT: *result = pdev->regshft; break; + case PUC_IVAR_SUBTYPE: + *result = pdev->subtype; + break; default: return (ENOENT); } diff --git a/sys/dev/puc/pucvar.h b/sys/dev/puc/pucvar.h index 3415c89df7c8..4ea07dcdb1df 100644 --- a/sys/dev/puc/pucvar.h +++ b/sys/dev/puc/pucvar.h @@ -116,7 +116,8 @@ struct puc_device_description { enum puc_device_ivars { PUC_IVAR_FREQ, PUC_IVAR_SUBTYPE, - PUC_IVAR_REGSHFT + PUC_IVAR_REGSHFT, + PUC_IVAR_PORT }; #ifdef PUC_ENTRAILS