Lines Matching full:piod

483 tdfx_query_fetch(u_int cmd, struct tdfx_pio_data *piod)  in tdfx_query_fetch()  argument
494 /*piod->device &= 0xf;*/ in tdfx_query_fetch()
495 if((piod == NULL) ||(tdfx_count <= piod->device) || in tdfx_query_fetch()
496 (piod->device < 0)) { in tdfx_query_fetch()
504 piod->device); in tdfx_query_fetch()
511 switch(piod->port) { in tdfx_query_fetch()
513 if(piod->size != 2) return -EINVAL; in tdfx_query_fetch()
514 return -copyout(&tdfx_info->vendor, piod->value, piod->size); in tdfx_query_fetch()
516 if(piod->size != 2) return -EINVAL; in tdfx_query_fetch()
517 return -copyout(&tdfx_info->type, piod->value, piod->size); in tdfx_query_fetch()
519 if(piod->size != 4) return -EINVAL; in tdfx_query_fetch()
520 return -copyout(&tdfx_info->addr0, piod->value, piod->size); in tdfx_query_fetch()
522 if(piod->size != 4) return -EINVAL; in tdfx_query_fetch()
523 return -copyout(&tdfx_info->addr1, piod->value, piod->size); in tdfx_query_fetch()
525 if(piod->size != 1) return -EINVAL; in tdfx_query_fetch()
528 if(piod->size != 2) return -EINVAL; in tdfx_query_fetch()
531 if(piod->size != 2) return -EINVAL; in tdfx_query_fetch()
534 if(piod->size != 4) return -EINVAL; in tdfx_query_fetch()
537 if(piod->size != 1) return -EINVAL; in tdfx_query_fetch()
540 if(piod->size != 4) return -EINVAL; in tdfx_query_fetch()
547 switch(piod->size) { in tdfx_query_fetch()
549 ret_byte = pci_read_config(tdfx_info[piod->device].dev, in tdfx_query_fetch()
550 piod->port, 1); in tdfx_query_fetch()
551 return -copyout(&ret_byte, piod->value, 1); in tdfx_query_fetch()
553 ret_word = pci_read_config(tdfx_info[piod->device].dev, in tdfx_query_fetch()
554 piod->port, 2); in tdfx_query_fetch()
555 return -copyout(&ret_word, piod->value, 2); in tdfx_query_fetch()
557 ret_dword = pci_read_config(tdfx_info[piod->device].dev, in tdfx_query_fetch()
558 piod->port, 4); in tdfx_query_fetch()
559 return -copyout(&ret_dword, piod->value, 4); in tdfx_query_fetch()
566 tdfx_query_update(u_int cmd, struct tdfx_pio_data *piod) in tdfx_query_update() argument
580 if((piod == NULL) || (piod->device >= (tdfx_count & in tdfx_query_update()
589 piod->device); in tdfx_query_update()
597 switch(piod->port) { in tdfx_query_update()
599 if(piod->size != 2) return -EINVAL; in tdfx_query_update()
602 if(piod->size != 4) return -EINVAL; in tdfx_query_update()
605 if(piod->size != 4) return -EINVAL; in tdfx_query_update()
608 if(piod->size != 4) return -EINVAL; in tdfx_query_update()
611 if(piod->size != 4) return -EINVAL; in tdfx_query_update()
617 retval = pci_read_config(tdfx_info->dev, piod->port & ~3, 4); in tdfx_query_update()
621 switch (piod->size) { in tdfx_query_update()
623 error = copyin(piod->value, &ret_byte, 1); in tdfx_query_update()
626 preval = ret_byte << (8 * (piod->port & 0x3)); in tdfx_query_update()
627 mask = 0xff << (8 * (piod->port & 0x3)); in tdfx_query_update()
630 error = copyin(piod->value, &ret_word, 2); in tdfx_query_update()
633 preval = ret_word << (8 * (piod->port & 0x3)); in tdfx_query_update()
634 mask = 0xffff << (8 * (piod->port & 0x3)); in tdfx_query_update()
637 error = copyin(piod->value, &ret_dword, 4); in tdfx_query_update()
648 pci_write_config(tdfx_info->dev, piod->port & ~3, retval, 4); in tdfx_query_update()
658 tdfx_do_pio_rd(struct tdfx_pio_data *piod) in tdfx_do_pio_rd() argument
664 (struct tdfx_softc*)devclass_get_softc(tdfx_devclass, piod->device); in tdfx_do_pio_rd()
667 if(((piod->port != VGA_INPUT_STATUS_1C) || (piod->port != SC_INDEX) || in tdfx_do_pio_rd()
668 (piod->port != SC_DATA) || (piod->port != VGA_MISC_OUTPUT_READ)) && in tdfx_do_pio_rd()
669 (piod->port < tdfx_info->pio0) && (piod->port > tdfx_info->pio0max)) in tdfx_do_pio_rd()
673 if(piod->size != 1) { in tdfx_do_pio_rd()
678 workport = piod->port; in tdfx_do_pio_rd()
680 return copyout(&ret_byte, piod->value, sizeof(u_int8_t)); in tdfx_do_pio_rd()
684 tdfx_do_pio_wt(struct tdfx_pio_data *piod) in tdfx_do_pio_wt() argument
690 tdfx_softc*)devclass_get_softc(tdfx_devclass, piod->device); in tdfx_do_pio_wt()
693 if(((piod->port != SC_INDEX) && (piod->port != SC_DATA) && in tdfx_do_pio_wt()
694 (piod->port != VGA_MISC_OUTPUT_READ)) /* Can't write VGA_ST_1C */ && in tdfx_do_pio_wt()
695 (piod->port < tdfx_info->pio0) && (piod->port > tdfx_info->pio0max)) in tdfx_do_pio_wt()
699 if(piod->size != 1) { in tdfx_do_pio_wt()
704 int error = -copyin(piod->value, &ret_byte, sizeof(u_int8_t)); in tdfx_do_pio_wt()
706 workport = piod->port; in tdfx_do_pio_wt()
713 tdfx_do_query(u_int cmd, struct tdfx_pio_data *piod) in tdfx_do_query() argument
721 return tdfx_query_fetch(cmd, piod); in tdfx_do_query()
724 return tdfx_query_update(cmd, piod); in tdfx_do_query()
736 tdfx_do_pio(u_int cmd, struct tdfx_pio_data *piod) in tdfx_do_pio() argument
741 return tdfx_do_pio_rd(piod); in tdfx_do_pio()
744 return tdfx_do_pio_wt(piod); in tdfx_do_pio()
771 struct tdfx_pio_data *piod = (struct tdfx_pio_data*)data; in tdfx_ioctl() local
774 piod); in tdfx_ioctl()
781 if((retval = tdfx_do_query(cmd, piod)) > 0) td->td_retval[0] = retval; in tdfx_ioctl()
786 if((tdfx_do_pio(cmd, piod)) > 0) td->td_retval[0] = retval; in tdfx_ioctl()