X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/f6ab9c9ababa2cf6e5c723b83ffb9362094054e8..1375eb51603466b723ab7dd1ca4194ee5d662f75:/lunaix-os/hal/rng/rngx86.c diff --git a/lunaix-os/hal/rng/rngx86.c b/lunaix-os/hal/rng/rngx86.c index aea9b69..5c12ca6 100644 --- a/lunaix-os/hal/rng/rngx86.c +++ b/lunaix-os/hal/rng/rngx86.c @@ -28,11 +28,20 @@ __rand_rd(struct device* dev, void* buf, size_t offset, size_t len) return len; } -void -pdev_randdev_init() +int +pdev_randdev_init(struct device_def* devdef) { - struct device* devrand = device_addseq(NULL, NULL, "rand"); + struct device* devrand = device_allocseq(NULL, NULL); devrand->ops.read = __rand_rd; devrand->ops.read_page = __rand_rd_pg; + + device_register(devrand, &devdef->class, "rand"); + + return 0; } -EXPORT_PSEUDODEV(randdev, pdev_randdev_init); \ No newline at end of file + +static struct device_def devrandx86_def = { + .name = "x86 On-Chip RNG", + .class = DEVCLASS(DEVIF_SOC, DEVFN_CHAR, DEV_RNG), + .init = pdev_randdev_init}; +EXPORT_DEVICE(randdev, &devrandx86_def, load_onboot); \ No newline at end of file