Rev 1233 | Rev 1246 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1233 | Rev 1239 | ||
---|---|---|---|
Line 46... | Line 46... | ||
46 | int radeon_connector_table = 0; |
46 | int radeon_connector_table = 0; |
47 | int radeon_tv = 0; |
47 | int radeon_tv = 0; |
Line 48... | Line 48... | ||
48 | 48 | ||
49 | void parse_cmdline(char *cmdline, mode_t *mode, char *log); |
49 | void parse_cmdline(char *cmdline, mode_t *mode, char *log); |
- | 50 | int init_display(struct radeon_device *rdev, mode_t *mode); |
|
- | 51 | int get_modes(mode_t *mode, int *count); |
|
- | 52 | int set_user_mode(mode_t *mode); |
|
Line 50... | Line 53... | ||
50 | int init_display(struct radeon_device *rdev, mode_t *mode); |
53 | |
51 | 54 | ||
52 | /* Legacy VGA regions */ |
55 | /* Legacy VGA regions */ |
53 | #define VGA_RSRC_NONE 0x00 |
56 | #define VGA_RSRC_NONE 0x00 |
Line 644... | Line 647... | ||
644 | // } |
647 | // } |
645 | return 0; |
648 | return 0; |
646 | } |
649 | } |
Line 647... | Line -... | ||
647 | - | ||
648 | - | ||
649 | static struct pci_device_id pciidlist[] = { |
- | |
650 | radeon_PCI_IDS |
- | |
651 | }; |
- | |
652 | - | ||
653 | mode_t usermode; |
- | |
654 | char log[256]; |
- | |
655 | - | ||
656 | u32_t drvEntry(int action, char *cmdline) |
- | |
657 | { |
- | |
658 | struct pci_device_id *ent; |
- | |
659 | - | ||
660 | dev_t device; |
- | |
661 | int err; |
- | |
662 | u32_t retval = 0; |
- | |
663 | - | ||
664 | if(action != 1) |
- | |
665 | return 0; |
- | |
666 | - | ||
667 | if( cmdline && *cmdline ) |
- | |
668 | parse_cmdline(cmdline, &usermode, log); |
- | |
669 | - | ||
670 | if(!dbg_open(log)) |
- | |
671 | { |
- | |
672 | strcpy(log, "/rd/1/drivers/atikms.log"); |
- | |
673 | - | ||
674 | if(!dbg_open(log)) |
- | |
675 | { |
- | |
676 | printf("Can't open %s\nExit\n", log); |
- | |
677 | return 0; |
- | |
678 | }; |
- | |
679 | } |
- | |
680 | - | ||
681 | enum_pci_devices(); |
- | |
682 | - | ||
683 | ent = find_pci_device(&device, pciidlist); |
- | |
684 | - | ||
685 | if( unlikely(ent == NULL) ) |
- | |
686 | { |
- | |
687 | dbgprintf("device not found\n"); |
- | |
688 | return 0; |
- | |
689 | }; |
- | |
690 | - | ||
691 | dbgprintf("device %x:%x\n", device.pci_dev.vendor, |
- | |
692 | device.pci_dev.device); |
- | |
693 | - | ||
694 | err = drm_get_dev(&device.pci_dev, ent); |
- | |
695 | - | ||
696 | return retval; |
- | |
697 | }; |
- | |
698 | - | ||
699 | 650 | ||
700 | 651 | ||
701 | /* |
652 | /* |
702 | * Driver load/unload |
653 | * Driver load/unload |
703 | */ |
654 | */ |
Line 714... | Line 665... | ||
714 | }; |
665 | }; |
Line 715... | Line 666... | ||
715 | 666 | ||
Line 716... | Line 667... | ||
716 | dev->dev_private = (void *)rdev; |
667 | dev->dev_private = (void *)rdev; |
717 | 668 | ||
718 | /* update BUS flag */ |
669 | /* update BUS flag */ |
719 | // if (drm_device_is_agp(dev)) { |
670 | if (drm_device_is_agp(dev)) { |
720 | flags |= RADEON_IS_AGP; |
671 | flags |= RADEON_IS_AGP; |
721 | // } else if (drm_device_is_pcie(dev)) { |
672 | } else if (drm_device_is_pcie(dev)) { |
722 | // flags |= RADEON_IS_PCIE; |
673 | flags |= RADEON_IS_PCIE; |
723 | // } else { |
674 | } else { |
Line 724... | Line 675... | ||
724 | // flags |= RADEON_IS_PCI; |
675 | flags |= RADEON_IS_PCI; |
725 | // } |
676 | } |
726 | 677 | ||
727 | /* radeon_device_init should report only fatal error |
678 | /* radeon_device_init should report only fatal error |
Line 744... | Line 695... | ||
744 | return r; |
695 | return r; |
745 | } |
696 | } |
746 | return 0; |
697 | return 0; |
747 | } |
698 | } |
Line -... | Line 699... | ||
- | 699 | ||
- | 700 | mode_t usermode; |
|
Line 748... | Line 701... | ||
748 | 701 | ||
749 | 702 | ||
750 | int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent) |
703 | int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent) |
751 | { |
704 | { |
Line 846... | Line 799... | ||
846 | 799 | ||
847 | *n = res; |
800 | *n = res; |
848 | return rem; |
801 | return rem; |
Line -... | Line 802... | ||
- | 802 | } |
|
- | 803 | ||
- | 804 | ||
- | 805 | static struct pci_device_id pciidlist[] = { |
|
- | 806 | radeon_PCI_IDS |
|
- | 807 | }; |
|
- | 808 | ||
- | 809 | ||
- | 810 | #define API_VERSION 0x01000100 |
|
- | 811 | ||
- | 812 | #define SRV_GETVERSION 0 |
|
- | 813 | #define SRV_ENUM_MODES 1 |
|
- | 814 | #define SRV_SET_MODE 2 |
|
- | 815 | ||
- | 816 | int _stdcall display_handler(ioctl_t *io) |
|
- | 817 | { |
|
- | 818 | int retval = -1; |
|
- | 819 | u32_t *inp; |
|
- | 820 | u32_t *outp; |
|
- | 821 | ||
- | 822 | inp = io->input; |
|
- | 823 | outp = io->output; |
|
- | 824 | ||
- | 825 | switch(io->io_code) |
|
- | 826 | { |
|
- | 827 | case SRV_GETVERSION: |
|
- | 828 | if(io->out_size==4) |
|
- | 829 | { |
|
- | 830 | *outp = API_VERSION; |
|
- | 831 | retval = 0; |
|
- | 832 | } |
|
- | 833 | break; |
|
- | 834 | ||
- | 835 | case SRV_ENUM_MODES: |
|
- | 836 | dbgprintf("SRV_ENUM_MODES inp %x inp_size %x out_size %x\n", |
|
- | 837 | inp, io->inp_size, io->out_size ); |
|
- | 838 | ||
- | 839 | if( (outp != NULL) && (io->out_size == 4) && |
|
- | 840 | (io->inp_size == *outp * sizeof(mode_t)) ) |
|
- | 841 | { |
|
- | 842 | retval = get_modes((mode_t*)inp, outp); |
|
- | 843 | }; |
|
- | 844 | break; |
|
- | 845 | ||
- | 846 | case SRV_SET_MODE: |
|
- | 847 | if( (inp != NULL) && |
|
- | 848 | (io->inp_size == sizeof(mode_t)) ) |
|
- | 849 | { |
|
- | 850 | retval = set_user_mode((mode_t*)inp); |
|
- | 851 | }; |
|
- | 852 | break; |
|
- | 853 | ||
- | 854 | }; |
|
- | 855 | ||
- | 856 | return retval; |
|
- | 857 | } |
|
- | 858 | ||
- | 859 | u32_t drvEntry(int action, char *cmdline) |
|
- | 860 | { |
|
- | 861 | static char log[256]; |
|
- | 862 | ||
- | 863 | struct pci_device_id *ent; |
|
- | 864 | ||
- | 865 | dev_t device; |
|
- | 866 | int err; |
|
- | 867 | u32_t retval = 0; |
|
- | 868 | ||
- | 869 | if(action != 1) |
|
- | 870 | return 0; |
|
- | 871 | ||
- | 872 | if( GetService("DISPLAY") != 0 ) |
|
- | 873 | return 0; |
|
- | 874 | ||
- | 875 | if( cmdline && *cmdline ) |
|
- | 876 | parse_cmdline(cmdline, &usermode, log); |
|
- | 877 | ||
- | 878 | if(!dbg_open(log)) |
|
- | 879 | { |
|
- | 880 | strcpy(log, "/rd/1/drivers/atikms.log"); |
|
- | 881 | ||
- | 882 | if(!dbg_open(log)) |
|
- | 883 | { |
|
- | 884 | printf("Can't open %s\nExit\n", log); |
|
- | 885 | return 0; |
|
- | 886 | }; |
|
- | 887 | } |
|
- | 888 | ||
- | 889 | enum_pci_devices(); |
|
- | 890 | ||
- | 891 | ent = find_pci_device(&device, pciidlist); |
|
- | 892 | ||
- | 893 | if( unlikely(ent == NULL) ) |
|
- | 894 | { |
|
- | 895 | dbgprintf("device not found\n"); |
|
- | 896 | return 0; |
|
- | 897 | }; |
|
- | 898 | ||
- | 899 | dbgprintf("device %x:%x\n", device.pci_dev.vendor, |
|
- | 900 | device.pci_dev.device); |
|
- | 901 | ||
- | 902 | err = drm_get_dev(&device.pci_dev, ent); |
|
- | 903 | ||
- | 904 | return RegService("DISPLAY", display_handler); |