This is a bare metal forum, not a Linux forum. It would be best if you directed your questions to the Linux forum.
That said, to help point you in the right direction, please look at the
datasheet, section 6. There are only 54 GPIO pins — the same 54 you found with your code. These pins are grouped into two banks, and GPIOs from only one bank are available on the normal Raspberry Pi headers. The compute module breaks out some additional GPIO pins from the other bank.
There's more to it (detailed in the datasheet), but basically the GPIO pins on a bank share an interrupt line. After it fires the kernel automagically maps the shared IRQ into unique kernel IRQ numbers. As you discovered, there is a gpio_to_irq(). There is also a platform specific irq_to_gpio() in mach/gpio.h. That should be all you need to know regarding the mapping of GPIOs to IRQs.