mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-23 02:05:57 +01:00
pci_min driver
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
1. [dep2](dep2.c)
|
1. [dep2](dep2.c)
|
||||||
1. [character_device](character_device.c)
|
1. [character_device](character_device.c)
|
||||||
1. Hardware device drivers
|
1. Hardware device drivers
|
||||||
|
1. [pci_min](pci_min.c)
|
||||||
1. [pci](pci.c)
|
1. [pci](pci.c)
|
||||||
1. [platform_device](platform_device.c)
|
1. [platform_device](platform_device.c)
|
||||||
1. [user](user/)
|
1. [user](user/)
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
Only tested in x86.
|
Only tested in x86.
|
||||||
|
|
||||||
PCI driver for our minimal pci_min.c QEMU fork device.
|
PCI driver for our minimal pci_min.c QEMU fork device.
|
||||||
|
|
||||||
|
probe already does a mmio write, which generates an IRQ and tests everything.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
|
|||||||
@@ -77,8 +77,8 @@ static int lkmc_platform_device_probe(struct platform_device *pdev)
|
|||||||
dev_err(dev, "of_iomap");
|
dev_err(dev, "of_iomap");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
dev_info(dev, "res.start = %u resource_size = %llx\n",
|
dev_info(dev, "res.start = %llx resource_size = %llx\n",
|
||||||
res.start, (unsigned long long)resource_size(&res));
|
(unsigned long long)res.start, (unsigned long long)resource_size(&res));
|
||||||
|
|
||||||
/* Test MMIO and IRQ. */
|
/* Test MMIO and IRQ. */
|
||||||
iowrite32(0x12345678, map);
|
iowrite32(0x12345678, map);
|
||||||
|
|||||||
2
qemu
2
qemu
Submodule qemu updated: 577f4633f1...22e7e210d6
1
run
1
run
@@ -44,6 +44,7 @@ env \
|
|||||||
HOST_QEMU_OPTS="--enable-debug --enable-sdl --extra-cflags='-DDEBUG_PL061=1' --with-sdlabi=2.0" \
|
HOST_QEMU_OPTS="--enable-debug --enable-sdl --extra-cflags='-DDEBUG_PL061=1' --with-sdlabi=2.0" \
|
||||||
host-qemu-rebuild \
|
host-qemu-rebuild \
|
||||||
linux-rebuild \
|
linux-rebuild \
|
||||||
|
kernel_module-rebuild \
|
||||||
all \
|
all \
|
||||||
;
|
;
|
||||||
cd ..
|
cd ..
|
||||||
|
|||||||
1
runqemu
1
runqemu
@@ -63,6 +63,7 @@ case "$arch" in
|
|||||||
-M pc \
|
-M pc \
|
||||||
-append 'root=/dev/vda $extra_append' \
|
-append 'root=/dev/vda $extra_append' \
|
||||||
-device edu \
|
-device edu \
|
||||||
|
-device lkmc_pci_min \
|
||||||
-drive file=${images_dir}/rootfs.ext2,if=virtio,format=raw \
|
-drive file=${images_dir}/rootfs.ext2,if=virtio,format=raw \
|
||||||
-kernel ${images_dir}/bzImage \
|
-kernel ${images_dir}/bzImage \
|
||||||
-net nic,model=virtio \
|
-net nic,model=virtio \
|
||||||
|
|||||||
Reference in New Issue
Block a user