Make the port number available to the sub-device with PUC_IVAR_PORT.

This commit is contained in:
marcel 2003-09-26 04:44:55 +00:00
parent cd9481b446
commit 0a28e00bd8
2 changed files with 10 additions and 4 deletions

View File

@ -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);
}

View File

@ -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