Deleted Added
full compact
33c33
< __FBSDID("$FreeBSD: head/sys/dev/pccard/pccard.c 150097 2005-09-13 17:49:47Z imp $");
---
> __FBSDID("$FreeBSD: head/sys/dev/pccard/pccard.c 150098 2005-09-13 17:56:36Z imp $");
1316a1317,1400
> static int
> pccard_attr_read_impl(device_t brdev, device_t child, uint32_t offset,
> uint8_t *val)
> {
> struct pccard_ivar *devi = PCCARD_IVAR(child);
> struct pccard_function *pf = devi->pf;
>
> /*
> * Optimization. Most of the time, devices want to access
> * the same page of the attribute memory that the CCR is in.
> * We take advantage of this fact here.
> */
> if (offset / PCCARD_MEM_PAGE_SIZE ==
> pf->ccr_base / PCCARD_MEM_PAGE_SIZE)
> *val = bus_space_read_1(pf->pf_ccrt, pf->pf_ccrh,
> offset % PCCARD_MEM_PAGE_SIZE);
> else {
> CARD_SET_MEMORY_OFFSET(brdev, child, pf->ccr_rid, offset,
> &offset);
> *val = bus_space_read_1(pf->pf_ccrt, pf->pf_ccrh, offset);
> CARD_SET_MEMORY_OFFSET(brdev, child, pf->ccr_rid, pf->ccr_base,
> &offset);
> }
> return 0;
> }
>
> static int
> pccard_attr_write_impl(device_t brdev, device_t child, uint32_t offset,
> uint8_t val)
> {
> struct pccard_ivar *devi = PCCARD_IVAR(child);
> struct pccard_function *pf = devi->pf;
>
> /*
> * Optimization. Most of the time, devices want to access
> * the same page of the attribute memory that the CCR is in.
> * We take advantage of this fact here.
> */
> if (offset / PCCARD_MEM_PAGE_SIZE ==
> pf->ccr_base / PCCARD_MEM_PAGE_SIZE)
> bus_space_write_1(pf->pf_ccrt, pf->pf_ccrh,
> offset % PCCARD_MEM_PAGE_SIZE, val);
> else {
> CARD_SET_MEMORY_OFFSET(brdev, child, pf->ccr_rid, offset,
> &offset);
> bus_space_write_1(pf->pf_ccrt, pf->pf_ccrh, offset, val);
> CARD_SET_MEMORY_OFFSET(brdev, child, pf->ccr_rid, pf->ccr_base,
> &offset);
> }
>
> return 0;
> }
>
> static int
> pccard_ccr_read_impl(device_t brdev, device_t child, uint32_t offset,
> uint8_t *val)
> {
> struct pccard_ivar *devi = PCCARD_IVAR(child);
>
> *val = pccard_ccr_read(devi->pf, offset);
> device_printf(child, "ccr_read of %#x (%#x) is %#x\n", offset,
> devi->pf->pf_ccr_offset, *val);
> return 0;
> }
>
> static int
> pccard_ccr_write_impl(device_t brdev, device_t child, uint32_t offset,
> uint8_t val)
> {
> struct pccard_ivar *devi = PCCARD_IVAR(child);
> struct pccard_function *pf = devi->pf;
>
> /*
> * Can't use pccard_ccr_write since client drivers may access
> * registers not contained in the 'mask' if they are non-standard.
> */
> device_printf(child, "ccr_write of %#x to %#x (%#x)\n", val, offset,
> devi->pf->pf_ccr_offset);
> bus_space_write_1(pf->pf_ccrt, pf->pf_ccrh, pf->pf_ccr_offset + offset,
> val);
> return 0;
> }
>
>
1348a1433
> DEVMETHOD(card_do_product_lookup, pccard_do_product_lookup),
1351d1435
< DEVMETHOD(card_do_product_lookup, pccard_do_product_lookup),
1352a1437,1440
> DEVMETHOD(card_attr_read, pccard_attr_read_impl),
> DEVMETHOD(card_attr_write, pccard_attr_write_impl),
> DEVMETHOD(card_ccr_read, pccard_ccr_read_impl),
> DEVMETHOD(card_ccr_write, pccard_ccr_write_impl),