What is the maximum # blocks?

I’m wondering how many blocks I can use?
Is this number fixed by hardware or software?
Where can I find the documentation on it?

Thanks

CUDA C Programming Guide, Appendix G.