Hi Ozgur, My replies in-line. Thanks! From: Ozgur Karatas <ozgurk@xxxxxxxx> Re-hi, On Mon, Apr 11, 2022 at 6:16 PM Chan Kim <ckim@xxxxxxxxxx> wrote:
I guess you got address 0x80000 randomly also may have this code from stackoverflow but it wont work for you. as written stackoverflow, device_create must be a character device and an address under /sys/dev/char before getting NULL. So did you create a char device with use mknod command? ==> (I don’t know how to remove this bar in the lefe when I add my in-line reply in outlook..) it’s the size of address range of my device. My question is, how I can get the io virtual address when 1. my driver is a kernel module and 2. It is a character driver. For platform driver I got it from the resource table, but I think it’s an old method now and we should ask the bus as Greg-KH said. The kernel already knows the addresses because it had processed the device table. Actually register_chrdev will do this for you but you can do it with mknod if you wish.
Please first read Documentation/devices.txt because kernel can do dynamic allocation I think. ==> I understand by using class_create and device_create, the device file is generated under /dev (without using mknod). I am using this method without problem and the app/driver runs ok on the virtual machine.
You dont need to call manual, because it is defined in cdev.h. ==> your link doesn’t show do any io access or irq processing. I want to know how I can get the io virtual address and the virtual irq number from the driver. My driver is a character device driver and it’s a kernel module which is inserted after OS has booted. I thinks this should be possible. in example for example device_destroy already destroys class.
it will be great that i will recommend three books to you again. * Linux Kernel Development ==> Yes I’ve read those books here and there in the past, but you know I’m not given that much time for this and my job isn’t always working with linux drivers. I will take some time to read those books thoroughly sometime later. Thanks for the interest and advices.
|
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies